From d4a28eefb08abc5b13d2f13bdde57d53d37e4d34 Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Tue, 3 Apr 2012 02:21:27 +0200 Subject: Core/Arenas/Dalaran Sewers: Fixed waterFallKnockbackTimer and set more blizzlike values --- src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp | 3 --- src/server/game/Battlegrounds/Zones/BattlegroundDS.h | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 8a11edf85e6..dcb6e668de8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -88,9 +88,6 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff) } else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and perform knockback { - if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[BG_DS_NPC_WATERFALL_KNOCKBACK])) - waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true); - if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1])) gob->SetGoState(GO_STATE_READY); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 12ed91fc922..8df01e6415c 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -66,9 +66,9 @@ enum BattlegroundDSData { // These values are NOT blizzlike... need the correct data! BG_DS_WATERFALL_TIMER_MIN = 30000, BG_DS_WATERFALL_TIMER_MAX = 60000, - BG_DS_WATERFALL_WARNING_DURATION = 7000, - BG_DS_WATERFALL_DURATION = 10000, - BG_DS_WATERFALL_KNOCKBACK_TIMER = 500, + BG_DS_WATERFALL_WARNING_DURATION = 2000, + BG_DS_WATERFALL_DURATION = 30000, + BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500, BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000, BG_DS_PIPE_KNOCKBACK_DELAY = 3000, @@ -118,7 +118,7 @@ class BattlegroundDS : public Battleground void setWaterFallStatus(uint8 status) { _waterfallStatus = status; }; uint32 getWaterFallTimer() { return _waterfallTimer; }; void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; }; - uint32 getWaterFallKnockbackTimer() { return _waterfallTimer; }; + uint32 getWaterFallKnockbackTimer() { return _waterfallKnockbackTimer; }; void setWaterFallKnockbackTimer(uint32 timer) { _waterfallKnockbackTimer = timer; }; uint8 getPipeKnockBackCount() { return _pipeKnockBackCount; }; void setPipeKnockBackCount(uint8 count) { _pipeKnockBackCount = count; }; -- cgit v1.2.3 From 11c183fd1f481c1d02f5567237ba6ef5122a0f30 Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Tue, 3 Apr 2012 20:44:22 +0200 Subject: Core/Arenas/Dalaran Sewers: Set more blizzlike waterfall warning timer value. Thanks Souler --- src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp | 2 +- src/server/game/Battlegrounds/Zones/BattlegroundDS.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index dcb6e668de8..ccc6a2305b4 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -86,7 +86,7 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff) setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION); setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING); } - else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and perform knockback + else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and start knockback timer { if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1])) gob->SetGoState(GO_STATE_READY); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 8df01e6415c..aaf08ba1313 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -66,7 +66,7 @@ enum BattlegroundDSData { // These values are NOT blizzlike... need the correct data! BG_DS_WATERFALL_TIMER_MIN = 30000, BG_DS_WATERFALL_TIMER_MAX = 60000, - BG_DS_WATERFALL_WARNING_DURATION = 2000, + BG_DS_WATERFALL_WARNING_DURATION = 5000, BG_DS_WATERFALL_DURATION = 30000, BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500, -- cgit v1.2.3 From 7e793575be1748e244382225b23731de8b771e00 Mon Sep 17 00:00:00 2001 From: cookta2012 Date: Thu, 5 Apr 2012 17:43:06 -0500 Subject: Moving a commands around eliminating a unnecessary file, and porting the "demorph" command * moved the "wpgps" command into the cs_debug.cpp because it seems more fitting * organized the "modify speed" commands into a table of their own * moved the "gps" command into the cs_misc.cpp --- sql/updates/world/2012_04_04_00_world_command.sql | 10 ++ src/server/game/Chat/Chat.cpp | 1 - src/server/game/Chat/Commands/Level2.cpp | 16 --- src/server/game/Scripting/ScriptLoader.cpp | 2 - src/server/scripts/Commands/CMakeLists.txt | 1 - src/server/scripts/Commands/cs_debug.cpp | 11 ++ src/server/scripts/Commands/cs_gps.cpp | 144 ---------------------- src/server/scripts/Commands/cs_misc.cpp | 90 +++++++++++++- src/server/scripts/Commands/cs_modify.cpp | 40 ++++-- 9 files changed, 141 insertions(+), 174 deletions(-) create mode 100644 sql/updates/world/2012_04_04_00_world_command.sql delete mode 100644 src/server/scripts/Commands/cs_gps.cpp (limited to 'src') diff --git a/sql/updates/world/2012_04_04_00_world_command.sql b/sql/updates/world/2012_04_04_00_world_command.sql new file mode 100644 index 00000000000..9adb3cff1d9 --- /dev/null +++ b/sql/updates/world/2012_04_04_00_world_command.sql @@ -0,0 +1,10 @@ +DELETE FROM `command` WHERE `name` IN ('modify tp','modify bwalk','modify swim','modify fly','modify arena','modify aspeed','modify morph'); +INSERT INTO `command` (`name`, `security`, `help`) VALUES ('modify speed all', 1, 'Syntax: .modify aspeed #rate\r\n\r\nModify all speeds -run,swim,run back,swim back- of the selected player to "normalbase speed for this move type"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify speed backwalk', 1, 'Syntax: .modify speed backwalk #rate\r\n\r\nModify the speed of the selected player while running backwards to "normal walk back speed"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify speed fly', 1, '.modify speed fly #rate\nModify the flying speed of the selected player to "normal flying speed"*rate. If no player is selected, modify your speed.\n #rate may range from 0.1 to 50.'), +('modify speed swim', 1, 'Syntax: .modify speed swim #rate\r\n\r\nModify the swim speed of the selected player to "normal swim speed"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify speed walk', 1, 'Syntax: .modify speed bwalk #rate\r\n\r\nModify the speed of the selected player while running to "normal walk speed"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify talentpoints', 1, 'Syntax: .modify talentpoints #amount\r\n\r\nSet free talent points for selected character or character\'s pet. It will be reset to default expected at next levelup/login/quest reward.'), +('morph', 2, 'Syntax: .morph #displayid\r\n\r\nChange your current model id to #displayid.'), +('modify arenapoints', 1, 'Syntax: .modify arenapoints #value\r\nAdd $amount arena points to the selected player.'); +UPDATE `command` SET `help`='Syntax: .modify speed $speedtype #rate\r\n\r\nModify the running speed of the selected player to "normal base run speed"= 1. If no player is selected, modify your speed.\r\n\r\n$speedtypes may be fly, all, walk, backwalk, or swim.\r\n\r\n #rate may range from 0.1 to 50.' WHERE `name`='modify speed' LIMIT 1; \ No newline at end of file diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 7a4c17d1c5e..48bb4c27ef8 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -359,7 +359,6 @@ ChatCommand* ChatHandler::getCommandTable() { "summon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleSummonCommand>, "", NULL }, { "groupsummon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleGroupSummonCommand>, "", NULL }, { "commands", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleCommandsCommand>, "", NULL }, - { "demorph", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleDeMorphCommand>, "", NULL }, { "die", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDieCommand>, "", NULL }, { "revive", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleReviveCommand>, "", NULL }, { "dismount", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleDismountCommand>, "", NULL }, diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index cc638193b5a..52bdcd15163 100755 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -205,22 +205,6 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) return true; } -//demorph player or unit -bool ChatHandler::HandleDeMorphCommand(const char* /*args*/) -{ - Unit* target = getSelectedUnit(); - if (!target) - target = m_session->GetPlayer(); - - // check online security - else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0)) - return false; - - target->DeMorph(); - - return true; -} - //kick player bool ChatHandler::HandleKickPlayerCommand(const char *args) { diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 76c3f1c073c..8e95f1a05cd 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -61,7 +61,6 @@ void AddSC_reload_commandscript(); void AddSC_tele_commandscript(); void AddSC_titles_commandscript(); void AddSC_wp_commandscript(); -void AddSC_gps_commandscript(); #ifdef SCRIPTS //world @@ -663,7 +662,6 @@ void AddCommandScripts() AddSC_tele_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); - AddSC_gps_commandscript(); } void AddWorldScripts() diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index d14e71aac4a..86fe984e197 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -17,7 +17,6 @@ set(scripts_STAT_SRCS Commands/cs_gm.cpp Commands/cs_go.cpp Commands/cs_gobject.cpp - Commands/cs_gps.cpp Commands/cs_honor.cpp Commands/cs_learn.cpp Commands/cs_misc.cpp diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 679bb450800..c7bcde01e9b 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -95,6 +95,7 @@ public: static ChatCommand commandTable[] = { { "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable }, + { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; return commandTable; @@ -1319,6 +1320,16 @@ public: return true; } + + static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + + handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); + return true; + } }; void AddSC_debug_commandscript() diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp deleted file mode 100644 index 59e2ec90905..00000000000 --- a/src/server/scripts/Commands/cs_gps.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * - * 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 . - */ - -/* ScriptData -Name: gps_commandscript -%Complete: 100 -Comment: GPS/WPGPS commands -Category: commandscripts -EndScriptData */ - -#include "ObjectAccessor.h" -#include "ScriptMgr.h" -#include "Chat.h" -#include "CellImpl.h" - -class gps_commandscript : public CommandScript -{ -public: - gps_commandscript() : CommandScript("gps_commandscript") { } - - ChatCommand* GetCommands() const - { - static ChatCommand commandTable[] = - { - { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, - { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - return commandTable; - } - - static bool HandleGPSCommand(ChatHandler* handler, char const* args) - { - WorldObject* object = NULL; - if (*args) - { - uint64 guid = handler->extractGuidFromLink((char*)args); - if (guid) - object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); - - if (!object) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - object = handler->getSelectedUnit(); - - if (!object) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - } - - CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); - Cell cell(cellCoord); - - uint32 zoneId, areaId; - object->GetZoneAndAreaId(zoneId, areaId); - - MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); - AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); - - float zoneX = object->GetPositionX(); - float zoneY = object->GetPositionY(); - - Map2ZoneCoordinates(zoneX, zoneY, zoneId); - - Map const* map = object->GetMap(); - float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); - float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); - - GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); - - // 63? WHY? - int gridX = 63 - gridCoord.x_coord; - int gridY = 63 - gridCoord.y_coord; - - uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - - if (haveVMap) - { - if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) - handler->PSendSysMessage("You are outdoors"); - else - handler->PSendSysMessage("You are indoors"); - } - else - handler->PSendSysMessage("no VMAP available for area info"); - - handler->PSendSysMessage(LANG_MAP_POSITION, - object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : ""), - zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : ""), - areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : ""), - object->GetPhaseMask(), - object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), - cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), - zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); - - LiquidData liquidStatus; - ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); - - if (status) - handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); - - return true; - } - - static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); - - handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); - return true; - } -}; - -void AddSC_gps_commandscript() -{ - new gps_commandscript(); -} diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 5f0434e5c55..7c431566f52 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -17,6 +17,9 @@ #include "ScriptPCH.h" #include "Chat.h" +#include "ObjectAccessor.h" +#include "ScriptMgr.h" +#include "CellImpl.h" class misc_commandscript : public CommandScript { @@ -27,7 +30,8 @@ public: { static ChatCommand commandTable[] = { - { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL }, + { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL }, + { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; return commandTable; @@ -64,6 +68,90 @@ public: handler->SetSentErrorMessage(true); return false; } + + static bool HandleGPSCommand(ChatHandler* handler, char const* args) + { + WorldObject* object = NULL; + if (*args) + { + uint64 guid = handler->extractGuidFromLink((char*)args); + if (guid) + object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); + + if (!object) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + object = handler->getSelectedUnit(); + + if (!object) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + } + + CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); + Cell cell(cellCoord); + + uint32 zoneId, areaId; + object->GetZoneAndAreaId(zoneId, areaId); + + MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); + AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); + + float zoneX = object->GetPositionX(); + float zoneY = object->GetPositionY(); + + Map2ZoneCoordinates(zoneX, zoneY, zoneId); + + Map const* map = object->GetMap(); + float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); + float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); + + GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); + + // 63? WHY? + int gridX = 63 - gridCoord.x_coord; + int gridY = 63 - gridCoord.y_coord; + + uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; + uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; + + if (haveVMap) + { + if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) + handler->PSendSysMessage("You are outdoors"); + else + handler->PSendSysMessage("You are indoors"); + } + else + handler->PSendSysMessage("no VMAP available for area info"); + + handler->PSendSysMessage(LANG_MAP_POSITION, + object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : ""), + zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : ""), + areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : ""), + object->GetPhaseMask(), + object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), + cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), + zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); + + LiquidData liquidStatus; + ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); + + if (status) + handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); + + return true; + } }; void AddSC_misc_commandscript() diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 32ee96dacfe..f62c434e2e5 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -33,6 +33,16 @@ public: ChatCommand* GetCommands() const { + static ChatCommand modifyspeedCommandTable[] = + { + { "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL }, + { "all", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, + { "walk", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL }, + { "backwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL }, + { "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL }, + { "", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand modifyCommandTable[] = { { "hp", SEC_MODERATOR, false, &HandleModifyHPCommand, "", NULL }, @@ -41,29 +51,26 @@ public: { "runicpower", SEC_MODERATOR, false, &HandleModifyRunicPowerCommand, "", NULL }, { "energy", SEC_MODERATOR, false, &HandleModifyEnergyCommand, "", NULL }, { "money", SEC_MODERATOR, false, &HandleModifyMoneyCommand, "", NULL }, - { "speed", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL }, - { "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL }, { "scale", SEC_MODERATOR, false, &HandleModifyScaleCommand, "", NULL }, { "bit", SEC_MODERATOR, false, &HandleModifyBitCommand, "", NULL }, - { "bwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL }, - { "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL }, - { "aspeed", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, { "faction", SEC_MODERATOR, false, &HandleModifyFactionCommand, "", NULL }, { "spell", SEC_MODERATOR, false, &HandleModifySpellCommand, "", NULL }, - { "tp", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL }, + { "talentpoints", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL }, { "mount", SEC_MODERATOR, false, &HandleModifyMountCommand, "", NULL }, { "honor", SEC_MODERATOR, false, &HandleModifyHonorCommand, "", NULL }, - { "rep", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL }, - { "arena", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL }, + { "reputation", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL }, + { "arenapoints", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL }, { "drunk", SEC_MODERATOR, false, &HandleModifyDrunkCommand, "", NULL }, { "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL }, - { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL }, { "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL }, { "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL }, + { "speed", SEC_MODERATOR, false, NULL, "", modifyspeedCommandTable }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { + { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL }, + { "demorph", SEC_GAMEMASTER, false, &HandleDeMorphCommand, "", NULL }, { "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable }, { NULL, 0, false, NULL, "", NULL } }; @@ -1374,6 +1381,21 @@ public: if (handler->needReportToTarget(target)) (ChatHandler(target)).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, handler->GetNameLink().c_str()); + return true; + } +//demorph player or unit + static bool HandleDeMorphCommand(ChatHandler* handler, const char* /*args*/) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + target = handler->GetSession()->GetPlayer(); + + // check online security + else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) + return false; + + target->DeMorph(); + return true; } }; -- cgit v1.2.3 From 26ff19dbf82ab252aa83eba18f8786452d83d292 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 11 Apr 2012 13:40:17 +0200 Subject: Scripts/Silithus: Fix crash when doing "A Pawn on the Eternal Board" Closes #6156 --- src/server/scripts/Kalimdor/silithus.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index 2e6234c3269..2d91f32fe9d 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -972,17 +972,15 @@ public: void SummonNextWave() { - //uint8 count = WavesInfo[WaveCount].SpawnCount; uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; - //uint8 KaldoreiSoldierCount = 0; - //uint8 AnubisathConquerorCount = 0; - //uint8 QirajiWaspCount = 0; - for (uint8 i = 0; i < 67; ++i) + uint8 count = locIndex + WavesInfo[WaveCount].SpawnCount; + + for (uint8 i = locIndex; i <= count; ++i) { - float x = SpawnLocation[locIndex + i].x; - float y = SpawnLocation[locIndex + i].y; - float z = SpawnLocation[locIndex + i].z; - float o = SpawnLocation[locIndex + i].o; + float x = SpawnLocation[i].x; + float y = SpawnLocation[i].y; + float z = SpawnLocation[i].z; + float o = SpawnLocation[i].o; uint32 desptimer = WavesInfo[WaveCount].DespTimer; if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer)) @@ -1004,6 +1002,7 @@ public: } } } + WaveTimer = WavesInfo[WaveCount].SpawnTimer; AnnounceTimer = WavesInfo[WaveCount].YellTimer; } -- cgit v1.2.3 From 7cc2c6109ac210bc0d34cc612e6b429136cb5f11 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 11 Apr 2012 10:24:51 -0400 Subject: Core/Spells: Fix vigilance taunt cooldown spell targeting. cleanup some whitespace --- src/server/game/Entities/Unit/Unit.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 52269199146..d5db4ca9714 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4499,7 +4499,7 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) AddPctN(multiplier, (*i)->GetAmount()); } - + for (std::map::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) AddPctN(multiplier, itr->second); @@ -4546,7 +4546,7 @@ int32 Unit::GetTotalAuraModifierByAffectMask(AuraType auratype, SpellInfo const* if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) modifier += (*i)->GetAmount(); } - + for (std::map::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) modifier += itr->second; @@ -8322,6 +8322,12 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg RemoveAuraFromStack(auraSpellInfo->Id); return false; } + if (auraSpellInfo->Id == 50720) + { + target = triggeredByAura->GetCaster(); + if (!target) + return false; + } break; case SPELLFAMILY_WARLOCK: { @@ -9551,7 +9557,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) if (this->GetTypeId() == TYPEID_PLAYER) { Pet* playerPet = this->ToPlayer()->GetPet(); - + if (playerPet && playerPet->isAlive()) playerPet->AI()->OwnerAttacked(victim); } -- cgit v1.2.3 From 0506877e2accabfe2c0acce6a2c4d0066e0c321b Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 11 Apr 2012 17:52:44 +0200 Subject: Core/Vehicles: Use DespawnOrUnsummon in Vehicle::Dismiss to call AI despawn hooks. --- src/server/game/Entities/Vehicle/Vehicle.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index f3d6e8abc79..4ce05ff40d3 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -453,11 +453,12 @@ void Vehicle::RelocatePassengers(float x, float y, float z, float ang) void Vehicle::Dismiss() { + if (GetBase()->GetTypeId() != TYPEID_UNIT) + return; + sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Dismiss Entry: %u, GuidLow %u", _creatureEntry, _me->GetGUIDLow()); Uninstall(); - _me->DestroyForNearbyPlayers(); - _me->CombatStop(); - _me->AddObjectToRemoveList(); + GetBase()->ToCreature()->DespawnOrUnsummon(); } void Vehicle::InitMovementInfoForBase() -- cgit v1.2.3 From be5b91f6bb9f98d40723807a03da6dc00d6b6aff Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 11 Apr 2012 17:53:55 +0200 Subject: Scripts/Icecrown Citadel: Fixed crashes on despawning abominations during Professor Putricide's phase transition --- .../IcecrownCitadel/boss_professor_putricide.cpp | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index b66632b6eeb..541e52fb922 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -167,6 +167,33 @@ enum PutricideData #define EXPERIMENT_STATE_OOZE false #define EXPERIMENT_STATE_GAS true +class AbominationDespawner +{ + public: + explicit AbominationDespawner(Unit* owner) : _owner(owner) { } + + bool operator()(uint64 guid) + { + if (Unit* summon = ObjectAccessor::GetUnit(*_owner, guid)) + { + if (summon->GetEntry() == NPC_MUTATED_ABOMINATION_10 || summon->GetEntry() == NPC_MUTATED_ABOMINATION_25) + { + if (Vehicle* veh = summon->GetVehicleKit()) + veh->RemoveAllPassengers(); // also despawns the vehicle + + return true; + } + + return false; + } + + return true; + } + + private: + Unit* _owner; +}; + class boss_professor_putricide : public CreatureScript { public: @@ -477,8 +504,7 @@ class boss_professor_putricide : public CreatureScript SetPhase(PHASE_COMBAT_3); events.ScheduleEvent(EVENT_MUTATED_PLAGUE, 25000); events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT); - summons.DespawnEntry(NPC_MUTATED_ABOMINATION_10); - summons.DespawnEntry(NPC_MUTATED_ABOMINATION_25); + summons.remove_if(AbominationDespawner(me)); break; default: break; -- cgit v1.2.3 From 6407582667f92018a57ff7607f5e353d9079d1fa Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 11 Apr 2012 11:56:35 -0400 Subject: Core/Attributes: change some attribute names to better describe what they are --- src/server/game/Miscellaneous/SharedDefines.h | 22 +++++++++++----------- src/server/game/Spells/SpellMgr.cpp | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 1ddf80484e2..22f0ea35413 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -269,7 +269,7 @@ enum SpellAttr0 SPELL_ATTR0_UNK0 = 0x00000001, // 0 SPELL_ATTR0_REQ_AMMO = 0x00000002, // 1 on next ranged SPELL_ATTR0_ON_NEXT_SWING = 0x00000004, // 2 - SPELL_ATTR0_UNK3 = 0x00000008, // 3 not set in 3.0.3 + SPELL_ATTR0_IS_REPLENISHMENT = 0x00000008, // 3 not set in 3.0.3 SPELL_ATTR0_ABILITY = 0x00000010, // 4 client puts 'ability' instead of 'spell' in game strings for these spells SPELL_ATTR0_TRADESPELL = 0x00000020, // 5 trade spells (recipes), will be added by client to a sublist of profession spell SPELL_ATTR0_PASSIVE = 0x00000040, // 6 Passive spell @@ -314,7 +314,7 @@ enum SpellAttr1 SPELL_ATTR1_MELEE_COMBAT_START = 0x00000200, // 9 player starts melee combat after this spell is cast SPELL_ATTR1_NO_THREAT = 0x00000400, // 10 no generates threat on cast 100% (old NO_INITIAL_AGGRO) SPELL_ATTR1_UNK11 = 0x00000800, // 11 aura - SPELL_ATTR1_UNK12 = 0x00001000, // 12 pickpoket + SPELL_ATTR1_IS_PICKPOCKET = 0x00001000, // 12 Pickpocket SPELL_ATTR1_FARSIGHT = 0x00002000, // 13 Client removes farsight on aura loss SPELL_ATTR1_CHANNEL_TRACK_TARGET = 0x00004000, // 14 Client automatically forces player to face target when channeling SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY = 0x00008000, // 15 remove auras on immunity @@ -326,7 +326,7 @@ enum SpellAttr1 SPELL_ATTR1_UNK21 = 0x00200000, // 21 SPELL_ATTR1_REQ_COMBO_POINTS2 = 0x00400000, // 22 Req combo points on target SPELL_ATTR1_UNK23 = 0x00800000, // 23 - SPELL_ATTR1_UNK24 = 0x01000000, // 24 only fishing spells + SPELL_ATTR1_IS_FISHING = 0x01000000, // 24 only fishing spells SPELL_ATTR1_UNK25 = 0x02000000, // 25 SPELL_ATTR1_UNK26 = 0x04000000, // 26 works correctly with [target=focus] and [target=mouseover] macros? SPELL_ATTR1_UNK27 = 0x08000000, // 27 melee spell? @@ -351,17 +351,17 @@ enum SpellAttr2 SPELL_ATTR2_UNK10 = 0x00000400, // 10 related to tame SPELL_ATTR2_HEALTH_FUNNEL = 0x00000800, // 11 SPELL_ATTR2_UNK12 = 0x00001000, // 12 Cleave, Heart Strike, Maul, Sunder Armor, Swipe - SPELL_ATTR2_UNK13 = 0x00002000, // 13 Items enchanted by spells with this flag preserve the enchant to arenas + SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA = 0x00002000, // 13 Items enchanted by spells with this flag preserve the enchant to arenas SPELL_ATTR2_UNK14 = 0x00004000, // 14 SPELL_ATTR2_UNK15 = 0x00008000, // 15 not set in 3.0.3 SPELL_ATTR2_TAME_BEAST = 0x00010000, // 16 SPELL_ATTR2_NOT_RESET_AUTO_ACTIONS = 0x00020000, // 17 don't reset timers for melee autoattacks (swings) or ranged autoattacks (autoshoots) - SPELL_ATTR2_UNK18 = 0x00040000, // 18 Only Revive pet - possible req dead pet + SPELL_ATTR2_REQ_DEAD_PET = 0x00040000, // 18 Only Revive pet and Heart of the Pheonix SPELL_ATTR2_NOT_NEED_SHAPESHIFT = 0x00080000, // 19 does not necessarly need shapeshift SPELL_ATTR2_UNK20 = 0x00100000, // 20 SPELL_ATTR2_DAMAGE_REDUCED_SHIELD = 0x00200000, // 21 for ice blocks, pala immunity buffs, priest absorb shields, but used also for other spells -> not sure! SPELL_ATTR2_UNK22 = 0x00400000, // 22 Ambush, Backstab, Cheap Shot, Death Grip, Garrote, Judgements, Mutilate, Pounce, Ravage, Shiv, Shred - SPELL_ATTR2_UNK23 = 0x00800000, // 23 Only mage Arcane Concentration have this flag + SPELL_ATTR2_IS_ARCANE_CONCENTRATION = 0x00800000, // 23 Only mage Arcane Concentration have this flag SPELL_ATTR2_UNK24 = 0x01000000, // 24 SPELL_ATTR2_UNK25 = 0x02000000, // 25 SPELL_ATTR2_UNK26 = 0x04000000, // 26 unaffected by school immunity @@ -388,7 +388,7 @@ enum SpellAttr3 SPELL_ATTR3_BATTLEGROUND = 0x00000800, // 11 Can casted only on battleground SPELL_ATTR3_ONLY_TARGET_GHOSTS = 0x00001000, // 12 SPELL_ATTR3_UNK13 = 0x00002000, // 13 - SPELL_ATTR3_UNK14 = 0x00004000, // 14 "Honorless Target" only this spells have this flag + SPELL_ATTR3_IS_HONORLESS_TARGET = 0x00004000, // 14 "Honorless Target" only this spells have this flag SPELL_ATTR3_UNK15 = 0x00008000, // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag SPELL_ATTR3_CANT_TRIGGER_PROC = 0x00010000, // 16 confirmed with many patchnotes SPELL_ATTR3_NO_INITIAL_AGGRO = 0x00020000, // 17 Soothe Animal, 39758, Mind Soothe @@ -432,16 +432,16 @@ enum SpellAttr4 SPELL_ATTR4_UNK19 = 0x00080000, // 19 proc dalayed, after damage or don't proc on absorb? SPELL_ATTR4_NOT_CHECK_SELFCAST_POWER = 0x00100000, // 20 supersedes message "More powerful spell applied" for self casts. SPELL_ATTR4_UNK21 = 0x00200000, // 21 Pally aura, dk presence, dudu form, warrior stance, shadowform, hunter track - SPELL_ATTR4_UNK22 = 0x00400000, // 22 + SPELL_ATTR4_UNK22 = 0x00400000, // 22 Seal of Command (42058,57770) and Gymer's Smash 55426 SPELL_ATTR4_UNK23 = 0x00800000, // 23 SPELL_ATTR4_UNK24 = 0x01000000, // 24 some shoot spell - SPELL_ATTR4_UNK25 = 0x02000000, // 25 pet scaling auras + SPELL_ATTR4_IS_PET_SCALING = 0x02000000, // 25 pet scaling auras SPELL_ATTR4_CAST_ONLY_IN_OUTLAND = 0x04000000, // 26 Can only be used in Outland. SPELL_ATTR4_UNK27 = 0x08000000, // 27 SPELL_ATTR4_UNK28 = 0x10000000, // 28 Aimed Shot SPELL_ATTR4_UNK29 = 0x20000000, // 29 SPELL_ATTR4_UNK30 = 0x40000000, // 30 - SPELL_ATTR4_UNK31 = 0x80000000 // 31 + SPELL_ATTR4_UNK31 = 0x80000000 // 31 Polymorph (chicken) 228 and Sonic Boom (38052,38488) }; enum SpellAttr5 @@ -461,7 +461,7 @@ enum SpellAttr5 SPELL_ATTR5_UNK12 = 0x00001000, // 12 Cleave related? SPELL_ATTR5_HASTE_AFFECT_DURATION = 0x00002000, // 13 haste effects decrease duration of this SPELL_ATTR5_UNK14 = 0x00004000, // 14 - SPELL_ATTR5_UNK15 = 0x00008000, // 15 + SPELL_ATTR5_UNK15 = 0x00008000, // 15 Inflits on multiple targets? SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index cf200f19010..80ed1972a5d 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2094,7 +2094,7 @@ void SpellMgr::LoadEnchantCustomAttr() continue; // TODO: find a better check - if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_UNK13) || !(spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)) + if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA) || !(spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)) continue; for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) -- cgit v1.2.3 From f9ae8e68107d9ab4cb72b2e2d7e5c92f674ed146 Mon Sep 17 00:00:00 2001 From: faramir118 Date: Wed, 11 Apr 2012 19:51:26 +0200 Subject: Core/DBLayer: incorrect use of va_start Signed-off-by: Machiavelli --- src/server/shared/Database/DatabaseWorkerPool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 5fe31006bb2..8b69accfc23 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -239,7 +239,7 @@ class DatabaseWorkerPool va_list ap; char szQuery[MAX_QUERY_LEN]; - va_start(ap, sql); + va_start(ap, conn); vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap); va_end(ap); -- cgit v1.2.3 From c7927a7796525b958140b0f58bd08851c9215ed3 Mon Sep 17 00:00:00 2001 From: faramir118 Date: Wed, 11 Apr 2012 19:54:35 +0200 Subject: Tools/MapExtractor: proper type for string literals Signed-off-by: Machiavelli --- src/tools/map_extractor/System.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index bbde9f4675e..cf2f2188a70 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -71,7 +71,7 @@ float CONF_flat_height_delta_limit = 0.005f; // If max - min less this value - s float CONF_flat_liquid_delta_limit = 0.001f; // If max - min less this value - liquid surface is flat // List MPQ for extract from -char *CONF_mpq_list[]={ +const char *CONF_mpq_list[]={ "common.MPQ", "common-2.MPQ", "lichking.MPQ", @@ -83,7 +83,7 @@ char *CONF_mpq_list[]={ "patch-5.MPQ", }; -static char* const langs[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }; +static const char* const langs[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }; #define LANG_COUNT 12 void CreateDir( const std::string& Path ) -- cgit v1.2.3 From c09cd267390a0b4a8c0a8643d193ebbaf4dadb79 Mon Sep 17 00:00:00 2001 From: faramir118 Date: Sat, 17 Mar 2012 01:39:41 -0500 Subject: wrong signature in a few overrides --- .../Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp | 4 ++-- .../CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index dabf3db13cb..2c8cd096644 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -116,9 +116,9 @@ public: DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0); } - bool IsEncounterInProgress() + bool IsEncounterInProgress() const { - if (GetData(TYPE_MEDIVH) == IN_PROGRESS) + if (const_cast(this)->GetData(TYPE_MEDIVH) == IN_PROGRESS) return true; return false; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 74b9c038482..6252812e10a 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -759,7 +759,7 @@ class spell_powering_up : public SpellScriptLoader uint32 spellId; - bool Validate(SpellEntry const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellEntry*/) { spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster()); if (!sSpellMgr->GetSpellInfo(spellId)) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 33415cda157..462c767f599 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1273,7 +1273,7 @@ class go_ulduar_tower : public GameObjectScript public: go_ulduar_tower() : GameObjectScript("go_ulduar_tower") { } - void OnDestroyed(GameObject* go, Player* /*player*/, uint32 /*value*/) + void OnDestroyed(GameObject* go, Player* /*player*/) { InstanceScript* instance = go->GetInstanceScript(); if (!instance) -- cgit v1.2.3 From e3f198ca568e270017585370bca972230dcf67f7 Mon Sep 17 00:00:00 2001 From: faramir118 Date: Sat, 17 Mar 2012 01:40:33 -0500 Subject: couple wrong return types --- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 4 ++-- src/server/game/Chat/Chat.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 0f0e2e416a2..096ee695bcf 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -177,11 +177,11 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec { //No target so we can't cast if (!target) - return false; + return NULL; //Silenced so we can't cast if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) - return false; + return NULL; //Using the extended script system we first create a list of viable spells SpellInfo const* apSpell[CREATURE_MAX_SPELLS]; diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 7a4c17d1c5e..22969601c32 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -1335,7 +1335,7 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text) // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r char* cId = extractKeyFromLink(text, "Htele"); if (!cId) - return false; + return NULL; // id case (explicit or from shift link) if (cId[0] >= '0' || cId[0] >= '9') @@ -1507,7 +1507,7 @@ char* ChatHandler::extractQuotedArg(char* args) { char* space = strtok(args, "\""); if (!space) - return false; + return NULL; return strtok(NULL, "\""); } } -- cgit v1.2.3 From d3c9817c601f1afd3f441d2ad5848fdc939d6936 Mon Sep 17 00:00:00 2001 From: faramir118 Date: Sat, 17 Mar 2012 01:45:31 -0500 Subject: make some dtors virtual this will prevent potential for future memory leaks --- src/server/game/Grids/GridStates.h | 1 + src/server/game/Warden/Warden.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h index 08b66f6bb35..cf649f8d896 100755 --- a/src/server/game/Grids/GridStates.h +++ b/src/server/game/Grids/GridStates.h @@ -40,6 +40,7 @@ class GridState void setMagic() { i_Magic = MAGIC_TESTVAL; } unsigned int i_Magic; #endif + virtual ~GridState() {}; virtual void Update(Map &, NGridType&, GridInfo &, const uint32 t_diff) const = 0; }; diff --git a/src/server/game/Warden/Warden.h b/src/server/game/Warden/Warden.h index e06ea7dca25..d16890b31b9 100644 --- a/src/server/game/Warden/Warden.h +++ b/src/server/game/Warden/Warden.h @@ -107,7 +107,7 @@ class Warden public: Warden(); - ~Warden(); + virtual ~Warden(); virtual void Init(WorldSession* session, BigNumber* k) = 0; virtual ClientWardenModule* GetModuleForClient() = 0; -- cgit v1.2.3 From 7ae0cf8c35b11f7f44927604fbca521d81c22109 Mon Sep 17 00:00:00 2001 From: faramir118 Date: Tue, 20 Mar 2012 01:03:30 -0500 Subject: fix mistaken fallthrough --- src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index f3d0f5520f0..45335ae7b8b 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -837,6 +837,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) { case GO_HORDE_GATE_1: lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED; + break; case GO_HORDE_GATE_2: case GO_ALLIANCE_GATE_1: lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED; -- cgit v1.2.3 From b1c4e8202e0c3f3a18811bda13e6f32bb0644864 Mon Sep 17 00:00:00 2001 From: faramir118 Date: Wed, 11 Apr 2012 20:00:51 +0200 Subject: Scripts/Karazhan/Midnight: Fix timer logic Signed-off-by: Machiavelli --- src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index bbf87ac3e73..783ac6baad1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -244,8 +244,8 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) Midnight = 0; me->SetVisible(false); me->Kill(me); - } - } else ResetTimer -= diff; + } else ResetTimer -= diff; + } //Return since we have no target if (!UpdateVictim()) -- cgit v1.2.3 From ccf50f4c3d583132ac736e0ec44a1ba5ad3c3b32 Mon Sep 17 00:00:00 2001 From: faramir118 Date: Tue, 20 Mar 2012 01:06:47 -0500 Subject: dead code --- src/server/game/Chat/Channels/Channel.cpp | 1 - src/server/game/Entities/Creature/GossipDef.cpp | 3 --- .../scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp | 1 - 3 files changed, 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 92cf4d750a8..0e89601e987 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -49,7 +49,6 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) } else // it's custom channel { - channel_id = 0; m_flags |= CHANNEL_FLAG_CUSTOM; // If storing custom channels in the db is enabled either load or save the channel diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index a39bd8eddf7..836fbe8c7bf 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -47,10 +47,7 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me for (GossipMenuItemContainer::const_iterator itr = _menuItems.begin(); itr != _menuItems.end(); ++itr) { if (int32(itr->first) > menuItemId) - { - menuItemId = menuItemId; break; - } menuItemId = itr->first + 1; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 28457b3b461..22307468f14 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -226,7 +226,6 @@ public: player->SendNewItem(item, 1, true, false, true); } player->SEND_GOSSIP_MENU(907, creature->GetGUID()); - CAST_AI(hyjalAI, creature->AI()); } return true; } -- cgit v1.2.3 From da8c7d23441467b0da4555fcccf6028a3d9665c1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 11 Apr 2012 21:30:56 +0200 Subject: Core: Fixed warning C4263: 'bool Creature::SetDisableGravity(bool,bool)' : member function does not override any base class virtual member function --- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Entities/Unit/Unit.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d5db4ca9714..d49346b232a 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -17565,7 +17565,7 @@ bool Unit::SetWalk(bool enable) return true; } -bool Unit::SetDisableGravity(bool disable) +bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/) { if (disable == IsLevitating()) return false; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index bb826c14dfc..00d66518d3f 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -707,7 +707,7 @@ enum MovementFlags MOVEMENTFLAG_MASK_TURNING = MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT, - MOVEMENTFLAG_MASK_MOVING_FLY = + MOVEMENTFLAG_MASK_MOVING_FLY = MOVEMENTFLAG_FLYING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING, //! TODO if needed: add more flags to this masks that are exclusive to players @@ -1647,7 +1647,7 @@ class Unit : public WorldObject bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);} bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);} virtual bool SetWalk(bool enable); - virtual bool SetDisableGravity(bool disable); + virtual bool SetDisableGravity(bool disable, bool packetOnly = false); bool SetHover(bool enable); void SetInFront(Unit const* target); -- cgit v1.2.3 From c38820c3bde1994e575c21daf9fb3cf79326a038 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Wed, 11 Apr 2012 22:35:23 +0300 Subject: Scripts/Twin Valkyr: Fix a crash in spell_powering_up_SpellScript. Author: Vincent-Michael --- .../Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 6252812e10a..15c83be0104 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -759,7 +759,7 @@ class spell_powering_up : public SpellScriptLoader uint32 spellId; - bool Validate(SpellInfo const* /*spellEntry*/) + bool Load(SpellInfo const* /*spellEntry*/) { spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster()); if (!sSpellMgr->GetSpellInfo(spellId)) -- cgit v1.2.3 From c2948f6352e7472b1ddfc3db0ac4526622a0ea98 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 11 Apr 2012 22:47:54 +0200 Subject: Scripts/Trial of the Crusader: Fixed spell_powering_up_SpellScript once again --- .../Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 15c83be0104..241d6239f82 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -759,7 +759,7 @@ class spell_powering_up : public SpellScriptLoader uint32 spellId; - bool Load(SpellInfo const* /*spellEntry*/) + bool Load() { spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster()); if (!sSpellMgr->GetSpellInfo(spellId)) -- cgit v1.2.3 From 54039b917c496e31d2579f3c2748c122946c6992 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 11 Apr 2012 16:32:01 -0500 Subject: Battlegrounds/WS: Fixed doors Closes #6170 Signed-off-by: Subv --- src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 5a60e371204..495178f18dd 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -187,7 +187,12 @@ void BattlegroundWS::StartingEventOpenDoors() for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); - // players joining later are not egible + SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY); + SpawnBGObject(BG_WS_OBJECT_DOOR_A_6, RESPAWN_ONE_DAY); + SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY); + SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY); + + // players joining later are not eligibles StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE); } -- cgit v1.2.3 From 397ee8ceb549cbfa5de949cd882ddc99cf3ea7c0 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 11 Apr 2012 17:41:36 -0500 Subject: Core/Spells: Execute spell procs after the healing effects of a spell Closes #216 Signed-off-by: Subv --- src/server/game/Spells/Spell.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 36d7328f37e..af3f53e2369 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2442,13 +2442,13 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) else procEx |= PROC_EX_NORMAL_HIT; - // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) - if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) - caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit); unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo); m_healing = gain; + + // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) + if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) + caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell); } // Do damage and triggers else if (m_damage > 0) -- cgit v1.2.3 From 2e5962725db3b9a596bede9b067b51588bd6b122 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 11 Apr 2012 18:53:24 -0500 Subject: Core/Spells: Corrected Rupture critical hits, it wont make other dots (incorrectly) crit any longer Signed-off-by: Subv --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 9ab375413fb..0e7090b4bc6 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1231,12 +1231,11 @@ bool AuraEffect::IsPeriodicTickCrit(Unit* target, Unit const* caster) const if ((*itr)->IsAffectedOnSpell(m_spellInfo) && caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask())) return true; } + // Rupture - since 3.3.3 can crit - if (target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0x0, 0x0, caster->GetGUID())) - { - if (caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask())) - return true; - } + if (m_spellInfo->SpellIconID == 500 && m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) + return caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask()); + return false; } -- cgit v1.2.3 From 74b5b3bd8e55d9c9f1d3eb97012604134d6e2484 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Thu, 12 Apr 2012 12:04:04 +0200 Subject: Core/Commands: Remove recently defunct .hover command. All this spell did before hoverheight changes was .cast/.unaura spell 11010. And since we do not have .autoattack, .steadyshot, .heroicstrike, .shootwand etc. either, there's no place for this command in the core (there never was). --- src/server/game/Chat/Chat.cpp | 1 - src/server/game/Chat/Chat.h | 1 - src/server/game/Chat/Commands/Level3.cpp | 19 ------------------- src/server/game/Miscellaneous/Language.h | 6 ++++-- 4 files changed, 4 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 22969601c32..042f16be3cc 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -382,7 +382,6 @@ ChatCommand* ChatHandler::getCommandTable() { "linkgrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLinkGraveCommand>, "", NULL }, { "neargrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleNearGraveCommand>, "", NULL }, { "explorecheat", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleExploreCheatCommand>, "", NULL }, - { "hover", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleHoverCommand>, "", NULL }, { "levelup", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLevelUpCommand>, "", NULL }, { "showarea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleShowAreaCommand>, "", NULL }, { "hidearea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleHideAreaCommand>, "", NULL }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 0a39eb43ddb..e88914a2daf 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -286,7 +286,6 @@ class ChatHandler bool HandleActivateObjectCommand(const char* args); bool HandleSpawnTransportCommand(const char* args); bool HandleExploreCheatCommand(const char* args); - bool HandleHoverCommand(const char* args); bool HandleWaterwalkCommand(const char* args); bool HandleLevelUpCommand(const char* args); bool HandleShowAreaCommand(const char* args); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 045d5e144a9..30562bb9662 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -2158,25 +2158,6 @@ bool ChatHandler::HandleExploreCheatCommand(const char *args) return true; } -bool ChatHandler::HandleHoverCommand(const char *args) -{ - char* px = strtok((char*)args, " "); - uint32 flag; - if (!px) - flag = 1; - else - flag = atoi(px); - - m_session->GetPlayer()->SetHover(flag); - - if (flag) - SendSysMessage(LANG_HOVER_ENABLED); - else - SendSysMessage(LANG_HOVER_DISABLED); - - return true; -} - void ChatHandler::HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel) { if (player) diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 547f1679b61..4b07d19bd7a 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -522,8 +522,10 @@ enum TrinityStrings LANG_YOURS_EXPLORE_SET_ALL = 553, LANG_YOURS_EXPLORE_SET_NOTHING = 554, - LANG_HOVER_ENABLED = 555, - LANG_HOVER_DISABLED = 556, + //! Old ones now free: + // LANG_HOVER_ENABLED = 555, + // LANG_HOVER_DISABLED = 556, + LANG_YOURS_LEVEL_UP = 557, LANG_YOURS_LEVEL_DOWN = 558, LANG_YOURS_LEVEL_PROGRESS_RESET = 559, -- cgit v1.2.3 From 6cb8d607ceb1ef5e902bed4b144f4db76f628f32 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 12 Apr 2012 05:52:20 -0500 Subject: Spells/Scripts: Allow OnEffectAbsorb to call PreventDefaultAction in AuraScripts closes #6172 Signed-off-by: Subv --- src/server/game/Spells/Auras/SpellAuras.cpp | 3 ++- src/server/game/Spells/SpellScript.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index b6cdc006d2d..0bf91b1b6c5 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2243,7 +2243,7 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM } } -void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/) +void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool& defaultPrevented) { for (std::list::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { @@ -2254,6 +2254,7 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication co if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount); } + defaultPrevented = (*scritr)->_IsDefaultActionPrevented(); (*scritr)->_FinishScriptCall(); } } diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 81f8bbd78c5..ed2f16d6e3e 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -787,6 +787,7 @@ void AuraScript::PreventDefaultAction() case AURA_SCRIPT_HOOK_EFFECT_APPLY: case AURA_SCRIPT_HOOK_EFFECT_REMOVE: case AURA_SCRIPT_HOOK_EFFECT_PERIODIC: + case AURA_SCRIPT_HOOK_EFFECT_ABSORB: m_defaultActionPrevented = true; break; default: -- cgit v1.2.3 From 20a09c5857d10f87958456392356fb6f46095d28 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 12 Apr 2012 05:54:33 -0500 Subject: Core/Spells: Fixed Lifebloom's final bloom benefit from Empowered Rejuvenation closes #244 Signed-off-by: Subv --- src/server/game/Entities/Unit/Unit.cpp | 5 +++-- src/server/game/Spells/SpellEffects.cpp | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d49346b232a..eebfd25e3d4 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3608,8 +3608,9 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId { // final heal int32 healAmount = aurEff->GetAmount(); - int32 stack = dispelInfo.GetRemovedCharges(); - CastCustomSpell(this, 33778, &healAmount, &stack, NULL, true, NULL, NULL, aura->GetCasterGUID()); + if (Unit* caster = aura->GetCaster()) + healAmount = caster->SpellHealingBonus(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); + CastCustomSpell(this, 33778, &healAmount, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); // mana if (Unit* caster = aura->GetCaster()) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 4e05c9fdac2..5078391348f 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1611,9 +1611,6 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) } } } - // Lifebloom - final heal coef multiplied by original DoT stack - else if (m_spellInfo->Id == 33778) - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL, m_spellValue->EffectBasePoints[1]); // Death Pact - return pct of max health to caster else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000) addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL); -- cgit v1.2.3 From dda7fab23037557f7e21745e15f9735f23b5f941 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 12 Apr 2012 09:15:36 -0400 Subject: Core/SpellScripts: Fix crash caused by 6cb8d607ceb1ef5e902bed4b144f4db76f628f32 --- src/server/game/Spells/SpellScript.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index ed2f16d6e3e..df1640df1b7 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -773,6 +773,7 @@ bool AuraScript::_IsDefaultActionPrevented() case AURA_SCRIPT_HOOK_EFFECT_APPLY: case AURA_SCRIPT_HOOK_EFFECT_REMOVE: case AURA_SCRIPT_HOOK_EFFECT_PERIODIC: + case AURA_SCRIPT_HOOK_EFFECT_ABSORB: return m_defaultActionPrevented; default: ASSERT(false && "AuraScript::_IsDefaultActionPrevented is called in a wrong place"); -- cgit v1.2.3 From 74052020235cdb8b2a7b38806b238e44a98f4587 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 12 Apr 2012 15:44:41 +0200 Subject: Removed unused file --- .../shared/Dynamic/TypeContainerFunctionsPtr.h | 168 --------------------- 1 file changed, 168 deletions(-) delete mode 100755 src/server/shared/Dynamic/TypeContainerFunctionsPtr.h (limited to 'src') diff --git a/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h b/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h deleted file mode 100755 index 2c065d96d4a..00000000000 --- a/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * 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 . - */ - -#ifndef TYPECONTAINER_FUNCTIONS_PTR_H -#define TYPECONTAINER_FUNCTIONS_PTR_H - -/* - * Here you'll find a list of helper functions to make - * the TypeContainer usefull. Without it, its hard - * to access or mutate the container. - */ - -#include "Platform/Define.h" -#include "Utilities/TypeList.h" -#include - -namespace Trinity -{ - /* ContainerMapList Helpers */ - // count functions - // template size_t Count(const ContainerMapList &elements, CountedPtr* /*fake*/) - // { - // return elements._element.size(); - // }; - // - // template size_t Count(const ContainerMapList &elements, CountedPtr* /*fake*/) - // { - // return 0; - // } - // - // template size_t Count(const ContainerMapList &elements, CountedPtr* /*fake*/) - // { - // return 0; - // } - // - // template size_t Count(const ContainerMapList >&elements, SPECIFIC_TYPE* fake) - // { - // return Count(elements._elements, fake); - // } - // - // template size_t Count(const ContainerMapList >&elements, SPECIFIC_TYPE* fake) - // { - // return Count(elements._TailElements, fake); - // } - - // non-const find functions - template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - typename std::map >::iterator iter = elements._element.find(hdl); - return (iter == elements._element.end() ? NullPtr((SPECIFIC_TYPE*)NULL) : iter->second); - }; - - template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - return NullPtr((SPECIFIC_TYPE*)NULL);// terminate recursion - } - - template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - return NullPtr((SPECIFIC_TYPE*)NULL);// this is a missed - } - - template CountedPtr& Find(ContainerMapList >&elements, OBJECT_HANDLE hdl, CountedPtr* fake) - { - CountedPtr &t = Find(elements._elements, hdl, fake); - return (!t ? Find(elements._TailElements, hdl, fake) : t); - } - - // const find functions - template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - typename CountedPtr::iterator iter = elements._element.find(hdl); - return (iter == elements._element.end() ? NullPtr((SPECIFIC_TYPE*)NULL) : iter->second); - }; - - template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - return NullPtr((SPECIFIC_TYPE*)NULL); - } - - template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - return NullPtr((SPECIFIC_TYPE*)NULL); - } - - template CountedPtr& Find(const ContainerMapList >&elements, OBJECT_HANDLE hdl, CountedPtr* fake) - { - CountedPtr &t = Find(elements._elements, hdl, fake); - if (!t) - t = Find(elements._TailElement, hdl, fake); - - return t; - } - - // non-const insert functions - template CountedPtr& Insert(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - elements._element[hdl] = obj; - return obj; - }; - - template CountedPtr& Insert(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - return NullPtr((SPECIFIC_TYPE*)NULL); - } - - // this is a missed - template CountedPtr& Insert(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - return NullPtr((SPECIFIC_TYPE*)NULL);// a missed - } - - // Recursion - template CountedPtr& Insert(ContainerMapList >&elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - CountedPtr &t= Insert(elements._elements, obj, hdl); - return (!t ? Insert(elements._TailElements, obj, hdl) : t); - } - - // non-const remove method - template bool Remove(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - typename std::map >::iterator iter = elements._element.find(hdl); - if ( iter != elements._element.end() ) - { - elements._element.erase(iter); - return true; - } - - return false; // found... terminate the search - } - - template bool Remove(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - return false; - } - - // this is a missed - template bool Remove(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - return false; - } - - template bool Remove(ContainerMapList > &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - // The head element is bad - bool t = Remove(elements._elements, obj, hdl); - return ( !t ? Remove(elements._TailElements, obj, hdl) : t ); - } - -} -#endif - -- cgit v1.2.3 From 71bf2684be58f6fdaebaeb480385769bd5934c85 Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 12 Apr 2012 17:53:34 +0200 Subject: Core/Script: Use DoMeleeAttackIfReady in default ScriptedAI::UpdateAI method (fixes offhand attacks if not UpdateAI is overridden) --- src/server/game/AI/CreatureAIImpl.h | 1 + src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index f568da80b49..98b0afdefc9 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -604,6 +604,7 @@ inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered) inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered) { + // Why don't we check for casting unit_state and existing target as we do in DoCast(.. ? me->CastSpell(me->getVictim(), spellId, triggered); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 096ee695bcf..6d27d251579 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -114,15 +114,7 @@ void ScriptedAI::UpdateAI(uint32 const /*diff*/) if (!UpdateVictim()) return; - if (me->isAttackReady()) - { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle) -- cgit v1.2.3 From 305cd14e864c5c1651d63ab627d79ddaa8535f16 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 12 Apr 2012 13:29:28 -0400 Subject: Core/Spells: Fix Unrelenting assault proc only on players. --- src/server/scripts/Spells/spell_warrior.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 2ce3c72580e..66e44112b8a 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -441,9 +441,9 @@ public: if (!spellId) return; - Unit* target = GetHitUnit(); - if (target->HasUnitState(UNIT_STATE_CASTING)) - target->CastSpell(target, spellId, true); + if (Player* target = GetHitPlayer()) + if (target->HasUnitState(UNIT_STATE_CASTING)) + target->CastSpell(target, spellId, true); } void Register() -- cgit v1.2.3 From c04e92564b96e104deabc6997edef9f6c89614ff Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 12 Apr 2012 18:39:40 -0500 Subject: Core/Spells: Apply Lifebloom's final bloom bonus from Empowered Rejuvenation also on expire. thanks @3kids for noticing --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 0e7090b4bc6..1ad6fe557f9 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4928,7 +4928,10 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool // final heal int32 stack = GetBase()->GetStackAmount(); - target->CastCustomSpell(target, 33778, &m_amount, &stack, NULL, true, NULL, this, GetCasterGUID()); + int32 heal = m_amount; + if (caster) + heal = caster->SpellHealingBonus(target, GetSpellInfo(), heal, HEAL, stack); + target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID()); // restore mana if (caster) -- cgit v1.2.3 From 491999280e5d914d6c9cb4cbb2878ce6ce112dcb Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 12 Apr 2012 20:18:07 -0500 Subject: Core/Spells: You should not be able to cast Create Healthstone if you already have one in your inventory Closes #1498 Signed-off-by: Subv --- src/server/scripts/Spells/spell_warlock.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 29a52406279..1f7e8171e46 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -172,6 +172,19 @@ class spell_warl_create_healthstone : public SpellScriptLoader return true; } + SpellCastResult CheckCast() + { + if (Player* caster = GetCaster()->ToPlayer()) + { + uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); + ItemPosCountVec dest; + InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL); + if (msg != EQUIP_ERR_OK) + return SPELL_FAILED_TOO_MANY_OF_ITEM; + } + return SPELL_CAST_OK; + } + void HandleScriptEffect(SpellEffIndex effIndex) { if (Unit* unitTarget = GetHitUnit()) @@ -198,6 +211,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnCheckCast += SpellCheckCastFn(spell_warl_create_healthstone_SpellScript::CheckCast); } }; -- cgit v1.2.3 From 6400c13fcb342fff7e2d808e469f2c57d83766c5 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 12 Apr 2012 20:19:23 -0500 Subject: Core/Loading: Make GameObject loot loading faster by removing an unneeded call to an expensive method. Thanks Manuel for pointing it out --- src/server/game/Globals/ObjectMgr.h | 9 --------- src/server/game/Loot/LootMgr.cpp | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 0f2b2382007..f81e7f1f074 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -1025,15 +1025,6 @@ class ObjectMgr return &itr->second; } - bool IsGoOfSpecificEntrySpawned(uint32 entry) const - { - for (GameObjectDataContainer::const_iterator it = _gameObjectDataStore.begin(); it != _gameObjectDataStore.end(); ++it) - if (it->second.id == entry) - return true; - - return false; - } - GameObjectData const* GetGOData(uint32 guid) const { GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 1b349b11156..75065158ef6 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1526,7 +1526,7 @@ void LoadLootTemplates_Gameobject() { if (uint32 lootid = itr->second.GetLootId()) { - if (sObjectMgr->IsGoOfSpecificEntrySpawned(itr->second.entry) && lootIdSet.find(lootid) == lootIdSet.end()) + if (lootIdSet.find(lootid) == lootIdSet.end()) LootTemplates_Gameobject.ReportNotExistedId(lootid); else lootIdSetUsed.insert(lootid); -- cgit v1.2.3 From 4b81de9d3a3578a7e6b9dad79cec709dc9fa0c83 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 13 Apr 2012 18:32:47 +0200 Subject: Core/Movement: Changed casting check in TargetedMovementGenerator to be able to freely manipulate cast+move interaction in scripts --- .../game/Movement/MovementGenerators/TargetedMovementGenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index eb61db8b4ba..fdff5a92564 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -135,7 +135,7 @@ bool TargetedMovementGeneratorMedium::Update(T &owner, const uint32 & time_ } // prevent movement while casting spells with cast time or channel time - if (owner.IsNonMeleeSpellCasted(false, false, true)) + if (owner.HasUnitState(UNIT_STATE_CASTING)) { if (!owner.IsStopped()) owner.StopMoving(); -- cgit v1.2.3 From 5466092d23a5e01c8edddb6a54390b4df96889b8 Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 13 Apr 2012 11:53:43 -0500 Subject: Core/Spells: Fixed Recklessness charges being dropped twice. Closes #932 --- src/server/game/Entities/Unit/Unit.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index eebfd25e3d4..8ecd22ec629 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8200,6 +8200,16 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true); break; } + // Recklessness + case 1719: + { + //! Possible hack alert + //! Don't drop charges on proc, they will be dropped on SpellMod removal + //! Before this change, it was dropping two charges per attack, one in ProcDamageAndSpellFor, and one in RemoveSpellMods. + //! The reason of this behaviour is Recklessness having three auras, 2 of them can not proc (isTriggeredAura array) but the other one can, making the whole spell proc. + *handled = true; + break; + } default: break; } -- cgit v1.2.3 From c055a8617d4011395d7c2bfe39a8b475e65c5955 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 13 Apr 2012 19:53:42 +0200 Subject: Scripts/Icecrown Citadel * Fixed Professor Putricide Tear Gas stunning himself * Fixed visual of Unstable Experiment * Fixed oozes not picking new targets after hitting old * Fixed Gas Cloud not using melee attack * Removed ooze summon position hack Closes #4301 Closes #2726 Closes #5119 Closes #4464 Closes #2874 Closes #4407 Closes #2421 Closes #4899 --- sql/updates/world/2012_04_13_02_world_misc.sql | 18 +++ src/server/game/Entities/Unit/Unit.cpp | 9 +- src/server/game/Spells/SpellMgr.cpp | 6 +- .../IcecrownCitadel/boss_professor_putricide.cpp | 158 ++++++++++++++------- src/server/shared/Database/DatabaseWorkerPool.h | 4 +- 5 files changed, 128 insertions(+), 67 deletions(-) create mode 100644 sql/updates/world/2012_04_13_02_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_13_02_world_misc.sql b/sql/updates/world/2012_04_13_02_world_misc.sql new file mode 100644 index 00000000000..7c71af78cd7 --- /dev/null +++ b/sql/updates/world/2012_04_13_02_world_misc.sql @@ -0,0 +1,18 @@ +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` IN (38308,38309,37824); -- Professor Putricide triggers +UPDATE `creature_template` SET `ScriptName`='npc_gas_cloud' WHERE `entry`=37562; -- Gas Cloud +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_putricide_ooze_summon'; +DELETE FROM `spell_target_position` WHERE `id` IN (71413,71414); +INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES +(71414,631,4335.00,3206.75,389.399,0), +(71413,631,4380.43,3206.55,389.398,0); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (71615,71618,71412,71415); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`Comment`) VALUES +(13,4,71615,31,3,37690,'Putricide - Tear Gas on Slime Puddle'), +(13,1,71618,31,3,37562,'Putricide - Tear Gas on Gas Cloud'), +(13,2,71618,31,3,37697,'Putricide - Tear Gas on Volatile Ooze'), +(13,4,71618,31,3,38159,'Putricide - Tear Gas on Choking Gas Bomb'); + +UPDATE `spell_script_names` SET `ScriptName`='spell_putricide_clear_aura_effect_value' WHERE `ScriptName`='spell_putricide_clear_mutated_plague'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(71620,'spell_putricide_clear_aura_effect_value'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8ecd22ec629..0550e7bbfda 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7396,8 +7396,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (GetTypeId() != TYPEID_PLAYER || !victim || !victim->isAlive() || !castItem || !castItem->IsEquipped()) return false; - Player* player = ToPlayer(); - WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot())); + WeaponAttackType attType = WeaponAttackType(Player::GetAttackBySlot(castItem->GetSlot())); if ((attType != BASE_ATTACK && attType != OFF_ATTACK) || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)) @@ -7985,11 +7984,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp for (uint8 i = 1; i < stack; ++i) dmg += mod * stack; if (Unit* caster = triggeredByAura->GetCaster()) - { caster->CastCustomSpell(70701, SPELLVALUE_BASE_POINT0, dmg); - if (Creature* creature = caster->ToCreature()) - creature->DespawnOrUnsummon(1); - } break; } // Ball of Flames Proc @@ -17576,7 +17571,7 @@ bool Unit::SetWalk(bool enable) return true; } -bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/) +bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/) { if (disable == IsLevitating()) return false; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 80ed1972a5d..05431ef0a16 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3347,9 +3347,9 @@ void SpellMgr::LoadDbcDataCorrections() case 70460: // Coldflame Jets (Traps after Saurfang) spellInfo->DurationIndex = 1; // 10 seconds break; - case 71413: // Green Ooze Summon (Professor Putricide) - case 71414: // Orange Ooze Summon (Professor Putricide) - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + case 71412: // Green Ooze Summon (Professor Putricide) + case 71415: // Orange Ooze Summon (Professor Putricide) + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; break; case 71159: // Awaken Plagued Zombies spellInfo->DurationIndex = 21; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 541e52fb922..273f2a20b4b 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -64,6 +64,9 @@ enum Spells SPELL_MALLEABLE_GOO = 70852, SPELL_UNSTABLE_EXPERIMENT = 70351, SPELL_TEAR_GAS = 71617, // phase transition + SPELL_TEAR_GAS_CREATURE = 71618, + SPELL_TEAR_GAS_CANCEL = 71620, + SPELL_TEAR_GAS_PERIODIC_TRIGGER = 73170, SPELL_CREATE_CONCOCTION = 71621, SPELL_GUZZLE_POTIONS = 71893, SPELL_OOZE_TANK_PROTECTION = 71770, // protects the tank @@ -86,6 +89,7 @@ enum Spells SPELL_GASEOUS_BLOAT_PROC = 70215, SPELL_GASEOUS_BLOAT = 70672, SPELL_GASEOUS_BLOAT_PROTECTION = 70812, + SPELL_EXPUNGED_GAS = 70701, // Volatile Ooze SPELL_OOZE_ERUPTION = 70492, @@ -595,13 +599,15 @@ class boss_professor_putricide : public CreatureScript break; case EVENT_TEAR_GAS: me->GetMotionMaster()->MovePoint(POINT_TABLE, tablePos); + DoCast(me, SPELL_TEAR_GAS_PERIODIC_TRIGGER, true); break; case EVENT_RESUME_ATTACK: me->SetReactState(REACT_DEFENSIVE); AttackStart(me->getVictim()); // remove Tear Gas + me->RemoveAurasDueToSpell(SPELL_TEAR_GAS_PERIODIC_TRIGGER); instance->DoRemoveAurasDueToSpellOnPlayers(71615); - instance->DoRemoveAurasDueToSpellOnPlayers(71618); + DoCastAOE(SPELL_TEAR_GAS_CANCEL); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE); break; @@ -699,27 +705,36 @@ class npc_volatile_ooze : public CreatureScript public: npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { } - struct npc_volatile_oozeAI : public ScriptedAI + struct npc_putricide_oozeAI : public ScriptedAI { - npc_volatile_oozeAI(Creature* creature) : ScriptedAI(creature) + npc_putricide_oozeAI(Creature* creature) : ScriptedAI(creature) { _newTargetSelectTimer = 0; } void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) { - if (!_newTargetSelectTimer && sSpellMgr->GetSpellDifficultyId(spell->Id) == sSpellMgr->GetSpellDifficultyId(SPELL_OOZE_ERUPTION)) + if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_OOZE_ERUPTION, me)) + _newTargetSelectTimer = 1000; + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_TEAR_GAS_CREATURE) _newTargetSelectTimer = 1000; } void UpdateAI(uint32 const diff) { - if (!UpdateVictim()) + if (!UpdateVictim() && !_newTargetSelectTimer) return; if (!_newTargetSelectTimer) return; + if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) + return; + if (_newTargetSelectTimer <= diff) { _newTargetSelectTimer = 0; @@ -730,13 +745,68 @@ class npc_volatile_ooze : public CreatureScript } private: - // no need to use EventMap for just one event uint32 _newTargetSelectTimer; }; CreatureAI* GetAI(Creature* creature) const { - return GetIcecrownCitadelAI(creature); + return GetIcecrownCitadelAI(creature); + } +}; + +class npc_gas_cloud : public CreatureScript +{ + public: + npc_gas_cloud() : CreatureScript("npc_gas_cloud") { } + + struct npc_gas_cloudAI : public ScriptedAI + { + npc_gas_cloudAI(Creature* creature) : ScriptedAI(creature) + { + _newTargetSelectTimer = 0; + } + + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) + { + if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_EXPUNGED_GAS, me)) + _newTargetSelectTimer = 1000; + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_TEAR_GAS_CREATURE) + _newTargetSelectTimer = 1000; + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim() && !_newTargetSelectTimer) + return; + + DoMeleeAttackIfReady(); + + if (!_newTargetSelectTimer) + return; + + if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) + return; + + if (_newTargetSelectTimer <= diff) + { + _newTargetSelectTimer = 0; + me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false); + } + else + _newTargetSelectTimer -= diff; + } + + private: + uint32 _newTargetSelectTimer; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); } }; @@ -755,8 +825,8 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader if (Unit* caster = GetCaster()) { target->RemoveAuraFromStack(GetSpellInfo()->Id, GetCasterGUID()); - if (!target->HasAura(GetId())&& caster->GetTypeId() == TYPEID_UNIT) - caster->ToCreature()->DespawnOrUnsummon(); + if (!target->HasAura(GetId())) + caster->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, caster, false); } } @@ -823,7 +893,19 @@ class spell_putricide_ooze_channel : public SpellScriptLoader void StartAttack() { GetCaster()->ClearUnitState(UNIT_STATE_CASTING); + GetCaster()->DeleteThreatList(); GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit()); + GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff + } + + // temporary, until SelectTarget are not called on empty lists + void CheckTarget() + { + if (_target) + return; + + FinishCast(SPELL_FAILED_NO_VALID_TARGETS); + GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update } void Register() @@ -832,6 +914,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack); + OnCast += SpellCastFn(spell_putricide_ooze_channel_SpellScript::CheckTarget); } Unit* _target; @@ -931,13 +1014,13 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader uint32 stage = GetCaster()->ToCreature()->AI()->GetData(DATA_EXPERIMENT_STAGE); Creature* target = NULL; std::list creList; - GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 100.0f); + GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f); // 2 of them are spawned at green place - weird trick blizz for (std::list::iterator itr = creList.begin(); itr != creList.end(); ++itr) { target = *itr; std::list tmp; - GetCreatureListWithEntryInGrid(tmp, target, NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 1.0f); + GetCreatureListWithEntryInGrid(tmp, target, NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 10.0f); if ((!stage && tmp.size() > 1) || (stage && tmp.size() == 1)) break; } @@ -957,42 +1040,6 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader } }; -class spell_putricide_ooze_summon : public SpellScriptLoader -{ - public: - spell_putricide_ooze_summon() : SpellScriptLoader("spell_putricide_ooze_summon") { } - - class spell_putricide_ooze_summon_AuraScript : public AuraScript - { - PrepareAuraScript(spell_putricide_ooze_summon_AuraScript); - - void HandleTriggerSpell(AuraEffect const* aurEff) - { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - { - uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; - float x, y, z; - GetTarget()->GetPosition(x, y, z); - z = GetTarget()->GetMap()->GetHeight(GetTarget()->GetPhaseMask(), x, y, z, true, 25.0f); - x += 10.0f * cosf(caster->GetOrientation()); - y += 10.0f * sinf(caster->GetOrientation()); - caster->CastSpell(x, y, z, triggerSpellId, true, NULL, NULL, GetCasterGUID()); - } - } - - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_ooze_summon_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_putricide_ooze_summon_AuraScript(); - } -}; - class spell_putricide_ooze_eruption_searcher : public SpellScriptLoader { public: @@ -1455,14 +1502,15 @@ class spell_putricide_regurgitated_ooze : public SpellScriptLoader } }; -class spell_putricide_clear_mutated_plague : public SpellScriptLoader +// Removes aura with id stored in effect value +class spell_putricide_clear_aura_effect_value : public SpellScriptLoader { public: - spell_putricide_clear_mutated_plague() : SpellScriptLoader("spell_putricide_clear_mutated_plague") { } + spell_putricide_clear_aura_effect_value() : SpellScriptLoader("spell_putricide_clear_aura_effect_value") { } - class spell_putricide_clear_mutated_plague_SpellScript : public SpellScript + class spell_putricide_clear_aura_effect_value_SpellScript : public SpellScript { - PrepareSpellScript(spell_putricide_clear_mutated_plague_SpellScript); + PrepareSpellScript(spell_putricide_clear_aura_effect_value_SpellScript); void HandleScript(SpellEffIndex effIndex) { @@ -1473,13 +1521,13 @@ class spell_putricide_clear_mutated_plague : public SpellScriptLoader void Register() { - OnEffectHitTarget += SpellEffectFn(spell_putricide_clear_mutated_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_putricide_clear_aura_effect_value_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const { - return new spell_putricide_clear_mutated_plague_SpellScript(); + return new spell_putricide_clear_aura_effect_value_SpellScript(); } }; @@ -1518,12 +1566,12 @@ void AddSC_boss_professor_putricide() { new boss_professor_putricide(); new npc_volatile_ooze(); + new npc_gas_cloud(); new spell_putricide_gaseous_bloat(); new spell_putricide_ooze_channel(); new spell_putricide_slime_puddle(); new spell_putricide_slime_puddle_aura(); new spell_putricide_unstable_experiment(); - new spell_putricide_ooze_summon(); new spell_putricide_ooze_eruption_searcher(); new spell_putricide_choking_gas_bomb(); new spell_putricide_unbound_plague(); @@ -1534,6 +1582,6 @@ void AddSC_boss_professor_putricide() new spell_putricide_mutated_transformation(); new spell_putricide_mutated_transformation_dmg(); new spell_putricide_regurgitated_ooze(); - new spell_putricide_clear_mutated_plague(); + new spell_putricide_clear_aura_effect_value(); new spell_stinky_precious_decimate(); } diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 8b69accfc23..314d196cc06 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -102,7 +102,7 @@ class DatabaseWorkerPool //! Shuts down delaythreads for this connection pool by underlying deactivate(). //! The next dequeue attempt in the worker thread tasks will result in an error, - //! ultimately ending the worker thread task. + //! ultimately ending the worker thread task. _queue->queue()->close(); for (uint8 i = 0; i < _connectionCount[IDX_ASYNC]; ++i) @@ -114,7 +114,7 @@ class DatabaseWorkerPool t->Close(); //! Closes the actualy MySQL connection. } - sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", + sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", GetDatabaseName()); //! Shut down the synchronous connections -- cgit v1.2.3 From b9c50a8b6ee4335a98518a7329fe94133e5ee69b Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 13 Apr 2012 13:36:28 -0500 Subject: Core/Spells: Prevent Siphon Life from proccing on Corruption apply. Closes #6150 Signed-off-by: Subv --- src/server/game/Entities/Unit/Unit.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0550e7bbfda..536f99019b0 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6000,6 +6000,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Siphon Life case 63108: { + if (!damage) + break; // Glyph of Siphon Life if (HasAura(56216)) triggerAmount += triggerAmount / 4; -- cgit v1.2.3 From a28742bffeca3764468b3f307a86c14e2f3e3607 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 13 Apr 2012 20:50:34 +0100 Subject: Core/BG: When starting a battleground teleport the player to start location if it goes outside of the allowed "waiting" area (for example, getting out of the "bubble" in EotS) Allowed waiting area is calculated as the distance specified in database (battleground_template.StartMaxDist) and the battleground start point for each team A distance of 0 is ignored (not used in SotA nor arenas) The values in DB might need some tweaks, open a pull request if you calculate better ones Closes #180 Initial patch and idea by Rat Also added validation (DBError log) to some fields in battleground_template table --- .../world/2012_04_13_02_world_bg_template.sql | 7 ++++ src/server/game/Battlegrounds/Battleground.cpp | 37 ++++++++++++++++++++-- src/server/game/Battlegrounds/Battleground.h | 4 +++ src/server/game/Battlegrounds/BattlegroundMgr.cpp | 28 +++++++++------- src/server/game/Battlegrounds/BattlegroundMgr.h | 1 + src/server/game/Miscellaneous/SharedDefines.h | 28 ++++++++-------- 6 files changed, 77 insertions(+), 28 deletions(-) create mode 100644 sql/updates/world/2012_04_13_02_world_bg_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_13_02_world_bg_template.sql b/sql/updates/world/2012_04_13_02_world_bg_template.sql new file mode 100644 index 00000000000..a426d7c6831 --- /dev/null +++ b/sql/updates/world/2012_04_13_02_world_bg_template.sql @@ -0,0 +1,7 @@ +ALTER TABLE `battleground_template` ADD `StartMaxDist` float NOT NULL DEFAULT 0 AFTER `HordeStartO`; + +UPDATE `battleground_template` SET `StartMaxDist`=200 WHERE `id`=30; -- IC +UPDATE `battleground_template` SET `StartMaxDist`=100 WHERE `id`=1; -- AV +UPDATE `battleground_template` SET `StartMaxDist`=75 WHERE `id` IN (2,3,7); -- WSG, AB, EotS + +UPDATE `battleground_template` SET `MinLvl`=1 WHERE `id`=32; diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index d6bfde021e7..d3348fd21d1 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -144,6 +144,7 @@ Battleground::Battleground() m_Winner = 2; m_StartTime = 0; m_ResetStatTimer = 0; + m_ValidStartPositionTimer = 0; m_Events = 0; m_IsRated = false; m_BuffChange = false; @@ -177,6 +178,8 @@ Battleground::Battleground() m_ArenaTeamIds[BG_TEAM_ALLIANCE] = 0; m_ArenaTeamIds[BG_TEAM_HORDE] = 0; + m_StartMaxDist = 0.0f; + m_ArenaTeamRatingChanges[BG_TEAM_ALLIANCE] = 0; m_ArenaTeamRatingChanges[BG_TEAM_HORDE] = 0; @@ -291,6 +294,7 @@ void Battleground::Update(uint32 diff) // Update start time and reset stats timer m_StartTime += diff; m_ResetStatTimer += diff; + m_ValidStartPositionTimer += diff; PostUpdateImpl(diff); } @@ -453,19 +457,19 @@ inline void Battleground::_ProcessJoin(uint32 diff) // First start warning - 2 or 1 minute SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); } - // After 1 minute or 30 seconds, warning is signalled + // After 1 minute or 30 seconds, warning is signaled else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) { m_Events |= BG_STARTING_EVENT_2; SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); } - // After 30 or 15 seconds, warning is signalled + // After 30 or 15 seconds, warning is signaled else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3)) { m_Events |= BG_STARTING_EVENT_3; SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); } - // Delay expired (atfer 2 or 1 minute) + // Delay expired (after 2 or 1 minute) else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) { m_Events |= BG_STARTING_EVENT_4; @@ -526,6 +530,33 @@ inline void Battleground::_ProcessJoin(uint32 diff) sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel()); } } + + // Find if the player left our start zone; if so, teleport it back + if (m_ValidStartPositionTimer > 1000) + { + m_ValidStartPositionTimer = 0; + float maxDist = GetStartMaxDist(); + if (maxDist > 0.0f) + { + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + { + if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + { + float x, y, z, o; + uint32 team = plr->GetBGTeam(); + GetTeamStartLoc(team, x, y, z, o); + + float dist = plr->GetDistance(x, y, z); + + if (dist >= maxDist) + { + sLog->outError("BATTLEGROUND: Sending %s back to start location (possible exploit)", plr->GetName()); + plr->TeleportTo(GetMapId(), x, y, z, o); + } + } + } + } + } } inline void Battleground::_ProcessLeave(uint32 diff) diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 32f6ebc92de..01dfbb23033 100755 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -443,6 +443,8 @@ class Battleground Z = m_TeamStartLocZ[idx]; O = m_TeamStartLocO[idx]; } + void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; } + float GetStartMaxDist() const { return m_StartMaxDist; } // Packet Transfer // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) @@ -617,6 +619,7 @@ class Battleground uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use uint32 m_StartTime; uint32 m_ResetStatTimer; + uint32 m_ValidStartPositionTimer; int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself uint32 m_LastResurrectTime; BattlegroundBracketId m_BracketId; @@ -698,6 +701,7 @@ class Battleground float m_TeamStartLocY[BG_TEAMS_COUNT]; float m_TeamStartLocZ[BG_TEAMS_COUNT]; float m_TeamStartLocO[BG_TEAMS_COUNT]; + float m_StartMaxDist; uint32 ScriptId; }; #endif diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index e1b99cbdcb9..a106f11ae82 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -660,6 +660,7 @@ uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data) bg->SetName(data.BattlegroundName); bg->SetTeamStartLoc(ALLIANCE, data.Team1StartLocX, data.Team1StartLocY, data.Team1StartLocZ, data.Team1StartLocO); bg->SetTeamStartLoc(HORDE, data.Team2StartLocX, data.Team2StartLocY, data.Team2StartLocZ, data.Team2StartLocO); + bg->SetStartMaxDist(data.StartMaxDist); bg->SetLevelRange(data.LevelMin, data.LevelMax); bg->SetScriptId(data.scriptId); @@ -677,8 +678,8 @@ void BattlegroundMgr::CreateInitialBattlegrounds() uint8 selectionWeight; BattlemasterListEntry const* bl; - // 0 1 2 3 4 5 6 7 8 9 10 - QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, Weight, ScriptName FROM battleground_template"); + // 0 1 2 3 4 5 6 7 8 9 10 11 + QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, StartMaxDist, Weight, ScriptName FROM battleground_template"); if (!result) { @@ -712,17 +713,20 @@ void BattlegroundMgr::CreateInitialBattlegrounds() data.MaxPlayersPerTeam = fields[2].GetUInt16(); data.LevelMin = fields[3].GetUInt8(); data.LevelMax = fields[4].GetUInt8(); - //check values from DB - if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam) + + // check values from DB + if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam) { - data.MinPlayersPerTeam = 0; // by default now expected strong full bg requirement - data.MaxPlayersPerTeam = 40; + sLog->outErrorDb("Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)", + data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam); + continue; } + if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax) { - //TO-DO: FIX ME - data.LevelMin = 0;//bl->minlvl; - data.LevelMax = 80;//bl->maxlvl; + sLog->outErrorDb("Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)", + data.bgTypeId, data.LevelMin, data.LevelMax); + continue; } startId = fields[5].GetUInt32(); @@ -767,8 +771,10 @@ void BattlegroundMgr::CreateInitialBattlegrounds() continue; } - selectionWeight = fields[9].GetUInt8(); - data.scriptId = sObjectMgr->GetScriptId(fields[10].GetCString()); + data.StartMaxDist = fields[9].GetFloat(); + + selectionWeight = fields[10].GetUInt8(); + data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString()); data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()]; data.MapID = bl->mapid[0]; diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index 88559d07993..7afb83da0a6 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -50,6 +50,7 @@ struct CreateBattlegroundData float Team2StartLocY; float Team2StartLocZ; float Team2StartLocO; + float StartMaxDist; uint32 scriptId; }; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 22f0ea35413..0386e6b4214 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -3294,20 +3294,20 @@ enum BanReturn // indexes of BattlemasterList.dbc enum BattlegroundTypeId { - BATTLEGROUND_TYPE_NONE = 0, - BATTLEGROUND_AV = 1, - BATTLEGROUND_WS = 2, - BATTLEGROUND_AB = 3, - BATTLEGROUND_NA = 4, - BATTLEGROUND_BE = 5, - BATTLEGROUND_AA = 6, - BATTLEGROUND_EY = 7, - BATTLEGROUND_RL = 8, - BATTLEGROUND_SA = 9, - BATTLEGROUND_DS = 10, - BATTLEGROUND_RV = 11, - BATTLEGROUND_IC = 30, - BATTLEGROUND_RB = 32 + BATTLEGROUND_TYPE_NONE = 0, // None + BATTLEGROUND_AV = 1, // Alterac Valley + BATTLEGROUND_WS = 2, // Warsong Gulch + BATTLEGROUND_AB = 3, // Arathi Basin + BATTLEGROUND_NA = 4, // Nagrand Arena + BATTLEGROUND_BE = 5, // Blade's Edge Arena + BATTLEGROUND_AA = 6, // All Arenas + BATTLEGROUND_EY = 7, // Eye of the Storm + BATTLEGROUND_RL = 8, // Ruins of Lordaernon + BATTLEGROUND_SA = 9, // Strand of the Ancients + BATTLEGROUND_DS = 10, // Dalaran Sewers + BATTLEGROUND_RV = 11, // Ring of Valor + BATTLEGROUND_IC = 30, // Isle of Conquest + BATTLEGROUND_RB = 32 // Random Battleground }; #define MAX_BATTLEGROUND_TYPE_ID 33 -- cgit v1.2.3 From ba957e6a0e5861abb4d80a6ca7a4d4da0b15163e Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 13 Apr 2012 18:31:18 -0500 Subject: Core/Spells: Reapply glyph bonuses that depend on stance when you shapeshift into that instance Closes #1076 and possibly others Signed-off-by: Subv --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1ad6fe557f9..a1bb14b3e16 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1474,6 +1474,23 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (spellInfo->Stances & (1<<(GetMiscValue()-1))) target->CastSpell(target, itr->first, true, NULL, this); } + + // Also do it for Glyphs + for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) + { + if (uint32 glyphId = target->ToPlayer()->GetGlyph(i)) + { + if (GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId)) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyph->SpellId); + if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) + continue; + if (spellInfo->Stances & (1<<(GetMiscValue()-1))) + target->CastSpell(target, glyph->SpellId, true, NULL, this); + } + } + } + // Leader of the Pack if (target->ToPlayer()->HasSpell(17007)) { -- cgit v1.2.3 From 98e184799970a74b436a8040f24c27c9abb96dc4 Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 13 Apr 2012 18:58:27 -0500 Subject: Player/Items: Fix the item durations when the item is stored in a bag different than the default backpack Closes #1026 Signed-off-by: Subv --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 26ea7c110d2..25429a18eec 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17657,7 +17657,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) ItemPosCountVec dest; err = CanStoreItem(itr->second->GetSlot(), slot, dest, item); if (err == EQUIP_ERR_OK) - itr->second->StoreItem(slot, item, true); + item = StoreItem(dest, item, true); } } -- cgit v1.2.3 From 63ec9f22998948b4cf2af4450b2d41ce398bfc96 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 14 Apr 2012 11:09:40 +0200 Subject: Core/Player: Send calendar raid lockout remove before removing player from instance save (may invalidate instance save) --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 25429a18eec..53bafbd4521 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -18318,10 +18318,10 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu CharacterDatabase.Execute(stmt); } - itr->second.save->RemovePlayer(this); // save can become invalid if (itr->second.perm) GetSession()->SendCalendarRaidLockout(itr->second.save, false); + itr->second.save->RemovePlayer(this); // save can become invalid m_boundInstances[difficulty].erase(itr++); } } -- cgit v1.2.3 From 0ec7016ccac555545598aac9464ba7f26659dafd Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 14 Apr 2012 08:23:23 -0500 Subject: Core/Spells: Corrected logic check for SPELL_ATTR4_IGNORE_RESISTANCES Signed-off-by: Subv --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 536f99019b0..52078922021 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1542,7 +1542,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe // Magic damage, check for resists // Ignore spells that cant be resisted - if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (spellInfo && (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0)) + if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (!spellInfo || (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0) { float victimResistance = float(victim->GetResistance(schoolMask)); victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); -- cgit v1.2.3 From 0d90f7c25790f06fba8eafc6a035e36a938d1f52 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 14 Apr 2012 08:44:19 -0500 Subject: Fixed build from my previous commit --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 52078922021..200f1b42ca7 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1542,7 +1542,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe // Magic damage, check for resists // Ignore spells that cant be resisted - if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (!spellInfo || (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0) + if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (!spellInfo || (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0)) { float victimResistance = float(victim->GetResistance(schoolMask)); victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); -- cgit v1.2.3 From ab8e69873c23ca48f981930d443509225792a070 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 14 Apr 2012 10:17:21 -0500 Subject: Core/Spells: Fixed Bloodworm's heal effect and damage Closes #1808 Thanks @A-Metaphysical-Drama for the damage part Signed-off-by: Subv --- sql/updates/world/2012_04_14_02_world_creature_template_addon.sql | 3 +++ src/server/game/Entities/Pet/Pet.cpp | 7 +++++++ src/server/game/Entities/Unit/StatSystem.cpp | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 sql/updates/world/2012_04_14_02_world_creature_template_addon.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_14_02_world_creature_template_addon.sql b/sql/updates/world/2012_04_14_02_world_creature_template_addon.sql new file mode 100644 index 00000000000..6aaa7da383e --- /dev/null +++ b/sql/updates/world/2012_04_14_02_world_creature_template_addon.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template_addon` SET `auras`='50453' WHERE `entry`=28017; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=28017; +UPDATE `creature_template` SET `ainame` = '' WHERE `entry`=28017; \ No newline at end of file diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index fcb89e33dc1..586f09bd79c 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1041,6 +1041,13 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); break; } + case 28017: // Bloodworms + { + SetCreateHealth(4 * petlevel); + SetBonusDamage(int32(m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - 30 - (petlevel / 4))); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4))); + } } break; } diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 69771129ac9..2da1c1b88cb 100755 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -1068,6 +1068,7 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType) #define ENTRY_TREANT 1964 #define ENTRY_FIRE_ELEMENTAL 15438 #define ENTRY_GHOUL 26125 +#define ENTRY_BLOODWORM 28017 bool Guardian::UpdateStats(Stats stat) { @@ -1229,6 +1230,7 @@ void Guardian::UpdateMaxHealth() case ENTRY_SUCCUBUS: multiplicator = 9.1f; break; case ENTRY_FELHUNTER: multiplicator = 9.5f; break; case ENTRY_FELGUARD: multiplicator = 11.0f; break; + case ENTRY_BLOODWORM: multiplicator = 1.0f; break; default: multiplicator = 10.0f; break; } -- cgit v1.2.3 From a3bdaf7e6d614f081ddc073aa6cec3e158f8617f Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 14 Apr 2012 17:49:51 +0200 Subject: Core/Scripts: Added support for creating custom GameObjectAI classes, similar to how creature scripts work. --- src/server/game/AI/CreatureAISelector.cpp | 3 +++ src/server/game/Scripting/ScriptMgr.cpp | 8 ++++++++ src/server/game/Scripting/ScriptMgr.h | 5 +++++ src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp | 1 - 4 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index ebe14c0d7d0..1a0c6652e74 100755 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -133,6 +133,9 @@ namespace FactorySelector const GameObjectAICreator* ai_factory = NULL; GameObjectAIRegistry& ai_registry(*GameObjectAIRepository::instance()); + if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go)) + return scriptedAI; + ai_factory = ai_registry.GetRegistryItem(go->GetAIName()); //future goAI types go here diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index aac615180c8..9de0951c5ef 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -954,6 +954,14 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd return tmpscript->OnDummyEffect(caster, spellId, effIndex, target); } +GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) +{ + ASSERT(go); + + GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); + tmpscript->GetAI(go); +} + bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger) { ASSERT(player); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 3b65a5cf256..6fe058d336a 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -39,6 +39,7 @@ class Creature; class CreatureAI; class DynamicObject; class GameObject; +class GameObjectAI; class Guild; class GridMap; class Group; @@ -471,6 +472,9 @@ class GameObjectScript : public ScriptObject, public UpdatableScript // Called when the game object is damaged (destructible buildings only). virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { } + + // Called when a GameObjectAI object is needed for the gameobject. + virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return NULL; } }; class AreaTriggerScript : public ScriptObject @@ -911,6 +915,7 @@ class ScriptMgr void OnGameObjectDestroyed(GameObject* go, Player* player); void OnGameObjectDamaged(GameObject* go, Player* player); void OnGameObjectUpdate(GameObject* go, uint32 diff); + GameObjectAI* GetGameObjectAI(GameObject* go); public: /* AreaTriggerScript */ diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index e12393f047f..22858cf69e5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -234,7 +234,6 @@ class instance_ulduar : public InstanceMapScript case NPC_ALGALON: AlgalonGUID = creature->GetGUID(); break; - // Hodir's Helper NPCs case NPC_EIVI_NIGHTFEATHER: if (TeamInInstance == HORDE) -- cgit v1.2.3 From 4f14693ef29402c6cfdab38879f9722235e4e1a9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 14 Apr 2012 18:26:16 +0200 Subject: Core/Scripts: Corrected previous commit and added a few AI hooks to GameObjectAI --- src/server/game/AI/CoreAI/GameObjectAI.h | 23 +++++++++++++---------- src/server/game/AI/SmartScripts/SmartAI.cpp | 2 +- src/server/game/AI/SmartScripts/SmartAI.h | 2 +- src/server/game/Scripting/ScriptMgr.cpp | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index b9d385ba675..f4555649210 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -33,21 +33,24 @@ class GameObjectAI explicit GameObjectAI(GameObject* g) : go(g) {} virtual ~GameObjectAI() {} - virtual void UpdateAI(const uint32 /*diff*/) {} + virtual void UpdateAI(uint32 /*diff*/) {} virtual void InitializeAI() { Reset(); } virtual void Reset() {}; - static int Permissible(const GameObject* go); + static int Permissible(GameObject const* go); - virtual bool GossipHello(Player* /*player*/) {return false;} - virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) {return false;} - virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) {return false;} - virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) {return false;} - virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) {return false;} - virtual uint32 GetDialogStatus(Player* /*player*/) {return 100;} + virtual bool GossipHello(Player* /*player*/) { return false; } + virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { return false; } + virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) { return false; } + virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) { return false; } + virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; } + virtual uint32 GetDialogStatus(Player* /*player*/) { return 100; } virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {} + virtual uint32 GetData(uint32 /*id*/) { return 0; } + virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {} + virtual uint64 GetData64(uint32 /*id*/) { return 0; } virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {} virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) { } @@ -58,8 +61,8 @@ class NullGameObjectAI : public GameObjectAI public: explicit NullGameObjectAI(GameObject* g); - void UpdateAI(const uint32 /*diff*/) {} + void UpdateAI(uint32 /*diff*/) {} - static int Permissible(const GameObject* /*go*/) { return PERMIT_BASE_IDLE; } + static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; } }; #endif diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 4eb7f8a7f50..2a412bffb22 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -854,7 +854,7 @@ int SmartGameObjectAI::Permissible(const GameObject* g) return PERMIT_BASE_NO; } -void SmartGameObjectAI::UpdateAI(const uint32 diff) +void SmartGameObjectAI::UpdateAI(uint32 diff) { GetScript()->OnUpdate(diff); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 94e5e65cf8b..bfd1c7b9d41 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -239,7 +239,7 @@ public: SmartGameObjectAI(GameObject* g) : GameObjectAI(g), go(g) {} ~SmartGameObjectAI() {} - void UpdateAI(const uint32 diff); + void UpdateAI(uint32 diff); void InitializeAI(); void Reset(); SmartScript* GetScript() { return &mScript; } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 9de0951c5ef..01d56cf8060 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -959,7 +959,7 @@ GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) ASSERT(go); GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); - tmpscript->GetAI(go); + return tmpscript->GetAI(go); } bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger) -- cgit v1.2.3 From 8c3d0e23689f8cbe4f4d7381dd9ebe9a905adfa8 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 14 Apr 2012 14:07:31 -0500 Subject: Core/Spells: Dont remove auras on stance change if the stance you are moving to is also allowed by the spell. Closes #2758 Signed-off-by: Subv --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a1bb14b3e16..dbbd89c7533 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1600,10 +1600,25 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const } } + const Unit::AuraEffectList& shapeshifts = target->GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT); + AuraEffect* newAura = NULL; + // Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied + for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr) + { + if ((*itr) != this) + { + newAura = *itr; + break; + } + } Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras(); for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();) { - if (itr->second->GetBase()->IsRemovedOnShapeLost(target)) + // Use the new aura to see on what stance the target will be + uint32 newStance = (1<<((newAura ? newAura->GetMiscValue() : 0)-1)); + + // If the stances are not compatible with the spell, remove it + if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance)) target->RemoveAura(itr); else ++itr; -- cgit v1.2.3 From 8a33ddc010a4be4a181191d2b8b06dee611a1a9c Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 15 Apr 2012 01:30:50 +0200 Subject: Core/BG: Fix a logic mistake in ResetStat timer It should only be executed every 5 seconds, not in every update --- src/server/game/Battlegrounds/Battleground.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index d3348fd21d1..44192a74123 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -426,7 +426,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) // ********************************************************* ModifyStartDelayTime(diff); - if (m_ResetStatTimer <= 5000) + if (m_ResetStatTimer > 5000) { m_ResetStatTimer = 0; for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) -- cgit v1.2.3 From 3d8aaabaf3f4c627a583ff8c5a611a7b02400931 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 14 Apr 2012 20:03:47 -0500 Subject: Core/Spells: Do not proc spells with PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_(NEG|POS) if there is no target, reimplemented Storm, Earth and Fire talent in another way Closes #3367 Closes #2424 If you find more spells that are broken because of this, please notify us Signed-off-by: Subv --- .../world/2012_04_14_05_world_spell_proc_event.sql | 1 + src/server/game/Entities/Unit/Unit.cpp | 14 ---------- src/server/game/Spells/Spell.cpp | 30 ---------------------- src/server/scripts/Spells/spell_shaman.cpp | 19 ++++++++++++++ 4 files changed, 20 insertions(+), 44 deletions(-) create mode 100644 sql/updates/world/2012_04_14_05_world_spell_proc_event.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_14_05_world_spell_proc_event.sql b/sql/updates/world/2012_04_14_05_world_spell_proc_event.sql new file mode 100644 index 00000000000..8cb2b1d3d2b --- /dev/null +++ b/sql/updates/world/2012_04_14_05_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (51486,51485,51483); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 200f1b42ca7..4da56b72017 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7356,20 +7356,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere triggered_spell_id = 63685; break; } - // Storm, Earth and Fire - if (dummySpell->SpellIconID == 3063) - { - // Earthbind Totem summon only - if (procSpell->Id != 2484) - return false; - - float chance = (float)triggerAmount; - if (!roll_chance_f(chance)) - return false; - - triggered_spell_id = 64695; - break; - } // Ancestral Awakening if (dummySpell->SpellIconID == 3065) { diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index af3f53e2369..df2b9c35320 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3427,36 +3427,6 @@ void Spell::_handle_immediate_phase() // process items for (std::list::iterator ihit= m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) DoAllEffectOnTarget(&(*ihit)); - - if (!m_originalCaster) - return; - // Handle procs on cast - // TODO: finish new proc system:P - if (m_UniqueTargetInfo.empty()) - { - uint32 procAttacker = m_procAttacker; - if (!procAttacker) - { - bool positive = m_spellInfo->IsPositive(); - switch (m_spellInfo->DmgClass) - { - case SPELL_DAMAGE_CLASS_MAGIC: - if (positive) - procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; - else - procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG; - break; - case SPELL_DAMAGE_CLASS_NONE: - if (positive) - procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS; - else - procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG; - break; - } - } - // Proc damage for spells which have only dest targets (2484 should proc 51486 for example) - m_originalCaster->ProcDamageAndSpell(NULL, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell); - } } void Spell::_handle_finish_phase() diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 1a0f4576fea..84e3bd8d604 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -35,6 +35,9 @@ enum ShamanSpells SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1 = 8349, SHAMAN_SPELL_SATED = 57724, SHAMAN_SPELL_EXHAUSTION = 57723, + + SHAMAN_SPELL_STORM_EARTH_AND_FIRE = 51483, + EARTHBIND_TOTEM_SPELL_EARTHGRAB = 64695, // For Earthen Power SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474, @@ -221,9 +224,25 @@ class spell_sha_earthbind_totem : public SpellScriptLoader caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff); } + void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (!GetCaster()) + return; + Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!owner) + return; + // Storm, Earth and Fire + if (AuraEffect* aurEff = owner->GetAuraEffectOfRankedSpell(SHAMAN_SPELL_STORM_EARTH_AND_FIRE, EFFECT_1)) + { + if (roll_chance_i(aurEff->GetAmount())) + GetCaster()->CastSpell(GetCaster(), EARTHBIND_TOTEM_SPELL_EARTHGRAB, false); + } + } + void Register() { OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_earthbind_totem_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectApply += AuraEffectApplyFn(spell_sha_earthbind_totem_AuraScript::Apply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); } }; -- cgit v1.2.3 From c7eeb0b59c6c2b9419c2fb3fc81ae74301404c7c Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 15 Apr 2012 09:30:34 -0500 Subject: Scripts/Commands: Make the .modify reputation command only modify the specified reputation (ignore spillovers) Patch by @ogeraisi --- src/server/scripts/Commands/cs_modify.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 32ee96dacfe..70f44dd05d0 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1234,7 +1234,7 @@ public: return false; } - target->GetReputationMgr().SetReputation(factionEntry, amount); + target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount); handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[handler->GetSessionDbcLocale()], factionId, handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry)); return true; -- cgit v1.2.3 From f7e0aedaf05e3edb1445d304cadf9c22931d9e2f Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 15 Apr 2012 09:45:51 -0500 Subject: Fixed broken compile --- src/server/scripts/Commands/cs_modify.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 70f44dd05d0..bb3a4d65b76 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1234,7 +1234,7 @@ public: return false; } - target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount); + target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false); handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[handler->GetSessionDbcLocale()], factionId, handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry)); return true; -- cgit v1.2.3 From 39b3589dcb543f5ba6703d6ea2324dc5318f18b4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 15 Apr 2012 17:41:37 +0200 Subject: Fixed Fixed broken compile --- src/server/game/Reputation/ReputationMgr.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h index 401503783b9..a073845ea73 100755 --- a/src/server/game/Reputation/ReputationMgr.h +++ b/src/server/game/Reputation/ReputationMgr.h @@ -132,6 +132,9 @@ class ReputationMgr void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply); + //! Public for chat command needs + bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); + public: // senders void SendInitialReputations(); void SendForceReactions(); @@ -142,7 +145,6 @@ class ReputationMgr void Initialize(); uint32 GetDefaultStateFlags(FactionEntry const* factionEntry) const; bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); - bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); void SetVisible(FactionState* faction); void SetAtWar(FactionState* faction, bool atWar) const; void SetInactive(FactionState* faction, bool inactive) const; -- cgit v1.2.3 From 413cfac9532d1b8d32b0eeb4c9d1b0972127a352 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 16 Apr 2012 11:40:29 -0400 Subject: Core/NPC: add essence infused moonstone, key to the focusing iris (and hc) to the list of keys gettable from locksmith npcs. (per aokromes) --- src/server/scripts/World/npcs_special.cpp | 48 ++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 6858827ed8e..61b997bba35 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2400,6 +2400,9 @@ enum eLockSmith QUEST_HOTTER_THAN_HELL_H = 10764, QUEST_RETURN_TO_KHAGDAR = 9837, QUEST_CONTAINMENT = 13159, + QUEST_ETERNAL_VIGILANCE = 11011, + QUEST_KEY_TO_THE_FOCUSING_IRIS = 13372, + QUEST_HC_KEY_TO_THE_FOCUSING_IRIS = 13375, ITEM_ARCATRAZ_KEY = 31084, ITEM_SHADOWFORGE_KEY = 11000, @@ -2407,21 +2410,28 @@ enum eLockSmith ITEM_SHATTERED_HALLS_KEY = 28395, ITEM_THE_MASTERS_KEY = 24490, ITEM_VIOLET_HOLD_KEY = 42482, + ITEM_ESSENCE_INFUSED_MOONSTONE = 32449, + ITEM_KEY_TO_THE_FOCUSING_IRIS = 44582, + ITEM_HC_KEY_TO_THE_FOCUSING_IRIS = 44581, SPELL_ARCATRAZ_KEY = 54881, SPELL_SHADOWFORGE_KEY = 54882, SPELL_SKELETON_KEY = 54883, SPELL_SHATTERED_HALLS_KEY = 54884, SPELL_THE_MASTERS_KEY = 54885, - SPELL_VIOLET_HOLD_KEY = 67253 + SPELL_VIOLET_HOLD_KEY = 67253, + SPELL_ESSENCE_INFUSED_MOONSTONE = 40173, }; -#define GOSSIP_LOST_ARCATRAZ_KEY "I've lost my key to the Arcatraz." -#define GOSSIP_LOST_SHADOWFORGE_KEY "I've lost my key to the Blackrock Depths." -#define GOSSIP_LOST_SKELETON_KEY "I've lost my key to the Scholomance." -#define GOSSIP_LOST_SHATTERED_HALLS_KEY "I've lost my key to the Shattered Halls." -#define GOSSIP_LOST_THE_MASTERS_KEY "I've lost my key to the Karazhan." -#define GOSSIP_LOST_VIOLET_HOLD_KEY "I've lost my key to the Violet Hold." +#define GOSSIP_LOST_ARCATRAZ_KEY "I've lost my key to the Arcatraz." +#define GOSSIP_LOST_SHADOWFORGE_KEY "I've lost my key to the Blackrock Depths." +#define GOSSIP_LOST_SKELETON_KEY "I've lost my key to the Scholomance." +#define GOSSIP_LOST_SHATTERED_HALLS_KEY "I've lost my key to the Shattered Halls." +#define GOSSIP_LOST_THE_MASTERS_KEY "I've lost my key to the Karazhan." +#define GOSSIP_LOST_VIOLET_HOLD_KEY "I've lost my key to the Violet Hold." +#define GOSSIP_LOST_ESSENCE_INFUSED_MOONSTONE "I've lost my Essence-Infused Moonstone." +#define GOSSIP_LOST_KEY_TO_THE_FOCUSING_IRIS "I've lost my Key to the Focusing Iris." +#define GOSSIP_LOST_HC_KEY_TO_THE_FOCUSING_IRIS "I've lost my Heroic Key to the Focusing Iris." class npc_locksmith : public CreatureScript { @@ -2456,6 +2466,18 @@ public: if (player->GetQuestRewardStatus(QUEST_CONTAINMENT) && !player->HasItemCount(ITEM_VIOLET_HOLD_KEY, 1, true)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + // Essence-Infused Moonstone + if (player->GetQuestRewardStatus(QUEST_ETERNAL_VIGILANCE) && !player->HasItemCount(ITEM_ESSENCE_INFUSED_MOONSTONE, 1, true)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ESSENCE_INFUSED_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + + // Key to the Focusing Iris + if (player->GetQuestRewardStatus(QUEST_KEY_TO_THE_FOCUSING_IRIS) && !player->HasItemCount(ITEM_KEY_TO_THE_FOCUSING_IRIS, 1, true)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_KEY_TO_THE_FOCUSING_IRIS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); + + // Heroic Key to the Focusing Iris + if (player->GetQuestRewardStatus(QUEST_HC_KEY_TO_THE_FOCUSING_IRIS) && !player->HasItemCount(ITEM_HC_KEY_TO_THE_FOCUSING_IRIS, 1, true)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_HC_KEY_TO_THE_FOCUSING_IRIS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; @@ -2490,6 +2512,18 @@ public: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_VIOLET_HOLD_KEY, false); break; + case GOSSIP_ACTION_INFO_DEF + 7: + player->CLOSE_GOSSIP_MENU(); + player->CastSpell(player, SPELL_ESSENCE_INFUSED_MOONSTONE, false); + break; + case GOSSIP_ACTION_INFO_DEF + 8: + player->CLOSE_GOSSIP_MENU(); + player->AddItem(ITEM_KEY_TO_THE_FOCUSING_IRIS,1); + break; + case GOSSIP_ACTION_INFO_DEF + 9: + player->CLOSE_GOSSIP_MENU(); + player->AddItem(ITEM_HC_KEY_TO_THE_FOCUSING_IRIS,1); + break; } return true; } -- cgit v1.2.3 From bb97ff7601161bb4a76bc2102605edb71bea0099 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 29 Mar 2012 13:14:21 -0400 Subject: Attempt on converting updatewaterstate for use with units (pets and vehicles) --- src/server/game/Entities/Player/Player.cpp | 5 ---- src/server/game/Entities/Unit/Unit.cpp | 45 ++++++++++++++++++++++++++++++ src/server/game/Entities/Unit/Unit.h | 2 ++ src/server/game/Movement/MotionMaster.cpp | 3 ++ 4 files changed, 50 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 53bafbd4521..31bd17ffc8f 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -6830,11 +6830,6 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation, bool t if (GetGroup()) SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION); - // code block for underwater state update - // Unit::UpdatePosition() checks for validity and updates our coordinates - // so we re-fetch them instead of using "raw" coordinates from function params - UpdateUnderwaterState(GetMap(), GetPositionX(), GetPositionY(), GetPositionZ()); - if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE)) GetSession()->SendCancelTrade(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4da56b72017..259f428dfb4 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3089,6 +3089,48 @@ bool Unit::IsUnderWater() const return GetBaseMap()->IsUnderWater(GetPositionX(), GetPositionY(), GetPositionZ()); } +void Unit::UpdateUnderwaterState(Map* m, float x, float y, float z) +{ + if (!isPet() && !IsVehicle()) + return; + + LiquidData liquid_status; + ZLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status); + if (!res) + { + if (_lastLiquid && _lastLiquid->SpellId) + RemoveAurasDueToSpell(_lastLiquid->SpellId); + + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); + _lastLiquid = NULL; + return; + } + + if (uint32 liqEntry = liquid_status.entry) + { + LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry); + if (_lastLiquid && _lastLiquid->SpellId && _lastLiquid->Id != liqEntry) + RemoveAurasDueToSpell(_lastLiquid->SpellId); + + if (liquid && liquid->SpellId) + { + if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER)) + CastSpell(this, liquid->SpellId, true); + else + RemoveAurasDueToSpell(liquid->SpellId); + } + + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER); + _lastLiquid = liquid; + } + else if (_lastLiquid && _lastLiquid->SpellId) + { + RemoveAurasDueToSpell(_lastLiquid->SpellId); + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); + _lastLiquid = NULL; + } +} + void Unit::DeMorph() { SetDisplayId(GetNativeDisplayId()); @@ -17255,6 +17297,9 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel else if (turn) UpdateOrientation(orientation); + // code block for underwater state update + UpdateUnderwaterState(GetMap(), x, y, z); + return (relocated || turn); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 00d66518d3f..828d87216df 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1580,6 +1580,7 @@ class Unit : public WorldObject virtual bool IsInWater() const; virtual bool IsUnderWater() const; + virtual void UpdateUnderwaterState(Map* m, float x, float y, float z); bool isInAccessiblePlaceFor(Creature const* c) const; void SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false); @@ -2353,6 +2354,7 @@ class Unit : public WorldObject uint32 m_state; // Even derived shouldn't modify uint32 m_CombatTimer; uint32 m_lastManaUse; // msecs + LiquidTypeEntry const* _lastLiquid; TimeTrackerSmall m_movesplineTimer; Diminishing m_Diminishing; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index b0ac0b710c1..c0e1eb842ae 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -114,6 +114,9 @@ void MotionMaster::UpdateMotion(uint32 diff) _cleanFlag &= ~MMCF_RESET; } + + // probably not the best place to pu this but im not really sure where else to put it. + _owner->UpdateUnderwaterState(_owner->GetMap(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); } void MotionMaster::DirectClean(bool reset) -- cgit v1.2.3 From a8ae4cf1e3981d5c14c5a1eb5c3d6435e7e35bb2 Mon Sep 17 00:00:00 2001 From: Joni Date: Mon, 16 Apr 2012 18:41:31 +0200 Subject: Add warden documentation to ban reason --- src/server/game/Warden/Warden.cpp | 4 +++- src/server/game/Warden/WardenCheckMgr.cpp | 11 +++++++++-- src/server/game/Warden/WardenCheckMgr.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index fa30adde72a..0734e0a0f63 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -187,7 +187,9 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/) duration << sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_BAN_DURATION) << "s"; std::string accountName; AccountMgr::GetName(_session->GetAccountId(), accountName); - sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), "Warden Anticheat violation","Server"); + std::stringstream banReason; + banReason << "Warden Anticheat Violation: " << check->Comment << " (CheckId: " << check->CheckId << ")"; + sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), banReason.str(),"Server"); return "Ban"; break; diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 90d1cfc0140..f4c7a5069cf 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -63,8 +63,8 @@ void WardenCheckMgr::LoadWardenChecks() CheckStore.resize(maxCheckId + 1); - // 0 1 2 3 4 5 6 - result = WorldDatabase.Query("SELECT id, type, data, result, address, length, str FROM warden_checks ORDER BY id ASC"); + // 0 1 2 3 4 5 6 7 + result = WorldDatabase.Query("SELECT id, type, data, result, address, length, str, comment FROM warden_checks ORDER BY id ASC"); uint32 count = 0; do @@ -78,9 +78,11 @@ void WardenCheckMgr::LoadWardenChecks() uint32 address = fields[4].GetUInt32(); uint8 length = fields[5].GetUInt8(); std::string str = fields[6].GetString(); + std::string comment = fields[7].GetString(); WardenCheck* wardenCheck = new WardenCheck(); wardenCheck->Type = checkType; + wardenCheck->CheckId = id; // Initialize action with default action from config wardenCheck->Action = WardenActions(sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_FAIL_ACTION)); @@ -134,6 +136,11 @@ void WardenCheckMgr::LoadWardenChecks() CheckResultStore[id] = wr; } + if (comment.empty()) + wardenCheck->Comment = "Undocumented Check"; + else + wardenCheck->Comment = comment; + ++count; } while (result->NextRow()); diff --git a/src/server/game/Warden/WardenCheckMgr.h b/src/server/game/Warden/WardenCheckMgr.h index 45de18081c2..7a83d8f0c6d 100644 --- a/src/server/game/Warden/WardenCheckMgr.h +++ b/src/server/game/Warden/WardenCheckMgr.h @@ -36,6 +36,8 @@ struct WardenCheck uint32 Address; // PROC_CHECK, MEM_CHECK, PAGE_CHECK uint8 Length; // PROC_CHECK, MEM_CHECK, PAGE_CHECK std::string Str; // LUA, MPQ, DRIVER + std::string Comment; + uint16 CheckId; enum WardenActions Action; }; -- cgit v1.2.3 From 0f48da6ed15f26b16a3d40e187978c09c2f565e6 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 16 Apr 2012 20:33:19 +0200 Subject: Spell/Warrior: Fixed Concussion Blow damage part Thanks ShinDarth --- src/server/scripts/Spells/spell_warrior.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 66e44112b8a..3e4c043ae47 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -365,7 +365,7 @@ class spell_warr_concussion_blow : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { - SetHitDamage(GetHitDamage() + CalculatePctF(GetHitDamage(),GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK))); + SetHitDamage(CalculatePctN(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue())); } void Register() -- cgit v1.2.3 From 3189b57bf527fa82faea289400c61a3f969d390a Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 17 Apr 2012 02:14:41 +0200 Subject: Core/Unit: Always initialize a pointer before using it. (less segfaults, more fun) --- src/server/game/Entities/Unit/Unit.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 259f428dfb4..da23a7ba010 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -252,6 +252,7 @@ m_HostileRefManager(this) _focusSpell = NULL; _targetLocked = false; + _lastLiquid = NULL; } //////////////////////////////////////////////////////////// -- cgit v1.2.3 From 61cb2db1bd57e90e56a62853c9445e243a189125 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 17 Apr 2012 10:16:31 +0200 Subject: Core/Player: Removed _lastLiquid from Player class, no need to have it in both Unit and Player --- src/server/game/Entities/Player/Player.cpp | 1 - src/server/game/Entities/Player/Player.h | 1 - src/server/game/Entities/Unit/Unit.h | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 31bd17ffc8f..0992c488315 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -724,7 +724,6 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep for (uint8 i=0; i uint32 m_lastFallTime; float m_lastFallZ; - LiquidTypeEntry const* _lastLiquid; int32 m_MirrorTimer[MAX_TIMERS]; uint8 m_MirrorTimerFlags; uint8 m_MirrorTimerFlagsLast; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 828d87216df..5a6276d3b0c 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2320,6 +2320,7 @@ class Unit : public WorldObject Vehicle* m_vehicleKit; uint32 m_unitTypeMask; + LiquidTypeEntry const* _lastLiquid; bool IsAlwaysVisibleFor(WorldObject const* seer) const; bool IsAlwaysDetectableFor(WorldObject const* seer) const; @@ -2354,7 +2355,6 @@ class Unit : public WorldObject uint32 m_state; // Even derived shouldn't modify uint32 m_CombatTimer; uint32 m_lastManaUse; // msecs - LiquidTypeEntry const* _lastLiquid; TimeTrackerSmall m_movesplineTimer; Diminishing m_Diminishing; -- cgit v1.2.3 From 17d87c0103703d38eb64f595e8a2155553b39d29 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 17 Apr 2012 09:56:08 -0400 Subject: Core/Misc: researched the reasons for instance reset failure and added them as comments to the sendresetinstancefailed function. --- src/server/game/Entities/Player/Player.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 0992c488315..141902fbbdc 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -19777,7 +19777,11 @@ void Player::SendResetInstanceSuccess(uint32 MapId) void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) { - // TODO: find what other fail reasons there are besides players in the instance + /*reasons for instance reset failure: + // 0: There are players inside the instance. + // 1: There are players offline in your party. + // 2>: There are players in your party attempting to zone into an instance. + */ WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4); data << uint32(reason); data << uint32(MapId); -- cgit v1.2.3 From 3bfe59b41d4e4111e1641012ff07f6f480b3d055 Mon Sep 17 00:00:00 2001 From: The Game Date: Tue, 17 Apr 2012 11:40:58 -0400 Subject: Fix unit tracking to not being limited to the caster of SPELL_AURA_MOD_STALKED, fixes https://github.com/TrinityCore/TrinityCore/issues/6208 --- src/server/game/Entities/Object/Object.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 70b680c6ae0..851c0f47e0f 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -626,7 +626,11 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* if (!target->isAllowedToLoot(creature)) dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE; } - + if(Unit const* unit = ToUnit()) + { + if(!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) + dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; + } *data << dynamicFlags; } // FG: pretend that OTHER players in own group are friendly ("blue") -- cgit v1.2.3 From 839abe4dca9ae326b7c8397212318d98acdbcb05 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 17 Apr 2012 11:45:26 -0400 Subject: Core/Spells: fix holy shock cast on friendly opposing team going on cooldown and saying invalid target. spell will now fail with invalid target and not cause a cooldown --- src/server/scripts/Spells/spell_paladin.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index d823c629d4b..9f7f7d847e1 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -285,9 +285,20 @@ class spell_pal_holy_shock : public SpellScriptLoader } } + SpellCastResult CheckCast() + { + Player* caster = GetCaster()->ToPlayer(); + if (GetTargetUnit()) + if (Player* target = GetTargetUnit()->ToPlayer()) + if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; + return SPELL_CAST_OK; + } + void Register() { // add dummy effect spell handler to Holy Shock + OnCheckCast += SpellCheckCastFn(spell_pal_holy_shock_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; -- cgit v1.2.3 From a998554f8f69d2e8453d800f9f8ffe2afc1ee18d Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 17 Apr 2012 22:33:45 +0200 Subject: Script/Pit of Saron: Fix logic in spell_tyrannus_overlord_brand should fix #6247 --- .../Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 88e9bedcd07..8d015adf4a4 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -387,8 +387,7 @@ class player_overlord_brandAI : public PlayerAI void SetGUID(uint64 guid, int32 /*type*/) { tyrannus = ObjectAccessor::GetCreature(*me, guid); - if (!tyrannus) - me->IsAIEnabled = false; + me->IsAIEnabled = tyrannus != NULL; } void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) @@ -423,10 +422,9 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader return; oldAI = GetTarget()->GetAI(); + oldAIState = GetTarget()->IsAIEnabled; GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer())); GetTarget()->GetAI()->SetGUID(GetCasterGUID()); - oldAIState = GetTarget()->IsAIEnabled; - GetTarget()->IsAIEnabled = true; } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) -- cgit v1.2.3 From bec761a3e0809c93ca0dd84844ed9635fcce2ac6 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 18 Apr 2012 12:44:56 +0200 Subject: Core/Creatures: Set melee sheath as default only for creatures that do not have creature_addon data --- src/server/game/Entities/Creature/Creature.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 6a8ae07291a..a7b57c7323c 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -357,8 +357,9 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) m_regenHealth = cInfo->RegenHealth; - // creatures always have melee weapon ready if any - SetSheath(SHEATH_STATE_MELEE); + // creatures always have melee weapon ready if any unless specified otherwise + if (!GetCreatureAddon()) + SetSheath(SHEATH_STATE_MELEE); SelectLevel(GetCreatureTemplate()); if (team == HORDE) -- cgit v1.2.3 From a483eb5f11bef57060397ffb8eae07c337f2fc56 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 18 Apr 2012 12:45:58 +0200 Subject: Core/Scripts: Added possibility to remove phase setting from EventMap and an empty-checking method --- src/server/game/AI/CreatureAIImpl.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index 98b0afdefc9..d097adf38ec 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -326,11 +326,15 @@ class EventMap : private std::map uint32 GetPhaseMask() const { return (_phase >> 24) & 0xFF; } + bool Empty() const { return empty(); } + // Sets event phase, must be in range 1 - 8 void SetPhase(uint32 phase) { if (phase && phase < 8) _phase = (1 << (phase + 24)); + else if (!phase) + _phase = 0; } // Creates new event entry in map with given id, time, group if given (1 - 8) and phase if given (1 - 8) -- cgit v1.2.3 From 284894b20b40af00951bdc25dd66dc759bc1d273 Mon Sep 17 00:00:00 2001 From: Frca Date: Wed, 18 Apr 2012 15:10:00 +0200 Subject: Core: Do not set TeleportDestination as reference in WorldSession::HandleMoveWorldportAckOpcode() Signed-off-by: Frca --- src/server/game/Handlers/MovementHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index f1217e58b3f..6c0365a05e9 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 &loc = GetPlayer()->GetTeleportDest(); + const WorldLocation loc = GetPlayer()->GetTeleportDest(); // possible errors in the coordinate validity check if (!MapManager::IsValidMapCoord(loc)) -- cgit v1.2.3 From 7dc228ea54dca734a9badcc41d5a4efe9f18c650 Mon Sep 17 00:00:00 2001 From: The Game Date: Wed, 18 Apr 2012 13:39:07 -0400 Subject: Fix code style, thanks Discover. --- src/server/game/Entities/Object/Object.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 851c0f47e0f..8bf22c8b7a0 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -626,11 +626,9 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* if (!target->isAllowedToLoot(creature)) dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE; } - if(Unit const* unit = ToUnit()) - { - if(!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) + if (Unit const* unit = ToUnit()) + if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; - } *data << dynamicFlags; } // FG: pretend that OTHER players in own group are friendly ("blue") -- cgit v1.2.3 From 5b80e7360bb588c47ee157e1e19f1a7dff834510 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 18 Apr 2012 13:57:12 -0500 Subject: Core/Collision: Disable LoS check for destroyed destructible buildings. More research has to be done. Closes #6228 --- src/server/game/Entities/GameObject/GameObject.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index d96c9052b7a..f58dd6b2e4d 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1825,6 +1825,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* m_goValue->Building.Health = m_goValue->Building.MaxHealth; SetGoAnimProgress(255); } + EnableCollision(true); break; case GO_DESTRUCTIBLE_DAMAGED: { @@ -1881,6 +1882,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* m_goValue->Building.Health = 0; SetGoAnimProgress(0); } + EnableCollision(false); break; } case GO_DESTRUCTIBLE_REBUILDING: @@ -1900,6 +1902,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* m_goValue->Building.Health = m_goValue->Building.MaxHealth; SetGoAnimProgress(255); } + EnableCollision(true); break; } } -- cgit v1.2.3 From 4818c70dcb4fba92919333d50a54458c4f4e5e7e Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 18 Apr 2012 22:27:40 +0200 Subject: Core/Spells: Removed unneeded phase check from spell casts, its already done in canSeeOrDetect for spells that need it. Probably more phase checks are not needed either --- src/server/game/AI/EventAI/CreatureEventAI.cpp | 2 +- src/server/game/Combat/ThreatManager.cpp | 3 ++- src/server/game/Entities/Object/Object.h | 4 ++-- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- src/server/game/Grids/Notifiers/GridNotifiers.h | 2 +- .../game/Grids/Notifiers/GridNotifiersImpl.h | 25 +++++++++------------- 6 files changed, 18 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index 7a2b83273c9..835705a0d7c 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -1107,7 +1107,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff) break; case EVENT_T_RANGE: if (me->getVictim()) - if (me->IsInMap(me->getVictim())) + if (me->IsInMap(me->getVictim()) && me->InSamePhase(me->getVictim())) if (me->IsInRange(me->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist)) ProcessEvent(*i); break; diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index d82e43ba83b..e604eaf9024 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -75,7 +75,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn return false; // not in same map or phase - if (!hatedUnit->IsInMap(hatingUnit)) + if (!hatedUnit->IsInMap(hatingUnit) || !hatedUnit->InSamePhase(hatingUnit)) return false; // spell not causing threat @@ -182,6 +182,7 @@ void HostileReference::updateOnlineStatus() && (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster()) && !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT) && getTarget()->IsInMap(getSourceUnit()) + && getTarget()->InSamePhase(getSourceUnit()) ) { Creature* creature = getSourceUnit()->ToCreature(); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 39be4d4f529..3693f683b24 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -685,7 +685,7 @@ class WorldObject : public Object, public WorldLocation bool IsInMap(const WorldObject* obj) const { if (obj) - return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj); + return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()); return false; } bool IsWithinDist3d(float x, float y, float z, float dist) const @@ -703,7 +703,7 @@ class WorldObject : public Object, public WorldLocation } bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const { - return obj && IsInMap(obj) && _IsWithinDist(obj, dist2compare, is3D); + return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D); } bool IsWithinLOS(float x, float y, float z) const; bool IsWithinLOSInMap(const WorldObject* obj) const; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index da23a7ba010..fb91c3fc9f1 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -460,7 +460,7 @@ void Unit::resetAttackTimer(WeaponAttackType type) bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const { - if (!obj || !IsInMap(obj)) + if (!obj || !IsInMap(obj) || !InSamePhase(obj)) return false; float dx = GetPositionX() - obj->GetPositionX(); @@ -476,7 +476,7 @@ bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const { - if (!obj || !IsInMap(obj)) + if (!obj || !IsInMap(obj) || !InSamePhase(obj)) return false; float dx = GetPositionX() - obj->GetPositionX(); diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index ec79db769da..e81822e72be 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -1287,7 +1287,7 @@ namespace Trinity AllWorldObjectsInRange(const WorldObject* object, float maxRange) : m_pObject(object), m_fRange(maxRange) {} bool operator() (WorldObject* go) { - return m_pObject->IsWithinDist(go, m_fRange, false); + return m_pObject->IsWithinDist(go, m_fRange, false) && m_pObject->InSamePhase(go); } private: const WorldObject* m_pObject; diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h index 40b3863679b..e3cda4dd76d 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h +++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h @@ -251,9 +251,8 @@ void Trinity::WorldObjectListSearcher::Visit(PlayerMapType &m) return; for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } template @@ -263,9 +262,8 @@ void Trinity::WorldObjectListSearcher::Visit(CreatureMapType &m) return; for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } template @@ -275,9 +273,8 @@ void Trinity::WorldObjectListSearcher::Visit(CorpseMapType &m) return; for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } template @@ -287,9 +284,8 @@ void Trinity::WorldObjectListSearcher::Visit(GameObjectMapType &m) return; for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } template @@ -299,9 +295,8 @@ void Trinity::WorldObjectListSearcher::Visit(DynamicObjectMapType &m) return; for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } // Gameobject searchers -- cgit v1.2.3 From 435a9a566a326424cf6ec924dedbae7b41802f06 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 Apr 2012 14:28:45 +0200 Subject: Core/Creatures: Changed how boss creatures are identified, creature_template.rank was not a good indicator --- src/server/game/Entities/Creature/Creature.h | 2 +- src/server/game/Miscellaneous/SharedDefines.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 4b5b07fd8a5..f6d03ca38b2 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -507,7 +507,7 @@ class Creature : public Unit, public GridObject, public MapCreature if (isPet()) return false; - return GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS; + return GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_BOSS; } bool IsDungeonBoss() const; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 0386e6b4214..06aca10879d 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -2566,7 +2566,7 @@ enum CreatureTypeFlags { CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter CREATURE_TYPEFLAGS_GHOST = 0x00000002, // Creature are also visible for not alive player. Allow gossip interaction if npcflag allow? - CREATURE_TYPEFLAGS_UNK2 = 0x00000004, + CREATURE_TYPEFLAGS_BOSS = 0x00000004, CREATURE_TYPEFLAGS_UNK3 = 0x00000008, CREATURE_TYPEFLAGS_UNK4 = 0x00000010, CREATURE_TYPEFLAGS_UNK5 = 0x00000020, -- cgit v1.2.3 From 3c2dd7c5edf7eaee1a7314e390aa2f51f3310687 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 Apr 2012 23:19:27 +0200 Subject: Scripts/Ulduar: Algalon the Observer --- .../world/2012_04_19_03_world_instance_ulduar.sql | 174 +++ src/server/game/Entities/Creature/Creature.cpp | 6 +- src/server/game/Entities/Player/Player.cpp | 13 + src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/game/Spells/SpellMgr.cpp | 13 + src/server/game/Spells/SpellScript.cpp | 2 +- src/server/game/Spells/SpellScript.h | 2 +- src/server/scripts/CMakeLists.txt | 1 + src/server/scripts/Northrend/CMakeLists.txt | 2 +- .../Northrend/Ulduar/Ulduar/boss_algalon.cpp | 376 ------ .../Ulduar/Ulduar/boss_algalon_the_observer.cpp | 1374 ++++++++++++++++++++ .../Northrend/Ulduar/Ulduar/instance_ulduar.cpp | 270 +++- .../scripts/Northrend/Ulduar/Ulduar/ulduar.h | 229 ++-- 13 files changed, 1981 insertions(+), 483 deletions(-) create mode 100644 sql/updates/world/2012_04_19_03_world_instance_ulduar.sql delete mode 100644 src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp create mode 100644 src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp (limited to 'src') diff --git a/sql/updates/world/2012_04_19_03_world_instance_ulduar.sql b/sql/updates/world/2012_04_19_03_world_instance_ulduar.sql new file mode 100644 index 00000000000..a39ed9c01d5 --- /dev/null +++ b/sql/updates/world/2012_04_19_03_world_instance_ulduar.sql @@ -0,0 +1,174 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1603019 AND -1603000; +UPDATE `creature_template` SET `ScriptName`='' WHERE `ScriptName` IN ('boss_algalon','mob_collapsing_star'); + +-- Difficulty linking +UPDATE `creature_template` SET `difficulty_entry_1`=34296 WHERE `entry`=32953; -- Black Hole + +UPDATE `creature_template` SET `minlevel`=80,`maxlevel`=80,`faction_A`=35,`faction_H`=35,`unit_flags`=0x8300,`equipment_id`=2478 WHERE `entry`=34064; -- Brann Bronzebeard +UPDATE `creature_template` SET `speed_walk`=4,`speed_run`=2.14286,`exp`=2,`minlevel`=83,`maxlevel`=83,`faction_A`=190,`faction_H`=190,`unit_flags`=0x8100,`BaseAttackTime`=1000,`equipment_id`=2479 WHERE `entry` IN (32871,33070); -- Algalon the Observer +UPDATE `creature_template` SET `faction_A`=190,`faction_H`=190,`exp`=2,`minlevel`=83,`maxlevel`=83,`unit_flags`=0x2000000,`speed_run`=1,`InhabitType`=4 WHERE `entry`=34246; -- Azeroth +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`exp`=2,`minlevel`=74,`maxlevel`=74,`unit_flags`=0x2000000,`flags_extra`=0x80,`InhabitType`=4 WHERE `entry`=33086; -- Algalon Stalker +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`unit_flags`=0x2008000,`speed_run`=1,`equipment_id`=2480,`InhabitType`=4 WHERE `entry` IN (33052,33116); -- Living Constellation +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`speed_run`=1,`RegenHealth`=0 WHERE `entry` IN (32955,34215); -- Collapsing Star +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`exp`=2,`minlevel`=80,`maxlevel`=80,`unit_flags`=0x2000000,`speed_run`=1,`InhabitType`=4 WHERE `entry` IN (32953,34296); -- Black Hole +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`minlevel`=81,`maxlevel`=81,`unit_flags`=0x8000,`speed_walk`=4,`speed_run`=1.42857,`InhabitType`=4 WHERE `entry` IN(33089,34097,34221,34222); -- Dark Matter +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`unit_flags`=0x2000000,`flags_extra`=0x80 WHERE `entry`=34100; -- Algalon Void Zone Visual Stalker +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`unit_flags`=0x2000000,`speed_run`=1,`InhabitType`=4 WHERE `entry`=34099; -- Worm Hole +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`exp`=2,`minlevel`=74,`maxlevel`=74,`unit_flags`=0x2000000,`flags_extra`=0x80,`InhabitType`=4 WHERE `entry`=33104; -- Algalon Stalker Asteroid Target 01 +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`exp`=2,`minlevel`=74,`maxlevel`=74,`unit_flags`=0x2000000,`flags_extra`=0x80,`InhabitType`=4 WHERE `entry`=33105; -- Algalon Stalker Asteroid Target 02 + +UPDATE `creature_model_info` SET `bounding_radius`=0.93,`combat_reach`=9,`gender`=0 WHERE `modelid`=28641; -- Algalon the Observer +UPDATE `creature_model_info` SET `bounding_radius`=0.02,`combat_reach`=0.2,`gender`=2 WHERE `modelid`=29133; -- Azeroth +UPDATE `creature_model_info` SET `bounding_radius`=0.62,`combat_reach`=0,`gender`=2 WHERE `modelid`=28741; -- Living Constellation +UPDATE `creature_model_info` SET `bounding_radius`=1,`combat_reach`=1,`gender`=2 WHERE `modelid`=28988; -- Collapsing Star +UPDATE `creature_model_info` SET `bounding_radius`=1,`combat_reach`=1,`gender`=2 WHERE `modelid`=28460; -- Black Hole + +UPDATE `gameobject_template` SET `faction`=114,`flags`=32 WHERE `entry`=194910; -- Doodad_UL_SigilDoor_03 +UPDATE `gameobject_template` SET `data0`=579 WHERE `entry`=194628; -- Celestial Planetarium Access + +UPDATE `creature_template` SET `ScriptName`='boss_algalon_the_observer' WHERE `entry`=32871; -- Algalon the Observer +UPDATE `creature_template` SET `ScriptName`='npc_living_constellation' WHERE `entry`=33052; -- Living Constellation +UPDATE `creature_template` SET `ScriptName`='npc_collapsing_star' WHERE `entry`=32955; -- Collapsing Star +UPDATE `creature_template` SET `ScriptName`='npc_brann_bronzebeard_algalon' WHERE `entry`=34064; -- Brann Bronzebeard +UPDATE `gameobject_template` SET `ScriptName`='go_celestial_planetarium_access' WHERE `entry` IN (194628,194752); -- Celestial Planetarium Access +UPDATE `creature_template` SET `AIName`='NullCreatureAI' WHERE `entry` IN (32953,34099); -- Black Hole + +DELETE FROM `creature` WHERE `guid` IN (41781,41783,41790,41811,41812,41814,41819,41820,41821,41822,41823,41875); +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`MovementType`) VALUES +(41781,33086,603,3,1,1627.400,-339.4133,417.4044,1.378810,7200,0,0), -- Algalon Stalker +(41783,33086,603,3,1,1622.681,-344.2576,417.3955,1.378810,7200,0,0), -- Algalon Stalker +(41790,33086,603,3,1,1629.984,-271.4798,417.4045,4.782202,7200,0,0), -- Algalon Stalker +(41811,33086,603,3,1,1630.005,-345.5189,417.3955,1.378810,7200,0,0), -- Algalon Stalker +(41812,33089,603,3,16,1622.451,-321.1563,417.6188,4.677482,7200,20,1), -- Dark Matter +(41814,33089,603,3,16,1649.438,-319.8127,418.3941,1.082104,7200,20,1), -- Dark Matter +(41819,33089,603,3,16,1615.060,-291.6816,417.7796,3.490659,7200,20,1), -- Dark Matter +(41820,33089,603,3,16,1647.005,-288.6790,417.3955,3.490659,7200,20,1), -- Dark Matter +(41821,33089,603,3,16,1622.451,-321.1563,417.6188,4.677482,7200,20,1), -- Dark Matter +(41822,33089,603,3,16,1649.438,-319.8127,418.3941,1.082104,7200,20,1), -- Dark Matter +(41823,33089,603,3,16,1615.060,-291.6816,417.7796,3.490659,7200,20,1), -- Dark Matter +(41875,33089,603,3,16,1647.005,-288.6790,417.3955,3.490659,7200,20,1); -- Dark Matter + +SET @OGUID := 252; +DELETE FROM `gameobject` WHERE `id` IN (194767,194910,194911,194715,194716,194148,194253,194628,194752,194821,194822); +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(@OGUID+00,194767,603,3,17,1632.024,-182.9211,427.6681,0.000000,0,0,8.742278E-08,1, 604800,255,1), -- Doodad_UL_SigilDoor_01 +(@OGUID+04,194911,603,3,17,1632.024,-182.9211,408.4224,3.141593,0,0,8.742278E-08,1, 604800,255,1), -- Doodad_UL_SigilDoor_02 +(@OGUID+10,194910,603,3,17,1632.053,-266.1495,438.5608,0.000000,0,0,8.742278E-08,1, 604800,255,0), -- Doodad_UL_SigilDoor_03 +(@OGUID+12,194715,603,3,17,1632.053,-307.6541,417.3211,0.000000,0,0,8.742278E-08,1, 604800,255,0), -- Doodad_UL_UniverseFloor_01 +(@OGUID+19,194716,603,3,17,1632.251,-307.5483,416.2641,0.000000,0,0,8.742278E-08,1, 604800,255,1), -- Doodad_UL_UniverseFloor_02 +(@OGUID+22,194148,603,3,17,1632.053,-307.6541,417.3211,0.000000,0,0,8.742278E-08,1, 604800,255,1), -- Doodad_UL_UniverseGlobe01 +(@OGUID+24,194253,603,3,17,1631.908,-246.4970,417.3211,0.000000,0,0,8.742278E-08,1, 604800,255,1), -- Doodad_UL_Ulduar_Trapdoor_03 +(@OGUID+29,194628,603,1, 1,1646.182,-174.6881,427.2536,1.553341,0,0,0.000000E-00,1, 604800,255,1), -- Celestial Planetarium Access +(@OGUID+33,194752,603,2, 1,1646.182,-174.6881,427.2536,1.553341,0,0,0.000000E-00,1, 604800,255,1), -- Celestial Planetarium Access +(@OGUID+37,194821,603,1, 1,1632.099,-306.5609,417.3210,4.694937,0,0,0.000000E-00,1,-604800,255,1), -- Gift of the Observer (10 man) +(@OGUID+46,194822,603,2, 1,1632.099,-306.5609,417.3210,4.694937,0,0,0.000000E-00,1,-604800,255,1); -- Gift of the Observer (25 man) + +DELETE FROM `creature_equip_template` WHERE `entry` IN (2478,2479,2480); +INSERT INTO `creature_equip_template` (`entry`,`itemEntry1`,`itemEntry2`,`itemEntry3`) VALUES +(2478,1903,25972,0), +(2479,45985,45985,0), +(2480,44952,0,0); + +DELETE FROM `creature_template_addon` WHERE `entry` IN (32871,33070,33052,33116,33089,34221,34097,34222,33105); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES +(32871,0,0x0000000,0x0,NULL), -- Algalon the Observer +(33070,0,0x0000000,0x0,NULL), -- Algalon the Observer +(33052,0,0x3000000,0x1,NULL), -- Living Constellation +(33116,0,0x3000000,0x1,NULL), -- Living Constellation +(33089,0,0x3000000,0x1,NULL), -- Dark Matter +(34221,0,0x3000000,0x1,NULL), -- Dark Matter +(34097,0,0x3000000,0x1,NULL), -- Unleashed Dark Matter +(34222,0,0x3000000,0x1,NULL), -- Unleashed Dark Matter +(33105,0,0x3000000,0x1,NULL); -- Algalon Stalker Asteroid Target 02 + +DELETE FROM `creature_text` WHERE `entry` IN (32871,34064); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`sound`,`emote`,`comment`) VALUES +(34064,0,0,'We did it, lads! We got here before Algalon''s arrival. Maybe we can rig the systems to interfere with his analysis--',14,15824,0,'Brann Bronzebeard - SAY_BRANN_ALGALON_INTRO_1'), +(34064,1,0,'I''ll head back to the Archivum and see if I can jam his signal. I might be able to buy us some time while you take care of him.',12,15825,0,'Brann Bronzebeard - SAY_BRANN_ALGALON_INTRO_2'), +(34064,2,0,'I know just the place. Will you be all right?',14,15823,6,'Brann Bronzebeard - SAY_BRANN_ALGALON_OUTRO'), +(32871,0,0,'Translocation complete. Commencing planetary analysis of Azeroth.',12,15405,0,'Algalon the Observer - SAY_ALGALON_INTRO_1'), +(32871,1,0,'Stand back, mortals. I''m not here to fight you.',12,15406,0,'Algalon the Observer - SAY_ALGALON_INTRO_2'), +(32871,2,0,'It is in the universe''s best interest to re-originate this planet should my analysis find systemic corruption. Do not interfere.',12,15407,0,'Algalon the Observer - SAY_ALGALON_INTRO_3'), +(32871,3,0,'Your actions are illogical. All possible results for this encounter have been calculated. The Pantheon will receive the Observer''s message regardless of outcome.',14,15386,0,'Algalon the Observer - SAY_ALGALON_START_TIMER'), +(32871,4,0,'See your world through my eyes: A universe so vast as to be immeasurable - incomprehensible even to your greatest minds.',14,15390,1,'Algalon the Observer - SAY_ALGALON_AGGRO'), +(32871,5,0,'The stars come to my aid!',14,15392,0,'Algalon the Observer - SAY_ALGALON_COLLAPSING_STAR'), +(32871,6,0,'%s begins to Summon Collapsing Stars!',41,0,0,'Algalon the Observer - EMOTE_ALGALON_COLLAPSING_STAR'), +(32871,7,0,'Witness the fury of the cosmos!',14,15396,0,'Algalon the Observer - SAY_ALGALONG_BIG_BANG'), +(32871,8,0,'%s begins to cast Big Bang!',41,0,0,'Algalon the Observer - EMOTE_ALGALON_BIG_BANG'), +(32871,9,0,'You are out of time.',14,15394,0,'Algalon the Observer - SAY_ALGALON_ASCEND'), +(32871,10,0,'%s begins to cast Cosmic Smash!',41,0,0,'Algalon the Observer - EMOTE_ALGALON_COSMIC_SMASH'), +(32871,11,0,'Behold the tools of creation!',14,15397,0,'Algalon the Observer - SAY_ALGALON_PHASE_TWO'), +(32871,12,0,'I have seen worlds bathed in the Makers'' flames, their denizens fading without as much as a whimper. Entire planetary systems born and razed in the time that it takes your mortal hearts to beat once. Yet all throughout, my own heart devoid of emotion... of empathy. I. Have. Felt. Nothing. A million-million lives wasted. Had they all held within them your tenacity? Had they all loved life as you do?',14,15393,1,'Algalon the Observer - SAY_ALGALON_OUTRO_1'), +(32871,13,0,'Perhaps it is your imperfections... that which grants you free will... that allows you to persevere against all cosmically calculated odds. You prevail where the Titan''s own perfect creations have failed.',14,15401,1,'Algalon the Observer - SAY_ALGALON_OUTRO_2'), +(32871,14,0,'I''ve rearranged the reply code - your planet will be spared. I cannot be certain of my own calculations anymore.',14,15402,1,'Algalon the Observer - SAY_ALGALON_OUTRO_3'), +(32871,15,0,'I lack the strength to transmit the signal. You must... hurry... find a place of power... close to the skies.',14,15403,1,'Algalon the Observer - SAY_ALGALON_OUTRO_4'), +(32871,16,0,'Do not worry about my fate, Bronzen. If the signal is not transmitted in time, re-origination will proceed regardless. Save... your world...',14,15404,1,'Algalon the Observer - SAY_ALGALON_OUTRO_5'), +(32871,17,0,'Analysis complete. There is partial corruption in the planet''s life-support systems as well as complete corruption in most of the planet''s defense mechanisms.',12,15398,0,'Algalon the Observer - SAY_ALGALON_DESPAWN_1'), +(32871,18,0,'Begin uplink: Reply Code: ''Omega''. Planetary re-origination requested.',12,15399,0,'Algalon the Observer - SAY_ALGALON_DESPAWN_2'), +(32871,19,0,'Farewell, mortals. Your bravery is admirable, for such flawed creatures.',12,15400,0,'Algalon the Observer - SAY_ALGALON_DESPAWN_3'), +(32871,20,0,'Loss of life unavoidable.',14,15387,0,'Algalon the Observer - SAY_ALGALON_KILL'), +(32871,20,1,'I do what I must.',14,15388,0,'Algalon the Observer - SAY_ALGALON_KILL'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (64996,62266,65509,62304,64597); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`Comment`) VALUES +(13,1,64996,31,3,34246,'Algalon the Observer - Reorigination on Azeroth'), +(13,1,62266,31,3,33052,'Algalon Stalker - target Living Constellation'), +(13,1,65509,31,3,33052,'Black Hole - target Living Constellation'), +(13,1,62304,31,3,33104,'Cosmic Smash - target trigger'), +(13,1,64597,31,3,33104,'Cosmic Smash - target trigger'); + +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_phase_punch'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_arcane_barrage'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_trigger_3_adds'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_collapse'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_big_bang'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_remove_phase'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_cosmic_smash'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_cosmic_smash_damage'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_supermassive_fail'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(64412,'spell_algalon_phase_punch'), +(64599,'spell_algalon_arcane_barrage'), +(64607,'spell_algalon_arcane_barrage'), +(62266,'spell_algalon_trigger_3_adds'), +(62018,'spell_algalon_collapse'), +(64443,'spell_algalon_big_bang'), +(64584,'spell_algalon_big_bang'), +(64445,'spell_algalon_remove_phase'), +(62295,'spell_algalon_cosmic_smash'), +(62311,'spell_algalon_cosmic_smash_damage'), +(64596,'spell_algalon_cosmic_smash_damage'), +(65311,'spell_algalon_supermassive_fail'); + +SET @DIFF_ID := 3262; +DELETE FROM `spelldifficulty_dbc` WHERE `id` BETWEEN @DIFF_ID AND @DIFF_ID+5; +INSERT INTO `spelldifficulty_dbc` (`id`,`spellid0`,`spellid1`) VALUES +(@DIFF_ID+0,64395,64592), +(@DIFF_ID+1,64599,64607), +(@DIFF_ID+2,64443,64584), +(@DIFF_ID+3,64122,65108), +(@DIFF_ID+4,62301,64598), +(@DIFF_ID+5,62304,64597); + +UPDATE `instance_encounters` SET `creditType`=1,`creditEntry`=65184 WHERE `entry` IN (757,771); -- Algalon the Observer + +DELETE FROM `disables` WHERE `sourceType`=4 AND `entry` IN (10565,10566,10678,9990,9991,10567,10569,10698,10780,10781,10782,10783,10568,10570); +DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (10565,10566,10678,9990,9991,10567,10569,10698,10780,10781,10782,10783,10568,10570); +INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`ScriptName`) VALUES +(10565,12,0,0,''), -- Algalon the Observer kills (Ulduar 10 player) +(10566,12,1,0,''), -- Algalon the Observer kills (Ulduar 25 player) +(10678,12,0,0,''), -- Herald of the Titans +(10678,18,0,0,''), -- Herald of the Titans +(9990,12,0,0,''), -- Lich King 10-player bosses killed +(9991,12,1,0,''), -- Lich King 25-player bosses killed +(10567,12,0,0,''), -- Observed (10 player) +(10569,12,1,0,''), -- Observed (25 player) +(10698,12,1,0,''), -- Realm First! Celestial Defender +(10780,12,0,0,''), -- Supermassive (10 player) +(10781,12,0,0,''), -- Supermassive (10 player) +(10782,12,1,0,''), -- Supermassive (25 player) +(10783,12,1,0,''), -- Supermassive (25 player) +(10568,11,0,0,'achievement_he_feeds_on_your_tears'), -- He Feeds On Your Tears (10 player) +(10568,12,0,0,''), -- He Feeds On Your Tears (10 player) +(10570,11,0,0,'achievement_he_feeds_on_your_tears'), -- He Feeds On Your Tears (25 player) +(10570,12,1,0,''); -- He Feeds On Your Tears (25 player) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index a7b57c7323c..ed89041ff66 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -796,10 +796,12 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, //! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + { z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT); - //! Relocate again with updated Z coord - Relocate(x, y, z, ang); + //! Relocate again with updated Z coord + Relocate(x, y, z, ang); + } uint32 displayID = GetNativeDisplayId(); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 141902fbbdc..7c70fe9358e 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -9217,6 +9217,9 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) case 4100: // The Culling of Stratholme NumberOfFields = 13; break; + case 4273: // Ulduar + NumberOfFields = 10; + break; default: NumberOfFields = 12; break; @@ -9761,6 +9764,16 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW } break; + // Ulduar + case 4273: + if (instance && mapid == 603) + instance->FillInitialWorldStates(data); + else + { + data << uint32(4132) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES + data << uint32(4131) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED + } + break; default: data << uint32(0x914) << uint32(0x0); // 7 data << uint32(0x913) << uint32(0x0); // 8 diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 76c3f1c073c..476b0082617 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -425,6 +425,7 @@ void AddSC_ulduar_teleporter(); void AddSC_boss_mimiron(); void AddSC_boss_hodir(); void AddSC_boss_freya(); +void AddSC_boss_algalon_the_observer(); void AddSC_instance_ulduar(); void AddSC_boss_keleseth(); //Utgarde Keep void AddSC_boss_skarvald_dalronn(); @@ -1129,6 +1130,7 @@ void AddNorthrendScripts() AddSC_boss_mimiron(); AddSC_boss_hodir(); AddSC_boss_freya(); + AddSC_boss_algalon_the_observer(); AddSC_instance_ulduar(); AddSC_boss_keleseth(); //Utgarde Keep AddSC_boss_skarvald_dalronn(); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 05431ef0a16..3de87790be9 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3298,6 +3298,19 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY; spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY; break; + case 62301: // Cosmic Smash (Algalon the Observer) + spellInfo->MaxAffectedTargets = 1; + break; + case 64598: // Cosmic Smash (Algalon the Observer) + spellInfo->MaxAffectedTargets = 3; + break; + case 62293: // Cosmic Smash (Algalon the Observer) + spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_CASTER; + break; + case 62311: // Cosmic Smash (Algalon the Observer) + case 64596: // Cosmic Smash (Algalon the Observer) + spellInfo->rangeIndex = 6; // 100yd + break; // ENDOF ULDUAR SPELLS // // TRIAL OF THE CRUSADER SPELLS diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index df1640df1b7..44a2dd4dedb 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -403,7 +403,7 @@ GameObject* SpellScript::GetHitGObj() return m_spell->gameObjTarget; } -WorldLocation const* SpellScript::GetHitDest() +WorldLocation* SpellScript::GetHitDest() { if (!IsInEffectHook()) { diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index e84a56c8dbb..26393040a1e 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -325,7 +325,7 @@ class SpellScript : public _SpellScript // returns: target of current effect if it was GameObject otherwise NULL GameObject* GetHitGObj(); // returns: destination of current effect - WorldLocation const* GetHitDest(); + WorldLocation* GetHitDest(); // setter/getter for for damage done by spell to target of spell hit // returns damage calculated before hit, and real dmg done after hit int32 GetHitDamage(); diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index f0136b065e8..792fdeb3e7b 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -119,6 +119,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/Maps ${CMAKE_SOURCE_DIR}/src/server/game/Movement ${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators + ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints ${CMAKE_SOURCE_DIR}/src/server/game/Opcodes ${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index 31aa924365d..3502e7fb104 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -22,7 +22,7 @@ set(scripts_STAT_SRCS Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp Northrend/Ulduar/Ulduar/boss_thorim.cpp Northrend/Ulduar/Ulduar/boss_ignis.cpp - Northrend/Ulduar/Ulduar/boss_algalon.cpp + Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp Northrend/Ulduar/Ulduar/instance_ulduar.cpp Northrend/Ulduar/Ulduar/boss_auriaya.cpp Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp deleted file mode 100644 index 2dd13e7ce07..00000000000 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * - * 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 . - */ - -#include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ulduar.h" - -#define GAMEOBJECT_GIVE_OF_THE_OBSERVER 194821 - -enum Spells -{ - SPELL_ASCEND = 64487, - SPELL_BERSERK = 47008, - SPELL_BIG_BANG = 64443, - H_SPELL_BIG_BANG = 64584, - SPELL_COSMIC_SMASH = 62301, - H_SPELL_COSMIC_SMASH = 64598, - SPELL_PHASE_PUNCH = 64412, - SPELL_QUANTUM_STRIKE = 64395, - H_SPELL_QUANTUM_STRIKE = 64592, - SPELL_BLACK_HOLE_EXPLOSION = 64122, - SPELL_ARCANE_BARAGE = 64599, - H_SPELL_ARCANE_BARAGE = 64607 -}; - -enum Creatures -{ - CREATURE_COLLAPSING_STAR = 32955, - CREATURE_BLACK_HOLE = 32953, - CREATURE_LIVING_CONSTELLATION = 33052, - CREATURE_DARK_MATTER = 33089 -}; - -enum Yells -{ - SAY_AGGRO = -1603000, - SAY_SLAY_1 = -1603001, - SAY_SLAY_2 = -1603002, - SAY_ENGADED_FOR_FIRTS_TIME = -1603003, - SAY_PHASE_2 = -1603004, - SAY_SUMMON_COLLAPSING_STAR = -1603005, - SAY_DEATH_1 = -1603006, - SAY_DEATH_2 = -1603007, - SAY_DEATH_3 = -1603008, - SAY_DEATH_4 = -1603009, - SAY_DEATH_5 = -1603010, - SAY_BERSERK = -1603011, - SAY_BIG_BANG_1 = -1603012, - SAY_BIG_BANG_2 = -1603013, - SAY_TIMER_1 = -1603014, - SAY_TIMER_2 = -1603015, - SAY_TIMER_3 = -1603016, - SAY_SUMMON_1 = -1603017, - SAY_SUMMON_2 = -1603018, - SAY_SUMMON_3 = -1603019, -}; - -class boss_algalon : public CreatureScript -{ -public: - boss_algalon() : CreatureScript("boss_algalon") { } - - CreatureAI* GetAI(Creature* creature) const - { - return GetUlduarAI(creature); - } - - struct boss_algalonAI : public ScriptedAI - { - boss_algalonAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - Summon = false; // not in reset. intro speech done only once. - } - - InstanceScript* instance; - - std::list m_lCollapsingStarGUIDList; - - uint32 Phase; - uint32 Ascend_Timer; - uint32 Berserk_Timer; - uint32 BigBang_Timer; - uint32 CosmicSmash_Timer; - uint32 PhasePunch_Timer; - uint32 QuantumStrike_Timer; - uint32 CollapsingStar_Timer; - uint32 uiPhase_timer; - uint32 uiStep; - - uint64 BlackHoleGUID; - - bool Enrage; - bool Summon; - - void EnterCombat(Unit* who) - { - if (Summon) - { - DoScriptText(SAY_AGGRO, me); - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - DoZoneInCombat(who->ToCreature()); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - uiStep = 1; - } - - if (instance) - instance->SetData(BOSS_ALGALON, IN_PROGRESS); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); - } - - void Reset() - { - Phase = 1; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (instance) - instance->SetData(BOSS_ALGALON, NOT_STARTED); - - BlackHoleGUID = 0; - - uiPhase_timer = 0; - Ascend_Timer = 480000; //8 minutes - QuantumStrike_Timer = urand(4000, 14000); - Berserk_Timer = 360000; //6 minutes - CollapsingStar_Timer = urand(15000, 20000); //Spawns between 15 to 20 seconds - BigBang_Timer = 90000; - PhasePunch_Timer = 8000; - CosmicSmash_Timer = urand(30000, 60000); - Enrage = false; - } - - void JumpToNextStep(uint32 uiTimer) - { - uiPhase_timer = uiTimer; - ++uiStep; - } - - void DespawnCollapsingStar() - { - if (m_lCollapsingStarGUIDList.empty()) - return; - - for (std::list::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr) - { - if (Creature* temp = Unit::GetCreature(*me, *itr)) - { - if (temp->isAlive()) - temp->DespawnOrUnsummon(); - } - } - m_lCollapsingStarGUIDList.clear(); - } - - void JustSummoned(Creature* summoned) - { - if (summoned->GetEntry() == CREATURE_COLLAPSING_STAR) - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (me->getVictim()) - summoned->AI()->AttackStart(target ? target : me->getVictim()); - m_lCollapsingStarGUIDList.push_back(summoned->GetGUID()); - } - } - - void SummonCollapsingStar(Unit* target) - { - DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me); - me->SummonCreature(CREATURE_COLLAPSING_STAR, target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 100000); - me->SummonCreature(CREATURE_BLACK_HOLE, target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 27000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (Phase == 1 && HealthBelowPct(20)) - { - Phase = 2; - DoScriptText(SAY_PHASE_2, me); - } - - if (HealthBelowPct(2)) - { - me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667f, -295.101166f, 417.321381f, 0, 0, 0, 0, 0, 0); - - // All of them. or random? - DoScriptText(SAY_DEATH_1, me); - DoScriptText(SAY_DEATH_2, me); - DoScriptText(SAY_DEATH_3, me); - DoScriptText(SAY_DEATH_4, me); - DoScriptText(SAY_DEATH_5, me); - - me->DisappearAndDie(); - - if (instance) - instance->SetData(BOSS_ALGALON, DONE); - - return; - } - - if (Phase == 1) - { - if (!Summon) - { - if (uiPhase_timer <= diff) - { - switch (uiStep) - { - case 1: - DoScriptText(SAY_SUMMON_1, me); - JumpToNextStep(3000); - break; - case 2: - DoScriptText(SAY_SUMMON_2, me); - JumpToNextStep(3000); - break; - case 3: - DoScriptText(SAY_SUMMON_3, me); - JumpToNextStep(3000); - break; - case 4: - DoScriptText(SAY_ENGADED_FOR_FIRTS_TIME, me); - JumpToNextStep(3000); - break; - case 5: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - Summon = true; - break; - } - } else uiPhase_timer -= diff; - - return; - } - - if (QuantumStrike_Timer <= diff) - { - DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE, H_SPELL_QUANTUM_STRIKE), true); - - QuantumStrike_Timer = urand(4000, 14000); - } else QuantumStrike_Timer -= diff; - - if (BigBang_Timer <= diff) - { - DoScriptText(RAND(SAY_BIG_BANG_1, SAY_BIG_BANG_2), me); - DoCast(me->getVictim(), RAID_MODE(SPELL_BIG_BANG, H_SPELL_BIG_BANG), true); - - BigBang_Timer = 90000; - } else BigBang_Timer -= diff; - - if (Ascend_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ASCEND, true); - - Ascend_Timer = 480000; - } else Ascend_Timer -= diff; - - if (PhasePunch_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_PHASE_PUNCH, true); - - PhasePunch_Timer = 8000; - } else PhasePunch_Timer -= diff; - - if (CosmicSmash_Timer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH, H_SPELL_COSMIC_SMASH), true); - - CosmicSmash_Timer = urand(30000, 60000); - } else CosmicSmash_Timer -= diff; - - if (Berserk_Timer <= diff) - { - DoScriptText(SAY_BERSERK, me); - DoCast(me->getVictim(), SPELL_BERSERK, true); - - Berserk_Timer = 360000; - } else Berserk_Timer -= diff; - - DoMeleeAttackIfReady(); - - EnterEvadeIfOutOfCombatArea(diff); - } - - if (Phase == 2) - { - if (Enrage) - { - if (Ascend_Timer <= diff) - { - DoCast(me, SPELL_ASCEND); - DoScriptText(SAY_BERSERK, me); - Ascend_Timer = urand(360000, 365000); - Enrage = false; - } else Ascend_Timer -= diff; - } - } - - DoMeleeAttackIfReady(); - } - }; - -}; - -//Collapsing Star -class mob_collapsing_star : public CreatureScript -{ -public: - mob_collapsing_star() : CreatureScript("mob_collapsing_star") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_collapsing_starAI(creature); - } - - struct mob_collapsing_starAI : public ScriptedAI - { - mob_collapsing_starAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - - uint32 BlackHoleExplosion_Timer; - - void Reset() - { - BlackHoleExplosion_Timer = 0; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (BlackHoleExplosion_Timer <= diff) - { - me->CastSpell(me, SPELL_BLACK_HOLE_EXPLOSION, false); - BlackHoleExplosion_Timer = 0; - } else BlackHoleExplosion_Timer -= diff; - } - }; - -}; - -void AddSC_boss_Algalon() -{ - new boss_algalon(); - new mob_collapsing_star(); -} 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 new file mode 100644 index 00000000000..4465fc08792 --- /dev/null +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -0,0 +1,1374 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +#include "ObjectMgr.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "GameObjectAI.h" +#include "MapManager.h" +#include "MoveSplineInit.h" +#include "ulduar.h" + +enum Texts +{ + SAY_BRANN_ALGALON_INTRO_1 = 0, + SAY_BRANN_ALGALON_INTRO_2 = 1, + SAY_BRANN_ALGALON_OUTRO = 2, + + SAY_ALGALON_INTRO_1 = 0, + SAY_ALGALON_INTRO_2 = 1, + SAY_ALGALON_INTRO_3 = 2, + SAY_ALGALON_START_TIMER = 3, + SAY_ALGALON_AGGRO = 4, + SAY_ALGALON_COLLAPSING_STAR = 5, + EMOTE_ALGALON_COLLAPSING_STAR = 6, + SAY_ALGALON_BIG_BANG = 7, + EMOTE_ALGALON_BIG_BANG = 8, + SAY_ALGALON_ASCEND = 9, + EMOTE_ALGALON_COSMIC_SMASH = 10, + SAY_ALGALON_PHASE_TWO = 11, + SAY_ALGALON_OUTRO_1 = 12, + SAY_ALGALON_OUTRO_2 = 13, + SAY_ALGALON_OUTRO_3 = 14, + SAY_ALGALON_OUTRO_4 = 15, + SAY_ALGALON_OUTRO_5 = 16, + SAY_ALGALON_DESPAWN_1 = 17, + SAY_ALGALON_DESPAWN_2 = 18, + SAY_ALGALON_DESPAWN_3 = 19, + SAY_ALGALON_KILL = 20, +}; + +enum Spells +{ + // Algalon the Observer + SPELL_ARRIVAL = 64997, + SPELL_RIDE_THE_LIGHTNING = 64986, + SPELL_SUMMON_AZEROTH = 64994, + SPELL_REORIGINATION = 64996, + SPELL_SUPERMASSIVE_FAIL = 65311, + SPELL_QUANTUM_STRIKE = 64395, + SPELL_PHASE_PUNCH = 64412, + SPELL_BIG_BANG = 64443, + SPELL_ASCEND_TO_THE_HEAVENS = 64487, + SPELL_COSMIC_SMASH = 62301, + SPELL_COSMIC_SMASH_TRIGGERED = 62304, + SPELL_COSMIC_SMASH_VISUAL_STATE = 62300, + SPELL_SELF_STUN = 65256, + SPELL_KILL_CREDIT = 65184, + SPELL_TELEPORT = 62940, + + // Algalon Stalker + SPELL_TRIGGER_3_ADDS = 62266, // Triggers Living Constellation + + // Living Constellation + SPELL_ARCANE_BARRAGE = 64599, + + // Collapsing Star + SPELL_COLLAPSE = 62018, + SPELL_BLACK_HOLE_SPAWN_VISUAL = 62003, + SPELL_SUMMON_BLACK_HOLE = 62189, + + // Black Hole + SPELL_BLACK_HOLE_TRIGGER = 62185, + SPELL_CONSTELLATION_PHASE_TRIGGER = 65508, + SPELL_CONSTELLATION_PHASE_EFFECT = 65509, + SPELL_BLACK_HOLE_EXPLOSION = 64122, + SPELL_SUMMON_VOID_ZONE_VISUAL = 64470, + SPELL_VOID_ZONE_VISUAL = 64469, + SPELL_BLACK_HOLE_CREDIT = 65312, + + // Worm Hole + SPELL_WORM_HOLE_TRIGGER = 65251, + SPELL_SUMMON_UNLEASHED_DARK_MATTER = 64450, +}; + +uint32 const PhasePunchAlphaId[5] = {64435, 64434, 64428, 64421, 64417}; + +enum Events +{ + // Celestial Planetarium Access + EVENT_DESPAWN_CONSOLE = 1, + + // Brann Bronzebeard + EVENT_BRANN_MOVE_INTRO = 2, + EVENT_SUMMON_ALGALON = 3, + EVENT_BRANN_OUTRO_1 = 4, + EVENT_BRANN_OUTRO_2 = 5, + + // Algalon the Observer + EVENT_INTRO_1 = 6, + EVENT_INTRO_2 = 7, + EVENT_INTRO_3 = 8, + EVENT_INTRO_FINISH = 9, + EVENT_START_COMBAT = 10, + EVENT_INTRO_TIMER_DONE = 11, + EVENT_QUANTUM_STRIKE = 12, + EVENT_PHASE_PUNCH = 13, + EVENT_SUMMON_COLLAPSING_STAR = 14, + EVENT_BIG_BANG = 15, + EVENT_RESUME_UPDATING = 16, + EVENT_ASCEND_TO_THE_HEAVENS = 17, + EVENT_EVADE = 18, + EVENT_COSMIC_SMASH = 19, + EVENT_UNLOCK_YELL = 20, + EVENT_OUTRO_START = 21, + EVENT_OUTRO_1 = 22, + EVENT_OUTRO_2 = 23, + EVENT_OUTRO_3 = 24, + EVENT_OUTRO_4 = 25, + EVENT_OUTRO_5 = 26, + EVENT_OUTRO_6 = 27, + EVENT_OUTRO_7 = 28, + EVENT_OUTRO_8 = 29, + EVENT_OUTRO_9 = 30, + EVENT_OUTRO_10 = 31, + EVENT_OUTRO_11 = 32, + EVENT_OUTRO_12 = 33, + EVENT_OUTRO_13 = 34, + EVENT_OUTRO_14 = 35, + EVENT_DESPAWN_ALGALON_1 = 36, + EVENT_DESPAWN_ALGALON_2 = 37, + EVENT_DESPAWN_ALGALON_3 = 38, + + // Living Constellation + EVENT_ARCANE_BARRAGE = 39, +}; + +enum Actions +{ + ACTION_START_INTRO = 0, + ACTION_FINISH_INTRO = 1, + ACTION_ACTIVATE_STAR = 2, + ACTION_BIG_BANG = 3, + ACTION_ASCEND = 4, + ACTION_OUTRO = 5, +}; + +enum Points +{ + POINT_BRANN_INTRO = 0, + MAX_BRANN_WAYPOINTS_INTRO = 10, + POINT_BRANN_OUTRO = 10, + POINT_BRANN_OUTRO_END = 11, + + POINT_ALGALON_LAND = 1, + POINT_ALGALON_OUTRO = 2, +}; + +enum EncounterPhases +{ + PHASE_NORMAL = 0, + PHASE_ROLE_PLAY = 1, + PHASE_BIG_BANG = 2, + + PHASE_MASK_NO_UPDATE = (1 << PHASE_ROLE_PLAY) | (1 << PHASE_BIG_BANG), + PHASE_MASK_NO_CAST_CHECK = 1 << PHASE_ROLE_PLAY, +}; + +enum AchievmentInfo +{ + EVENT_ID_SUPERMASSIVE_START = 21697, + DATA_HAS_FED_ON_TEARS = 30043005, +}; + + +Position const BrannIntroSpawnPos = {1676.277f, -162.5308f, 427.3326f, 3.235537f}; +Position const BrannIntroWaypoint[MAX_BRANN_WAYPOINTS_INTRO] = +{ + {1642.482f, -164.0812f, 427.2602f, 0.0f}, + {1635.000f, -169.5145f, 427.2523f, 0.0f}, + {1632.814f, -173.9334f, 427.2621f, 0.0f}, + {1632.676f, -190.5927f, 425.8831f, 0.0f}, + {1631.497f, -214.2221f, 418.1152f, 0.0f}, + {1624.717f, -224.6876f, 418.1152f, 0.0f}, + {1631.497f, -214.2221f, 418.1152f, 0.0f}, + {1632.676f, -190.5927f, 425.8831f, 0.0f}, + {1632.814f, -173.9334f, 427.2621f, 0.0f}, + {1635.000f, -169.5145f, 427.2523f, 0.0f}, +}; +Position const AlgalonSummonPos = {1632.531f, -304.8516f, 450.1123f, 1.530165f}; +Position const AlgalonLandPos = {1632.668f, -302.7656f, 417.3211f, 1.530165f}; + +#define LIVING_CONSTELLATION_COUNT 11 +Position const ConstellationPos[LIVING_CONSTELLATION_COUNT] = +{ + {1625.208f, -267.2771f, 446.4296f, 5.044002f}, + {1658.279f, -262.5490f, 441.9073f, 4.188790f}, + {1678.677f, -276.3280f, 427.7531f, 3.979351f}, + {1593.389f, -299.4325f, 432.4636f, 6.073746f}, + {1685.613f, -300.1219f, 443.2366f, 3.385939f}, + {1591.706f, -263.8201f, 441.4153f, 5.253441f}, + {1668.317f, -324.7676f, 457.9394f, 3.211406f}, + {1592.242f, -325.5323f, 446.9508f, 0.226893f}, + {1635.821f, -363.3442f, 424.3459f, 1.466077f}, + {1672.188f, -357.2484f, 436.7337f, 2.338741f}, + {1615.800f, -348.0065f, 442.9586f, 1.134464f}, +}; + +#define COLLAPSING_STAR_COUNT 4 +Position const CollapsingStarPos[COLLAPSING_STAR_COUNT] = +{ + {1649.438f, -319.8127f, 418.3941f, 1.082104f}, + {1647.005f, -288.6790f, 417.3955f, 3.490659f}, + {1622.451f, -321.1563f, 417.6188f, 4.677482f}, + {1615.060f, -291.6816f, 417.7796f, 3.490659f}, +}; +Position const AlgalonOutroPos = {1633.64f, -317.78f, 417.3211f, 0.0f}; +Position const BrannOutroPos[3] = +{ + {1632.023f, -243.7434f, 417.9118f, 0.0f}, + {1631.986f, -297.7831f, 417.3210f, 0.0f}, + {1633.832f, -216.2948f, 417.0463f, 0.0f}, +}; + +class ActivateLivingConstellation : public BasicEvent +{ + public: + ActivateLivingConstellation(Unit* owner) : _owner(owner), _instance(owner->GetInstanceScript()) + { + } + + bool Execute(uint64 execTime, uint32 /*diff*/) + { + if (!_instance || _instance->GetBossState(BOSS_ALGALON) != IN_PROGRESS) + return true; // delete event + + _owner->CastSpell((Unit*)NULL, SPELL_TRIGGER_3_ADDS, TRIGGERED_FULL_MASK); + _owner->m_Events.AddEvent(this, execTime + urand(45000, 50000)); + return false; + } + + private: + Unit* _owner; + InstanceScript* _instance; +}; + +class CosmicSmashDamageEvent : public BasicEvent +{ + public: + CosmicSmashDamageEvent(Unit* caster) : _caster(caster) + { + } + + bool Execute(uint64 /*execTime*/, uint32 /*diff*/) + { + _caster->CastSpell((Unit*)NULL, SPELL_COSMIC_SMASH_TRIGGERED, TRIGGERED_FULL_MASK); + return true; + } + + private: + Unit* _caster; +}; + +class SummonUnleashedDarkMatter : public BasicEvent +{ + public: + SummonUnleashedDarkMatter(Unit* caster) : _caster(caster) + { + } + + bool Execute(uint64 execTime, uint32 /*diff*/) + { + _caster->CastSpell((Unit*)NULL, SPELL_SUMMON_UNLEASHED_DARK_MATTER, TRIGGERED_FULL_MASK); + _caster->m_Events.AddEvent(this, execTime + 30000); + return false; + } + + private: + Unit* _caster; +}; + +class boss_algalon_the_observer : public CreatureScript +{ + public: + boss_algalon_the_observer() : CreatureScript("boss_algalon_the_observer") {} + + struct boss_algalon_the_observerAI : public BossAI + { + boss_algalon_the_observerAI(Creature* creature) : BossAI(creature, BOSS_ALGALON) + { + _firstPull = true; + _fedOnTears = false; + } + + void Reset() + { + _Reset(); + me->SetReactState(REACT_PASSIVE); + _phaseTwo = false; + _fightWon = false; + _hasYelled = false; + } + + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_UNIT) + { + _fedOnTears = true; + if (!_hasYelled) + { + _hasYelled = true; + events.ScheduleEvent(EVENT_UNLOCK_YELL, 1000); + Talk(SAY_ALGALON_KILL); + } + } + } + + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_START_INTRO: + { + me->SetFlag(UNIT_FIELD_FLAGS_2, 0x20); + me->SetDisableGravity(true); + DoCast(me, SPELL_ARRIVAL, true); + DoCast(me, SPELL_RIDE_THE_LIGHTNING, true); + me->GetMotionMaster()->MovePoint(POINT_ALGALON_LAND, AlgalonLandPos); + me->SetHomePosition(AlgalonLandPos); + Movement::MoveSplineInit init(*me); + init.MoveTo(AlgalonLandPos.GetPositionX(), AlgalonLandPos.GetPositionY(), AlgalonLandPos.GetPositionZ()); + init.SetOrientationFixed(true); + init.Launch(); + events.Reset(); + events.SetPhase(PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_INTRO_1, 5000, 0, PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_INTRO_2, 15000, 0, PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_INTRO_3, 23000, 0, PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_INTRO_FINISH, 36000, 0, PHASE_ROLE_PLAY); + break; + } + case ACTION_ASCEND: + events.SetPhase(PHASE_BIG_BANG); + events.CancelEvent(EVENT_RESUME_UPDATING); + events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1500); + break; + case EVENT_DESPAWN_ALGALON: + events.Reset(); + events.SetPhase(PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1); + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_1, 5000); + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_2, 17000); + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_3, 26000); + me->DespawnOrUnsummon(34000); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + break; + case ACTION_INIT_ALGALON: + _firstPull = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + break;; + } + } + + uint32 GetData(uint32 type) + { + return type == DATA_HAS_FED_ON_TEARS ? _fedOnTears : 1; + } + + void EnterCombat(Unit* /*target*/) + { + uint32 introDelay = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + events.Reset(); + events.SetPhase(PHASE_ROLE_PLAY); + + if (!_firstPull) + { + Talk(SAY_ALGALON_AGGRO); + _EnterCombat(); + introDelay = 8000; + } + else + { + _firstPull = false; + Talk(SAY_ALGALON_START_TIMER); + if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRANN_BRONZEBEARD_ALG))) + brann->AI()->DoAction(ACTION_FINISH_INTRO); + + me->setActive(true); + DoZoneInCombat(); + introDelay = 26000; + summons.DespawnEntry(NPC_AZEROTH); + instance->SetData(EVENT_DESPAWN_ALGALON, 0); + events.ScheduleEvent(EVENT_START_COMBAT, 18000); + } + + events.ScheduleEvent(EVENT_INTRO_TIMER_DONE, introDelay); + events.ScheduleEvent(EVENT_QUANTUM_STRIKE, 3500 + introDelay); + events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500 + introDelay); + events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 18000 + introDelay); + events.ScheduleEvent(EVENT_BIG_BANG, 90000 + introDelay); + events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 360000 + introDelay); + events.ScheduleEvent(EVENT_COSMIC_SMASH, 25000 + introDelay); + + std::list stalkers; + me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f); + for (std::list::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr) + (*itr)->m_Events.KillAllEvents(true); + } + + void MovementInform(uint32 movementType, uint32 pointId) + { + if (movementType != POINT_MOTION_TYPE) + return; + + if (pointId == POINT_ALGALON_LAND) + me->SetDisableGravity(false); + else if (pointId == POINT_ALGALON_OUTRO) + { + me->SetFacingTo(1.605703f); + events.ScheduleEvent(EVENT_OUTRO_3, 1200); + events.ScheduleEvent(EVENT_OUTRO_4, 2400); + events.ScheduleEvent(EVENT_OUTRO_5, 8500); + events.ScheduleEvent(EVENT_OUTRO_6, 15500); + events.ScheduleEvent(EVENT_OUTRO_7, 55500); + events.ScheduleEvent(EVENT_OUTRO_8, 73500); + events.ScheduleEvent(EVENT_OUTRO_9, 85500); + events.ScheduleEvent(EVENT_OUTRO_10, 108500); + events.ScheduleEvent(EVENT_OUTRO_11, 123500); + } + } + + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + switch (summon->GetEntry()) + { + case NPC_AZEROTH: + DoCastAOE(SPELL_REORIGINATION, true); + break; + case NPC_COLLAPSING_STAR: + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->MoveRandom(20.0f); + summon->CastSpell(summon, SPELL_COLLAPSE, TRIGGERED_FULL_MASK); + break; + case NPC_BLACK_HOLE: + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_TRIGGER, TRIGGERED_FULL_MASK); + summon->CastSpell(summon, SPELL_CONSTELLATION_PHASE_TRIGGER, TRIGGERED_FULL_MASK); + summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_EXPLOSION); + summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK); + break; + case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER: + summon->CastSpell(summon, SPELL_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK); + break; + case NPC_ALGALON_STALKER_ASTEROID_TARGET_01: + summon->CastSpell(summon, SPELL_COSMIC_SMASH_VISUAL_STATE, TRIGGERED_FULL_MASK); + break; + case NPC_ALGALON_STALKER_ASTEROID_TARGET_02: + summon->m_Events.AddEvent(new CosmicSmashDamageEvent(summon), summon->m_Events.CalculateTime(3250)); + break; + case NPC_WORM_HOLE: + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell(summon, SPELL_WORM_HOLE_TRIGGER, TRIGGERED_FULL_MASK); + summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK); + break; + case NPC_UNLEASHED_DARK_MATTER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + if (summon->Attack(target, true)) + summon->GetMotionMaster()->MoveChase(target); + break; + } + } + + void EnterEvadeMode() + { + instance->SetBossState(BOSS_ALGALON, FAIL); + BossAI::EnterEvadeMode(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetSheath(SHEATH_STATE_UNARMED); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (_fightWon) + { + damage = 0; + return; + } + + if (!_phaseTwo && me->HealthBelowPctDamaged(20, damage)) + { + _phaseTwo = true; + Talk(SAY_ALGALON_PHASE_TWO); + summons.DespawnEntry(NPC_LIVING_CONSTELLATION); + summons.DespawnEntry(NPC_COLLAPSING_STAR); + summons.DespawnEntry(NPC_BLACK_HOLE); + summons.DespawnEntry(NPC_ALGALON_VOID_ZONE_VISUAL_STALKER); + events.CancelEvent(EVENT_SUMMON_COLLAPSING_STAR); + std::list stalkers; + me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f); + for (std::list::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr) + (*itr)->m_Events.KillAllEvents(true); + for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i) + if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN)) + wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000)); + } + else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF(int32(me->GetMaxHealth()), 2.5f) && !_fightWon) + { + _fightWon = true; + damage = 0; + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_SELF_STUN); + events.Reset(); + summons.DespawnAll(); + events.SetPhase(PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_OUTRO_START, 1500); + events.ScheduleEvent(EVENT_OUTRO_1, 7200); + events.ScheduleEvent(EVENT_OUTRO_2, 8700); + } + } + + void UpdateAI(uint32 const diff) + { + if ((!(events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim()) || !CheckInRoom()) + return; + + events.Update(diff); + + if (!(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK)) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_INTRO_1: + me->RemoveAurasDueToSpell(SPELL_RIDE_THE_LIGHTNING); + Talk(SAY_ALGALON_INTRO_1); + break; + case EVENT_INTRO_2: + DoCastAOE(SPELL_SUMMON_AZEROTH, true); + Talk(SAY_ALGALON_INTRO_2); + break; + case EVENT_INTRO_3: + Talk(SAY_ALGALON_INTRO_3); + break; + case EVENT_INTRO_FINISH: + events.Reset(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + break; + case EVENT_START_COMBAT: + instance->SetBossState(BOSS_ALGALON, IN_PROGRESS); + break; + case EVENT_INTRO_TIMER_DONE: + { + events.SetPhase(PHASE_NORMAL); + me->SetSheath(SHEATH_STATE_MELEE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_DEFENSIVE); + DoCastAOE(SPELL_SUPERMASSIVE_FAIL, true); + //! Workaround for Creature::_IsTargetAcceptable returning false + //! for creatures that start combat in REACT_PASSIVE and UNIT_FLAG_NOT_SELECTABLE + //! causing them to immediately evade + if (!me->getThreatManager().isThreatListEmpty()) + AttackStart(me->getThreatManager().getHostilTarget()); + for (uint32 i = 0; i < LIVING_CONSTELLATION_COUNT; ++i) + if (Creature* summon = DoSummon(NPC_LIVING_CONSTELLATION, ConstellationPos[i], 0, TEMPSUMMON_DEAD_DESPAWN)) + summon->SetReactState(REACT_PASSIVE); + + std::list stalkers; + me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f); + if (!stalkers.empty()) + { + Unit* stalker = Trinity::Containers::SelectRandomContainerElement(stalkers); + stalker->m_Events.AddEvent(new ActivateLivingConstellation(stalker), stalker->m_Events.CalculateTime(urand(45000, 50000))); + } + break; + } + case EVENT_QUANTUM_STRIKE: + DoCastVictim(SPELL_QUANTUM_STRIKE); + events.ScheduleEvent(EVENT_QUANTUM_STRIKE, urand(3000, 5000)); + break; + case EVENT_PHASE_PUNCH: + DoCastVictim(SPELL_PHASE_PUNCH); + events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500); + break; + case EVENT_SUMMON_COLLAPSING_STAR: + Talk(SAY_ALGALON_COLLAPSING_STAR); + Talk(EMOTE_ALGALON_COLLAPSING_STAR); + for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i) + me->SummonCreature(NPC_COLLAPSING_STAR, CollapsingStarPos[i], TEMPSUMMON_CORPSE_DESPAWN); + events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 60000); + break; + case EVENT_BIG_BANG: + { + Talk(SAY_ALGALON_BIG_BANG); + Talk(EMOTE_ALGALON_BIG_BANG); + events.SetPhase(PHASE_BIG_BANG); + std::list constellations; + me->GetCreatureListWithEntryInGrid(constellations, NPC_LIVING_CONSTELLATION, 200.0f); + for (std::list::iterator itr = constellations.begin(); itr != constellations.end(); ++itr) + (*itr)->AI()->DoAction(ACTION_BIG_BANG); + DoCastAOE(SPELL_BIG_BANG); + events.ScheduleEvent(EVENT_BIG_BANG, 90500); + events.ScheduleEvent(EVENT_RESUME_UPDATING, 9500); + break; + } + case EVENT_RESUME_UPDATING: + events.SetPhase(0); + break; + case EVENT_ASCEND_TO_THE_HEAVENS: + Talk(SAY_ALGALON_ASCEND); + DoCastAOE(SPELL_ASCEND_TO_THE_HEAVENS); + events.ScheduleEvent(EVENT_EVADE, 2500); + break; + case EVENT_EVADE: + EnterEvadeMode(); + break; + case EVENT_COSMIC_SMASH: + Talk(EMOTE_ALGALON_COSMIC_SMASH); + DoCastAOE(SPELL_COSMIC_SMASH); + events.ScheduleEvent(EVENT_COSMIC_SMASH, 25500); + break; + case EVENT_UNLOCK_YELL: + _hasYelled = false; + break; + case EVENT_OUTRO_START: + instance->SetBossState(BOSS_ALGALON, DONE); + break; + case EVENT_OUTRO_1: + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_RENAME); + break; + case EVENT_OUTRO_2: + _EnterEvadeMode(); + me->AddUnitState(UNIT_STATE_EVADE); + me->GetMotionMaster()->MovePoint(POINT_ALGALON_OUTRO, AlgalonOutroPos); + break; + case EVENT_OUTRO_3: + DoCastAOE(SPELL_KILL_CREDIT); + break; + case EVENT_OUTRO_4: + DoCastAOE(SPELL_SUPERMASSIVE_FAIL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + break; + case EVENT_OUTRO_5: + if (Creature* brann = DoSummon(NPC_BRANN_BRONZBEARD_ALG, BrannOutroPos[0], 131500, TEMPSUMMON_TIMED_DESPAWN)) + brann->AI()->DoAction(ACTION_OUTRO); + break; + case EVENT_OUTRO_6: + Talk(SAY_ALGALON_OUTRO_1); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case EVENT_OUTRO_7: + Talk(SAY_ALGALON_OUTRO_2); + break; + case EVENT_OUTRO_8: + Talk(SAY_ALGALON_OUTRO_3); + break; + case EVENT_OUTRO_9: + Talk(SAY_ALGALON_OUTRO_4); + break; + case EVENT_OUTRO_10: + Talk(SAY_ALGALON_OUTRO_5); + break; + case EVENT_OUTRO_11: + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_TELEPORT); + me->DespawnOrUnsummon(1500); + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + bool _firstPull; + bool _fedOnTears; + bool _phaseTwo; + bool _fightWon; + bool _hasYelled; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI(creature); + } +}; + +class npc_living_constellation : public CreatureScript +{ + public: + npc_living_constellation() : CreatureScript("npc_living_constellation") { } + + struct npc_living_constellationAI : public CreatureAI + { + npc_living_constellationAI(Creature* creature) : CreatureAI(creature) + { + } + + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_ARCANE_BARRAGE, 2500); + _isActive = false; + } + + uint32 GetData(uint32 /*type*/) + { + return _isActive ? 1 : 0; + } + + void DoAction(int32 const action) + { + if (action != ACTION_ACTIVATE_STAR) + return; + + switch (action) + { + case ACTION_ACTIVATE_STAR: + if (Creature* algalon = me->FindNearestCreature(NPC_ALGALON, 200.0f)) + { + if (Unit* target = algalon->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(algalon))) + { + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + AttackStart(target); + DoZoneInCombat(); + _isActive = true; + } + } + break; + case ACTION_BIG_BANG: + _events.SetPhase(PHASE_BIG_BANG); + _events.DelayEvents(9500); + _events.ScheduleEvent(EVENT_RESUME_UPDATING, 9500); + break; + } + } + + void SpellHit(Unit* caster, SpellInfo const* spell) + { + if (spell->Id != SPELL_CONSTELLATION_PHASE_EFFECT || caster->GetTypeId() != TYPEID_UNIT) + return; + + me->DespawnOrUnsummon(1); + if (InstanceScript* instance = me->GetInstanceScript()) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_ID_SUPERMASSIVE_START); + caster->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK); + caster->ToCreature()->DespawnOrUnsummon(1); + } + + void UpdateAI(uint32 const diff) + { + if (!(_events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_ARCANE_BARRAGE: + DoCastAOE(SPELL_ARCANE_BARRAGE); + _events.ScheduleEvent(EVENT_ARCANE_BARRAGE, 2500); + break; + case EVENT_RESUME_UPDATING: + _events.SetPhase(0); + break; + } + } + } + + private: + EventMap _events; + bool _isActive; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI(creature); + } +}; + +class npc_collapsing_star : public CreatureScript +{ + public: + npc_collapsing_star() : CreatureScript("npc_collapsing_star") { } + + struct npc_collapsing_starAI : public PassiveAI + { + npc_collapsing_starAI(Creature* creature) : PassiveAI(creature) + { + _dying = false; + } + + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() != NPC_BLACK_HOLE) + return; + + if (TempSummon* summ = me->ToTempSummon()) + if (Creature* algalon = ObjectAccessor::GetCreature(*me, summ->GetSummonerGUID())) + algalon->AI()->JustSummoned(summon); + + me->DespawnOrUnsummon(1); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (_dying) + { + damage = 0; + return; + } + + if (damage >= me->GetHealth()) + { + _dying = true; + damage = 0; + DoCast(me, SPELL_BLACK_HOLE_SPAWN_VISUAL, true); + DoCast(me, SPELL_SUMMON_BLACK_HOLE, true); + } + } + + bool _dying; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI(creature); + } +}; + +class npc_brann_bronzebeard_algalon : public CreatureScript +{ + public: + npc_brann_bronzebeard_algalon() : CreatureScript("npc_brann_bronzebeard_algalon") { } + + struct npc_brann_bronzebeard_algalonAI : public CreatureAI + { + npc_brann_bronzebeard_algalonAI(Creature* creature) : CreatureAI(creature) + { + } + + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_START_INTRO: + _currentPoint = 0; + _events.Reset(); + me->SetWalk(false); + _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1); + break; + case ACTION_FINISH_INTRO: + Talk(SAY_BRANN_ALGALON_INTRO_2); + _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1); + break; + case ACTION_OUTRO: + me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO, BrannOutroPos[1]); + _events.ScheduleEvent(EVENT_BRANN_OUTRO_1, 89500); + _events.ScheduleEvent(EVENT_BRANN_OUTRO_2, 116500); + break; + } + } + + void MovementInform(uint32 movementType, uint32 pointId) + { + if (movementType != POINT_MOTION_TYPE) + return; + + uint32 delay = 1; + _currentPoint = pointId + 1; + switch (pointId) + { + case 2: + delay = 8000; + me->SetWalk(true); + break; + case 5: + me->SetWalk(false); + Talk(SAY_BRANN_ALGALON_INTRO_1); + _events.ScheduleEvent(EVENT_SUMMON_ALGALON, 7500); + return; + case 9: + me->DespawnOrUnsummon(1); + return; + case POINT_BRANN_OUTRO: + case POINT_BRANN_OUTRO_END: + return; + } + + _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, delay); + } + + void UpdateAI(uint32 const diff) + { + UpdateVictim(); + + if (_events.Empty()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_BRANN_MOVE_INTRO: + if (_currentPoint < MAX_BRANN_WAYPOINTS_INTRO) + me->GetMotionMaster()->MovePoint(_currentPoint, BrannIntroWaypoint[_currentPoint]); + break; + case EVENT_SUMMON_ALGALON: + if (Creature* algalon = me->GetMap()->SummonCreature(NPC_ALGALON, AlgalonSummonPos)) + algalon->AI()->DoAction(ACTION_START_INTRO); + break; + case EVENT_BRANN_OUTRO_1: + Talk(SAY_BRANN_ALGALON_OUTRO); + break; + case EVENT_BRANN_OUTRO_2: + me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO_END, BrannOutroPos[2]); + break; + } + } + } + + private: + EventMap _events; + uint32 _currentPoint; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI(creature); + } +}; + +class go_celestial_planetarium_access : public GameObjectScript +{ + public: + go_celestial_planetarium_access() : GameObjectScript("go_celestial_planetarium_access") {} + + struct go_celestial_planetarium_accessAI : public GameObjectAI + { + go_celestial_planetarium_accessAI(GameObject* go) : GameObjectAI(go) + { + } + + bool GossipHello(Player* player) + { + bool hasKey = true; + if (LockEntry const* lock = sLockStore.LookupEntry(go->GetGOInfo()->goober.lockId)) + { + hasKey = false; + for (uint32 i = 0; i < MAX_LOCK_CASE; ++i) + { + if (!lock->Index[i]) + continue; + + if (player->HasItemCount(lock->Index[i], 1)) + { + hasKey = true; + break; + } + } + } + + if (!hasKey) + return false; + + // Start Algalon event + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + _events.ScheduleEvent(EVENT_DESPAWN_CONSOLE, 5000); + if (Creature* brann = go->SummonCreature(NPC_BRANN_BRONZBEARD_ALG, BrannIntroSpawnPos)) + brann->AI()->DoAction(ACTION_START_INTRO); + + if (InstanceScript* instance = go->GetInstanceScript()) + { + instance->SetData(DATA_ALGALON_SUMMON_STATE, 1); + if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_01))) + sigil->SetGoState(GO_STATE_ACTIVE); + + if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_02))) + sigil->SetGoState(GO_STATE_ACTIVE); + } + + return false; + } + + void UpdateAI(uint32 diff) + { + if (_events.Empty()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DESPAWN_CONSOLE: + go->Delete(); + break; + } + } + } + + EventMap _events; + }; + + GameObjectAI* GetAI(GameObject* go) const + { + return GetUlduarAI(go); + } +}; + +class spell_algalon_phase_punch : public SpellScriptLoader +{ + public: + spell_algalon_phase_punch() : SpellScriptLoader("spell_algalon_phase_punch") { } + + class spell_algalon_phase_punch_AuraScript : public AuraScript + { + PrepareAuraScript(spell_algalon_phase_punch_AuraScript); + + void HandlePeriodic(AuraEffect const* aurEff) + { + PreventDefaultAction(); + if (GetStackAmount() != 1) + GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 2]); + GetTarget()->CastSpell(GetTarget(), PhasePunchAlphaId[GetStackAmount() - 1], TRIGGERED_FULL_MASK); + if (GetStackAmount() == 5) + Remove(AURA_REMOVE_BY_DEFAULT); + } + + void OnRemove(AuraEffect const*, AuraEffectHandleModes) + { + if (GetStackAmount() != 5) + GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 1]); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_phase_punch_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectRemove += AuraEffectRemoveFn(spell_algalon_phase_punch_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_algalon_phase_punch_AuraScript(); + } +}; + +class NotVictimFilter +{ + public: + NotVictimFilter(Unit* caster) : _victim(caster->getVictim()) + { + } + + bool operator()(Unit* target) + { + return target != _victim; + } + + private: + Unit* _victim; +}; + +class spell_algalon_arcane_barrage : public SpellScriptLoader +{ + public: + spell_algalon_arcane_barrage() : SpellScriptLoader("spell_algalon_arcane_barrage") { } + + class spell_algalon_arcane_barrage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_arcane_barrage_SpellScript); + + void SelectTarget(std::list& targets) + { + targets.remove_if(NotVictimFilter(GetCaster())); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_arcane_barrage_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_arcane_barrage_SpellScript(); + } +}; + +class ActiveConstellationFilter +{ + public: + bool operator()(Unit* target) const + { + return target->GetAI()->GetData(0); + } +}; + +class spell_algalon_trigger_3_adds : public SpellScriptLoader +{ + public: + spell_algalon_trigger_3_adds() : SpellScriptLoader("spell_algalon_trigger_3_adds") { } + + class spell_algalon_trigger_3_adds_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_trigger_3_adds_SpellScript); + + void SelectTarget(std::list& targets) + { + targets.remove_if(ActiveConstellationFilter()); + } + + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Creature* target = GetHitCreature(); + if (!target) + return; + + target->AI()->DoAction(ACTION_ACTIVATE_STAR); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_trigger_3_adds_SpellScript(); + } +}; + +class spell_algalon_collapse : public SpellScriptLoader +{ + public: + spell_algalon_collapse() : SpellScriptLoader("spell_algalon_collapse") { } + + class spell_algalon_collapse_AuraScript : public AuraScript + { + PrepareAuraScript(spell_algalon_collapse_AuraScript); + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + GetTarget()->DealDamage(GetTarget(), GetTarget()->CountPctFromMaxHealth(1), NULL, NODAMAGE); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_collapse_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_algalon_collapse_AuraScript(); + } +}; + +class spell_algalon_big_bang : public SpellScriptLoader +{ + public: + spell_algalon_big_bang() : SpellScriptLoader("spell_algalon_big_bang") { } + + class spell_algalon_big_bang_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_big_bang_SpellScript); + + bool Load() + { + _targetCount = 0; + return true; + } + + void CountTargets(std::list& targets) + { + _targetCount = targets.size(); + } + + void CheckTargets() + { + if (!_targetCount) + GetCaster()->GetAI()->DoAction(ACTION_ASCEND); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + AfterCast += SpellCastFn(spell_algalon_big_bang_SpellScript::CheckTargets); + } + + uint32 _targetCount; + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_big_bang_SpellScript(); + } +}; + +class spell_algalon_remove_phase : public SpellScriptLoader +{ + public: + spell_algalon_remove_phase() : SpellScriptLoader("spell_algalon_remove_phase") { } + + class spell_algalon_remove_phase_AuraScript : public AuraScript + { + PrepareAuraScript(spell_algalon_remove_phase_AuraScript); + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + GetTarget()->RemoveAurasByType(SPELL_AURA_PHASE); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_remove_phase_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_algalon_remove_phase_AuraScript(); + } +}; + +class spell_algalon_cosmic_smash : public SpellScriptLoader +{ + public: + spell_algalon_cosmic_smash() : SpellScriptLoader("spell_algalon_cosmic_smash") { } + + class spell_algalon_cosmic_smash_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_cosmic_smash_SpellScript); + + void ModDestHeight(SpellEffIndex /*effIndex*/) + { + Position offset = {0.0f, 0.0f, 65.0f, 0.0f}; + const_cast(GetTargetDest())->RelocateOffset(offset); + GetHitDest()->RelocateOffset(offset); + } + + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_algalon_cosmic_smash_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_cosmic_smash_SpellScript(); + } +}; + +class spell_algalon_cosmic_smash_damage : public SpellScriptLoader +{ + public: + spell_algalon_cosmic_smash_damage() : SpellScriptLoader("spell_algalon_cosmic_smash_damage") { } + + class spell_algalon_cosmic_smash_damage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_cosmic_smash_damage_SpellScript); + + void RecalculateDamage() + { + if (!GetTargetDest() || !GetHitUnit()) + return; + + float distance = GetHitUnit()->GetDistance2d(GetTargetDest()->GetPositionX(), GetTargetDest()->GetPositionY()); + if (distance > 6.0f) + SetHitDamage(int32(float(GetHitDamage()) / distance) * 2); + } + + void Register() + { + OnHit += SpellHitFn(spell_algalon_cosmic_smash_damage_SpellScript::RecalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_cosmic_smash_damage_SpellScript(); + } +}; + +class spell_algalon_supermassive_fail : public SpellScriptLoader +{ + public: + spell_algalon_supermassive_fail() : SpellScriptLoader("spell_algalon_supermassive_fail") { } + + class spell_algalon_supermassive_fail_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_supermassive_fail_SpellScript); + + void RecalculateDamage() + { + if (!GetHitPlayer()) + return; + + GetHitPlayer()->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT, GetSpellInfo()->Id, true); + } + + void Register() + { + OnHit += SpellHitFn(spell_algalon_supermassive_fail_SpellScript::RecalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_supermassive_fail_SpellScript(); + } +}; + +class achievement_he_feeds_on_your_tears : public AchievementCriteriaScript +{ + public: + achievement_he_feeds_on_your_tears() : AchievementCriteriaScript("achievement_he_feeds_on_your_tears") { } + + bool OnCheck(Player* /*source*/, Unit* target) + { + return !target->GetAI()->GetData(DATA_HAS_FED_ON_TEARS); + } +}; + +void AddSC_boss_algalon_the_observer() +{ + new boss_algalon_the_observer(); + new npc_living_constellation(); + new npc_collapsing_star(); + new npc_brann_bronzebeard_algalon(); + new go_celestial_planetarium_access(); + new spell_algalon_phase_punch(); + new spell_algalon_arcane_barrage(); + new spell_algalon_trigger_3_adds(); + new spell_algalon_collapse(); + new spell_algalon_big_bang(); + new spell_algalon_remove_phase(); + new spell_algalon_cosmic_smash(); + new spell_algalon_cosmic_smash_damage(); + new spell_algalon_supermassive_fail(); + new achievement_he_feeds_on_your_tears(); +} diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 22858cf69e5..654d763ddbc 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -22,9 +22,14 @@ static DoorData const doorData[] = { - { GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S }, - { GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S }, - { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + {GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S }, + {GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S }, + {GO_DOODAD_UL_SIGILDOOR_03, BOSS_ALGALON, DOOR_TYPE_ROOM, BOUNDARY_W }, + {GO_DOODAD_UL_UNIVERSEFLOOR_01, BOSS_ALGALON, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + {GO_DOODAD_UL_UNIVERSEFLOOR_02, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE }, + {GO_DOODAD_UL_UNIVERSEGLOBE01, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE }, + {GO_DOODAD_UL_ULDUAR_TRAPDOOR_03, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE }, + {0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE }, }; class instance_ulduar : public InstanceMapScript @@ -36,7 +41,6 @@ class instance_ulduar : public InstanceMapScript { instance_ulduar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } - uint32 Encounter[MAX_ENCOUNTER]; std::string m_strInstData; // Creatures @@ -72,6 +76,12 @@ class instance_ulduar : public InstanceMapScript uint64 HodirDoorGUID; uint64 HodirIceDoorGUID; uint64 ArchivumDoorGUID; + uint64 AlgalonSigilDoorGUID[3]; + uint64 AlgalonFloorGUID[2]; + uint64 AlgalonUniverseGUID; + uint64 AlgalonTrapdoorGUID; + uint64 BrannBronzebeardAlgGUID; + uint64 GiftOfTheObserverGUID; // Miscellaneous uint32 TeamInInstance; @@ -111,35 +121,49 @@ class instance_ulduar : public InstanceMapScript HodirDoorGUID = 0; HodirIceDoorGUID = 0; ArchivumDoorGUID = 0; + AlgalonUniverseGUID = 0; + AlgalonTrapdoorGUID = 0; + BrannBronzebeardAlgGUID = 0; + GiftOfTheObserverGUID = 0; + _algalonTimer = 61; + _maxArmorItemLevel = 0; + _maxWeaponItemLevel = 0; TeamInInstance = 0; HodirRareCacheData = 0; ColossusData = 0; elderCount = 0; conSpeedAtory = false; Unbroken = true; + _summonAlgalon = false; - memset(Encounter, 0, sizeof(Encounter)); + memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID)); + memset(AlgalonFloorGUID, 0, sizeof(AlgalonFloorGUID)); memset(XTToyPileGUIDs, 0, sizeof(XTToyPileGUIDs)); memset(AssemblyGUIDs, 0, sizeof(AssemblyGUIDs)); memset(RazorHarpoonGUIDs, 0, sizeof(RazorHarpoonGUIDs)); memset(KeeperGUIDs, 0, sizeof(KeeperGUIDs)); } - bool IsEncounterInProgress() const + void FillInitialWorldStates(WorldPacket& packet) { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (Encounter[i] == IN_PROGRESS) - return true; - } - - return false; + packet << uint32(WORLD_STATE_ALGALON_TIMER_ENABLED) << uint32(_algalonTimer && _algalonTimer <= 60); + packet << uint32(WORLD_STATE_ALGALON_DESPAWN_TIMER) << uint32(std::min(_algalonTimer, 60)); } void OnPlayerEnter(Player* player) { if (!TeamInInstance) TeamInInstance = player->GetTeam(); + + if (_summonAlgalon) + { + _summonAlgalon = false; + TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos); + if (_algalonTimer && _algalonTimer <= 60) + algalon->AI()->DoAction(ACTION_INIT_ALGALON); + else + algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + } } void OnCreatureCreate(Creature* creature) @@ -267,9 +291,32 @@ class instance_ulduar : public InstanceMapScript if (TeamInInstance == HORDE) creature->UpdateEntry(NPC_BATTLE_PRIEST_GINA, HORDE); break; + case NPC_BRANN_BRONZBEARD_ALG: + BrannBronzebeardAlgGUID = creature->GetGUID(); + break; + //! These creatures are summoned by something else than Algalon + //! but need to be controlled/despawned by him - so they need to be + //! registered in his summon list + case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER: + case NPC_ALGALON_STALKER_ASTEROID_TARGET_01: + case NPC_ALGALON_STALKER_ASTEROID_TARGET_02: + case NPC_UNLEASHED_DARK_MATTER: + if (Creature* algalon = instance->GetCreature(AlgalonGUID)) + algalon->AI()->JustSummoned(creature); + break; } + } - } + void OnCreatureRemove(Creature* creature) + { + switch (creature->GetEntry()) + { + case NPC_BRANN_BRONZBEARD_ALG: + if (BrannBronzebeardAlgGUID == creature->GetGUID()) + BrannBronzebeardAlgGUID = 0; + break; + } + } void OnGameObjectCreate(GameObject* gameObject) { @@ -340,6 +387,45 @@ class instance_ulduar : public InstanceMapScript if (GetBossState(BOSS_ASSEMBLY_OF_IRON) != DONE) HandleGameObject(ArchivumDoorGUID, false); break; + case GO_CELESTIAL_PLANETARIUM_ACCESS_10: + case GO_CELESTIAL_PLANETARIUM_ACCESS_25: + if (_algalonSummoned) + gameObject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + break; + case GO_DOODAD_UL_SIGILDOOR_01: + AlgalonSigilDoorGUID[0] = gameObject->GetGUID(); + if (_algalonSummoned) + gameObject->SetGoState(GO_STATE_ACTIVE); + break; + case GO_DOODAD_UL_SIGILDOOR_02: + AlgalonSigilDoorGUID[1] = gameObject->GetGUID(); + if (_algalonSummoned) + gameObject->SetGoState(GO_STATE_ACTIVE); + break; + case GO_DOODAD_UL_SIGILDOOR_03: + AlgalonSigilDoorGUID[2] = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_DOODAD_UL_UNIVERSEFLOOR_01: + AlgalonFloorGUID[0] = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_DOODAD_UL_UNIVERSEFLOOR_02: + AlgalonFloorGUID[1] = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_DOODAD_UL_UNIVERSEGLOBE01: + AlgalonUniverseGUID = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03: + AlgalonTrapdoorGUID = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_GIFT_OF_THE_OBSERVER_10: + case GO_GIFT_OF_THE_OBSERVER_25: + GiftOfTheObserverGUID = gameObject->GetGUID(); + break; } } @@ -348,10 +434,14 @@ class instance_ulduar : public InstanceMapScript switch (gameObject->GetEntry()) { case GO_LEVIATHAN_DOOR: - AddDoor(gameObject, false); - break; case GO_XT_002_DOOR: + case GO_DOODAD_UL_SIGILDOOR_03: + case GO_DOODAD_UL_UNIVERSEFLOOR_01: + case GO_DOODAD_UL_UNIVERSEFLOOR_02: + case GO_DOODAD_UL_UNIVERSEGLOBE01: + case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03: AddDoor(gameObject, false); + break; default: break; } @@ -389,6 +479,7 @@ class instance_ulduar : public InstanceMapScript // Flame Leviathan's Tower Event triggers Creature* FlameLeviathan = instance->GetCreature(LeviathanGUID); if (FlameLeviathan && FlameLeviathan->isAlive()) // No leviathan, no event triggering ;) + { switch (eventId) { case EVENT_TOWER_OF_STORM_DESTROYED: @@ -404,6 +495,7 @@ class instance_ulduar : public InstanceMapScript FlameLeviathan->AI()->DoAction(ACTION_TOWER_OF_LIFE_DESTROYED); break; } + } } @@ -464,6 +556,52 @@ class instance_ulduar : public InstanceMapScript if (GameObject* gameObject = instance->GetGameObject(ThorimChestGUID)) gameObject->SetRespawnTime(gameObject->GetRespawnDelay()); break; + case BOSS_ALGALON: + if (state == DONE) + { + _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER); + _events.CancelEvent(EVENT_DESPAWN_ALGALON); + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0); + _algalonTimer = 61; + if (GameObject* gameObject = instance->GetGameObject(GiftOfTheObserverGUID)) + gameObject->SetRespawnTime(gameObject->GetRespawnDelay()); + // get item level (recheck weapons) + Map::PlayerList const& players = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->getSource()) + for (uint8 slot = EQUIPMENT_SLOT_MAINHAND; slot <= EQUIPMENT_SLOT_RANGED; ++slot) + if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel) + _maxWeaponItemLevel = item->GetTemplate()->ItemLevel; + } + else if (state == IN_PROGRESS) + { + // get item level (armor cannot be swapped in combat) + Map::PlayerList const& players = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* player = itr->getSource()) + { + for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot) + { + if (slot == EQUIPMENT_SLOT_TABARD || slot == EQUIPMENT_SLOT_BODY) + continue; + + if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + { + if (slot >= EQUIPMENT_SLOT_MAINHAND && slot <= EQUIPMENT_SLOT_RANGED) + { + if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel) + _maxWeaponItemLevel = item->GetTemplate()->ItemLevel; + } + else if (item->GetTemplate()->ItemLevel > _maxArmorItemLevel) + _maxArmorItemLevel = item->GetTemplate()->ItemLevel; + } + } + } + } + } + break; } return true; @@ -496,6 +634,16 @@ class instance_ulduar : public InstanceMapScript case DATA_UNBROKEN: Unbroken = bool(data); break; + case EVENT_DESPAWN_ALGALON: + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1); + DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60); + _algalonTimer = 60; + _events.ScheduleEvent(EVENT_DESPAWN_ALGALON, 3600000); + _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); + break; + case DATA_ALGALON_SUMMON_STATE: + _algalonSummoned = true; + break; default: break; } @@ -570,6 +718,22 @@ class instance_ulduar : public InstanceMapScript return KeeperGUIDs[1]; case BOSS_STONEBARK: return KeeperGUIDs[2]; + case DATA_SIGILDOOR_01: + return AlgalonSigilDoorGUID[0]; + case DATA_SIGILDOOR_02: + return AlgalonSigilDoorGUID[1]; + case DATA_SIGILDOOR_03: + return AlgalonSigilDoorGUID[2]; + case DATA_UNIVERSE_FLOOR_01: + return AlgalonFloorGUID[0]; + case DATA_UNIVERSE_FLOOR_02: + return AlgalonFloorGUID[1]; + case DATA_UNIVERSE_GLOBE: + return AlgalonUniverseGUID; + case DATA_ALGALON_TRAPDOOR: + return AlgalonTrapdoorGUID; + case DATA_BRANN_BRONZEBEARD_ALG: + return BrannBronzebeardAlgGUID; } return 0; @@ -592,12 +756,23 @@ class instance_ulduar : public InstanceMapScript return 0; } + bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* , Unit const* /* = NULL */, uint32 /* = 0 */) + { + switch (criteriaId) + { + case CRITERIA_HERALD_OF_TITANS: + return _maxArmorItemLevel <= MAX_HERALD_ARMOR_ITEMLEVEL && _maxWeaponItemLevel <= MAX_HERALD_WEAPON_ITEMLEVEL; + } + + return false; + } + std::string GetSaveData() { OUT_SAVE_INST_DATA; std::ostringstream saveStream; - saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS); + saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS) << ' ' << _algalonTimer << ' ' << (_algalonSummoned ? 1 : 0); OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); @@ -627,15 +802,68 @@ class instance_ulduar : public InstanceMapScript if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; - if (i == DATA_COLOSSUS) - SetData(i, tmpState); - else - SetBossState(i, EncounterState(tmpState)); + SetBossState(i, EncounterState(tmpState)); + } + + uint32 tempState; + loadStream >> tempState; + if (tempState == IN_PROGRESS || tempState > SPECIAL) + tempState = NOT_STARTED; + SetData(DATA_COLOSSUS, tempState); + + loadStream >> _algalonTimer; + loadStream >> tempState; + _algalonSummoned = tempState != 0; + if (_algalonSummoned && GetBossState(BOSS_ALGALON) != DONE) + { + _summonAlgalon = true; + if (_algalonTimer && _algalonTimer <= 60) + { + _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1); + DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, _algalonTimer); + } } } OUT_LOAD_INST_DATA_COMPLETE; } + + void Update(uint32 diff) + { + if (_events.Empty()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_UPDATE_ALGALON_TIMER: + SaveToDB(); + DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, --_algalonTimer); + if (_algalonTimer) + _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); + else + { + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0); + _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER); + if (Creature* algalon = instance->GetCreature(AlgalonGUID)) + algalon->AI()->DoAction(EVENT_DESPAWN_ALGALON); + } + break; + } + } + } + + private: + EventMap _events; + uint32 _algalonTimer; + bool _summonAlgalon; + bool _algalonSummoned; + uint32 _maxArmorItemLevel; + uint32 _maxWeaponItemLevel; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index a31954b8a16..d3b4684772f 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -18,9 +18,12 @@ #ifndef DEF_ULDUAR_H #define DEF_ULDUAR_H -#include "ObjectMgr.h" +#include "Creature.h" +#include "GameObject.h" #define UlduarScriptName "instance_ulduar" +extern Position const AlgalonLandPos; + enum UlduarBosses { MAX_ENCOUNTER = 20, @@ -50,98 +53,124 @@ enum UlduarBosses enum UlduarNPCs { // General - NPC_LEVIATHAN = 33113, - NPC_SALVAGED_DEMOLISHER = 33109, - NPC_SALVAGED_SIEGE_ENGINE = 33060, - NPC_IGNIS = 33118, - NPC_RAZORSCALE = 33186, - NPC_RAZORSCALE_CONTROLLER = 33233, - NPC_STEELFORGED_DEFFENDER = 33236, - NPC_EXPEDITION_COMMANDER = 33210, - NPC_XT002 = 33293, - NPC_XT_TOY_PILE = 33337, - NPC_STEELBREAKER = 32867, - NPC_MOLGEIM = 32927, - NPC_BRUNDIR = 32857, - NPC_KOLOGARN = 32930, - NPC_FOCUSED_EYEBEAM = 33632, - NPC_FOCUSED_EYEBEAM_RIGHT = 33802, - NPC_LEFT_ARM = 32933, - NPC_RIGHT_ARM = 32934, - NPC_RUBBLE = 33768, - NPC_AURIAYA = 33515, - NPC_MIMIRON = 33350, - NPC_HODIR = 32845, - NPC_THORIM = 32865, - NPC_FREYA = 32906, - NPC_VEZAX = 33271, - NPC_YOGGSARON = 33288, - NPC_ALGALON = 32871, + NPC_LEVIATHAN = 33113, + NPC_SALVAGED_DEMOLISHER = 33109, + NPC_SALVAGED_SIEGE_ENGINE = 33060, + NPC_IGNIS = 33118, + NPC_RAZORSCALE = 33186, + NPC_RAZORSCALE_CONTROLLER = 33233, + NPC_STEELFORGED_DEFFENDER = 33236, + NPC_EXPEDITION_COMMANDER = 33210, + NPC_XT002 = 33293, + NPC_XT_TOY_PILE = 33337, + NPC_STEELBREAKER = 32867, + NPC_MOLGEIM = 32927, + NPC_BRUNDIR = 32857, + NPC_KOLOGARN = 32930, + NPC_FOCUSED_EYEBEAM = 33632, + NPC_FOCUSED_EYEBEAM_RIGHT = 33802, + NPC_LEFT_ARM = 32933, + NPC_RIGHT_ARM = 32934, + NPC_RUBBLE = 33768, + NPC_AURIAYA = 33515, + NPC_MIMIRON = 33350, + NPC_HODIR = 32845, + NPC_THORIM = 32865, + NPC_FREYA = 32906, + NPC_VEZAX = 33271, + NPC_YOGGSARON = 33288, + NPC_ALGALON = 32871, // Mimiron - NPC_LEVIATHAN_MKII = 33432, - NPC_VX_001 = 33651, - NPC_AERIAL_COMMAND_UNIT = 33670, + NPC_LEVIATHAN_MKII = 33432, + NPC_VX_001 = 33651, + NPC_AERIAL_COMMAND_UNIT = 33670, // Freya's Keepers - NPC_IRONBRANCH = 32913, - NPC_BRIGHTLEAF = 32915, - NPC_STONEBARK = 32914, + NPC_IRONBRANCH = 32913, + NPC_BRIGHTLEAF = 32915, + NPC_STONEBARK = 32914, // Hodir's Helper NPCs - NPC_TOR_GREYCLOUD = 32941, - NPC_KAR_GREYCLOUD = 33333, - NPC_EIVI_NIGHTFEATHER = 33325, - NPC_ELLIE_NIGHTFEATHER = 32901, - NPC_SPIRITWALKER_TARA = 33332, - NPC_SPIRITWALKER_YONA = 32950, - NPC_ELEMENTALIST_MAHFUUN = 33328, - NPC_ELEMENTALIST_AVUUN = 32900, - NPC_AMIRA_BLAZEWEAVER = 33331, - NPC_VEESHA_BLAZEWEAVER = 32946, - NPC_MISSY_FLAMECUFFS = 32893, - NPC_SISSY_FLAMECUFFS = 33327, - NPC_BATTLE_PRIEST_ELIZA = 32948, - NPC_BATTLE_PRIEST_GINA = 33330, - NPC_FIELD_MEDIC_PENNY = 32897, - NPC_FIELD_MEDIC_JESSI = 33326, + NPC_TOR_GREYCLOUD = 32941, + NPC_KAR_GREYCLOUD = 33333, + NPC_EIVI_NIGHTFEATHER = 33325, + NPC_ELLIE_NIGHTFEATHER = 32901, + NPC_SPIRITWALKER_TARA = 33332, + NPC_SPIRITWALKER_YONA = 32950, + NPC_ELEMENTALIST_MAHFUUN = 33328, + NPC_ELEMENTALIST_AVUUN = 32900, + NPC_AMIRA_BLAZEWEAVER = 33331, + NPC_VEESHA_BLAZEWEAVER = 32946, + NPC_MISSY_FLAMECUFFS = 32893, + NPC_SISSY_FLAMECUFFS = 33327, + NPC_BATTLE_PRIEST_ELIZA = 32948, + NPC_BATTLE_PRIEST_GINA = 33330, + NPC_FIELD_MEDIC_PENNY = 32897, + NPC_FIELD_MEDIC_JESSI = 33326, // Freya's trash NPCs - NPC_CORRUPTED_SERVITOR = 33354, - NPC_MISGUIDED_NYMPH = 33355, - NPC_GUARDIAN_LASHER = 33430, - NPC_FOREST_SWARMER = 33431, - NPC_MANGROVE_ENT = 33525, - NPC_IRONROOT_LASHER = 33526, - NPC_NATURES_BLADE = 33527, - NPC_GUARDIAN_OF_LIFE = 33528, + NPC_CORRUPTED_SERVITOR = 33354, + NPC_MISGUIDED_NYMPH = 33355, + NPC_GUARDIAN_LASHER = 33430, + NPC_FOREST_SWARMER = 33431, + NPC_MANGROVE_ENT = 33525, + NPC_IRONROOT_LASHER = 33526, + NPC_NATURES_BLADE = 33527, + NPC_GUARDIAN_OF_LIFE = 33528, + + // Algalon the Observer + NPC_BRANN_BRONZBEARD_ALG = 34064, + NPC_AZEROTH = 34246, + NPC_LIVING_CONSTELLATION = 33052, + NPC_ALGALON_STALKER = 33086, + NPC_COLLAPSING_STAR = 32955, + NPC_BLACK_HOLE = 32953, + NPC_WORM_HOLE = 34099, + NPC_ALGALON_VOID_ZONE_VISUAL_STALKER = 34100, + NPC_ALGALON_STALKER_ASTEROID_TARGET_01 = 33104, + NPC_ALGALON_STALKER_ASTEROID_TARGET_02 = 33105, + NPC_UNLEASHED_DARK_MATTER = 34097, }; enum UlduarGameObjects { - GO_KOLOGARN_CHEST_HERO = 195047, - GO_KOLOGARN_CHEST = 195046, - GO_KOLOGARN_BRIDGE = 194232, - GO_KOLOGARN_DOOR = 194553, - GO_THORIM_CHEST_HERO = 194315, - GO_THORIM_CHEST = 194314, - GO_HODIR_RARE_CACHE_OF_WINTER = 194200, - GO_HODIR_RARE_CACHE_OF_WINTER_HERO = 194201, - GO_HODIR_CHEST_HERO = 194308, - GO_HODIR_CHEST = 194307, - GO_LEVIATHAN_DOOR = 194905, - GO_LEVIATHAN_GATE = 194630, - GO_XT_002_DOOR = 194631, - GO_VEZAX_DOOR = 194750, - GO_MOLE_MACHINE = 194316, - GO_RAZOR_HARPOON_1 = 194542, - GO_RAZOR_HARPOON_2 = 194541, - GO_RAZOR_HARPOON_3 = 194543, - GO_RAZOR_HARPOON_4 = 194519, - GO_RAZOR_BROKEN_HARPOON = 194565, - GO_HODIR_DOOR = 194634, - GO_HODIR_ICE_DOOR = 194441, - GO_ARCHIVUM_DOOR = 194556, + GO_KOLOGARN_CHEST_HERO = 195047, + GO_KOLOGARN_CHEST = 195046, + GO_KOLOGARN_BRIDGE = 194232, + GO_KOLOGARN_DOOR = 194553, + GO_THORIM_CHEST_HERO = 194315, + GO_THORIM_CHEST = 194314, + GO_HODIR_RARE_CACHE_OF_WINTER = 194200, + GO_HODIR_RARE_CACHE_OF_WINTER_HERO = 194201, + GO_HODIR_CHEST_HERO = 194308, + GO_HODIR_CHEST = 194307, + GO_LEVIATHAN_DOOR = 194905, + GO_LEVIATHAN_GATE = 194630, + GO_XT_002_DOOR = 194631, + GO_VEZAX_DOOR = 194750, + GO_MOLE_MACHINE = 194316, + GO_RAZOR_HARPOON_1 = 194542, + GO_RAZOR_HARPOON_2 = 194541, + GO_RAZOR_HARPOON_3 = 194543, + GO_RAZOR_HARPOON_4 = 194519, + GO_RAZOR_BROKEN_HARPOON = 194565, + GO_HODIR_DOOR = 194634, + GO_HODIR_ICE_DOOR = 194441, + GO_ARCHIVUM_DOOR = 194556, + + // Algalon the Observer + GO_CELESTIAL_PLANETARIUM_ACCESS_10 = 194628, + GO_CELESTIAL_PLANETARIUM_ACCESS_25 = 194752, + GO_DOODAD_UL_SIGILDOOR_01 = 194767, + GO_DOODAD_UL_SIGILDOOR_02 = 194911, + GO_DOODAD_UL_SIGILDOOR_03 = 194910, + GO_DOODAD_UL_UNIVERSEFLOOR_01 = 194715, + GO_DOODAD_UL_UNIVERSEFLOOR_02 = 194716, + GO_DOODAD_UL_UNIVERSEGLOBE01 = 194148, + GO_DOODAD_UL_ULDUAR_TRAPDOOR_03 = 194253, + GO_GIFT_OF_THE_OBSERVER_10 = 194821, + GO_GIFT_OF_THE_OBSERVER_25 = 194822, }; enum LeviathanData @@ -161,6 +190,7 @@ enum UlduarAchievementCriteriaIds { CRITERIA_CON_SPEED_ATORY = 21597, CRITERIA_DISARMED = 21687, + CRITERIA_HERALD_OF_TITANS = 10678, }; enum UlduarData @@ -180,12 +210,38 @@ enum UlduarData // Hodir DATA_HODIR_RARE_CACHE, + + // Algalon the Observer + DATA_ALGALON_SUMMON_STATE, + DATA_SIGILDOOR_01, + DATA_SIGILDOOR_02, + DATA_SIGILDOOR_03, + DATA_UNIVERSE_FLOOR_01, + DATA_UNIVERSE_FLOOR_02, + DATA_UNIVERSE_GLOBE, + DATA_ALGALON_TRAPDOOR, + DATA_BRANN_BRONZEBEARD_ALG, +}; + +enum UlduarWorldStates +{ + WORLD_STATE_ALGALON_DESPAWN_TIMER = 4131, + WORLD_STATE_ALGALON_TIMER_ENABLED = 4132, }; enum UlduarAchievementData { // FL Achievement boolean DATA_UNBROKEN = 29052906, // 2905, 2906 are achievement IDs, + MAX_HERALD_ARMOR_ITEMLEVEL = 226, + MAX_HERALD_WEAPON_ITEMLEVEL = 232, +}; + +enum UlduarEvents +{ + EVENT_DESPAWN_ALGALON = 1, + EVENT_UPDATE_ALGALON_TIMER = 2, + ACTION_INIT_ALGALON = 6, }; template @@ -199,6 +255,17 @@ CreatureAI* GetUlduarAI(Creature* creature) return NULL; } +template +GameObjectAI* GetUlduarAI(GameObject* go) +{ + if (InstanceMap* instance = go->GetMap()->ToInstanceMap()) + if (instance->GetInstanceScript()) + if (instance->GetScriptId() == sObjectMgr->GetScriptId(UlduarScriptName)) + return new AI(go); + + return NULL; +} + class PlayerOrPetCheck { public: -- cgit v1.2.3 From a5da806cc6ccd71918e89f0b66ecc15a3ed6be93 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 Apr 2012 23:30:40 +0200 Subject: Scripts/Ulduar: Fixed some WIP code for Algalon --- .../scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') 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 4465fc08792..ab2d8126fd2 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 @@ -360,7 +360,8 @@ class boss_algalon_the_observer : public CreatureScript case EVENT_DESPAWN_ALGALON: events.Reset(); events.SetPhase(PHASE_ROLE_PLAY); - events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1); + if (me->isInCombat()) + events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1); events.ScheduleEvent(EVENT_DESPAWN_ALGALON_1, 5000); events.ScheduleEvent(EVENT_DESPAWN_ALGALON_2, 17000); events.ScheduleEvent(EVENT_DESPAWN_ALGALON_3, 26000); @@ -731,9 +732,6 @@ class npc_living_constellation : public CreatureScript void DoAction(int32 const action) { - if (action != ACTION_ACTIVATE_STAR) - return; - switch (action) { case ACTION_ACTIVATE_STAR: -- cgit v1.2.3 From c6618575a29d1592b4ffc6b4359516af41736432 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 Apr 2012 23:50:32 +0200 Subject: Fixed build without PCH --- .../scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp | 1 + src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 ab2d8126fd2..4776c95ac88 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 @@ -18,6 +18,7 @@ #include "ObjectMgr.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "PassiveAI.h" #include "GameObjectAI.h" #include "MapManager.h" #include "MoveSplineInit.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index d3b4684772f..d35f0559080 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -18,8 +18,7 @@ #ifndef DEF_ULDUAR_H #define DEF_ULDUAR_H -#include "Creature.h" -#include "GameObject.h" +#include "ObjectMgr.h" #define UlduarScriptName "instance_ulduar" extern Position const AlgalonLandPos; -- cgit v1.2.3 From 479af777f1b75d1e62ae1bb59c6a2b62a6484009 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 20 Apr 2012 00:01:07 +0200 Subject: More include fixes --- src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') 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 4776c95ac88..6f87d7fcd2a 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 @@ -18,6 +18,7 @@ #include "ObjectMgr.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellScript.h" #include "PassiveAI.h" #include "GameObjectAI.h" #include "MapManager.h" -- cgit v1.2.3 From a5aba350a087386e7d46f837c88e8c4e90eb7bd6 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 19 Apr 2012 18:33:25 -0500 Subject: Core/SmartAI: Allow SMART_ACTION_SUMMON_GO and SMART_ACTION_SUMMON_CREATURE to use x, y, z and o parameters as relative offsets for a summoning position (example, summon creature 20 yards in front of the invoker) Signed-off-by: Subv --- src/server/game/AI/SmartScripts/SmartScript.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 209eb38e13a..31038faf369 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1119,12 +1119,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (!IsUnit(*itr)) - continue; - (*itr)->GetPosition(x, y, z, o); + x += e.target.x; + y += e.target.y; + z += e.target.z; + o += e.target.o; if (Creature* summon = GetBaseObject()->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration)) - if (unit && e.action.summonCreature.attackInvoker) + if (e.action.summonCreature.attackInvoker) summon->AI()->AttackStart((*itr)->ToUnit()); } @@ -1154,6 +1155,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u continue; (*itr)->GetPosition(x, y, z, o); + x += e.target.x + y += e.target.y + z += e.target.z + o += e.target.o GetBaseObject()->SummonGameObject(e.action.summonGO.entry, x, y, z, o, 0, 0, 0, 0, e.action.summonGO.despawnTime); } -- cgit v1.2.3 From 50f2be538cd5de97051c2920c9bcfc0a7a5e3091 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 19 Apr 2012 18:43:41 -0500 Subject: Fixed build --- src/server/game/AI/SmartScripts/SmartScript.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 31038faf369..893c8f4580e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1155,10 +1155,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u continue; (*itr)->GetPosition(x, y, z, o); - x += e.target.x - y += e.target.y - z += e.target.z - o += e.target.o + x += e.target.x; + y += e.target.y; + z += e.target.z; + o += e.target.o; GetBaseObject()->SummonGameObject(e.action.summonGO.entry, x, y, z, o, 0, 0, 0, 0, e.action.summonGO.despawnTime); } -- cgit v1.2.3 From e9fd6d19798c25f2971f37cd270722efac279cdf Mon Sep 17 00:00:00 2001 From: MrSmite Date: Fri, 20 Apr 2012 20:22:40 -0400 Subject: Fix pets attacking on non-harmful spells --- src/server/game/Spells/Spell.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index df2b9c35320..f055d669925 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3107,13 +3107,13 @@ void Spell::cast(bool skipCheck) // should be done before the spell is actually executed sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck); - // Let any pets know we've attacked something. As of 3.0.2 pets begin - // attacking their owner's target immediately - if (Pet* playerPet = playerCaster->GetPet()) - { - if (playerPet->isAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT)) - playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit()); - } + // As of 3.0.2 pets begin attacking their owner's target immediately + // Let any pets know we've attacked something. Check DmgClass for harmful spells only + // This prevents spells such as Hunter's Mark from triggering pet attack + if (this->GetSpellInfo()->DmgClass != SPELL_DAMAGE_CLASS_NONE) + if (Pet* playerPet = playerCaster->GetPet()) + if (playerPet->isAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT)) + playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit()); } SetExecutedCurrently(true); -- cgit v1.2.3 From 9559a488771eec4f6ea7826df6ad459ca44fa21f Mon Sep 17 00:00:00 2001 From: kaelima Date: Sat, 21 Apr 2012 02:42:59 +0200 Subject: Core/Spell: Attempt to fix some rare steady shot crashes ref issue #5689 --- src/server/game/Spells/SpellEffects.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 5078391348f..371d4cdc5e0 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -666,19 +666,19 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (found) damage += m_spellInfo->Effects[EFFECT_1].CalcValue(); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (Player* caster = m_caster->ToPlayer()) { // Add Ammo and Weapon damage plus RAP * 0.1 - Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); - if (item) + if (Item* item = caster->GetWeaponForAttack(RANGED_ATTACK)) { - float dmg_min = item->GetTemplate()->Damage->DamageMin; - float dmg_max = item->GetTemplate()->Damage->DamageMax; + ItemTemplate const* weaponTemplate = item->GetTemplate(); + float dmg_min = weaponTemplate->Damage[0].DamageMin; + float dmg_max = weaponTemplate->Damage[0].DamageMax; if (dmg_max == 0.0f && dmg_min > dmg_max) damage += int32(dmg_min); else damage += irand(int32(dmg_min), int32(dmg_max)); - damage += int32(m_caster->ToPlayer()->GetAmmoDPS()*item->GetTemplate()->Delay*0.001f); + damage += int32(caster->GetAmmoDPS() * weaponTemplate->Delay * 0.001f); } } } -- cgit v1.2.3 From 408c78dcd7311588d7ceeb0f0e98d0831b500632 Mon Sep 17 00:00:00 2001 From: Vincent-Core Date: Sat, 7 Apr 2012 12:17:21 +0200 Subject: Core/Spells * Converted percent based damage dealing spell effects to scripts * Fix Leviroth Self-Impale damage Closes #6085 Signed-off-by: Shauren --- .../2012_04_21_00_world_spell_script_names.sql | 14 ++++++++ src/server/game/Spells/SpellEffects.cpp | 17 --------- .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 31 ----------------- .../scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp | 8 ++++- src/server/scripts/Spells/spell_generic.cpp | 40 ++++++++++++++++++++++ 5 files changed, 61 insertions(+), 49 deletions(-) create mode 100644 sql/updates/world/2012_04_21_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_21_00_world_spell_script_names.sql b/sql/updates/world/2012_04_21_00_world_spell_script_names.sql new file mode 100644 index 00000000000..e61ef4aec74 --- /dev/null +++ b/sql/updates/world/2012_04_21_00_world_spell_script_names.sql @@ -0,0 +1,14 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (20625,29142,35139,42393,49882,55269,56578,38441,66316,67100,67101,67102); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(20625,'spell_gen_default_count_pct_from_max_hp'), -- Ritual of Doom Sacrifice +(29142,'spell_gen_default_count_pct_from_max_hp'), -- Eyesore Blaster +(35139,'spell_gen_default_count_pct_from_max_hp'), -- Throw Boom's Doom +(42393,'spell_gen_default_count_pct_from_max_hp'), -- Brewfest - Attack Keg +(49882,'spell_gen_default_count_pct_from_max_hp'), -- Leviroth Self-Impale +(55269,'spell_gen_default_count_pct_from_max_hp'), -- Deathly Stare +(56578,'spell_gen_default_count_pct_from_max_hp'), -- Rapid-Fire Harpoon +(38441,'spell_gen_50pct_count_pct_from_max_hp'), -- Cataclysmic Bolt +(66316,'spell_gen_50pct_count_pct_from_max_hp'), -- Spinning Pain Spike 10m +(67100,'spell_gen_50pct_count_pct_from_max_hp'), -- Spinning Pain Spike 25m +(67101,'spell_gen_50pct_count_pct_from_max_hp'), -- Spinning Pain Spike 10m heroic +(67102,'spell_gen_50pct_count_pct_from_max_hp'); -- Spinning Pain Spike 25m heroic diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 371d4cdc5e0..c72ccbacc3d 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -390,23 +390,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (!unitTarget->HasAura(27825)) return; break; - // Cataclysmic Bolt - case 38441: - { - damage = unitTarget->CountPctFromMaxHealth(50); - break; - } - case 20625: // Ritual of Doom Sacrifice - case 29142: // Eyesore Blaster - case 35139: // Throw Boom's Doom - case 42393: // Brewfest - Attack Keg - case 55269: // Deathly Stare - case 56578: // Rapid-Fire Harpoon - case 62775: // Tympanic Tantrum - { - damage = unitTarget->CountPctFromMaxHealth(damage); - break; - } // Gargoyle Strike case 51963: { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 6f817a6d0eb..a7328b43826 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -515,36 +515,6 @@ public: }; -class spell_spinning_pain_spike : public SpellScriptLoader -{ - public: - spell_spinning_pain_spike() : SpellScriptLoader("spell_spinning_pain_spike") {} - - class spell_spinning_pain_spike_SpellScript : public SpellScript - { - PrepareSpellScript(spell_spinning_pain_spike_SpellScript); - - void HandleScript(SpellEffIndex /*eff*/) - { - Unit* target = GetHitUnit(); - if (!target) - return; - - if (target->isAlive()) - SetHitDamage(target->CountPctFromMaxHealth(50)); - } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_spinning_pain_spike_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - } - }; - - SpellScript* GetSpellScript() const - { - return new spell_spinning_pain_spike_SpellScript(); - } -}; - void AddSC_boss_jaraxxus() { new boss_jaraxxus(); @@ -553,5 +523,4 @@ void AddSC_boss_jaraxxus() new mob_fel_infernal(); new mob_nether_portal(); new mob_mistress_of_pain(); - new spell_spinning_pain_spike(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 727f40aef81..c7091b42c5a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -947,13 +947,19 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader void FilterTargets(std::list& unitList) { - unitList.remove_if (PlayerOrPetCheck()); + unitList.remove_if(PlayerOrPetCheck()); + } + + void RecalculateDamage() + { + SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(GetHitDamage())); } void Register() { OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnHit += SpellHitFn(spell_xt002_tympanic_tantrum_SpellScript::RecalculateDamage); } }; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 035f9ec98b2..2d431331691 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2618,6 +2618,44 @@ class spell_gen_wg_water : public SpellScriptLoader } }; +class spell_gen_count_pct_from_max_hp : public SpellScriptLoader +{ + public: + spell_gen_count_pct_from_max_hp(char const* name, int32 damagePct = 0) : SpellScriptLoader(name), _damagePct(damagePct) { } + + class spell_gen_count_pct_from_max_hp_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript) + + public: + spell_gen_count_pct_from_max_hp_SpellScript(int32 damagePct) : SpellScript(), _damagePct(damagePct) { } + + void RecalculateDamage() + { + if (!_damagePct) + _damagePct = GetHitDamage(); + + SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(_damagePct)); + } + + void Register() + { + OnHit += SpellHitFn(spell_gen_count_pct_from_max_hp_SpellScript::RecalculateDamage); + } + + private: + int32 _damagePct; + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_count_pct_from_max_hp_SpellScript(_damagePct); + } + + private: + int32 _damagePct; +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2669,4 +2707,6 @@ void AddSC_generic_spell_scripts() new spell_gen_chaos_blast(); new spell_gen_ds_flush_knockback(); new spell_gen_wg_water(); + new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); + new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); } -- cgit v1.2.3 From 5c3ee06f49d0061ef78042a637f5ca5dc787f2ab Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 21 Apr 2012 16:29:26 +0200 Subject: Core/Errors: Improved OS detection for windows crash reporting --- src/server/shared/Debugging/WheatyExceptionReport.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp index 63648f66e29..febc5ef3573 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.cpp +++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp @@ -195,7 +195,23 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax) case VER_PLATFORM_WIN32_NT: // Test for the specific product family. if (osvi.dwMajorVersion == 6) - _tcsncat(szVersion, _T("Windows Vista or Windows Server 2008 "), cntMax); + { + #if WINVER < 0x0500 + if (osvi.wReserved[1] == VER_NT_WORKSTATION) + #else + if (osvi.wProductType == VER_NT_WORKSTATION) + #endif // WINVER < 0x0500 + { + if (osvi.dwMinorVersion == 1) + _tcsncat(szVersion, _T("Windows 7 "), cntMax); + else + _tcsncat(szVersion, _T("Windows Vista "), cntMax); + } + else if (osvi.dwMinorVersion == 1) + _tcsncat(szVersion, _T("Windows Server 2008 R2 "), cntMax); + else + _tcsncat(szVersion, _T("Windows Server 2008 "), cntMax); + } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) _tcsncat(szVersion, _T("Microsoft Windows Server 2003 "), cntMax); if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) -- cgit v1.2.3 From 2921e28de38d539f2ac82f11be2a9721eb6cc92d Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 21 Apr 2012 20:10:11 +0200 Subject: Core/Maps: Increased default ground search range, 10 yards was insufficient for many flying creatures --- src/server/game/Maps/Map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 766e3d23f93..6ba08646f25 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -228,7 +228,7 @@ enum LevelRequirementVsMode #define MAX_HEIGHT 100000.0f // can be use for find ground height at surface #define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE #define MAX_FALL_DISTANCE 250000.0f // "unlimited fall" to find VMap ground if it is available, just larger than MAX_HEIGHT - INVALID_HEIGHT -#define DEFAULT_HEIGHT_SEARCH 10.0f // default search distance to find height at nearby locations +#define DEFAULT_HEIGHT_SEARCH 50.0f // default search distance to find height at nearby locations #define MIN_UNLOAD_DELAY 1 // immediate unload typedef std::map CreatureGroupHolderType; -- cgit v1.2.3 From c47d295e2afc59ceeb24abc7e4b59647da6eaa4b Mon Sep 17 00:00:00 2001 From: Ramusik Date: Sat, 21 Apr 2012 21:44:20 +0300 Subject: Scripts/Outland: Boss Doomlord Kazzak - Implement Berserk - Some style corrections --- .../scripts/Outland/boss_doomlord_kazzak.cpp | 37 ++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 147d2d60359..a213713ae1a 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -31,15 +31,15 @@ enum Texts enum Spells { - SPELL_SHADOWVOLLEY = 32963, + SPELL_SHADOW_VOLLEY = 32963, SPELL_CLEAVE = 31779, SPELL_THUNDERCLAP = 36706, - SPELL_VOIDBOLT = 39329, - SPELL_MARKOFKAZZAK = 32960, - SPELL_MARKOFKAZZAK_DAMAGE = 32961, + SPELL_VOID_BOLT = 39329, + SPELL_MARK_OF_KAZZAK = 32960, SPELL_ENRAGE = 32964, - SPELL_CAPTURESOUL = 32966, - SPELL_TWISTEDREFLECTION = 21063 + SPELL_CAPTURE_SOUL = 32966, + SPELL_TWISTED_REFLECTION = 21063, + SPELL_BERSERK = 32965, }; enum Events @@ -47,10 +47,11 @@ enum Events EVENT_SHADOW_VOLLEY = 1, EVENT_CLEAVE = 2, EVENT_THUNDERCLAP = 3, - EVENT_VOIDBOLT = 4, + EVENT_VOID_BOLT = 4, EVENT_MARK_OF_KAZZAK = 5, EVENT_ENRAGE = 6, - EVENT_TWISTED_REFLECTION = 7 + EVENT_TWISTED_REFLECTION = 7, + EVENT_BERSERK = 8 }; class boss_doomlord_kazzak : public CreatureScript @@ -70,10 +71,11 @@ class boss_doomlord_kazzak : public CreatureScript _events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(6000, 10000)); _events.ScheduleEvent(EVENT_CLEAVE, 7000); _events.ScheduleEvent(EVENT_THUNDERCLAP, urand(14000, 18000)); - _events.ScheduleEvent(EVENT_VOIDBOLT, 30000); + _events.ScheduleEvent(EVENT_VOID_BOLT, 30000); _events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 25000); _events.ScheduleEvent(EVENT_ENRAGE, 60000); _events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 33000); + _events.ScheduleEvent(EVENT_BERSERK, 180000); } void JustRespawned() @@ -92,7 +94,7 @@ class boss_doomlord_kazzak : public CreatureScript if (victim->GetTypeId() != TYPEID_PLAYER) return; - DoCast(me, SPELL_CAPTURESOUL); + DoCast(me, SPELL_CAPTURE_SOUL); Talk(SAY_KILL); } @@ -118,7 +120,7 @@ class boss_doomlord_kazzak : public CreatureScript switch (eventId) { case EVENT_SHADOW_VOLLEY: - DoCastVictim(SPELL_SHADOWVOLLEY); + DoCastVictim(SPELL_SHADOW_VOLLEY); _events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(4000, 6000)); break; case EVENT_CLEAVE: @@ -129,13 +131,13 @@ class boss_doomlord_kazzak : public CreatureScript DoCastVictim(SPELL_THUNDERCLAP); _events.ScheduleEvent(EVENT_THUNDERCLAP, urand(10000, 14000)); break; - case EVENT_VOIDBOLT: - DoCastVictim(SPELL_VOIDBOLT); - _events.ScheduleEvent(EVENT_VOIDBOLT, urand(15000, 18000)); + case EVENT_VOID_BOLT: + DoCastVictim(SPELL_VOID_BOLT); + _events.ScheduleEvent(EVENT_VOID_BOLT, urand(15000, 18000)); break; case EVENT_MARK_OF_KAZZAK: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - DoCast(target, SPELL_MARKOFKAZZAK); + DoCast(target, SPELL_MARK_OF_KAZZAK); _events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 20000); break; case EVENT_ENRAGE: @@ -145,9 +147,12 @@ class boss_doomlord_kazzak : public CreatureScript break; case EVENT_TWISTED_REFLECTION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - DoCast(target, SPELL_TWISTEDREFLECTION); + DoCast(target, SPELL_TWISTED_REFLECTION); _events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 15000); break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + break; default: break; } -- cgit v1.2.3 From 98f9472715e782119807ebdf3193d3d626c87925 Mon Sep 17 00:00:00 2001 From: Xanvial Date: Sun, 22 Apr 2012 08:40:22 +0700 Subject: Convert script of npc tabard vendor to SAI and add missing tabard recovery --- sql/updates/world/2012_04_22_00_world_sai.sql | 72 +++++++++++ src/server/scripts/World/npcs_special.cpp | 167 -------------------------- 2 files changed, 72 insertions(+), 167 deletions(-) create mode 100644 sql/updates/world/2012_04_22_00_world_sai.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_22_00_world_sai.sql b/sql/updates/world/2012_04_22_00_world_sai.sql new file mode 100644 index 00000000000..0a84b09c087 --- /dev/null +++ b/sql/updates/world/2012_04_22_00_world_sai.sql @@ -0,0 +1,72 @@ +-- SAI for Tabard Vendor Elizabeth Ross +SET @ROSS := 28776; +SET @GOSSIP := 9832; + +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ROSS; + +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@GOSSIP AND `id`>0 AND `id`<11; +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`) VALUES +(@GOSSIP, 1, 0, 'I''ve lost my Blood Knight Tabard.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 2, 0, 'I''ve lost my Tabard of the Hand.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 3, 0, 'I''ve lost my Tabard of the Protector.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 4, 0, 'I''ve lost my Green Trophy Tabard of the Illidari.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 5, 0, 'I''ve lost my Purple Trophy Tabard of the Illidari.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 6, 0, 'I''ve lost my Tabard of Summer Skies.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 7, 0, 'I''ve lost my Tabard of Summer Flames.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 8, 0, 'I''ve lost my Loremaster''s Colors.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 9, 0, 'I''ve lost my Tabard of the Explorer.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 10, 0, 'I''ve lost my Tabard of the Achiever.', 1, 1, 0, 0, 0, 0, ''); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ROSS AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ROSS, 0, 0, 0, 62, 0, 100, 0, @GOSSIP, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Blood Knight Tabard'), +(@ROSS, 0, 1, 0, 62, 0, 100, 0, @GOSSIP, 1, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 2, 0, 62, 0, 100, 0, @GOSSIP, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of the Hand'), +(@ROSS, 0, 3, 0, 62, 0, 100, 0, @GOSSIP, 2, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 4, 0, 62, 0, 100, 0, @GOSSIP, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of the Protector'), +(@ROSS, 0, 5, 0, 62, 0, 100, 0, @GOSSIP, 3, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 6, 0, 62, 0, 100, 0, @GOSSIP, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Green Trophy Tabard of the Illidari'), +(@ROSS, 0, 7, 0, 62, 0, 100, 0, @GOSSIP, 4, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 8, 0, 62, 0, 100, 0, @GOSSIP, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Purple Trophy Tabard of the Illidari'), +(@ROSS, 0, 9, 0, 62, 0, 100, 0, @GOSSIP, 5, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 10, 0, 62, 0, 100, 0, @GOSSIP, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of Summer Skies'), +(@ROSS, 0, 11, 0, 62, 0, 100, 0, @GOSSIP, 6, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 12, 0, 62, 0, 100, 0, @GOSSIP, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of Summer Flames'), +(@ROSS, 0, 13, 0, 62, 0, 100, 0, @GOSSIP, 7, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 14, 0, 62, 0, 100, 0, @GOSSIP, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Loremaster''s Colors'), +(@ROSS, 0, 15, 0, 62, 0, 100, 0, @GOSSIP, 8, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 16, 0, 62, 0, 100, 0, @GOSSIP, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of the Explorer'), +(@ROSS, 0, 17, 0, 62, 0, 100, 0, @GOSSIP, 9, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'), +(@ROSS, 0, 18, 0, 62, 0, 100, 0, @GOSSIP, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of the Achiever'), +(@ROSS, 0, 19, 0, 62, 0, 100, 0, @GOSSIP, 10, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=@GOSSIP; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,@GOSSIP,1,0,2,25549,1,1,1,0,'','Only show gossip if player doesn''t have Blood Knight Tabard'), +(15,@GOSSIP,1,0,8,9737,0,0,0,0,'','Only show gossip if player already finished quest True Masters of Light'), +(15,@GOSSIP,2,0,2,24344,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of the Hand'), +(15,@GOSSIP,2,0,8,9762,0,0,0,0,'','Only show gossip if player already finished quest The Unwritten Prophecy'), +(15,@GOSSIP,3,0,2,28788,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of the protector'), +(15,@GOSSIP,3,0,8,10259,0,0,0,0,'','Only show gossip if player already finished quest Into the Breach'), +(15,@GOSSIP,4,0,2,31404,1,1,1,0,'','Only show gossip if player doesn''t have Green Trophy Tabard of Illidari'), +(15,@GOSSIP,4,0,2,31405,1,1,1,0,'','Only show gossip if player doesn''t have Purple Trophy Tabard of Illidari'), +(15,@GOSSIP,4,0,2,31408,1,1,1,0,'','Only show gossip if player doesn''t have Offering of the Sha''tar'), +(15,@GOSSIP,4,0,8,10781,0,0,0,0,'','Only show gossip if player already finished quest Battle of the Crimson Watch'), +(15,@GOSSIP,5,0,2,31404,1,1,1,0,'','Only show gossip if player doesn''t have Green Trophy Tabard of Illidari'), +(15,@GOSSIP,5,0,2,31405,1,1,1,0,'','Only show gossip if player doesn''t have Purple Trophy Tabard of Illidari'), +(15,@GOSSIP,5,0,2,31408,1,1,1,0,'','Only show gossip if player doesn''t have Offering of the Sha''tar'), +(15,@GOSSIP,5,0,8,10781,0,0,0,0,'','Only show gossip if player already finished quest Battle of the Crimson Watch'), +(15,@GOSSIP,6,0,2,35279,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of Summer Skies'), +(15,@GOSSIP,6,0,2,35280,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of Summer Flames'), +(15,@GOSSIP,6,0,8,11972,0,0,0,0,'','Only show gossip if player already finished quest Shards of Ahune'), +(15,@GOSSIP,7,0,2,35279,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of Summer Skies'), +(15,@GOSSIP,7,0,2,35280,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of Summer Flames'), +(15,@GOSSIP,7,0,8,11972,0,0,0,0,'','Only show gossip if player already finished quest Shards of Ahune'), +(15,@GOSSIP,8,0,2,43300,1,1,1,0,'','Only show gossip if player doesn''t have Loremaster''s Colors'), +(15,@GOSSIP,8,0,17,1681,0,0,0,0,'','Only show gossip if player have achievement Loremaster (A)'), +(15,@GOSSIP,8,1,2,43300,1,1,1,0,'','Only show gossip if player doesn''t have Loremaster''s Colors'), +(15,@GOSSIP,8,1,17,1682,0,0,0,0,'','Only show gossip if player have achievement Loremaster (H)'), +(15,@GOSSIP,9,0,2,43348,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of the Explorer'), +(15,@GOSSIP,9,0,17,45,0,0,0,0,'','Only show gossip if player have achievement Explore Northrend'), +(15,@GOSSIP,10,0,2,40643,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of the Explorer'), +(15,@GOSSIP,10,0,17,1021,0,0,0,0,'','Only show gossip if player have achievement Twenty-Five Tabards'); diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 61b997bba35..e1cfd077444 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2529,172 +2529,6 @@ public: } }; -/*###### -## npc_tabard_vendor -######*/ - -enum -{ - QUEST_TRUE_MASTERS_OF_LIGHT = 9737, - QUEST_THE_UNWRITTEN_PROPHECY = 9762, - QUEST_INTO_THE_BREACH = 10259, - QUEST_BATTLE_OF_THE_CRIMSON_WATCH = 10781, - QUEST_SHARDS_OF_AHUNE = 11972, - - ACHIEVEMENT_EXPLORE_NORTHREND = 45, - ACHIEVEMENT_TWENTYFIVE_TABARDS = 1021, - ACHIEVEMENT_THE_LOREMASTER_A = 1681, - ACHIEVEMENT_THE_LOREMASTER_H = 1682, - - ITEM_TABARD_OF_THE_HAND = 24344, - ITEM_TABARD_OF_THE_BLOOD_KNIGHT = 25549, - ITEM_TABARD_OF_THE_PROTECTOR = 28788, - ITEM_OFFERING_OF_THE_SHATAR = 31408, - ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI = 31404, - ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI = 31405, - ITEM_TABARD_OF_THE_SUMMER_SKIES = 35279, - ITEM_TABARD_OF_THE_SUMMER_FLAMES = 35280, - ITEM_TABARD_OF_THE_ACHIEVER = 40643, - ITEM_LOREMASTERS_COLORS = 43300, - ITEM_TABARD_OF_THE_EXPLORER = 43348, - - SPELL_TABARD_OF_THE_BLOOD_KNIGHT = 54974, - SPELL_TABARD_OF_THE_HAND = 54976, - SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI = 54977, - SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI = 54982, - SPELL_TABARD_OF_THE_ACHIEVER = 55006, - SPELL_TABARD_OF_THE_PROTECTOR = 55008, - SPELL_LOREMASTERS_COLORS = 58194, - SPELL_TABARD_OF_THE_EXPLORER = 58224, - SPELL_TABARD_OF_SUMMER_SKIES = 62768, - SPELL_TABARD_OF_SUMMER_FLAMES = 62769 -}; - -#define GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT "I've lost my Tabard of Blood Knight." -#define GOSSIP_LOST_TABARD_OF_THE_HAND "I've lost my Tabard of the Hand." -#define GOSSIP_LOST_TABARD_OF_THE_PROTECTOR "I've lost my Tabard of the Protector." -#define GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI "I've lost my Green Trophy Tabard of the Illidari." -#define GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI "I've lost my Purple Trophy Tabard of the Illidari." -#define GOSSIP_LOST_TABARD_OF_SUMMER_SKIES "I've lost my Tabard of Summer Skies." -#define GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES "I've lost my Tabard of Summer Flames." -#define GOSSIP_LOST_LOREMASTERS_COLORS "I've lost my Loremaster's Colors." -#define GOSSIP_LOST_TABARD_OF_THE_EXPLORER "I've lost my Tabard of the Explorer." -#define GOSSIP_LOST_TABARD_OF_THE_ACHIEVER "I've lost my Tabard of the Achiever." - -class npc_tabard_vendor : public CreatureScript -{ -public: - npc_tabard_vendor() : CreatureScript("npc_tabard_vendor") { } - - bool OnGossipHello(Player* player, Creature* creature) - { - bool lostBloodKnight = false; - bool lostHand = false; - bool lostProtector = false; - bool lostIllidari = false; - bool lostSummer = false; - - //Tabard of the Blood Knight - if (player->GetQuestRewardStatus(QUEST_TRUE_MASTERS_OF_LIGHT) && !player->HasItemCount(ITEM_TABARD_OF_THE_BLOOD_KNIGHT, 1, true)) - lostBloodKnight = true; - - //Tabard of the Hand - if (player->GetQuestRewardStatus(QUEST_THE_UNWRITTEN_PROPHECY) && !player->HasItemCount(ITEM_TABARD_OF_THE_HAND, 1, true)) - lostHand = true; - - //Tabard of the Protector - if (player->GetQuestRewardStatus(QUEST_INTO_THE_BREACH) && !player->HasItemCount(ITEM_TABARD_OF_THE_PROTECTOR, 1, true)) - lostProtector = true; - - //Green Trophy Tabard of the Illidari - //Purple Trophy Tabard of the Illidari - if (player->GetQuestRewardStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) && - (!player->HasItemCount(ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && - !player->HasItemCount(ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && - !player->HasItemCount(ITEM_OFFERING_OF_THE_SHATAR, 1, true))) - lostIllidari = true; - - //Tabard of Summer Skies - //Tabard of Summer Flames - if (player->GetQuestRewardStatus(QUEST_SHARDS_OF_AHUNE) && - !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_SKIES, 1, true) && - !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_FLAMES, 1, true)) - lostSummer = true; - - if (lostBloodKnight || lostHand || lostProtector || lostIllidari || lostSummer) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - - if (lostBloodKnight) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - if (lostHand) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - if (lostProtector) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - - if (lostIllidari) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - } - - if (lostSummer) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - } - - player->SEND_GOSSIP_MENU(13583, creature->GetGUID()); - } - else - player->GetSession()->SendListInventory(creature->GetGUID()); - - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_TRADE: - player->GetSession()->SendListInventory(creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 1: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_BLOOD_KNIGHT, false); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_HAND, false); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_PROTECTOR, false); - break; - case GOSSIP_ACTION_INFO_DEF + 4: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, false); - break; - case GOSSIP_ACTION_INFO_DEF + 5: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, false); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_SUMMER_SKIES, false); - break; - case GOSSIP_ACTION_INFO_DEF + 7: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_SUMMER_FLAMES, false); - break; - } - return true; - } -}; - /*###### ## npc_experience ######*/ @@ -3158,7 +2992,6 @@ void AddSC_npcs_special() new npc_wormhole(); new npc_pet_trainer(); new npc_locksmith(); - new npc_tabard_vendor(); new npc_experience(); new npc_fire_elemental(); new npc_earth_elemental(); -- cgit v1.2.3 From 8cf7d9185725b14b31f35c73f167a665edce543f Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Sun, 22 Apr 2012 13:58:22 +0300 Subject: Core/DB: Quest The Emissary. Fix condition in item spell(usable only when npc is above 95% hp). Added correct faction,unit_flags and emote to Leviroth. --- sql/updates/world/2012_04_05_00_world_creature_misc.sql | 5 +++++ src/server/scripts/Spells/spell_item.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2012_04_05_00_world_creature_misc.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_05_00_world_creature_misc.sql b/sql/updates/world/2012_04_05_00_world_creature_misc.sql new file mode 100644 index 00000000000..ae35b3fba5d --- /dev/null +++ b/sql/updates/world/2012_04_05_00_world_creature_misc.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `faction_A`=1914,`faction_H`=1914,`unit_flags`=33024 WHERE `entry`=26452; + +DELETE FROM `creature_template_addon` WHERE `entry`=26452; +INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(26452,0,0,0,1,383,''); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 666477e68e7..80520f44c3e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1535,7 +1535,7 @@ class spell_item_impale_leviroth : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { if (Unit* target = GetHitCreature()) - if (target->GetEntry() == NPC_LEVIROTH && target->HealthBelowPct(95)) + if (target->GetEntry() == NPC_LEVIROTH && !target->HealthBelowPct(95)) target->CastSpell(target, SPELL_LEVIROTH_SELF_IMPALE, true); } -- cgit v1.2.3 From ddd25ce7166fc34f9e3411863da80f84d3693c34 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 22 Apr 2012 04:29:49 +0200 Subject: Battleground/Strand of the Ancients: Fix broken gate state --- .../game/Battlegrounds/Zones/BattlegroundSA.cpp | 10 +-- .../game/Battlegrounds/Zones/BattlegroundSA.h | 89 +++++++++++++++++----- 2 files changed, 73 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 6d784488aad..977897b8d48 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -534,16 +534,16 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui if (eventType == go->GetGOInfo()->building.damagedEvent) { - uint32 i = GetGateIDFromDestroyEventID(eventType); + uint32 i = getGateIdFromDamagedOrDestroyEventId(eventType); GateStatus[i] = BG_SA_GATE_DAMAGED; - uint32 uws = GetWorldStateFromGateID(i); + uint32 uws = getWorldStateFromGateId(i); if (uws) UpdateWorldState(uws, GateStatus[i]); } if (eventType == go->GetGOInfo()->building.destroyedEvent) { - if (go->GetGOInfo()->building.destroyedEvent == 19837) + if (go->GetGOInfo()->building.destroyedEvent == BG_SA_EVENT_ANCIENT_GATE_DESTROYED) SendWarningToAll(LANG_BG_SA_CHAMBER_BREACHED); else SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str()); @@ -603,7 +603,7 @@ void BattlegroundSA::DemolisherStartState(bool start) void BattlegroundSA::DestroyGate(Player* player, GameObject* go) { - uint32 i = GetGateIDFromDestroyEventID(go->GetGOInfo()->building.destroyedEvent); + uint32 i = getGateIdFromDamagedOrDestroyEventId(go->GetGOInfo()->building.destroyedEvent); if (!GateStatus[i]) return; @@ -612,7 +612,7 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go) if (g->GetGOValue()->Building.Health == 0) { GateStatus[i] = BG_SA_GATE_DESTROYED; - uint32 uws = GetWorldStateFromGateID(i); + uint32 uws = getWorldStateFromGateId(i); if (uws) UpdateWorldState(uws, GateStatus[i]); bool rewardHonor = true; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 76a772ff978..2ade101ce54 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -45,9 +45,30 @@ enum BG_SA_Status enum BG_SA_GateState { - BG_SA_GATE_OK = 1, - BG_SA_GATE_DAMAGED = 2, - BG_SA_GATE_DESTROYED = 3 + BG_SA_GATE_OK = 1, + BG_SA_GATE_DAMAGED = 2, + BG_SA_GATE_DESTROYED = 3 +}; + +enum BG_SA_EventIdGate +{ + BG_SA_EVENT_GREEN_GATE_DAMAGED = 19041, + BG_SA_EVENT_GREEN_GATE_DESTROYED = 19046, + + BG_SA_EVENT_BLUE_GATE_DAMAGED = 19040, + BG_SA_EVENT_BLUE_GATE_DESTROYED = 19045, + + BG_SA_EVENT_RED_GATE_DAMAGED = 19042, + BG_SA_EVENT_RED_GATE_DESTROYED = 19047, + + BG_SA_EVENT_PURPLE_GATE_DAMAGED = 19048, + BG_SA_EVENT_PURPLE_GATE_DESTROYED = 19043, + + BG_SA_EVENT_YELLOW_GATE_DAMAGED = 19049, + BG_SA_EVENT_YELLOW_GATE_DESTROYED = 19044, + + BG_SA_EVENT_ANCIENT_GATE_DAMAGED = 19836, + BG_SA_EVENT_ANCIENT_GATE_DESTROYED = 19837 }; enum BG_SA_Timers @@ -443,34 +464,60 @@ class BattlegroundSA : public Battleground /// Called when a player use a gamobject (relic) virtual void EventPlayerUsedGO(Player* Source, GameObject* object); /// Return gate id, relative to bg data, according to gameobject id - uint32 GetGateIDFromDestroyEventID(uint32 id) + uint32 getGateIdFromDamagedOrDestroyEventId(uint32 id) { - uint32 i = 0; switch (id) { - case 19046: i = BG_SA_GREEN_GATE; break; //Green gate destroyed - case 19045: i = BG_SA_BLUE_GATE; break; //blue gate - case 19047: i = BG_SA_RED_GATE; break; //red gate - case 19048: i = BG_SA_PURPLE_GATE; break; //purple gate - case 19049: i = BG_SA_YELLOW_GATE; break; //yellow gate - case 19837: i = BG_SA_ANCIENT_GATE; break; //ancient gate + // Green gate + case BG_SA_EVENT_GREEN_GATE_DAMAGED: + case BG_SA_EVENT_GREEN_GATE_DESTROYED: + return BG_SA_GREEN_GATE; + // Blue gate + case BG_SA_EVENT_BLUE_GATE_DAMAGED: + case BG_SA_EVENT_BLUE_GATE_DESTROYED: + return BG_SA_BLUE_GATE; + // Red gate + case BG_SA_EVENT_RED_GATE_DAMAGED: + case BG_SA_EVENT_RED_GATE_DESTROYED: + return BG_SA_RED_GATE; + // Purple gate + case BG_SA_EVENT_PURPLE_GATE_DAMAGED: + case BG_SA_EVENT_PURPLE_GATE_DESTROYED: + return BG_SA_PURPLE_GATE; + // Yellow gate + case BG_SA_EVENT_YELLOW_GATE_DAMAGED: + case BG_SA_EVENT_YELLOW_GATE_DESTROYED: + return BG_SA_YELLOW_GATE; + // Ancient gate + case BG_SA_EVENT_ANCIENT_GATE_DAMAGED: + case BG_SA_EVENT_ANCIENT_GATE_DESTROYED: + return BG_SA_ANCIENT_GATE; + default: + break; } - return i; + return 0; } /// Return worldstate id, according to door id - uint32 GetWorldStateFromGateID(uint32 id) + uint32 getWorldStateFromGateId(uint32 id) { - uint32 uws = 0; switch (id) { - case BG_SA_GREEN_GATE: uws = BG_SA_GREEN_GATEWS; break; - case BG_SA_YELLOW_GATE: uws = BG_SA_YELLOW_GATEWS; break; - case BG_SA_BLUE_GATE: uws = BG_SA_BLUE_GATEWS; break; - case BG_SA_RED_GATE: uws = BG_SA_RED_GATEWS; break; - case BG_SA_PURPLE_GATE: uws = BG_SA_PURPLE_GATEWS; break; - case BG_SA_ANCIENT_GATE: uws = BG_SA_ANCIENT_GATEWS; break; + case BG_SA_GREEN_GATE: + return BG_SA_GREEN_GATEWS; + case BG_SA_YELLOW_GATE: + return BG_SA_YELLOW_GATEWS; + case BG_SA_BLUE_GATE: + return BG_SA_BLUE_GATEWS; + case BG_SA_RED_GATE: + return BG_SA_RED_GATEWS; + case BG_SA_PURPLE_GATE: + return BG_SA_PURPLE_GATEWS; + case BG_SA_ANCIENT_GATE: + return BG_SA_ANCIENT_GATEWS; + default: + break; } - return uws; + return 0; } /// Called on battleground ending -- cgit v1.2.3 From 0a82c93a974226e3a1dfcb600ceaac0dd7c41a26 Mon Sep 17 00:00:00 2001 From: Frca Date: Sun, 22 Apr 2012 19:24:44 +0200 Subject: Codestyle Signed-off-by: Frca --- src/server/game/Handlers/MovementHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 6c0365a05e9..b3d663e1850 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 - const WorldLocation loc = GetPlayer()->GetTeleportDest(); + WorldLocation const loc = GetPlayer()->GetTeleportDest(); // possible errors in the coordinate validity check if (!MapManager::IsValidMapCoord(loc)) -- cgit v1.2.3 From ccda7c8a408e6800a161162fa5c4014265a1125e Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 22 Apr 2012 20:29:47 +0200 Subject: Core/Shaman: Fix Earthen Power --- .../2012_04_22_01_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_shaman.cpp | 56 ++++++++++++++++++---- 2 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 sql/updates/world/2012_04_22_01_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_22_01_world_spell_script_names.sql b/sql/updates/world/2012_04_22_01_world_spell_script_names.sql new file mode 100644 index 00000000000..bd4becdc3f4 --- /dev/null +++ b/sql/updates/world/2012_04_22_01_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=59566; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(59566,'spell_sha_earthen_power'); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 84e3bd8d604..f16f663ae2d 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -215,13 +215,12 @@ class spell_sha_earthbind_totem : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* aurEff) { - if (Unit* target = GetTarget()) - if (Unit* caster = aurEff->GetBase()->GetCaster()) - if (TempSummon* summon = caster->ToTempSummon()) - if (Unit* owner = summon->GetOwner()) - if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) - if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) - caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff); + if (!GetCaster()) + return; + if (Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) + if (roll_chance_i(aur->GetBaseAmount())) + GetTarget()->CastSpell((Unit*)NULL, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true); } void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -252,6 +251,46 @@ class spell_sha_earthbind_totem : public SpellScriptLoader } }; +class EarthenPowerTargetSelector +{ + public: + EarthenPowerTargetSelector() { } + + bool operator() (Unit* target) + { + if (!target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) + return true; + + return false; + } +}; + +class spell_sha_earthen_power : public SpellScriptLoader +{ + public: + spell_sha_earthen_power() : SpellScriptLoader("spell_sha_earthen_power") { } + + class spell_sha_earthen_power_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_earthen_power_SpellScript); + + void FilterTargets(std::list& unitList) + { + unitList.remove_if(EarthenPowerTargetSelector()); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_earthen_power_SpellScript(); + } +}; + class spell_sha_bloodlust : public SpellScriptLoader { public: @@ -270,7 +309,7 @@ class spell_sha_bloodlust : public SpellScriptLoader void RemoveInvalidTargets(std::list& targets) { - targets.remove_if (Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); + targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); } void ApplyDebuff() @@ -617,6 +656,7 @@ void AddSC_shaman_spell_scripts() new spell_sha_fire_nova(); new spell_sha_mana_tide_totem(); new spell_sha_earthbind_totem(); + new spell_sha_earthen_power(); new spell_sha_bloodlust(); new spell_sha_heroism(); new spell_sha_ancestral_awakening_proc(); -- cgit v1.2.3 From 1cbcbe5ba1b51d2117b3f21cef93ab20d98b3ce4 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 23 Apr 2012 11:45:22 -0400 Subject: Core/Battleground: correct checking for which flag was on the ground. fixes issue with not being able to pick up flags --- src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 495178f18dd..d100dc645a2 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -476,7 +476,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //Alliance flag on ground(not in base) (returned or picked up again from ground!) - if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) + if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY) { if (Source->GetTeam() == ALLIANCE) { @@ -510,7 +510,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //Horde flag on ground(not in base) (returned or picked up again) - if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) + if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY) { if (Source->GetTeam() == HORDE) { -- cgit v1.2.3 From a9ad4099ec99d2ba3eefc2ff393b3d32d0fcaccb Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 23 Apr 2012 18:10:18 +0200 Subject: Scripts/Icecrown Citadel * Sister Svalna will now fly and land properly * Fixed visuals in Blood Prince Council fight * Flying triggers will now fly properly --- .../world/2012_04_23_00_world_creatures.sql | 12 ++++ .../IcecrownCitadel/boss_blood_prince_council.cpp | 65 +++++++--------------- .../IcecrownCitadel/boss_professor_putricide.cpp | 2 +- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 2 + .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 14 +++-- 5 files changed, 44 insertions(+), 51 deletions(-) create mode 100644 sql/updates/world/2012_04_23_00_world_creatures.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_23_00_world_creatures.sql b/sql/updates/world/2012_04_23_00_world_creatures.sql new file mode 100644 index 00000000000..3730fabf552 --- /dev/null +++ b/sql/updates/world/2012_04_23_00_world_creatures.sql @@ -0,0 +1,12 @@ +UPDATE `creature_template` SET `flags_extra`=0x82,`ModelId1`=1126,`ModelId2`=16925 WHERE `entry` IN (38008,38641,38773,38774); -- Blood Orb Controller +UPDATE `creature_template` SET `flags_extra`=0x80,`ModelId1`=19725,`ModelId2`=31095,`baseattacktime`=2000,`speed_walk`=0.8,`speed_run`=0.28571 WHERE `entry` IN (38454,38775,38776,38777); -- Kinetic Bomb +UPDATE `creature_template` SET `exp`=2,`baseattacktime`=2000,`ModelId1`=19725,`ModelId2`=21342 WHERE `entry`=38458; -- Kinetic Bomb Target +UPDATE `creature_template` SET `baseattacktime`=2000,`speed_walk`=4.4,`ModelId1`=19725,`ModelId2`=26767 WHERE `entry` IN (38332,38451); -- Ball of Flame +UPDATE `creature_template` SET `flags_extra`=0x80 WHERE `entry`=37950; -- Valithria Dreamwalker +UPDATE `creature_template` SET `InhabitType`=4 WHERE `InhabitType`&4 AND `flags_extra`&0x80; -- make flying triggers fly +UPDATE `creature_template` SET `InhabitType`=4,`HoverHeight`=12 WHERE `entry`=37126; -- Sister Svalna +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=37950; -- Valithria Dreamwalker +UPDATE `creature_model_info` SET `bounding_radius`=1,`combat_reach`=0,`gender`=0 WHERE `modelid`=31095; -- Kinetic Bomb +UPDATE `creature_model_info` SET `bounding_radius`=0.5,`combat_reach`=1,`gender`=0 WHERE `modelid`=21342; -- Kinetic Bomb Target +UPDATE `creature_model_info` SET `bounding_radius`=0.5,`combat_reach`=1,`gender`=0 WHERE `modelid`=26767; -- Ball of Flame +UPDATE `creature_template_addon` SET `bytes1`=50331648,`bytes2`=1,`mount`=0,`emote`=0,`auras`=NULL WHERE `entry`=38454; -- Kinetic Bomb diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index de104a78e43..8090fc98101 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -103,6 +103,7 @@ enum Spells SPELL_UNSTABLE = 72059, SPELL_KINETIC_BOMB_VISUAL = 72054, SPELL_KINETIC_BOMB_EXPLOSION = 72052, + SPELL_KINETIC_BOMB_KNOCKBACK = 72087, // Shock Vortex SPELL_SHOCK_VORTEX_PERIODIC = 71945, @@ -443,20 +444,12 @@ class boss_prince_keleseth_icc : public CreatureScript { summons.Summon(summon); Position pos; - pos.Relocate(summon); + me->GetPosition(&pos); float maxRange = me->GetDistance2d(summon); float angle = me->GetAngle(summon); - // prevent spawning outside of room - while (!me->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ())) - { - maxRange -= 5.0f; - if (maxRange < 5.0f) - break; - - summon->MovePosition(pos, float(rand_norm() * maxRange), angle); - } - + me->MovePositionToFirstCollision(pos, maxRange, angle); summon->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); + summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); } void DamageDealt(Unit* /*target*/, uint32& damage, DamageEffectType damageType) @@ -894,6 +887,7 @@ class boss_prince_valanar_icc : public CreatureScript summon->GetPosition(x, y, z); float ground_Z = summon->GetMap()->GetHeight(summon->GetPhaseMask(), x, y, z, true, 500.0f); summon->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, x, y, ground_Z); + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); break; } case NPC_SHOCK_VORTEX: @@ -1073,7 +1067,7 @@ class npc_blood_queen_lana_thel : public CreatureScript if (_introDone) return; - if (!me->IsWithinDistInMap(who, 35.0f)) + if (!me->IsWithinDistInMap(who, 35.0f, false)) return; _introDone = true; @@ -1232,12 +1226,12 @@ class npc_kinetic_bomb : public CreatureScript void Reset() { _events.Reset(); - me->SetDisplayId(DISPLAY_KINETIC_BOMB); + me->SetWalk(true); me->CastSpell(me, SPELL_UNSTABLE, true); me->CastSpell(me, SPELL_KINETIC_BOMB_VISUAL, true); me->SetReactState(REACT_PASSIVE); - me->SetSpeed(MOVE_FLIGHT, IsHeroic() ? 0.3f : 0.15f, true); me->GetPosition(_x, _y, _groundZ); + me->DespawnOrUnsummon(60000); _groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f); } @@ -1247,9 +1241,9 @@ class npc_kinetic_bomb : public CreatureScript _events.ScheduleEvent(EVENT_BOMB_DESPAWN, 1000); else if (action == ACTION_KINETIC_BOMB_JUMP) { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveJump(_x, _y, me->GetPositionZ() + 7.0f, 1.0f, 7.0f); - _events.ScheduleEvent(EVENT_CONTINUE_FALLING, 700); + if (!me->HasAura(SPELL_KINETIC_BOMB_KNOCKBACK)) + me->GetMotionMaster()->MoveCharge(_x, _y, me->GetPositionZ() + 100.0f, me->GetSpeed(MOVE_RUN), 0); + _events.RescheduleEvent(EVENT_CONTINUE_FALLING, 3000); } } @@ -1263,10 +1257,10 @@ class npc_kinetic_bomb : public CreatureScript { case EVENT_BOMB_DESPAWN: me->SetVisible(false); + me->DespawnOrUnsummon(5000); break; case EVENT_CONTINUE_FALLING: - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, _x, _y, _groundZ); + me->GetMotionMaster()->MoveCharge(_x, _y, _groundZ, me->GetSpeed(MOVE_WALK), POINT_KINETIC_BOMB_IMPACT); break; default: break; @@ -1329,17 +1323,16 @@ class npc_dark_nucleus : public CreatureScript void DamageTaken(Unit* attacker, uint32& /*damage*/) { - if (attacker == me) + if (attacker == me || attacker == me->getVictim()) return; - if (!_lockedTarget) - if (me->getVictim() == attacker) - _lockedTarget = true; + me->DeleteThreatList(); + me->AddThreat(attacker, 500000000.0f); } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { - if (!me->isInCombat()) + if (!UpdateVictim()) return; if (_targetAuraCheck <= diff) @@ -1355,23 +1348,6 @@ class npc_dark_nucleus : public CreatureScript } else _targetAuraCheck -= diff; - - if (!_lockedTarget) - { - if (Unit* victim = me->SelectVictim()) - { - if (me->getVictim() && me->getVictim() != victim) - { - me->getVictim()->RemoveAurasDueToSpell(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID()); - _lockedTarget = true; - } - - _lockedTarget = true; - AttackStart(victim); - DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST); - me->ClearUnitState(UNIT_STATE_CASTING); - } - } } private: @@ -1525,6 +1501,7 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader Position offset = {0.0f, 0.0f, 20.0f, 0.0f}; summonPos.RelocateOffset(offset); SetTargetDest(summonPos); + GetHitDest()->RelocateOffset(offset); } void Register() @@ -1586,7 +1563,7 @@ class spell_valanar_kinetic_bomb_knockback : public SpellScriptLoader void Register() { - AfterHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir); + BeforeHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir); } }; @@ -1663,7 +1640,7 @@ class spell_blood_council_shadow_prison_damage : public SpellScriptLoader void AddExtraDamage() { if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id)) - if (AuraEffect const* eff = aur->GetEffect(1)) + if (AuraEffect const* eff = aur->GetEffect(EFFECT_1)) SetHitDamage(GetHitDamage() + eff->GetAmount()); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 273f2a20b4b..c043cb27c7c 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -544,7 +544,7 @@ class boss_professor_putricide : public CreatureScript void UpdateAI(uint32 const diff) { - if ((!UpdateVictim() && !(events.GetPhaseMask() & PHASE_MASK_NOT_SELF)) || !CheckInRoom()) + if ((!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF) && !UpdateVictim()) || !CheckInRoom()) return; events.Update(diff); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index ab924d1b543..ebf9ae02a95 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -713,6 +713,7 @@ class npc_spinestalker : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetHomePosition(SpinestalkerLandPos); + me->SetFacingTo(SpinestalkerLandPos.GetOrientation()); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -839,6 +840,7 @@ class npc_rimefang : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetHomePosition(RimefangLandPos); + me->SetFacingTo(RimefangLandPos.GetOrientation()); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index c99fde1739c..8d562a23f67 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -796,7 +796,8 @@ class boss_sister_svalna : public CreatureScript { _JustReachedHome(); me->SetReactState(REACT_PASSIVE); - me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); } void DoAction(int32 const action) @@ -838,13 +839,14 @@ class boss_sister_svalna : public CreatureScript void MovementInform(uint32 type, uint32 id) { - if (type != POINT_MOTION_TYPE || id != POINT_LAND) + if (type != EFFECT_MOTION_TYPE || id != POINT_LAND) return; _isEventInProgress = false; me->setActive(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); } void SpellHitTarget(Unit* target, SpellInfo const* spell) @@ -1921,10 +1923,10 @@ class spell_svalna_revive_champion : public SpellScriptLoader Position pos; caster->GetPosition(&pos); caster->GetNearPosition(pos, 5.0f, 0.0f); - pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 20.0f); - pos.m_positionZ += 0.05f; + //pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f); + //pos.m_positionZ += 0.05f; caster->SetHomePosition(pos); - caster->GetMotionMaster()->MovePoint(POINT_LAND, pos); + caster->GetMotionMaster()->MoveLand(POINT_LAND, pos, caster->GetSpeed(MOVE_FLIGHT)); } void Register() -- cgit v1.2.3 From 5da5021464c649d84c755a921eae43519eba8567 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 23 Apr 2012 13:42:54 -0400 Subject: Core/Spells: fix rocket boots extreme (+lite) spell cooldown issue. --- src/server/scripts/Spells/spell_item.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 666477e68e7..73a77b06408 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1744,6 +1744,7 @@ class spell_item_rocket_boots : public SpellScriptLoader if (Battleground* bg = caster->GetBattleground()) bg->EventPlayerDroppedFlag(caster); + caster->RemoveSpellCooldown(SPELL_ROCKET_BOOTS_PROC); caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL); } -- cgit v1.2.3 From b07341f998bb9305707f300f52bfce5515d555a5 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 23 Apr 2012 14:35:12 -0400 Subject: Core/Spells: Fix spell cast of greatmother's soulcatcher. closes #1882 --- .../world/2012_04_23_01_world_conditions.sql | 5 ++++ src/server/scripts/Spells/spell_item.cpp | 31 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 sql/updates/world/2012_04_23_01_world_conditions.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_23_01_world_conditions.sql b/sql/updates/world/2012_04_23_01_world_conditions.sql new file mode 100644 index 00000000000..c731426aa3f --- /dev/null +++ b/sql/updates/world/2012_04_23_01_world_conditions.sql @@ -0,0 +1,5 @@ +-- setup alternate conditions for spell 46488 +DELETE FROM `conditions` WHERE `SourceEntry` = 46488 AND `ElseGroup` = 1; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,46488,0,1,31,1,3,26817,0,0,0,'',''), +(13,1,46488,0,1,36,1,0,0,0,1,0,'',''); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 73a77b06408..3c5d6438275 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -2021,6 +2021,37 @@ class spell_item_muisek_vessel : public SpellScriptLoader } }; +enum GreatmothersSoulcather +{ + SPELL_FORCE_CAST_SUMMON_GNOME_SOUL = 46486, +}; +class spell_item_greatmothers_soulcatcher : public SpellScriptLoader +{ +public: + spell_item_greatmothers_soulcatcher() : SpellScriptLoader("spell_item_greatmothers_soulcatcher") { } + + class spell_item_greatmothers_soulcatcher_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_greatmothers_soulcatcher_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(GetCaster(),SPELL_FORCE_CAST_SUMMON_GNOME_SOUL); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_greatmothers_soulcatcher_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_greatmothers_soulcatcher_SpellScript(); + } +}; + void AddSC_item_spell_scripts() { // 23074 Arcanite Dragonling -- cgit v1.2.3 From 1851a2e9e3a44d997488adaee43ac274476baef8 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 24 Apr 2012 16:53:37 +0200 Subject: Scripts: Replaced calls to ForcedDespawn with DespawnOrUnsummon (calls appropriate AI hooks in case of temporary summons) and made ForcedDespawn private --- src/server/game/Entities/Creature/Creature.cpp | 2 +- src/server/game/Entities/Creature/Creature.h | 3 ++- src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp | 4 ++-- src/server/scripts/Kalimdor/bloodmyst_isle.cpp | 2 +- src/server/scripts/Kalimdor/durotar.cpp | 4 ++-- src/server/scripts/Kalimdor/dustwallow_marsh.cpp | 2 +- .../Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp | 4 ++-- .../scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp | 2 +- src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp | 4 ++-- src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp | 10 +++++----- src/server/scripts/Northrend/borean_tundra.cpp | 2 +- src/server/scripts/Northrend/storm_peaks.cpp | 6 +++--- src/server/scripts/Outland/blades_edge_mountains.cpp | 2 +- src/server/scripts/Outland/nagrand.cpp | 4 ++-- src/server/scripts/Outland/netherstorm.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 2 +- src/server/scripts/Spells/spell_quest.cpp | 2 +- src/server/scripts/World/go_scripts.cpp | 6 +++--- 18 files changed, 32 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index ed89041ff66..fde85feb8d9 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -135,7 +135,7 @@ CreatureBaseStats const* CreatureBaseStats::GetBaseStats(uint8 level, uint8 unit bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - m_owner.ForcedDespawn(); + m_owner.DespawnOrUnsummon(); // since we are here, we are not TempSummon as object type cannot change during runtime return true; } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index f6d03ca38b2..f6021a7d7ec 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -635,7 +635,6 @@ class Creature : public Unit, public GridObject, public MapCreature void RemoveCorpse(bool setSpawnTime = true); - void ForcedDespawn(uint32 timeMSToDespawn = 0); void DespawnOrUnsummon(uint32 msTimeToDespawn = 0); time_t const& GetRespawnTime() const { return m_respawnTime; } @@ -763,6 +762,8 @@ class Creature : public Unit, public GridObject, public MapCreature bool IsInvisibleDueToDespawn() const; bool CanAlwaysSee(WorldObject const* obj) const; private: + void ForcedDespawn(uint32 timeMSToDespawn = 0); + //WaypointMovementGenerator vars uint32 m_waypointID; uint32 m_path_id; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 37808e2b924..bf887bec164 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -664,7 +664,7 @@ public: { CAST_PLR(charmer)->GroupEventHappens(12687, me); charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE); - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); //CAST_CRE(who)->Respawn(true); } @@ -767,7 +767,7 @@ public: //Todo: Creatures must not be removed, but, must instead // stand next to Gothik and be commanded into the pit // and dig into the ground. - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) owner->RemoveAllMinionsByEntry(GHOULS); diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp index ffc2fb3fb61..6c692a6738b 100644 --- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp @@ -193,7 +193,7 @@ public: if (type == POINT_MOTION_TYPE && id == 1) { DoScriptText(SAY_DIRECTION, me); - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } } }; diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index 88bc3352ea1..fe5bedf4c98 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -264,7 +264,7 @@ class npc_tiger_matriarch : public CreatureScript vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER); vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER); } - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } void DamageTaken(Unit* attacker, uint32& damage) @@ -287,7 +287,7 @@ class npc_tiger_matriarch : public CreatureScript vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER); } - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } } diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 4a1b67ba477..cbacc4fdf66 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -847,7 +847,7 @@ public: player->KilledMonsterCredit(NPC_THERAMORE_PRISONER, 0); prisoner->AI()->Talk(SAY_FREE); // We also emote cry here (handled in creature_text.emote) - prisoner->ForcedDespawn(6000); + prisoner->DespawnOrUnsummon(6000); } return true; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index ed1ca4d20fb..c40a521c794 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -262,7 +262,7 @@ class ValithriaDespawner : public BasicEvent if (CreatureData const* data = creature->GetCreatureData()) creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); - creature->ForcedDespawn(); + creature->DespawnOrUnsummon(); creature->SetCorpseDelay(corpseDelay); creature->SetRespawnDelay(respawnDelay); @@ -1087,7 +1087,7 @@ class npc_dream_cloud : public CreatureScript me->GetMotionMaster()->MoveIdle(); // must use originalCaster the same for all clouds to allow stacking me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); - me->ForcedDespawn(100); + me->DespawnOrUnsummon(100); break; default: break; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 8d562a23f67..5b208768b0c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -346,7 +346,7 @@ class FrostwingGauntletRespawner if (CreatureData const* data = creature->GetCreatureData()) creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); - creature->ForcedDespawn(); + creature->DespawnOrUnsummon(); creature->SetCorpseDelay(corpseDelay); creature->SetRespawnDelay(respawnDelay); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index 6c2c08f07a0..472ff153d73 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -298,14 +298,14 @@ class npc_auriaya_seeping_trigger : public CreatureScript void Reset() { - me->ForcedDespawn(600000); + me->DespawnOrUnsummon(600000); DoCast(me, SPELL_SEEPING_ESSENCE); } void UpdateAI(uint32 const /*diff*/) { if (instance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS) - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } private: diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 4ea38a7642d..a3c9cb847e5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -507,7 +507,7 @@ class boss_freya : public CreatureScript for (uint8 n = 0; n < 3; ++n) { summons.remove(Elemental[n][i]->GetGUID()); - Elemental[n][i]->ForcedDespawn(5000); + Elemental[n][i]->DespawnOrUnsummon(5000); trioDefeated[i] = true; Elemental[n][i]->CastSpell(me, SPELL_REMOVE_10STACK, true); } @@ -664,12 +664,12 @@ class boss_freya : public CreatureScript case NPC_DETONATING_LASHER: summoned->CastSpell(me, SPELL_REMOVE_2STACK, true); summoned->CastSpell(who, SPELL_DETONATE, true); - summoned->ForcedDespawn(5000); + summoned->DespawnOrUnsummon(5000); summons.remove(summoned->GetGUID()); break; case NPC_ANCIENT_CONSERVATOR: summoned->CastSpell(me, SPELL_REMOVE_25STACK, true); - summoned->ForcedDespawn(5000); + summoned->DespawnOrUnsummon(5000); summons.remove(summoned->GetGUID()); break; } @@ -1385,7 +1385,7 @@ class npc_healthy_spore : public CreatureScript if (lifeTimer <= diff) { me->RemoveAurasDueToSpell(SPELL_GROW); - me->ForcedDespawn(2200); + me->DespawnOrUnsummon(2200); lifeTimer = urand(22000, 30000); } else @@ -1423,7 +1423,7 @@ class npc_eonars_gift : public CreatureScript { me->RemoveAurasDueToSpell(SPELL_GROW); DoCast(SPELL_LIFEBINDERS_GIFT); - me->ForcedDespawn(2500); + me->DespawnOrUnsummon(2500); lifeBindersGiftTimer = 12000; } else diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index f83538b344c..8b51618eedd 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -186,7 +186,7 @@ public: if (owner->GetTypeId() == TYPEID_PLAYER) { owner->CastSpell(owner, 46231, true); - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); } } } diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 251bdb8278a..15239e9f836 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -550,7 +550,7 @@ public: // drake unsummoned, passengers dropped if (!me->IsOnVehicle(drake) && !hasEmptySeats) - me->ForcedDespawn(3000); + me->DespawnOrUnsummon(3000); if (enter_timer <= 0) return; @@ -605,7 +605,7 @@ public: me->ExitVehicle(); me->CastSpell(me, SPELL_SUMMON_LIBERATED, true); - me->ForcedDespawn(500); + me->DespawnOrUnsummon(500); // drake is empty now, deliver credit for drake and despawn him if (drake->GetVehicleKit()->HasEmptySeat(1) && @@ -616,7 +616,7 @@ public: if (rider->ToPlayer()) rider->ToPlayer()->KilledMonsterCredit(29709, 0); - drake->ForcedDespawn(0); + drake->DespawnOrUnsummon(0); } } } diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index 7a371170d7d..cf0955ed89c 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -855,7 +855,7 @@ class npc_simon_bunny : public CreatureScript if (GameObject* relic = me->FindNearestGameObject(large ? GO_APEXIS_MONUMENT : GO_APEXIS_RELIC, searchDistance)) relic->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - me->ForcedDespawn(1000); + me->DespawnOrUnsummon(1000); } /* diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index 8080a1402af..871a2f200bb 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -450,7 +450,7 @@ public: { if (Say_Timer <= diff) { - me->ForcedDespawn(); + me->DespawnOrUnsummon(); ReleasedFromCage = false; } else @@ -689,7 +689,7 @@ class go_warmaul_prison : public GameObjectScript player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0); prisoner->AI()->Talk(SAY_FREE, player->GetGUID()); - prisoner->ForcedDespawn(6000); + prisoner->DespawnOrUnsummon(6000); } return true; } diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 388d18697b9..afc18c71b92 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -1057,7 +1057,7 @@ class go_captain_tyralius_prison : public GameObjectScript player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS, 0); tyralius->AI()->Talk(SAY_FREE); - tyralius->ForcedDespawn(8000); + tyralius->DespawnOrUnsummon(8000); } return true; } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 3c5d6438275..300e54ab027 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -2006,7 +2006,7 @@ class spell_item_muisek_vessel : public SpellScriptLoader { if (Creature* target = GetHitCreature()) if (target->isDead()) - target->ForcedDespawn(); + target->DespawnOrUnsummon(); } void Register() diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 48faf83cd2f..06678407b93 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -837,7 +837,7 @@ class spell_q12659_ahunaes_knife : public SpellScriptLoader Player* caster = GetCaster()->ToPlayer(); if (Creature* target = GetHitCreature()) { - target->ForcedDespawn(); + target->DespawnOrUnsummon(); caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0); } } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 60ddf8990a7..790a9d0f814 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1174,7 +1174,7 @@ class go_gjalerbron_cage : public GameObjectScript player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, 0); prisoner->AI()->Talk(SAY_FREE); - prisoner->ForcedDespawn(6000); + prisoner->DespawnOrUnsummon(6000); } } return true; @@ -1201,7 +1201,7 @@ class go_large_gjalerbron_cage : public GameObjectScript { go->UseDoorOrButton(); player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, (*itr)->GetGUID()); - (*itr)->ForcedDespawn(6000); + (*itr)->DespawnOrUnsummon(6000); (*itr)->AI()->Talk(SAY_FREE); } } @@ -1235,7 +1235,7 @@ class go_veil_skith_cage : public GameObjectScript { go->UseDoorOrButton(); player->KilledMonsterCredit(NPC_CAPTIVE_CHILD, (*itr)->GetGUID()); - (*itr)->ForcedDespawn(5000); + (*itr)->DespawnOrUnsummon(5000); (*itr)->GetMotionMaster()->MovePoint(1, go->GetPositionX()+5, go->GetPositionY(), go->GetPositionZ()); (*itr)->AI()->Talk(SAY_FREE_0); (*itr)->GetMotionMaster()->Clear(); -- cgit v1.2.3 From 05bb8e4fcd47b3d127de73927701fd2d5aa3e752 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 24 Apr 2012 17:19:41 +0200 Subject: Core/Vehicles: Fixed creature passengers falling off vehicles at client side --- src/server/game/Entities/Vehicle/Vehicle.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 4ce05ff40d3..c297ce1e792 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -285,9 +285,6 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ // return; // Something went wrong in the spellsystem //} - // This is not good, we have to send update twice - accessory->SendMovementFlagUpdate(); - if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnInstallAccessory(this, accessory); } @@ -352,6 +349,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) unit->m_movementInfo.t_pos.m_orientation = 0; unit->m_movementInfo.t_time = 0; // 1 for player unit->m_movementInfo.t_seat = seat->first; + unit->m_movementInfo.t_guid = _me->GetGUID(); if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER -- cgit v1.2.3 From 61bc8e1c6f82558b3cb1f441ffad1d40dca198a9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 24 Apr 2012 11:59:08 -0400 Subject: Core/Spells: added function to initiation script. DB/SAI: added rest of quest to database for Greatmother's Soulcatcher --- sql/updates/world/2012_04_24_06_world_misc.sql | 31 ++++++++++++++++++++++++++ src/server/scripts/Spells/spell_item.cpp | 1 + 2 files changed, 32 insertions(+) create mode 100644 sql/updates/world/2012_04_24_06_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_24_06_world_misc.sql b/sql/updates/world/2012_04_24_06_world_misc.sql new file mode 100644 index 00000000000..2e095a76cd9 --- /dev/null +++ b/sql/updates/world/2012_04_24_06_world_misc.sql @@ -0,0 +1,31 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = 46485; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(46485,'spell_item_greatmothers_soulcatcher'); + +DELETE FROM `conditions` WHERE `SourceEntry` IN (46485,46488); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,46485,0,1,31,1,3,26817,0,0,0,'',''), +(13,1,46485,0,1,36,1,0,0,0,1,0,'',''), +(13,1,46488,0,1,31,1,3,26817,0,0,0,'',''), +(13,1,46488,0,1,36,1,0,0,0,1,0,'',''); + +-- Gnome Soul SAI +SET @ENTRY := 26096; +SET @SPELL_ARCANE_EXPLOSION := 35426; +UPDATE creature_template SET AIName="SmartAI" WHERE entry=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,1,54,0,100,0,0,0,0,0,33,@ENTRY,0,0,0,0,0,7,0,0,0,0,0,0,0,"Gnome Soul - On Just Summoned - Quest Credit"), +(@ENTRY,0,1,2,61,0,100,0,0,0,0,0,45,1,1,0,0,0,0,19,25814,10,1,0,0,0,0,"Gnome Soul - On Just Summoned - Set Data Fizzcrank Mechagnome"), +(@ENTRY,0,2,0,61,0,100,0,0,0,0,0,69,1,0,0,0,0,0,7,0,0,0,0,0,0,0,"Gnome Soul - On Just Summoned - Move to Summoner"), + +(@ENTRY,0,3,4,34,0,100,0,1,0,0,0,11,@SPELL_ARCANE_EXPLOSION,0,0,0,0,0,1,0,0,0,0,0,0,0,"Gnome Soul - Reached Summoner - Cast Arcane Explosion Visual"), +(@ENTRY,0,4,0,61,0,100,0,0,0,0,0,41,1000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Gnome Soul - Reached Summoner - Forced Despawn"); + +-- Fizzcrank Mechagnome SAI +SET @ENTRY := 25814; +UPDATE creature_template SET AIName="SmartAI" WHERE entry=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,4,0,100,0,0,0,0,0,1,1,10000,0,0,0,0,0,0,0,0,0,0,0,0,"Fizzcrank Mechagnome - Chance Say on Aggro"), +(@ENTRY,1,0,0,38,0,100,0,1,1,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Fizzcrank Mechagnome - On Data Set - Forced Despawn"); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 300e54ab027..eb2d3187636 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -2104,4 +2104,5 @@ void AddSC_item_spell_scripts() new spell_item_uded(); new spell_item_chicken_cover(); new spell_item_muisek_vessel(); + new spell_item_greatmothers_soulcatcher(); } -- cgit v1.2.3 From 9320131892f4458f506a87f7976c5b60fb9ce4e0 Mon Sep 17 00:00:00 2001 From: The Game Date: Tue, 24 Apr 2012 13:11:22 -0400 Subject: Check if unit has UNIT_DYNFLAG_TRACK_UNIT before checking auras to prevent prevent unnecessary operations, thanks you QAston for suggesting. --- src/server/game/Entities/Object/Object.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 8bf22c8b7a0..e26bc0a6ea1 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -626,9 +626,10 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* if (!target->isAllowedToLoot(creature)) dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE; } - if (Unit const* unit = ToUnit()) - if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) - dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; + if(dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT) + if (Unit const* unit = ToUnit()) + if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) + dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; *data << dynamicFlags; } // FG: pretend that OTHER players in own group are friendly ("blue") -- cgit v1.2.3 From 2e9196162e6c17972b7b863dddf3acacd79eb624 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 24 Apr 2012 13:26:17 -0400 Subject: Core/Spells: Fix wrong target in Bloodthirst spell script. Closes #3359 --- src/server/scripts/Spells/spell_warrior.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 3e4c043ae47..3b683eb5795 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -397,8 +397,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { int32 damage = GetEffectValue(); - if (GetHitUnit()) - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL); + GetCaster()->CastCustomSpell(GetCaster(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL); } void Register() -- cgit v1.2.3 From e6a6f6539d59357c617b2679e9123d0a05954e6b Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 24 Apr 2012 13:39:37 -0400 Subject: Core/Spells: Correct tick damage for health funnel. (thx alp22) Closes #3465 --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index dbbd89c7533..31a8e57825c 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1616,7 +1616,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const { // Use the new aura to see on what stance the target will be uint32 newStance = (1<<((newAura ? newAura->GetMiscValue() : 0)-1)); - + // If the stances are not compatible with the spell, remove it if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance)) target->RemoveAura(itr); @@ -6473,7 +6473,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const // damage caster for heal amount if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL) { - uint32 funnelDamage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power + uint32 funnelDamage = GetSpellInfo()->ManaPerSecond; // damage is not affected by spell power if ((int32)funnelDamage > gain) funnelDamage = gain; uint32 funnelAbsorb = 0; -- cgit v1.2.3 From 5878a790db5d6a0a8acb8cdac656632bf53e3a10 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 25 Apr 2012 09:02:09 -0400 Subject: Core/Spells: Fix prayer of mending bonus from t9 healing 2 piece set. Closes #4069 --- .../2012_04_25_01_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_priest.cpp | 47 ++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/2012_04_25_01_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_25_01_world_spell_script_names.sql b/sql/updates/world/2012_04_25_01_world_spell_script_names.sql new file mode 100644 index 00000000000..e42f1979229 --- /dev/null +++ b/sql/updates/world/2012_04_25_01_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = 33110; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(33110,'spell_pri_prayer_of_mending_heal'); \ No newline at end of file diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index d2bba2b8bc3..2ef782d6dcf 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -291,12 +291,53 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader } }; +enum PrayerOfMending +{ + SPELL_T9_HEALING_2_PIECE = 67201, +}; +// Prayer of Mending Heal +class spell_pri_prayer_of_mending_heal : public SpellScriptLoader +{ +public: + spell_pri_prayer_of_mending_heal() : SpellScriptLoader("spell_pri_prayer_of_mending_heal") { } + + class spell_pri_prayer_of_mending_heal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pri_prayer_of_mending_heal_SpellScript); + + void HandleHeal(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetOriginalCaster()) + { + if (Aura* aur = caster->GetAura(SPELL_T9_HEALING_2_PIECE)) + { + int32 heal = GetHitHeal(); + AddPctN(heal, aur->GetSpellInfo()->Effects[0]->CalcValue()); + SetHitHeal(heal); + } + } + + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pri_prayer_of_mending_heal_SpellScript(); + } +}; + void AddSC_priest_spell_scripts() { new spell_pri_guardian_spirit(); - new spell_pri_mana_burn; - new spell_pri_pain_and_suffering_proc; - new spell_pri_penance; + new spell_pri_mana_burn(); + new spell_pri_pain_and_suffering_proc(); + new spell_pri_penance(); new spell_pri_reflective_shield_trigger(); new spell_pri_mind_sear(); + new spell_pri_prayer_of_mending_heal(); } -- cgit v1.2.3 From 0ec4d55ca641bc8c5e117bec28d16255830f53fa Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 25 Apr 2012 09:15:09 -0400 Subject: Core/Spells: Fix build error introduced in previous commit. --- src/server/scripts/Spells/spell_priest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 2ef782d6dcf..65bbd86d5e1 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -312,7 +312,7 @@ public: if (Aura* aur = caster->GetAura(SPELL_T9_HEALING_2_PIECE)) { int32 heal = GetHitHeal(); - AddPctN(heal, aur->GetSpellInfo()->Effects[0]->CalcValue()); + AddPctN(heal, aur->GetSpellInfo()->Effects[0].CalcValue(); SetHitHeal(heal); } } -- cgit v1.2.3 From b528f70639769b131ca1624269aa622b70b5535e Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 25 Apr 2012 09:20:18 -0400 Subject: Core/Spells: get effect value correctly. thx shauren! --- src/server/scripts/Spells/spell_priest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 65bbd86d5e1..5d471afdd2a 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -309,10 +309,10 @@ public: { if (Unit* caster = GetOriginalCaster()) { - if (Aura* aur = caster->GetAura(SPELL_T9_HEALING_2_PIECE)) + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE,EFFECT_0)) { int32 heal = GetHitHeal(); - AddPctN(heal, aur->GetSpellInfo()->Effects[0].CalcValue(); + AddPctN(heal, aurEff->GetAmount()); SetHitHeal(heal); } } -- cgit v1.2.3 From 57866f3465dad99fc2f4f714631fa02b05f9d96c Mon Sep 17 00:00:00 2001 From: Aristoo Date: Wed, 25 Apr 2012 16:38:51 +0300 Subject: Script/Trial of the Crusader: Fix define for Permafrost --- .../CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index c718c0cee5f..f329b940e1f 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -104,7 +104,7 @@ enum BossSpells SPELL_SPIKE_TELE = 66170, }; -#define SPELL_PERMAFROST_HELPER RAID_MODE(66193, 67856, 67855, 67857) +#define SPELL_PERMAFROST_HELPER RAID_MODE(66193, 67855, 67856, 67857) enum SummonActions { -- cgit v1.2.3 From 13b68af78dbc51f44656ecfddb1bfb27dc44a21a Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 25 Apr 2012 13:47:26 -0400 Subject: Core/Spells: Convert some spells from spell_scripts in the db to a generic spellscript. --- .../2012_04_25_02_world_spell_script_names.sql | 12 ++++++ src/server/scripts/Spells/spell_generic.cpp | 43 +++++++++++++++++++--- 2 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 sql/updates/world/2012_04_25_02_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_25_02_world_spell_script_names.sql b/sql/updates/world/2012_04_25_02_world_spell_script_names.sql new file mode 100644 index 00000000000..6d8974664f4 --- /dev/null +++ b/sql/updates/world/2012_04_25_02_world_spell_script_names.sql @@ -0,0 +1,12 @@ +select id from spell_scripts where command = 18 order by id asc; +DELETE FROM `spell_scripts` WHERE `id` IN (15998,25952,29435,45980,51592,51910,52267,54420); +DELETE FROM `spell_script_names` WHERE `spell_id` IN (15998,25952,29435,45980,51592,51910,52267,54420); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(15998, 'spell_gen_despawn_self'), +(25952, 'spell_gen_despawn_self'), +(29435, 'spell_gen_despawn_self'), +(45980, 'spell_gen_despawn_self'), +(51592, 'spell_gen_despawn_self'), +(51910, 'spell_gen_despawn_self'), +(52267, 'spell_gen_despawn_self'), +(54420, 'spell_gen_despawn_self'); \ No newline at end of file diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 2d431331691..f7e895f97f4 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -169,7 +169,7 @@ class spell_gen_burn_brutallus : public SpellScriptLoader } }; -enum eCannibalizeSpells +enum CannibalizeSpells { SPELL_CANNIBALIZE_TRIGGERED = 20578, }; @@ -224,7 +224,7 @@ class spell_gen_cannibalize : public SpellScriptLoader }; // 45472 Parachute -enum eParachuteSpells +enum ParachuteSpells { SPELL_PARACHUTE = 45472, SPELL_PARACHUTE_BUFF = 44795, @@ -365,7 +365,7 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader }; // 66118 Leeching Swarm -enum eLeechingSwarmSpells +enum LeechingSwarmSpells { SPELL_LEECHING_SWARM_DMG = 66240, SPELL_LEECHING_SWARM_HEAL = 66125, @@ -481,7 +481,7 @@ class spell_gen_elune_candle : public SpellScriptLoader }; // 24750 Trick -enum eTrickSpells +enum TrickSpells { SPELL_PIRATE_COSTUME_MALE = 24708, SPELL_PIRATE_COSTUME_FEMALE = 24709, @@ -557,7 +557,7 @@ class spell_gen_trick : public SpellScriptLoader }; // 24751 Trick or Treat -enum eTrickOrTreatSpells +enum TrickOrTreatSpells { SPELL_TRICK = 24714, SPELL_TREAT = 24715, @@ -2656,6 +2656,38 @@ class spell_gen_count_pct_from_max_hp : public SpellScriptLoader int32 _damagePct; }; +class spell_gen_despawn_self : public SpellScriptLoader +{ +public: + spell_gen_despawn_self() : SpellScriptLoader("spell_gen_despawn_self") { } + + class spell_gen_despawn_self_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_despawn_self_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + void HandleDummy(SpellEffIndex effIndex) + { + GetCaster()->ToCreature()->DespawnOrUnsummon(); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT); + + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_despawn_self_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2709,4 +2741,5 @@ void AddSC_generic_spell_scripts() new spell_gen_wg_water(); new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); + new spell_gen_despawn_self(); } -- cgit v1.2.3 From 1b5fa3a6f3cc1ac0ace75a3d0676e7ea044eb0de Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 25 Apr 2012 14:21:56 -0400 Subject: Core/Spells: fix sql file from previous commit and add newline after load function --- sql/updates/world/2012_04_25_02_world_spell_script_names.sql | 1 - src/server/scripts/Spells/spell_generic.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/sql/updates/world/2012_04_25_02_world_spell_script_names.sql b/sql/updates/world/2012_04_25_02_world_spell_script_names.sql index 6d8974664f4..ea6b95559c6 100644 --- a/sql/updates/world/2012_04_25_02_world_spell_script_names.sql +++ b/sql/updates/world/2012_04_25_02_world_spell_script_names.sql @@ -1,4 +1,3 @@ -select id from spell_scripts where command = 18 order by id asc; DELETE FROM `spell_scripts` WHERE `id` IN (15998,25952,29435,45980,51592,51910,52267,54420); DELETE FROM `spell_script_names` WHERE `spell_id` IN (15998,25952,29435,45980,51592,51910,52267,54420); INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index f7e895f97f4..3f75c7d41a9 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2669,6 +2669,7 @@ public: { return GetCaster()->GetTypeId() == TYPEID_UNIT; } + void HandleDummy(SpellEffIndex effIndex) { GetCaster()->ToCreature()->DespawnOrUnsummon(); -- cgit v1.2.3 From aee77546e9a0be3a2d779d92aff7618732737a91 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 26 Apr 2012 09:13:07 -0400 Subject: Core/Spells,DB/Conditions: Fix startup errors associated with bf0d001cd3bc5347fecd92d8fbec2a196d6dcda9 and 13b68af78dbc51f44656ecfddb1bfb27dc44a21a Closes #6346 --- sql/updates/world/2012_04_26_00_world_conditions.sql | 1 + src/server/scripts/Spells/spell_generic.cpp | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 sql/updates/world/2012_04_26_00_world_conditions.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_26_00_world_conditions.sql b/sql/updates/world/2012_04_26_00_world_conditions.sql new file mode 100644 index 00000000000..943fe386085 --- /dev/null +++ b/sql/updates/world/2012_04_26_00_world_conditions.sql @@ -0,0 +1 @@ +UPDATE `conditions` SET `ElseGroup` = 0, `SourceGroup` = 0 WHERE `SourceEntry` IN (46485,46488) AND `ConditionValue2` = 26817; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 3f75c7d41a9..13ea2740abb 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2672,14 +2672,13 @@ public: void HandleDummy(SpellEffIndex effIndex) { - GetCaster()->ToCreature()->DespawnOrUnsummon(); + if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect = SPELL_EFFECT_SCRIPT_EFFECT) + GetCaster()->ToCreature()->DespawnOrUnsummon(); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_DUMMY); - OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT); - + OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY); } }; -- cgit v1.2.3 From 16e367bb84a46bafd4b2a0cb12f1cd54a14cf8d1 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 26 Apr 2012 09:28:48 -0400 Subject: Core/Spells: fix build error with previous commits. --- src/server/scripts/Spells/spell_generic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 13ea2740abb..7fd37ede316 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2672,7 +2672,7 @@ public: void HandleDummy(SpellEffIndex effIndex) { - if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect = SPELL_EFFECT_SCRIPT_EFFECT) + if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT) GetCaster()->ToCreature()->DespawnOrUnsummon(); } -- cgit v1.2.3 From bf7a32b79eb6efd0d7c9f733ca21abf92ca3a9d3 Mon Sep 17 00:00:00 2001 From: Jildor Date: Thu, 26 Apr 2012 15:38:48 +0200 Subject: Scripts/Icecrown Citadel: Fixed Deathbringer Saurfang berserk timer on heroic mode. --- .../scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 249eed01643..e424cd16eaa 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -297,7 +297,7 @@ class boss_deathbringer_saurfang : public CreatureScript Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 30000, 0, PHASE_COMBAT); - events.ScheduleEvent(EVENT_BERSERK, 480000, 0, PHASE_COMBAT); + events.ScheduleEvent(EVENT_BERSERK, IsHeroic() ? 360000 : 480000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_BOILING_BLOOD, 15500, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_BLOOD_NOVA, 17000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, 20000, 0, PHASE_COMBAT); -- cgit v1.2.3 From b5a5080df0ab41e97ecbf71a4cc4341cea3f6323 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 26 Apr 2012 11:15:23 -0400 Subject: Core/Spells: fix penance and holy shock targetting for non faction friendly npcs that appear friendly. should also fix the issue with using mixed groups --- src/server/scripts/Spells/spell_paladin.cpp | 4 ++-- src/server/scripts/Spells/spell_priest.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 9f7f7d847e1..c8c563d3d5d 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -289,8 +289,8 @@ class spell_pal_holy_shock : public SpellScriptLoader { Player* caster = GetCaster()->ToPlayer(); if (GetTargetUnit()) - if (Player* target = GetTargetUnit()->ToPlayer()) - if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target)) + if (Unit* target = GetTargetUnit()) + if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 5d471afdd2a..47cec6ce516 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -228,8 +228,8 @@ class spell_pri_penance : public SpellScriptLoader { Player* caster = GetCaster()->ToPlayer(); if (GetTargetUnit()) - if (Player* target = GetTargetUnit()->ToPlayer()) - if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target)) + if (Unit* target = GetTargetUnit()) + if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } -- cgit v1.2.3 From 51656d7e609a4a079e636c74e5f1cd34d9141742 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 27 Apr 2012 15:38:09 +0200 Subject: Scripts/Icecrown Citadel: Fixed Scent of Blood on heroic mode of Deathbringer Saurfang encounter --- .../world/2012_04_27_00_world_instance_icc.sql | 5 ++++ src/server/game/Spells/SpellEffects.cpp | 8 ++--- src/server/game/Spells/SpellMgr.cpp | 13 ++++++-- .../IcecrownCitadel/boss_deathbringer_saurfang.cpp | 35 +++++++++++++--------- 4 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 sql/updates/world/2012_04_27_00_world_instance_icc.sql (limited to 'src') diff --git a/sql/updates/world/2012_04_27_00_world_instance_icc.sql b/sql/updates/world/2012_04_27_00_world_instance_icc.sql new file mode 100644 index 00000000000..6738e4904ab --- /dev/null +++ b/sql/updates/world/2012_04_27_00_world_instance_icc.sql @@ -0,0 +1,5 @@ +DELETE FROM `creature_text` WHERE `entry`=37813 AND `groupid`=14; +INSERT INTO `creature_text` (`entry`,`groupid`,`text`,`type`,`comment`) VALUES (37813,14,'%s''s Blood Beasts gain the scent of blood!',41,'Deathbringer Saurfang - EMOTE_SCENT_OF_BLOOD'); +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=72771; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`Comment`) VALUES +(13,3,72771,31,3,38508,'Deathbringer Saurfang - Scent of Blood on Blood Beast'); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c72ccbacc3d..d3566c24a48 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1085,10 +1085,6 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) case 52349: // Overtake unitTarget->CastCustomSpell(unitTarget, spellInfo->Id, &damage, NULL, NULL, true, NULL, NULL, m_originalCasterGUID); return; - case 72378: // Blood Nova - case 73058: // Blood Nova - m_caster->CastSpell(unitTarget, damage, true); // additional spell cast - break; } } @@ -5710,9 +5706,9 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/) } if (!pet) return; - + player->GetMap()->CreatureRelocation(pet, x, y, z, player->GetOrientation()); - + pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); pet->setDeathState(ALIVE); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 3de87790be9..64e1527b8d3 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3346,13 +3346,22 @@ void SpellMgr::LoadDbcDataCorrections() case 70835: // Bone Storm (Lord Marrowgar) case 70836: // Bone Storm (Lord Marrowgar) case 72864: // Death Plague (Rotting Frost Giant) - case 72378: // Blood Nova (Deathbringer Saurfang) - case 73058: // Blood Nova (Deathbringer Saurfang) case 71160: // Plague Stench (Stinky) case 71161: // Plague Stench (Stinky) case 71123: // Decimate (Stinky & Precious) spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd break; + case 72378: // Blood Nova (Deathbringer Saurfang) + case 73058: // Blood Nova (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; + spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; + break; + case 72769: // Scent of Blood (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; + // no break + case 72771: // Scent of Blood (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; + break; case 72723: // Resistant Skin (Deathbringer Saurfang adds) // this spell initially granted Shadow damage immunity, however it was removed but the data was left in client spellInfo->Effect[2] = 0; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index e424cd16eaa..afc7c503bee 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -39,6 +39,7 @@ enum ScriptTexts SAY_FRENZY = 11, SAY_BERSERK = 12, SAY_DEATH = 13, + EMOTE_SCENT_OF_BLOOD = 14, // High Overlord Saurfang SAY_INTRO_HORDE_1 = 0, @@ -145,6 +146,7 @@ enum EventTypes EVENT_BOILING_BLOOD = 20, EVENT_BLOOD_NOVA = 21, EVENT_RUNE_OF_BLOOD = 22, + EVENT_SCENT_OF_BLOOD = 52, EVENT_OUTRO_ALLIANCE_1 = 23, EVENT_OUTRO_ALLIANCE_2 = 24, @@ -374,16 +376,13 @@ class boss_deathbringer_saurfang : public CreatureScript if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) summon->AI()->AttackStart(target); - if (IsHeroic()) - DoCast(summon, SPELL_SCENT_OF_BLOOD); - - summon->AI()->DoCast(summon, SPELL_BLOOD_LINK_BEAST, true); - summon->AI()->DoCast(summon, SPELL_RESISTANT_SKIN, true); + summon->CastSpell(summon, SPELL_BLOOD_LINK_BEAST, true); + summon->CastSpell(summon, SPELL_RESISTANT_SKIN, true); summons.Summon(summon); DoZoneInCombat(summon); } - void SummonedCreatureDespawn(Creature* summon) + void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) { summons.Despawn(summon); } @@ -463,18 +462,13 @@ class boss_deathbringer_saurfang : public CreatureScript DoCast(me, SPELL_SUMMON_BLOOD_BEAST_25_MAN+i25); Talk(SAY_BLOOD_BEASTS); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 40000, 0, PHASE_COMBAT); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SCENT_OF_BLOOD, 10000, 0, PHASE_COMBAT); break; case EVENT_BLOOD_NOVA: - { - // select at range only - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, -10.0f, true); - if (!target) - target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true); // noone? select melee - if (target) - DoCast(target, SPELL_BLOOD_NOVA_TRIGGER); + DoCastAOE(SPELL_BLOOD_NOVA_TRIGGER); events.ScheduleEvent(EVENT_BLOOD_NOVA, urand(20000, 25000), 0, PHASE_COMBAT); break; - } case EVENT_RUNE_OF_BLOOD: DoCastVictim(SPELL_RUNE_OF_BLOOD); events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, urand(20000, 25000), 0, PHASE_COMBAT); @@ -487,6 +481,13 @@ class boss_deathbringer_saurfang : public CreatureScript DoCast(me, SPELL_BERSERK); Talk(SAY_BERSERK); break; + case EVENT_SCENT_OF_BLOOD: + if (!summons.empty()) + { + Talk(EMOTE_SCENT_OF_BLOOD); + DoCastAOE(SPELL_SCENT_OF_BLOOD); + } + break; default: break; } @@ -1237,10 +1238,16 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader unitList.push_back(target); } + void HandleForceCast(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), TRIGGERED_FULL_MASK); + } + void Register() { OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_nova_targeting_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); } Unit* target; -- cgit v1.2.3 From 8f19d0050923f30f150a6ac0d6c85a3f2bbb8b04 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 27 Apr 2012 16:24:16 +0200 Subject: Core/Battleground: * Fix typo in commit ddd25ce7166fc34f9e3411863da80f84d3693c34 * Fix codestyle --- .../game/Battlegrounds/Zones/BattlegroundSA.h | 134 ++++++++++----------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 2ade101ce54..c18806490f2 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -30,8 +30,8 @@ class BattlegroundSAScore : public BattlegroundScore uint8 gates_destroyed; }; -#define BG_SA_FLAG_AMOUNT 3 -#define BG_SA_DEMOLISHER_AMOUNT 4 +#define BG_SA_FLAG_AMOUNT 3 +#define BG_SA_DEMOLISHER_AMOUNT 4 enum BG_SA_Status { @@ -52,20 +52,20 @@ enum BG_SA_GateState enum BG_SA_EventIdGate { - BG_SA_EVENT_GREEN_GATE_DAMAGED = 19041, - BG_SA_EVENT_GREEN_GATE_DESTROYED = 19046, - BG_SA_EVENT_BLUE_GATE_DAMAGED = 19040, BG_SA_EVENT_BLUE_GATE_DESTROYED = 19045, + BG_SA_EVENT_GREEN_GATE_DAMAGED = 19041, + BG_SA_EVENT_GREEN_GATE_DESTROYED = 19046, + BG_SA_EVENT_RED_GATE_DAMAGED = 19042, BG_SA_EVENT_RED_GATE_DESTROYED = 19047, - BG_SA_EVENT_PURPLE_GATE_DAMAGED = 19048, - BG_SA_EVENT_PURPLE_GATE_DESTROYED = 19043, + BG_SA_EVENT_PURPLE_GATE_DAMAGED = 19043, + BG_SA_EVENT_PURPLE_GATE_DESTROYED = 19048, - BG_SA_EVENT_YELLOW_GATE_DAMAGED = 19049, - BG_SA_EVENT_YELLOW_GATE_DESTROYED = 19044, + BG_SA_EVENT_YELLOW_GATE_DAMAGED = 19044, + BG_SA_EVENT_YELLOW_GATE_DESTROYED = 19049, BG_SA_EVENT_ANCIENT_GATE_DAMAGED = 19836, BG_SA_EVENT_ANCIENT_GATE_DESTROYED = 19837 @@ -73,38 +73,38 @@ enum BG_SA_EventIdGate enum BG_SA_Timers { - BG_SA_BOAT_START = 60*IN_MILLISECONDS, - BG_SA_WARMUPLENGTH = 120*IN_MILLISECONDS, - BG_SA_ROUNDLENGTH = 600*IN_MILLISECONDS + BG_SA_BOAT_START = 60 * IN_MILLISECONDS, + BG_SA_WARMUPLENGTH = 120 * IN_MILLISECONDS, + BG_SA_ROUNDLENGTH = 600 * IN_MILLISECONDS }; enum BG_SA_WorldStates { - BG_SA_TIMER_MINS = 3559, - BG_SA_TIMER_SEC_TENS = 3560, - BG_SA_TIMER_SEC_DECS = 3561, - BG_SA_ALLY_ATTACKS = 4352, - BG_SA_HORDE_ATTACKS = 4353, - BG_SA_PURPLE_GATEWS = 3614, - BG_SA_RED_GATEWS = 3617, - BG_SA_BLUE_GATEWS = 3620, - BG_SA_GREEN_GATEWS = 3623, - BG_SA_YELLOW_GATEWS = 3638, - BG_SA_ANCIENT_GATEWS = 3849, - BG_SA_LEFT_GY_ALLIANCE = 3635, - BG_SA_RIGHT_GY_ALLIANCE = 3636, - BG_SA_CENTER_GY_ALLIANCE = 3637, - BG_SA_RIGHT_ATT_TOKEN_ALL = 3627, - BG_SA_LEFT_ATT_TOKEN_ALL = 3626, - BG_SA_LEFT_ATT_TOKEN_HRD = 3629, - BG_SA_RIGHT_ATT_TOKEN_HRD = 3628, - BG_SA_HORDE_DEFENCE_TOKEN = 3631, - BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630, - BG_SA_RIGHT_GY_HORDE = 3632, - BG_SA_LEFT_GY_HORDE = 3633, - BG_SA_CENTER_GY_HORDE = 3634, - BG_SA_BONUS_TIMER = 0xdf3, - BG_SA_ENABLE_TIMER = 3564, + BG_SA_TIMER_MINS = 3559, + BG_SA_TIMER_SEC_TENS = 3560, + BG_SA_TIMER_SEC_DECS = 3561, + BG_SA_ALLY_ATTACKS = 4352, + BG_SA_HORDE_ATTACKS = 4353, + BG_SA_PURPLE_GATEWS = 3614, + BG_SA_RED_GATEWS = 3617, + BG_SA_BLUE_GATEWS = 3620, + BG_SA_GREEN_GATEWS = 3623, + BG_SA_YELLOW_GATEWS = 3638, + BG_SA_ANCIENT_GATEWS = 3849, + BG_SA_LEFT_GY_ALLIANCE = 3635, + BG_SA_RIGHT_GY_ALLIANCE = 3636, + BG_SA_CENTER_GY_ALLIANCE = 3637, + BG_SA_RIGHT_ATT_TOKEN_ALL = 3627, + BG_SA_LEFT_ATT_TOKEN_ALL = 3626, + BG_SA_LEFT_ATT_TOKEN_HRD = 3629, + BG_SA_RIGHT_ATT_TOKEN_HRD = 3628, + BG_SA_HORDE_DEFENCE_TOKEN = 3631, + BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630, + BG_SA_RIGHT_GY_HORDE = 3632, + BG_SA_LEFT_GY_HORDE = 3633, + BG_SA_CENTER_GY_HORDE = 3634, + BG_SA_BONUS_TIMER = 0xdf3, + BG_SA_ENABLE_TIMER = 3564, }; enum npc @@ -143,14 +143,14 @@ enum BG_SA_NPCs enum BG_SA_Boat { - BG_SA_BOAT_ONE_A =193182, - BG_SA_BOAT_TWO_H =193183, - BG_SA_BOAT_ONE_H =193184, - BG_SA_BOAT_TWO_A =193185, + BG_SA_BOAT_ONE_A = 193182, + BG_SA_BOAT_TWO_H = 193183, + BG_SA_BOAT_ONE_H = 193184, + BG_SA_BOAT_TWO_A = 193185, }; -const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] = - { +uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC] = +{ NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, @@ -161,25 +161,25 @@ const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] = NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, - //4 beach demolishers + // 4 beach demolishers NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, - //Triggers + // Triggers 23472, 23472, 23472, 23472, 23472, - //Used Demolisher Salesman + // Used Demolisher Salesman NPC_RIGGER_SPARKLIGHT, NPC_GORGRIL_RIGSPARK - }; +}; -const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = +float const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = { - //Cannons + // Cannons { 1436.429f, 110.05f, 41.407f, 5.4f }, { 1404.9023f, 84.758f, 41.183f, 5.46f }, { 1068.693f, -86.951f, 93.81f, 0.02f }, @@ -190,21 +190,21 @@ const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = { 1249.634f, -224.189f, 66.72f, 0.635f }, { 1236.213f, 92.287f, 64.965f, 5.751f }, { 1215.11f, 57.772f, 64.739f, 5.78f }, - //Demolishers + // Demolishers { 1611.597656f, -117.270073f, 8.719355f, 2.513274f}, { 1575.562500f, -158.421875f, 5.024450f, 2.129302f}, { 1618.047729f, 61.424641f, 7.248210f, 3.979351f}, { 1575.103149f, 98.873344f, 2.830360f, 3.752458f}, - //trigger + // Triggers { 1453.49f, -250.453f, 30.896f, 4.2883f}, { 1377.05f, 97.036f, 30.8605f, 2.46539f}, { 1186.05f, 58.8048f, 56.5491f, 2.75992f}, { 1042.83f, -72.839f, 84.8145f, 3.58615f}, { 1233.62f, -250.49f, 55.4036f, 3.7016f}, - //Npcs + // Npcs { 1348.644165f, -298.786469f, 31.080130f, 1.710423f}, { 1358.191040f, 195.527786f, 31.018187f, 4.171337f}, - //Demolishers2 + // Demolishers 2 { 1371.055786f, -317.071136f, 35.007359f, 1.947460f}, { 1424.034912f, -260.195190f, 31.084425f, 2.820013f}, { 1353.139893f, 223.745438f, 35.265411f, 4.343684f}, @@ -242,7 +242,7 @@ enum BG_SA_Objects BG_SA_MAXOBJ = BG_SA_BOMB+68 }; -const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = +float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = { { 1411.57f, 108.163f, 28.692f, 5.441f }, { 1055.452f, -108.1f, 82.134f, 0.034f }, @@ -251,30 +251,30 @@ const float 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 }, - //Ships + // Ships { 2679.696777f, -826.891235f, 3.712860f, 5.78367f}, //rot2 1 rot3 0.0002f { 2574.003662f, 981.261475f, 2.603424f, 0.807696f}, - //Sigils + // Sigils { 1414.054f, 106.72f, 41.442f, 5.441f }, { 1060.63f, -107.8f, 94.7f, 0.034f }, { 1433.383f, -216.4f, 43.642f, 0.9736f }, { 1230.75f, -210.724f, 67.611f, 0.5023f }, { 1217.8f, 79.532f, 66.58f, 5.745f }, - //Flagpoles + // Flagpoles { 1215.114258f, -65.711861f, 70.084267f, -3.124123f}, {1338.863892f, -153.336533f, 30.895121f, -2.530723f}, {1309.124268f, 9.410645f, 30.893402f, -1.623156f}, - //Flags + // Flags { 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 + // 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 + // Bombs {1333.45f, 211.354f, 31.0538f, 5.03666f}, {1334.29f, 209.582f, 31.0532f, 1.28088f}, {1332.72f, 210.049f, 31.0532f, 1.28088f}, @@ -358,7 +358,7 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = * to get horde ones. */ -const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = +uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = { 190722, 190727, @@ -388,7 +388,7 @@ const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = 190753 }; -const uint32 BG_SA_Factions[2] = +uint32 const BG_SA_Factions[2] = { 1732, 1735, @@ -413,13 +413,13 @@ const uint32 BG_SA_GYEntries[BG_SA_MAX_GY] = 1348, }; -const float BG_SA_GYOrientation[BG_SA_MAX_GY] = +float const BG_SA_GYOrientation[BG_SA_MAX_GY] = { 6.202f, - 1.926f, //right capturable GY - 3.917f, //left capturable GY - 3.104f, //center, capturable - 6.148f, //defender last GY + 1.926f, // right capturable GY + 3.917f, // left capturable GY + 3.104f, // center, capturable + 6.148f, // defender last GY }; struct BG_SA_RoundScore -- cgit v1.2.3 From e8bfcb686f2400b80659d4f65ec523cb07e17c06 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 28 Apr 2012 02:56:29 +0200 Subject: Core/Spell: Fix not using Disengage while rooted --- src/server/game/Spells/Spell.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index f055d669925..28b089f91cd 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5333,8 +5333,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Id == 781 && !m_caster->isInCombat()) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - Unit* target = m_targets.GetUnitTarget(); - if (m_caster == target && m_caster->HasUnitState(UNIT_STATE_ROOT)) + if (m_caster->HasUnitState(UNIT_STATE_ROOT)) { if (m_caster->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_ROOTED; -- cgit v1.2.3 From b899f5fc942902153ff369737ca835a997495299 Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 28 Apr 2012 14:53:40 +0200 Subject: Core/SpellScripts: rename GetTarget*() functions to GetExplTarget*(), so the names reflect better what those functions do. Also update some comments. --- src/server/game/Spells/SpellScript.cpp | 15 ++++++---- src/server/game/Spells/SpellScript.h | 34 ++++++++++++++-------- src/server/scripts/Examples/example_spell.cpp | 2 +- src/server/scripts/Kalimdor/dustwallow_marsh.cpp | 2 +- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- .../IcecrownCitadel/boss_blood_prince_council.cpp | 4 +-- .../IcecrownCitadel/boss_blood_queen_lana_thel.cpp | 2 +- .../IcecrownCitadel/boss_professor_putricide.cpp | 10 +++---- .../Northrend/IcecrownCitadel/boss_rotface.cpp | 4 +-- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 2 +- .../IcecrownCitadel/boss_the_lich_king.cpp | 4 +-- .../Ulduar/Ulduar/boss_algalon_the_observer.cpp | 6 ++-- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../Northrend/Ulduar/Ulduar/boss_razorscale.cpp | 2 +- src/server/scripts/Spells/spell_dk.cpp | 2 +- src/server/scripts/Spells/spell_druid.cpp | 4 +-- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/server/scripts/Spells/spell_hunter.cpp | 4 +-- src/server/scripts/Spells/spell_paladin.cpp | 7 ++--- src/server/scripts/Spells/spell_priest.cpp | 7 ++--- src/server/scripts/Spells/spell_quest.cpp | 2 +- src/server/scripts/Spells/spell_warlock.cpp | 4 +-- 22 files changed, 68 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 44a2dd4dedb..e12c5d62d9f 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -320,29 +320,34 @@ SpellInfo const* SpellScript::GetSpellInfo() return m_spell->GetSpellInfo(); } -WorldLocation const* SpellScript::GetTargetDest() +WorldLocation const* SpellScript::GetExplTargetDest() { if (m_spell->m_targets.HasDst()) return m_spell->m_targets.GetDstPos(); return NULL; } -void SpellScript::SetTargetDest(WorldLocation& loc) +void SpellScript::SetExplTargetDest(WorldLocation& loc) { m_spell->m_targets.SetDst(loc); } -Unit* SpellScript::GetTargetUnit() +Unit* SpellScript::GetExplTargetWorldObject() +{ + return m_spell->m_targets.GetObjectTarget(); +} + +Unit* SpellScript::GetExplTargetUnit() { return m_spell->m_targets.GetUnitTarget(); } -GameObject* SpellScript::GetTargetGObj() +GameObject* SpellScript::GetExplTargetGObj() { return m_spell->m_targets.GetGOTarget(); } -Item* SpellScript::GetTargetItem() +Item* SpellScript::GetExplTargetItem() { return m_spell->m_targets.GetItemTarget(); } diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 26393040a1e..7b194b7827f 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -295,25 +295,35 @@ class SpellScript : public _SpellScript SpellInfo const* GetSpellInfo(); SpellValue const* GetSpellValue(); - // methods useable after spell targets are set - // accessors to the "focus" targets of the spell - // note: do not confuse these with spell hit targets + // methods useable after spell is prepared + // accessors to the explicit targets of the spell + // explicit target - target selected by caster (player, game client, or script - DoCast(explicitTarget, ...), required for spell to be cast + // examples: + // -shadowstep - explicit target is the unit you want to go behind of + // -chain heal - explicit target is the unit to be healed first + // -holy nova/arcane explosion - explicit target = NULL because target you are selecting doesn't affect how spell targets are selected + // you can determine if spell requires explicit targets by dbc columns: + // - Targets - mask of explicit target types + // - ImplicitTargetXX set to TARGET_XXX_TARGET_YYY, _TARGET_ here means that explicit target is used by the effect, so spell needs one too + // returns: WorldLocation which was selected as a spell destination or NULL - WorldLocation const* GetTargetDest(); + WorldLocation const* GetExplTargetDest(); - void SetTargetDest(WorldLocation& loc); + void SetExplTargetDest(WorldLocation& loc); - // returns: Unit which was selected as a spell target or NULL - Unit* GetTargetUnit(); + // returns: WorldObject which was selected as an explicit spell target or NULL if there's no target + WorldObject* GetExplTargetWorldObject(); - // returns: GameObject which was selected as a spell target or NULL - GameObject* GetTargetGObj(); + // returns: Unit which was selected as an explicit spell target or NULL if there's no target + Unit* GetExplTargetUnit(); - // returns: Item which was selected as a spell target or NULL - Item* GetTargetItem(); + // returns: GameObject which was selected as an explicit spell target or NULL if there's no target + GameObject* GetExplTargetGObj(); - // methods useable only during spell hit on target, or during spell launch on target: + // returns: Item which was selected as an explicit spell target or NULL if there's no target + Item* GetExplTargetItem(); + // methods useable only during spell hit on target, or during spell launch on target: // returns: target of current effect if it was Unit otherwise NULL Unit* GetHitUnit(); // returns: target of current effect if it was Creature otherwise NULL diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 8c721c141af..70d7f43135c 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -102,7 +102,7 @@ class spell_ex_5581 : public SpellScriptLoader { // in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed) // in this case we're disallowing to select non-player as a target of the spell - //if (!GetTargetUnit() || GetTargetUnit()->ToPlayer()) + //if (!GetExplTargetUnit() || GetExplTargetUnit()->ToPlayer()) //return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index cbacc4fdf66..e4ed3793385 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -713,7 +713,7 @@ class spell_ooze_zap : public SpellScriptLoader if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct - if (!GetTargetUnit()) + if (!GetExplTargetUnit()) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 241d6239f82..cf84abb482f 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -769,7 +769,7 @@ class spell_powering_up : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetTargetUnit()) + if (Unit* target = GetExplTargetUnit()) if (urand(0, 99) < 15) target->CastSpell(target, spellId, true); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 8090fc98101..d091a87dbfe 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -1497,10 +1497,10 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader void ChangeSummonPos(SpellEffIndex /*effIndex*/) { - WorldLocation summonPos = *GetTargetDest(); + WorldLocation summonPos = *GetExplTargetDest(); Position offset = {0.0f, 0.0f, 20.0f, 0.0f}; summonPos.RelocateOffset(offset); - SetTargetDest(summonPos); + SetExplTargetDest(summonPos); GetHitDest()->RelocateOffset(offset); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index b6544fd9a2a..f086e8dc9cf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -522,7 +522,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader SpellCastResult CheckTarget() { - if (IsVampire(GetTargetUnit())) + if (IsVampire(GetExplTargetUnit())) { SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES); return SPELL_FAILED_CUSTOM_ERROR; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index c043cb27c7c..a0fca522f61 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -1280,11 +1280,11 @@ class spell_putricide_mutation_init : public SpellScriptLoader SpellCastResult CheckRequirementInternal(SpellCustomErrors& extendedError) { - InstanceScript* instance = GetTargetUnit()->GetInstanceScript(); + InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript(); if (!instance) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - Creature* professor = ObjectAccessor::GetCreature(*GetTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); + Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); if (!professor) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; @@ -1305,17 +1305,17 @@ class spell_putricide_mutation_init : public SpellScriptLoader SpellCastResult CheckRequirement() { - if (!GetTargetUnit()) + if (!GetExplTargetUnit()) return SPELL_FAILED_BAD_TARGETS; - if (GetTargetUnit()->GetTypeId() != TYPEID_PLAYER) + if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE; SpellCastResult result = CheckRequirementInternal(extension); if (result != SPELL_CAST_OK) { - Spell::SendCastResult(GetTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); + Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); return result; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 85de6789784..a4ab13f6ada 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -716,13 +716,13 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader void CheckTarget(SpellEffIndex effIndex) { PreventHitDefaultEffect(EFFECT_0); - if (!GetTargetDest()) + if (!GetExplTargetDest()) return; uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell; float x, y, z; - GetTargetDest()->GetPosition(x, y, z); + GetExplTargetDest()->GetPosition(x, y, z); // let Rotface handle the cast - caster dies before this executes if (InstanceScript* script = GetCaster()->GetInstanceScript()) if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE))) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index ebf9ae02a95..6039ace44ab 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1344,7 +1344,7 @@ class spell_rimefang_icy_blast : public SpellScriptLoader void HandleTriggerMissile(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - if (Position const* pos = GetTargetDest()) + if (Position const* pos = GetExplTargetDest()) if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000)) summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 2eb894a5153..4dab215d1da 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -2470,7 +2470,7 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader void ModDestHeight(SpellEffIndex effIndex) { static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f}; - WorldLocation* dest = const_cast(GetTargetDest()); + WorldLocation* dest = const_cast(GetExplTargetDest()); dest->RelocateOffset(offset); // spirit bombs get higher if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB) @@ -2727,7 +2727,7 @@ class spell_the_lich_king_vile_spirits_visual : public SpellScriptLoader void ModDestHeight(SpellEffIndex /*effIndex*/) { Position offset = {0.0f, 0.0f, 15.0f, 0.0f}; - const_cast(GetTargetDest())->RelocateOffset(offset); + const_cast(GetExplTargetDest())->RelocateOffset(offset); } void Register() 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 6f87d7fcd2a..661b3530bb8 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 @@ -1267,7 +1267,7 @@ class spell_algalon_cosmic_smash : public SpellScriptLoader void ModDestHeight(SpellEffIndex /*effIndex*/) { Position offset = {0.0f, 0.0f, 65.0f, 0.0f}; - const_cast(GetTargetDest())->RelocateOffset(offset); + const_cast(GetExplTargetDest())->RelocateOffset(offset); GetHitDest()->RelocateOffset(offset); } @@ -1294,10 +1294,10 @@ class spell_algalon_cosmic_smash_damage : public SpellScriptLoader void RecalculateDamage() { - if (!GetTargetDest() || !GetHitUnit()) + if (!GetExplTargetDest() || !GetHitUnit()) return; - float distance = GetHitUnit()->GetDistance2d(GetTargetDest()->GetPositionX(), GetTargetDest()->GetPositionY()); + float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY()); if (distance > 6.0f) SetHitDamage(int32(float(GetHitDamage()) / distance) * 2); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 462c767f599..0e453eceaa1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1743,7 +1743,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader { // use 99 because it is 3d search std::list targetList; - Trinity::WorldObjectSpellAreaTargetCheck check(99, GetTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL); + Trinity::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL); Trinity::WorldObjectListSearcher searcher(GetCaster(), targetList, check); GetCaster()->GetMap()->VisitAll(GetCaster()->m_positionX, GetCaster()->m_positionY, 99, searcher); float minDist = 99 * 99; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index a1323b07899..e8e938dc06b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -1006,7 +1006,7 @@ class spell_razorscale_devouring_flame : public SpellScriptLoader PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - WorldLocation const* summonLocation = GetTargetDest(); + WorldLocation const* summonLocation = GetExplTargetDest(); if (!caster || !summonLocation) return; diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 5d874faf411..13190ed013f 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -775,7 +775,7 @@ class spell_dk_death_grip : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); - Position const* pos = GetTargetDest(); + Position const* pos = GetExplTargetDest(); if (Unit* target = GetHitUnit()) { if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 380cac4e5ee..898350dbd71 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -237,7 +237,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader } else { - unitList.remove(GetTargetUnit()); + unitList.remove(GetExplTargetUnit()); std::list tempTargets; for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr)) @@ -279,7 +279,7 @@ class spell_dru_starfall_aoe : public SpellScriptLoader void FilterTargets(std::list& unitList) { - unitList.remove(GetTargetUnit()); + unitList.remove(GetExplTargetUnit()); } void Register() diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 7fd37ede316..501c7c47676 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1282,7 +1282,7 @@ class spell_gen_launch : public SpellScriptLoader void Launch() { - WorldLocation const* const position = GetTargetDest(); + WorldLocation const* const position = GetExplTargetDest(); if (Player* player = GetHitPlayer()) { diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 5d8e8f84e6a..a7fb2eb9077 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -286,8 +286,8 @@ class spell_hun_masters_call : public SpellScriptLoader target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask); // there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that // it's more likely that on on retail it's possible to call target selector based on dbc values - // anyways, we're using GetTargetUnit() here and it's ok - if (Unit* ally = GetTargetUnit()) + // anyways, we're using GetExplTargetUnit() here and it's ok + if (Unit* ally = GetExplTargetUnit()) { target->CastSpell(ally, GetEffectValue(), castMask); target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index c8c563d3d5d..cf8cae68c58 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -288,10 +288,9 @@ class spell_pal_holy_shock : public SpellScriptLoader SpellCastResult CheckCast() { Player* caster = GetCaster()->ToPlayer(); - if (GetTargetUnit()) - if (Unit* target = GetTargetUnit()) - if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) - return SPELL_FAILED_BAD_TARGETS; + if (Unit* target = GetExplTargetUnit()) + if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 47cec6ce516..8088004c9d1 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -227,10 +227,9 @@ class spell_pri_penance : public SpellScriptLoader SpellCastResult CheckCast() { Player* caster = GetCaster()->ToPlayer(); - if (GetTargetUnit()) - if (Unit* target = GetTargetUnit()) - if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) - return SPELL_FAILED_BAD_TARGETS; + if (Unit* target = GetExplTargetUnit()) + if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 06678407b93..9d042da0789 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -275,7 +275,7 @@ class spell_q11396_11399_scourging_crystal_controller : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetTargetUnit()) + if (Unit* target = GetExplTargetUnit()) if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) // Make sure nobody else is channeling the same target if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER)) diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 1f7e8171e46..838b9e4f932 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -301,8 +301,8 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader void FilterTargets(std::list& unitList) { - if (GetTargetUnit()) - unitList.remove(GetTargetUnit()); + if (GetExplTargetUnit()) + unitList.remove(GetExplTargetUnit()); } void Register() -- cgit v1.2.3 From b53485e05326f9ed6562aa78fee282f255eac339 Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 28 Apr 2012 15:10:52 +0200 Subject: Fix build and correct minor codestyle issue. --- src/server/game/Entities/Object/Object.cpp | 6 ++++-- src/server/game/Spells/SpellScript.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index e26bc0a6ea1..fc1b56c4b8c 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -626,8 +626,10 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* if (!target->isAllowedToLoot(creature)) dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE; } - if(dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT) - if (Unit const* unit = ToUnit()) + + // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras + if (Unit const* unit = ToUnit()) + if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT) if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; *data << dynamicFlags; diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index e12c5d62d9f..e6ce80c20f0 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -332,7 +332,7 @@ void SpellScript::SetExplTargetDest(WorldLocation& loc) m_spell->m_targets.SetDst(loc); } -Unit* SpellScript::GetExplTargetWorldObject() +WorldObject* SpellScript::GetExplTargetWorldObject() { return m_spell->m_targets.GetObjectTarget(); } -- cgit v1.2.3 From 879070bc80351bebe5c781396740210a37cf52ac Mon Sep 17 00:00:00 2001 From: Chaplain Date: Sat, 28 Apr 2012 15:10:52 +0300 Subject: Core/Spells: Separation caster/target part damage/heal bonus calculations. *Implement HoT/DoT save caster side bonuses and apply target mods on each tick --- src/server/game/Entities/Pet/Pet.cpp | 10 +- src/server/game/Entities/Unit/StatSystem.cpp | 6 +- src/server/game/Entities/Unit/Unit.cpp | 608 +++++++++++----------- src/server/game/Entities/Unit/Unit.h | 24 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 61 ++- src/server/game/Spells/Auras/SpellAuraEffects.h | 8 +- src/server/game/Spells/Auras/SpellAuras.cpp | 10 +- src/server/game/Spells/SpellEffects.cpp | 56 +- src/server/game/Spells/SpellInfo.cpp | 29 ++ src/server/game/Spells/SpellInfo.h | 2 + src/server/scripts/Spells/spell_hunter.cpp | 3 +- src/server/scripts/Spells/spell_shaman.cpp | 4 +- src/server/scripts/Spells/spell_warrior.cpp | 5 +- 13 files changed, 465 insertions(+), 361 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 586f09bd79c..f3a736daceb 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -940,14 +940,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) { case 510: // mage Water Elemental { - SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FROST) * 0.33f)); + SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f)); break; } case 1964: //force of nature { if (!pInfo) SetCreateHealth(30 + 30*petlevel); - float bonusDmg = m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_NATURE) * 0.15f; + float bonusDmg = m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE) * 0.15f; SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.5f - (petlevel / 2) + bonusDmg)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.5f + (petlevel / 2) + bonusDmg)); break; @@ -967,7 +967,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateHealth(40*petlevel); SetCreateMana(28 + 10*petlevel); } - SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE) * 0.5f)); + SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) * 0.5f)); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 4 - petlevel)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4 + petlevel)); break; @@ -979,7 +979,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateMana(28 + 10*petlevel); SetCreateHealth(28 + 30*petlevel); } - int32 bonus_dmg = (int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_SHADOW)* 0.3f)); + int32 bonus_dmg = (int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW)* 0.3f)); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel * 4 - petlevel) + bonus_dmg)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel * 4 + petlevel) + bonus_dmg)); @@ -1020,7 +1020,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) } case 31216: // Mirror Image { - SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FROST) * 0.33f)); + SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f)); SetDisplayId(m_owner->GetDisplayId()); if (!pInfo) { diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 2da1c1b88cb..5cec0cf4375 100755 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -142,13 +142,13 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply) void Player::UpdateSpellDamageAndHealingBonus() { - // Magic damage modifiers implemented in Unit::SpellDamageBonus + // Magic damage modifiers implemented in Unit::SpellDamageBonusDone // This information for client side use only // Get healing bonus for all schools - SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonus(SPELL_SCHOOL_MASK_ALL)); + SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL)); // Get damage bonus for all schools for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonus(SpellSchoolMask(1 << i))); + SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i))); } bool Player::UpdateAllStats() diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index fb91c3fc9f1..a04e2ac0e48 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -953,7 +953,9 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID); SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask); - damage = SpellDamageBonus(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE); + damage = SpellDamageBonusDone(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE); + damage = victim->SpellDamageBonusTaken(spellInfo, damage, SPELL_DIRECT_DAMAGE); + CalculateSpellDamageTaken(&damageInfo, damage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); SendSpellNonMeleeDamageLog(&damageInfo); @@ -1148,7 +1150,8 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damage += CalculateDamage(damageInfo->attackType, false, true); // Add melee damage bonus - MeleeDamageBonus(damageInfo->target, &damage, damageInfo->attackType); + damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType); + damage = MeleeDamageBonusTaken(damage, damageInfo->attackType); // Calculate armor reduction if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask))) @@ -1400,7 +1403,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) uint32 damage = (*dmgShieldItr)->GetAmount(); if (Unit* caster = (*dmgShieldItr)->GetCaster()) - damage = caster->SpellDamageBonus(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE); + { + damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE); + damage = this->SpellDamageBonusTaken(i_spellProto, damage, SPELL_DIRECT_DAMAGE); + } // No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that victim->DealDamageMods(this, damage, NULL); @@ -3652,7 +3658,10 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId // final heal int32 healAmount = aurEff->GetAmount(); if (Unit* caster = aura->GetCaster()) - healAmount = caster->SpellHealingBonus(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); + { + healAmount = caster->SpellHealingBonusDone(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); + healAmount = this->SpellHealingBonusTaken(aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); + } CastCustomSpell(this, 33778, &healAmount, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); // mana @@ -6724,8 +6733,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere return false; triggered_spell_id = 25742; float ap = GetTotalAttackPowerValue(BASE_ATTACK); - int32 holy = SpellBaseDamageBonus(SPELL_SCHOOL_MASK_HOLY) + - SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_HOLY, victim); + int32 holy = SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY) + + victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY); basepoints0 = (int32)GetAttackTime(BASE_ATTACK) * int32(ap * 0.022f + 0.044f * holy) / 1000; break; } @@ -7435,8 +7444,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f)); - float add_spellpower = (float)(SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE) - + SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_FIRE, victim)); + float add_spellpower = (float)(SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) + + victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_FIRE)); // 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84% ApplyPctF(add_spellpower, 3.84f); @@ -9007,7 +9016,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg { if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 3220, 0)) { - basepoints0 = int32((aurEff->GetAmount() * owner->SpellBaseDamageBonus(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC)) + 100.0f) / 100.0f); // TODO: Is it right? + basepoints0 = int32((aurEff->GetAmount() * owner->SpellBaseDamageBonusDone(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC)) + 100.0f) / 100.0f); // TODO: Is it right? CastCustomSpell(this, trigger_spell_id, &basepoints0, &basepoints0, NULL, true, castItem, triggeredByAura); return true; } @@ -10374,7 +10383,7 @@ void Unit::EnergizeBySpell(Unit* victim, uint32 spellID, uint32 damage, Powers p victim->getHostileRefManager().threatAssist(this, float(damage) * 0.5f, spellInfo); } -uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) { if (!spellProto || !victim || damagetype == DIRECT_DAMAGE) return pdamage; @@ -10387,15 +10396,13 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 // For totems get damage bonus from owner if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem()) if (Unit* owner = GetOwner()) - return owner->SpellDamageBonus(victim, spellProto, pdamage, damagetype); + return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype); - // Taken/Done total percent damage auras + // Done total percent damage auras float DoneTotalMod = 1.0f; float ApCoeffMod = 1.0f; int32 DoneTotal = 0; - int32 TakenTotal = 0; - // ..done // Pet damage? if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet()) DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); @@ -10726,50 +10733,8 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 break; } - // ..taken - float TakenTotalMod = 1.0f; - - // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN - // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) - TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask()); - - // .. taken pct: dummy auras - AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY); - for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) - { - switch ((*i)->GetSpellInfo()->SpellIconID) - { - // Cheat Death - case 2109: - if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - continue; - float mod = victim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); - AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount()))); - } - break; - } - } - - // From caster spells - AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); - for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) - AddPctN(TakenTotalMod, (*i)->GetAmount()); - - // Mod damage from spell mechanic - if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask()) - { - AuraEffectList const& mDamageDoneMechanic = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); - for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) - if (mechanicMask & uint32(1<<((*i)->GetMiscValue()))) - AddPctN(TakenTotalMod, (*i)->GetAmount()); - } - - // Taken/Done fixed damage bonus auras - int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(spellProto->GetSchoolMask()); - int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(spellProto->GetSchoolMask(), victim); + // Done fixed damage bonus auras + int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask()); // Pets just add their bonus damage to their spell damage // note that their spell damage is just gain of their own auras if (HasUnitTypeMask(UNIT_MASK_GUARDIAN)) @@ -10804,67 +10769,13 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 } } // Default calculation - if (DoneAdvertisedBenefit || TakenAdvertisedBenefit) + if (DoneAdvertisedBenefit) { if (!bonus || coeff < 0) - { - // Damage Done from spell damage bonus - int32 CastingTime = spellProto->IsChanneled() ? spellProto->GetDuration() : spellProto->CalcCastTime(); - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if (damagetype == DOT) - { - int32 DotDuration = spellProto->GetDuration(); - // 200% limit - if (DotDuration > 0) - { - if (DotDuration > 30000) - DotDuration = 30000; - if (!spellProto->IsChanneled()) - DotFactor = DotDuration / 15000.0f; - uint8 x = 0; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && ( - spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || - spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - x = j; - break; - } - } - int32 DotTicks = 6; - if (spellProto->Effects[x].Amplitude != 0) - DotTicks = DotDuration / spellProto->Effects[x].Amplitude; - if (DotTicks) - { - DoneAdvertisedBenefit /= DotTicks; - TakenAdvertisedBenefit /= DotTicks; - } - } - } - // Distribute Damage over multiple effects, reduce by AoE - CastingTime = GetCastingTimeForBonus(spellProto, damagetype, CastingTime); - - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH || - (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - CastingTime /= 2; - break; - } - } - if (spellProto->SchoolMask != SPELL_SCHOOL_MASK_NORMAL) - coeff = (CastingTime / 3500.0f) * DotFactor; - else - coeff = DotFactor; - } + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); float factorMod = CalculateLevelPenalty(spellProto) * stack; - // level penalty still applied on Taken bonus - is it blizzlike? - TakenTotal+= int32(TakenAdvertisedBenefit * factorMod); + if (Player* modOwner = GetSpellModOwner()) { coeff *= 100.0f; @@ -10892,16 +10803,89 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage); - tmpDamage = (tmpDamage + TakenTotal) * TakenTotalMod; + return uint32(std::max(tmpDamage, 0.0f)); +} + +uint32 Unit::SpellDamageBonusTaken(SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) +{ + if (!spellProto || damagetype == DIRECT_DAMAGE) + return pdamage; + + int32 TakenTotal = 0; + float TakenTotalMod = 1.0f; + + //from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN + //multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) + TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask()); + + //.. taken pct: dummy auras + AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY); + for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) + { + switch ((*i)->GetSpellInfo()->SpellIconID) + { + // Cheat Death + case 2109: + if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) + { + if (GetTypeId() != TYPEID_PLAYER) + continue; + float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); + AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount()))); + } + break; + } + } + + // From caster spells + AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); + for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) + if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) + AddPctN(TakenTotalMod, (*i)->GetAmount()); + + // Mod damage from spell mechanic + if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask()) + { + AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); + for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) + if (mechanicMask & uint32(1<<((*i)->GetMiscValue()))) + AddPctN(TakenTotalMod, (*i)->GetAmount()); + } + + int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask()); + + // Check for table values + float coeff = 0; + SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); + if (bonus) + coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; + + // Default calculation + if (TakenAdvertisedBenefit) + { + if (!bonus || coeff < 0) + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); + + float factorMod = CalculateLevelPenalty(spellProto) * stack; + // level penalty still applied on Taken bonus - is it blizzlike? + if (Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); + coeff /= 100.0f; + } + TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod); + } + + float tmpDamage = (pdamage + TakenTotal) * TakenTotalMod; return uint32(std::max(tmpDamage, 0.0f)); } -int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) { int32 DoneAdvertisedBenefit = 0; - // ..done AuraEffectList const& mDamageDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE); for (AuraEffectList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i) if (((*i)->GetMiscValue() & schoolMask) != 0 && @@ -10937,19 +10921,11 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) return DoneAdvertisedBenefit > 0 ? DoneAdvertisedBenefit : 0; } -int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit* victim) +int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) { - uint32 creatureTypeMask = victim->GetCreatureTypeMask(); - int32 TakenAdvertisedBenefit = 0; - // ..done (for creature type by mask) in taken - AuraEffectList const& mDamageDoneCreature = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); - for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i) - if (creatureTypeMask & uint32((*i)->GetMiscValue())) - TakenAdvertisedBenefit += (*i)->GetAmount(); - // ..taken - AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); + AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) if (((*i)->GetMiscValue() & schoolMask) != 0) TakenAdvertisedBenefit += (*i)->GetAmount(); @@ -11218,23 +11194,19 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damag return damage; } -uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) { // For totems get healing bonus from owner (statue isn't totem in fact) if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem()) if (Unit* owner = GetOwner()) - return owner->SpellHealingBonus(victim, spellProto, healamount, damagetype, stack); + return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, stack); // no bonus for heal potions/bandages if (spellProto->SpellFamilyName == SPELLFAMILY_POTION) return healamount; - // Healing Done - // Taken/Done total percent damage auras float DoneTotalMod = 1.0f; - float TakenTotalMod = 1.0f; int32 DoneTotal = 0; - int32 TakenTotal = 0; // Healing done percent AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); @@ -11297,28 +11269,11 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 } } - // Taken/Done fixed damage bonus auras - int32 DoneAdvertisedBenefit = SpellBaseHealingBonus(spellProto->GetSchoolMask()); - int32 TakenAdvertisedBenefit = SpellBaseHealingBonusForVictim(spellProto->GetSchoolMask(), victim); - - bool scripted = false; - - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - { - switch (spellProto->Effects[i].ApplyAuraName) - { - // These auras do not use healing coeff - case SPELL_AURA_PERIODIC_LEECH: - case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: - scripted = true; - break; - } - if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) - scripted = true; - } + // Done fixed damage bonus auras + int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask()); // Check for table values - SpellBonusEntry const* bonus = !scripted ? sSpellMgr->GetSpellBonusData(spellProto->Id) : NULL; + SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); float coeff = 0; float factorMod = 1.0f; if (bonus) @@ -11338,94 +11293,53 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); } } - else // scripted bonus + + // Default calculation + if (DoneAdvertisedBenefit) { + if (!bonus || coeff < 0) + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells) + + factorMod *= CalculateLevelPenalty(spellProto) * stack; + + if (Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); + coeff /= 100.0f; + } + // Gift of the Naaru if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329) { - scripted = true; int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK))); if (apBonus > DoneAdvertisedBenefit) DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick else DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick } - // Earthliving - 0.45% of normal hot coeff - else if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) - factorMod *= 0.45f; - // Already set to scripted? so not uses healing bonus coefficient - // No heal coeff for SPELL_DAMAGE_CLASS_NONE class spells by default - else if (scripted || spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + else { - scripted = true; - coeff = 0.0f; + // Earthliving - 0.45% of normal hot coeff + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) + factorMod *= 0.45f; + + DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); } } - // Default calculation - if (DoneAdvertisedBenefit || TakenAdvertisedBenefit) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if ((!bonus && !scripted) || coeff < 0) - { - // Damage Done from spell damage bonus - int32 CastingTime = !spellProto->IsChanneled() ? spellProto->CalcCastTime() : spellProto->GetDuration(); - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if (damagetype == DOT) - { - int32 DotDuration = spellProto->GetDuration(); - // 200% limit - if (DotDuration > 0) - { - if (DotDuration > 30000) DotDuration = 30000; - if (!spellProto->IsChanneled()) DotFactor = DotDuration / 15000.0f; - uint32 x = 0; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; j++) - { - if (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && ( - spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || - spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - x = j; - break; - } - } - int32 DotTicks = 6; - if (spellProto->Effects[x].Amplitude != 0) - DotTicks = DotDuration / spellProto->Effects[x].Amplitude; - if (DotTicks) - { - DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks; - TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks; - } - } - } - // Distribute Damage over multiple effects, reduce by AoE - CastingTime = GetCastingTimeForBonus(spellProto, damagetype, CastingTime); - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH || - (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - CastingTime /= 2; - break; - } - } - // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells) - coeff = (CastingTime / 3500.0f) * DotFactor * 1.88f; - } - - factorMod *= CalculateLevelPenalty(spellProto) * stack; - // level penalty still applied on Taken bonus - is it blizzlike? - TakenTotal += int32(TakenAdvertisedBenefit * factorMod); - if (Player* modOwner = GetSpellModOwner()) + switch (spellProto->Effects[i].ApplyAuraName) { - coeff *= 100.0f; - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); - coeff /= 100.0f; + // Bonus healing does not apply to these spells + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: + DoneTotal = 0; + break; } - DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); + if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) + DoneTotal = 0; } // use float as more appropriate for negative values and percent applying @@ -11434,53 +11348,106 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal); - // Nourish cast - if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000) - { - // Rejuvenation, Regrowth, Lifebloom, or Wild Growth - if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x50, 0x4000010, 0)) - // increase healing by 20% - TakenTotalMod *= 1.2f; - } - - // Taken mods + return uint32(std::max(heal, 0.0f)); +} - // Tenacity increase healing % taken - if (AuraEffect const* Tenacity = victim->GetAuraEffect(58549, 0)) - AddPctN(TakenTotalMod, Tenacity->GetAmount()); +uint32 Unit::SpellHealingBonusTaken(SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +{ + float TakenTotalMod = 1.0f; // Healing taken percent - float minval = (float)victim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float minval = (float)GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if (minval) AddPctF(TakenTotalMod, minval); - float maxval = (float)victim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float maxval = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if (maxval) AddPctF(TakenTotalMod, maxval); + // Tenacity increase healing % taken + if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0)) + AddPctN(TakenTotalMod, Tenacity->GetAmount()); + + // Healing Done + int32 TakenTotal = 0; + + // Taken fixed damage bonus auras + int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(spellProto->GetSchoolMask()); + + // Nourish cast + if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000) + { + // Rejuvenation, Regrowth, Lifebloom, or Wild Growth + if (GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x50, 0x4000010, 0)) + // increase healing by 20% + TakenTotalMod *= 1.2f; + } + if (damagetype == DOT) { // Healing over time taken percent - float minval_hot = (float)victim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float minval_hot = (float)GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); if (minval_hot) AddPctF(TakenTotalMod, minval_hot); - float maxval_hot = (float)victim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float maxval_hot = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); if (maxval_hot) AddPctF(TakenTotalMod, maxval_hot); } - AuraEffectList const& mHealingGet= victim->GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); + // Check for table values + SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); + float coeff = 0; + float factorMod = 1.0f; + if (bonus) + coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; + + // Default calculation + if (TakenAdvertisedBenefit) + { + if (!bonus || coeff < 0) + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells) + + factorMod *= CalculateLevelPenalty(spellProto) * int32(stack); + if (Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); + coeff /= 100.0f; + } + + // Earthliving - 0.45% of normal hot coeff + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) + factorMod *= 0.45f; + + TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod); + } + + AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) if (GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) AddPctN(TakenTotalMod, (*i)->GetAmount()); - heal = (int32(heal) + TakenTotal) * TakenTotalMod; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + switch (spellProto->Effects[i].ApplyAuraName) + { + // Bonus healing does not apply to these spells + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: + TakenTotal = 0; + break; + } + if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) + TakenTotal = 0; + } + + float heal = (int32(healamount) + TakenTotal) * TakenTotalMod; return uint32(std::max(heal, 0.0f)); } -int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) { int32 AdvertisedBenefit = 0; @@ -11513,13 +11480,15 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) return AdvertisedBenefit; } -int32 Unit::SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit* victim) +int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) { int32 AdvertisedBenefit = 0; - AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_HEALING); + + AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING); for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) if (((*i)->GetMiscValue() & schoolMask) != 0) AdvertisedBenefit += (*i)->GetAmount(); + return AdvertisedBenefit; } @@ -11662,21 +11631,20 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons return false; } -void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attType, SpellInfo const* spellProto) +uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto) { if (!victim) - return; + return 0; - if (*pdamage == 0) - return; + if (pdamage == 0) + return 0; uint32 creatureTypeMask = victim->GetCreatureTypeMask(); - // Taken/Done fixed damage bonus auras + // Done fixed damage bonus auras int32 DoneFlatBenefit = 0; - int32 TakenFlatBenefit = 0; - // ..done (for creature type by mask) in taken + // ..done AuraEffectList const& mDamageDoneCreature = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i) if (creatureTypeMask & uint32((*i)->GetMiscValue())) @@ -11722,20 +11690,8 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT DoneFlatBenefit += int32(APbonus/14.0f * GetAPMultiplier(attType, normalized)); } - // ..taken - AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); - for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) - if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask()) - TakenFlatBenefit += (*i)->GetAmount(); - - if (attType != RANGED_ATTACK) - TakenFlatBenefit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN); - else - TakenFlatBenefit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN); - - // Done/Taken total percent damage auras + // Done total percent damage auras float DoneTotalMod = 1.0f; - float TakenTotalMod = 1.0f; // ..done AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); @@ -11841,11 +11797,43 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT break; } + float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod; + + // apply spellmod to Done damage + if (spellProto) + if (Player* modOwner = GetSpellModOwner()) + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage); + + // bonus result can be negative + return uint32(std::max(tmpDamage, 0.0f)); +} + +uint32 Unit::MeleeDamageBonusTaken(uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto) +{ + if (pdamage == 0) + return 0; + + int32 TakenFlatBenefit = 0; + // ..taken - TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask()); + AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); + for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) + if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask()) + TakenFlatBenefit += (*i)->GetAmount(); + + if (attType != RANGED_ATTACK) + TakenFlatBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN); + else + TakenFlatBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN); + + // Taken total percent damage auras + float TakenTotalMod = 1.0f; + + // ..taken + TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask()); // From caster spells - AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); + AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) AddPctN(TakenTotalMod, (*i)->GetAmount()); @@ -11862,7 +11850,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT if (mechanicMask) { - AuraEffectList const& mDamageDoneMechanic = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); + AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) if (mechanicMask & uint32(1<<((*i)->GetMiscValue()))) AddPctN(TakenTotalMod, (*i)->GetAmount()); @@ -11870,7 +11858,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT } // .. taken pct: dummy auras - AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY); + AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY); for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { switch ((*i)->GetSpellInfo()->SpellIconID) @@ -11879,9 +11867,9 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT case 2109: if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) { - if (victim->GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) continue; - float mod = victim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); + float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount()))); } break; @@ -11889,38 +11877,31 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT } // .. taken pct: class scripts - /*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i) - { - switch ((*i)->GetMiscValue()) - { - } - }*/ + //*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + //for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i) + //{ + // switch ((*i)->GetMiscValue()) + // { + // } + //}*/ if (attType != RANGED_ATTACK) { - AuraEffectList const& mModMeleeDamageTakenPercent = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT); + AuraEffectList const& mModMeleeDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT); for (AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i) AddPctN(TakenTotalMod, (*i)->GetAmount()); } else { - AuraEffectList const& mModRangedDamageTakenPercent = victim->GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT); + AuraEffectList const& mModRangedDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT); for (AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i) AddPctN(TakenTotalMod, (*i)->GetAmount()); } - float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod; - - // apply spellmod to Done damage - if (spellProto) - if (Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage); - - tmpDamage = (tmpDamage + TakenFlatBenefit) * TakenTotalMod; + float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod; // bonus result can be negative - *pdamage = uint32(std::max(tmpDamage, 0.0f)); + return uint32(std::max(tmpDamage, 0.0f)); } void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply) @@ -14501,7 +14482,8 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); SpellNonMeleeDamage damageInfo(this, target, spellInfo->Id, spellInfo->SchoolMask); - uint32 newDamage = SpellDamageBonus(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE); + uint32 newDamage = SpellDamageBonusDone(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE); + newDamage = target->SpellDamageBonusTaken(spellInfo, newDamage, SPELL_DIRECT_DAMAGE); CalculateSpellDamageTaken(&damageInfo, newDamage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); SendSpellNonMeleeDamageLog(&damageInfo); @@ -15028,7 +15010,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply) ApplyPercentModFloatValue(UNIT_MOD_CAST_SPEED, -val, apply); } -uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) +uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const { // Not apply this to creature casted spells with casttime == 0 if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet()) @@ -15101,20 +15083,21 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp if (AreaEffect) CastingTime /= 2; - // -5% of total per any additional effect - for (uint8 i = 0; i < effects; ++i) + // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) { - if (CastingTime > 175) - { - CastingTime -= 175; - } - else + if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH || + (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) { - CastingTime = 0; + CastingTime /= 2; break; } } + // -5% of total per any additional effect + for (uint8 i = 0; i < effects; ++i) + CastingTime *= 0.95f; + return CastingTime; } @@ -15145,6 +15128,29 @@ void Unit::UpdateAuraForGroup(uint8 slot) } } +float Unit::CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const +{ + // Damage over Time spells bonus calculation + float DotFactor = 1.0f; + if (damagetype == DOT) + { + + int32 DotDuration = spellInfo->GetDuration(); + if (!spellInfo->IsChanneled() && DotDuration > 0) + DotFactor = DotDuration / 15000.0f; + + if (uint32 DotTicks = spellInfo->GetMaxTicks()) + DotFactor /= DotTicks; + } + + int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime(); + // Distribute Damage over multiple effects, reduce by AoE + CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime); + + // As wowwiki says: C = (Cast Time / 3.5) + return (CastingTime / 3500.0f) * DotFactor; +} + float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized) { if (!normalized || GetTypeId() != TYPEID_PLAYER) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 5a6276d3b0c..e7ea70dc290 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2034,12 +2034,20 @@ class Unit : public WorldObject void UnsummonAllTotems(); Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo); Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL); - int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask); - int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask); - int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit* victim); - int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit* victim); - uint32 SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1); - uint32 SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + + int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask); + int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask); + uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellDamageBonusTaken(SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); + int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask); + int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask); + uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellHealingBonusTaken(SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + + uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL); + uint32 MeleeDamageBonusTaken(uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = NULL); + + bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isBlockCritical(); bool isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const; @@ -2051,8 +2059,8 @@ class Unit : public WorldObject void SetContestedPvP(Player* attackedPlayer = NULL); - void MeleeDamageBonus(Unit* victim, uint32 *damage, WeaponAttackType attType, SpellInfo const* spellProto = NULL); - uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime); + uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const; + float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const; uint32 GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index dbbd89c7533..d9368810945 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -490,7 +490,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->SpellFamilyFlags[1] & 0x1 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8) { // +80.68% from sp bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f; // Glyph of Ice Barrier: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :) // Glyph of Ice Barrier is only applied at the spell damage bonus because it was already applied to the base value in CalculateSpellDamage DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit); @@ -499,13 +499,13 @@ int32 AuraEffect::CalculateAmount(Unit* caster) else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x8 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8) { // +80.68% from sp bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f; } // Frost Ward else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8) { // +80.68% from sp bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f; } break; case SPELLFAMILY_WARLOCK: @@ -513,7 +513,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (m_spellInfo->SpellFamilyFlags[2] & 0x40) { // +80.68% from sp bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f; } break; case SPELLFAMILY_PRIEST: @@ -527,7 +527,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1)) bonus += CalculatePctN(1.0f, pAurEff->GetAmount()); - DoneActualBenefit += caster->SpellBaseHealingBonus(m_spellInfo->GetSchoolMask()) * bonus; + DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus; // Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :) // Improved PW: Shield is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit); @@ -555,7 +555,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) //+75.00% from sp bonus float bonus = 0.75f; - DoneActualBenefit += caster->SpellBaseHealingBonus(m_spellInfo->GetSchoolMask()) * bonus; + DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus; // Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit); DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo()); @@ -584,7 +584,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellFamilyFlags[0] & 0x8000 && m_spellInfo->SpellFamilyFlags[2] & 0x8) { // +80.53% from +spd bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8053f;; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8053f;; } break; case SPELL_AURA_DUMMY: @@ -592,9 +592,13 @@ int32 AuraEffect::CalculateAmount(Unit* caster) break; // Earth Shield if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[1] & 0x400) - amount = caster->SpellHealingBonus(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); + { + amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); + amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); + } break; case SPELL_AURA_PERIODIC_DAMAGE: + m_canBeRecalculated = true; if (!caster) break; // Rupture @@ -656,6 +660,9 @@ int32 AuraEffect::CalculateAmount(Unit* caster) amount = int32((float)amount / GetTotalTicks()); } break; + case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: + m_canBeRecalculated = true; + break; case SPELL_AURA_PERIODIC_ENERGIZE: if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) { @@ -672,6 +679,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)); break; case SPELL_AURA_PERIODIC_HEAL: + m_canBeRecalculated = true; if (!caster) break; // Lightwell Renew @@ -933,6 +941,7 @@ void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply) handleMask |= AURA_EFFECT_HANDLE_CHANGE_AMOUNT; if (onStackOrReapply) handleMask |= AURA_EFFECT_HANDLE_REAPPLY; + if (!handleMask) return; @@ -1259,7 +1268,7 @@ void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const caster->SendSpellDamageImmune(target, m_spellInfo->Id); } -void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const +void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) { bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp); if (prevented) @@ -4962,7 +4971,10 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool int32 stack = GetBase()->GetStackAmount(); int32 heal = m_amount; if (caster) - heal = caster->SpellHealingBonus(target, GetSpellInfo(), heal, HEAL, stack); + { + heal = caster->SpellHealingBonusDone(target, GetSpellInfo(), heal, HEAL, stack); + heal = target->SpellHealingBonusTaken(GetSpellInfo(), heal, HEAL, stack); + } target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID()); // restore mana @@ -6139,7 +6151,7 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* sLog->outDebug(LOG_FILTER_SPELLS_AURAS,"AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); } -void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const +void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) { if (!caster || !target->isAlive()) return; @@ -6190,7 +6202,10 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) { - damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + if (m_canBeRecalculated) + SetAmount(caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount())); + + damage = target->SpellDamageBonusTaken(GetSpellInfo(), GetAmount(), DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex())) @@ -6280,7 +6295,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); } -void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const +void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) { if (!caster || !target->isAlive()) return; @@ -6300,7 +6315,11 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); uint32 damage = std::max(GetAmount(), 0); - damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + + if (m_canBeRecalculated) + SetAmount(caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount())); + + damage = target->SpellDamageBonusTaken(GetSpellInfo(), GetAmount(), DOT, GetBase()->GetStackAmount()); bool crit = IsPeriodicTickCrit(target, caster); if (crit) @@ -6338,12 +6357,12 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c if (caster->isAlive()) caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); int32 new_damage = caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false); - if (caster->isAlive()) { float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster); - uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount())); + uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount())); + heal = uint32(caster->SpellHealingBonusTaken(GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount())); int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal); caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); @@ -6378,7 +6397,7 @@ void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) caster->HealBySpell(target, GetSpellInfo(), damage); } -void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const +void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) { if (!caster || !target->isAlive()) return; @@ -6447,7 +6466,10 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const damage += addition; } - damage = caster->SpellHealingBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + if (m_canBeRecalculated) + SetAmount(caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount())); + + damage = target->SpellHealingBonusTaken(GetSpellInfo(), GetAmount(), DOT, GetBase()->GetStackAmount()); } bool crit = IsPeriodicTickCrit(target, caster); @@ -6737,7 +6759,8 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv Unit* target = aurApp->GetTarget(); Unit* triggerTarget = eventInfo.GetProcTarget(); SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask); - uint32 damage = target->SpellDamageBonus(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE); + uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE); + damage = triggerTarget->SpellDamageBonusTaken(GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo()); target->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); target->SendSpellNonMeleeDamageLog(&damageInfo); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 64079918638..77742e17e51 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -83,7 +83,7 @@ class AuraEffect bool HasSpellClassMask() const { return m_spellInfo->Effects[m_effIndex].SpellClassMask; } void SendTickImmune(Unit* target, Unit* caster) const; - void PeriodicTick(AuraApplication * aurApp, Unit* caster) const; + void PeriodicTick(AuraApplication * aurApp, Unit* caster); void HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo); @@ -285,10 +285,10 @@ class AuraEffect void HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const; - void HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const; - void HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const; + void HandlePeriodicDamageAurasTick(Unit* target, Unit* caster); + void HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster); void HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) const; - void HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const; + void HandlePeriodicHealAurasTick(Unit* target, Unit* caster); void HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) const; void HandleObsModPowerAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) const; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 0bf91b1b6c5..b3169ce6fcc 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1212,8 +1212,11 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b // Improved Devouring Plague if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1)) { - int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellDamageBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT) / 100; + uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT); + damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT); + int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; int32 heal = int32(CalculatePctN(basepoints0, 15)); + caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0)); } @@ -1224,7 +1227,10 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b // Empowered Renew if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1)) { - int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellHealingBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL) / 100; + uint32 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL); + damage = target->SpellHealingBonusTaken(GetSpellInfo(), damage, HEAL); + + int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); } } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c72ccbacc3d..7a6030d634c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -467,7 +467,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (aura) { uint32 pdamage = uint32(std::max(aura->GetAmount(), 0)); - pdamage = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); + pdamage = m_caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); + pdamage = unitTarget->SpellDamageBonusTaken(aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1)); uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude); damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir)); @@ -505,7 +506,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) // Shadow Word: Death - deals damage equal to damage done to caster if (m_spellInfo->SpellFamilyFlags[1] & 0x2) { - int32 back_damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + int32 back_damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + back_damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, (uint32)back_damage, SPELL_DIRECT_DAMAGE); // Pain and Suffering reduces damage if (AuraEffect* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0)) AddPctN(back_damage, -aurEff->GetAmount()); @@ -712,7 +714,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) } if (m_originalCaster && damage > 0 && apply_direct_bonus) - damage = m_originalCaster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + { + damage = m_originalCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + } m_damage += damage; } @@ -1395,7 +1400,8 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex) return; // add spell damage bonus - damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) int32 power = damage; @@ -1558,7 +1564,10 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) int32 tickheal = targetAura->GetAmount(); if (Unit* auraCaster = targetAura->GetCaster()) - tickheal = auraCaster->SpellHealingBonus(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); + { + tickheal = auraCaster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); + tickheal = unitTarget->SpellHealingBonusTaken(targetAura->GetSpellInfo(), tickheal, DOT); + } //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included @@ -1582,7 +1591,8 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) // Glyph of Nourish else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x2000000) { - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); + addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); + addhealth = unitTarget->SpellHealingBonusTaken(m_spellInfo, addhealth, HEAL); if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0)) { @@ -1596,9 +1606,11 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) } // Death Pact - return pct of max health to caster else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000) - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL); + addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL); else - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); + addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); + + addhealth = unitTarget->SpellHealingBonusTaken(m_spellInfo, addhealth, HEAL); // Remove Grievious bite if fully healed if (unitTarget->HasAura(48920) && (unitTarget->GetHealth() + addhealth >= unitTarget->GetMaxHealth())) @@ -1624,7 +1636,10 @@ void Spell::EffectHealPct(SpellEffIndex /*effIndex*/) if (m_spellInfo->Id == 59754 && unitTarget == m_caster) return; - m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL); + uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL); + heal = unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); + + m_healing += heal; } void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/) @@ -1639,7 +1654,9 @@ void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/) if (!m_originalCaster) return; - m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(damage), HEAL); + uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, uint32(damage), HEAL); + + m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL);; } void Spell::EffectHealthLeech(SpellEffIndex effIndex) @@ -1650,7 +1667,8 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) if (!unitTarget || !unitTarget->isAlive() || damage < 0) return; - damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage); @@ -1662,7 +1680,9 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) if (m_caster->isAlive()) { - healthGain = m_caster->SpellHealingBonus(m_caster, m_spellInfo, healthGain, HEAL); + healthGain = m_caster->SpellHealingBonusDone(m_caster, m_spellInfo, healthGain, HEAL); + healthGain = m_caster->SpellHealingBonusTaken(m_spellInfo, healthGain, HEAL); + m_caster->HealBySpell(m_caster, m_spellInfo, uint32(healthGain)); } } @@ -3356,7 +3376,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) if (m_spellInfo->Id == 20467) { spell_bonus += int32(0.08f * m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); - spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask())); + spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask())); } break; } @@ -3525,8 +3545,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) uint32 eff_damage(std::max(weaponDamage, 0)); // Add melee damage bonuses (also check for negative) - m_caster->MeleeDamageBonus(unitTarget, &eff_damage, m_attackType, m_spellInfo); - m_damage += eff_damage; + uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo); + + m_damage += unitTarget->MeleeDamageBonusTaken(damage, m_attackType, m_spellInfo); } void Spell::EffectThreat(SpellEffIndex /*effIndex*/) @@ -3569,7 +3590,10 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth(); if (m_originalCaster) - m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); + { + uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); + m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); + } } void Spell::EffectInterruptCast(SpellEffIndex effIndex) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 07ab71207f1..7732908ac47 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1972,6 +1972,35 @@ uint32 SpellInfo::CalcCastTime(Unit* caster, Spell* spell) const return (castTime > 0) ? uint32(castTime) : 0; } +uint32 SpellInfo::GetMaxTicks() const +{ + int32 DotDuration = GetDuration(); + if (DotDuration == 0) + return 1; + + // 200% limit + if (DotDuration > 30000) + DotDuration = 30000; + + uint8 x = 0; + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + { + if (Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && ( + Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || + Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_HEAL || + Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) + { + x = j; + break; + } + } + + if (Effects[x].Amplitude != 0) + return DotDuration / Effects[x].Amplitude; + + return 6; +} + uint32 SpellInfo::GetRecoveryTime() const { return RecoveryTime > CategoryRecoveryTime ? RecoveryTime : CategoryRecoveryTime; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index b82f7dbd61d..54430cd7116 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -440,6 +440,8 @@ public: int32 GetDuration() const; int32 GetMaxDuration() const; + uint32 GetMaxTicks() const; + uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = NULL) const; uint32 GetRecoveryTime() const; diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 5d8e8f84e6a..891c7b79270 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -137,8 +137,9 @@ class spell_hun_chimera_shot : public SpellScriptLoader { int32 TickCount = aurEff->GetTotalTicks(); spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; - basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); + basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); ApplyPctN(basePoint, TickCount * 40); + basePoint = unitTarget->SpellDamageBonusTaken(aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. else if (familyFlag[1] & 0x00000080) diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 84e3bd8d604..00e89391a7e 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -449,7 +449,7 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader if (Unit* owner = caster->GetOwner()) { if (triggeringSpell) - damage = int32(owner->SpellHealingBonus(target, triggeringSpell, damage, HEAL)); + damage = int32(owner->SpellHealingBonusDone(target, triggeringSpell, damage, HEAL)); // Restorative Totems if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1)) @@ -458,6 +458,8 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader // Glyph of Healing Stream Totem if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0)) AddPctN(damage, aurEff->GetAmount()); + + damage = int32(target->SpellHealingBonusTaken(triggeringSpell, damage, HEAL)); } caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 3e4c043ae47..d2c35b514e1 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -181,7 +181,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader if (Unit* caster = GetCaster()) { // apply percent damage mods - damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); @@ -193,6 +193,9 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); damage = damage / ticks; + + damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); } } -- cgit v1.2.3 From 7f51c399c61ec538997b52f0a9508e6b78137b47 Mon Sep 17 00:00:00 2001 From: kaelima Date: Mon, 30 Apr 2012 02:07:59 +0200 Subject: Core/DBLayer: CHAR_DEL_CHAR_AURA_FROZEN query should be asynchronous Closes issue #6273 Also corrected one opcode name in Opcodes.cpp (changes nothing) --- src/server/game/Server/Protocol/Opcodes.cpp | 4 ++-- src/server/shared/Database/Implementation/CharacterDatabase.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index c6ccfaa8004..aa6013fae3d 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -76,7 +76,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x02F*/ { "SMSG_DEBUG_AISTATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x030*/ { "CMSG_DISABLE_PVP_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x031*/ { "CMSG_ADVANCE_SPAWN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, - /*0x032*/ { "SMSG_DESTRUCTIBLE_BUILDING_DAMAGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x032*/ { "SMSG_DESTRUCTIBLE_BUILDING_DAMAGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x033*/ { "CMSG_AUTH_SRP6_BEGIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x034*/ { "CMSG_AUTH_SRP6_PROOF", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x035*/ { "CMSG_AUTH_SRP6_RECODE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, @@ -558,7 +558,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x211*/ { "CMSG_GMTICKET_GETTICKET", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGMTicketGetTicketOpcode }, /*0x212*/ { "SMSG_GMTICKET_GETTICKET", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x213*/ { "CMSG_UNLEARN_TALENTS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, - /*0x214*/ { "SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x214*/ { "SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x215*/ { "SMSG_GAMEOBJECT_DESPAWN_ANIM", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x216*/ { "MSG_CORPSE_QUERY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleCorpseQueryOpcode }, /*0x217*/ { "CMSG_GMTICKET_DELETETICKET", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGMTicketDeleteOpcode }, diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 772a52b62cf..6bdf3ba9230 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -435,8 +435,8 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_PET_SPELL, "SELECT spell, active FROM pet_spell WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_PET_SPELL_COOLDOWN, "SELECT spell, time FROM pet_spell_cooldown WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_PET_DECLINED_NAME, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = ? AND id = ?", CONNECTION_SYNCH); - PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_BY_NAME, "SELECT characters.guid FROM characters WHERE characters.name = ?", CONNECTION_SYNCH); - PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA_FROZEN, "DELETE FROM character_aura WHERE character_aura.spell = 9454 AND character_aura.guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_BY_NAME, "SELECT guid FROM characters WHERE name = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA_FROZEN, "DELETE FROM character_aura WHERE spell = 9454 AND guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM character_inventory ci INNER JOIN item_instance ii ON ii.guid = ci.item WHERE itemEntry = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_MAIL_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM mail_items mi INNER JOIN item_instance ii ON ii.guid = mi.item_guid WHERE itemEntry = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM,"SELECT COUNT(itemEntry) FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE itemEntry = ?", CONNECTION_SYNCH); -- cgit v1.2.3 From a12faa5e9d4c27c6455fd16436d10321c6dd7693 Mon Sep 17 00:00:00 2001 From: Amit Date: Mon, 30 Apr 2012 13:53:25 +0300 Subject: Fix log typo with spell_group at SpellMgr.cpp --- src/server/game/Spells/SpellMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 64e1527b8d3..06e4978eb58 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1602,7 +1602,7 @@ void SpellMgr::LoadSpellGroups() uint32 group_id = fields[0].GetUInt32(); if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_groups` is in core range, but is not defined in core!", group_id); + sLog->outErrorDb("SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id); continue; } int32 spell_id = fields[1].GetInt32(); @@ -1618,7 +1618,7 @@ void SpellMgr::LoadSpellGroups() { if (groups.find(abs(itr->second)) == groups.end()) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_groups` does not exist", abs(itr->second)); + sLog->outErrorDb("SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second)); mSpellGroupSpell.erase(itr++); } else -- cgit v1.2.3 From 7a8f6b84c99929dc158fcecbfa55546bcc0020af Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Tue, 1 May 2012 02:11:44 +0200 Subject: Scripts/the_barrens: Fix quest "The Affray" and some cleanup. Closes: #4764 Also Closes: #6354 --- src/server/scripts/Kalimdor/the_barrens.cpp | 38 +++++++---------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index c56991e2553..933ad4de3eb 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -408,42 +408,26 @@ public: return; if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { - EventInProgress = false; DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); pWarrior->FailQuest(1719); - for (uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) // unsummon challengers { if (AffrayChallenger[i]) { Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]); - if (creature) { - if (creature->isAlive()) - { - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - creature->setDeathState(JUST_DIED); - } - } + if (creature && creature->isAlive()) + creature->DisappearAndDie(); } - AffrayChallenger[i] = 0; - Challenger_down[i] = false; } - if (BigWill) + if (BigWill) // unsummon bigWill { Creature* creature = Unit::GetCreature((*me), BigWill); - if (creature) - { - if (creature->isAlive()) - { - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - creature->setDeathState(JUST_DIED); - } - } + if (creature && creature->isAlive()) + creature->DisappearAndDie(); } - BigWill = 0; + Reset(); } if (!EventGrate && EventInProgress) @@ -453,7 +437,7 @@ public: if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { pWarrior->AreaExploredOrEventHappens(1719); - DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me); + DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me, pWarrior); for (uint8 i = 0; i < 6; ++i) { @@ -525,11 +509,7 @@ public: if (!creature || !creature->isAlive()) { DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me); - EventInProgress = false; - EventBigWill = false; - EventGrate = false; - PlayerGUID = 0; - Wave = 0; + Reset(); } } } else Wave_Timer -= diff; -- cgit v1.2.3 From a8a5b5a8f02bbb112abbb9ca418939f003c74a22 Mon Sep 17 00:00:00 2001 From: kandera Date: Thu, 3 May 2012 12:45:28 -0300 Subject: Core/Seasonal: move quest resetting to the beginning of the event. --- src/server/game/Events/GameEventMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index a8492726e75..d5e85d2cf2f 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1124,8 +1124,6 @@ void GameEventMgr::UnApplyEvent(uint16 event_id) UpdateEventNPCVendor(event_id, false); // update bg holiday UpdateBattlegroundSettings(); - // check for seasonal quest reset. - sWorld->ResetEventSeasonalQuests(event_id); } void GameEventMgr::ApplyNewEvent(uint16 event_id) @@ -1160,6 +1158,8 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id) UpdateEventNPCVendor(event_id, true); // update bg holiday UpdateBattlegroundSettings(); + // check for seasonal quest reset. + sWorld->ResetEventSeasonalQuests(event_id); } void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) -- cgit v1.2.3 From 58b05da8df4a0b330d55ccdd296730608b749490 Mon Sep 17 00:00:00 2001 From: MacWarrior Date: Fri, 4 May 2012 16:42:23 +0300 Subject: Fix creature's save --- src/server/game/Entities/Creature/Creature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index fde85feb8d9..acdf2b16f2a 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1128,7 +1128,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) stmt->setUInt8(index++, uint8(GetDefaultMovementType())); stmt->setUInt32(index++, npcflag); stmt->setUInt32(index++, unit_flags); - stmt->setUInt32(index, dynamicflags); + stmt->setUInt32(index++, dynamicflags); trans->Append(stmt); WorldDatabase.CommitTransaction(trans); -- cgit v1.2.3 From d94a89c4652e5ffd488c3cdaebd56df8b268bb3e Mon Sep 17 00:00:00 2001 From: Chaplain Date: Fri, 4 May 2012 18:35:11 +0300 Subject: Clean misused m_canBeRecalculated. *When we solve problem with m_amount we could make right solution for caster/victim damage calculation. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index d9368810945..172a5612000 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -598,7 +598,6 @@ int32 AuraEffect::CalculateAmount(Unit* caster) } break; case SPELL_AURA_PERIODIC_DAMAGE: - m_canBeRecalculated = true; if (!caster) break; // Rupture @@ -660,9 +659,6 @@ int32 AuraEffect::CalculateAmount(Unit* caster) amount = int32((float)amount / GetTotalTicks()); } break; - case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: - m_canBeRecalculated = true; - break; case SPELL_AURA_PERIODIC_ENERGIZE: if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) { @@ -679,7 +675,6 @@ int32 AuraEffect::CalculateAmount(Unit* caster) ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)); break; case SPELL_AURA_PERIODIC_HEAL: - m_canBeRecalculated = true; if (!caster) break; // Lightwell Renew @@ -6202,10 +6197,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) { - if (m_canBeRecalculated) - SetAmount(caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount())); - - damage = target->SpellDamageBonusTaken(GetSpellInfo(), GetAmount(), DOT, GetBase()->GetStackAmount()); + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex())) @@ -6316,10 +6309,8 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) uint32 damage = std::max(GetAmount(), 0); - if (m_canBeRecalculated) - SetAmount(caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount())); - - damage = target->SpellDamageBonusTaken(GetSpellInfo(), GetAmount(), DOT, GetBase()->GetStackAmount()); + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); bool crit = IsPeriodicTickCrit(target, caster); if (crit) @@ -6466,10 +6457,8 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) damage += addition; } - if (m_canBeRecalculated) - SetAmount(caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount())); - - damage = target->SpellHealingBonusTaken(GetSpellInfo(), GetAmount(), DOT, GetBase()->GetStackAmount()); + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellHealingBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); } bool crit = IsPeriodicTickCrit(target, caster); -- cgit v1.2.3 From 706a2d4175ceae1e05af349d0beba54156761689 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 5 May 2012 12:37:27 -0230 Subject: Core/Scripts: Remove core Forge of Souls trash scripts now done in SAI. --- .../FrozenHalls/ForgeOfSouls/forge_of_souls.cpp | 579 --------------------- 1 file changed, 579 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index 3158d58716f..1469e26fd20 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -18,53 +18,6 @@ #include "ScriptPCH.h" #include "forge_of_souls.h" -enum Spells -{ - //Spiteful Apparition - SPELL_SPITE = 68895, - H_SPELL_SPITE = 70212, - - //Spectral Warden - SPELL_VEIL_OF_SHADOWS = 69633, - SPELL_WAIL_OF_SOULS = 69148, - H_SPELL_WAIL_OF_SOULS = 70210, - - //Soulguard Watchman - SPELL_SHROUD_OF_RUNES = 69056, - SPELL_UNHOLY_RAGE = 69053, - - //Soulguard Reaper - SPELL_FROST_NOVA = 69060, - H_SPELL_FROST_NOVA = 70209, - SPELL_SHADOW_LANCE = 69058, - - //Soulguard Bonecaster - SPELL_BONE_VOLLEY = 69080, - H_SPELL_BONE_VOLLEY = 70206, - SPELL_RAISE_DEAD = 69562, - SPELL_SHIELD_OF_BONES = 69069, - H_SPELL_SHIELD_OF_BONES = 70207, - - //Soulguard Animator - // Raise dead 69562 - SPELL_SHADOW_BOLT = 69068, - H_SPELL_SHADOW_BOLT = 70208, - SPELL_SOUL_SICKNESS = 69131, - SPELL_SOUL_SIPHON = 69128, - - //Soulguard Adept - //Raise dead 69562 - //Shadow Bolt 69068/70208 - SPELL_DRAIN_LIFE = 69066, - H_SPELL_DRAIN_LIFE = 70213, - SPELL_SHADOW_MEND = 69564, - H_SPELL_SHADOW_MEND = 70205, - - //Soul Horror - SPELL_SOUL_STRIKE = 69088, - H_SPELL_SOUL_STRIKE = 70211, -}; - enum Events { EVENT_NONE, @@ -78,38 +31,6 @@ enum Events EVENT_INTRO_6, EVENT_INTRO_7, EVENT_INTRO_8, - - //Spiteful Apparition - EVENT_SPITE, - - //Spectral Warden - EVENT_VEIL_OF_SHADOWS, - EVENT_WAIL_OF_SOULS, - - //Soulguard Watchman - EVENT_SHROUD_OF_RUNES, - EVENT_UNHOLY_RAGE, - - //Soulguard Reaper - EVENT_FROST_NOVA, - EVENT_SHADOW_LANCE, - - //Soulguard Bonecaster - EVENT_BONE_VOLLEY, - EVENT_RAISE_DEAD, - EVENT_SHIELD_OF_BONES, - - //Soulguard Animator - EVENT_SHADOW_BOLT, - EVENT_SOUL_SICKNESS, - EVENT_SOUL_SIPHON, - - //Soulguard Adept - EVENT_DRAIN_LIFE, - EVENT_SHADOW_MEND, - - //Soul Horror - EVENT_SOUL_STRIKE, }; /****************************************SYLVANAS************************************/ @@ -410,508 +331,8 @@ public: } }; -class mob_spiteful_apparition : public CreatureScript -{ -public: - mob_spiteful_apparition() : CreatureScript("mob_spiteful_apparition") { } - - struct mob_spiteful_apparitionAI: public ScriptedAI - { - mob_spiteful_apparitionAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SPITE, 8000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SPITE: - DoCastVictim(SPELL_SPITE); - events.RescheduleEvent(EVENT_SPITE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_spiteful_apparitionAI(creature); - } -}; - -class mob_spectral_warden : public CreatureScript -{ -public: - mob_spectral_warden() : CreatureScript("mob_spectral_warden") { } - - struct mob_spectral_wardenAI: public ScriptedAI - { - mob_spectral_wardenAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_VEIL_OF_SHADOWS, 5000); - events.ScheduleEvent(EVENT_WAIL_OF_SOULS, 10000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_VEIL_OF_SHADOWS: - DoCastVictim(SPELL_VEIL_OF_SHADOWS); - events.RescheduleEvent(EVENT_VEIL_OF_SHADOWS, 10000); - return; - case EVENT_WAIL_OF_SOULS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_WAIL_OF_SOULS); - events.RescheduleEvent(EVENT_WAIL_OF_SOULS, 5000); - return; - } - } - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_spectral_wardenAI(creature); - } -}; - -class mob_soulguard_watchman : public CreatureScript -{ -public: - mob_soulguard_watchman() : CreatureScript("mob_soulguard_watchman") { } - - struct mob_soulguard_watchmanAI: public ScriptedAI - { - mob_soulguard_watchmanAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHROUD_OF_RUNES, 1000); - events.ScheduleEvent(EVENT_UNHOLY_RAGE, 1000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SHROUD_OF_RUNES: - DoCast(me, SPELL_SHROUD_OF_RUNES); - events.RescheduleEvent(EVENT_SHROUD_OF_RUNES, 5000); - return; - case EVENT_UNHOLY_RAGE: - DoCast(me, SPELL_UNHOLY_RAGE); - events.RescheduleEvent(EVENT_UNHOLY_RAGE, 99999); - return; - } - } - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_watchmanAI(creature); - } -}; - -class mob_soulguard_reaper : public CreatureScript -{ -public: - mob_soulguard_reaper() : CreatureScript("mob_soulguard_reaper") { } - - struct mob_soulguard_reaperAI: public ScriptedAI - { - mob_soulguard_reaperAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FROST_NOVA, 8000); - events.ScheduleEvent(EVENT_SHADOW_LANCE, 5000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_FROST_NOVA: - DoCast(me, SPELL_FROST_NOVA); - events.RescheduleEvent(EVENT_FROST_NOVA, 9600); - return; - case EVENT_SHADOW_LANCE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_LANCE); - events.RescheduleEvent(EVENT_SHADOW_LANCE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_reaperAI(creature); - } -}; - -class mob_soulguard_bonecaster : public CreatureScript -{ -public: - mob_soulguard_bonecaster() : CreatureScript("mob_soulguard_bonecaster") { } - - struct mob_soulguard_bonecasterAI: public ScriptedAI - { - mob_soulguard_bonecasterAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_BONE_VOLLEY, 6000); - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHIELD_OF_BONES, 6000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BONE_VOLLEY: - DoCastAOE(SPELL_BONE_VOLLEY); - events.RescheduleEvent(EVENT_BONE_VOLLEY, 7000); - return; - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHIELD_OF_BONES: - DoCast(me, SPELL_SHIELD_OF_BONES); - events.RescheduleEvent(EVENT_SHIELD_OF_BONES, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_bonecasterAI(creature); - } -}; - -class mob_soulguard_animator : public CreatureScript -{ -public: - mob_soulguard_animator() : CreatureScript("mob_soulguard_animator") { } - - struct mob_soulguard_animatorAI : public ScriptedAI - { - mob_soulguard_animatorAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 5000); - events.ScheduleEvent(EVENT_SOUL_SICKNESS, 8000); - events.ScheduleEvent(EVENT_SOUL_SIPHON, 10000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHADOW_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_BOLT); - events.RescheduleEvent(EVENT_SHADOW_BOLT, 5000); - return; - case EVENT_SOUL_SICKNESS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SOUL_SICKNESS); - events.RescheduleEvent(EVENT_SOUL_SICKNESS, 10000); - return; - case EVENT_SOUL_SIPHON: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SOUL_SIPHON); - events.RescheduleEvent(EVENT_SOUL_SIPHON, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_animatorAI(creature); - } -}; - -class mob_soulguard_adept : public CreatureScript -{ -public: - mob_soulguard_adept() : CreatureScript("mob_soulguard_adept") { } - - struct mob_soulguard_adeptAI: public ScriptedAI - { - mob_soulguard_adeptAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 8000); - events.ScheduleEvent(EVENT_DRAIN_LIFE, 7000); - events.ScheduleEvent(EVENT_SHADOW_MEND, 35000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHADOW_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_BOLT); - events.RescheduleEvent(EVENT_SHADOW_BOLT, 4000); - return; - case EVENT_DRAIN_LIFE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_DRAIN_LIFE); - events.RescheduleEvent(EVENT_DRAIN_LIFE, 9000); - return; - case EVENT_SHADOW_MEND: - DoCast(me, SPELL_SHADOW_MEND); - events.RescheduleEvent(EVENT_SHADOW_MEND, 20000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_adeptAI(creature); - } -}; - -class mob_soul_horror : public CreatureScript -{ -public: - mob_soul_horror() : CreatureScript("mob_soul_horror") { } - - struct mob_soul_horrorAI : public ScriptedAI - { - mob_soul_horrorAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SOUL_STRIKE, 6000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SOUL_STRIKE: - DoCast(me->getVictim(), SPELL_SOUL_STRIKE); - events.RescheduleEvent(EVENT_SOUL_STRIKE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soul_horrorAI(creature); - } -}; - void AddSC_forge_of_souls() { new npc_sylvanas_fos(); new npc_jaina_fos(); - new mob_spiteful_apparition(); - new mob_spectral_warden(); - new mob_soulguard_watchman(); - new mob_soulguard_reaper(); - new mob_soulguard_bonecaster(); - new mob_soulguard_animator(); - new mob_soulguard_adept(); - new mob_soul_horror(); } -- cgit v1.2.3 From f34e650fe0f6a2a6c5ade1e71064cd5575a3caf5 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 6 May 2012 02:37:31 +0200 Subject: Core/Accounts: Delete all bans related to an account when it has been deleted. --- src/server/game/Accounts/AccountMgr.cpp | 9 +++++++++ src/server/shared/Database/Implementation/CharacterDatabase.cpp | 1 + src/server/shared/Database/Implementation/CharacterDatabase.h | 1 + src/server/shared/Database/Implementation/LoginDatabase.cpp | 2 +- src/server/shared/Database/Implementation/LoginDatabase.h | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 9963ade54f9..8076f800356 100755 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -91,10 +91,15 @@ AccountOpResult DeleteAccount(uint32 accountId) stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS); stmt->setUInt32(0, accountId); CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ACCOUNT_DATA); stmt->setUInt32(0, accountId); CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_BAN); + stmt->setUInt32(0, accountId); + CharacterDatabase.Execute(stmt); + SQLTransaction trans = LoginDatabase.BeginTransaction(); stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT); @@ -109,6 +114,10 @@ AccountOpResult DeleteAccount(uint32 accountId) stmt->setUInt32(0, accountId); trans->Append(stmt); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_BANNED); + stmt->setUInt32(0, accountId); + trans->Append(stmt); + LoginDatabase.CommitTransaction(trans); return AOR_OK; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 6bdf3ba9230..d315c6417ea 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -33,6 +33,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_CHAR_CREATE_INFO, "SELECT level, race, class FROM characters WHERE account = ? LIMIT 0, ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_INS_CHARACTER_BAN, "INSERT INTO character_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_UPD_CHARACTER_BAN, "UPDATE character_banned SET active = 0 WHERE guid = ? AND active != 0", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_CHARACTER_BAN, "DELETE cb FROM character_banned cb INNER JOIN characters c ON c.guid = cb.guid WHERE c.account = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_BANINFO, "SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM character_banned WHERE guid = ? ORDER BY bandate ASC", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_GUID_BY_NAME_FILTER, "SELECT guid, name FROM characters WHERE name LIKE CONCAT('%%', ?, '%%')", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_BANINFO_LIST, "SELECT bandate, unbandate, bannedby, banreason FROM character_banned WHERE guid = ? ORDER BY unbandate", CONNECTION_SYNCH) diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index d2c9f3b3ac4..cf6bbd7bdfa 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -53,6 +53,7 @@ enum CharacterDatabaseStatements CHAR_SEL_CHAR_CREATE_INFO, CHAR_INS_CHARACTER_BAN, CHAR_UPD_CHARACTER_BAN, + CHAR_DEL_CHARACTER_BAN, CHAR_SEL_BANINFO, CHAR_SEL_GUID_BY_NAME_FILTER, CHAR_SEL_BANINFO_LIST, diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 70d874be31d..028d927a720 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -33,6 +33,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED_ALL, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 AND username LIKE CONCAT('%%', ?, '%%') GROUP BY account.id", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_INS_ACCOUNT_AUTO_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban', 1)", CONNECTION_ASYNC) + PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_SEL_SESSIONKEY, "SELECT a.sessionkey, a.id, aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username = ?", CONNECTION_SYNCH) PREPARE_STATEMENT(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_ASYNC) @@ -86,5 +87,4 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC); - } diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 2b9d94cbceb..7c2a94eec94 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -51,6 +51,7 @@ enum LoginDatabaseStatements LOGIN_SEL_ACCOUNT_BANNED_ALL, LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, LOGIN_INS_ACCOUNT_AUTO_BANNED, + LOGIN_DEL_ACCOUNT_BANNED, LOGIN_SEL_SESSIONKEY, LOGIN_UPD_VS, LOGIN_UPD_LOGONPROOF, -- cgit v1.2.3 From 85ca26c382914916f71d4c69d62fcbf8cf387dfa Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 5 May 2012 23:37:14 -0230 Subject: DB/SAI: Add SAI for Wrathbone Laborer, fix unit flags, remove cpp script. --- sql/updates/world/2012_05_05_03_world_sai.sql | 17 +++++ .../FrozenHalls/PitOfSaron/pit_of_saron.cpp | 76 ---------------------- 2 files changed, 17 insertions(+), 76 deletions(-) create mode 100644 sql/updates/world/2012_05_05_03_world_sai.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_05_03_world_sai.sql b/sql/updates/world/2012_05_05_03_world_sai.sql new file mode 100644 index 00000000000..fce3b5bc957 --- /dev/null +++ b/sql/updates/world/2012_05_05_03_world_sai.sql @@ -0,0 +1,17 @@ +-- Wrathbone Laborer SAI +SET @ENTRY := 36830; -- NPC entry +SET @SPELL1 := 70302; -- Blinding Dirt +SET @SPELL2 := 70278; -- Puncture Wound (Normal) +SET @SPELL3 := 70279; -- Puncture Wound (Heroic) +SET @SPELL4 := 69572; -- Shovelled! (Normal) +SET @SPELL5 := 70280; -- Shovelled! (Heroic) +UPDATE `creature_template` SET `unit_flags`=`unit_flags`&~256,`AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,6,7000,8000,10000,11000,11,@SPELL1,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Blinding Dirt'), +(@ENTRY,0,1,0,0,0,100,2,8000,9000,9000,10000,11,@SPELL2,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Puncture Wound (Normal)'), +(@ENTRY,0,2,0,0,0,100,4,8000,9000,9000,10000,11,@SPELL3,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Puncture Wound (Heroic)'), +(@ENTRY,0,3,0,0,0,100,2,5000,6000,7000,8000,11,@SPELL4,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Shovelled! (Normal)'), +(@ENTRY,0,4,0,0,0,100,4,5000,6000,7000,8000,11,@SPELL5,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Shovelled! (Heroic)'), +(@ENTRY,0,5,0,1,0,100,6,1000,3000,3000,3000,5,38,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Wrathbone Laborer - OOC - emote'); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index 70d72e52e67..b6c821ef66a 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -25,9 +25,6 @@ enum eSpells SPELL_HELLFIRE = 69586, SPELL_TACTICAL_BLINK = 69584, SPELL_FROST_BREATH = 69527, //Iceborn Proto-Drake - SPELL_BLINDING_DIRT = 70302, //Wrathbone Laborer - SPELL_PUNCTURE_WOUND = 70278, - SPELL_SHOVELLED = 69572, SPELL_LEAPING_FACE_MAUL = 69504, // Geist Ambusher }; @@ -36,11 +33,6 @@ enum eEvents // Ymirjar Flamebearer EVENT_FIREBALL = 1, EVENT_TACTICAL_BLINK = 2, - - //Wrathbone Laborer - EVENT_BLINDING_DIRT = 3, - EVENT_PUNCTURE_WOUND = 4, - EVENT_SHOVELLED = 5, }; class mob_ymirjar_flamebearer : public CreatureScript @@ -157,73 +149,6 @@ class mob_iceborn_protodrake : public CreatureScript } }; -class mob_wrathbone_laborer : public CreatureScript -{ - public: - mob_wrathbone_laborer() : CreatureScript("mob_wrathbone_laborer") { } - - struct mob_wrathbone_laborerAI: public ScriptedAI - { - mob_wrathbone_laborerAI(Creature* creature) : ScriptedAI(creature) - { - } - - void Reset() - { - _events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - _events.ScheduleEvent(EVENT_BLINDING_DIRT, 8000); - _events.ScheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - _events.ScheduleEvent(EVENT_SHOVELLED, 5000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = _events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BLINDING_DIRT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 10.0f, true)) - DoCast(target, SPELL_BLINDING_DIRT); - _events.RescheduleEvent(EVENT_BLINDING_DIRT, 10000); - return; - case EVENT_PUNCTURE_WOUND: - DoCastVictim(SPELL_PUNCTURE_WOUND); - _events.RescheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - return; - case EVENT_SHOVELLED: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, -5.0f)) - DoCast(target, SPELL_SHOVELLED); - _events.RescheduleEvent(EVENT_SHOVELLED, 7000); - return; - } - } - - DoMeleeAttackIfReady(); - } - - private: - EventMap _events; - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_wrathbone_laborerAI(creature); - } -}; - class mob_geist_ambusher : public CreatureScript { public: @@ -310,7 +235,6 @@ class spell_trash_mob_glacial_strike : public SpellScriptLoader void AddSC_pit_of_saron() { new mob_ymirjar_flamebearer(); - new mob_wrathbone_laborer(); new mob_iceborn_protodrake(); new mob_geist_ambusher(); new spell_trash_mob_glacial_strike(); -- cgit v1.2.3 From 7be70393e5b63118af0f5bad812b410d57d35fac Mon Sep 17 00:00:00 2001 From: kaelima Date: Mon, 7 May 2012 14:33:24 +0200 Subject: Movement/WaypointGenerator: Fix issue where waypoints with delay always would turn to 0.0 orientation --- .../game/Movement/MovementGenerators/WaypointMovementGenerator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 81fe1606ede..25730f92161 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -107,7 +107,7 @@ bool WaypointMovementGenerator::StartMove(Creature &creature) i_currentNode = (i_currentNode+1) % i_path->size(); } - const WaypointData *node = i_path->at(i_currentNode); + WaypointData const* node = i_path->at(i_currentNode); m_isArrivalDone = false; @@ -116,7 +116,8 @@ bool WaypointMovementGenerator::StartMove(Creature &creature) Movement::MoveSplineInit init(creature); init.MoveTo(node->x, node->y, node->z); - if (node->orientation != 100 && node->delay != 0) + //! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table + if (node->orientation && node->delay) init.SetFacing(node->orientation); init.SetWalk(!node->run); -- cgit v1.2.3 From 7386aafaf618af00d30521f106ada59ac4833c03 Mon Sep 17 00:00:00 2001 From: Svannon Date: Mon, 7 May 2012 16:57:28 -0600 Subject: Core/AI - Fix Evade Bug --- src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index 311b69c06b7..a8bdb698432 100755 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp @@ -25,7 +25,6 @@ void HomeMovementGenerator::Initialize(Creature & owner) { - owner.AddUnitState(UNIT_STATE_EVADE); _setTargetLocation(owner); } -- cgit v1.2.3 From d2a33afc373e5c56a222a59a7ce7701864821dc8 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 8 May 2012 09:15:52 -0400 Subject: Core/Items: fix deletion of items when the bag they are in gets deleted on load. also checks for items that have no real bag for possible expoits. --- src/server/game/Entities/Player/Player.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 7c70fe9358e..c285d8df788 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17606,6 +17606,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) uint32 zoneId = GetZoneId(); std::map bagMap; // fast guid lookup for bags + std::map invalidBagMap; // fast guid lookup for bags std::list problematicItems; SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -17650,9 +17651,15 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) // Remember bags that may contain items in them if (err == EQUIP_ERR_OK) + { if (IsBagPos(item->GetPos())) if (Bag* pBag = item->ToBag()) bagMap[item->GetGUIDLow()] = pBag; + } + else + if (IsBagPos(item->GetPos())) + if (Bag* pBag = item->ToBag()) + invalidBagMap[item->GetGUIDLow()] = pBag; } else { @@ -17666,6 +17673,17 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) if (err == EQUIP_ERR_OK) item = StoreItem(dest, item, true); } + else if (invalidBagMap.find(bagGuid) != invalidBagMap.end() && std::find(problematicItems.begin(),problematicItems.end(),(*invalidBagMap.find(bagGuid)))) + err = EQUIP_ERR_INT_BAG_ERROR; + else + { + sLog->outError("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); + item->DeleteFromInventoryDB(trans); + delete item; + continue; + } + } // Item's state may have changed after storing -- cgit v1.2.3 From 6c15bee88415006efe7111b6f7febd70b9a2ca50 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 8 May 2012 09:17:04 -0400 Subject: Core/AI: fix the call to help handler to use distance from the npc and not the victim of the npc. (thx shauren) --- src/server/game/Grids/Notifiers/GridNotifiers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index e81822e72be..6ca31b22e37 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -972,7 +972,7 @@ namespace Trinity return; // too far - if (!u->IsWithinDistInMap(i_enemy, i_range)) + if (!u->IsWithinDistInMap(i_funit, i_range)) return; // only if see assisted creature's enemy -- cgit v1.2.3 From 5fc2c8cda37151520cd1ac26def420c978dc54dd Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 8 May 2012 10:06:38 -0400 Subject: Core/Items: fix compile error from previous commit. use item instead of bag. --- src/server/game/Entities/Player/Player.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index c285d8df788..d38489ef5a9 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17606,7 +17606,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) uint32 zoneId = GetZoneId(); std::map bagMap; // fast guid lookup for bags - std::map invalidBagMap; // fast guid lookup for bags + std::map invalidBagMap; // fast guid lookup for bags std::list problematicItems; SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -17659,7 +17659,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) else if (IsBagPos(item->GetPos())) if (Bag* pBag = item->ToBag()) - invalidBagMap[item->GetGUIDLow()] = pBag; + invalidBagMap[item->GetGUIDLow()] = item; } else { @@ -17673,8 +17673,12 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) if (err == EQUIP_ERR_OK) item = StoreItem(dest, item, true); } - else if (invalidBagMap.find(bagGuid) != invalidBagMap.end() && std::find(problematicItems.begin(),problematicItems.end(),(*invalidBagMap.find(bagGuid)))) + else if (invalidBagMap.find(bagGuid) != invalidBagMap.end()) + { + std::map::iterator itr = invalidBagMap.find(bagGuid); + if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end()) err = EQUIP_ERR_INT_BAG_ERROR; + } else { sLog->outError("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?", -- cgit v1.2.3 From 1af30a9ea24f90abaefeb0782ccbd40d376da3ce Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 9 May 2012 01:48:18 +0200 Subject: Scripts/Wormhole: Add rare 6th option to "Underground". Fixed some teleport positions (from sniffs) And made some random cleanup for npc_shadowfiend and npc_lightwell --- .../2012_05_09_00_world_spell_target_position.sql | 7 + src/server/scripts/World/npcs_special.cpp | 201 +++++++++++---------- 2 files changed, 108 insertions(+), 100 deletions(-) create mode 100644 sql/updates/world/2012_05_09_00_world_spell_target_position.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_09_00_world_spell_target_position.sql b/sql/updates/world/2012_05_09_00_world_spell_target_position.sql new file mode 100644 index 00000000000..a6e9d7289b7 --- /dev/null +++ b/sql/updates/world/2012_05_09_00_world_spell_target_position.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_target_position` WHERE `id` IN (67834, 68081); +INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES +(67834, 571, 3167.01, 5586.04, 880.067, 0), +(68081, 571, 5857.252, 516.8015, 599.82, 2.987); + +UPDATE `spell_target_position` SET `target_position_x`=6136.89,`target_position_y`=4785.55,`target_position_z`=100.673 WHERE `id`=67835; +UPDATE `spell_target_position` SET `target_position_x`=8301.39,`target_position_y`=1501.34,`target_position_z`=870.555 WHERE `id`=67836; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index e1cfd077444..13880d240bf 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1975,33 +1975,31 @@ public: class npc_lightwell : public CreatureScript { -public: - npc_lightwell() : CreatureScript("npc_lightwell") { } - - struct npc_lightwellAI : public PassiveAI - { - npc_lightwellAI(Creature* creature) : PassiveAI(creature) {} + public: + npc_lightwell() : CreatureScript("npc_lightwell") { } - void Reset() + struct npc_lightwellAI : public PassiveAI { - DoCast(me, 59907, false); // Spell for Lightwell Charges - } + npc_lightwellAI(Creature* creature) : PassiveAI(creature) + { + DoCast(me, 59907, false); + } - void EnterEvadeMode() - { - if (!me->isAlive()) - return; + void EnterEvadeMode() + { + if (!me->isAlive()) + return; - me->DeleteThreatList(); - me->CombatStop(true); - me->ResetPlayerDamageReq(); - } - }; + me->DeleteThreatList(); + me->CombatStop(true); + me->ResetPlayerDamageReq(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_lightwellAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_lightwellAI(creature); + } }; enum eTrainingDummy @@ -2099,34 +2097,26 @@ public: class npc_shadowfiend : public CreatureScript { -public: - npc_shadowfiend() : CreatureScript("npc_shadowfiend") { } - - struct npc_shadowfiendAI : public ScriptedAI - { - npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {} + public: + npc_shadowfiend() : CreatureScript("npc_shadowfiend") { } - void DamageTaken(Unit* /*killer*/, uint32& damage) + struct npc_shadowfiendAI : public ScriptedAI { - if (me->isSummon()) - if (Unit* owner = me->ToTempSummon()->GetSummoner()) - if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth()) - owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); - } + npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {} - void UpdateAI(uint32 const /*diff*/) - { - if (!UpdateVictim()) - return; + void DamageTaken(Unit* /*killer*/, uint32& damage) + { + if (me->isSummon()) + if (Unit* owner = me->ToTempSummon()->GetSummoner()) + if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth()) + owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); + } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new npc_shadowfiendAI(creature); } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_shadowfiendAI(creature); - } }; /*###### @@ -2193,7 +2183,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_fire_elementalAI(creature); } @@ -2238,7 +2228,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_earth_elementalAI(creature); } @@ -2248,78 +2238,89 @@ public: # npc_wormhole ######*/ -#define GOSSIP_ENGINEERING1 "Borean Tundra." -#define GOSSIP_ENGINEERING2 "Howling Fjord." -#define GOSSIP_ENGINEERING3 "Sholazar Basin." -#define GOSSIP_ENGINEERING4 "Icecrown." -#define GOSSIP_ENGINEERING5 "Storm Peaks." +#define GOSSIP_ENGINEERING1 "Borean Tundra" +#define GOSSIP_ENGINEERING2 "Howling Fjord" +#define GOSSIP_ENGINEERING3 "Sholazar Basin" +#define GOSSIP_ENGINEERING4 "Icecrown" +#define GOSSIP_ENGINEERING5 "Storm Peaks" +#define GOSSIP_ENGINEERING6 "Underground..." -enum eWormhole +enum WormholeSpells { - SPELL_HOWLING_FJORD = 67838, + SPELL_BOREAN_TUNDRA = 67834, SPELL_SHOLAZAR_BASIN = 67835, SPELL_ICECROWN = 67836, SPELL_STORM_PEAKS = 67837, + SPELL_HOWLING_FJORD = 67838, + SPELL_UNDERGROUND = 68081, TEXT_WORMHOLE = 907 }; class npc_wormhole : public CreatureScript { -public: - npc_wormhole() : CreatureScript("npc_wormhole") { } + public: + npc_wormhole() : CreatureScript("npc_wormhole") + { + showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though + } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isSummon()) + bool OnGossipHello(Player* player, Creature* creature) { - if (player == creature->ToTempSummon()->GetSummoner()) + if (creature->isSummon()) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + if (player == creature->ToTempSummon()->GetSummoner()) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + + if (showUnderground) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID()); + player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID()); + } } + return true; } - return true; - } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - bool roll = urand(0, 1); - - switch (action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { - case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra - player->CLOSE_GOSSIP_MENU(); - if (roll) //At the moment we don't have chance on spell_target_position table so we hack this - player->TeleportTo(571, 4305.505859f, 5450.839844f, 63.005806f, 0.627286f); - else - player->TeleportTo(571, 3201.936279f, 5630.123535f, 133.658798f, 3.855272f); - break; - case GOSSIP_ACTION_INFO_DEF + 2: //Howling Fjord - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_HOWLING_FJORD, true); - break; - case GOSSIP_ACTION_INFO_DEF + 3: //Sholazar Basin - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_SHOLAZAR_BASIN, true); - break; - case GOSSIP_ACTION_INFO_DEF + 4: //Icecrown - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_ICECROWN, true); - break; - case GOSSIP_ACTION_INFO_DEF + 5: //Storm peaks - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_STORM_PEAKS, true); - break; + player->PlayerTalkClass->ClearMenus(); + + switch (action) + { + case GOSSIP_ACTION_INFO_DEF + 1: // Borean Tundra + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_BOREAN_TUNDRA, false); + break; + case GOSSIP_ACTION_INFO_DEF + 2: // Howling Fjord + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_HOWLING_FJORD, false); + break; + case GOSSIP_ACTION_INFO_DEF + 3: // Sholazar Basin + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_SHOLAZAR_BASIN, false); + break; + case GOSSIP_ACTION_INFO_DEF + 4: // Icecrown + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_ICECROWN, false); + break; + case GOSSIP_ACTION_INFO_DEF + 5: // Storm peaks + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_STORM_PEAKS, false); + break; + case GOSSIP_ACTION_INFO_DEF + 6: // Underground + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_UNDERGROUND, false); + break; + } + return true; } - return true; - } + private: + bool underGround; }; /*###### @@ -2865,7 +2866,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_fireworkAI(creature); } -- cgit v1.2.3 From 7d561c884ee35fc92a48e353a4a1d21b3ef43788 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 9 May 2012 02:25:46 +0200 Subject: Correct typo from 1af30a9ea24f90abaefeb0782ccbd40d376da3ce --- src/server/scripts/World/npcs_special.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 13880d240bf..9b100618235 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2320,7 +2320,7 @@ class npc_wormhole : public CreatureScript return true; } private: - bool underGround; + bool showUnderground; }; /*###### -- cgit v1.2.3 From d50b23d9f9d06225edc42b10893583d85bd58911 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 9 May 2012 03:08:34 +0200 Subject: Core/Transport: Set GAMEOBJECT_FLAGS from DB for transports, not hardcoded --- src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp | 2 +- src/server/game/Entities/Transport/Transport.cpp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 45335ae7b8b..ccc9493e234 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -931,7 +931,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period) float o = 1; // creates the Gameobject - if (!t->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), goEntry, mapid, x, y, z, o, 100, 0)) + if (!t->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), goEntry, mapid, x, y, z, o, 255, 0)) { delete t; return NULL; diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 81a505b7acc..9578605ac6f 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -52,7 +52,7 @@ void MapManager::LoadTransports() uint32 period = fields[3].GetUInt32(); uint32 scriptId = sObjectMgr->GetScriptId(fields[4].GetCString()); - const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(entry); + GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { @@ -86,7 +86,7 @@ void MapManager::LoadTransports() float o = 1.0f; // creates the Gameobject - if (!t->Create(lowguid, entry, mapid, x, y, z, o, 100, 0)) + if (!t->Create(lowguid, entry, mapid, x, y, z, o, 255, 0)) { delete t; continue; @@ -217,8 +217,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); - //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); - SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64)); + SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetEntry(goinfo->entry); -- cgit v1.2.3 From cb36825a3abd268470c6c6d70386ae6269ff3d8e Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 9 May 2012 13:49:49 +0200 Subject: Script/Wormhole: Correct randomize logic for underground option --- src/server/scripts/World/npcs_special.cpp | 36 +++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 9b100618235..ecd1a439a58 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2254,16 +2254,33 @@ enum WormholeSpells SPELL_HOWLING_FJORD = 67838, SPELL_UNDERGROUND = 68081, - TEXT_WORMHOLE = 907 + TEXT_WORMHOLE = 907, + + DATA_SHOW_UNDERGROUND = 1, }; class npc_wormhole : public CreatureScript { public: - npc_wormhole() : CreatureScript("npc_wormhole") + npc_wormhole() : CreatureScript("npc_wormhole") {} + + struct npc_wormholeAI : public PassiveAI { - showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though - } + npc_wormholeAI(Creature* creature) : PassiveAI(creature) {} + + void InitializeAI() + { + _showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though + } + + uint32 GetData(uint32 type) + { + return (type == DATA_SHOW_UNDERGROUND && _showUnderground) ? 1 : 0; + } + + private: + bool _showUnderground; + }; bool OnGossipHello(Player* player, Creature* creature) { @@ -2277,12 +2294,13 @@ class npc_wormhole : public CreatureScript player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - if (showUnderground) + if (creature->AI()->GetData(DATA_SHOW_UNDERGROUND)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID()); } } + return true; } @@ -2317,10 +2335,14 @@ class npc_wormhole : public CreatureScript creature->CastSpell(player, SPELL_UNDERGROUND, false); break; } + return true; } - private: - bool showUnderground; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_wormholeAI(creature); + } }; /*###### -- cgit v1.2.3 From 1fec4a5af240699758330fa4be0108ba00003878 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 9 May 2012 13:52:31 +0200 Subject: Core/Gameobject: Set artkit once in GameObject::Create --- src/server/game/Entities/GameObject/GameObject.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index f58dd6b2e4d..e871f99b38c 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -222,9 +222,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 SetGoType(GameobjectTypes(goinfo->type)); SetGoState(go_state); - - SetGoArtKit(0); // unknown what this is - SetByteValue(GAMEOBJECT_BYTES_1, 2, artKit); + SetGoArtKit(artKit); switch (goinfo->type) { -- cgit v1.2.3 From d6d45633c8ca34176d066755ba8be182b1ed7ac7 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 9 May 2012 10:07:18 -0400 Subject: Core/Commands: Add level 3 command for setting npc data. used for testing scripts. --- sql/updates/world/2012_05_09_01_world_commands.sql | 8 +++++ src/server/game/Miscellaneous/Language.h | 3 +- src/server/scripts/Commands/cs_npc.cpp | 34 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2012_05_09_01_world_commands.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_09_01_world_commands.sql b/sql/updates/world/2012_05_09_01_world_commands.sql new file mode 100644 index 00000000000..dcd4c9130eb --- /dev/null +++ b/sql/updates/world/2012_05_09_01_world_commands.sql @@ -0,0 +1,8 @@ +DELETE FROM `trinity_string` WHERE `entry` = 555; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES +(555,"SetData performed on [GUID: %u, entry: %u, name: %s] Field: %u, Data: %u, with %s"); + +DELETE FROM `command` WHERE `name` = "npc set data"; +INSERT INTO `command` (`name`,`security`,`help`) VALUES +("npc set data", 3, "Syntax: .npc set data $field $data +Sets data for the selected creature. Used for testing Scripting"); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 4b07d19bd7a..aec72835d86 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -522,8 +522,9 @@ enum TrinityStrings LANG_YOURS_EXPLORE_SET_ALL = 553, LANG_YOURS_EXPLORE_SET_NOTHING = 554, + LANG_NPC_SETDATA = 555, + //! Old ones now free: - // LANG_HOVER_ENABLED = 555, // LANG_HOVER_DISABLED = 556, LANG_YOURS_LEVEL_UP = 557, diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index a9959c60201..6089d256387 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -73,6 +73,7 @@ public: { "phase", SEC_GAMEMASTER, false, &HandleNpcSetPhaseCommand, "", NULL }, { "spawndist", SEC_GAMEMASTER, false, &HandleNpcSetSpawnDistCommand, "", NULL }, { "spawntime", SEC_GAMEMASTER, false, &HandleNpcSetSpawnTimeCommand, "", NULL }, + { "data", SEC_ADMINISTRATOR, false, &HandleNpcSetDataCommand, "", NULL }, //{ TODO: fix or remove these commands { "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "", NULL }, { "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "", NULL }, @@ -524,6 +525,39 @@ public: return true; } + //set data of creature for testing scripting + static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args) + { + if (!*args) + return false; + + char* arg1 = strtok((char*)args, " "); + char* arg2 = strtok((char*)NULL, ""); + + if (!arg1 || !arg2) + return false; + + uint32 data_1 = (uint32)atoi(arg1); + uint32 data_2 = (uint32)atoi(arg2); + + if (!data_1 || !data_2) + return false; + + Creature* creature = handler->getSelectedCreature(); + + if (!creature) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + 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); + return true; + } + //npc follow handling static bool HandleNpcFollowCommand(ChatHandler* handler, const char* /*args*/) { -- cgit v1.2.3 From 0f3db42ffc7e2d5a3c4985802dcafe0c5f075738 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 9 May 2012 12:14:31 -0400 Subject: Core/Commands: fix build error with non-pch builds --- src/server/scripts/Commands/cs_npc.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 6089d256387..2c5136ed428 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "Transport.h" #include "CreatureGroups.h" #include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand +#include "CreatureAI.h" class npc_commandscript : public CommandScript { -- cgit v1.2.3 From 890c7e64e17b1303809787255b09a9818ff46c50 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 9 May 2012 22:40:59 +0200 Subject: Battleground/Strand of the Ancients: Fix Achievement: Not Even a Scratch --- .../2012_05_09_02_achievement_criteria_data.sql | 6 ++++++ .../game/Battlegrounds/Zones/BattlegroundSA.cpp | 12 +++++++----- .../game/Battlegrounds/Zones/BattlegroundSA.h | 9 +++++++-- src/server/scripts/World/achievement_scripts.cpp | 22 ++++++++++++++++++++++ 4 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 sql/updates/world/2012_05_09_02_achievement_criteria_data.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_09_02_achievement_criteria_data.sql b/sql/updates/world/2012_05_09_02_achievement_criteria_data.sql new file mode 100644 index 00000000000..e1c0529fffe --- /dev/null +++ b/sql/updates/world/2012_05_09_02_achievement_criteria_data.sql @@ -0,0 +1,6 @@ +DELETE FROM `disables` WHERE `entry` IN (7626,7634) AND `sourceType`=4; + +DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (7626,7634); +INSERT INTO `achievement_criteria_data` (`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES +(7626, 11, 0, 0, 'achievement_not_even_a_scratch'), +(7634, 11, 0, 0, 'achievement_not_even_a_scratch'); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 977897b8d48..d20efbddbbe 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -56,6 +56,8 @@ void BattlegroundSA::Reset() GateStatus[i] = BG_SA_GATE_OK; ShipsStarted = false; gateDestroyed = false; + _notEvenAScratch[BG_TEAM_ALLIANCE] = true; + _notEvenAScratch[BG_TEAM_HORDE] = true; Status = BG_SA_WARMUP; } @@ -553,13 +555,13 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui SendWarningToAll(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name.c_str()); } -void BattlegroundSA::HandleKillUnit(Creature* unit, Player* killer) +void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer) { - if (!unit) - return; - - if (unit->GetEntry() == NPC_DEMOLISHER_SA) + if (creature->GetEntry() == NPC_DEMOLISHER_SA) + { UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1); + _notEvenAScratch[Attackers] = false; + } } /* diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index c18806490f2..fd11cb2c5ea 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -456,7 +456,7 @@ class BattlegroundSA : public Battleground /// Called when a player deal damage to building (door) virtual void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType); /// Called when a player kill a unit in bg - virtual void HandleKillUnit(Creature* unit, Player* killer); + virtual void HandleKillUnit(Creature* creature, Player* killer); /// Return the nearest graveyard where player can respawn virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); /// Called when a player click on flag (graveyard flag) @@ -531,9 +531,12 @@ class BattlegroundSA : public Battleground /// Update score board void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); - // Achievement Defense of the Ancients + // Achievement: Defense of the Ancients bool gateDestroyed; + // Achievement: Not Even a Scratch + bool notEvenAScratch(uint32 team) const { return _notEvenAScratch[GetTeamIndexByTeamId(team)]; } + /// Id of attacker team TeamId Attackers; @@ -615,5 +618,7 @@ class BattlegroundSA : public Battleground bool InitSecondRound; std::map DemoliserRespawnList; + // Achievement: Not Even a Scratch + bool _notEvenAScratch[BG_TEAMS_COUNT]; }; #endif diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index 9bcf450b3aa..3dc737f0c95 100755 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -313,6 +313,27 @@ class achievement_tilted : public AchievementCriteriaScript } }; +class achievement_not_even_a_scratch : public AchievementCriteriaScript +{ + public: + achievement_not_even_a_scratch() : AchievementCriteriaScript("achievement_not_even_a_scratch") { } + + bool OnCheck(Player* source, Unit* /*target*/) + { + if (!source) + return false; + + Battleground* battleground = source->GetBattleground(); + if (!battleground) + return false; + + if (static_cast(battleground)->notEvenAScratch(source->GetTeam())) + return true; + + return false; + } +}; + void AddSC_achievement_scripts() { new achievement_resilient_victory(); @@ -331,4 +352,5 @@ void AddSC_achievement_scripts() new achievement_arena_kills("achievement_arena_5v5_kills", ARENA_TYPE_5v5); new achievement_bg_sa_defense_of_ancients(); new achievement_tilted(); + new achievement_not_even_a_scratch(); } -- cgit v1.2.3 From 0ecd9e72d0745ed0e79f8730f808153139a795a1 Mon Sep 17 00:00:00 2001 From: Discover- Date: Thu, 10 May 2012 13:43:40 +0200 Subject: Scripts/Quests: Script quest Leave Nothing to Chance. Closes #1863 Closes #3087 Closes #2061 --- sql/updates/world/2012_05_10_01_world_misc.sql | 37 ++++++++++++++++ src/server/scripts/Spells/spell_quest.cpp | 58 ++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 sql/updates/world/2012_05_10_01_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_10_01_world_misc.sql b/sql/updates/world/2012_05_10_01_world_misc.sql new file mode 100644 index 00000000000..a7a30d518a2 --- /dev/null +++ b/sql/updates/world/2012_05_10_01_world_misc.sql @@ -0,0 +1,37 @@ +-- [Q] Leave Nothing to Chance + +-- Lower Wintergarde Mine Shaft and Upper Wintergarde Mine Shaft +UPDATE `creature_template` SET `MovementType`=0,`flags_extra`=`flags_extra`|128 WHERE `entry`IN (27437,27436); +UPDATE `creature` SET `MovementType`=0,`spawndist`=0 WHERE `id` IN (27437,27436); + +-- Wintergarde Mine Bomb SAI +SET @ENTRY := 27435; +SET @SPELL_EXPLOSION := 48742; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,1,1,0,100,1,14000,14000,0,0,11,@SPELL_EXPLOSION,2,0,0,0,0,1,0,0,0,0,0,0,0,"Wintergarde Mine Bomb - Out of Combat - Cast Wintergarde Mine Explosion"), +(@ENTRY,0,1,0,61,0,100,0,0,0,0,0,41,3000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wintergarde Mine Bomb - On Wintergarde Mine Explosion Cast - Forced Despawn"); + +-- Spawn missing spell focus object for upper mine +DELETE FROM `gameobject` WHERE `id`=188711 AND `guid`=370; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(370,188711,571,1,1,3898.18,-881.748,119.533,0.421023,0,0,0.20896,0.977924,300,0,1); + +-- Spawn missing Upper Wintergarde Mine Shaft +DELETE FROM `creature` WHERE `id`=27436 AND `guid`=42576; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES +(42576,27436,571,1,1,0,0,3899.86,-883.613,119.536,0.0636665,300,0,0,42,0,0,0,0,0); + +-- Spellscriptname +DELETE FROM `spell_script_names` WHERE `spell_id`=@SPELL_EXPLOSION; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(@SPELL_EXPLOSION,'spell_q12277_wintergarde_mine_explosion'); + +-- The conditions will make it works exactly like it should. Thanks a lot Josh. +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=@SPELL_EXPLOSION; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,@SPELL_EXPLOSION,0,31,3,27437,0,0,'',"Wintergarde Mine Explosion - Lower Wintergarde Mine Shaft"), -- Effect 0 - SPELL_EFFECT_DUMMY +(13,1,@SPELL_EXPLOSION,1,31,3,27436,0,0,'',"Wintergarde Mine Explosion - Upper Wintergarde Mine Shaft"), -- Effect 0 - SPELL_EFFECT_DUMMY +(13,2,@SPELL_EXPLOSION,0,31,4,0,0,0,'',"Wintergarde Mine Explosion - Targets Players"), -- Effect 1 - SPELL_EFFECT_KNOCK_BACK +(13,4,@SPELL_EXPLOSION,0,31,5,188712,0,0,'',"Wintergarde Mine Explosion - Wintergarde Mine Cave In (2)"); -- Effect 2 - SPELL_EFFECT_ACTIVATE_OBJECT diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 9d042da0789..87db81d2518 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1105,6 +1105,63 @@ public: } }; +enum LeaveNothingToChance +{ + NPC_UPPER_MINE_SHAFT = 27436, + NPC_LOWER_MINE_SHAFT = 27437, + + SPELL_UPPER_MINE_SHAFT_CREDIT = 48744, + SPELL_LOWER_MINE_SHAFT_CREDIT = 48745, +}; + +class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader +{ + public: + spell_q12277_wintergarde_mine_explosion() : SpellScriptLoader("spell_q12277_wintergarde_mine_explosion") { } + + class spell_q12277_wintergarde_mine_explosion_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12277_wintergarde_mine_explosion_SpellScript) + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* unitTarget = GetHitCreature()) + { + if (Unit* caster = GetCaster()) + { + if (caster->GetTypeId() == TYPEID_UNIT) + { + if (Unit* owner = caster->GetOwner()) + { + switch (unitTarget->GetEntry()) + { + case NPC_UPPER_MINE_SHAFT: + caster->CastSpell(owner, SPELL_UPPER_MINE_SHAFT_CREDIT, true); + break; + case NPC_LOWER_MINE_SHAFT: + caster->CastSpell(owner, SPELL_LOWER_MINE_SHAFT_CREDIT, true); + break; + default: + break; + } + } + } + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12277_wintergarde_mine_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12277_wintergarde_mine_explosion_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -1131,4 +1188,5 @@ void AddSC_quest_spell_scripts() new spell_q14112_14145_chum_the_water(); new spell_q9452_cast_net(); new spell_q12987_read_pronouncement(); + new spell_q12277_wintergarde_mine_explosion(); } -- cgit v1.2.3 From 70739ec9deb967cd64bc96791278018c0e7b97ea Mon Sep 17 00:00:00 2001 From: Discover- Date: Thu, 10 May 2012 13:50:22 +0200 Subject: Scripts/Commands: Fix compile under Linux (d6d45633c8ca34176d066755ba8be182b1ed7ac7). Credits go to @PuniCZ --- src/server/scripts/Commands/cs_npc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 2c5136ed428..832f7958fc8 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -555,7 +555,7 @@ 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); + handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript.c_str()); return true; } -- cgit v1.2.3 From 5057a8156dc0b2f8664ca952d1da2954f385b2f2 Mon Sep 17 00:00:00 2001 From: Discover- Date: Thu, 10 May 2012 13:52:22 +0200 Subject: Scripts/Quests: Fix compile from 0ecd9e72d0745ed0e79f8730f808153139a795a1 - sorry guys. Thanks @Vincent-Michael. --- src/server/scripts/Spells/spell_quest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 87db81d2518..810cc20e04b 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1118,11 +1118,11 @@ class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader { public: spell_q12277_wintergarde_mine_explosion() : SpellScriptLoader("spell_q12277_wintergarde_mine_explosion") { } - + class spell_q12277_wintergarde_mine_explosion_SpellScript : public SpellScript { - PrepareSpellScript(spell_q12277_wintergarde_mine_explosion_SpellScript) - + PrepareSpellScript(spell_q12277_wintergarde_mine_explosion_SpellScript); + void HandleDummy(SpellEffIndex /*effIndex*/) { if (Creature* unitTarget = GetHitCreature()) @@ -1149,13 +1149,13 @@ class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader } } } - + void Register() { OnEffectHitTarget += SpellEffectFn(spell_q12277_wintergarde_mine_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - + SpellScript* GetSpellScript() const { return new spell_q12277_wintergarde_mine_explosion_SpellScript(); -- cgit v1.2.3 From 469ba0b0e797c64040d0b4a3fbe371d8d5baa0b6 Mon Sep 17 00:00:00 2001 From: Chaplain Date: Thu, 10 May 2012 19:39:29 +0300 Subject: Clean up for 58f63509cd4 *restore const methods in spellauraeffects *fix typo in Unit::CalculateMeleeDamage thx bytewarrior *minor speed up in SpellInfo::GetMaxTicks() thx Warpten *deleted duble ';;' thx bytewarrior *speed up in SpellInfo::GetMaxTicks() thx goes to Vincent-Michael --- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 2 +- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 10 ++++----- src/server/game/Spells/Auras/SpellAuraEffects.h | 8 ++++---- src/server/game/Spells/SpellEffects.cpp | 2 +- src/server/game/Spells/SpellInfo.cpp | 24 ++++++++++------------ 6 files changed, 23 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 688d48b41ad..2243734f642 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -383,7 +383,7 @@ void npc_escortAI::FillPointMovementListForCreature() if (movePoints.empty()) return; - ScriptPointVector::const_iterator itrEnd = movePoints.end();; + ScriptPointVector::const_iterator itrEnd = movePoints.end(); for (ScriptPointVector::const_iterator itr = movePoints.begin(); itr != itrEnd; ++itr) { Escort_Waypoint point(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a04e2ac0e48..f4f41ff6b5f 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1151,7 +1151,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damage += CalculateDamage(damageInfo->attackType, false, true); // Add melee damage bonus damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType); - damage = MeleeDamageBonusTaken(damage, damageInfo->attackType); + damage = damageInfo->target->MeleeDamageBonusTaken(damage, damageInfo->attackType); // Calculate armor reduction if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask))) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index e3d220d744f..c14e79dfe78 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -584,7 +584,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellFamilyFlags[0] & 0x8000 && m_spellInfo->SpellFamilyFlags[2] & 0x8) { // +80.53% from +spd bonus - DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8053f;; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8053f; } break; case SPELL_AURA_DUMMY: @@ -1263,7 +1263,7 @@ void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const caster->SendSpellDamageImmune(target, m_spellInfo->Id); } -void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) +void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const { bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp); if (prevented) @@ -6146,7 +6146,7 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* sLog->outDebug(LOG_FILTER_SPELLS_AURAS,"AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); } -void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) +void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const { if (!caster || !target->isAlive()) return; @@ -6288,7 +6288,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); } -void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) +void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const { if (!caster || !target->isAlive()) return; @@ -6388,7 +6388,7 @@ void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) caster->HealBySpell(target, GetSpellInfo(), damage); } -void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) +void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const { if (!caster || !target->isAlive()) return; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 77742e17e51..64079918638 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -83,7 +83,7 @@ class AuraEffect bool HasSpellClassMask() const { return m_spellInfo->Effects[m_effIndex].SpellClassMask; } void SendTickImmune(Unit* target, Unit* caster) const; - void PeriodicTick(AuraApplication * aurApp, Unit* caster); + void PeriodicTick(AuraApplication * aurApp, Unit* caster) const; void HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo); @@ -285,10 +285,10 @@ class AuraEffect void HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const; - void HandlePeriodicDamageAurasTick(Unit* target, Unit* caster); - void HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster); + void HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const; + void HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) const; - void HandlePeriodicHealAurasTick(Unit* target, Unit* caster); + void HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const; void HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) const; void HandleObsModPowerAuraTick(Unit* target, Unit* caster) const; void HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) const; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 06493dd070a..ba3e54075a1 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1652,7 +1652,7 @@ void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/) uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, uint32(damage), HEAL); - m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL);; + m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); } void Spell::EffectHealthLeech(SpellEffIndex effIndex) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 7732908ac47..e9e1b0eee8d 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1982,22 +1982,20 @@ uint32 SpellInfo::GetMaxTicks() const if (DotDuration > 30000) DotDuration = 30000; - uint8 x = 0; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + for (uint8 x = 0; x < MAX_SPELL_EFFECTS; x++) { - if (Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && ( - Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || - Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_HEAL || - Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - x = j; - break; - } + if (Effects[x].Effect == SPELL_EFFECT_APPLY_AURA) + switch (Effects[x].ApplyAuraName) + { + case SPELL_AURA_PERIODIC_DAMAGE: + case SPELL_AURA_PERIODIC_HEAL: + case SPELL_AURA_PERIODIC_LEECH: + if (Effects[x].Amplitude != 0) + return DotDuration / Effects[x].Amplitude; + break; + } } - if (Effects[x].Amplitude != 0) - return DotDuration / Effects[x].Amplitude; - return 6; } -- cgit v1.2.3 From d8a1a0e05ada916705388af91a7f533350df8d9c Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 11 May 2012 13:12:09 +0200 Subject: Scripts/Pit of Saron: Unlock passage to Tyrannus after first 2 bosses are down. --- .../PitOfSaron/instance_pit_of_saron.cpp | 27 ++++++++++++++++++++++ .../FrozenHalls/PitOfSaron/pit_of_saron.h | 1 + 2 files changed, 28 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 24529801564..02782a22452 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -23,6 +23,12 @@ Position const SlaveLeaderPos = {689.7158f, -104.8736f, 513.7360f, 0.0f}; // position for Jaina and Sylvanas Position const EventLeaderPos2 = {1054.368f, 107.14620f, 628.4467f, 0.0f}; +DoorData const Doors[] = +{ + {GO_ICE_WALL, DATA_GARFROST, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_ICE_WALL, DATA_ICK, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, +}; + class instance_pit_of_saron : public InstanceMapScript { public: @@ -33,6 +39,7 @@ class instance_pit_of_saron : public InstanceMapScript instance_pit_of_saron_InstanceScript(Map* map) : InstanceScript(map) { SetBossNumber(MAX_ENCOUNTER); + LoadDoorData(Doors); _garfrostGUID = 0; _krickGUID = 0; _ickGUID = 0; @@ -154,6 +161,26 @@ class instance_pit_of_saron : public InstanceMapScript } } + void OnGameObjectCreate(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_ICE_WALL: + AddDoor(go, true); + break; + } + } + + void OnGameObjectRemove(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_ICE_WALL: + AddDoor(go, false); + break; + } + } + bool SetBossState(uint32 type, EncounterState state) { if (!InstanceScript::SetBossState(type, state)) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h index 728e0ccd955..4252f4f59a8 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h @@ -90,6 +90,7 @@ enum CreatureIds enum GameObjectIds { GO_SARONITE_ROCK = 196485, + GO_ICE_WALL = 201885, }; #endif -- cgit v1.2.3 From 4e354d6ca90b8aead894e95c8a55151f9b90027b Mon Sep 17 00:00:00 2001 From: joschiwald Date: Fri, 11 May 2012 22:43:06 +0200 Subject: Core/Spells: fix damage mods from caster on target --- src/server/game/Entities/Unit/Unit.cpp | 32 +++++++++++------------ src/server/game/Entities/Unit/Unit.h | 6 ++--- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 14 +++++----- src/server/game/Spells/Auras/SpellAuras.cpp | 4 +-- src/server/game/Spells/SpellEffects.cpp | 26 +++++++++--------- src/server/scripts/Spells/spell_hunter.cpp | 2 +- src/server/scripts/Spells/spell_shaman.cpp | 2 +- src/server/scripts/Spells/spell_warrior.cpp | 2 +- 8 files changed, 44 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f4f41ff6b5f..1783db9b14e 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -954,7 +954,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID); SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask); damage = SpellDamageBonusDone(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE); - damage = victim->SpellDamageBonusTaken(spellInfo, damage, SPELL_DIRECT_DAMAGE); + damage = victim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE); CalculateSpellDamageTaken(&damageInfo, damage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); @@ -1151,7 +1151,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damage += CalculateDamage(damageInfo->attackType, false, true); // Add melee damage bonus damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType); - damage = damageInfo->target->MeleeDamageBonusTaken(damage, damageInfo->attackType); + damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType); // Calculate armor reduction if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask))) @@ -1405,7 +1405,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) if (Unit* caster = (*dmgShieldItr)->GetCaster()) { damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE); - damage = this->SpellDamageBonusTaken(i_spellProto, damage, SPELL_DIRECT_DAMAGE); + damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE); } // No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that @@ -3660,7 +3660,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId if (Unit* caster = aura->GetCaster()) { healAmount = caster->SpellHealingBonusDone(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); - healAmount = this->SpellHealingBonusTaken(aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); + healAmount = this->SpellHealingBonusTaken(caster, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); } CastCustomSpell(this, 33778, &healAmount, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); @@ -10806,7 +10806,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin return uint32(std::max(tmpDamage, 0.0f)); } -uint32 Unit::SpellDamageBonusTaken(SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) { if (!spellProto || damagetype == DIRECT_DAMAGE) return pdamage; @@ -10840,7 +10840,7 @@ uint32 Unit::SpellDamageBonusTaken(SpellInfo const* spellProto, uint32 pdamage, // From caster spells AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) + if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) AddPctN(TakenTotalMod, (*i)->GetAmount()); // Mod damage from spell mechanic @@ -11351,7 +11351,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui return uint32(std::max(heal, 0.0f)); } -uint32 Unit::SpellHealingBonusTaken(SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) { float TakenTotalMod = 1.0f; @@ -11425,7 +11425,7 @@ uint32 Unit::SpellHealingBonusTaken(SpellInfo const *spellProto, uint32 healamou AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) - if (GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) + if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) AddPctN(TakenTotalMod, (*i)->GetAmount()); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) @@ -11808,7 +11808,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType return uint32(std::max(tmpDamage, 0.0f)); } -uint32 Unit::MeleeDamageBonusTaken(uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto) +uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto) { if (pdamage == 0) return 0; @@ -11832,15 +11832,15 @@ uint32 Unit::MeleeDamageBonusTaken(uint32 pdamage, WeaponAttackType attType, Spe // ..taken TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask()); - // From caster spells - AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); - for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) - AddPctN(TakenTotalMod, (*i)->GetAmount()); - // .. taken pct (special attacks) if (spellProto) { + // From caster spells + AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); + for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) + if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) + AddPctN(TakenTotalMod, (*i)->GetAmount()); + // Mod damage from spell mechanic uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask(); @@ -14483,7 +14483,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); SpellNonMeleeDamage damageInfo(this, target, spellInfo->Id, spellInfo->SchoolMask); uint32 newDamage = SpellDamageBonusDone(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE); - newDamage = target->SpellDamageBonusTaken(spellInfo, newDamage, SPELL_DIRECT_DAMAGE); + newDamage = target->SpellDamageBonusTaken(this, spellInfo, newDamage, SPELL_DIRECT_DAMAGE); CalculateSpellDamageTaken(&damageInfo, newDamage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); SendSpellNonMeleeDamageLog(&damageInfo); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index e7ea70dc290..c3cfc415c41 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2038,14 +2038,14 @@ class Unit : public WorldObject int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask); int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask); uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); - uint32 SpellDamageBonusTaken(SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask); int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask); uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); - uint32 SpellHealingBonusTaken(SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL); - uint32 MeleeDamageBonusTaken(uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = NULL); + uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = NULL); bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index c14e79dfe78..bdbc5cb79d1 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -594,7 +594,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[1] & 0x400) { amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); - amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); + amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); } break; case SPELL_AURA_PERIODIC_DAMAGE: @@ -4968,7 +4968,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (caster) { heal = caster->SpellHealingBonusDone(target, GetSpellInfo(), heal, HEAL, stack); - heal = target->SpellHealingBonusTaken(GetSpellInfo(), heal, HEAL, stack); + heal = target->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, HEAL, stack); } target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID()); @@ -6198,7 +6198,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) { damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); - damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex())) @@ -6310,7 +6310,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c uint32 damage = std::max(GetAmount(), 0); damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); - damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); bool crit = IsPeriodicTickCrit(target, caster); if (crit) @@ -6353,7 +6353,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster); uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount())); - heal = uint32(caster->SpellHealingBonusTaken(GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount())); + heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount())); int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal); caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); @@ -6458,7 +6458,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const } damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); - damage = target->SpellHealingBonusTaken(GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); } bool crit = IsPeriodicTickCrit(target, caster); @@ -6749,7 +6749,7 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv Unit* triggerTarget = eventInfo.GetProcTarget(); SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask); uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE); - damage = triggerTarget->SpellDamageBonusTaken(GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo()); target->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); target->SendSpellNonMeleeDamageLog(&damageInfo); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index b3169ce6fcc..4dda1c731a7 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1213,7 +1213,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1)) { uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT); - damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, DOT); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT); int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; int32 heal = int32(CalculatePctN(basepoints0, 15)); @@ -1228,7 +1228,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1)) { uint32 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL); - damage = target->SpellHealingBonusTaken(GetSpellInfo(), damage, HEAL); + damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, HEAL); int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index ba3e54075a1..b1a3cd687df 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -468,7 +468,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) { uint32 pdamage = uint32(std::max(aura->GetAmount(), 0)); pdamage = m_caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); - pdamage = unitTarget->SpellDamageBonusTaken(aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); + pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1)); uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude); damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir)); @@ -507,7 +507,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (m_spellInfo->SpellFamilyFlags[1] & 0x2) { int32 back_damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); - back_damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, (uint32)back_damage, SPELL_DIRECT_DAMAGE); + back_damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, (uint32)back_damage, SPELL_DIRECT_DAMAGE); // Pain and Suffering reduces damage if (AuraEffect* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0)) AddPctN(back_damage, -aurEff->GetAmount()); @@ -716,7 +716,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (m_originalCaster && damage > 0 && apply_direct_bonus) { damage = m_originalCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); - damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_originalCaster, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); } m_damage += damage; @@ -1397,7 +1397,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex) // add spell damage bonus damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); - damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) int32 power = damage; @@ -1562,7 +1562,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) if (Unit* auraCaster = targetAura->GetCaster()) { tickheal = auraCaster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); - tickheal = unitTarget->SpellHealingBonusTaken(targetAura->GetSpellInfo(), tickheal, DOT); + tickheal = unitTarget->SpellHealingBonusTaken(auraCaster, targetAura->GetSpellInfo(), tickheal, DOT); } //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included @@ -1588,7 +1588,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x2000000) { addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - addhealth = unitTarget->SpellHealingBonusTaken(m_spellInfo, addhealth, HEAL); + addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0)) { @@ -1606,7 +1606,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) else addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - addhealth = unitTarget->SpellHealingBonusTaken(m_spellInfo, addhealth, HEAL); + addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); // Remove Grievious bite if fully healed if (unitTarget->HasAura(48920) && (unitTarget->GetHealth() + addhealth >= unitTarget->GetMaxHealth())) @@ -1633,7 +1633,7 @@ void Spell::EffectHealPct(SpellEffIndex /*effIndex*/) return; uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL); - heal = unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); + heal = unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); m_healing += heal; } @@ -1652,7 +1652,7 @@ void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/) uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, uint32(damage), HEAL); - m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); + m_healing += unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); } void Spell::EffectHealthLeech(SpellEffIndex effIndex) @@ -1664,7 +1664,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) return; damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); - damage = unitTarget->SpellDamageBonusTaken(m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage); @@ -1677,7 +1677,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) if (m_caster->isAlive()) { healthGain = m_caster->SpellHealingBonusDone(m_caster, m_spellInfo, healthGain, HEAL); - healthGain = m_caster->SpellHealingBonusTaken(m_spellInfo, healthGain, HEAL); + healthGain = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, healthGain, HEAL); m_caster->HealBySpell(m_caster, m_spellInfo, uint32(healthGain)); } @@ -3543,7 +3543,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Add melee damage bonuses (also check for negative) uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo); - m_damage += unitTarget->MeleeDamageBonusTaken(damage, m_attackType, m_spellInfo); + m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damage, m_attackType, m_spellInfo); } void Spell::EffectThreat(SpellEffIndex /*effIndex*/) @@ -3588,7 +3588,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) if (m_originalCaster) { uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - m_healing += unitTarget->SpellHealingBonusTaken(m_spellInfo, heal, HEAL); + m_healing += unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); } } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 53a78e42c3c..896ed331bde 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -139,7 +139,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); ApplyPctN(basePoint, TickCount * 40); - basePoint = unitTarget->SpellDamageBonusTaken(aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); + basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. else if (familyFlag[1] & 0x00000080) diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 7e2756f28a5..f50dbb7773d 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -498,7 +498,7 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0)) AddPctN(damage, aurEff->GetAmount()); - damage = int32(target->SpellHealingBonusTaken(triggeringSpell, damage, HEAL)); + damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL)); } caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index bb271139b6a..194753d6e90 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -194,7 +194,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = damage / ticks; - damage = target->SpellDamageBonusTaken(GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); } -- cgit v1.2.3 From d770c125e97cf4313d2c32adbb6d9ceab308d477 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 12 May 2012 12:19:41 -0230 Subject: Core/Scripts: Fix Halls of Reflection Portcullis door in Pit of Saron. Now requires Tyrannus boss kill to open. --- sql/updates/world/2012_05_12_00_world_gameobject_template.sql | 2 ++ .../Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp | 7 +++++++ src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h | 1 + 3 files changed, 10 insertions(+) create mode 100644 sql/updates/world/2012_05_12_00_world_gameobject_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_12_00_world_gameobject_template.sql b/sql/updates/world/2012_05_12_00_world_gameobject_template.sql new file mode 100644 index 00000000000..ffa932c8640 --- /dev/null +++ b/sql/updates/world/2012_05_12_00_world_gameobject_template.sql @@ -0,0 +1,2 @@ +-- Lock Halls of Reflection Portcullis +UPDATE `gameobject_template` SET `flags`=18 WHERE `entry`=201848; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 02782a22452..c75bdb8095f 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -27,6 +27,7 @@ DoorData const Doors[] = { {GO_ICE_WALL, DATA_GARFROST, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, {GO_ICE_WALL, DATA_ICK, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_HALLS_OF_REFLECTION_PORTCULLIS, DATA_TYRANNUS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, }; class instance_pit_of_saron : public InstanceMapScript @@ -168,6 +169,9 @@ class instance_pit_of_saron : public InstanceMapScript case GO_ICE_WALL: AddDoor(go, true); break; + case GO_HALLS_OF_REFLECTION_PORTCULLIS: + AddDoor(go, true); + break; } } @@ -178,6 +182,9 @@ class instance_pit_of_saron : public InstanceMapScript case GO_ICE_WALL: AddDoor(go, false); break; + case GO_HALLS_OF_REFLECTION_PORTCULLIS: + AddDoor(go, true); + break; } } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h index 4252f4f59a8..768c3ba40ec 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h @@ -91,6 +91,7 @@ enum GameObjectIds { GO_SARONITE_ROCK = 196485, GO_ICE_WALL = 201885, + GO_HALLS_OF_REFLECTION_PORTCULLIS = 201848, }; #endif -- cgit v1.2.3 From 8a1417ae750765e1013f428545c8a49da6aa4e92 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 12 May 2012 12:23:21 -0230 Subject: Core/Scripts: Fix for previous --- .../scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index c75bdb8095f..fa7b027961c 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -183,7 +183,7 @@ class instance_pit_of_saron : public InstanceMapScript AddDoor(go, false); break; case GO_HALLS_OF_REFLECTION_PORTCULLIS: - AddDoor(go, true); + AddDoor(go, false); break; } } -- cgit v1.2.3 From fa3ee22849e5f1634caedd75c7d28f031839a1a3 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 12 May 2012 12:49:36 -0230 Subject: Core/Script: Optimize code for previous commit for Pit of Saron. --- .../Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index fa7b027961c..1301acf4c99 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -167,8 +167,6 @@ class instance_pit_of_saron : public InstanceMapScript switch (go->GetEntry()) { case GO_ICE_WALL: - AddDoor(go, true); - break; case GO_HALLS_OF_REFLECTION_PORTCULLIS: AddDoor(go, true); break; @@ -180,8 +178,6 @@ class instance_pit_of_saron : public InstanceMapScript switch (go->GetEntry()) { case GO_ICE_WALL: - AddDoor(go, false); - break; case GO_HALLS_OF_REFLECTION_PORTCULLIS: AddDoor(go, false); break; -- cgit v1.2.3 From 024a39af9f4c78dadadb5bfbde46ca1eaaf97f89 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 12 May 2012 21:11:41 +0200 Subject: Core: Tweaked ASSERT macro a bit - removed library assert as on Windows platforms it calls abort() and does not generaty crash dump files. --- src/server/shared/Debugging/Errors.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h index 6927fdb483f..48a8bda32ed 100755 --- a/src/server/shared/Debugging/Errors.h +++ b/src/server/shared/Debugging/Errors.h @@ -24,10 +24,10 @@ #include #include -#define WPAssert( assertion ) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError( "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); assert( #assertion &&0 ); ((void(*)())NULL)();} } -#define WPError( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); } -#define WPWarning( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); } -#define WPFatal( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); ACE_OS::sleep(10); assert( #assertion &&0 ); abort(); } +#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError("\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } } +#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError("%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } } +#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } } +#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } } #define ASSERT WPAssert #endif -- cgit v1.2.3 From 5709929d2b575e83f427c7f48cd6bd0d7ed1b29d Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 11:33:42 -0230 Subject: Core/Threat: Fix by faq. Turning gm on, now drops threat. Dead mobs no longer holds threat on player. Also fixed some Engrish. --- src/server/game/Combat/ThreatManager.cpp | 4 ++++ src/server/game/Entities/Creature/Creature.cpp | 10 +++++----- src/server/game/Entities/Unit/Unit.cpp | 9 ++++++--- src/server/game/Entities/Unit/Unit.h | 2 +- .../scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index e604eaf9024..104d2d3d52b 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -535,6 +535,10 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat setCurrentVictim(NULL); setDirty(true); } + if (getOwner() && getOwner()->IsInWorld()) + if (Unit* target = ObjectAccessor::GetUnit(*getOwner(), hostilRef->getUnitGuid())) + if (getOwner()->IsInMap(target)) + getOwner()->SendRemoveFromThreatListOpcode(hostilRef); iThreatContainer.remove(hostilRef); iThreatOfflineContainer.addReference(hostilRef); } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index acdf2b16f2a..d120713636d 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -468,9 +468,9 @@ void Creature::Update(uint32 diff) switch (m_deathState) { - case JUST_ALIVED: - // Must not be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. - sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)", GetGUIDLow(), GetEntry()); + case JUST_RESPAWNED: + // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting. + sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry()); break; case JUST_DIED: // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. @@ -1555,7 +1555,7 @@ void Creature::setDeathState(DeathState s) Unit::setDeathState(CORPSE); } - else if (s == JUST_ALIVED) + else if (s == JUST_RESPAWNED) { //if (isPet()) // setActive(true); @@ -1611,7 +1611,7 @@ void Creature::Respawn(bool force) CreatureTemplate const* cinfo = GetCreatureTemplate(); SelectLevel(cinfo); - setDeathState(JUST_ALIVED); + setDeathState(JUST_RESPAWNED); uint32 displayID = GetNativeDisplayId(); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1783db9b14e..18b4b79a502 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12823,9 +12823,8 @@ void Unit::setDeathState(DeathState s) { // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that // it can be used to check creation of death items (such as soul shards). - m_deathState = s; - if (s != ALIVE && s != JUST_ALIVED) + if (s != ALIVE && s != JUST_RESPAWNED) { CombatStop(); DeleteThreatList(); @@ -12868,8 +12867,12 @@ void Unit::setDeathState(DeathState s) if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript()) zoneScript->OnUnitDeath(this); } - else if (s == JUST_ALIVED) + else if (s == JUST_RESPAWNED) + { RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) + } + + m_deathState = s; } /*######################################## diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index c3cfc415c41..2d6c5b1a86e 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -465,7 +465,7 @@ enum DeathState JUST_DIED = 1, CORPSE = 2, DEAD = 3, - JUST_ALIVED = 4, + JUST_RESPAWNED = 4, }; enum UnitState diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 5b208768b0c..fab9a5f0740 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1290,7 +1290,7 @@ struct npc_argent_captainAI : public ScriptedAI if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead) { IsUndead = true; - me->setDeathState(JUST_ALIVED); + me->setDeathState(JUST_RESPAWNED); uint32 newEntry = 0; switch (me->GetEntry()) { diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index eb2d3187636..045ae5a6f9a 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1095,7 +1095,7 @@ class spell_item_shimmering_vessel : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { if (Creature* target = GetHitCreature()) - target->setDeathState(JUST_ALIVED); + target->setDeathState(JUST_RESPAWNED); } void Register() -- cgit v1.2.3 From 79a735fb01c3dc2c812f12a4c09612a1b2db942e Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 12 May 2012 13:21:05 +0200 Subject: Core/Spell: * Fix Spells with DmgClass SPELL_DAMAGE_CLASS_NONE * Fix SPELL_AURA_PERIODIC_HEAL calculation * Fix Swiftmend heal calculation * Fix some codestyle --- src/server/game/Entities/Unit/Unit.cpp | 50 ++++++++++++++--------- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Spells/SpellEffects.cpp | 3 -- 3 files changed, 32 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1783db9b14e..5f2f3bc2873 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11201,12 +11201,12 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui if (Unit* owner = GetOwner()) return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, stack); - // no bonus for heal potions/bandages + // No bonus healing for potion spells if (spellProto->SpellFamilyName == SPELLFAMILY_POTION) return healamount; - float DoneTotalMod = 1.0f; - int32 DoneTotal = 0; + float DoneTotalMod = 1.0f; + int32 DoneTotal = 0; // Healing done percent AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); @@ -11270,7 +11270,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui } // Done fixed damage bonus auras - int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask()); + int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask()); // Check for table values SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); @@ -11283,16 +11283,22 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui coeff = bonus->dot_damage; if (bonus->ap_dot_bonus > 0) DoneTotal += int32(bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue( - (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); + (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK)); } else { coeff = bonus->direct_damage; if (bonus->ap_bonus > 0) DoneTotal += int32(bonus->ap_bonus * stack * GetTotalAttackPowerValue( - (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); + (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK)); } } + else + { + // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default + if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + return healamount < 0 ? 0 : healamount; + } // Default calculation if (DoneAdvertisedBenefit) @@ -11320,11 +11326,11 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui } else { - // Earthliving - 0.45% of normal hot coeff - if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) - factorMod *= 0.45f; + // Earthliving - 0.45% of normal hot coeff + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) + factorMod *= 0.45f; - DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); + DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); } } @@ -11339,7 +11345,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui break; } if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) - DoneTotal = 0; + DoneTotal = 0; } // use float as more appropriate for negative values and percent applying @@ -11351,16 +11357,16 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui return uint32(std::max(heal, 0.0f)); } -uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) { - float TakenTotalMod = 1.0f; + float TakenTotalMod = 1.0f; // Healing taken percent - float minval = (float)GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); if (minval) AddPctF(TakenTotalMod, minval); - float maxval = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); if (maxval) AddPctF(TakenTotalMod, maxval); @@ -11369,7 +11375,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, u AddPctN(TakenTotalMod, Tenacity->GetAmount()); // Healing Done - int32 TakenTotal = 0; + int32 TakenTotal = 0; // Taken fixed damage bonus auras int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(spellProto->GetSchoolMask()); @@ -11386,11 +11392,11 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, u if (damagetype == DOT) { // Healing over time taken percent - float minval_hot = (float)GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT)); if (minval_hot) AddPctF(TakenTotalMod, minval_hot); - float maxval_hot = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT)); if (maxval_hot) AddPctF(TakenTotalMod, maxval_hot); } @@ -11401,6 +11407,12 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, u float factorMod = 1.0f; if (bonus) coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; + else + { + // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default + if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + return healamount < 0 ? 0 : healamount; + } // Default calculation if (TakenAdvertisedBenefit) @@ -11439,7 +11451,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, u break; } if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) - TakenTotal = 0; + TakenTotal = 0; } float heal = (int32(healamount) + TakenTotal) * TakenTotalMod; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index bdbc5cb79d1..7d245539c97 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -6457,7 +6457,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const damage += addition; } - damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index b1a3cd687df..352b91c635c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1560,10 +1560,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) int32 tickheal = targetAura->GetAmount(); if (Unit* auraCaster = targetAura->GetCaster()) - { tickheal = auraCaster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); - tickheal = unitTarget->SpellHealingBonusTaken(auraCaster, targetAura->GetSpellInfo(), tickheal, DOT); - } //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included -- cgit v1.2.3 From a1ff27a1c64d87717d0b0f65905ffff064329fb7 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 13 May 2012 17:47:12 +0200 Subject: Core/Threat: Some corrections to 5709929d2b575e83f427c7f48cd6bd0d7ed1b29d Fixes HandleChannelDeathItem (spells such as Drain Soul), which got broken by moving m_deathState = s, thanks Shauren --- src/server/game/Combat/ThreatManager.cpp | 5 +- src/server/game/Entities/Unit/Unit.cpp | 7 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 91 +++++++++++------------ 3 files changed, 46 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 104d2d3d52b..9737d4584ea 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -535,10 +535,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat setCurrentVictim(NULL); setDirty(true); } - if (getOwner() && getOwner()->IsInWorld()) - if (Unit* target = ObjectAccessor::GetUnit(*getOwner(), hostilRef->getUnitGuid())) - if (getOwner()->IsInMap(target)) - getOwner()->SendRemoveFromThreatListOpcode(hostilRef); + iOwner->SendRemoveFromThreatListOpcode(hostilRef); iThreatContainer.remove(hostilRef); iThreatOfflineContainer.addReference(hostilRef); } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e78c18ea3de..b1fcdf888c2 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12833,9 +12833,6 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) void Unit::setDeathState(DeathState s) { - // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that - // it can be used to check creation of death items (such as soul shards). - if (s != ALIVE && s != JUST_RESPAWNED) { CombatStop(); @@ -12880,9 +12877,7 @@ void Unit::setDeathState(DeathState s) zoneScript->OnUnitDeath(this); } else if (s == JUST_RESPAWNED) - { - RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) - } + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) m_deathState = s; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 7d245539c97..d28ba9e1e19 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5272,66 +5272,63 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod if (!(mode & AURA_EFFECT_HANDLE_REAL)) return; - if (!apply) - { - Unit* caster = GetCaster(); + if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH) + return; - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return; + Unit* caster = GetCaster(); + + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) + return; - Player* plCaster = caster->ToPlayer(); - Unit* target = aurApp->GetTarget(); + Player* plCaster = caster->ToPlayer(); + Unit* target = aurApp->GetTarget(); - if (target->getDeathState() != JUST_DIED) - return; + // Item amount + if (GetAmount() <= 0) + return; - // Item amount - if (GetAmount() <= 0) - return; + if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0) + return; - if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0) + // Soul Shard + if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265) + { + // Soul Shard only from units that grant XP or honor + if (!plCaster->isHonorOrXPTarget(target) || + (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster))) return; - // Soul Shard - if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265) + // If this is Drain Soul, check for Glyph of Drain Soul + if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) { - // Soul Shard only from units that grant XP or honor - if (!plCaster->isHonorOrXPTarget(target) || - (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster))) - return; - - // If this is Drain Soul, check for Glyph of Drain Soul - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) - { - // Glyph of Drain Soul - chance to create an additional Soul Shard - if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) - if (roll_chance_i(aur->GetMiscValue())) - caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) - } + // Glyph of Drain Soul - chance to create an additional Soul Shard + if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) + if (roll_chance_i(aur->GetMiscValue())) + caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) } + } - //Adding items - uint32 noSpaceForCount = 0; - uint32 count = m_amount; - - ItemPosCountVec dest; - InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount); - if (msg != EQUIP_ERR_OK) - { - count-=noSpaceForCount; - plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); - if (count == 0) - return; - } + //Adding items + uint32 noSpaceForCount = 0; + uint32 count = m_amount; - Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); - if (!newitem) - { - plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + ItemPosCountVec dest; + InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) + { + count-=noSpaceForCount; + plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); + if (count == 0) return; - } - plCaster->SendNewItem(newitem, count, true, true); } + + Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); + if (!newitem) + { + plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + return; + } + plCaster->SendNewItem(newitem, count, true, true); } void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const -- cgit v1.2.3 From e122f9fd30680433cb246d98f2666d1ddcdd0c02 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 13 May 2012 18:08:57 +0200 Subject: Core/Spell: * Fix Nourish heal calculation * Fix some codestyle --- src/server/game/Entities/Unit/Unit.cpp | 18 +++++++++--------- src/server/game/Spells/SpellEffects.cpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b1fcdf888c2..f79adb2b232 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10600,7 +10600,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin break; } } - break; + break; case SPELLFAMILY_PRIEST: // Mind Flay if (spellProto->SpellFamilyFlags[0] & 0x800000) @@ -10633,7 +10633,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) AddPctN(DoneTotalMod, aurEff->GetAmount()); } - break; + break; case SPELLFAMILY_PALADIN: // Judgement of Vengeance/Judgement of Corruption if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292) @@ -10651,7 +10651,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (stacks) AddPctU(DoneTotalMod, 10 * stacks); } - break; + break; case SPELLFAMILY_DRUID: // Thorns if (spellProto->SpellFamilyFlags[0] & 0x100) @@ -10660,7 +10660,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0)) AddPctN(DoneTotalMod, aurEff->GetAmount()); } - break; + break; case SPELLFAMILY_WARLOCK: // Fire and Brimstone if (spellProto->SpellFamilyFlags[1] & 0x00020040) @@ -10682,14 +10682,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (spellProto->SpellFamilyFlags[1] & 0x00400000 && isPet()) if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID())) AddPctN(DoneTotalMod, 15 * count); - break; + break; case SPELLFAMILY_HUNTER: // Steady Shot if (spellProto->SpellFamilyFlags[1] & 0x1) if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID())) AddPctN(DoneTotalMod, aurEff->GetAmount()); - break; + break; case SPELLFAMILY_DEATHKNIGHT: // Improved Icy Touch if (spellProto->SpellFamilyFlags[0] & 0x2) @@ -10730,7 +10730,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin } } } - break; + break; } // Done fixed damage bonus auras @@ -10751,7 +10751,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (bonus->ap_dot_bonus > 0) { WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK; - float APbonus = (float) victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS); + float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS)); APbonus += GetTotalAttackPowerValue(attType); DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus); } @@ -10762,7 +10762,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (bonus->ap_bonus > 0) { WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK; - float APbonus = (float) victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS); + float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS)); APbonus += GetTotalAttackPowerValue(attType); DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 352b91c635c..c306da9d43b 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1581,12 +1581,12 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) //addhealth += tickheal * tickcount; //addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth, HEAL, unitTarget); } - // Glyph of Nourish + // Nourish else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x2000000) { addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); + // Glyph of Nourish if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0)) { Unit::AuraEffectList const& Periodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL); -- cgit v1.2.3 From 42b0dfc94f9e9960a38024624f0a0f9886c5ccbd Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 14:36:24 -0230 Subject: Core/Scripts: Update text for Garfrost to creature_text. Added some missing text & added call for help to aggro. --- .../world/2012_05_13_00_world_creature_text.sql | 13 +++++++++ .../PitOfSaron/boss_forgemaster_garfrost.cpp | 33 ++++++++++++++-------- 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 sql/updates/world/2012_05_13_00_world_creature_text.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_13_00_world_creature_text.sql b/sql/updates/world/2012_05_13_00_world_creature_text.sql new file mode 100644 index 00000000000..8d083156fb0 --- /dev/null +++ b/sql/updates/world/2012_05_13_00_world_creature_text.sql @@ -0,0 +1,13 @@ +-- NPC talk text insert from sniff +DELETE FROM `creature_text` WHERE `entry`=36494; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(36494,0,0, 'Tiny creatures under feet, you bring Garfrost something good to eat!',14,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,1,0, 'Axe too weak. Garfrost make better and CRUSH YOU.',14,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,2,0, 'Garfrost tired of puny mortals. Now your bones will freeze!',14,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,3,0, 'Garfrost hope giant underpants clean. Save boss great shame. For later.',14,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,4,0, 'Will save for snack. For later.',12,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,4,1, 'That one maybe not so good to eat now. Stupid Garfrost! BAD! BAD!',12,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,5,0, '%s hurls a massive saronite boulder at you!',16,0,100,0,0,0, 'Forgemaster Garfrost'), +(36494,6,0, '%s casts |cFF00AACCDeep Freeze|r at $n.',41,0,100,0,0,0, 'Forgemaster Garfrost'); +-- Remove old script text +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1658006 AND -1658001; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 64609efd7ff..a3b8c5df4e7 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -20,14 +20,15 @@ enum Yells { - SAY_AGGRO = -1658001, - SAY_SLAY_1 = -1658002, - SAY_SLAY_2 = -1658003, - SAY_DEATH = -1658004, - SAY_PHASE2 = -1658005, - SAY_PHASE3 = -1658006, - - SAY_TYRANNUS_DEATH = -1658007, + SAY_AGGRO = 0, + SAY_PHASE2 = 1, + SAY_PHASE3 = 2, + SAY_DEATH = 3, + SAY_SLAY = 4, + SAY_THROW_SARONITE = 5, + SAY_CAST_DEEP_FREEZE = 6, + + SAY_TYRANNUS_DEATH = -1658007, // todo }; enum Spells @@ -107,8 +108,9 @@ class boss_garfrost : public CreatureScript void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); DoCast(me, SPELL_PERMAFROST); + me->CallForHelp(70.0f); events.ScheduleEvent(EVENT_THROW_SARONITE, 7000); instance->SetBossState(DATA_GARFROST, IN_PROGRESS); @@ -117,12 +119,13 @@ class boss_garfrost : public CreatureScript void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER) - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); + if (Creature* tyrannus = me->GetCreature(*me, instance->GetData64(DATA_TYRANNUS))) DoScriptText(SAY_TYRANNUS_DEATH, tyrannus); @@ -134,6 +137,7 @@ class boss_garfrost : public CreatureScript if (events.GetPhaseMask() & PHASE_ONE_MASK && !HealthAbovePct(66)) { events.SetPhase(PHASE_TWO); + Talk(SAY_PHASE2); events.DelayEvents(8000); DoCast(me, SPELL_THUNDERING_STOMP); events.ScheduleEvent(EVENT_JUMP, 1500); @@ -143,6 +147,7 @@ class boss_garfrost : public CreatureScript if (events.GetPhaseMask() & PHASE_TWO_MASK && !HealthAbovePct(33)) { events.SetPhase(PHASE_THREE); + Talk(SAY_PHASE3); events.DelayEvents(8000); DoCast(me, SPELL_THUNDERING_STOMP); events.ScheduleEvent(EVENT_JUMP, 1500); @@ -199,7 +204,10 @@ class boss_garfrost : public CreatureScript { case EVENT_THROW_SARONITE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + Talk(SAY_THROW_SARONITE); DoCast(target, SPELL_THROW_SARONITE); + } events.ScheduleEvent(EVENT_THROW_SARONITE, urand(12500, 20000)); break; case EVENT_CHILLING_WAVE: @@ -208,7 +216,10 @@ class boss_garfrost : public CreatureScript break; case EVENT_DEEP_FREEZE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + Talk(SAY_CAST_DEEP_FREEZE); DoCast(target, SPELL_DEEP_FREEZE); + } events.ScheduleEvent(EVENT_DEEP_FREEZE, 35000, 0, PHASE_THREE); break; case EVENT_JUMP: -- cgit v1.2.3 From fa7e9d3c0d492cbf5e4563d8292674145dfef5a0 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 15:14:32 -0230 Subject: Core/Scripts: And some Gameobject enums for future scripting of Blackrock Spire. --- .../BlackrockSpire/blackrock_spire.h | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h index e51c6b9130d..cef08375c13 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h @@ -61,7 +61,34 @@ enum AdditionalData enum GameObjects { - GO_WHELP_SPAWNER = 175622, //trap spawned by go id 175124 + GO_WHELP_SPAWNER = 175622, // trap spawned by go id 175124 + + // Doors + GO_EMBERSEER_IN = 175244, // First door to Pyroguard Emberseer + GO_DOORS = 175705, // Second door to Pyroguard Emberseer + GO_EMBERSEER_OUT = 175153, // Door after Pyroguard Emberseer event + GO_GYTH_ENTRY_DOOR = 164726, + GO_GYTH_COMBAT_DOOR = 175185, + GO_GYTH_EXIT_DOOR = 175186, + GO_DRAKKISATH_DOOR_1 = 175946, + GO_DRAKKISATH_DOOR_2 = 175947, + + // Runes + GO_ROOM_1_RUNE = 175197, + GO_ROOM_2_RUNE = 175199, + GO_ROOM_3_RUNE = 175195, + GO_ROOM_4_RUNE = 175200, + GO_ROOM_5_RUNE = 175198, + GO_ROOM_6_RUNE = 175196, + GO_ROOM_7_RUNE = 175194, + + GO_EMBERSEER_RUNE_1 = 175266, + GO_EMBERSEER_RUNE_2 = 175267, + GO_EMBERSEER_RUNE_3 = 175268, + GO_EMBERSEER_RUNE_4 = 175269, + GO_EMBERSEER_RUNE_5 = 175270, + GO_EMBERSEER_RUNE_6 = 175271, + GO_EMBERSEER_RUNE_7 = 175272, }; #endif -- cgit v1.2.3 From ede623b473199426e736fc12829c283a9f181587 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 13 May 2012 21:07:59 +0200 Subject: Core/Spell: * Fix SPELL_DAMAGE_CLASS_NONE calculation for SpellHealingBonusTaken * Fix some codestyles --- src/server/game/Entities/Unit/Unit.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f79adb2b232..5b0a3820b0e 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10814,11 +10814,11 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui int32 TakenTotal = 0; float TakenTotalMod = 1.0f; - //from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN - //multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) + // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN + // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask()); - //.. taken pct: dummy auras + //.. taken pct: dummy auras AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY); for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { @@ -11411,7 +11411,10 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u { // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + { + healamount = int32(healamount * TakenTotalMod); return healamount < 0 ? 0 : healamount; + } } // Default calculation @@ -11820,7 +11823,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType return uint32(std::max(tmpDamage, 0.0f)); } -uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto) +uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto) { if (pdamage == 0) return 0; -- cgit v1.2.3 From e144b8e3bef87a55791188f6578e176e28e9bdd7 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 20:30:11 -0230 Subject: DB/creature_text: Added creature text for Boss Sara. --- sql/updates/world/2012_05_13_01_world_creature_text.sql | 14 ++++++++++++++ .../scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp | 14 ++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 sql/updates/world/2012_05_13_01_world_creature_text.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_13_01_world_creature_text.sql b/sql/updates/world/2012_05_13_01_world_creature_text.sql new file mode 100644 index 00000000000..8e983fd9a73 --- /dev/null +++ b/sql/updates/world/2012_05_13_01_world_creature_text.sql @@ -0,0 +1,14 @@ +-- NPC talk text insert for Sara +DELETE FROM `creature_text` WHERE `entry`=33134; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(33134,0,0, 'Help me! Please get them off me!',14,0,100,0,0,15771, 'Sara YELL_PREFIGHT'), +(33134,0,1, 'What do you want from me? Leave me alone!',14,0,100,0,0,15772, 'Sara YELL_PREFIGHT'), +(33134,1,0, 'Yes! YES! Show them no mercy! Give no pause to your attacks!',14,0,100,0,0,15773, 'Sara YELL_COMBAT_PHASE_1'), +(33134,1,1, 'Let hatred and rage guide your blows!',14,0,100,0,0,15774, 'Sara YELL_COMBAT_PHASE_1'), +(33134,1,2, 'The time to strike at the head of the beast will soon be upon us! Focus your anger and hatred on his minions!',14,0,100,457,0,15775, 'Sara YELL_COMBAT_PHASE_1'), +(33134,2,0, 'Suffocate upon your own hate!',14,0,100,0,0,15776, 'Sara YELL_COMBAT_PHASE_2'), +(33134,2,1, 'Tremble, mortals, before the coming of the end!',14,0,100,0,0,15777, 'Sara YELL_COMBAT_PHASE_2'), +(33134,3,0, 'Powerless to act...',14,0,100,0,0,15778, 'Sara YELL_SLAY'), +(33134,3,1, 'Could they have been saved?',14,0,100,0,0,15779, 'YELL SAY_SLAY'); +-- remove script text +DELETE FROM script_texts WHERE entry BETWEEN -1603319 AND -1603310; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index 3f01f21b189..585967ebdcc 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -20,16 +20,10 @@ enum Sara_Yells { - SAY_SARA_PREFIGHT_1 = -1603310, - SAY_SARA_PREFIGHT_2 = -1603311, - SAY_SARA_AGGRO_1 = -1603312, - SAY_SARA_AGGRO_2 = -1603313, - SAY_SARA_AGGRO_3 = -1603314, - SAY_SARA_SLAY_1 = -1603315, - SAY_SARA_SLAY_2 = -1603316, - WHISP_SARA_INSANITY = -1603317, - SAY_SARA_PHASE2_1 = -1603318, - SAY_SARA_PHASE2_2 = -1603319, + YELL_SARA_PREFIGHT = 0, + YELL_COMBAT_PHASE_1 = 1, + YELL_COMBAT_PHASE_2 = 2, + YELL_SLAY = 3, }; enum YoggSaron_Yells -- cgit v1.2.3 From 72d00c476ca6b6e2d48f5fdfaae48bf383e44ef0 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 13 May 2012 21:43:37 -0230 Subject: Core/scripts: Add spell enums for boss sara. --- .../scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index 585967ebdcc..948ca58e446 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -18,12 +18,27 @@ #include "ScriptMgr.h" #include "ulduar.h" -enum Sara_Yells +enum Sara { + // text YELL_SARA_PREFIGHT = 0, YELL_COMBAT_PHASE_1 = 1, YELL_COMBAT_PHASE_2 = 2, YELL_SLAY = 3, + + // Phase 1 spells + SPELL_SARAS_BLESSING = 63745, // Target Self + SPELL_SARAS_ANGER = 63147, // Target Entry 33136 + SPELL_SARAS_ANGER = 63744, // Target Entry 33136 + SPELL_SARAS_FEVOR = 63138, // Target Player + SPELL_SARAS_FEVOR = 63747, // Target Player + SPELL_SARAS_BLESSING = 63134, // Target Player + + // Phase 2 spells + SPELL_PHYCHOSIS = 63795, // Target Self + SPELL_MALADY_OF_THE_MIND = 63830, // Target Self + SPELL_DEATH_RAY = 63891, // Target Self + SPELL_BRAIN_LINK = 63802, // Target Self }; enum YoggSaron_Yells -- cgit v1.2.3 From 1a06e197fd7d908ff62b801176cc3797306b07cd Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 13 May 2012 19:39:06 -0500 Subject: Core/Spells: Proc the spells that have DEST target when there is no other target info Closes #6443 Closes #6277 Closes #6331 Signed-off-by: Subv --- src/server/game/Spells/Spell.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 28b089f91cd..48aa40a0e51 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3427,6 +3427,20 @@ void Spell::_handle_immediate_phase() // process items for (std::list::iterator ihit= m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) DoAllEffectOnTarget(&(*ihit)); + + if (!m_originalCaster) + return; + // Handle procs on cast + // TODO: finish new proc system:P + if (m_UniqueTargetInfo.empty() && m_targets.HasDst()) + { + uint32 procAttacker = m_procAttacker; + if (!procAttacker) + procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; + + // Proc the spells that have DEST target + m_originalCaster->ProcDamageAndSpell(NULL, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell); + } } void Spell::_handle_finish_phase() -- cgit v1.2.3 From 25f1c5a51da26f30fe251e326e68168985102b6f Mon Sep 17 00:00:00 2001 From: Xanvial Date: Mon, 14 May 2012 12:15:57 +0700 Subject: Core/Spell : Glyph of Totem of Wrath Spell bonus granted by glyph should calculated based from summoned totem, not from player's aura --- src/server/game/Entities/Unit/Unit.cpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f79adb2b232..90c8ffaae63 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7366,30 +7366,16 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (procSpell->SpellIconID != 2019) return false; - AuraEffect* aurEffA = NULL; - AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE); - for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + if (Creature* totem = GetMap()->GetCreature(m_SummonSlot[1])) // Fire totem summon slot { - SpellInfo const* spell = (*i)->GetSpellInfo(); - if (spell->SpellFamilyName == uint32(SPELLFAMILY_SHAMAN) && spell->SpellFamilyFlags.HasFlag(0, 0x02000000, 0)) + if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0])) { - if ((*i)->GetCasterGUID() != GetGUID()) - continue; - if (spell->Id == 63283) - continue; - aurEffA = (*i); - break; + int32 bp0 = CalculatePctN(totemSpell->Effects[EFFECT_0].CalcValue(), triggerAmount); + int32 bp1 = CalculatePctN(totemSpell->Effects[EFFECT_1].CalcValue(), triggerAmount); + CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true); + return true; } } - if (aurEffA) - { - int32 bp0 = 0, bp1 = 0; - bp0 = CalculatePctN(triggerAmount, aurEffA->GetAmount()); - if (AuraEffect* aurEffB = aurEffA->GetBase()->GetEffect(EFFECT_1)) - bp1 = CalculatePctN(triggerAmount, aurEffB->GetAmount()); - CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true, NULL, triggeredByAura); - return true; - } return false; } break; -- cgit v1.2.3 From 06c4917568a43cd85a40b07eb82f273af2053050 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Mon, 14 May 2012 07:18:06 -0230 Subject: Cote/Scripts: Fix build for boss_yoggsaron --- .../scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index 948ca58e446..58ba125b994 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -27,12 +27,12 @@ enum Sara YELL_SLAY = 3, // Phase 1 spells - SPELL_SARAS_BLESSING = 63745, // Target Self - SPELL_SARAS_ANGER = 63147, // Target Entry 33136 - SPELL_SARAS_ANGER = 63744, // Target Entry 33136 - SPELL_SARAS_FEVOR = 63138, // Target Player - SPELL_SARAS_FEVOR = 63747, // Target Player - SPELL_SARAS_BLESSING = 63134, // Target Player + SPELL_SARAS_ANGER_1 = 63147, // Target Entry 33136 + SPELL_SARAS_ANGER_2 = 63744, // Target Entry 33136 + SPELL_SARAS_FEVOR_1 = 63138, // Target Player + SPELL_SARAS_FEVOR_2 = 63747, // Target Player + SPELL_SARAS_BLESSING_1 = 63134, // Target Player + SPELL_SARAS_BLESSING_2 = 63745, // Target Self // Phase 2 spells SPELL_PHYCHOSIS = 63795, // Target Self -- cgit v1.2.3 From 548ac10879701b5eda9d8d369e9fbd470418ce8d Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 14 May 2012 14:11:02 -0400 Subject: Core/Entities: fix calculations for damage taken/done with negative values (should go into effect) and correctly implement SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS. small cleanup --- src/server/game/Entities/Unit/Unit.cpp | 74 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5b0a3820b0e..359e2145112 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10407,20 +10407,24 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet()) DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + // Some spells don't benefit from pct done mods + if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) { - if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) - continue; - - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if ((*i)->GetSpellInfo()->EquippedItemClass == -1) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) - AddPctN(DoneTotalMod, (*i)->GetAmount()); + if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) + continue; + + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + { + if ((*i)->GetSpellInfo()->EquippedItemClass == -1) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + } } } @@ -10792,12 +10796,6 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotalMod = 1.0f; } - // Some spells don't benefit from pct done mods - // maybe should be implemented like SPELL_ATTR3_NO_DONE_BONUS, - // but then it may break spell power coeffs work on spell 31117 - if (spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) - DoneTotalMod = 1.0f; - float tmpDamage = (int32(pdamage) + DoneTotal) * DoneTotalMod; // apply spellmod to Done damage (flat and pct) if (Player* modOwner = GetSpellModOwner()) @@ -10918,7 +10916,7 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) DoneAdvertisedBenefit += int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount())); } - return DoneAdvertisedBenefit > 0 ? DoneAdvertisedBenefit : 0; + return DoneAdvertisedBenefit; } int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) @@ -10930,7 +10928,7 @@ int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) if (((*i)->GetMiscValue() & schoolMask) != 0) TakenAdvertisedBenefit += (*i)->GetAmount(); - return TakenAdvertisedBenefit > 0 ? TakenAdvertisedBenefit : 0; + return TakenAdvertisedBenefit; } bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const @@ -11197,7 +11195,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damag uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) { // For totems get healing bonus from owner (statue isn't totem in fact) - if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem()) + if (GetTypeId() == TYPEID_UNIT && isTotem()) if (Unit* owner = GetOwner()) return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, stack); @@ -11297,7 +11295,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui { // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) - return healamount < 0 ? 0 : healamount; + return healamount; } // Default calculation @@ -11413,7 +11411,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) { healamount = int32(healamount * TakenTotalMod); - return healamount < 0 ? 0 : healamount; + return healamount; } } @@ -11648,10 +11646,7 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto) { - if (!victim) - return 0; - - if (pdamage == 0) + if (!victim || pdamage == 0) return 0; uint32 creatureTypeMask = victim->GetCreatureTypeMask(); @@ -11708,20 +11703,23 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType // Done total percent damage auras float DoneTotalMod = 1.0f; - // ..done - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + // Some spells don't benefit from pct done mods + if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) { - if (spellProto) + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) + if (spellProto) { - if ((*i)->GetSpellInfo()->EquippedItemClass == -1) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) - AddPctN(DoneTotalMod, (*i)->GetAmount()); + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) + { + if ((*i)->GetSpellInfo()->EquippedItemClass == -1) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + } } } } -- cgit v1.2.3 From 06e019b72225e824711fc41b6f4d0443b715b8cc Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 14 May 2012 14:23:21 -0400 Subject: Core/Entities: move spellproto check to the outside of the forloop to not has crashes --- src/server/game/Entities/Unit/Unit.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 359e2145112..3c10243e6b1 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11704,12 +11704,11 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType float DoneTotalMod = 1.0f; // Some spells don't benefit from pct done mods - if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) - { - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + if (spellProto) + if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) { - if (spellProto) + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) { @@ -11722,7 +11721,6 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType } } } - } AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i) -- cgit v1.2.3 From cd06bb93773b9e788067e1a73bbd75ad01937c64 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 14 May 2012 15:14:40 -0400 Subject: Core/Spells: fix possible crash from not having any effect and trying to check if immune. fixes non effect spell mechanic checking for spells with both spell mechanics and effect mechanics --- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3c10243e6b1..bf4911223b8 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11569,7 +11569,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) } // Spells that don't have effectMechanics. - if (!spellInfo->HasAnyEffectMechanic() && spellInfo->Mechanic) + if (spellInfo->Mechanic) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) @@ -11609,7 +11609,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - if (!spellInfo) + if (!spellInfo || !spellInfo->Effects[index]) return false; // If m_immuneToEffect type contain this effect type, IMMUNE effect. uint32 effect = spellInfo->Effects[index].Effect; -- cgit v1.2.3 From 124c65ad80af46c73541dcad9066e3314155f1a8 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 14 May 2012 15:28:31 -0400 Subject: fix compile warnings from 548ac10 --- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bf4911223b8..5f448567b16 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10408,7 +10408,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); // Some spells don't benefit from pct done mods - if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) @@ -11705,7 +11705,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType // Some spells don't benefit from pct done mods if (spellProto) - if (!spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) -- cgit v1.2.3 From b72c690905d6dc650b6322c0054cd3faa85c80ea Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 15 May 2012 00:03:18 +0200 Subject: Fixed compile --- src/server/game/Entities/Unit/Unit.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5f448567b16..f80175b74d2 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11528,7 +11528,7 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) return false; uint32 shoolMask = spellInfo->GetSchoolMask(); - if (spellInfo->Id != 42292 && spellInfo->Id !=59752) + if (spellInfo->Id != 42292 && spellInfo->Id != 59752) { // If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; @@ -11588,10 +11588,11 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) break; } } + if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects. return true; - if (spellInfo->Id != 42292 && spellInfo->Id !=59752) + if (spellInfo->Id != 42292 && spellInfo->Id != 59752) { SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) @@ -11609,8 +11610,9 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - if (!spellInfo || !spellInfo->Effects[index]) + if (!spellInfo || !spellInfo->Effects[index].IsEffect()) return false; + // If m_immuneToEffect type contain this effect type, IMMUNE effect. uint32 effect = spellInfo->Effects[index].Effect; SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT]; -- cgit v1.2.3 From 68bfe8c831c107ccdd43475ed2a89b7848b6ab32 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 15 May 2012 12:41:00 +0200 Subject: Core/Spell: Fix not using Shadowstep while rooted --- .../2012_05_15_00_world_spell_script_names.sql | 3 +++ src/server/scripts/Spells/spell_rogue.cpp | 29 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 sql/updates/world/2012_05_15_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_15_00_world_spell_script_names.sql b/sql/updates/world/2012_05_15_00_world_spell_script_names.sql new file mode 100644 index 00000000000..980aceff519 --- /dev/null +++ b/sql/updates/world/2012_05_15_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=36554; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(36554,'spell_rog_shadowstep'); diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 3a4132f62fe..a315f867e34 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -386,6 +386,34 @@ class spell_rog_deadly_poison : public SpellScriptLoader } }; +class spell_rog_shadowstep : public SpellScriptLoader +{ + public: + spell_rog_shadowstep() : SpellScriptLoader("spell_rog_shadowstep") { } + + class spell_rog_shadowstep_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rog_shadowstep_SpellScript); + + SpellCastResult CheckCast() + { + if (GetCaster()->HasUnitState(UNIT_STATE_ROOT)) + return SPELL_FAILED_ROOTED; + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_rog_shadowstep_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_rog_shadowstep_SpellScript(); + } +}; + void AddSC_rogue_spell_scripts() { new spell_rog_cheat_death(); @@ -394,4 +422,5 @@ void AddSC_rogue_spell_scripts() new spell_rog_prey_on_the_weak(); new spell_rog_shiv(); new spell_rog_deadly_poison(); + new spell_rog_shadowstep(); } -- cgit v1.2.3 From 648321e1212c3e2a002df0b4509f2b097a330153 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 15 May 2012 13:26:15 -0400 Subject: Core/Spelld: fix target selection for ground based aoe spells. use the center of the cast (dynamic object) instead of the caster for checking los --- src/server/game/Entities/Unit/Unit.cpp | 6 +++--- src/server/game/Entities/Unit/Unit.h | 2 +- src/server/game/Grids/Notifiers/GridNotifiers.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f80175b74d2..14184b1606d 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12254,7 +12254,7 @@ bool Unit::IsValidAttackTarget(Unit const* target) const } // function based on function Unit::CanAttack from 13850 client -bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const +bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj) const { ASSERT(target); @@ -12272,8 +12272,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target)) return false; - // can't attack invisible (ignore stealth for aoe spells) - if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea())) + // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit. + if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))) return false; // can't attack dead diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 2d6c5b1a86e..f246f595dec 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1573,7 +1573,7 @@ class Unit : public WorldObject bool isTargetableForAttack(bool checkFakeDeath = true) const; bool IsValidAttackTarget(Unit const* target) const; - bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const; + bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = NULL) const; bool IsValidAssistTarget(Unit const* target) const; bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 6ca31b22e37..7bb4492f99c 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -943,7 +943,7 @@ namespace Trinity if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem()) return false; - if (i_funit->_IsValidAttackTarget(u, _spellInfo) && i_obj->IsWithinDistInMap(u, i_range)) + if (i_funit->_IsValidAttackTarget(u, _spellInfo,i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range)) return true; return false; -- cgit v1.2.3 From c05c16a8dee97a485e0d6a4e73c750e1d140f227 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 15 May 2012 15:07:53 -0400 Subject: Core/Spells: more immunities fixes! mechanics are supposed to be checked for finding out if immune to the entire spell. --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 14184b1606d..f1e5f05bd35 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11582,7 +11582,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) { // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately - if (spellInfo->Effects[i].Mechanic || !IsImmunedToSpellEffect(spellInfo, i)) + if (!IsImmunedToSpellEffect(spellInfo, i)) { immuneToAllEffects = false; break; -- cgit v1.2.3 From b90cb5878de2afc621c0b9ebc86066c2b827f428 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 15 May 2012 23:14:47 +0200 Subject: Core/Spell: Fix SpellDamageBonusTaken calculation for negative value --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f1e5f05bd35..aaba0102f55 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10875,7 +10875,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod); } - float tmpDamage = (pdamage + TakenTotal) * TakenTotalMod; + float tmpDamage = (int32(pdamage) + TakenTotal) * TakenTotalMod; return uint32(std::max(tmpDamage, 0.0f)); } -- cgit v1.2.3 From c70792df02858a93c156ac00b4a1fdd366c994ec Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 16 May 2012 08:47:43 -0400 Subject: Core/Scripting: add the ability to access loot/go state changed events for gameobjects from cpp scripting. (malcrom's idea) --- src/server/game/Entities/GameObject/GameObject.cpp | 2 ++ src/server/game/Scripting/ScriptMgr.cpp | 16 ++++++++++++++++ src/server/game/Scripting/ScriptMgr.h | 8 ++++++++ 3 files changed, 26 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index e871f99b38c..10136c5fbd7 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1910,6 +1910,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) { m_lootState = state; AI()->OnStateChanged(state, unit); + sScriptMgr->OnGameObjectLootStateChanged(this, state, unit); if (m_model) { // startOpen determines whether we are going to add or remove the LoS on activation @@ -1929,6 +1930,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) void GameObject::SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); + sScriptMgr->OnGameObjectStateChanged(this, state); if (m_model) { if (!IsInWorld()) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 01d56cf8060..23d18e12097 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -937,6 +937,22 @@ void ScriptMgr::OnGameObjectDamaged(GameObject* go, Player* player) tmpscript->OnDamaged(go, player); } +void ScriptMgr::OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit) +{ + ASSERT(go); + + GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript); + tmpscript->OnLootStateChanged(go, state, unit); +} + +void ScriptMgr::OnGameObjectStateChanged(GameObject* go, uint32 state) +{ + ASSERT(go); + + GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript); + tmpscript->OnGameObjectStateChanged(go, state); +} + void ScriptMgr::OnGameObjectUpdate(GameObject* go, uint32 diff) { ASSERT(go); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 6fe058d336a..b3d445af0c6 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -473,6 +473,12 @@ class GameObjectScript : public ScriptObject, public UpdatableScript // Called when the game object is damaged (destructible buildings only). virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { } + // Called when the game object loot state is changed. + virtual void OnLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { } + + // Called when the game object state is changed. + virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { } + // Called when a GameObjectAI object is needed for the gameobject. virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return NULL; } }; @@ -914,6 +920,8 @@ class ScriptMgr uint32 GetDialogStatus(Player* player, GameObject* go); void OnGameObjectDestroyed(GameObject* go, Player* player); void OnGameObjectDamaged(GameObject* go, Player* player); + void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit); + void OnGameObjectStateChanged(GameObject* go, uint32 state); void OnGameObjectUpdate(GameObject* go, uint32 diff); GameObjectAI* GetGameObjectAI(GameObject* go); -- cgit v1.2.3 From ac844f99537dc9867242269f63c3cd58be96e1b2 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Wed, 16 May 2012 12:30:37 -0230 Subject: Core/Scripts: Scripting of Dragonspire Hall Runes "UBRS" Additional work to do. --- sql/updates/world/2012_05_16_00_world_scripts.sql | 2 ++ .../BlackrockSpire/blackrock_spire.h | 1 + .../BlackrockSpire/instance_blackrock_spire.cpp | 23 ++++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 sql/updates/world/2012_05_16_00_world_scripts.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_16_00_world_scripts.sql b/sql/updates/world/2012_05_16_00_world_scripts.sql new file mode 100644 index 00000000000..9997c09bd8d --- /dev/null +++ b/sql/updates/world/2012_05_16_00_world_scripts.sql @@ -0,0 +1,2 @@ +-- Add script to Dragonspire Hall Runes "UBRS" +UPDATE `gameobject_template` SET `ScriptName`= 'go_dragonspire_hall_rune' WHERE `entry` BETWEEN 175194 AND 175200; diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h index cef08375c13..beef71ea857 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h @@ -57,6 +57,7 @@ enum AdditionalData { SPELL_SUMMON_ROOKERY_WHELP = 15745, MAX_ENCOUNTER = 14, + MAX_DRAGONSPIRE_HALL_RUNES = 7, }; enum GameObjects diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp index ff97984fa09..b5b1b34a593 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp @@ -247,7 +247,30 @@ public: }; +uint8 ActivatedRunes = 0; + +class go_dragonspire_hall_rune : public GameObjectScript +{ +public: + go_dragonspire_hall_rune() : GameObjectScript("go_dragonspire_hall_rune") { } + + void OnGameObjectStateChanged(GameObject* go, uint32 state) + { + if (state == GO_STATE_READY) + { + if (++ActivatedRunes == MAX_DRAGONSPIRE_HALL_RUNES) + { + if (GameObject* door1 = GetClosestGameObjectWithEntry(go, GO_EMBERSEER_IN, 150.0f)) + door1->SetGoState(GO_STATE_ACTIVE); + if (GameObject* door2 = GetClosestGameObjectWithEntry(go, GO_DOORS, 150.0f)) + door2->SetGoState(GO_STATE_ACTIVE); + } + } + } +}; + void AddSC_instance_blackrock_spire() { new instance_blackrock_spire(); + new go_dragonspire_hall_rune; } -- cgit v1.2.3 From ea4815b52806aa41ad015b314c8caff9ff2e2a6f Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 16 May 2012 11:05:11 -0400 Subject: Core/Spells: change spell bonus damage taken pdamage to float to match melee damage bonus taken --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index aaba0102f55..9438d9f7860 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10875,7 +10875,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod); } - float tmpDamage = (int32(pdamage) + TakenTotal) * TakenTotalMod; + float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod; return uint32(std::max(tmpDamage, 0.0f)); } -- cgit v1.2.3 From 619fdd185b2b59d886697d1cdbf71ac843982f66 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 17 May 2012 09:40:44 -0400 Subject: Core/Spells: fix deep wounds damage. thanks warpten. --- src/server/scripts/Spells/spell_warrior.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 194753d6e90..3d348a41e76 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -180,9 +180,6 @@ class spell_warr_deep_wounds : public SpellScriptLoader if (Unit* target = GetHitUnit()) if (Unit* caster = GetCaster()) { - // apply percent damage mods - damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); @@ -194,8 +191,6 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = damage / ticks; - damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); } } -- cgit v1.2.3 From c6aa41cc1050bf637669c633024cd82270bd64a7 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 17 May 2012 10:29:36 -0400 Subject: Core/Spells: Revert previous commit. add exception for deep wounds in pct done aura modifiers. clean up heal bonus code to use the correct numerical types. --- src/server/game/Entities/Unit/Unit.cpp | 10 +++++----- src/server/scripts/Spells/spell_warrior.cpp | 27 ++++++++++++++++----------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 9438d9f7860..6622e3b1e31 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10408,7 +10408,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); // Some spells don't benefit from pct done mods - if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162))) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) @@ -11347,7 +11347,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui } // use float as more appropriate for negative values and percent applying - float heal = (int32(healamount) + DoneTotal) * DoneTotalMod; + float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod; // apply spellmod to Done amount if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal); @@ -11410,7 +11410,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) { - healamount = int32(healamount * TakenTotalMod); + healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f)); return healamount; } } @@ -11455,7 +11455,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u TakenTotal = 0; } - float heal = (int32(healamount) + TakenTotal) * TakenTotalMod; + float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod; return uint32(std::max(heal, 0.0f)); } @@ -11707,7 +11707,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType // Some spells don't benefit from pct done mods if (spellProto) - if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162))) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 3d348a41e76..08583f51c21 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -177,22 +177,27 @@ class spell_warr_deep_wounds : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { int32 damage = GetEffectValue(); + Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) - if (Unit* caster = GetCaster()) - { - ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); + { + // apply percent damage mods + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); - uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; + ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); - // Add remaining ticks to damage done - if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID())) - damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); + uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; - damage = damage / ticks; + // Add remaining ticks to damage done + if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID())) + damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); - caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); - } + damage = damage / ticks; + + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + + caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); + } } void Register() -- cgit v1.2.3 From 63010fe77b4eea4461c01ffd8a3f2a0841bdd220 Mon Sep 17 00:00:00 2001 From: kandera Date: Thu, 17 May 2012 14:04:57 -0300 Subject: Core/Spells: calculate damagebonustaken for target before adding the damage left from the previous aura. thx @zwerg --- src/server/scripts/Spells/spell_warrior.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 08583f51c21..0ba5c866d63 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -184,7 +184,9 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); - + + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; @@ -194,8 +196,6 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = damage / ticks; - damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); } } -- cgit v1.2.3 From 9e6a5593bdab8ab9d301ec5373cd639025f4a790 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 10:25:14 -0400 Subject: Core/Spells: if doneadvertisedbenefit is 0 gift of the naaru will never get the ap bonus. moved outside the check to fix. --- src/server/game/Entities/Unit/Unit.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6622e3b1e31..a4d02ee5ea1 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11313,23 +11313,21 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui coeff /= 100.0f; } - // Gift of the Naaru - if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329) - { - int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK))); - if (apBonus > DoneAdvertisedBenefit) - DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick - else - DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick - } - else - { - // Earthliving - 0.45% of normal hot coeff - if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) - factorMod *= 0.45f; + // Earthliving - 0.45% of normal hot coeff + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) + factorMod *= 0.45f; - DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); - } + DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); + } + + // Gift of the Naaru + if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329) + { + int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK))); + if (apBonus > DoneAdvertisedBenefit) + DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick + else + DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick } for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) -- cgit v1.2.3 From 7688c7609f6686c2a045860c10d9502b3af5f055 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 11:44:38 -0400 Subject: Core/Spells: remove holy shock and death coil (dk) from checkcast and add them to the checkcast of the spell script. also check if unit is in front for damage spell of death coil (dk) Closes #6027 --- src/server/game/Spells/Spell.cpp | 17 ++--------------- src/server/scripts/Spells/spell_dk.cpp | 17 +++++++++++++++++ src/server/scripts/Spells/spell_paladin.cpp | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 48aa40a0e51..aef0a8ad3b3 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3427,7 +3427,7 @@ void Spell::_handle_immediate_phase() // process items for (std::list::iterator ihit= m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) DoAllEffectOnTarget(&(*ihit)); - + if (!m_originalCaster) return; // Handle procs on cast @@ -3437,7 +3437,7 @@ void Spell::_handle_immediate_phase() uint32 procAttacker = m_procAttacker; if (!procAttacker) procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; - + // Proc the spells that have DEST target m_originalCaster->ProcDamageAndSpell(NULL, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell); } @@ -4991,19 +4991,6 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; } - else if (m_spellInfo->SpellIconID == 156) // Holy Shock - { - // spell different for friends and enemies - // hurt version required facing - if (m_targets.GetUnitTarget() && !m_caster->IsFriendlyTo(m_targets.GetUnitTarget()) && !m_caster->HasInArc(static_cast(M_PI), m_targets.GetUnitTarget())) - return SPELL_FAILED_UNIT_NOT_INFRONT; - } - else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] == 0x2000) // Death Coil (DeathKnight) - { - Unit* target = m_targets.GetUnitTarget(); - if (!target || (target->IsFriendlyTo(m_caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)) - return SPELL_FAILED_BAD_TARGETS; - } else if (m_spellInfo->Id == 19938) // Awaken Peon { Unit* unit = m_targets.GetUnitTarget(); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 13190ed013f..8f0ef118e71 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -750,6 +750,23 @@ class spell_dk_death_coil : public SpellScriptLoader } } + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + { + if (!caster->IsFriendlyTo(target) && !caster->isInFront(target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + + if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD) + return SPELL_FAILED_BAD_TARGETS; + } + else + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; + } + void Register() { OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index cf8cae68c58..4baa1eb3735 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -289,8 +289,18 @@ class spell_pal_holy_shock : public SpellScriptLoader { Player* caster = GetCaster()->ToPlayer(); if (Unit* target = GetExplTargetUnit()) - if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) - return SPELL_FAILED_BAD_TARGETS; + { + if (!caster->IsFriendlyTo(target)) + { + if (!caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; + + if (!caster->isInFront(target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + } + } + else + return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } -- cgit v1.2.3 From edf1de6d936b531b05d3384f156b8cc15448313f Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 11:56:23 -0400 Subject: Core/Spells: move rocket boots spell cast check to spell script. add event for checkcast for deathcoil (dk) heh i forgot it >.< --- src/server/game/Spells/Spell.cpp | 7 +------ src/server/scripts/Spells/spell_dk.cpp | 1 + src/server/scripts/Spells/spell_item.cpp | 8 ++++++++ 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index aef0a8ad3b3..b27326fce59 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4986,12 +4986,7 @@ SpellCastResult Spell::CheckCast(bool strict) { case SPELL_EFFECT_DUMMY: { - if (m_spellInfo->Id == 51582) // Rocket Boots Engaged - { - if (m_caster->IsInWater()) - return SPELL_FAILED_ONLY_ABOVEWATER; - } - else if (m_spellInfo->Id == 19938) // Awaken Peon + if (m_spellInfo->Id == 19938) // Awaken Peon { Unit* unit = m_targets.GetUnitTarget(); if (!unit || !unit->HasAura(17743)) diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 8f0ef118e71..36dcb53ad00 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -769,6 +769,7 @@ class spell_dk_death_coil : public SpellScriptLoader void Register() { + OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 045ae5a6f9a..33e266e1326 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1748,8 +1748,16 @@ class spell_item_rocket_boots : public SpellScriptLoader caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL); } + SpellCastResult CheckCast() + { + if (GetCaster()->IsInWater()) + return SPELL_FAILED_ONLY_ABOVEWATER; + return SPELL_CAST_OK; + } + void Register() { + OnCheckCast += SpellCheckCastFn(spell_item_rocket_boots_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_item_rocket_boots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; -- cgit v1.2.3 From 01b2bf80575d1a115f88928bf7c4e17ba573c890 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 12:09:35 -0400 Subject: Core/Spells, DB/Conditions: convert checkcast cpp to conditions for spell 52264 (deliver stolen horse) --- sql/updates/world/2012_05_18_00_world_conditions.sql | 3 +++ src/server/game/Spells/Spell.cpp | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) create mode 100644 sql/updates/world/2012_05_18_00_world_conditions.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_18_00_world_conditions.sql b/sql/updates/world/2012_05_18_00_world_conditions.sql new file mode 100644 index 00000000000..a1de19ced35 --- /dev/null +++ b/sql/updates/world/2012_05_18_00_world_conditions.sql @@ -0,0 +1,3 @@ +DELETE FROM `conditions` WHERE `SourceEntry` = 52264; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,52264,0,0,29,0,28653,5,0,0,97,NULL,"Creature conditions for spell 52264 (Deliver stolen horse)"); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index b27326fce59..ae9f68f594c 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4992,11 +4992,6 @@ SpellCastResult Spell::CheckCast(bool strict) if (!unit || !unit->HasAura(17743)) return SPELL_FAILED_BAD_TARGETS; } - else if (m_spellInfo->Id == 52264) // Deliver Stolen Horse - { - if (!m_caster->FindNearestCreature(28653, 5)) - return SPELL_FAILED_OUT_OF_RANGE; - } else if (m_spellInfo->Id == 31789) // Righteous Defense { if (m_caster->GetTypeId() != TYPEID_PLAYER) -- cgit v1.2.3 From e897bb59f74178c60ce24153e35d1ad4eb230ad9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 12:25:13 -0400 Subject: Core/SpellEffects: successful dispel effects on hostile targets should put you in combat. Closes #656 Closes #678 --- src/server/game/Spells/SpellEffects.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c306da9d43b..51f37ec5920 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2610,6 +2610,9 @@ void Spell::EffectDispel(SpellEffIndex effIndex) } m_caster->SendMessageToSet(&dataSuccess, true); + if (m_caster->IsValidAttackTarget(unitTarget) && !m_caster->isInCombat()) + m_caster->CombatStart(unitTarget); + // On success dispel // Devour Magic if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == SPELLCATEGORY_DEVOUR_MAGIC) @@ -3539,7 +3542,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Add melee damage bonuses (also check for negative) uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo); - + m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damage, m_attackType, m_spellInfo); } -- cgit v1.2.3 From 1037f96e4f9a788cc450fd429ce5f2b0fcc29790 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 12:31:13 -0400 Subject: Core/Spells: Damage should be dealt AFTER m_damage has been set. possibly fixes scourge strike damage calculations. --- src/server/game/Spells/Spell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ae9f68f594c..758769b36a4 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2475,15 +2475,16 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); } - caster->DealSpellDamage(&damageInfo, true); - // Haunt if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1)) { AuraEffect* aurEff = m_spellAura->GetEffect(1); aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage)); } + m_damage = damageInfo.damage; + + caster->DealSpellDamage(&damageInfo, true); } // Passive spell hits/misses or active spells only misses (only triggers) else -- cgit v1.2.3 From d1e0dc3fe0c95f78ef261d19c956faf8d3f70a35 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 May 2012 13:49:59 -0400 Subject: Core/Spells: fix dispel aggro in a less hacky way! --- src/server/game/Spells/Spell.cpp | 2 +- src/server/game/Spells/SpellEffects.cpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 758769b36a4..de432229e2c 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2505,7 +2505,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) } } - if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && !m_spellInfo->IsPositive()) + if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) { m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO)); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 51f37ec5920..07bea5f980c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2610,9 +2610,6 @@ void Spell::EffectDispel(SpellEffIndex effIndex) } m_caster->SendMessageToSet(&dataSuccess, true); - if (m_caster->IsValidAttackTarget(unitTarget) && !m_caster->isInCombat()) - m_caster->CombatStart(unitTarget); - // On success dispel // Devour Magic if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == SPELLCATEGORY_DEVOUR_MAGIC) -- cgit v1.2.3 From 881138553b1a85fda62cc131dc6487195e49a2d1 Mon Sep 17 00:00:00 2001 From: Elron103 Date: Fri, 18 May 2012 21:23:07 +0200 Subject: Core/Spells: Fix immunity checking for creatures (i.e. Mind Control) --- src/server/game/Entities/Creature/Creature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index d120713636d..6506a113ae1 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1668,8 +1668,8 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) if (!spellInfo) return false; - // Spells that don't have effectMechanics. - if (!spellInfo->HasAnyEffectMechanic() && GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1))) + // Creature is immune to main mechanic of the spell + if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1))) return true; // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break -- cgit v1.2.3 From fc0950dbf33e6a4a9797be46bfe2e7dd2366d9e1 Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 19 May 2012 11:48:41 +0100 Subject: SQLS: Correct comments for 2012_02_16_00_world_conditions.sql (Core/Opcs: Use Handle_NULL for an unused opcode) Closes #6517 (pr) --- sql/updates/world/2012_02_16_00_world_conditions.sql | 10 +++++----- src/server/game/Server/Protocol/Opcodes.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/sql/updates/world/2012_02_16_00_world_conditions.sql b/sql/updates/world/2012_02_16_00_world_conditions.sql index a01792ef838..5bef38fc485 100644 --- a/sql/updates/world/2012_02_16_00_world_conditions.sql +++ b/sql/updates/world/2012_02_16_00_world_conditions.sql @@ -4,8 +4,8 @@ CREATE TABLE `temp_convert_spells` PRIMARY KEY (`id`) ); -# spells with EffectImplicitTarget In (6,21, 25) + spells having Targets & 1115534 -# those spells are the ones which require explicit unit target to cast +-- spells with EffectImplicitTarget In (6,21, 25) + spells having Targets & 1115534 +-- those spells are the ones which require explicit unit target to cast INSERT INTO `temp_convert_spells` VALUES (5), (11), @@ -12783,13 +12783,13 @@ INSERT IGNORE INTO `temp_item_spell` SELECT `entry`, `spellid_5` FROM `item_temp INSERT INTO `temp_cond_vals` (`spellId`, `entry`, `dead`, `errorTextId`, `comment`) SELECT DISTINCT (SELECT `spellId` FROM `temp_item_spell` WHERE `itemId` = `SourceEntry`), `ConditionValue2`, (`ConditionValue1` - 1), `ErrorTextId`, `Comment` FROM `conditions` WHERE `SourceTypeOrReferenceId` = 18; -#use CONDITION_OBJECT_ENTRY instead of CONDITION_ITEM_TARGET +-- use CONDITION_OBJECT_ENTRY instead of CONDITION_ITEM_TARGET INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `Comment`) SELECT DISTINCT 17, 0, `spellId`, 0, `elseGroup` - 1, 31, 1, 3, `entry`, 0, 0, `errorTextId`, `comment` FROM `temp_cond_vals`; -#for CONDITION_ITEM_TARGET with ConditionValue1 = DEAD we're adding !CONDITION_ALIVE as a second requirement +-- for CONDITION_ITEM_TARGET with ConditionValue1 = DEAD we're adding !CONDITION_ALIVE as a second requirement INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `Comment`) SELECT DISTINCT 17, 0, `spellId`, 0, `elseGroup` - 1, 36, 1, 0, 0, 0, 1, `errorTextId`, `comment` FROM `temp_cond_vals` WHERE `dead`; -#remove entries which could be converted by this sql +-- remove entries which could be converted by this sql DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 18 AND `SourceEntry` IN (SELECT `itemId` FROM `temp_item_spell`); DROP TABLE `temp_convert_spells`; DROP TABLE `temp_cond_vals`; diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index aa6013fae3d..63ee2369ce3 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -491,7 +491,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x1CE*/ { "CMSG_QUERY_TIME", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQueryTimeOpcode }, /*0x1CF*/ { "SMSG_QUERY_TIME_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x1D0*/ { "SMSG_LOG_XPGAIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x1D2*/ { "CMSG_RECLAIM_CORPSE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReclaimCorpseOpcode }, /*0x1D3*/ { "CMSG_WRAP_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleWrapItemOpcode }, /*0x1D4*/ { "SMSG_LEVELUP_INFO", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, -- cgit v1.2.3 From c3287fee0636e9beee460bdb9d3ddbaa34631504 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sat, 19 May 2012 13:04:58 +0200 Subject: Core/SmartAI: - Improve an error msg in ProcessAction - Allow dist/angle to be 0.0f and set default if negative when using SMART_ACTION_FOLLOW - Some minor cleanup in Opcodes.cpp, all smsg's should have Handle_ServerSide --- src/server/game/AI/SmartScripts/SmartAI.cpp | 6 +++--- src/server/game/AI/SmartScripts/SmartScript.cpp | 2 +- src/server/game/Server/Protocol/Opcodes.cpp | 10 +++++----- src/server/game/Server/WorldSession.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 2a412bffb22..08f1b18ffad 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -804,12 +804,12 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui return; SetRun(mRun); mFollowGuid = target->GetGUID(); - mFollowDist = dist ? dist : PET_FOLLOW_DIST; - mFollowAngle = angle ? angle : me->GetFollowAngle(); + mFollowDist = dist >= 0.0f ? dist : PET_FOLLOW_DIST; + mFollowAngle = angle >= 0.0f ? angle : me->GetFollowAngle(); mFollowArrivedTimer = 1000; mFollowCredit = credit; mFollowArrivedEntry = end; - me->GetMotionMaster()->MoveFollow(target, dist, angle); + me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle); mFollowCreditType = creditType; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 893c8f4580e..85b117ccd8c 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1925,7 +1925,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; } default: - sLog->outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType()); + sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; } diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 63ee2369ce3..517935acbd2 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -270,8 +270,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x0F1*/ { "MSG_MOVE_KNOCK_BACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x0F2*/ { "SMSG_MOVE_FEATHER_FALL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x0F3*/ { "SMSG_MOVE_NORMAL_FALL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x0F4*/ { "SMSG_MOVE_SET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, - /*0x0F5*/ { "SMSG_MOVE_UNSET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x0F4*/ { "SMSG_MOVE_SET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x0F5*/ { "SMSG_MOVE_UNSET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x0F6*/ { "CMSG_MOVE_HOVER_ACK", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleMoveHoverAck }, /*0x0F7*/ { "MSG_MOVE_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x0F8*/ { "CMSG_TRIGGER_CINEMATIC_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, @@ -491,7 +491,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x1CE*/ { "CMSG_QUERY_TIME", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQueryTimeOpcode }, /*0x1CF*/ { "SMSG_QUERY_TIME_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x1D0*/ { "SMSG_LOG_XPGAIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x1D2*/ { "CMSG_RECLAIM_CORPSE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReclaimCorpseOpcode }, /*0x1D3*/ { "CMSG_WRAP_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleWrapItemOpcode }, /*0x1D4*/ { "SMSG_LEVELUP_INFO", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, @@ -970,7 +970,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3AD*/ { "MSG_MOVE_UPDATE_CAN_FLY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x3AE*/ { "MSG_RAID_READY_CHECK_CONFIRM", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x3AF*/ { "CMSG_VOICE_SESSION_ENABLE", STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleVoiceSessionEnableOpcode }, - /*0x3B0*/ { "SMSG_VOICE_SESSION_ENABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x3B0*/ { "SMSG_VOICE_SESSION_ENABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3B1*/ { "SMSG_VOICE_PARENTAL_CONTROLS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3B2*/ { "CMSG_GM_WHISPER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x3B3*/ { "SMSG_GM_MESSAGECHAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, @@ -1023,7 +1023,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3E2*/ { "SMSG_COMSAT_CONNECT_FAIL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3E3*/ { "SMSG_VOICE_CHAT_STATUS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3E4*/ { "CMSG_REPORT_PVP_AFK", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReportPvPAFK }, - /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x3E6*/ { "CMSG_GUILD_BANKER_ACTIVATE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildBankerActivate }, /*0x3E7*/ { "CMSG_GUILD_BANK_QUERY_TAB", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildBankQueryTab }, /*0x3E8*/ { "SMSG_GUILD_BANK_LIST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 0fce0a372ff..bb54a0ae19e 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -395,7 +395,7 @@ class WorldSession public: // opcodes handlers void Handle_NULL(WorldPacket& recvPacket); // not used - void Handle_EarlyProccess(WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead + void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client void Handle_Deprecated(WorldPacket& recvPacket); // never used anymore by client -- cgit v1.2.3 From 524e30e57b4a743f1ebd964f06657487d437d0f4 Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Sat, 19 May 2012 15:09:23 +0100 Subject: Scripts/kalimdor: Use proper headers to optimize compile, code style and general cleanup. Closes #6419 (pr) --- src/server/scripts/EasternKingdoms/undercity.cpp | 6 +- src/server/scripts/Kalimdor/ashenvale.cpp | 196 +++++++------ src/server/scripts/Kalimdor/azshara.cpp | 225 ++++++++------- src/server/scripts/Kalimdor/azuremyst_isle.cpp | 186 ++++++------- src/server/scripts/Kalimdor/bloodmyst_isle.cpp | 16 +- src/server/scripts/Kalimdor/boss_azuregos.cpp | 119 ++++---- src/server/scripts/Kalimdor/darkshore.cpp | 135 ++++----- src/server/scripts/Kalimdor/desolace.cpp | 27 +- src/server/scripts/Kalimdor/durotar.cpp | 20 +- src/server/scripts/Kalimdor/dustwallow_marsh.cpp | 61 ++-- src/server/scripts/Kalimdor/felwood.cpp | 25 +- src/server/scripts/Kalimdor/feralas.cpp | 6 +- src/server/scripts/Kalimdor/moonglade.cpp | 212 +++++++------- src/server/scripts/Kalimdor/mulgore.cpp | 171 ++++++------ src/server/scripts/Kalimdor/orgrimmar.cpp | 53 ++-- src/server/scripts/Kalimdor/silithus.cpp | 32 +-- .../scripts/Kalimdor/stonetalon_mountains.cpp | 6 +- src/server/scripts/Kalimdor/tanaris.cpp | 306 +++++++++++---------- src/server/scripts/Kalimdor/teldrassil.cpp | 17 +- src/server/scripts/Kalimdor/the_barrens.cpp | 100 +++---- src/server/scripts/Kalimdor/thousand_needles.cpp | 85 +++--- src/server/scripts/Kalimdor/thunder_bluff.cpp | 67 ++--- src/server/scripts/Kalimdor/ungoro_crater.cpp | 117 ++++---- src/server/scripts/Kalimdor/winterspring.cpp | 4 +- .../Ulduar/Ulduar/boss_algalon_the_observer.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 2 +- src/server/scripts/Spells/spell_shaman.cpp | 2 +- 27 files changed, 1116 insertions(+), 1082 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index d5896812007..a9b627ded34 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -184,7 +184,7 @@ public: { if (Unit* victim = me->getVictim()) { - DoCast(me->getVictim(), SPELL_BLACK_ARROW); + DoCast(victim, SPELL_BLACK_ARROW); BlackArrowTimer = 15000 + rand()%5000; } } else BlackArrowTimer -= diff; @@ -193,7 +193,7 @@ public: { if (Unit* victim = me->getVictim()) { - DoCast(me->getVictim(), SPELL_SHOT); + DoCast(victim, SPELL_SHOT); ShotTimer = 8000 + rand()%2000; } } else ShotTimer -= diff; @@ -202,7 +202,7 @@ public: { if (Unit* victim = me->getVictim()) { - DoCast(me->getVictim(), SPELL_MULTI_SHOT); + DoCast(victim, SPELL_MULTI_SHOT); MultiShotTimer = 10000 + rand()%3000; } } else MultiShotTimer -= diff; diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp index cec5e42aee5..e28665c038e 100644 --- a/src/server/scripts/Kalimdor/ashenvale.cpp +++ b/src/server/scripts/Kalimdor/ashenvale.cpp @@ -28,7 +28,8 @@ npc_torek npc_ruul_snowhoof EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*#### @@ -78,32 +79,31 @@ class npc_torek : public CreatureScript void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 1: - Talk(SAY_MOVE, player->GetGUID()); - break; - case 8: - Talk(SAY_PREPARE, player->GetGUID()); - break; - case 19: - //TODO: verify location and creatures amount. - me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 20: - DoScriptText(SAY_WIN, me, player); - Completed = true; - player->GroupEventHappens(QUEST_TOREK_ASSULT, me); - break; - case 21: - Talk(SAY_END, player->GetGUID()); - break; + switch (waypointId) + { + case 1: + Talk(SAY_MOVE, player->GetGUID()); + break; + case 8: + Talk(SAY_PREPARE, player->GetGUID()); + break; + case 19: + //TODO: verify location and creatures amount. + me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 20: + DoScriptText(SAY_WIN, me, player); + Completed = true; + player->GroupEventHappens(QUEST_TOREK_ASSULT, me); + break; + case 21: + Talk(SAY_END, player->GetGUID()); + break; + } } } @@ -169,8 +169,26 @@ class npc_torek : public CreatureScript # npc_ruul_snowhoof ####*/ -#define QUEST_FREEDOM_TO_RUUL 6482 -#define GO_CAGE 178147 +enum RuulSnowhoof +{ + NPC_THISTLEFUR_URSA = 3921, + NPC_THISTLEFUR_TOTEMIC = 3922, + NPC_THISTLEFUR_PATHFINDER = 3926, + + QUEST_FREEDOM_TO_RUUL = 6482, + + GO_CAGE = 178147 +}; + +Position const RuulSnowhoofSummonsCoord[6] = +{ + {3449.218018f, -587.825073f, 174.978867f, 4.714445f}, + {3446.384521f, -587.830872f, 175.186279f, 4.714445f}, + {3444.218994f, -587.835327f, 175.380600f, 4.714445f}, + {3508.344482f, -492.024261f, 186.929031f, 4.145029f}, + {3506.265625f, -490.531006f, 186.740128f, 4.239277f}, + {3503.682373f, -489.393799f, 186.629684f, 4.349232f} +}; class npc_ruul_snowhoof : public CreatureScript { @@ -195,14 +213,14 @@ class npc_ruul_snowhoof : public CreatureScript Cage->SetGoState(GO_STATE_ACTIVE); break; case 13: - me->SummonCreature(3922, 3449.218018f, -587.825073f, 174.978867f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3921, 3446.384521f, -587.830872f, 175.186279f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3926, 3444.218994f, -587.835327f, 175.380600f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[0], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[1], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[2], TEMPSUMMON_DEAD_DESPAWN, 60000); break; case 19: - me->SummonCreature(3922, 3508.344482f, -492.024261f, 186.929031f, 4.145029f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3921, 3506.265625f, -490.531006f, 186.740128f, 4.239277f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3926, 3503.682373f, -489.393799f, 186.629684f, 4.349232f, TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[3], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[4], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[5], TEMPSUMMON_DEAD_DESPAWN, 60000); break; case 21: player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me); @@ -214,8 +232,7 @@ class npc_ruul_snowhoof : public CreatureScript void Reset() { - GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20); - if (Cage) + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) Cage->SetGoState(GO_STATE_READY); } @@ -249,7 +266,7 @@ class npc_ruul_snowhoof : public CreatureScript } }; -enum eEnums +enum Muglash { SAY_MUG_START1 = -1800054, SAY_MUG_START2 = -1800055, @@ -278,21 +295,21 @@ enum eEnums NPC_MUGLASH = 12717 }; -static float m_afFirstNagaCoord[3][3]= +Position const FirstNagaCoord[3] = { - {3603.504150f, 1122.631104f, 1.635f}, // rider - {3589.293945f, 1148.664063f, 5.565f}, // sorceress - {3609.925537f, 1168.759521f, -1.168f} // razortail + {3603.504150f, 1122.631104f, 1.635f, 0.0f}, // rider + {3589.293945f, 1148.664063f, 5.565f, 0.0f}, // sorceress + {3609.925537f, 1168.759521f, -1.168f, 0.0f} // razortail }; -static float m_afSecondNagaCoord[3][3]= +Position const SecondNagaCoord[3] = { - {3609.925537f, 1168.759521f, -1.168f}, // witch - {3645.652100f, 1139.425415f, 1.322f}, // priest - {3583.602051f, 1128.405762f, 2.347f} // myrmidon + {3609.925537f, 1168.759521f, -1.168f, 0.0f}, // witch + {3645.652100f, 1139.425415f, 1.322f, 0.0f}, // priest + {3583.602051f, 1128.405762f, 2.347f, 0.0f} // myrmidon }; -static float m_fVorshaCoord[]={3633.056885f, 1172.924072f, -5.388f}; +Position const VorshaCoord = {3633.056885f, 1172.924072f, -5.388f, 0.0f}; class npc_muglash : public CreatureScript { @@ -303,9 +320,9 @@ class npc_muglash : public CreatureScript { npc_muglashAI(Creature* creature) : npc_escortAI(creature) { } - uint32 m_uiWaveId; - uint32 m_uiEventTimer; - bool m_bIsBrazierExtinguished; + uint8 WaveId; + uint32 EventTimer; + bool IsBrazierExtinguished; void JustSummoned(Creature* summoned) { @@ -314,34 +331,33 @@ class npc_muglash : public CreatureScript void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 0: - if (player) + switch (waypointId) + { + case 0: DoScriptText(SAY_MUG_START2, me, player); - break; - case 24: - if (player) + break; + case 24: DoScriptText(SAY_MUG_BRAZIER, me, player); - if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2)) - { - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - SetEscortPaused(true); - } - break; - case 25: - DoScriptText(SAY_MUG_GRATITUDE, me); - player->GroupEventHappens(QUEST_VORSHA, me); - break; - case 26: - DoScriptText(SAY_MUG_PATROL, me); - break; - case 27: - DoScriptText(SAY_MUG_RETURN, me); - break; + if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2)) + { + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + SetEscortPaused(true); + } + break; + case 25: + DoScriptText(SAY_MUG_GRATITUDE, me); + player->GroupEventHappens(QUEST_VORSHA, me); + break; + case 26: + DoScriptText(SAY_MUG_PATROL, me); + break; + case 27: + DoScriptText(SAY_MUG_RETURN, me); + break; + } } } @@ -358,9 +374,9 @@ class npc_muglash : public CreatureScript void Reset() { - m_uiEventTimer = 10000; - m_uiWaveId = 0; - m_bIsBrazierExtinguished = false; + EventTimer = 10000; + WaveId = 0; + IsBrazierExtinguished = false; } void JustDied(Unit* /*killer*/) @@ -372,20 +388,20 @@ class npc_muglash : public CreatureScript void DoWaveSummon() { - switch (m_uiWaveId) + switch (WaveId) { case 1: - me->SummonCreature(NPC_WRATH_RIDER, m_afFirstNagaCoord[0][0], m_afFirstNagaCoord[0][1], m_afFirstNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_SORCERESS, m_afFirstNagaCoord[1][0], m_afFirstNagaCoord[1][1], m_afFirstNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_RAZORTAIL, m_afFirstNagaCoord[2][0], m_afFirstNagaCoord[2][1], m_afFirstNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_RIDER, FirstNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_SORCERESS, FirstNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_RAZORTAIL, FirstNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 2: - me->SummonCreature(NPC_WRATH_PRIESTESS, m_afSecondNagaCoord[0][0], m_afSecondNagaCoord[0][1], m_afSecondNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_MYRMIDON, m_afSecondNagaCoord[1][0], m_afSecondNagaCoord[1][1], m_afSecondNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_SEAWITCH, m_afSecondNagaCoord[2][0], m_afSecondNagaCoord[2][1], m_afSecondNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_PRIESTESS, SecondNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_MYRMIDON, SecondNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_SEAWITCH, SecondNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 3: - me->SummonCreature(NPC_VORSHA, m_fVorshaCoord[0], m_fVorshaCoord[1], m_fVorshaCoord[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_VORSHA, VorshaCoord, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 4: SetEscortPaused(false); @@ -400,16 +416,16 @@ class npc_muglash : public CreatureScript if (!me->getVictim()) { - if (HasEscortState(STATE_ESCORT_PAUSED) && m_bIsBrazierExtinguished) + if (HasEscortState(STATE_ESCORT_PAUSED) && IsBrazierExtinguished) { - if (m_uiEventTimer < uiDiff) + if (EventTimer < uiDiff) { - ++m_uiWaveId; + ++WaveId; DoWaveSummon(); - m_uiEventTimer = 10000; + EventTimer = 10000; } else - m_uiEventTimer -= uiDiff; + EventTimer -= uiDiff; } return; } @@ -451,7 +467,7 @@ class go_naga_brazier : public GameObjectScript { DoScriptText(SAY_MUG_BRAZIER_WAIT, creature); - pEscortAI->m_bIsBrazierExtinguished = true; + pEscortAI->IsBrazierExtinguished = true; return false; } } diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp index 2e7b0a684c1..eae5baa8db2 100644 --- a/src/server/scripts/Kalimdor/azshara.cpp +++ b/src/server/scripts/Kalimdor/azshara.cpp @@ -30,9 +30,9 @@ mob_rizzle_sprysprocket mob_depth_charge EndContentData */ -#include "ScriptPCH.h" -#include "World.h" -#include "WorldPacket.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## mobs_spitelashes @@ -179,9 +179,12 @@ public: # mob_rizzle_sprysprocket ####*/ -enum eRizzleSprysprocketData +enum RizzleSprysprocketData { + QUEST_CHASING_THE_MOONSTONE = 10994, + MOB_DEPTH_CHARGE = 23025, + SPELL_RIZZLE_BLACKJACK = 39865, SPELL_RIZZLE_ESCAPE = 39871, SPELL_RIZZLE_FROST_GRENADE = 40525, @@ -199,67 +202,66 @@ enum eRizzleSprysprocketData #define GOSSIP_GET_MOONSTONE "Hand over the Southfury moonstone and I'll let you go." -float WPs[58][4] = +Position const WPs[58] = { -//pos_x pos_y pos_z orien -{3691.97f, -3962.41f, 35.9118f, 3.67f}, -{3675.02f, -3960.49f, 35.9118f, 3.67f}, -{3653.19f, -3958.33f, 33.9118f, 3.59f}, -{3621.12f, -3958.51f, 29.9118f, 3.48f}, -{3604.86f, -3963, 29.9118f, 3.48f}, -{3569.94f, -3970.25f, 29.9118f, 3.44f}, -{3541.03f, -3975.64f, 29.9118f, 3.41f}, -{3510.84f, -3978.71f, 29.9118f, 3.41f}, -{3472.7f, -3997.07f, 29.9118f, 3.35f}, -{3439.15f, -4014.55f, 29.9118f, 3.29f}, -{3412.8f, -4025.87f, 29.9118f, 3.25f}, -{3384.95f, -4038.04f, 29.9118f, 3.24f}, -{3346.77f, -4052.93f, 29.9118f, 3.22f}, -{3299.56f, -4071.59f, 29.9118f, 3.20f}, -{3261.22f, -4080.38f, 30.9118f, 3.19f}, -{3220.68f, -4083.09f, 31.9118f, 3.18f}, -{3187.11f, -4070.45f, 33.9118f, 3.16f}, -{3162.78f, -4062.75f, 33.9118f, 3.15f}, -{3136.09f, -4050.32f, 33.9118f, 3.07f}, -{3119.47f, -4044.51f, 36.0363f, 3.07f}, -{3098.95f, -4019.8f, 33.9118f, 3.07f}, -{3073.07f, -4011.42f, 33.9118f, 3.07f}, -{3051.71f, -3993.37f, 33.9118f, 3.02f}, -{3027.52f, -3978.6f, 33.9118f, 3.00f}, -{3003.78f, -3960.14f, 33.9118f, 2.98f}, -{2977.99f, -3941.98f, 31.9118f, 2.96f}, -{2964.57f, -3932.07f, 30.9118f, 2.96f}, -{2947.9f, -3921.31f, 29.9118f, 2.96f}, -{2924.91f, -3910.8f, 29.9118f, 2.94f}, -{2903.04f, -3896.42f, 29.9118f, 2.93f}, -{2884.75f, -3874.03f, 29.9118f, 2.90f}, -{2868.19f, -3851.48f, 29.9118f, 2.82f}, -{2854.62f, -3819.72f, 29.9118f, 2.80f}, -{2825.53f, -3790.4f, 29.9118f, 2.744f}, -{2804.31f, -3773.05f, 29.9118f, 2.71f}, -{2769.78f, -3763.57f, 29.9118f, 2.70f}, -{2727.23f, -3745.92f, 30.9118f, 2.69f}, -{2680.12f, -3737.49f, 30.9118f, 2.67f}, -{2647.62f, -3739.94f, 30.9118f, 2.66f}, -{2616.6f, -3745.75f, 30.9118f, 2.64f}, -{2589.38f, -3731.97f, 30.9118f, 2.61f}, -{2562.94f, -3722.35f, 31.9118f, 2.56f}, -{2521.05f, -3716.6f, 31.9118f, 2.55f}, -{2485.26f, -3706.67f, 31.9118f, 2.51f}, -{2458.93f, -3696.67f, 31.9118f, 2.51f}, -{2432, -3692.03f, 31.9118f, 2.46f}, -{2399.59f, -3681.97f, 31.9118f, 2.45f}, -{2357.75f, -3666.6f, 31.9118f, 2.44f}, -{2311.99f, -3656.88f, 31.9118f, 2.94f}, -{2263.41f, -3649.55f, 31.9118f, 3.02f}, -{2209.05f, -3641.76f, 31.9118f, 2.99f}, -{2164.83f, -3637.64f, 31.9118f, 3.15f}, -{2122.42f, -3639, 31.9118f, 3.21f}, -{2075.73f, -3643.59f, 31.9118f, 3.22f}, -{2033.59f, -3649.52f, 31.9118f, 3.42f}, -{1985.22f, -3662.99f, 31.9118f, 3.42f}, -{1927.09f, -3679.56f, 33.9118f, 3.42f}, -{1873.57f, -3695.32f, 33.9118f, 3.44f} + {3691.97f, -3962.41f, 35.9118f, 3.67f}, + {3675.02f, -3960.49f, 35.9118f, 3.67f}, + {3653.19f, -3958.33f, 33.9118f, 3.59f}, + {3621.12f, -3958.51f, 29.9118f, 3.48f}, + {3604.86f, -3963, 29.9118f, 3.48f}, + {3569.94f, -3970.25f, 29.9118f, 3.44f}, + {3541.03f, -3975.64f, 29.9118f, 3.41f}, + {3510.84f, -3978.71f, 29.9118f, 3.41f}, + {3472.7f, -3997.07f, 29.9118f, 3.35f}, + {3439.15f, -4014.55f, 29.9118f, 3.29f}, + {3412.8f, -4025.87f, 29.9118f, 3.25f}, + {3384.95f, -4038.04f, 29.9118f, 3.24f}, + {3346.77f, -4052.93f, 29.9118f, 3.22f}, + {3299.56f, -4071.59f, 29.9118f, 3.20f}, + {3261.22f, -4080.38f, 30.9118f, 3.19f}, + {3220.68f, -4083.09f, 31.9118f, 3.18f}, + {3187.11f, -4070.45f, 33.9118f, 3.16f}, + {3162.78f, -4062.75f, 33.9118f, 3.15f}, + {3136.09f, -4050.32f, 33.9118f, 3.07f}, + {3119.47f, -4044.51f, 36.0363f, 3.07f}, + {3098.95f, -4019.8f, 33.9118f, 3.07f}, + {3073.07f, -4011.42f, 33.9118f, 3.07f}, + {3051.71f, -3993.37f, 33.9118f, 3.02f}, + {3027.52f, -3978.6f, 33.9118f, 3.00f}, + {3003.78f, -3960.14f, 33.9118f, 2.98f}, + {2977.99f, -3941.98f, 31.9118f, 2.96f}, + {2964.57f, -3932.07f, 30.9118f, 2.96f}, + {2947.9f, -3921.31f, 29.9118f, 2.96f}, + {2924.91f, -3910.8f, 29.9118f, 2.94f}, + {2903.04f, -3896.42f, 29.9118f, 2.93f}, + {2884.75f, -3874.03f, 29.9118f, 2.90f}, + {2868.19f, -3851.48f, 29.9118f, 2.82f}, + {2854.62f, -3819.72f, 29.9118f, 2.80f}, + {2825.53f, -3790.4f, 29.9118f, 2.744f}, + {2804.31f, -3773.05f, 29.9118f, 2.71f}, + {2769.78f, -3763.57f, 29.9118f, 2.70f}, + {2727.23f, -3745.92f, 30.9118f, 2.69f}, + {2680.12f, -3737.49f, 30.9118f, 2.67f}, + {2647.62f, -3739.94f, 30.9118f, 2.66f}, + {2616.6f, -3745.75f, 30.9118f, 2.64f}, + {2589.38f, -3731.97f, 30.9118f, 2.61f}, + {2562.94f, -3722.35f, 31.9118f, 2.56f}, + {2521.05f, -3716.6f, 31.9118f, 2.55f}, + {2485.26f, -3706.67f, 31.9118f, 2.51f}, + {2458.93f, -3696.67f, 31.9118f, 2.51f}, + {2432, -3692.03f, 31.9118f, 2.46f}, + {2399.59f, -3681.97f, 31.9118f, 2.45f}, + {2357.75f, -3666.6f, 31.9118f, 2.44f}, + {2311.99f, -3656.88f, 31.9118f, 2.94f}, + {2263.41f, -3649.55f, 31.9118f, 3.02f}, + {2209.05f, -3641.76f, 31.9118f, 2.99f}, + {2164.83f, -3637.64f, 31.9118f, 3.15f}, + {2122.42f, -3639, 31.9118f, 3.21f}, + {2075.73f, -3643.59f, 31.9118f, 3.22f}, + {2033.59f, -3649.52f, 31.9118f, 3.42f}, + {1985.22f, -3662.99f, 31.9118f, 3.42f}, + {1927.09f, -3679.56f, 33.9118f, 3.42f}, + {1873.57f, -3695.32f, 33.9118f, 3.44f} }; class mob_rizzle_sprysprocket : public CreatureScript @@ -270,19 +272,19 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF + 1 && player->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + if (action == GOSSIP_ACTION_INFO_DEF + 1 && player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, SPELL_GIVE_SOUTHFURY_MOONSTONE, true); - CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->Must_Die_Timer = 3000; - CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->Must_Die = true; + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->MustDieTimer = 3000; + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->MustDie = true; } return true; } bool OnGossipHello(Player* player, Creature* creature) { - if (player->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) != QUEST_STATUS_INCOMPLETE) return true; player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(10811, creature->GetGUID()); @@ -298,32 +300,32 @@ public: { mob_rizzle_sprysprocketAI(Creature* creature) : ScriptedAI(creature) {} - uint32 spellEscape_Timer; - uint32 Teleport_Timer; - uint32 Check_Timer; - uint32 Grenade_Timer; - uint32 Must_Die_Timer; + uint32 SpellEscapeTimer; + uint32 TeleportTimer; + uint32 CheckTimer; + uint32 GrenadeTimer; + uint32 MustDieTimer; uint32 CurrWP; uint64 PlayerGUID; - bool Must_Die; + bool MustDie; bool Escape; bool ContinueWP; bool Reached; void Reset() { - spellEscape_Timer = 1300; - Teleport_Timer = 3500; - Check_Timer = 10000; - Grenade_Timer = 30000; - Must_Die_Timer = 3000; + SpellEscapeTimer = 1300; + TeleportTimer = 3500; + CheckTimer = 10000; + GrenadeTimer = 30000; + MustDieTimer = 3000; CurrWP = 0; PlayerGUID = 0; - Must_Die = false; + MustDie = false; Escape = false; ContinueWP = false; Reached = false; @@ -331,13 +333,13 @@ public: void UpdateAI(const uint32 diff) { - if (Must_Die) + if (MustDie) { - if (Must_Die_Timer <= diff) + if (MustDieTimer <= diff) { me->DespawnOrUnsummon(); return; - } else Must_Die_Timer -= diff; + } else MustDieTimer -= diff; } if (!Escape) @@ -345,17 +347,16 @@ public: if (!PlayerGUID) return; - if (spellEscape_Timer <= diff) + if (SpellEscapeTimer <= diff) { DoCast(me, SPELL_RIZZLE_ESCAPE, false); - spellEscape_Timer = 10000; - } else spellEscape_Timer -= diff; + SpellEscapeTimer = 10000; + } else SpellEscapeTimer -= diff; - if (Teleport_Timer <= diff) + if (TeleportTimer <= diff) { //temp solution - unit can't be teleported by core using spelleffect 5, only players - Map* map = me->GetMap(); - if (map) + if (me->GetMap()) { me->SetPosition(3706.39f, -3969.15f, 35.9118f, 0); me->AI_SendMoveToPacket(3706.39f, -3969.15f, 35.9118f, 0, 0, 0); @@ -367,20 +368,20 @@ public: me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); me->SetSpeed(MOVE_RUN, 0.85f, true); me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]); Escape = true; - } else Teleport_Timer -= diff; + } else TeleportTimer -= diff; return; } if (ContinueWP) { - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]); ContinueWP = false; } - if (Grenade_Timer <= diff) + if (GrenadeTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player) @@ -388,10 +389,10 @@ public: DoScriptText(SAY_RIZZLE_GRENADE, me, player); DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true); } - Grenade_Timer = 30000; - } else Grenade_Timer -= diff; + GrenadeTimer = 30000; + } else GrenadeTimer -= diff; - if (Check_Timer <= diff) + if (CheckTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (!player) @@ -410,8 +411,8 @@ public: Reached = true; } - Check_Timer = 1000; - } else Check_Timer -= diff; + CheckTimer = 1000; + } else CheckTimer -= diff; } @@ -427,7 +428,7 @@ public: if (!who || PlayerGUID) return; - if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE) { PlayerGUID = who->GetGUID(); DoScriptText(SAY_RIZZLE_START, me); @@ -472,25 +473,25 @@ public: { mob_depth_chargeAI(Creature* creature) : ScriptedAI(creature) {} - bool we_must_die; - uint32 must_die_timer; + bool WeMustDie; + uint32 WeMustDieTimer; void Reset() { me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - we_must_die = false; - must_die_timer = 1000; + WeMustDie = false; + WeMustDieTimer = 1000; } void UpdateAI(const uint32 diff) { - if (we_must_die) + if (WeMustDie) { - if (must_die_timer <= diff) - { + if (WeMustDieTimer <= diff) me->DespawnOrUnsummon(); - } else must_die_timer -= diff; + else + WeMustDieTimer -= diff; } return; } @@ -503,18 +504,14 @@ public: if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5)) { DoCast(who, SPELL_DEPTH_CHARGE_TRAP); - we_must_die = true; + WeMustDie = true; return; } } - void AttackStart(Unit* /*who*/) - { - } + void AttackStart(Unit* /*who*/) {} - void EnterCombat(Unit* /*who*/) - { - } + void EnterCombat(Unit* /*who*/) {} }; }; diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index dfb1f3b0bdf..608117ca9af 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -33,15 +33,19 @@ go_ravager_cage npc_death_ravager EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" -#include +#include "ScriptedGossip.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" /*###### ## npc_draenei_survivor ######*/ -enum eEnums +enum draeneiSurvivor { SAY_HEAL1 = -1000176, SAY_HEAL2 = -1000177, @@ -175,7 +179,7 @@ public: ## npc_engineer_spark_overgrind ######*/ -enum eOvergrind +enum Overgrind { SAY_TEXT = -1000184, SAY_EMOTE = -1000185, @@ -235,15 +239,15 @@ public: uint32 NormFaction; uint32 NpcFlags; - uint32 Dynamite_Timer; - uint32 Emote_Timer; + uint32 DynamiteTimer; + uint32 EmoteTimer; bool IsTreeEvent; void Reset() { - Dynamite_Timer = 8000; - Emote_Timer = urand(120000, 150000); + DynamiteTimer = 8000; + EmoteTimer = urand(120000, 150000); me->setFaction(NormFaction); me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); @@ -260,12 +264,12 @@ public: { if (!me->isInCombat() && !IsTreeEvent) { - if (Emote_Timer <= diff) + if (EmoteTimer <= diff) { DoScriptText(SAY_TEXT, me); DoScriptText(SAY_EMOTE, me); - Emote_Timer = urand(120000, 150000); - } else Emote_Timer -= diff; + EmoteTimer = urand(120000, 150000); + } else EmoteTimer -= diff; } else if (IsTreeEvent) return; @@ -273,11 +277,11 @@ public: if (!UpdateVictim()) return; - if (Dynamite_Timer <= diff) + if (DynamiteTimer <= diff) { DoCast(me->getVictim(), SPELL_DYNAMITE); - Dynamite_Timer = 8000; - } else Dynamite_Timer -= diff; + DynamiteTimer = 8000; + } else DynamiteTimer -= diff; DoMeleeAttackIfReady(); } @@ -307,7 +311,7 @@ public: { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); me->SetHealth(me->CountPctFromMaxHealth(15)); - switch (rand()%2) + switch (urand(0, 1)) { case 0: me->SetStandState(UNIT_STAND_STATE_SIT); @@ -321,14 +325,9 @@ public: void EnterCombat(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) - { - } - - void UpdateAI(const uint32 /*diff*/) - { - } + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} }; }; @@ -337,7 +336,7 @@ public: ## npc_magwin ######*/ -enum eMagwin +enum Magwin { SAY_START = -1000111, SAY_AGGRO = -1000112, @@ -376,26 +375,25 @@ public: void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 0: - DoScriptText(SAY_START, me, player); - break; - case 17: - DoScriptText(SAY_PROGRESS, me, player); - break; - case 28: - DoScriptText(SAY_END1, me, player); - break; - case 29: - DoScriptText(EMOTE_HUG, me, player); - DoScriptText(SAY_END2, me, player); - player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me); - break; + switch (waypointId) + { + case 0: + DoScriptText(SAY_START, me, player); + break; + case 17: + DoScriptText(SAY_PROGRESS, me, player); + break; + case 28: + DoScriptText(SAY_END1, me, player); + break; + case 29: + DoScriptText(EMOTE_HUG, me, player); + DoScriptText(SAY_END2, me, player); + player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me); + break; + } } } @@ -404,7 +402,7 @@ public: DoScriptText(SAY_AGGRO, me, who); } - void Reset() { } + void Reset() {} }; }; @@ -413,7 +411,7 @@ public: ## npc_geezle ######*/ -enum eGeezle +enum Geezle { QUEST_TREES_COMPANY = 9531, @@ -433,7 +431,7 @@ enum eGeezle GO_NAGA_FLAG = 181694 }; -static float SparkPos[3] = {-5029.91f, -11291.79f, 8.096f}; +Position const SparkPos = {-5029.91f, -11291.79f, 8.096f, 0.0f}; class npc_geezle : public CreatureScript { @@ -451,7 +449,7 @@ public: uint64 SparkGUID; - uint32 Step; + uint8 Step; uint32 SayTimer; bool EventStarted; @@ -469,8 +467,7 @@ public: { Step = 0; EventStarted = true; - Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - if (Spark) + if (Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) { SparkGUID = Spark->GetGUID(); Spark->setActive(true); @@ -479,47 +476,47 @@ public: SayTimer = 8000; } - uint32 NextStep(uint32 Step) + uint32 NextStep(uint8 Step) { Creature* Spark = Unit::GetCreature(*me, SparkGUID); switch (Step) { - case 0: - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f); - me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f); - return 9000; // NPCs are walking up to fire - case 1: - DespawnNagaFlag(true); - DoScriptText(EMOTE_SPARK, Spark); - return 1000; - case 2: - DoScriptText(GEEZLE_SAY_1, me, Spark); - if (Spark) - { - Spark->SetInFront(me); - me->SetInFront(Spark); - } - return 5000; - case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; - case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; - case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; - case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; - case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; - case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; - case 9: - me->GetMotionMaster()->MoveTargetedHome(); - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, SparkPos[0], SparkPos[1], SparkPos[2]); - CompleteQuest(); - return 9000; - case 10: - if (Spark) - Spark->DisappearAndDie(); - DespawnNagaFlag(false); - me->DisappearAndDie(); - default: return 99999999; + case 0: + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f); + me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f); + return 9000; // NPCs are walking up to fire + case 1: + DespawnNagaFlag(true); + DoScriptText(EMOTE_SPARK, Spark); + return 1000; + case 2: + DoScriptText(GEEZLE_SAY_1, me, Spark); + if (Spark) + { + Spark->SetInFront(me); + me->SetInFront(Spark); + } + return 5000; + case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; + case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; + case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; + case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; + case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; + case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; + case 9: + me->GetMotionMaster()->MoveTargetedHome(); + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, SparkPos); + CompleteQuest(); + return 9000; + case 10: + if (Spark) + Spark->DisappearAndDie(); + DespawnNagaFlag(false); + me->DisappearAndDie(); + default: return 99999999; } } @@ -533,13 +530,8 @@ public: me->VisitNearbyWorldObject(radius, searcher); for (std::list::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE - &&(*itr)->HasAura(SPELL_TREE_DISGUISE)) - { + if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE && (*itr)->HasAura(SPELL_TREE_DISGUISE)) (*itr)->KilledMonsterCredit(MOB_SPARK, 0); - } - } } void DespawnNagaFlag(bool despawn) @@ -552,13 +544,13 @@ public: for (std::list::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) { if (despawn) - { (*itr)->SetLootState(GO_JUST_DEACTIVATED); - } else (*itr)->Respawn(); } - } else sLog->outError("SD2 ERROR: FlagList is empty!"); + } + else + sLog->outError("SD2 ERROR: FlagList is empty!"); } void UpdateAI(const uint32 diff) @@ -566,16 +558,16 @@ public: if (SayTimer <= diff) { if (EventStarted) - { SayTimer = NextStep(Step++); - } - } else SayTimer -= diff; + } + else + SayTimer -= diff; } }; }; -enum eRavegerCage +enum RavegerCage { NPC_DEATH_RAVAGER = 17556, diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp index 6c692a6738b..3883b740d02 100644 --- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp @@ -28,14 +28,16 @@ mob_webbed_creature npc_captured_sunhawk_agent EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## mob_webbed_creature ######*/ //possible creatures to be spawned -const uint32 possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; +uint32 const possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; class mob_webbed_creature : public CreatureScript { @@ -51,13 +53,9 @@ public: { mob_webbed_creatureAI(Creature* creature) : ScriptedAI(creature) {} - void Reset() - { - } + void Reset() {} - void EnterCombat(Unit* /*who*/) - { - } + void EnterCombat(Unit* /*who*/) {} void JustDied(Unit* killer) { @@ -153,7 +151,7 @@ public: ## Quest 9667: Saving Princess Stillpine ######*/ -enum eStillpine +enum Stillpine { QUEST_SAVING_PRINCESS_STILLPINE = 9667, NPC_PRINCESS_STILLPINE = 17682, diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp index c344de8cb51..ec098951c03 100644 --- a/src/server/scripts/Kalimdor/boss_azuregos.cpp +++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp @@ -23,17 +23,24 @@ SDComment: Teleport not included, spell reflect not effecting dots (Core problem SDCategory: Azshara EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" -#define SAY_TELEPORT -1000100 +enum Say +{ + SAY_TELEPORT = -1000100 +}; -#define SPELL_MARKOFFROST 23182 -#define SPELL_MANASTORM 21097 -#define SPELL_CHILL 21098 -#define SPELL_FROSTBREATH 21099 -#define SPELL_REFLECT 22067 -#define SPELL_CLEAVE 8255 //Perhaps not right ID -#define SPELL_ENRAGE 23537 +enum Spells +{ + SPELL_MARKOFFROST = 23182, + SPELL_MANASTORM = 21097, + SPELL_CHILL = 21098, + SPELL_FROSTBREATH = 21099, + SPELL_REFLECT = 22067, + SPELL_CLEAVE = 8255, //Perhaps not right ID + SPELL_ENRAGE = 23537 +}; class boss_azuregos : public CreatureScript { @@ -49,26 +56,26 @@ public: { boss_azuregosAI(Creature* creature) : ScriptedAI(creature) {} - uint32 MarkOfFrost_Timer; - uint32 ManaStorm_Timer; - uint32 Chill_Timer; - uint32 Breath_Timer; - uint32 Teleport_Timer; - uint32 Reflect_Timer; - uint32 Cleave_Timer; - uint32 Enrage_Timer; + uint32 MarkOfFrostTimer; + uint32 ManaStormTimer; + uint32 ChillTimer; + uint32 BreathTimer; + uint32 TeleportTimer; + uint32 ReflectTimer; + uint32 CleaveTimer; + uint32 EnrageTimer; bool Enraged; void Reset() { - MarkOfFrost_Timer = 35000; - ManaStorm_Timer = urand(5000, 17000); - Chill_Timer = urand(10000, 30000); - Breath_Timer = urand(2000, 8000); - Teleport_Timer = 30000; - Reflect_Timer = urand(15000, 30000); - Cleave_Timer = 7000; - Enrage_Timer = 0; + MarkOfFrostTimer = 35000; + ManaStormTimer = urand(5000, 17000); + ChillTimer = urand(10000, 30000); + BreathTimer = urand(2000, 8000); + TeleportTimer = 30000; + ReflectTimer = urand(15000, 30000); + CleaveTimer = 7000; + EnrageTimer = 0; Enraged = false; } @@ -80,12 +87,12 @@ public: if (!UpdateVictim()) return; - if (Teleport_Timer <= diff) + if (TeleportTimer <= diff) { DoScriptText(SAY_TELEPORT, me); - std::list& m_threatlist = me->getThreatManager().getThreatList(); - std::list::const_iterator i = m_threatlist.begin(); - for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) + std::list& threatlist = me->getThreatManager().getThreatList(); + std::list::const_iterator i = threatlist.begin(); + for (i = threatlist.begin(); i!= threatlist.end(); ++i) { Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) @@ -95,53 +102,53 @@ public: } DoResetThreat(); - Teleport_Timer = 30000; - } else Teleport_Timer -= diff; + TeleportTimer = 30000; + } else TeleportTimer -= diff; - // //MarkOfFrost_Timer - // if (MarkOfFrost_Timer <= diff) + // //MarkOfFrostTimer + // if (MarkOfFrostTimer <= diff) // { // DoCast(me->getVictim(), SPELL_MARKOFFROST); - // MarkOfFrost_Timer = 25000; - // } else MarkOfFrost_Timer -= diff; + // MarkOfFrostTimer = 25000; + // } else MarkOfFrostTimer -= diff; - //Chill_Timer - if (Chill_Timer <= diff) + //ChillTimer + if (ChillTimer <= diff) { DoCast(me->getVictim(), SPELL_CHILL); - Chill_Timer = urand(13000, 25000); - } else Chill_Timer -= diff; + ChillTimer = urand(13000, 25000); + } else ChillTimer -= diff; - //Breath_Timer - if (Breath_Timer <= diff) + //BreathTimer + if (BreathTimer <= diff) { DoCast(me->getVictim(), SPELL_FROSTBREATH); - Breath_Timer = urand(10000, 15000); - } else Breath_Timer -= diff; + BreathTimer = urand(10000, 15000); + } else BreathTimer -= diff; - //ManaStorm_Timer - if (ManaStorm_Timer <= diff) + //ManaStormTimer + if (ManaStormTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_MANASTORM); - ManaStorm_Timer = urand(7500, 12500); - } else ManaStorm_Timer -= diff; + ManaStormTimer = urand(7500, 12500); + } else ManaStormTimer -= diff; - //Reflect_Timer - if (Reflect_Timer <= diff) + //ReflectTimer + if (ReflectTimer <= diff) { DoCast(me, SPELL_REFLECT); - Reflect_Timer = urand(20000, 35000); - } else Reflect_Timer -= diff; + ReflectTimer = urand(20000, 35000); + } else ReflectTimer -= diff; - //Cleave_Timer - if (Cleave_Timer <= diff) + //CleaveTimer + if (CleaveTimer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + CleaveTimer = 7000; + } else CleaveTimer -= diff; - //Enrage_Timer + //EnrageTimer if (HealthBelowPct(26) && !Enraged) { DoCast(me, SPELL_ENRAGE); diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp index 1de04db61c4..0e02a77169e 100644 --- a/src/server/scripts/Kalimdor/darkshore.cpp +++ b/src/server/scripts/Kalimdor/darkshore.cpp @@ -29,7 +29,9 @@ npc_prospector_remtravel npc_threshwackonator EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" @@ -37,7 +39,7 @@ EndContentData */ # npc_kerlonian ####*/ -enum eKerlonian +enum Kerlonian { SAY_KER_START = -1000434, @@ -94,11 +96,11 @@ public: { npc_kerlonianAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiFallAsleepTimer; + uint32 FallAsleepTimer; void Reset() { - m_uiFallAsleepTimer = urand(10000, 45000); + FallAsleepTimer = urand(10000, 45000); } void MoveInLineOfSight(Unit* who) @@ -150,7 +152,7 @@ public: SetFollowPaused(false); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { @@ -159,13 +161,13 @@ public: if (!HasFollowState(STATE_FOLLOW_PAUSED)) { - if (m_uiFallAsleepTimer <= uiDiff) + if (FallAsleepTimer <= Diff) { SetSleeping(); - m_uiFallAsleepTimer = urand(25000, 90000); + FallAsleepTimer = urand(25000, 90000); } else - m_uiFallAsleepTimer -= uiDiff; + FallAsleepTimer -= Diff; } return; @@ -181,7 +183,7 @@ public: # npc_prospector_remtravel ####*/ -enum eRemtravel +enum Remtravel { SAY_REM_START = -1000327, SAY_REM_AGGRO = -1000328, @@ -233,63 +235,62 @@ public: void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 0: - DoScriptText(SAY_REM_START, me, player); - break; - case 5: - DoScriptText(SAY_REM_RAMP1_1, me, player); - break; - case 6: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 9: - DoScriptText(SAY_REM_RAMP1_2, me, player); - break; - case 14: - //depend quest rewarded? - DoScriptText(SAY_REM_BOOK, me, player); - break; - case 15: - DoScriptText(SAY_REM_TENT1_1, me, player); - break; - case 16: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 17: - DoScriptText(SAY_REM_TENT1_2, me, player); - break; - case 26: - DoScriptText(SAY_REM_MOSS, me, player); - break; - case 27: - DoScriptText(EMOTE_REM_MOSS, me, player); - break; - case 28: - DoScriptText(SAY_REM_MOSS_PROGRESS, me, player); - break; - case 29: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 31: - DoScriptText(SAY_REM_PROGRESS, me, player); - break; - case 41: - DoScriptText(SAY_REM_REMEMBER, me, player); - break; - case 42: - DoScriptText(EMOTE_REM_END, me, player); - player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); - break; + switch (waypointId) + { + case 0: + DoScriptText(SAY_REM_START, me, player); + break; + case 5: + DoScriptText(SAY_REM_RAMP1_1, me, player); + break; + case 6: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 9: + DoScriptText(SAY_REM_RAMP1_2, me, player); + break; + case 14: + //depend quest rewarded? + DoScriptText(SAY_REM_BOOK, me, player); + break; + case 15: + DoScriptText(SAY_REM_TENT1_1, me, player); + break; + case 16: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 17: + DoScriptText(SAY_REM_TENT1_2, me, player); + break; + case 26: + DoScriptText(SAY_REM_MOSS, me, player); + break; + case 27: + DoScriptText(EMOTE_REM_MOSS, me, player); + break; + case 28: + DoScriptText(SAY_REM_MOSS_PROGRESS, me, player); + break; + case 29: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 31: + DoScriptText(SAY_REM_PROGRESS, me, player); + break; + case 41: + DoScriptText(SAY_REM_REMEMBER, me, player); + break; + case 42: + DoScriptText(EMOTE_REM_END, me, player); + player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); + break; + } } } @@ -297,7 +298,7 @@ public: void EnterCombat(Unit* who) { - if (rand()%2) + if (urand(0, 1)) DoScriptText(SAY_REM_AGGRO, me, who); } @@ -314,7 +315,7 @@ public: # npc_threshwackonator ####*/ -enum eThreshwackonator +enum Threshwackonator { EMOTE_START = -1000325, //signed for 4966 SAY_AT_CLOSE = -1000326, //signed for 4966 diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp index f295d7626ac..e196c71f681 100644 --- a/src/server/scripts/Kalimdor/desolace.cpp +++ b/src/server/scripts/Kalimdor/desolace.cpp @@ -30,10 +30,12 @@ npc_dalinda_malem go_demon_portal EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" -enum eDyingKodo +enum DyingKodo { // signed for 9999 SAY_SMEED_HOME_1 = -1000348, @@ -114,11 +116,11 @@ public: { npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) { Reset(); } - uint32 m_uiDespawnTimer; + uint32 DespawnTimer; void Reset() { - m_uiDespawnTimer = 0; + DespawnTimer = 0; } void MoveInLineOfSight(Unit* who) @@ -143,14 +145,14 @@ public: if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) { me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - m_uiDespawnTimer = 60000; + DespawnTimer = 60000; } } void UpdateAI(const uint32 diff) { //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. - if (m_uiDespawnTimer && m_uiDespawnTimer <= diff) + if (DespawnTimer && DespawnTimer <= diff) { if (!me->getVictim() && me->isAlive()) { @@ -159,7 +161,7 @@ public: me->Respawn(); return; } - } else m_uiDespawnTimer -= diff; + } else DespawnTimer -= diff; if (!UpdateVictim()) return; @@ -175,7 +177,7 @@ public: ## Hand of Iruxos ######*/ -enum +enum Iruxos { QUEST_HAND_IRUXOS = 5381, NPC_DEMON_SPIRIT = 11876, @@ -199,7 +201,10 @@ class go_iruxos : public GameObjectScript ## npc_dalinda_malem. Quest 1440 ######*/ -#define QUEST_RETURN_TO_VAHLARRIEL 1440 +enum Dalinda +{ + QUEST_RETURN_TO_VAHLARRIEL = 1440 +}; class npc_dalinda : public CreatureScript { @@ -255,9 +260,9 @@ public: return; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { - npc_escortAI::UpdateAI(uiDiff); + npc_escortAI::UpdateAI(Diff); if (!UpdateVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index fe5bedf4c98..ec06a542b6f 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -15,8 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "Vehicle.h" +#include "SpellScript.h" /*###### ##Quest 5441: Lazy Peons @@ -50,15 +52,15 @@ public: { npc_lazy_peonAI(Creature* creature) : ScriptedAI(creature) {} - uint64 uiPlayerGUID; + uint64 PlayerGUID; - uint32 m_uiRebuffTimer; + uint32 RebuffTimer; bool work; void Reset() { - uiPlayerGUID = 0; - m_uiRebuffTimer = 0; + PlayerGUID = 0; + RebuffTimer = 0; work = false; } @@ -81,17 +83,17 @@ public: } } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (work == true) me->HandleEmoteCommand(EMOTE_ONESHOT_WORK_CHOPWOOD); - if (m_uiRebuffTimer <= uiDiff) + if (RebuffTimer <= Diff) { DoCast(me, SPELL_BUFF_SLEEP); - m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes + RebuffTimer = 300000; //Rebuff agian in 5 minutes } else - m_uiRebuffTimer -= uiDiff; + RebuffTimer -= Diff; if (!UpdateVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index e4ed3793385..45e1c1808c1 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -32,8 +32,11 @@ npc_private_hendel npc_cassa_crimsonwing - handled by npc_taxi EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" +#include "SpellScript.h" /*###### ## mobs_risen_husk_spirit @@ -132,7 +135,7 @@ class mobs_risen_husk_spirit : public CreatureScript ## npc_deserter_agitator ######*/ -enum eDeserter +enum Deserter { QUEST_TRAITORS_AMONG_US = 11126, NPC_THERAMORE_DESERTER = 23602, @@ -203,12 +206,12 @@ public: me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - void MovementInform(uint32 uiType, uint32 uiId) + void MovementInform(uint32 Type, uint32 Id) { - if (uiType != POINT_MOTION_TYPE) + if (Type != POINT_MOTION_TYPE) return; - if (uiId == 1) + if (Id == 1) me->DisappearAndDie(); } }; @@ -218,7 +221,7 @@ public: ## npc_deserter_agitator ######*/ -enum eTheramoreGuard +enum TheramoreGuard { SAY_QUEST1 = -1000641, SAY_QUEST2 = -1000642, @@ -266,7 +269,7 @@ public: DoScriptText(SAY_QUEST1, creature); creature->CastSpell(creature, SPELL_DOCTORED_LEAFLET, false); creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->uiYellTimer = 4000; + CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->YellTimer = 4000; CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->bYellTimer = true; } @@ -282,40 +285,40 @@ public: { npc_theramore_guardAI(Creature* creature) : ScriptedAI(creature) { } - uint32 uiYellTimer; - uint32 uiStep; + uint32 YellTimer; + uint32 Step; bool bYellTimer; void Reset() { bYellTimer = false; - uiStep = 0; + Step = 0; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (!me->HasAura(SPELL_PROPAGANDIZED)) me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if (bYellTimer && uiYellTimer <= uiDiff) + if (bYellTimer && YellTimer <= Diff) { - switch (uiStep) + switch (Step) { case 0: DoScriptText(RAND(SAY_QUEST2, SAY_QUEST3, SAY_QUEST4, SAY_QUEST5, SAY_QUEST6), me); - uiYellTimer = 3000; - ++uiStep; + YellTimer = 3000; + ++Step; break; case 1: DoScriptText(RAND(SAY_QUEST7, SAY_QUEST8, SAY_QUEST9), me); me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - uiStep = 0; + Step = 0; bYellTimer = false; break; } } else - uiYellTimer -= uiDiff; + YellTimer -= Diff; } }; }; @@ -324,7 +327,7 @@ public: ## npc_lady_jaina_proudmoore ######*/ -enum eLadyJaina +enum LadyJaina { QUEST_JAINAS_AUTOGRAPH = 558, SPELL_JAINAS_AUTOGRAPH = 23122 @@ -367,7 +370,7 @@ public: ## npc_nat_pagle ######*/ -enum eNatPagle +enum NatPagle { QUEST_NATS_MEASURING_TAPE = 8227 }; @@ -408,7 +411,7 @@ public: ## npc_private_hendel ######*/ -enum eHendel +enum Hendel { // looks like all this text ids are wrong. SAY_PROGRESS_1_TER = -1000411, // signed for 3568 @@ -464,11 +467,11 @@ public: AttackStart(pAttacker); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + void DamageTaken(Unit* pDoneBy, uint32 &Damage) { - if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(20, uiDamage)) + if (Damage > me->GetHealth() || me->HealthBelowPctDamaged(20, Damage)) { - uiDamage = 0; + Damage = 0; if (Player* player = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) player->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); @@ -485,9 +488,9 @@ public: ## npc_zelfrax ######*/ -const Position MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f}; +Position const MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f}; -enum eZelfrax +enum Zelfrax { SAY_ZELFRAX = -1000472, SAY_ZELFRAX_2 = -1000473 @@ -525,9 +528,9 @@ public: } } - void MovementInform(uint32 uiType, uint32 /*uiId*/) + void MovementInform(uint32 Type, uint32 /*Id*/) { - if (uiType != POINT_MOTION_TYPE) + if (Type != POINT_MOTION_TYPE) return; me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); @@ -547,7 +550,7 @@ public: DoScriptText(SAY_ZELFRAX_2, me); } - void UpdateAI(uint32 const /*uiDiff*/) + void UpdateAI(uint32 const /*Diff*/) { if (!UpdateVictim()) return; @@ -562,7 +565,7 @@ public: ## npc_stinky ######*/ -enum eStinky +enum Stinky { QUEST_STINKYS_ESCAPE_H = 1270, QUEST_STINKYS_ESCAPE_A = 1222, diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp index e1f59ec26be..9243ea0017e 100644 --- a/src/server/scripts/Kalimdor/felwood.cpp +++ b/src/server/scripts/Kalimdor/felwood.cpp @@ -27,7 +27,9 @@ EndScriptData */ npcs_riverbreeze_and_silversky EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npcs_riverbreeze_and_silversky @@ -35,6 +37,17 @@ EndContentData */ #define GOSSIP_ITEM_BEACON "Please make me a Cenarion Beacon" +enum RiverbreezeAndSilversky +{ + SPELL_CENARION_BEACON = 15120, + + NPC_ARATHANDRIS_SILVERSKY = 9528, + NPC_MAYBESS_RIVERBREEZE = 9529, + + QUEST_CLEASING_FELWOOD_A = 4101, + QUEST_CLEASING_FELWOOD_H = 4102 +}; + class npcs_riverbreeze_and_silversky : public CreatureScript { public: @@ -46,7 +59,7 @@ public: if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); - creature->CastSpell(player, 15120, false); + creature->CastSpell(player, SPELL_CENARION_BEACON, false); } return true; } @@ -58,9 +71,9 @@ public: uint32 creatureId = creature->GetEntry(); - if (creatureId == 9528) + if (creatureId == NPC_ARATHANDRIS_SILVERSKY) { - if (player->GetQuestRewardStatus(4101)) + if (player->GetQuestRewardStatus(QUEST_CLEASING_FELWOOD_A)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(2848, creature->GetGUID()); @@ -70,9 +83,9 @@ public: player->SEND_GOSSIP_MENU(2844, creature->GetGUID()); } - if (creatureId == 9529) + if (creatureId == NPC_MAYBESS_RIVERBREEZE) { - if (player->GetQuestRewardStatus(4102)) + if (player->GetQuestRewardStatus(QUEST_CLEASING_FELWOOD_H)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(2849, creature->GetGUID()); diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp index 480b94d6767..4fcd20951c9 100644 --- a/src/server/scripts/Kalimdor/feralas.cpp +++ b/src/server/scripts/Kalimdor/feralas.cpp @@ -23,8 +23,10 @@ SDComment: Quest support: 3520, 2767, Special vendor Gregan Brewspewer SDCategory: Feralas EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" /*###### ## npc_gregan_brewspewer @@ -68,7 +70,7 @@ public: ## npc_oox22fe ######*/ -enum eOOX +enum OOX { //signed for 7806 SAY_OOX_START = -1000287, diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 08f5b2aa592..9df208d2578 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -31,14 +31,16 @@ npc_clintar_spirit npc_clintar_dreamwalker EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" /*###### ## npc_bunthen_plainswind ######*/ -enum eBunthen +enum Bunthen { QUEST_SEA_LION_HORDE = 30, QUEST_SEA_LION_ALLY = 272, @@ -218,70 +220,68 @@ public: ## npc_clintar_spirit ######*/ -float Clintar_spirit_WP[41][5] = +float const Clintar_spirit_WP[41][5] = { - //pos_x pos_y pos_z orien waitTime -{7465.28f, -3115.46f, 439.327f, 0.83f, 4000}, -{7476.49f, -3101, 443.457f, 0.89f, 0}, -{7486.57f, -3085.59f, 439.478f, 1.07f, 0}, -{7472.19f, -3085.06f, 443.142f, 3.07f, 0}, -{7456.92f, -3085.91f, 438.862f, 3.24f, 0}, -{7446.68f, -3083.43f, 438.245f, 2.40f, 0}, -{7446.17f, -3080.21f, 439.826f, 1.10f, 6000}, -{7452.41f, -3085.8f, 438.984f, 5.78f, 0}, -{7469.11f, -3084.94f, 443.048f, 6.25f, 0}, -{7483.79f, -3085.44f, 439.607f, 6.25f, 0}, -{7491.14f, -3090.96f, 439.983f, 5.44f, 0}, -{7497.62f, -3098.22f, 436.854f, 5.44f, 0}, -{7498.72f, -3113.41f, 434.596f, 4.84f, 0}, -{7500.06f, -3122.51f, 434.749f, 5.17f, 0}, -{7504.96f, -3131.53f, 434.475f, 4.74f, 0}, -{7504.31f, -3133.53f, 435.693f, 3.84f, 6000}, -{7504.55f, -3133.27f, 435.476f, 0.68f, 15000}, -{7501.99f, -3126.01f, 434.93f, 1.83f, 0}, -{7490.76f, -3114.97f, 434.431f, 2.51f, 0}, -{7479.64f, -3105.51f, 431.123f, 1.83f, 0}, -{7474.63f, -3086.59f, 428.994f, 1.83f, 2000}, -{7472.96f, -3074.18f, 427.566f, 1.57f, 0}, -{7472.25f, -3063, 428.268f, 1.55f, 0}, -{7473.46f, -3054.22f, 427.588f, 0.36f, 0}, -{7475.08f, -3053.6f, 428.653f, 0.36f, 6000}, -{7474.66f, -3053.56f, 428.433f, 3.19f, 4000}, -{7471.81f, -3058.84f, 427.073f, 4.29f, 0}, -{7472.16f, -3064.91f, 427.772f, 4.95f, 0}, -{7471.56f, -3085.36f, 428.924f, 4.72f, 0}, -{7473.56f, -3093.48f, 429.294f, 5.04f, 0}, -{7478.94f, -3104.29f, 430.638f, 5.23f, 0}, -{7484.46f, -3109.61f, 432.769f, 5.79f, 0}, -{7490.23f, -3111.08f, 434.431f, 0.02f, 0}, -{7496.29f, -3108, 434.783f, 1.15f, 0}, -{7497.46f, -3100.66f, 436.191f, 1.50f, 0}, -{7495.64f, -3093.39f, 438.349f, 2.10f, 0}, -{7492.44f, -3086.01f, 440.267f, 1.38f, 0}, -{7498.26f, -3076.44f, 440.808f, 0.71f, 0}, -{7506.4f, -3067.35f, 443.64f, 0.77f, 0}, -{7518.37f, -3057.42f, 445.584f, 0.74f, 0}, -{7517.51f, -3056.3f, 444.568f, 2.49f, 4500} + //pos_x pos_y pos_z orien waitTime + {7465.28f, -3115.46f, 439.327f, 0.83f, 4000}, + {7476.49f, -3101, 443.457f, 0.89f, 0}, + {7486.57f, -3085.59f, 439.478f, 1.07f, 0}, + {7472.19f, -3085.06f, 443.142f, 3.07f, 0}, + {7456.92f, -3085.91f, 438.862f, 3.24f, 0}, + {7446.68f, -3083.43f, 438.245f, 2.40f, 0}, + {7446.17f, -3080.21f, 439.826f, 1.10f, 6000}, + {7452.41f, -3085.8f, 438.984f, 5.78f, 0}, + {7469.11f, -3084.94f, 443.048f, 6.25f, 0}, + {7483.79f, -3085.44f, 439.607f, 6.25f, 0}, + {7491.14f, -3090.96f, 439.983f, 5.44f, 0}, + {7497.62f, -3098.22f, 436.854f, 5.44f, 0}, + {7498.72f, -3113.41f, 434.596f, 4.84f, 0}, + {7500.06f, -3122.51f, 434.749f, 5.17f, 0}, + {7504.96f, -3131.53f, 434.475f, 4.74f, 0}, + {7504.31f, -3133.53f, 435.693f, 3.84f, 6000}, + {7504.55f, -3133.27f, 435.476f, 0.68f, 15000}, + {7501.99f, -3126.01f, 434.93f, 1.83f, 0}, + {7490.76f, -3114.97f, 434.431f, 2.51f, 0}, + {7479.64f, -3105.51f, 431.123f, 1.83f, 0}, + {7474.63f, -3086.59f, 428.994f, 1.83f, 2000}, + {7472.96f, -3074.18f, 427.566f, 1.57f, 0}, + {7472.25f, -3063, 428.268f, 1.55f, 0}, + {7473.46f, -3054.22f, 427.588f, 0.36f, 0}, + {7475.08f, -3053.6f, 428.653f, 0.36f, 6000}, + {7474.66f, -3053.56f, 428.433f, 3.19f, 4000}, + {7471.81f, -3058.84f, 427.073f, 4.29f, 0}, + {7472.16f, -3064.91f, 427.772f, 4.95f, 0}, + {7471.56f, -3085.36f, 428.924f, 4.72f, 0}, + {7473.56f, -3093.48f, 429.294f, 5.04f, 0}, + {7478.94f, -3104.29f, 430.638f, 5.23f, 0}, + {7484.46f, -3109.61f, 432.769f, 5.79f, 0}, + {7490.23f, -3111.08f, 434.431f, 0.02f, 0}, + {7496.29f, -3108, 434.783f, 1.15f, 0}, + {7497.46f, -3100.66f, 436.191f, 1.50f, 0}, + {7495.64f, -3093.39f, 438.349f, 2.10f, 0}, + {7492.44f, -3086.01f, 440.267f, 1.38f, 0}, + {7498.26f, -3076.44f, 440.808f, 0.71f, 0}, + {7506.4f, -3067.35f, 443.64f, 0.77f, 0}, + {7518.37f, -3057.42f, 445.584f, 0.74f, 0}, + {7517.51f, -3056.3f, 444.568f, 2.49f, 4500} }; -#define ASPECT_RAVEN 22915 - -#define ASPECT_RAVEN_SUMMON_X 7472.96f -#define ASPECT_RAVEN_SUMMON_Y -3074.18f -#define ASPECT_RAVEN_SUMMON_Z 427.566f -#define CLINTAR_SPIRIT_SUMMON_X 7459.2275f -#define CLINTAR_SPIRIT_SUMMON_Y -3122.5632f -#define CLINTAR_SPIRIT_SUMMON_Z 438.9842f -#define CLINTAR_SPIRIT_SUMMON_O 0.8594f - -//from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong. -#define CLINTAR_SPIRIT_SAY_START -1000286 -#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 -1000287 -#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 -1000288 -#define CLINTAR_SPIRIT_SAY_GET_ONE -1000289 -#define CLINTAR_SPIRIT_SAY_GET_TWO -1000290 -#define CLINTAR_SPIRIT_SAY_GET_THREE -1000291 -#define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292 +Position const AspectRavenSummon = {7472.96f, -3074.18f, 427.566f, 0.0f}; +Position const ClintarSpiritSummon = {7459.2275f, -3122.5632f, 438.9842f, 0.8594f}; + +enum ClintarSpirit +{ + ASPECT_RAVEN = 22915, + + //from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong. + CLINTAR_SPIRIT_SAY_START = -1000286, + CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 = -1000287, + CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 = -1000288, + CLINTAR_SPIRIT_SAY_GET_ONE = -1000289, + CLINTAR_SPIRIT_SAY_GET_TWO = -1000290, + CLINTAR_SPIRIT_SAY_GET_THREE = -1000291, + CLINTAR_SPIRIT_SAY_GET_FINAL = -1000292 +}; class npc_clintar_spirit : public CreatureScript { @@ -298,14 +298,14 @@ public: public: npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {} - uint32 Step; + uint8 Step; uint32 CurrWP; - uint32 Event_Timer; - uint32 checkPlayer_Timer; + uint32 EventTimer; + uint32 checkPlayerTimer; uint64 PlayerGUID; - bool Event_onWait; + bool EventOnWait; void Reset() { @@ -313,10 +313,10 @@ public: { Step = 0; CurrWP = 0; - Event_Timer = 0; + EventTimer = 0; PlayerGUID = 0; - checkPlayer_Timer = 1000; - Event_onWait = false; + checkPlayerTimer = 1000; + EventOnWait = false; } } @@ -347,8 +347,7 @@ public: void EnterCombat(Unit* who) { - uint32 rnd = rand()%2; - switch (rnd) + switch (urand(0, 1)) { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break; case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break; @@ -357,9 +356,7 @@ public: void StartEvent(Player* player) { - if (!player) - return; - if (player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { for (uint8 i = 0; i < 41; ++i) { @@ -381,18 +378,18 @@ public: return; } - if (!me->isInCombat() && !Event_onWait) + if (!me->isInCombat() && !EventOnWait) { - if (checkPlayer_Timer <= diff) + if (checkPlayerTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player && player->isInCombat() && player->getAttackerForHelper()) AttackStart(player->getAttackerForHelper()); - checkPlayer_Timer = 1000; - } else checkPlayer_Timer -= diff; + checkPlayerTimer = 1000; + } else checkPlayerTimer -= diff; } - if (Event_onWait && Event_Timer <= diff) + if (EventOnWait && EventTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); @@ -409,11 +406,11 @@ public: { case 0: me->Say(CLINTAR_SPIRIT_SAY_START, 0, PlayerGUID); - Event_Timer = 8000; + EventTimer = 8000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -422,13 +419,13 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, player); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -437,12 +434,12 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -451,11 +448,11 @@ public: { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, player); - Event_Timer = 15000; + EventTimer = 15000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -463,19 +460,16 @@ public: switch (Step) { case 0: - { - Creature* mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); - if (mob) + if (Creature* mob = me->SummonCreature(ASPECT_RAVEN, AspectRavenSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) { mob->AddThreat(me, 10000.0f); mob->AI()->AttackStart(me); } - Event_Timer = 2000; + EventTimer = 2000; Step = 1; break; - } case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -484,12 +478,12 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -498,11 +492,11 @@ public: { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, player); - Event_Timer = 4000; + EventTimer = 4000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -513,12 +507,12 @@ public: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, player); player->CompleteQuest(10965); - Event_Timer = 1500; + EventTimer = 1500; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_Timer = 3000; + EventTimer = 3000; Step = 2; break; case 2: @@ -530,19 +524,19 @@ public: } break; default: - Event_onWait = false; + EventOnWait = false; break; } - } else if (Event_onWait) Event_Timer -= diff; + } else if (EventOnWait) EventTimer -= diff; } void WaypointReached(uint32 waypointId) { CurrWP = waypointId; - Event_Timer = 0; + EventTimer = 0; Step = 0; - Event_onWait = true; + EventOnWait = true; } }; @@ -552,7 +546,10 @@ public: # npc_clintar_dreamwalker ####*/ -#define CLINTAR_SPIRIT 22916 +enum Clintar +{ + CLINTAR_SPIRIT = 22916 +}; class npc_clintar_dreamwalker : public CreatureScript { @@ -562,11 +559,8 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == 10965) - { - Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000); - if (clintar_spirit) + if (Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, ClintarSpiritSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000)) CAST_AI(npc_clintar_spirit::npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(player); - } return true; } diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp index bd4cf55b7b2..5b35688c2b8 100644 --- a/src/server/scripts/Kalimdor/mulgore.cpp +++ b/src/server/scripts/Kalimdor/mulgore.cpp @@ -29,8 +29,9 @@ npc_kyle_frenzied npc_plains_vision EndContentData */ -#include "ScriptPCH.h" -#include "ScriptedEscortAI.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### # npc_skorn_whitecloud @@ -71,7 +72,7 @@ public: # npc_kyle_frenzied ######*/ -enum eKyleFrenzied +enum KyleFrenzied { //emote signed for 7780 but propably thats wrong id. EMOTE_SEE_LUNCH = -1000340, @@ -98,30 +99,30 @@ public: { npc_kyle_frenziedAI(Creature* creature) : ScriptedAI(creature) {} - bool bEvent; - bool m_bIsMovingToLunch; - uint64 uiPlayerGUID; - uint32 uiEventTimer; - uint8 uiEventPhase; + bool EventActive; + bool IsMovingToLunch; + uint64 PlayerGUID; + uint32 EventTimer; + uint8 EventPhase; void Reset() { - bEvent = false; - m_bIsMovingToLunch = false; - uiPlayerGUID = 0; - uiEventTimer = 5000; - uiEventPhase = 0; + EventActive = false; + IsMovingToLunch = false; + PlayerGUID = 0; + EventTimer = 5000; + EventPhase = 0; if (me->GetEntry() == NPC_KYLE_FRIENDLY) me->UpdateEntry(NPC_KYLE_FRENZIED); } - void SpellHit(Unit* pCaster, SpellInfo const* pSpell) + void SpellHit(Unit* Caster, SpellInfo const* Spell) { - if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) + if (!me->getVictim() && !EventActive && Spell->Id == SPELL_LUNCH) { - if (pCaster->GetTypeId() == TYPEID_PLAYER) - uiPlayerGUID = pCaster->GetGUID(); + if (Caster->GetTypeId() == TYPEID_PLAYER) + PlayerGUID = Caster->GetGUID(); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) { @@ -130,41 +131,41 @@ public: me->StopMoving(); } - bEvent = true; + EventActive = true; DoScriptText(EMOTE_SEE_LUNCH, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL); } } - void MovementInform(uint32 uiType, uint32 uiPointId) + void MovementInform(uint32 Type, uint32 PointId) { - if (uiType != POINT_MOTION_TYPE || !bEvent) + if (Type != POINT_MOTION_TYPE || !EventActive) return; - if (uiPointId == POINT_ID) - m_bIsMovingToLunch = false; + if (PointId == POINT_ID) + IsMovingToLunch = false; } void UpdateAI(const uint32 diff) { - if (bEvent) + if (EventActive) { - if (m_bIsMovingToLunch) + if (IsMovingToLunch) return; - if (uiEventTimer <= diff) + if (EventTimer <= diff) { - uiEventTimer = 5000; - ++uiEventPhase; + EventTimer = 5000; + ++EventPhase; - switch (uiEventPhase) + switch (EventPhase) { case 1: - if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID)) + if (Unit* unit = Unit::GetUnit(*me, PlayerGUID)) { if (GameObject* go = unit->GetGameObject(SPELL_LUNCH)) { - m_bIsMovingToLunch = true; + IsMovingToLunch = true; me->GetMotionMaster()->MovePoint(POINT_ID, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()); } } @@ -174,13 +175,13 @@ public: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); break; case 3: - if (Player* unit = Unit::GetPlayer(*me, uiPlayerGUID)) + if (Player* unit = Unit::GetPlayer(*me, PlayerGUID)) unit->TalkedToCreature(me->GetEntry(), me->GetGUID()); me->UpdateEntry(NPC_KYLE_FRIENDLY); break; case 4: - uiEventTimer = 30000; + EventTimer = 30000; DoScriptText(EMOTE_DANCE, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL); break; @@ -192,7 +193,7 @@ public: } } else - uiEventTimer -= diff; + EventTimer -= diff; } } }; @@ -203,58 +204,58 @@ public: # npc_plains_vision ######*/ -float wp_plain_vision[50][3] = +Position const wpPlainVision[50] = { - {-2226.32f, -408.095f, -9.36235f}, - {-2203.04f, -437.212f, -5.72498f}, - {-2163.91f, -457.851f, -7.09049f}, - {-2123.87f, -448.137f, -9.29591f}, - {-2104.66f, -427.166f, -6.49513f}, - {-2101.48f, -422.826f, -5.3567f}, - {-2097.56f, -417.083f, -7.16716f}, - {-2084.87f, -398.626f, -9.88973f}, - {-2072.71f, -382.324f, -10.2488f}, - {-2054.05f, -356.728f, -6.22468f}, - {-2051.8f, -353.645f, -5.35791f}, - {-2049.08f, -349.912f, -6.15723f}, - {-2030.6f, -310.724f, -9.59302f}, - {-2002.15f, -249.308f, -10.8124f}, - {-1972.85f, -195.811f, -10.6316f}, - {-1940.93f, -147.652f, -11.7055f}, - {-1888.06f, -81.943f, -11.4404f}, - {-1837.05f, -34.0109f, -12.258f}, - {-1796.12f, -14.6462f, -10.3581f}, - {-1732.61f, -4.27746f, -10.0213f}, - {-1688.94f, -0.829945f, -11.7103f}, - {-1681.32f, 13.0313f, -9.48056f}, - {-1677.04f, 36.8349f, -7.10318f}, - {-1675.2f, 68.559f, -8.95384f}, - {-1676.57f, 89.023f, -9.65104f}, - {-1678.16f, 110.939f, -10.1782f}, - {-1677.86f, 128.681f, -5.73869f}, - {-1675.27f, 144.324f, -3.47916f}, - {-1671.7f, 163.169f, -1.23098f}, - {-1666.61f, 181.584f, 5.26145f}, - {-1661.51f, 196.154f, 8.95252f}, - {-1655.47f, 210.811f, 8.38727f}, - {-1647.07f, 226.947f, 5.27755f}, - {-1621.65f, 232.91f, 2.69579f}, - {-1600.23f, 237.641f, 2.98539f}, - {-1576.07f, 242.546f, 4.66541f}, - {-1554.57f, 248.494f, 6.60377f}, - {-1547.53f, 259.302f, 10.6741f}, - {-1541.7f, 269.847f, 16.4418f}, - {-1539.83f, 278.989f, 21.0597f}, - {-1540.16f, 290.219f, 27.8247f}, - {-1538.99f, 298.983f, 34.0032f}, - {-1540.38f, 307.337f, 41.3557f}, - {-1536.61f, 314.884f, 48.0179f}, - {-1532.42f, 323.277f, 55.6667f}, - {-1528.77f, 329.774f, 61.1525f}, - {-1525.65f, 333.18f, 63.2161f}, - {-1517.01f, 350.713f, 62.4286f}, - {-1511.39f, 362.537f, 62.4539f}, - {-1508.68f, 366.822f, 62.733f} + {-2226.32f, -408.095f, -9.36235f, 0.0f}, + {-2203.04f, -437.212f, -5.72498f, 0.0f}, + {-2163.91f, -457.851f, -7.09049f, 0.0f}, + {-2123.87f, -448.137f, -9.29591f, 0.0f}, + {-2104.66f, -427.166f, -6.49513f, 0.0f}, + {-2101.48f, -422.826f, -5.3567f, 0.0f}, + {-2097.56f, -417.083f, -7.16716f, 0.0f}, + {-2084.87f, -398.626f, -9.88973f, 0.0f}, + {-2072.71f, -382.324f, -10.2488f, 0.0f}, + {-2054.05f, -356.728f, -6.22468f, 0.0f}, + {-2051.8f, -353.645f, -5.35791f, 0.0f}, + {-2049.08f, -349.912f, -6.15723f, 0.0f}, + {-2030.6f, -310.724f, -9.59302f, 0.0f}, + {-2002.15f, -249.308f, -10.8124f, 0.0f}, + {-1972.85f, -195.811f, -10.6316f, 0.0f}, + {-1940.93f, -147.652f, -11.7055f, 0.0f}, + {-1888.06f, -81.943f, -11.4404f, 0.0f}, + {-1837.05f, -34.0109f, -12.258f, 0.0f}, + {-1796.12f, -14.6462f, -10.3581f, 0.0f}, + {-1732.61f, -4.27746f, -10.0213f, 0.0f}, + {-1688.94f, -0.829945f, -11.7103f, 0.0f}, + {-1681.32f, 13.0313f, -9.48056f, 0.0f}, + {-1677.04f, 36.8349f, -7.10318f, 0.0f}, + {-1675.2f, 68.559f, -8.95384f, 0.0f}, + {-1676.57f, 89.023f, -9.65104f, 0.0f}, + {-1678.16f, 110.939f, -10.1782f, 0.0f}, + {-1677.86f, 128.681f, -5.73869f, 0.0f}, + {-1675.27f, 144.324f, -3.47916f, 0.0f}, + {-1671.7f, 163.169f, -1.23098f, 0.0f}, + {-1666.61f, 181.584f, 5.26145f, 0.0f}, + {-1661.51f, 196.154f, 8.95252f, 0.0f}, + {-1655.47f, 210.811f, 8.38727f, 0.0f}, + {-1647.07f, 226.947f, 5.27755f, 0.0f}, + {-1621.65f, 232.91f, 2.69579f, 0.0f}, + {-1600.23f, 237.641f, 2.98539f, 0.0f}, + {-1576.07f, 242.546f, 4.66541f, 0.0f}, + {-1554.57f, 248.494f, 6.60377f, 0.0f}, + {-1547.53f, 259.302f, 10.6741f, 0.0f}, + {-1541.7f, 269.847f, 16.4418f, 0.0f}, + {-1539.83f, 278.989f, 21.0597f, 0.0f}, + {-1540.16f, 290.219f, 27.8247f, 0.0f}, + {-1538.99f, 298.983f, 34.0032f, 0.0f}, + {-1540.38f, 307.337f, 41.3557f, 0.0f}, + {-1536.61f, 314.884f, 48.0179f, 0.0f}, + {-1532.42f, 323.277f, 55.6667f, 0.0f}, + {-1528.77f, 329.774f, 61.1525f, 0.0f}, + {-1525.65f, 333.18f, 63.2161f, 0.0f}, + {-1517.01f, 350.713f, 62.4286f, 0.0f}, + {-1511.39f, 362.537f, 62.4539f, 0.0f}, + {-1508.68f, 366.822f, 62.733f, 0.0f} }; class npc_plains_vision : public CreatureScript @@ -305,7 +306,7 @@ public: { if (newWaypoint) { - me->GetMotionMaster()->MovePoint(WayPointId, wp_plain_vision[WayPointId][0], wp_plain_vision[WayPointId][1], wp_plain_vision[WayPointId][2]); + me->GetMotionMaster()->MovePoint(WayPointId, wpPlainVision[WayPointId]); newWaypoint = false; } } diff --git a/src/server/scripts/Kalimdor/orgrimmar.cpp b/src/server/scripts/Kalimdor/orgrimmar.cpp index 2ff2d28768a..fca8d0f5fc5 100644 --- a/src/server/scripts/Kalimdor/orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/orgrimmar.cpp @@ -28,13 +28,15 @@ npc_shenthul npc_thrall_warchief EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_shenthul ######*/ -enum eShenthul +enum Shenthul { QUEST_SHATTERED_SALUTE = 2460 }; @@ -65,16 +67,16 @@ public: bool CanTalk; bool CanEmote; - uint32 Salute_Timer; - uint32 Reset_Timer; + uint32 SaluteTimer; + uint32 ResetTimer; uint64 PlayerGUID; void Reset() { CanTalk = false; CanEmote = false; - Salute_Timer = 6000; - Reset_Timer = 0; + SaluteTimer = 6000; + ResetTimer = 0; PlayerGUID = 0; } @@ -84,7 +86,7 @@ public: { if (CanEmote) { - if (Reset_Timer <= diff) + if (ResetTimer <= diff) { if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) { @@ -92,17 +94,17 @@ public: player->FailQuest(QUEST_SHATTERED_SALUTE); } Reset(); - } else Reset_Timer -= diff; + } else ResetTimer -= diff; } if (CanTalk && !CanEmote) { - if (Salute_Timer <= diff) + if (SaluteTimer <= diff) { me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); CanEmote = true; - Reset_Timer = 60000; - } else Salute_Timer -= diff; + ResetTimer = 60000; + } else SaluteTimer -= diff; } if (!UpdateVictim()) @@ -130,10 +132,13 @@ public: ## npc_thrall_warchief ######*/ -#define QUEST_6566 6566 +enum ThrallWarchief +{ + QUEST_6566 = 6566, -#define SPELL_CHAIN_LIGHTNING 16033 -#define SPELL_SHOCK 16034 + SPELL_CHAIN_LIGHTNING = 16033, + SPELL_SHOCK = 16034 +}; #define GOSSIP_HTW "Please share your wisdom with me, Warchief." #define GOSSIP_STW1 "What discoveries?" @@ -207,13 +212,13 @@ public: { npc_thrall_warchiefAI(Creature* creature) : ScriptedAI(creature) {} - uint32 ChainLightning_Timer; - uint32 Shock_Timer; + uint32 ChainLightningTimer; + uint32 ShockTimer; void Reset() { - ChainLightning_Timer = 2000; - Shock_Timer = 8000; + ChainLightningTimer = 2000; + ShockTimer = 8000; } void EnterCombat(Unit* /*who*/) {} @@ -223,17 +228,17 @@ public: if (!UpdateVictim()) return; - if (ChainLightning_Timer <= diff) + if (ChainLightningTimer <= diff) { DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - ChainLightning_Timer = 9000; - } else ChainLightning_Timer -= diff; + ChainLightningTimer = 9000; + } else ChainLightningTimer -= diff; - if (Shock_Timer <= diff) + if (ShockTimer <= diff) { DoCast(me->getVictim(), SPELL_SHOCK); - Shock_Timer = 15000; - } else Shock_Timer -= diff; + ShockTimer = 15000; + } else ShockTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index 2d91f32fe9d..639de3dc3b2 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -29,7 +29,9 @@ npcs_rutgar_and_frankal quest_a_pawn_on_the_eternal_pawn EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "Group.h" /*### @@ -125,9 +127,11 @@ public: #define GOSSIP_ITEM14 "I should ask the monkey about this" #define GOSSIP_ITEM15 "Then what..." -//trigger creatures to kill -#define TRIGGER_RUTGAR 15222 -#define TRIGGER_FRANKAL 15221 +enum RutgarAndFrankal //trigger creatures to kill +{ + TRIGGER_FRANKAL = 15221, + TRIGGER_RUTGAR = 15222 +}; class npcs_rutgar_and_frankal : public CreatureScript { @@ -223,7 +227,7 @@ public: /*#### # quest_a_pawn_on_the_eternal_board (Defines) ####*/ -enum eEternalBoard +enum EternalBoard { QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519, @@ -290,7 +294,6 @@ TO DO: get correct spell IDs and timings for spells cast upon dragon transformat TO DO: Dragons should use the HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF) after transformation, but for some unknown reason it doesnt work. EndContentData */ -#define QUEST_A_PAWN_ON_THE_ETERNAL_BOARD 8519 #define EVENT_AREA_RADIUS 65 //65yds #define EVENT_COOLDOWN 500000 //in ms. appear after event completed or failed (should be = Adds despawn time) @@ -373,13 +376,8 @@ static QuestCinematic EventAnim[]= {0, 0, 0} }; -struct Location -{ - float x, y, z, o; -}; - //Cordinates for Spawns -static Location SpawnLocation[]= +Position const SpawnLocation[] = { {-8085.0f, 1528.0f, 2.61f, 3.141592f}, //Kaldorei Infantry {-8080.0f, 1526.0f, 2.61f, 3.141592f}, //Kaldorei Infantry @@ -460,7 +458,7 @@ struct WaveData int32 WaveTextId; }; -static WaveData WavesInfo[] = +static WaveData WavesInfo[5] = { {30, 0, 15423, 0, 0, 24000, 0}, // Kaldorei Soldier { 3, 35, 15424, 0, 0, 24000, 0}, // Anubisath Conqueror @@ -475,7 +473,7 @@ struct SpawnSpells uint32 Timer1, Timer2, SpellId; }; -static SpawnSpells SpawnCast[]=// +static SpawnSpells SpawnCast[4] = { {100000, 2000, 33652}, // Stop Time {38500, 300000, 28528}, // Poison Cloud @@ -977,13 +975,9 @@ public: for (uint8 i = locIndex; i <= count; ++i) { - float x = SpawnLocation[i].x; - float y = SpawnLocation[i].y; - float z = SpawnLocation[i].z; - float o = SpawnLocation[i].o; uint32 desptimer = WavesInfo[WaveCount].DespTimer; - if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer)) + if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, SpawnLocation[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer)) { if (spawn->GetEntry() == 15423) spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15427+rand()%4); diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp index 635bb50509e..d38395c7b37 100644 --- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp @@ -28,7 +28,9 @@ npc_braug_dimspirit npc_kaya_flathoof EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### @@ -90,7 +92,7 @@ public: ## npc_kaya_flathoof ######*/ -enum eKaya +enum Kaya { FACTION_ESCORTEE_H = 775, diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp index da0e0e738cf..9b742b495bb 100644 --- a/src/server/scripts/Kalimdor/tanaris.cpp +++ b/src/server/scripts/Kalimdor/tanaris.cpp @@ -33,7 +33,9 @@ npc_OOX17 npc_tooga EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" @@ -41,10 +43,13 @@ EndContentData */ ## mob_aquementas ######*/ -#define AGGRO_YELL_AQUE -1000350 +enum Aquementas +{ + AGGRO_YELL_AQUE = -1000350, -#define SPELL_AQUA_JET 13586 -#define SPELL_FROST_SHOCK 15089 + SPELL_AQUA_JET = 13586, + SPELL_FROST_SHOCK = 15089 +}; class mob_aquementas : public CreatureScript { @@ -60,22 +65,22 @@ public: { mob_aquementasAI(Creature* creature) : ScriptedAI(creature) {} - uint32 SendItem_Timer; - uint32 SwitchFaction_Timer; + uint32 SendItemTimer; + uint32 SwitchFactionTimer; bool isFriendly; - uint32 FrostShock_Timer; - uint32 AquaJet_Timer; + uint32 FrostShockTimer; + uint32 AquaJetTimer; void Reset() { - SendItem_Timer = 0; - SwitchFaction_Timer = 10000; + SendItemTimer = 0; + SwitchFactionTimer = 10000; me->setFaction(35); isFriendly = true; - AquaJet_Timer = 5000; - FrostShock_Timer = 1000; + AquaJetTimer = 5000; + FrostShockTimer = 1000; } void SendItem(Unit* receiver) @@ -101,11 +106,11 @@ public: { if (isFriendly) { - if (SwitchFaction_Timer <= diff) + if (SwitchFactionTimer <= diff) { me->setFaction(91); isFriendly = false; - } else SwitchFaction_Timer -= diff; + } else SwitchFactionTimer -= diff; } if (!UpdateVictim()) @@ -113,25 +118,25 @@ public: if (!isFriendly) { - if (SendItem_Timer <= diff) + if (SendItemTimer <= diff) { if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) SendItem(me->getVictim()); - SendItem_Timer = 5000; - } else SendItem_Timer -= diff; + SendItemTimer = 5000; + } else SendItemTimer -= diff; } - if (FrostShock_Timer <= diff) + if (FrostShockTimer <= diff) { DoCast(me->getVictim(), SPELL_FROST_SHOCK); - FrostShock_Timer = 15000; - } else FrostShock_Timer -= diff; + FrostShockTimer = 15000; + } else FrostShockTimer -= diff; - if (AquaJet_Timer <= diff) + if (AquaJetTimer <= diff) { DoCast(me, SPELL_AQUA_JET); - AquaJet_Timer = 15000; - } else AquaJet_Timer -= diff; + AquaJetTimer = 15000; + } else AquaJetTimer -= diff; DoMeleeAttackIfReady(); } @@ -143,20 +148,23 @@ public: ## npc_custodian_of_time ######*/ -#define WHISPER_CUSTODIAN_1 -1000217 -#define WHISPER_CUSTODIAN_2 -1000218 -#define WHISPER_CUSTODIAN_3 -1000219 -#define WHISPER_CUSTODIAN_4 -1000220 -#define WHISPER_CUSTODIAN_5 -1000221 -#define WHISPER_CUSTODIAN_6 -1000222 -#define WHISPER_CUSTODIAN_7 -1000223 -#define WHISPER_CUSTODIAN_8 -1000224 -#define WHISPER_CUSTODIAN_9 -1000225 -#define WHISPER_CUSTODIAN_10 -1000226 -#define WHISPER_CUSTODIAN_11 -1000227 -#define WHISPER_CUSTODIAN_12 -1000228 -#define WHISPER_CUSTODIAN_13 -1000229 -#define WHISPER_CUSTODIAN_14 -1000230 +enum CustodianOfTime +{ + WHISPER_CUSTODIAN_1 = -1000217, + WHISPER_CUSTODIAN_2 = -1000218, + WHISPER_CUSTODIAN_3 = -1000219, + WHISPER_CUSTODIAN_4 = -1000220, + WHISPER_CUSTODIAN_5 = -1000221, + WHISPER_CUSTODIAN_6 = -1000222, + WHISPER_CUSTODIAN_7 = -1000223, + WHISPER_CUSTODIAN_8 = -1000224, + WHISPER_CUSTODIAN_9 = -1000225, + WHISPER_CUSTODIAN_10 = -1000226, + WHISPER_CUSTODIAN_11 = -1000227, + WHISPER_CUSTODIAN_12 = -1000228, + WHISPER_CUSTODIAN_13 = -1000229, + WHISPER_CUSTODIAN_14 = -1000230 +}; class npc_custodian_of_time : public CreatureScript { @@ -174,69 +182,68 @@ public: void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 0: - DoScriptText(WHISPER_CUSTODIAN_1, me, player); - break; - case 1: - DoScriptText(WHISPER_CUSTODIAN_2, me, player); - break; - case 2: - DoScriptText(WHISPER_CUSTODIAN_3, me, player); - break; - case 3: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 5: - DoScriptText(WHISPER_CUSTODIAN_5, me, player); - break; - case 6: - DoScriptText(WHISPER_CUSTODIAN_6, me, player); - break; - case 7: - DoScriptText(WHISPER_CUSTODIAN_7, me, player); - break; - case 8: - DoScriptText(WHISPER_CUSTODIAN_8, me, player); - break; - case 9: - DoScriptText(WHISPER_CUSTODIAN_9, me, player); - break; - case 10: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 13: - DoScriptText(WHISPER_CUSTODIAN_10, me, player); - break; - case 14: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 16: - DoScriptText(WHISPER_CUSTODIAN_11, me, player); - break; - case 17: - DoScriptText(WHISPER_CUSTODIAN_12, me, player); - break; - case 18: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 22: - DoScriptText(WHISPER_CUSTODIAN_13, me, player); - break; - case 23: - DoScriptText(WHISPER_CUSTODIAN_4, me, player); - break; - case 24: - DoScriptText(WHISPER_CUSTODIAN_14, me, player); - DoCast(player, 34883); - // below here is temporary workaround, to be removed when spell works properly - player->AreaExploredOrEventHappens(10277); - break; + switch (waypointId) + { + case 0: + DoScriptText(WHISPER_CUSTODIAN_1, me, player); + break; + case 1: + DoScriptText(WHISPER_CUSTODIAN_2, me, player); + break; + case 2: + DoScriptText(WHISPER_CUSTODIAN_3, me, player); + break; + case 3: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 5: + DoScriptText(WHISPER_CUSTODIAN_5, me, player); + break; + case 6: + DoScriptText(WHISPER_CUSTODIAN_6, me, player); + break; + case 7: + DoScriptText(WHISPER_CUSTODIAN_7, me, player); + break; + case 8: + DoScriptText(WHISPER_CUSTODIAN_8, me, player); + break; + case 9: + DoScriptText(WHISPER_CUSTODIAN_9, me, player); + break; + case 10: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 13: + DoScriptText(WHISPER_CUSTODIAN_10, me, player); + break; + case 14: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 16: + DoScriptText(WHISPER_CUSTODIAN_11, me, player); + break; + case 17: + DoScriptText(WHISPER_CUSTODIAN_12, me, player); + break; + case 18: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 22: + DoScriptText(WHISPER_CUSTODIAN_13, me, player); + break; + case 23: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 24: + DoScriptText(WHISPER_CUSTODIAN_14, me, player); + DoCast(player, 34883); + // below here is temporary workaround, to be removed when spell works properly + player->AreaExploredOrEventHappens(10277); + break; + } } } @@ -259,7 +266,7 @@ public: } void EnterCombat(Unit* /*who*/) {} - void Reset() { } + void Reset() {} void UpdateAI(const uint32 diff) { @@ -416,7 +423,7 @@ public: ## npc_OOX17 ######*/ -enum e00X17 +enum Npc00X17 { //texts are signed for 7806 SAY_OOX_START = -1000287, @@ -464,30 +471,29 @@ public: void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 23: - me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - break; - case 56: - me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) - DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); - break; - case 86: - DoScriptText(SAY_OOX_END, me); - player->GroupEventHappens(Q_OOX17, me); - break; + switch (waypointId) + { + case 23: + me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 56: + me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) + DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); + break; + case 86: + DoScriptText(SAY_OOX_END, me); + player->GroupEventHappens(Q_OOX17, me); + break; + } } } @@ -509,7 +515,7 @@ public: # npc_tooga ####*/ -enum eTooga +enum Tooga { SAY_TOOG_THIRST = -1000391, SAY_TOOG_WORRIED = -1000392, @@ -527,7 +533,7 @@ enum eTooga FACTION_TOOG_ESCORTEE = 113 }; -const float m_afToWaterLoc[] = {-7032.664551f, -4906.199219f, -1.606446f}; +Position const ToWaterLoc = {-7032.664551f, -4906.199219f, -1.606446f, 0.0f}; class npc_tooga : public CreatureScript { @@ -554,17 +560,17 @@ public: { npc_toogaAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiCheckSpeechTimer; - uint32 m_uiPostEventTimer; - uint32 m_uiPhasePostEvent; + uint32 CheckSpeechTimer; + uint32 PostEventTimer; + uint32 PhasePostEvent; uint64 TortaGUID; void Reset() { - m_uiCheckSpeechTimer = 2500; - m_uiPostEventTimer = 1000; - m_uiPhasePostEvent = 0; + CheckSpeechTimer = 2500; + PostEventTimer = 1000; + PhasePostEvent = 0; TortaGUID = 0; } @@ -577,11 +583,9 @@ public: { if (me->IsWithinDistInMap(who, INTERACTION_DISTANCE)) { - if (Player* player = GetLeaderForFollower()) - { - if (player->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) - player->GroupEventHappens(QUEST_TOOGA, me); - } + Player* player = GetLeaderForFollower(); + if (player && player->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + player->GroupEventHappens(QUEST_TOOGA, me); TortaGUID = who->GetGUID(); SetFollowComplete(true); @@ -589,27 +593,27 @@ public: } } - void MovementInform(uint32 uiMotionType, uint32 uiPointId) + void MovementInform(uint32 MotionType, uint32 PointId) { - FollowerAI::MovementInform(uiMotionType, uiPointId); + FollowerAI::MovementInform(MotionType, PointId); - if (uiMotionType != POINT_MOTION_TYPE) + if (MotionType != POINT_MOTION_TYPE) return; - if (uiPointId == POINT_ID_TO_WATER) + if (PointId == POINT_ID_TO_WATER) SetFollowComplete(); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { //we are doing the post-event, or... if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { - if (m_uiPostEventTimer <= uiDiff) + if (PostEventTimer <= Diff) { - m_uiPostEventTimer = 5000; + PostEventTimer = 5000; Unit* pTorta = Unit::GetUnit(*me, TortaGUID); if (!pTorta || !pTorta->isAlive()) @@ -619,7 +623,7 @@ public: return; } - switch (m_uiPhasePostEvent) + switch (PhasePostEvent) { case 1: DoScriptText(SAY_TOOG_POST_1, me); @@ -638,27 +642,27 @@ public: break; case 6: DoScriptText(SAY_TORT_POST_6, pTorta); - me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); + me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, ToWaterLoc); break; } - ++m_uiPhasePostEvent; + ++PhasePostEvent; } else - m_uiPostEventTimer -= uiDiff; + PostEventTimer -= Diff; } //...we are doing regular speech check else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - if (m_uiCheckSpeechTimer <= uiDiff) + if (CheckSpeechTimer <= Diff) { - m_uiCheckSpeechTimer = 5000; + CheckSpeechTimer = 5000; if (urand(0, 9) > 8) DoScriptText(RAND(SAY_TOOG_THIRST, SAY_TOOG_WORRIED), me); } else - m_uiCheckSpeechTimer -= uiDiff; + CheckSpeechTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/teldrassil.cpp b/src/server/scripts/Kalimdor/teldrassil.cpp index d7cac99c374..7f2b2fc7f05 100644 --- a/src/server/scripts/Kalimdor/teldrassil.cpp +++ b/src/server/scripts/Kalimdor/teldrassil.cpp @@ -27,14 +27,15 @@ EndScriptData */ npc_mist EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedFollowerAI.h" /*#### # npc_mist ####*/ -enum eMist +enum Mist { SAY_AT_HOME = -1000323, EMOTE_AT_HOME = -1000324, @@ -51,10 +52,8 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_MIST) - { if (npc_mistAI* pMistAI = CAST_AI(npc_mist::npc_mistAI, creature->AI())) pMistAI->StartFollow(player, FACTION_DARNASSUS, quest); - } return true; } @@ -88,18 +87,16 @@ public: { DoScriptText(EMOTE_AT_HOME, me); - if (Player* player = GetLeaderForFollower()) - { - if (player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) - player->GroupEventHappens(QUEST_MIST, me); - } + Player* player = GetLeaderForFollower(); + if (player && player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) + player->GroupEventHappens(QUEST_MIST, me); //The follow is over (and for later development, run off to the woods before really end) SetFollowComplete(); } //call not needed here, no known abilities - /*void UpdateFollowerAI(const uint32 uiDiff) + /*void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) return; diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index 933ad4de3eb..f4983558b67 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -32,7 +32,9 @@ npc_twiggy_flathead npc_wizzlecrank_shredder EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### @@ -41,7 +43,7 @@ EndContentData */ #define GOSSIP_CORPSE "Examine corpse in detail..." -enum eQuests +enum BeatenCorpse { QUEST_LOST_IN_BATTLE = 4921 }; @@ -77,7 +79,7 @@ public: # npc_gilthares ######*/ -enum eGilthares +enum Gilthares { SAY_GIL_START = -1000370, SAY_GIL_AT_LAST = -1000371, @@ -214,7 +216,7 @@ public: ## npc_taskmaster_fizzule ######*/ -enum eEnums +enum TaskmasterFizzule { FACTION_FRIENDLY_F = 35, SPELL_FLARE = 10113, @@ -240,13 +242,13 @@ public: uint32 factionNorm; bool IsFriend; - uint32 Reset_Timer; + uint32 ResetTimer; uint8 FlareCount; void Reset() { IsFriend = false; - Reset_Timer = 120000; + ResetTimer = 120000; FlareCount = 0; me->setFaction(factionNorm); } @@ -281,11 +283,11 @@ public: { if (IsFriend) { - if (Reset_Timer <= diff) + if (ResetTimer <= diff) { EnterEvadeMode(); return; - } else Reset_Timer -= diff; + } else ResetTimer -= diff; } if (!UpdateVictim()) @@ -315,7 +317,7 @@ public: ## npc_twiggy_flathead #####*/ -enum eTwiggyFlathead +enum TwiggyFlathead { NPC_BIG_WILL = 6238, NPC_AFFRAY_CHALLENGER = 6240, @@ -327,7 +329,7 @@ enum eTwiggyFlathead SAY_TWIGGY_FLATHEAD_OVER = -1000127, }; -float AffrayChallengerLoc[6][4]= +Position const AffrayChallengerLoc[6] = { {-1683.0f, -4326.0f, 2.79f, 0.0f}, {-1682.0f, -4329.0f, 2.79f, 0.0f}, @@ -354,10 +356,10 @@ public: bool EventInProgress; bool EventGrate; bool EventBigWill; - bool Challenger_down[6]; - uint32 Wave; - uint32 Wave_Timer; - uint32 Challenger_checker; + bool ChallengerDown[6]; + uint8 Wave; + uint32 WaveTimer; + uint32 ChallengerChecker; uint64 PlayerGUID; uint64 AffrayChallenger[6]; uint64 BigWill; @@ -367,15 +369,15 @@ public: EventInProgress = false; EventGrate = false; EventBigWill = false; - Wave_Timer = 600000; - Challenger_checker = 0; + WaveTimer = 600000; + ChallengerChecker = 0; Wave = 0; PlayerGUID = 0; for (uint8 i = 0; i < 6; ++i) { AffrayChallenger[i] = 0; - Challenger_down[i] = false; + ChallengerDown[i] = false; } BigWill = 0; } @@ -441,7 +443,7 @@ public: for (uint8 i = 0; i < 6; ++i) { - Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); if (!creature) continue; creature->setFaction(35); @@ -450,31 +452,31 @@ public: creature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); AffrayChallenger[i] = creature->GetGUID(); } - Wave_Timer = 5000; - Challenger_checker = 1000; + WaveTimer = 5000; + ChallengerChecker = 1000; EventGrate = true; } } else if (EventInProgress) { - if (Challenger_checker <= diff) + if (ChallengerChecker <= diff) { for (uint8 i = 0; i < 6; ++i) { if (AffrayChallenger[i]) { Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]); - if ((!creature || (!creature->isAlive())) && !Challenger_down[i]) + if ((!creature || (!creature->isAlive())) && !ChallengerDown[i]) { DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); - Challenger_down[i] = true; + ChallengerDown[i] = true; } } } - Challenger_checker = 1000; - } else Challenger_checker -= diff; + ChallengerChecker = 1000; + } else ChallengerChecker -= diff; - if (Wave_Timer <= diff) + if (WaveTimer <= diff) { if (Wave < 6 && AffrayChallenger[Wave] && !EventBigWill) { @@ -488,7 +490,7 @@ public: creature->setFaction(14); creature->AI()->AttackStart(pWarrior); ++Wave; - Wave_Timer = 20000; + WaveTimer = 20000; } } else if (Wave >= 6 && !EventBigWill) { @@ -500,7 +502,7 @@ public: creature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79f); creature->HandleEmoteCommand(EMOTE_STATE_READY_UNARMED); EventBigWill = true; - Wave_Timer = 1000; + WaveTimer = 1000; } } else if (Wave >= 6 && EventBigWill && BigWill) @@ -512,7 +514,7 @@ public: Reset(); } } - } else Wave_Timer -= diff; + } else WaveTimer -= diff; } } } @@ -524,7 +526,7 @@ public: ## npc_wizzlecrank_shredder #####*/ -enum eEnums_Wizzlecrank +enum Wizzlecrank { SAY_START = -1000298, SAY_STARTUP1 = -1000299, @@ -550,14 +552,14 @@ public: { npc_wizzlecrank_shredderAI(Creature* creature) : npc_escortAI(creature) { - m_bIsPostEvent = false; - m_uiPostEventTimer = 1000; - m_uiPostEventCount = 0; + IsPostEvent = false; + PostEventTimer = 1000; + PostEventCount = 0; } - bool m_bIsPostEvent; - uint32 m_uiPostEventTimer; - uint32 m_uiPostEventCount; + bool IsPostEvent; + uint32 PostEventTimer; + uint32 PostEventCount; void Reset() { @@ -566,9 +568,9 @@ public: if (me->getStandState() == UNIT_STAND_STATE_DEAD) me->SetStandState(UNIT_STAND_STATE_STAND); - m_bIsPostEvent = false; - m_uiPostEventTimer = 1000; - m_uiPostEventCount = 0; + IsPostEvent = false; + PostEventTimer = 1000; + PostEventCount = 0; } } @@ -590,19 +592,19 @@ public: } break; case 24: - m_bIsPostEvent = true; + IsPostEvent = true; break; } } - void WaypointStart(uint32 uiPointId) + void WaypointStart(uint32 PointId) { Player* player = GetPlayerForEscort(); if (!player) return; - switch (uiPointId) + switch (PointId) { case 9: DoScriptText(SAY_STARTUP2, me, player); @@ -623,15 +625,15 @@ public: summoned->AI()->AttackStart(me); } - void UpdateEscortAI(const uint32 uiDiff) + void UpdateEscortAI(const uint32 Diff) { if (!UpdateVictim()) { - if (m_bIsPostEvent) + if (IsPostEvent) { - if (m_uiPostEventTimer <= uiDiff) + if (PostEventTimer <= Diff) { - switch (m_uiPostEventCount) + switch (PostEventCount) { case 0: DoScriptText(SAY_PROGRESS_2, me); @@ -651,11 +653,11 @@ public: break; } - ++m_uiPostEventCount; - m_uiPostEventTimer = 5000; + ++PostEventCount; + PostEventTimer = 5000; } else - m_uiPostEventTimer -= uiDiff; + PostEventTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp index 5b77b8dc2c0..b9ae356ddf1 100644 --- a/src/server/scripts/Kalimdor/thousand_needles.cpp +++ b/src/server/scripts/Kalimdor/thousand_needles.cpp @@ -32,14 +32,16 @@ npc_enraged_panther go_panther_cage EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*##### # npc_kanati ######*/ -enum eKanati +enum Kanati { SAY_KAN_START = -1000410, @@ -47,7 +49,7 @@ enum eKanati NPC_GALAK_ASS = 10720 }; -const float m_afGalakLoc[]= {-4867.387695f, -1357.353760f, -48.226f }; +Position const GalakLoc = {-4867.387695f, -1357.353760f, -48.226f, 0.0f}; class npc_kanati : public CreatureScript { @@ -57,10 +59,9 @@ public: bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) { if (quest->GetQuestId() == QUEST_PROTECT_KANATI) - { if (npc_kanatiAI* pEscortAI = CAST_AI(npc_kanati::npc_kanatiAI, creature->AI())) pEscortAI->Start(false, false, player->GetGUID(), quest, true); - } + return true; } @@ -73,7 +74,7 @@ public: { npc_kanatiAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} void WaypointReached(uint32 waypointId) { @@ -93,9 +94,7 @@ public: void DoSpawnGalak() { for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_GALAK_ASS, - m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f, - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_GALAK_ASS, GalakLoc, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); } void JustSummoned(Creature* summoned) @@ -110,7 +109,7 @@ public: # npc_lakota_windsong ######*/ -enum eLakota +enum Lakota { SAY_LAKO_START = -1000365, SAY_LAKO_LOOK_OUT = -1000366, @@ -127,14 +126,14 @@ enum eLakota ID_AMBUSH_3 = 4 }; -float m_afBanditLoc[6][6]= +Position const BanditLoc[6] = { - {-4905.479492f, -2062.732666f, 84.352f}, - {-4915.201172f, -2073.528320f, 84.733f}, - {-4878.883301f, -1986.947876f, 91.966f}, - {-4877.503906f, -1966.113403f, 91.859f}, - {-4767.985352f, -1873.169189f, 90.192f}, - {-4788.861328f, -1888.007813f, 89.888f} + {-4905.479492f, -2062.732666f, 84.352f, 0.0f}, + {-4915.201172f, -2073.528320f, 84.733f, 0.0f}, + {-4878.883301f, -1986.947876f, 91.966f, 0.0f}, + {-4877.503906f, -1966.113403f, 91.859f, 0.0f}, + {-4767.985352f, -1873.169189f, 90.192f, 0.0f}, + {-4788.861328f, -1888.007813f, 89.888f, 0.0f} }; class npc_lakota_windsong : public CreatureScript @@ -164,7 +163,7 @@ public: { npc_lakota_windsongAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} void WaypointReached(uint32 waypointId) { @@ -189,12 +188,10 @@ public: } } - void DoSpawnBandits(int uiAmbushId) + void DoSpawnBandits(int AmbushId) { for (int i = 0; i < 2; ++i) - me->SummonCreature(NPC_GRIM_BANDIT, - m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_GRIM_BANDIT, BanditLoc[i+AmbushId], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } }; @@ -204,7 +201,7 @@ public: # npc_paoka_swiftmountain ######*/ -enum ePacka +enum Packa { SAY_START = -1000362, SAY_WYVERN = -1000363, @@ -215,11 +212,11 @@ enum ePacka FACTION_ESCORTEE = 232 //guessed }; -float m_afWyvernLoc[3][3]= +Position const WyvernLoc[3] = { - {-4990.606f, -906.057f, -5.343f}, - {-4970.241f, -927.378f, -4.951f}, - {-4985.364f, -952.528f, -5.199f} + {-4990.606f, -906.057f, -5.343f, 0.0f}, + {-4970.241f, -927.378f, -4.951f, 0.0f}, + {-4985.364f, -952.528f, -5.199f, 0.0f} }; class npc_paoka_swiftmountain : public CreatureScript @@ -249,7 +246,7 @@ public: { npc_paoka_swiftmountainAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} void WaypointReached(uint32 waypointId) { @@ -272,9 +269,7 @@ public: void DoSpawnWyvern() { for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_WYVERN, - m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_WYVERN, WyvernLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } }; }; @@ -285,7 +280,7 @@ public: #define GOSSIP_P "Please tell me the Phrase.." -enum ePlucky +enum Plucky { FACTION_FRIENDLY = 35, QUEST_SCOOP = 1950, @@ -328,17 +323,17 @@ public: struct npc_pluckyAI : public ScriptedAI { - npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { m_uiNormFaction = creature->getFaction(); } + npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { NormFaction = creature->getFaction(); } - uint32 m_uiNormFaction; - uint32 m_uiResetTimer; + uint32 NormFaction; + uint32 ResetTimer; void Reset() { - m_uiResetTimer = 120000; + ResetTimer = 120000; - if (me->getFaction() != m_uiNormFaction) - me->setFaction(m_uiNormFaction); + if (me->getFaction() != NormFaction) + me->setFaction(NormFaction); if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -346,11 +341,11 @@ public: DoCast(me, SPELL_PLUCKY_CHICKEN, false); } - void ReceiveEmote(Player* player, uint32 uiTextEmote) + void ReceiveEmote(Player* player, uint32 TextEmote) { if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) { - if (uiTextEmote == TEXT_EMOTE_BECKON) + if (TextEmote == TEXT_EMOTE_BECKON) { me->setFaction(FACTION_FRIENDLY); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -358,7 +353,7 @@ public: } } - if (uiTextEmote == TEXT_EMOTE_CHICKEN) + if (TextEmote == TEXT_EMOTE_CHICKEN) { if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) return; @@ -372,11 +367,11 @@ public: } } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) { - if (m_uiResetTimer <= uiDiff) + if (ResetTimer <= Diff) { if (!me->getVictim()) EnterEvadeMode(); @@ -386,7 +381,7 @@ public: return; } else - m_uiResetTimer -= uiDiff; + ResetTimer -= Diff; } if (!UpdateVictim()) @@ -398,7 +393,7 @@ public: }; -enum ePantherCage +enum PantherCage { ENRAGED_PANTHER = 10992 }; diff --git a/src/server/scripts/Kalimdor/thunder_bluff.cpp b/src/server/scripts/Kalimdor/thunder_bluff.cpp index 5aa55ddea66..b8b05b9692f 100644 --- a/src/server/scripts/Kalimdor/thunder_bluff.cpp +++ b/src/server/scripts/Kalimdor/thunder_bluff.cpp @@ -23,17 +23,22 @@ SDComment: Quest support: 925 SDCategory: Thunder Bluff EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*##### # npc_cairne_bloodhoof ######*/ -#define SPELL_BERSERKER_CHARGE 16636 -#define SPELL_CLEAVE 16044 -#define SPELL_MORTAL_STRIKE 16856 -#define SPELL_THUNDERCLAP 23931 -#define SPELL_UPPERCUT 22916 +enum CairneBloodhoof +{ + SPELL_BERSERKER_CHARGE = 16636, + SPELL_CLEAVE = 16044, + SPELL_MORTAL_STRIKE = 16856, + SPELL_THUNDERCLAP = 23931, + SPELL_UPPERCUT = 22916 +}; #define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint." //TODO: verify abilities/timers @@ -75,19 +80,19 @@ public: { npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) {} - uint32 BerserkerCharge_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - uint32 Thunderclap_Timer; - uint32 Uppercut_Timer; + uint32 BerserkerChargeTimer; + uint32 CleaveTimer; + uint32 MortalStrikeTimer; + uint32 ThunderclapTimer; + uint32 UppercutTimer; void Reset() { - BerserkerCharge_Timer = 30000; - Cleave_Timer = 5000; - MortalStrike_Timer = 10000; - Thunderclap_Timer = 15000; - Uppercut_Timer = 10000; + BerserkerChargeTimer = 30000; + CleaveTimer = 5000; + MortalStrikeTimer = 10000; + ThunderclapTimer = 15000; + UppercutTimer = 10000; } void EnterCombat(Unit* /*who*/) {} @@ -97,37 +102,37 @@ public: if (!UpdateVictim()) return; - if (BerserkerCharge_Timer <= diff) + if (BerserkerChargeTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_BERSERKER_CHARGE); - BerserkerCharge_Timer = 25000; - } else BerserkerCharge_Timer -= diff; + BerserkerChargeTimer = 25000; + } else BerserkerChargeTimer -= diff; - if (Uppercut_Timer <= diff) + if (UppercutTimer <= diff) { DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 20000; - } else Uppercut_Timer -= diff; + UppercutTimer = 20000; + } else UppercutTimer -= diff; - if (Thunderclap_Timer <= diff) + if (ThunderclapTimer <= diff) { DoCast(me->getVictim(), SPELL_THUNDERCLAP); - Thunderclap_Timer = 15000; - } else Thunderclap_Timer -= diff; + ThunderclapTimer = 15000; + } else ThunderclapTimer -= diff; - if (MortalStrike_Timer <= diff) + if (MortalStrikeTimer <= diff) { DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; + MortalStrikeTimer = 15000; + } else MortalStrikeTimer -= diff; - if (Cleave_Timer <= diff) + if (CleaveTimer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + CleaveTimer = 7000; + } else CleaveTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp index 232dba404e0..786d2fc0cd3 100644 --- a/src/server/scripts/Kalimdor/ungoro_crater.cpp +++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp @@ -28,11 +28,12 @@ npc_a-me npc_ringo EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" -enum eAMeData +enum AmeData { SAY_READY = -1000517, SAY_AGGRO1 = -1000518, @@ -76,41 +77,40 @@ public: { npc_ameAI(Creature* creature) : npc_escortAI(creature) {} - uint32 DEMORALIZINGSHOUT_Timer; + uint32 DemoralizingShoutTimer; void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) + if (Player* player = GetPlayerForEscort()) { - case 19: - me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO1, me, player); - break; - case 28: - DoScriptText(SAY_SEARCH, me, player); - break; - case 38: - me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO2, me, player); - break; - case 49: - me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO3, me, player); - break; - case 55: - DoScriptText(SAY_FINISH, me, player); - player->GroupEventHappens(QUEST_CHASING_AME, me); - break; + switch (waypointId) + { + case 19: + me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO1, me, player); + break; + case 28: + DoScriptText(SAY_SEARCH, me, player); + break; + case 38: + me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO2, me, player); + break; + case 49: + me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO3, me, player); + break; + case 55: + DoScriptText(SAY_FINISH, me, player); + player->GroupEventHappens(QUEST_CHASING_AME, me); + break; + } } } void Reset() { - DEMORALIZINGSHOUT_Timer = 5000; + DemoralizingShoutTimer = 5000; } void JustSummoned(Creature* summoned) @@ -130,11 +130,11 @@ public: if (!UpdateVictim()) return; - if (DEMORALIZINGSHOUT_Timer <= diff) + if (DemoralizingShoutTimer <= diff) { DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); - DEMORALIZINGSHOUT_Timer = 70000; - } else DEMORALIZINGSHOUT_Timer -= diff; + DemoralizingShoutTimer = 70000; + } else DemoralizingShoutTimer -= diff; } }; }; @@ -143,7 +143,7 @@ public: # npc_ringo ####*/ -enum eRingo +enum Ringo { SAY_RIN_START_1 = -1000416, SAY_RIN_START_2 = -1000417, @@ -201,17 +201,17 @@ public: { npc_ringoAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiFaintTimer; - uint32 m_uiEndEventProgress; - uint32 m_uiEndEventTimer; + uint32 FaintTimer; + uint32 EndEventProgress; + uint32 EndEventTimer; uint64 SpraggleGUID; void Reset() { - m_uiFaintTimer = urand(30000, 60000); - m_uiEndEventProgress = 0; - m_uiEndEventTimer = 1000; + FaintTimer = urand(30000, 60000); + EndEventProgress = 0; + EndEventTimer = 1000; SpraggleGUID = 0; } @@ -266,13 +266,13 @@ public: SetFollowPaused(false); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { - if (m_uiEndEventTimer <= uiDiff) + if (EndEventTimer <= Diff) { Unit* pSpraggle = Unit::GetUnit(*me, SpraggleGUID); if (!pSpraggle || !pSpraggle->isAlive()) @@ -281,64 +281,61 @@ public: return; } - switch (m_uiEndEventProgress) + switch (EndEventProgress) { case 1: DoScriptText(SAY_RIN_END_1, me); - m_uiEndEventTimer = 3000; + EndEventTimer = 3000; break; case 2: DoScriptText(SAY_SPR_END_2, pSpraggle); - m_uiEndEventTimer = 5000; + EndEventTimer = 5000; break; case 3: DoScriptText(SAY_RIN_END_3, me); - m_uiEndEventTimer = 1000; + EndEventTimer = 1000; break; case 4: DoScriptText(EMOTE_RIN_END_4, me); SetFaint(); - m_uiEndEventTimer = 9000; + EndEventTimer = 9000; break; case 5: DoScriptText(EMOTE_RIN_END_5, me); ClearFaint(); - m_uiEndEventTimer = 1000; + EndEventTimer = 1000; break; case 6: DoScriptText(SAY_RIN_END_6, me); - m_uiEndEventTimer = 3000; + EndEventTimer = 3000; break; case 7: DoScriptText(SAY_SPR_END_7, pSpraggle); - m_uiEndEventTimer = 10000; + EndEventTimer = 10000; break; case 8: DoScriptText(EMOTE_RIN_END_8, me); - m_uiEndEventTimer = 5000; + EndEventTimer = 5000; break; case 9: SetFollowComplete(); break; } - ++m_uiEndEventProgress; + ++EndEventProgress; } else - m_uiEndEventTimer -= uiDiff; + EndEventTimer -= Diff; } - else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) + else if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !HasFollowState(STATE_FOLLOW_PAUSED)) { - if (!HasFollowState(STATE_FOLLOW_PAUSED)) + if (FaintTimer <= Diff) { - if (m_uiFaintTimer <= uiDiff) - { - SetFaint(); - m_uiFaintTimer = urand(60000, 120000); - } - else - m_uiFaintTimer -= uiDiff; + SetFaint(); + FaintTimer = urand(60000, 120000); } + else + FaintTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index ab5e4c4023a..a02156ee110 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -29,7 +29,9 @@ npc_rivern_frostwind npc_witch_doctor_mauari EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_lorax 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 661b3530bb8..2af73389ecb 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 @@ -1044,7 +1044,7 @@ class spell_algalon_phase_punch : public SpellScriptLoader { PrepareAuraScript(spell_algalon_phase_punch_AuraScript); - void HandlePeriodic(AuraEffect const* aurEff) + void HandlePeriodic(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); if (GetStackAmount() != 1) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 33e266e1326..09ff5935b6e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -2044,7 +2044,7 @@ public: void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetHitUnit()) + if (GetHitUnit()) GetCaster()->CastSpell(GetCaster(),SPELL_FORCE_CAST_SUMMON_GNOME_SOUL); } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index f50dbb7773d..c9c036d5329 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -213,7 +213,7 @@ class spell_sha_earthbind_totem : public SpellScriptLoader return true; } - void HandleEffectPeriodic(AuraEffect const* aurEff) + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { if (!GetCaster()) return; -- cgit v1.2.3 From 512b0945a8107ac43a2a50f1af39dee0011f49d4 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 15:37:13 +0100 Subject: Core/BG: Add map to start zone teleport possible exploit log --- src/server/game/Battlegrounds/Battleground.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 44192a74123..9d5858e1ca4 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -550,7 +550,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) if (dist >= maxDist) { - sLog->outError("BATTLEGROUND: Sending %s back to start location (possible exploit)", plr->GetName()); + sLog->outError("BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", plr->GetName(), GetMapId()); plr->TeleportTo(GetMapId(), x, y, z, o); } } -- cgit v1.2.3 From 7661858ac0a0010e8b9070352218fd534becf774 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 16:13:52 +0100 Subject: Core/SAI: Few changes to db data validation for actions and event flags --- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 7 ++++++- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index b0f1fcb8ede..a7149f37480 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -324,7 +324,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType()); return false; } - if (e.action.type >= SMART_ACTION_END) + if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END) { sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType()); return false; @@ -334,6 +334,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask); return false; } + if (e.event.event_flags > SMART_EVENT_FLAGS_ALL) + { + sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags); + return false; + } if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST) { e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script! diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 8d3686a265d..6bb309c46c2 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1176,6 +1176,7 @@ enum SmartEventFlags SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset() SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3) + SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET) }; enum SmartCastFlags -- cgit v1.2.3 From 66ce5a1148d11cd57f953be04de2b756c6754909 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 16:36:44 +0100 Subject: And I forgot to Ctrl+S, yay me. --- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 6bb309c46c2..bde7768f036 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1175,7 +1175,7 @@ enum SmartEventFlags SMART_EVENT_FLAG_DEBUG_ONLY = 0x080, //Event only occurs in debug build SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset() - SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3) + SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3), SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET) }; -- cgit v1.2.3 From e56b2cdd59c5c7673da1aaac5fe8a99d4891e260 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 17:58:35 +0100 Subject: Core: Fix a few compile warnings --- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 6 +++--- src/server/game/Maps/Map.cpp | 2 +- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/tools/map_extractor/System.cpp | 18 +++++++++--------- src/tools/map_extractor/adt.cpp | 12 ++++++------ src/tools/map_extractor/loadlib.cpp | 2 +- src/tools/map_extractor/mpq_libmpq04.h | 4 ++-- src/tools/map_extractor/wdt.cpp | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 96f454fd3e2..4176d9f605b 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -190,7 +190,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } case CONDITION_OBJECT_ENTRY: { - if (object->GetTypeId() == ConditionValue1) + if (uint32(object->GetTypeId()) == ConditionValue1) condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); break; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d38489ef5a9..f5f336a2402 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12019,7 +12019,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje Map const* map = lootedObject->GetMap(); if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) lootedObjectInDungeon = true; if (!lootedObjectInDungeon) @@ -17658,7 +17658,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) } else if (IsBagPos(item->GetPos())) - if (Bag* pBag = item->ToBag()) + if (item->IsBag()) invalidBagMap[item->GetGUIDLow()] = item; } else @@ -17811,7 +17811,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList(); for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr) { - if (events[*itr].holiday_id == proto->HolidayId) + if (uint32(events[*itr].holiday_id) == proto->HolidayId) { remove = false; break; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index a1b3d913c99..162dd12d121 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2470,7 +2470,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) - if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) + 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); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 501c7c47676..0c879cfb029 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1513,7 +1513,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader if (group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + 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/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index cf2f2188a70..3deb9f44dd7 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -221,7 +221,7 @@ uint32 ReadMapDBC() map_ids[x].id = dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc.getRecord(x).getString(1)); } - printf("Done! (%u maps loaded)\n", map_count); + printf("Done! (%d maps loaded)\n", map_count); return map_count; } @@ -246,7 +246,7 @@ void ReadAreaTableDBC() maxAreaId = dbc.getMaxId(); - printf("Done! (%u areas loaded)\n", area_count); + printf("Done! (%d areas loaded)\n", area_count); } void ReadLiquidTypeTableDBC() @@ -259,15 +259,15 @@ void ReadLiquidTypeTableDBC() exit(1); } - size_t LiqType_count = dbc.getRecordCount(); - size_t LiqType_maxid = dbc.getMaxId(); - LiqType = new uint16[LiqType_maxid + 1]; - memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); + size_t liqTypeCount = dbc.getRecordCount(); + size_t liqTypeMaxId = dbc.getMaxId(); + LiqType = new uint16[liqTypeMaxId + 1]; + memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16)); - for(uint32 x = 0; x < LiqType_count; ++x) + for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); - printf("Done! (%u LiqTypes loaded)\n", LiqType_count); + printf("Done! (%d LiqTypes loaded)\n", liqTypeCount); } // @@ -364,7 +364,7 @@ uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE]; float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]; -bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 build) +bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, /*int cell_x*/, uint32 build) { ADT_file adt; diff --git a/src/tools/map_extractor/adt.cpp b/src/tools/map_extractor/adt.cpp index fde70681113..66134180cb0 100644 --- a/src/tools/map_extractor/adt.cpp +++ b/src/tools/map_extractor/adt.cpp @@ -53,7 +53,7 @@ bool ADT_file::prepareLoadedData() bool adt_MHDR::prepareLoadedData() { - if (fcc != 'MHDR') + if (fcc != "MHDR") return false; if (size!=sizeof(adt_MHDR)-8) @@ -72,7 +72,7 @@ bool adt_MHDR::prepareLoadedData() bool adt_MCIN::prepareLoadedData() { - if (fcc != 'MCIN') + if (fcc != "MCIN") return false; // Check cells data @@ -86,7 +86,7 @@ bool adt_MCIN::prepareLoadedData() bool adt_MH2O::prepareLoadedData() { - if (fcc != 'MH2O') + if (fcc != "MH2O") return false; // Check liquid data @@ -98,7 +98,7 @@ bool adt_MH2O::prepareLoadedData() bool adt_MCNK::prepareLoadedData() { - if (fcc != 'MCNK') + if (fcc != "MCNK") return false; // Check height map @@ -113,7 +113,7 @@ bool adt_MCNK::prepareLoadedData() bool adt_MCVT::prepareLoadedData() { - if (fcc != 'MCVT') + if (fcc != "MCVT") return false; if (size != sizeof(adt_MCVT)-8) @@ -124,7 +124,7 @@ bool adt_MCVT::prepareLoadedData() bool adt_MCLQ::prepareLoadedData() { - if (fcc != 'MCLQ') + if (fcc != "MCLQ") return false; return true; diff --git a/src/tools/map_extractor/loadlib.cpp b/src/tools/map_extractor/loadlib.cpp index 465eb04083f..77dca04d4c8 100644 --- a/src/tools/map_extractor/loadlib.cpp +++ b/src/tools/map_extractor/loadlib.cpp @@ -49,7 +49,7 @@ bool FileLoader::prepareLoadedData() { // Check version version = (file_MVER *) data; - if (version->fcc != 'MVER') + if (version->fcc != "MVER") return false; if (version->ver != FILE_FORMAT_VERSION) return false; diff --git a/src/tools/map_extractor/mpq_libmpq04.h b/src/tools/map_extractor/mpq_libmpq04.h index 1f3b259bbfc..89f715e9e87 100644 --- a/src/tools/map_extractor/mpq_libmpq04.h +++ b/src/tools/map_extractor/mpq_libmpq04.h @@ -60,8 +60,8 @@ class MPQFile libmpq__off_t pointer,size; // disable copying - MPQFile(const MPQFile &f) {} - void operator=(const MPQFile &f) {} + MPQFile(const MPQFile& /*f*/) {} + void operator=(const MPQFile& /*f*/) {} public: MPQFile(const char* filename); // filenames are not case sensitive diff --git a/src/tools/map_extractor/wdt.cpp b/src/tools/map_extractor/wdt.cpp index dedefbb64e5..d9ad0f4c7d3 100644 --- a/src/tools/map_extractor/wdt.cpp +++ b/src/tools/map_extractor/wdt.cpp @@ -4,21 +4,21 @@ bool wdt_MWMO::prepareLoadedData() { - if (fcc != 'MWMO') + if (fcc != "MWMO") return false; return true; } bool wdt_MPHD::prepareLoadedData() { - if (fcc != 'MPHD') + if (fcc != "MPHD") return false; return true; } bool wdt_MAIN::prepareLoadedData() { - if (fcc != 'MAIN') + if (fcc != "MAIN") return false; return true; } -- cgit v1.2.3 From 23be8c4fd719bb67e6a2dc9bc4114766bd62507f Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 18:22:34 +0100 Subject: Scripts/VH: Add an 1 minute pause after each boss fight (instead of 5 seconds) Revert one of the warning fixes (non standard C++) --- src/server/game/Spells/SpellInfo.cpp | 2 +- .../scripts/Northrend/VioletHold/instance_violet_hold.cpp | 3 ++- src/tools/map_extractor/adt.cpp | 12 ++++++------ src/tools/map_extractor/loadlib.cpp | 2 +- src/tools/map_extractor/wdt.cpp | 6 +++--- 5 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index e9e1b0eee8d..a931f759163 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -351,7 +351,7 @@ bool SpellEffectInfo::IsEffect() const bool SpellEffectInfo::IsEffect(SpellEffects effectName) const { - return Effect == effectName; + return Effect == uint32(effectName); } bool SpellEffectInfo::IsAura() const diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 79c54880430..37a13388b5f 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -690,7 +690,8 @@ public: { AddWave(); bActive = false; - uiActivationTimer = 5000; + // 1 minute waiting time after each boss fight + uiActivationTimer = (uiWaveCount == 6 || uiWaveCount == 12) ? 60000 : 5000; } else uiActivationTimer -= diff; } diff --git a/src/tools/map_extractor/adt.cpp b/src/tools/map_extractor/adt.cpp index 66134180cb0..fde70681113 100644 --- a/src/tools/map_extractor/adt.cpp +++ b/src/tools/map_extractor/adt.cpp @@ -53,7 +53,7 @@ bool ADT_file::prepareLoadedData() bool adt_MHDR::prepareLoadedData() { - if (fcc != "MHDR") + if (fcc != 'MHDR') return false; if (size!=sizeof(adt_MHDR)-8) @@ -72,7 +72,7 @@ bool adt_MHDR::prepareLoadedData() bool adt_MCIN::prepareLoadedData() { - if (fcc != "MCIN") + if (fcc != 'MCIN') return false; // Check cells data @@ -86,7 +86,7 @@ bool adt_MCIN::prepareLoadedData() bool adt_MH2O::prepareLoadedData() { - if (fcc != "MH2O") + if (fcc != 'MH2O') return false; // Check liquid data @@ -98,7 +98,7 @@ bool adt_MH2O::prepareLoadedData() bool adt_MCNK::prepareLoadedData() { - if (fcc != "MCNK") + if (fcc != 'MCNK') return false; // Check height map @@ -113,7 +113,7 @@ bool adt_MCNK::prepareLoadedData() bool adt_MCVT::prepareLoadedData() { - if (fcc != "MCVT") + if (fcc != 'MCVT') return false; if (size != sizeof(adt_MCVT)-8) @@ -124,7 +124,7 @@ bool adt_MCVT::prepareLoadedData() bool adt_MCLQ::prepareLoadedData() { - if (fcc != "MCLQ") + if (fcc != 'MCLQ') return false; return true; diff --git a/src/tools/map_extractor/loadlib.cpp b/src/tools/map_extractor/loadlib.cpp index 77dca04d4c8..465eb04083f 100644 --- a/src/tools/map_extractor/loadlib.cpp +++ b/src/tools/map_extractor/loadlib.cpp @@ -49,7 +49,7 @@ bool FileLoader::prepareLoadedData() { // Check version version = (file_MVER *) data; - if (version->fcc != "MVER") + if (version->fcc != 'MVER') return false; if (version->ver != FILE_FORMAT_VERSION) return false; diff --git a/src/tools/map_extractor/wdt.cpp b/src/tools/map_extractor/wdt.cpp index d9ad0f4c7d3..dedefbb64e5 100644 --- a/src/tools/map_extractor/wdt.cpp +++ b/src/tools/map_extractor/wdt.cpp @@ -4,21 +4,21 @@ bool wdt_MWMO::prepareLoadedData() { - if (fcc != "MWMO") + if (fcc != 'MWMO') return false; return true; } bool wdt_MPHD::prepareLoadedData() { - if (fcc != "MPHD") + if (fcc != 'MPHD') return false; return true; } bool wdt_MAIN::prepareLoadedData() { - if (fcc != "MAIN") + if (fcc != 'MAIN') return false; return true; } -- cgit v1.2.3 From 36ea485f9a62bedf7b1114f0536322f241fed2e1 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 18:37:10 +0100 Subject: Tools: Fix a typo and printf formats (there's no standard format for size_t) --- src/tools/map_extractor/System.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 3deb9f44dd7..1505f2c2cee 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -221,7 +221,7 @@ uint32 ReadMapDBC() map_ids[x].id = dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc.getRecord(x).getString(1)); } - printf("Done! (%d maps loaded)\n", map_count); + printf("Done! (%u maps loaded)\n", map_count); return map_count; } @@ -246,7 +246,7 @@ void ReadAreaTableDBC() maxAreaId = dbc.getMaxId(); - printf("Done! (%d areas loaded)\n", area_count); + printf("Done! (%u areas loaded)\n", area_count); } void ReadLiquidTypeTableDBC() @@ -267,7 +267,7 @@ void ReadLiquidTypeTableDBC() for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); - printf("Done! (%d LiqTypes loaded)\n", liqTypeCount); + printf("Done! (%u LiqTypes loaded)\n", liqTypeCount); } // @@ -364,7 +364,7 @@ uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE]; float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]; -bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, /*int cell_x*/, uint32 build) +bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/, uint32 build) { ADT_file adt; -- cgit v1.2.3 From 868e38ebcbac5b94b6d2810730114b64b3cbea27 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 20:33:49 +0100 Subject: Core/BG: Move the log "ArenaTeam x does not have any members or ..." from DB error to debug level --- src/server/game/Battlegrounds/ArenaTeam.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 73e24e5a3c3..89151b6395c 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -267,7 +267,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (Empty() || !captainPresentInTeam) { // Arena team is empty or captain is not in team, delete from db - sLog->outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); return false; } -- cgit v1.2.3 From 388250961f24cbe2ba955da6d7446965d058f97d Mon Sep 17 00:00:00 2001 From: Mik43l Date: Sun, 20 May 2012 22:09:12 +0200 Subject: [Core/Spell]: Fix Blessing of Ancient Kings (Val'anyr, Hammer of Ancient Kings) closes #6521 --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a4d02ee5ea1..ba481176d23 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5870,7 +5870,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID())) { // The shield can grow to a maximum size of 20, 000 damage absorbtion - aurEff->SetAmount(std::max(aurEff->GetAmount() + basepoints0, 20000)); + aurEff->SetAmount(std::min(aurEff->GetAmount() + basepoints0, 20000)); // Refresh and return to prevent replacing the aura aurEff->GetBase()->RefreshDuration(); -- cgit v1.2.3 From 6b8d4ce123a40d66968a8fcb56e14364355fdb5d Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 21 May 2012 00:03:43 +0200 Subject: Core/Spell: Fix spell effect SPELL_EFFECT_HEAL_MAX_HEALTH calculation --- src/server/game/Spells/SpellEffects.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 07bea5f980c..17e79501d16 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3565,7 +3565,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) if (!unitTarget || !unitTarget->isAlive()) return; - int32 addhealth; + int32 addhealth = 0; if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands { if (m_caster->GetGUID() == unitTarget->GetGUID()) @@ -3582,11 +3582,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) else addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth(); - if (m_originalCaster) - { - uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - m_healing += unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); - } + m_healing += addhealth; } void Spell::EffectInterruptCast(SpellEffIndex effIndex) -- cgit v1.2.3 From 4e9de61e97050dfcfa402f8fe16cd820f2938aa9 Mon Sep 17 00:00:00 2001 From: Chaplain Date: Mon, 21 May 2012 13:28:37 +0300 Subject: Core/MapManager: Fix logic in SetMapUpdateInterval() --- src/server/game/Maps/MapManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 1049325237a..106c2189c65 100755 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -71,7 +71,7 @@ class MapManager void SetMapUpdateInterval(uint32 t) { - if (t > MIN_MAP_UPDATE_DELAY) + if (t < MIN_MAP_UPDATE_DELAY) t = MIN_MAP_UPDATE_DELAY; i_timer.SetInterval(t); -- cgit v1.2.3 From 5a154ac27249b6584cba15063698584b165f2038 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 21 May 2012 00:22:58 +0200 Subject: Core/Spell: DK T10 Melee 4P is SPELL_AURA_PROC_TRIGGER_SPELL proc --- src/server/game/Entities/Unit/Unit.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ba481176d23..9689a0c6402 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7786,17 +7786,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } } } - // Item - Death Knight T10 Melee 4P Bonus - if (dummySpell->Id == 70656) - { - Player* player = ToPlayer(); - if (!player) - return false; - - for (uint32 i = 0; i < MAX_RUNES; ++i) - if (player->GetRuneCooldown(i) == 0) - return false; - } break; } case SPELLFAMILY_POTION: @@ -8724,6 +8713,16 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 50475; basepoints0 = CalculatePctN(int32(damage), triggerAmount); } + // Item - Death Knight T10 Melee 4P Bonus + else if (auraSpellInfo->Id == 70656) + { + if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT) + return false; + + for (uint8 i = 0; i < MAX_RUNES; ++i) + if (ToPlayer()->GetRuneCooldown(i) == 0) + return false; + } break; } case SPELLFAMILY_ROGUE: -- cgit v1.2.3 From 99040237c7d9f5e1ffcca0416b6b7fef8ea8cd1a Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 22 May 2012 12:32:53 -0400 Subject: Core/Items: correctly cast spells on item store. Closes #4208 --- src/server/game/Entities/Player/Player.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f5f336a2402..3a5bfa6c8c1 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12180,11 +12180,6 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update pItem->SetItemRandomProperties(randomPropertyId); pItem = StoreItem(dest, pItem, update); - const ItemTemplate* proto = pItem->GetTemplate(); - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger - CastSpell(this, proto->Spells[i].SpellId, true, pItem); - if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound()) { pItem->SetSoulboundTradeable(allowedLooters); @@ -12290,6 +12285,14 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool AddEnchantmentDurations(pItem); AddItemDurations(pItem); + + const ItemTemplate* proto = pItem->GetTemplate(); + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger + if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) + if (HasAura(proto->Spells[i].SpellId)) + CastSpell(this, proto->Spells[i].SpellId, true, pItem); + return pItem; } else @@ -12326,6 +12329,13 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool pItem2->SetState(ITEM_CHANGED, this); + const ItemTemplate* proto = pItem2->GetTemplate(); + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger + if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) + if (HasAura(proto->Spells[i].SpellId)) + CastSpell(this, proto->Spells[i].SpellId, true, pItem2); + return pItem2; } } -- cgit v1.2.3 From df9791f1aa09b33e061133047b679951ba656357 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 22 May 2012 14:05:53 -0400 Subject: Core/Items: fix typo from previous commit (thx vincentmichael) --- src/server/game/Entities/Player/Player.cpp | 6 +++--- src/server/game/Entities/Unit/Unit.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3a5bfa6c8c1..2448f4a3199 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12290,7 +12290,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) - if (HasAura(proto->Spells[i].SpellId)) + if (!HasAura(proto->Spells[i].SpellId)) CastSpell(this, proto->Spells[i].SpellId, true, pItem); return pItem; @@ -12333,7 +12333,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) - if (HasAura(proto->Spells[i].SpellId)) + if (!HasAura(proto->Spells[i].SpellId)) CastSpell(this, proto->Spells[i].SpellId, true, pItem2); return pItem2; @@ -16385,7 +16385,7 @@ void Player::ReputationChanged2(FactionEntry const* factionEntry) } } -bool Player::HasQuestForItem(uint32 itemid) const + bool Player::HasQuestForItem(uint32 itemid) const { for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e45f1214f4f..bc4a824d1d7 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8039,7 +8039,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp *handled = true; if (victim && victim->HasAura(53601)) { - int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2]. CalcValue()); + int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2].CalcValue()); // Item - Paladin T9 Holy 4P Bonus if (AuraEffect const* aurEff = GetAuraEffect(67191, 0)) AddPctN(bp0, aurEff->GetAmount()); -- cgit v1.2.3 From 66d42b4f296fa455bfc96ed6a09e64ed5cc62a9d Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 14:24:28 +0200 Subject: Core/Protocol: Process CMSG_UPDATE_MISSILE_TRAJECTORY packets --- src/server/game/Handlers/MiscHandler.cpp | 45 +++++++++++++++++++++++++++++ src/server/game/Server/Protocol/Opcodes.cpp | 2 +- src/server/game/Server/WorldSession.h | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 35872f8c63f..9abd39f90ec 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -51,6 +51,7 @@ #include "GameObjectAI.h" #include "Group.h" #include "AccountMgr.h" +#include "Spell.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { @@ -1714,3 +1715,47 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) _player->SetPendingBind(0, 0); } + +void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); + + uint64 guid; + uint32 spellId; + float elevation, speed; + float curX, curY, curZ; + float targetX, targetY, targetZ; + uint8 moveStop; + + recvPacket >> guid >> spellId >> elevation >> speed; + recvPacket >> curX >> curY >> curZ; + recvPacket >> targetX >> targetY >> targetZ; + recvPacket >> moveStop; + + Unit* caster = ObjectAccessor::GetUnit(*_player, guid); + Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL; + if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst()) + { + recvPacket.rfinish(); + return; + } + + Position pos = *spell->m_targets.GetSrcPos(); + pos.Relocate(curX, curY, curZ); + spell->m_targets.ModSrc(pos); + + pos = *spell->m_targets.GetDstPos(); + pos.Relocate(targetX, targetY, targetZ); + spell->m_targets.ModDst(pos); + + spell->m_targets.SetElevation(elevation); + spell->m_targets.SetSpeed(speed); + + if (moveStop) + { + uint32 opcode; + recvPacket >> opcode; + recvPacket.SetOpcode(opcode); + HandleMovementOpcodes(recvPacket); + } +} diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 517935acbd2..bd9c75c251d 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1148,7 +1148,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x45F*/ { "CMSG_CALENDAR_EVENT_INVITE_NOTES", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x460*/ { "SMSG_CALENDAR_EVENT_INVITE_NOTES", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x461*/ { "SMSG_CALENDAR_EVENT_INVITE_NOTES_ALERT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x462*/ { "CMSG_UPDATE_MISSILE_TRAJECTORY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x462*/ { "CMSG_UPDATE_MISSILE_TRAJECTORY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleUpdateMissileTrajectory }, /*0x463*/ { "SMSG_UPDATE_ACCOUNT_DATA_COMPLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x464*/ { "SMSG_TRIGGER_MOVIE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x465*/ { "CMSG_COMPLETE_MOVIE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index bb54a0ae19e..6d8a9e3ff38 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -785,6 +785,7 @@ class WorldSession void HandleResetInstancesOpcode(WorldPacket& recv_data); void HandleHearthAndResurrect(WorldPacket& recv_data); void HandleInstanceLockResponse(WorldPacket& recvPacket); + void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); // Looking for Dungeon/Raid void HandleLfgSetCommentOpcode(WorldPacket& recv_data); -- cgit v1.2.3 From f424052f82c8fc0172e78170bd70722ec76c1368 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 14:28:38 +0200 Subject: Core/Spells: Make spellclick spells non triggered --- src/server/game/Entities/Unit/Unit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bc4a824d1d7..71977bf469c 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10191,7 +10191,7 @@ Unit* Unit::GetFirstControlled() const // Sequence: charmed, pet, other guardians Unit* unit = GetCharm(); if (!unit) - if (uint64 guid = GetUInt64Value(UNIT_FIELD_SUMMON)) + if (uint64 guid = GetMinionGUID()) unit = ObjectAccessor::GetUnit(*this, guid); return unit; @@ -17018,7 +17018,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) } if (IsInMap(caster)) - caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, true, NULL, NULL, origCasterGUID); + caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, false, NULL, NULL, origCasterGUID); else // This can happen during Player::_LoadAuras { int32 bp0 = seatId; @@ -17028,7 +17028,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) else { if (IsInMap(caster)) - caster->CastSpell(target, spellEntry, true, NULL, NULL, origCasterGUID); + caster->CastSpell(target, spellEntry, false, NULL, NULL, origCasterGUID); else Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID); } -- cgit v1.2.3 From 037f37ac653f1c2aa26068f6a03b4e01e7a544c3 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 14:56:08 +0200 Subject: Core/Protocol: correct SMSG_CALENDAR_RAID_LOCKOUT_UPDATED struct (and SMSG_CALENDAR_SEND_CALENDAR if no invite was found) --- src/server/game/Handlers/CalendarHandler.cpp | 56 ++++++++++++++++------------ 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index d1277d154cc..298c742fc3a 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -20,7 +20,7 @@ ----- Opcodes Not Used yet ----- SMSG_CALENDAR_CLEAR_PENDING_ACTION SendCalendarClearPendingAction() -SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save) <--- Structure unknown, using LOCKOUT_ADDED +SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save) ----- Opcodes without Sniffs ----- SMSG_CALENDAR_FILTER_GUILD [ for (... uint32(count) { packguid(???), uint8(???) } ] @@ -74,7 +74,11 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) else { sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it); - data << uint64(0) << uint64(0) << uint8(0) << uint8(0); + data << uint64(0); + data << uint64(0); + data << uint8(0); + data << uint8(0); + data << uint8(0); data.appendPackGUID(0); } } @@ -96,8 +100,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) else { sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it); - data << uint64(0) << uint8(0) << uint32(0) - << uint32(0) << uint32(0) << uint32(0); + data << uint64(0); + data << uint8(0); + data << uint32(0); + data << uint32(0); + data << uint32(0); + data << uint32(0); data.appendPackGUID(0); } } @@ -835,26 +843,6 @@ void WorldSession::SendCalendarClearPendingAction() SendPacket(&data); } -void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save) -{ - if (!save) - return; - - uint64 guid = _player->GetGUID(); - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD - "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty()); - - time_t cur_time = time_t(time(NULL)); - - WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8); - data << secsToTimeBitFields(cur_time); - data << uint32(save->GetMapId()); - data << uint32(save->GetDifficulty()); - data << uint32(save->GetResetTime() - cur_time); - data << uint64(save->GetInstanceId()); - SendPacket(&data); -} - void WorldSession::SendCalendarCommandResult(CalendarError err, char const* param /*= NULL*/) { uint64 guid = _player->GetGUID(); @@ -898,3 +886,23 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add) data << uint64(save->GetInstanceId()); SendPacket(&data); } + +void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save) +{ + if (!save) + return; + + uint64 guid = _player->GetGUID(); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD + "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty()); + + time_t cur_time = time_t(time(NULL)); + + WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8); + data << secsToTimeBitFields(cur_time); + data << uint32(save->GetMapId()); + data << uint32(save->GetDifficulty()); + data << uint32(0); // Amount of seconds that has changed to the reset time + data << uint32(save->GetResetTime() - cur_time); + SendPacket(&data); +} -- cgit v1.2.3 From 419d537bc833fb83aac947c3fa3ba0823e5b8c81 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 15:02:54 +0200 Subject: Core/Global: Cleanup in MovementHandler and some assertions --- .../game/Battlegrounds/Zones/BattlegroundAB.cpp | 2 +- .../game/Battlegrounds/Zones/BattlegroundSA.cpp | 11 ++- src/server/game/Globals/ObjectMgr.cpp | 78 ++++++++-------------- src/server/game/Handlers/MovementHandler.cpp | 68 +++++++++---------- 4 files changed, 70 insertions(+), 89 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 52d2cdefd65..d28f5ddfe6a 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -290,7 +290,7 @@ int32 BattlegroundAB::_GetNodeNameId(uint8 node) case BG_AB_NODE_LUMBER_MILL:return LANG_BG_AB_NODE_LUMBER_MILL; case BG_AB_NODE_GOLD_MINE: return LANG_BG_AB_NODE_GOLD_MINE; default: - ASSERT(0); + ASSERT(false); } return 0; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 977897b8d48..133a0aec560 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -720,8 +720,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) DelCreature(BG_SA_MAXNPC + i); GraveyardStatus[i] = Source->GetTeamId(); - WorldSafeLocsEntry const* sg = NULL; - sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + if (!sg) + { + sLog->outError("BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]); + return; + } + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE)); uint32 npc = 0; uint32 flag = 0; @@ -781,7 +786,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) SendWarningToAll(LANG_BG_SA_H_GY_SOUTH); break; default: - ASSERT(0); + ASSERT(false); break; }; } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 9dea557f650..1e36b4c732b 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6247,74 +6247,54 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) switch (guidhigh) { case HIGHGUID_ITEM: - if (_hiItemGuid >= 0xFFFFFFFE) - { - sLog->outError("Item guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!"); return _hiItemGuid++; + } case HIGHGUID_UNIT: - if (_hiCreatureGuid >= 0x00FFFFFE) - { - sLog->outError("Creature guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!"); return _hiCreatureGuid++; + } case HIGHGUID_PET: - if (_hiPetGuid >= 0x00FFFFFE) - { - sLog->outError("Pet guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!"); return _hiPetGuid++; + } case HIGHGUID_VEHICLE: - if (_hiVehicleGuid >= 0x00FFFFFF) - { - sLog->outError("Vehicle guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!"); return _hiVehicleGuid++; + } case HIGHGUID_PLAYER: - if (_hiCharGuid >= 0xFFFFFFFE) - { - sLog->outError("Players guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCharGuid < 0xFFFFFFFE && "Player guid overflow!"); return _hiCharGuid++; + } case HIGHGUID_GAMEOBJECT: - if (_hiGoGuid >= 0x00FFFFFE) - { - sLog->outError("Gameobject guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!"); return _hiGoGuid++; + } case HIGHGUID_CORPSE: - if (_hiCorpseGuid >= 0xFFFFFFFE) - { - sLog->outError("Corpse guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!"); return _hiCorpseGuid++; + } case HIGHGUID_DYNAMICOBJECT: - if (_hiDoGuid >= 0xFFFFFFFE) - { - sLog->outError("DynamicObject guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!"); return _hiDoGuid++; + } case HIGHGUID_MO_TRANSPORT: - if (_hiMoTransGuid >= 0xFFFFFFFE) - { - sLog->outError("MO Transport guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!"); return _hiMoTransGuid++; + } default: - ASSERT(0); + ASSERT(false && "ObjectMgr::GenerateLowGuid - Unknown HIGHGUID type"); + return 0; } - - ASSERT(0); - return 0; } void ObjectMgr::LoadGameObjectLocales() diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index b3d663e1850..c271a43462a 100755 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -64,10 +64,9 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->m_InstanceValid = true; Map* oldMap = GetPlayer()->GetMap(); - ASSERT(oldMap); if (GetPlayer()->IsInWorld()) { - sLog->outCrash("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId()); + sLog->outError("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } @@ -200,8 +199,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) sLog->outStaticDebug("Guid " UI64FMTD, guid); sLog->outStaticDebug("Flags %u, time %u", flags, time/IN_MILLISECONDS); - Unit* mover = _player->m_mover; - Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; + Player* plMover = _player->m_mover->ToPlayer(); if (!plMover || !plMover->IsBeingTeleportedNear()) return; @@ -240,33 +238,33 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) GetPlayer()->ProcessDelayedOperations(); } -void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) +void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) { - uint16 opcode = recv_data.GetOpcode(); + uint16 opcode = recvData.GetOpcode(); Unit* mover = _player->m_mover; - ASSERT(mover != NULL); // there must always be a mover + ASSERT(mover != NULL); // there must always be a mover - Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; + Player* plrMover = mover->ToPlayer(); // ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck - if (plMover && plMover->IsBeingTeleported()) + if (plrMover && plrMover->IsBeingTeleported()) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } /* extract packet */ uint64 guid; - recv_data.readPackGUID(guid); + recvData.readPackGUID(guid); MovementInfo movementInfo; movementInfo.guid = guid; - ReadMovementInfo(recv_data, &movementInfo); + ReadMovementInfo(recvData, &movementInfo); - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam // prevent tampered movement data if (guid != mover->GetGUID()) @@ -274,7 +272,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) if (!movementInfo.pos.IsPositionValid()) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } @@ -285,27 +283,27 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) // (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped) if (movementInfo.t_pos.GetPositionX() > 50 || movementInfo.t_pos.GetPositionY() > 50 || movementInfo.t_pos.GetPositionZ() > 50) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(), movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation())) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } // if we boarded a transport, add us to it - if (plMover && !plMover->GetTransport()) + if (plrMover && !plrMover->GetTransport()) { // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter) { if ((*iter)->GetGUID() == movementInfo.t_guid) { - plMover->m_transport = (*iter); - (*iter)->AddPassenger(plMover); + plrMover->m_transport = (*iter); + (*iter)->AddPassenger(plrMover); break; } } @@ -318,29 +316,29 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; } } - else if (plMover && plMover->GetTransport()) // if we were on a transport, leave + else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave { - plMover->m_transport->RemovePassenger(plMover); - plMover->m_transport = NULL; + plrMover->m_transport->RemovePassenger(plrMover); + plrMover->m_transport = NULL; movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); movementInfo.t_time = 0; movementInfo.t_seat = -1; } // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map). - if (opcode == MSG_MOVE_FALL_LAND && plMover && !plMover->isInFlight()) - plMover->HandleFall(movementInfo); + if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->isInFlight()) + plrMover->HandleFall(movementInfo); - if (plMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plMover->IsInWater()) + if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater()) { // now client not include swimming flag in case jumping under water - plMover->SetInWater(!plMover->IsInWater() || plMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ())); + plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ())); } /*----------------------*/ /* process position-change */ - WorldPacket data(opcode, recv_data.size()); + WorldPacket data(opcode, recvData.size()); movementInfo.time = getMSTime(); movementInfo.guid = mover->GetGUID(); WriteMovementInfo(&data, &movementInfo); @@ -357,27 +355,25 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) mover->UpdatePosition(movementInfo.pos); - if (plMover) // nothing is charmed, or player charmed + if (plrMover) // nothing is charmed, or player charmed { - plMover->UpdateFallInformationIfNeed(movementInfo, opcode); + plrMover->UpdateFallInformationIfNeed(movementInfo, opcode); if (movementInfo.pos.GetPositionZ() < -500.0f) { - if (!(plMover->InBattleground() - && plMover->GetBattleground() - && plMover->GetBattleground()->HandlePlayerUnderMap(_player))) + if (!(plrMover->GetBattleground() && plrMover->GetBattleground()->HandlePlayerUnderMap(_player))) { // NOTE: this is actually called many times while falling // even after the player has been teleported away // TODO: discard movement packets after the player is rooted - if (plMover->isAlive()) + if (plrMover->isAlive()) { - plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); + plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); // player can be alive if GM/etc // change the death state to CORPSE to prevent the death timer from // starting in the next player update - if (!plMover->isAlive()) - plMover->KillPlayer(); + if (!plrMover->isAlive()) + plrMover->KillPlayer(); } } } -- cgit v1.2.3 From dbe8034ec277c660d1eeacbd9ac39b6783ad37dd Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 16:37:22 +0200 Subject: Core/Calendar: Fix crash when deleting an event on the calendar. Should also stop the error message from appearing. Thanks elecyb Closes #6570 - Corrected some code from 66d42b4f296fa455bfc96ed6a09e64ed5cc62a9d --- src/server/game/Calendar/CalendarMgr.cpp | 24 +++++++++++------------- src/server/game/Handlers/MiscHandler.cpp | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index cef68891890..62bc0ab3205 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -95,9 +95,9 @@ CalendarEventIdList const& CalendarMgr::GetPlayerEvents(uint64 guid) CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) { - CalendarInviteMap::iterator it = _invites.find(inviteId); - if (it != _invites.end()) - return &(it->second); + CalendarInviteMap::iterator itr = _invites.find(inviteId); + if (itr != _invites.end()) + return &(itr->second); sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId); return NULL; @@ -105,9 +105,9 @@ CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) CalendarEvent* CalendarMgr::GetEvent(uint64 eventId) { - CalendarEventMap::iterator it = _events.find(eventId); - if (it != _events.end()) - return &(it->second); + CalendarEventMap::iterator itr = _events.find(eventId); + if (itr != _events.end()) + return &(itr->second); sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId); return NULL; @@ -316,11 +316,6 @@ void CalendarMgr::AddAction(CalendarAction const& action) if (!calendarEvent) return; - CalendarInviteIdList const& inviteIds = calendarEvent->GetInviteIdList(); - for (CalendarInviteIdList::const_iterator it = inviteIds.begin(); it != inviteIds.end(); ++it) - if (uint64 invitee = RemoveInvite(*it)) - SendCalendarEventRemovedAlert(invitee, *calendarEvent); - RemoveEvent(eventId); break; } @@ -464,8 +459,6 @@ bool CalendarMgr::RemoveEvent(uint64 eventId) return false; } - _events.erase(itr); - bool val = true; CalendarInviteIdList const& invites = itr->second.GetInviteIdList(); @@ -474,8 +467,13 @@ bool CalendarMgr::RemoveEvent(uint64 eventId) CalendarInvite* invite = GetInvite(*itrInvites); if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId)) val = false; + + if (uint64 invitee = RemoveInvite(*itrInvites)) + SendCalendarEventRemovedAlert(invitee, itr->second); } + _events.erase(itr); + return val; } diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 9abd39f90ec..a280bc30b7c 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -1733,8 +1733,8 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) recvPacket >> moveStop; Unit* caster = ObjectAccessor::GetUnit(*_player, guid); - Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL; - if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst()) + Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : NULL; + if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc()) { recvPacket.rfinish(); return; -- cgit v1.2.3 From 2ae0cfc8b6c0c5c41550f81a8fdb768714456b00 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 23 May 2012 16:40:44 +0200 Subject: Core/GuardAI: General cleanup and removed some unnecessary code. --- src/server/game/AI/CoreAI/GuardAI.cpp | 87 +++-------------------------------- src/server/game/AI/CoreAI/GuardAI.h | 23 ++------- 2 files changed, 11 insertions(+), 99 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 252bcbabca5..6e2326ca9d5 100755 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -23,7 +23,7 @@ #include "World.h" #include "CreatureAIImpl.h" -int GuardAI::Permissible(const Creature* creature) +int GuardAI::Permissible(Creature const* creature) { if (creature->isGuard()) return PERMIT_BASE_SPECIAL; @@ -31,7 +31,7 @@ int GuardAI::Permissible(const Creature* creature) return PERMIT_BASE_NO; } -GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature), i_victimGuid(0), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK) +GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature) { } @@ -40,108 +40,35 @@ bool GuardAI::CanSeeAlways(WorldObject const* obj) if (!obj->isType(TYPEMASK_UNIT)) return false; - std::list t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - if (unit == obj) - return true; - } + std::list threatList = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + if ((*itr)->getUnitGuid() == obj->GetGUID()) + return true; return false; } -void GuardAI::MoveInLineOfSight(Unit* unit) -{ - // Ignore Z for flying creatures - if (!me->CanFly() && me->GetDistanceZ(unit) > CREATURE_Z_ATTACK_RANGE) - return; - - if (!me->getVictim() && me->IsValidAttackTarget(unit) && - (unit->IsHostileToPlayers() || me->IsHostileTo(unit)) && - unit->isInAccessiblePlaceFor(me)) - { - float attackRadius = me->GetAttackDistance(unit); - if (me->IsWithinDistInMap(unit, attackRadius)) - { - //Need add code to let guard support player - AttackStart(unit); - //u->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); - } - } -} - void GuardAI::EnterEvadeMode() { if (!me->isAlive()) { - sLog->outStaticDebug("Creature stopped attacking because he is dead [guid=%u]", me->GetGUIDLow()); me->GetMotionMaster()->MoveIdle(); - - i_state = STATE_NORMAL; - - i_victimGuid = 0; me->CombatStop(true); me->DeleteThreatList(); return; } - Unit* victim = ObjectAccessor::GetUnit(*me, i_victimGuid); - - if (!victim) - { - sLog->outStaticDebug("Creature stopped attacking because victim does not exist [guid=%u]", me->GetGUIDLow()); - } - else if (!victim->isAlive()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is dead [guid=%u]", me->GetGUIDLow()); - } - else if (victim->HasStealthAura()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is using stealth [guid=%u]", me->GetGUIDLow()); - } - else if (victim->isInFlight()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is flying away [guid=%u]", me->GetGUIDLow()); - } - else - { - sLog->outStaticDebug("Creature stopped attacking because victim outran him [guid=%u]", me->GetGUIDLow()); - } + sLog->outDebug(LOG_FILTER_UNITS, "Guard entry: %u enters evade mode.", me->GetEntry()); me->RemoveAllAuras(); me->DeleteThreatList(); - i_victimGuid = 0; me->CombatStop(true); - i_state = STATE_NORMAL; // Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) me->GetMotionMaster()->MoveTargetedHome(); } -void GuardAI::UpdateAI(const uint32 /*diff*/) -{ - // update i_victimGuid if me->getVictim() !=0 and changed - if (!UpdateVictim()) - return; - - Unit* const victim = me->getVictim(); - if (!victim) - return; - - i_victimGuid = victim->GetGUID(); - - if (me->isAttackReady()) - { - if (me->IsWithinMeleeRange(victim)) - { - me->AttackerStateUpdate(victim); - me->resetAttackTimer(); - } - } -} - void GuardAI::JustDied(Unit* killer) { if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h index c80c5a6c343..c8dd9d54921 100755 --- a/src/server/game/AI/CoreAI/GuardAI.h +++ b/src/server/game/AI/CoreAI/GuardAI.h @@ -20,34 +20,19 @@ #define TRINITY_GUARDAI_H #include "ScriptedCreature.h" -#include "Timer.h" class Creature; class GuardAI : public ScriptedAI { - enum GuardState - { - STATE_NORMAL = 1, - STATE_LOOK_AT_VICTIM = 2 - }; - public: + explicit GuardAI(Creature* creature); - explicit GuardAI(Creature* c); - - void MoveInLineOfSight(Unit*); - void EnterEvadeMode(); - void JustDied(Unit*); + static int Permissible(Creature const* creature); bool CanSeeAlways(WorldObject const* obj); - void UpdateAI(const uint32); - static int Permissible(const Creature*); - - private: - uint64 i_victimGuid; - GuardState i_state; - TimeTracker i_tracker; + void EnterEvadeMode(); + void JustDied(Unit* killer); }; #endif -- cgit v1.2.3 From b1179d8f49d0dcab4b99365309e3eaadd5dbe218 Mon Sep 17 00:00:00 2001 From: Nay Date: Wed, 23 May 2012 21:25:50 +0100 Subject: Core/Bags: Do not allow multiple unique bags in bank bag slots Existing multiple bags will be removed and items mailed Kudos to micha Closes #2786 --- src/server/game/Entities/Player/Player.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2448f4a3199..371662921f5 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -10157,7 +10157,8 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const if (inBankAlso) { - for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + // checking every item from 39 to 74 (including bank bags) + for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetEntry() == item) count += pItem->GetCount(); -- cgit v1.2.3 From 3ea75c50d019f1b29145bc974ae51039544beb16 Mon Sep 17 00:00:00 2001 From: MrSmite Date: Mon, 7 May 2012 17:41:58 -0400 Subject: Fixes broken autocast spells such as Furious Howl and Leap to cast when on autocast and "attack" is clicked. Fixes wrong check for spell cooldown and removes check for duration (some spells with duration such as poison are stackable) --- src/server/game/AI/CoreAI/PetAI.cpp | 58 +++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index bcec8d273b9..14306c8861f 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -153,40 +153,60 @@ void PetAI::UpdateAI(const uint32 diff) if (spellInfo->IsPositive()) { - // non combat spells allowed - // only pet spells have IsNonCombatSpell and not fit this reqs: - // Consume Shadows, Lesser Invisibility, so ignore checks for its if (spellInfo->CanBeUsedInCombat()) { - // allow only spell without spell cost or with spell cost but not duration limit - int32 duration = spellInfo->GetDuration(); - if ((spellInfo->ManaCost || spellInfo->ManaCostPercentage || spellInfo->ManaPerSecond) && duration > 0) + // check spell cooldown + if (me->HasSpellCooldown(spellInfo->Id)) continue; - // allow only spell without cooldown > duration - int32 cooldown = spellInfo->GetRecoveryTime(); - if (cooldown >= 0 && duration >= 0 && cooldown > duration) + // Check if we're in combat or commanded to attack + if (!me->isInCombat() && !me->GetCharmInfo()->IsCommandAttack()) continue; } Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0); - bool spellUsed = false; - for (std::set::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) - { - Unit* target = ObjectAccessor::GetUnit(*me, *tar); - //only buff targets that are in combat, unless the spell can only be cast while out of combat - if (!target) - continue; - - if (spell->CanAutoCast(target)) + // Some spells can target enemy or friendly (DK Ghoul's Leap) + // Check for enemy first (pet then owner) + if (Unit* target = me->getAttackerForHelper()) + { + if (CanAttack(target) && spell->CanAutoCast(target)) + { + targetSpellStore.push_back(std::make_pair(target, spell)); + spellUsed = true; + } + } + else if (Unit* target = me->GetCharmerOrOwner()->getAttackerForHelper()) + { + if (CanAttack(target) && spell->CanAutoCast(target)) { targetSpellStore.push_back(std::make_pair(target, spell)); spellUsed = true; - break; } } + + // No enemy, check friendly + if (!spellUsed) + { + for (std::set::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) + { + Unit* target = ObjectAccessor::GetUnit(*me, *tar); + + //only buff targets that are in combat, unless the spell can only be cast while out of combat + if (!target) + continue; + + if (spell->CanAutoCast(target)) + { + targetSpellStore.push_back(std::make_pair(target, spell)); + spellUsed = true; + break; + } + } + } + + // No valid targets at all if (!spellUsed) delete spell; } -- cgit v1.2.3 From 4bdc5573822fd8c2d4ed0422abb2bd29e772e6de Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 09:51:57 -0400 Subject: Core/Bags: cleanup random tab. check for item in bag slots for getitembyguid and getitemcountwithlimitcategory --- src/server/game/Entities/Player/Player.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 371662921f5..41c95ac3d04 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -10198,7 +10198,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte if (Bag* pBag = GetBagByPos(i)) count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem); - for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem) if (ItemTemplate const* pProto = pItem->GetTemplate()) @@ -10224,7 +10224,7 @@ Item* Player::GetItemByGuid(uint64 guid) const if (pItem->GetGUID() == guid) return pItem; - for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetGUID() == guid) return pItem; @@ -16386,7 +16386,7 @@ void Player::ReputationChanged2(FactionEntry const* factionEntry) } } - bool Player::HasQuestForItem(uint32 itemid) const +bool Player::HasQuestForItem(uint32 itemid) const { for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { -- cgit v1.2.3 From 84b420160dacd5b9a9c6cf77ecc9e5cfc1b4afae Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 24 May 2012 16:29:43 +0200 Subject: Core/Pets: Some minor corrections to 3ea75c50d019f1b29145bc974ae51039544beb16 --- src/server/game/AI/CoreAI/PetAI.cpp | 22 +++++++++------------- src/server/game/DataStores/DBCEnums.h | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 14306c8861f..160b406a6ea 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -169,15 +169,11 @@ void PetAI::UpdateAI(const uint32 diff) // Some spells can target enemy or friendly (DK Ghoul's Leap) // Check for enemy first (pet then owner) - if (Unit* target = me->getAttackerForHelper()) - { - if (CanAttack(target) && spell->CanAutoCast(target)) - { - targetSpellStore.push_back(std::make_pair(target, spell)); - spellUsed = true; - } - } - else if (Unit* target = me->GetCharmerOrOwner()->getAttackerForHelper()) + Unit* target = me->getAttackerForHelper(); + if (!target && owner) + target = owner->getAttackerForHelper(); + + if (target) { if (CanAttack(target) && spell->CanAutoCast(target)) { @@ -191,15 +187,15 @@ void PetAI::UpdateAI(const uint32 diff) { for (std::set::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) { - Unit* target = ObjectAccessor::GetUnit(*me, *tar); + Unit* ally = ObjectAccessor::GetUnit(*me, *tar); //only buff targets that are in combat, unless the spell can only be cast while out of combat - if (!target) + if (!ally) continue; - if (spell->CanAutoCast(target)) + if (spell->CanAutoCast(ally)) { - targetSpellStore.push_back(std::make_pair(target, spell)); + targetSpellStore.push_back(std::make_pair(ally, spell)); spellUsed = true; break; } diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index 80949effa0c..23578a55816 100755 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -245,7 +245,7 @@ enum AreaFlags AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?) AREA_FLAG_OUTLAND = 0x00000400, // expansion zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled) - AREA_FLAG_NEED_FLY = 0x00001000, // Unknown + AREA_FLAG_NEED_FLY = 0x00001000, // Respawn alive at the graveyard without corpse AREA_FLAG_UNUSED1 = 0x00002000, // Unused in 3.3.5a AREA_FLAG_OUTLAND2 = 0x00004000, // expansion zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) AREA_FLAG_OUTDOOR_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area) @@ -260,7 +260,7 @@ enum AreaFlags AREA_FLAG_WINTERGRASP = 0x01000000, // Wintergrasp and it's subzones AREA_FLAG_INSIDE = 0x02000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors AREA_FLAG_OUTSIDE = 0x04000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors - AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Same as AREA_FLAG_WINTERGRASP except for The Sunken Ring and Western Bridge. + AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Can Hearth And Resurrect From Area AREA_FLAG_NO_FLY_ZONE = 0x20000000 // Marks zones where you cannot fly }; -- cgit v1.2.3 From d54d536f6fb996c2fb729c3f2ee5bf7c44945096 Mon Sep 17 00:00:00 2001 From: Nay Date: Thu, 24 May 2012 17:06:06 +0100 Subject: Core/Arena: Fix Hotter Streak achiev, thanks to Horn Ref #6590 Closes #6335 --- src/server/game/Battlegrounds/Battleground.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 9d5858e1ca4..c589edcee7a 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -850,9 +850,12 @@ void Battleground::EndBattleground(uint32 winner) if (team == winner) { // update achievement BEFORE personal rating update - ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID()); - if (member) - player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, 1); + if (ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID())) + { + uint32 rating = player->GetArenaPersonalRating(winner_arena_team->GetSlot()); + player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, + rating ? rating : 1); + } winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change); } -- cgit v1.2.3 From 2849f21d20d53461813c0a2f66a5401f71adcbc9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 15:33:08 -0400 Subject: Core/Spells: correctly calculate Replenishment aura. x * 20 / 10000 != x * .2 --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index d28ba9e1e19..38ad27b0ad2 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -662,10 +662,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster) case SPELL_AURA_PERIODIC_ENERGIZE: if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) { - // Replenishment (0.25% from max) + // Replenishment (0.2% from max) // Infinite Replenishment if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 25 / 10000; + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.2f; } // Innervate else if (m_spellInfo->Id == 29166) -- cgit v1.2.3 From aa341353954b77e55bbca420f1eb757433e2db9e Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 15:55:55 -0400 Subject: Core/Spells: fix issue with previous commit. i cant do math. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 38ad27b0ad2..b49cad74244 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -665,7 +665,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) // Replenishment (0.2% from max) // Infinite Replenishment if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.2f; + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; } // Innervate else if (m_spellInfo->Id == 29166) -- cgit v1.2.3 From b7573a1bc70eede743bfb7cdeb2f29b45758347a Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 16:58:09 -0400 Subject: Core/Auras: change from if to switch and fix calculation for inifinite replenishment. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index b49cad74244..0d0931e481b 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -660,19 +660,25 @@ int32 AuraEffect::CalculateAmount(Unit* caster) } break; case SPELL_AURA_PERIODIC_ENERGIZE: - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) + switch (m_spellInfo->Id) { - // Replenishment (0.2% from max) - // Infinite Replenishment + case 57669: // Replenishment (0.2% from max) if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; - } - // Innervate - else if (m_spellInfo->Id == 29166) + break; + case 61782: // Infinite Replenishment + if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; + break; + case 29166: // Innervate ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks()); - // Owlkin Frenzy - else if (m_spellInfo->Id == 48391) + break; + case 48391: // Owlkin Frenzy ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)); + break; + default: + break; + } break; case SPELL_AURA_PERIODIC_HEAL: if (!caster) -- cgit v1.2.3 From 51388c49345158fa39bcd3259544a6279477038d Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 17:10:12 -0400 Subject: Core/Auras: one more for good measure. thanks vincent-michael --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 0d0931e481b..5a29e6b325d 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -663,12 +663,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster) switch (m_spellInfo->Id) { case 57669: // Replenishment (0.2% from max) - if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; break; case 61782: // Infinite Replenishment - if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; break; case 29166: // Innervate ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks()); -- cgit v1.2.3 From d98f36194bc271c3bd3adc6532e84bd3645127c8 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 24 May 2012 17:34:51 -0400 Subject: Core/Spells: attempt to correct issue with triggered spells happening before the spell actually hits the target. reply with any bugs that this causes please! --- src/server/game/Spells/SpellEffects.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 07bea5f980c..9470d6edef9 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -849,15 +849,15 @@ void Spell::EffectDummy(SpellEffIndex effIndex) void Spell::EffectTriggerSpell(SpellEffIndex effIndex) { - if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET - && effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) + if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET + && effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; // todo: move those to spell scripts if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL - && effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) + && effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) { // special cases switch (triggered_spell_id) @@ -970,13 +970,13 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } SpellCastTargets targets; - if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) + if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) { if (!spellInfo->NeedsToBeTriggeredByCaster()) return; targets.SetUnitTarget(unitTarget); } - else //if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH) + else //if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT) { if (spellInfo->NeedsToBeTriggeredByCaster() && (m_spellInfo->Effects[effIndex].GetProvidedTargetMask() & TARGET_FLAG_UNIT_MASK)) return; -- cgit v1.2.3 From 929e7c0f0c8f008519b5d168af4fda165c62547e Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 25 May 2012 08:56:02 -0400 Subject: Core/Spells: revert previous commit to find a better solution. --- src/server/game/Spells/SpellEffects.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 9470d6edef9..07bea5f980c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -849,15 +849,15 @@ void Spell::EffectDummy(SpellEffIndex effIndex) void Spell::EffectTriggerSpell(SpellEffIndex effIndex) { - if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET - && effectHandleMode != SPELL_EFFECT_HANDLE_HIT) + if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET + && effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) return; uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; // todo: move those to spell scripts if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL - && effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) + && effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) { // special cases switch (triggered_spell_id) @@ -970,13 +970,13 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } SpellCastTargets targets; - if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) + if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) { if (!spellInfo->NeedsToBeTriggeredByCaster()) return; targets.SetUnitTarget(unitTarget); } - else //if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT) + else //if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH) { if (spellInfo->NeedsToBeTriggeredByCaster() && (m_spellInfo->Effects[effIndex].GetProvidedTargetMask() & TARGET_FLAG_UNIT_MASK)) return; -- cgit v1.2.3 From c40d86f05f5857b73015f09eb68b7dfdd7224a1f Mon Sep 17 00:00:00 2001 From: kaelima Date: Fri, 25 May 2012 16:44:34 +0200 Subject: Core/Protocol: Fix struct and make use of CMSG_UPDATE_PROJECTILE_POSITION. --- src/server/game/Handlers/SpellHandler.cpp | 11 ++++++++++- src/server/game/Server/Protocol/Opcodes.h | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index b2d52c85467..1affdf0aff7 100755 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -650,13 +650,22 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) uint8 castCount; float x, y, z; // Position of missile hit - recvPacket.readPackGUID(casterGuid); + recvPacket >> casterGuid; recvPacket >> spellId; recvPacket >> castCount; recvPacket >> x; recvPacket >> y; recvPacket >> z; + Unit* caster = ObjectAccessor::GetUnit(*_player, casterGuid); + Spell* spell = caster ? caster->FindCurrentSpellBySpellId(spellId) : NULL; + if (spell && spell->m_targets.HasDst()) + { + Position pos = *spell->m_targets.GetDstPos(); + pos.Relocate(x, y, z); + spell->m_targets.ModDst(pos); + } + WorldPacket data(SMSG_SET_PROJECTILE_POSITION, 21); data << uint64(casterGuid); data << uint8(castCount); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 3c77ced6741..d76a0ab8dd4 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -1248,8 +1248,8 @@ enum Opcodes SMSG_CALENDAR_CLEAR_PENDING_ACTION = 0x4BB, SMSG_EQUIPMENT_SET_LIST = 0x4BC, // equipment manager list? CMSG_EQUIPMENT_SET_SAVE = 0x4BD, - CMSG_UPDATE_PROJECTILE_POSITION = 0x4BE, // uint64 caster, uint32 spellId, uint8 castId, vector3 position - SMSG_SET_PROJECTILE_POSITION = 0x4BF, // uint64 caster, uint8 castId, vector3 position + CMSG_UPDATE_PROJECTILE_POSITION = 0x4BE, + SMSG_SET_PROJECTILE_POSITION = 0x4BF, SMSG_TALENTS_INFO = 0x4C0, CMSG_LEARN_PREVIEW_TALENTS = 0x4C1, CMSG_LEARN_PREVIEW_TALENTS_PET = 0x4C2, -- cgit v1.2.3 From 39a609ce5c3c926384273c7c1676d3f72a672d09 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Fri, 25 May 2012 23:53:33 -0230 Subject: Core/DB: Some updates for UBRS from sniff --- sql/updates/world/2012_05_25_03_world_template.sql | 8 ++ .../BlackrockSpire/blackrock_spire.h | 9 +- .../BlackrockSpire/boss_pyroguard_emberseer.cpp | 40 ++++++++- .../BlackrockSpire/instance_blackrock_spire.cpp | 100 ++++++++++++++++----- 4 files changed, 129 insertions(+), 28 deletions(-) create mode 100644 sql/updates/world/2012_05_25_03_world_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_25_03_world_template.sql b/sql/updates/world/2012_05_25_03_world_template.sql new file mode 100644 index 00000000000..6ef112f342f --- /dev/null +++ b/sql/updates/world/2012_05_25_03_world_template.sql @@ -0,0 +1,8 @@ +-- Fix unit flags for Blackhand Incarcerator +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|768 WHERE `entry`=10316; +-- Fix unit flags for Pyroguard Emberseer +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|33554688 WHERE `entry`=9816; +-- Remove hack event script +DELETE FROM `event_scripts` WHERE `id`=4884; +-- Remove script to Dragonspire Hall Runes "UBRS" +UPDATE `gameobject_template` SET `ScriptName`= '' WHERE `entry` BETWEEN 175194 AND 175200; diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h index beef71ea857..0af2af948d3 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h @@ -33,7 +33,8 @@ enum Data DATA_WARCHIEF_REND_BLACKHAND, DATA_GYTH, DATA_THE_BEAST, - DATA_GENERAL_DRAKKISATH + DATA_GENERAL_DRAKKISATH, + DATA_DRAGONSPIRE_ROOM, }; enum Npc { @@ -51,6 +52,9 @@ enum Npc NPC_GYTH = 10339, NPC_THE_BEAST = 10430, NPC_GENERAL_DRAKKISATH = 10363, + NPC_BLACKHAND_DREADWEAVER = 9817, + NPC_BLACKHAND_SUMMONER = 9818, + NPC_BLACKHAND_VETERAN = 9819, }; enum AdditionalData @@ -58,6 +62,9 @@ enum AdditionalData SPELL_SUMMON_ROOKERY_WHELP = 15745, MAX_ENCOUNTER = 14, MAX_DRAGONSPIRE_HALL_RUNES = 7, + EVENT_PYROGUARD_EMBERSEER = 4884, + AREATRIGGER_ENTER_UBRS = 2046, + AREATRIGGER_STADIUM = 2026, }; enum GameObjects diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 411b800cd03..f84fcefd40b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -20,11 +20,24 @@ #include "ScriptedCreature.h" #include "blackrock_spire.h" +enum Text +{ + EMOTE_ONE_STACK = 0, + EMOTE_TEN_STACK = 1, + EMOTE_FREE_OF_BONDS = 2, + YELL_FREE_OF_BONDS = 3, +}; + enum Spells { - SPELL_FIRENOVA = 23462, - SPELL_FLAMEBUFFET = 23341, - SPELL_PYROBLAST = 17274, + SPELL_ENCAGED_EMBERSEER = 15282, // Self on spawn + SPELL_FIRE_SHIELD_TRIGGER = 13377, // Self on spawn missing from 335 dbc + SPELL_FREEZE_ANIM = 16245, // Self on event start + SPELL_EMBERSEER_GROWING = 16048, // Self on event start + SPELL_EMBERSEER_FULL_STRENGTH = 16047, // Emberseer Full Strength + SPELL_FIRENOVA = 23462, // Combat + SPELL_FLAMEBUFFET = 23341, // Combat + SPELL_PYROBLAST = 17274, // Combat }; enum Events @@ -51,12 +64,19 @@ public: void Reset() { + if(instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) + OpenDoors(FALSE); + instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED); + // respawn any dead Blackhand Incarcerators + DoCast(me, SPELL_ENCAGED_EMBERSEER); + //DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); _Reset(); } void EnterCombat(Unit* /*who*/) { _EnterCombat(); + // activate all runes in room events.ScheduleEvent(EVENT_FIRENOVA, 6 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_FLAMEBUFFET, 3 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_PYROBLAST, 14 * IN_MILLISECONDS); @@ -64,12 +84,26 @@ public: void JustDied(Unit* /*killer*/) { + instance->SetBossState(DATA_PYROGAURD_EMBERSEER,DONE); + OpenDoors(TRUE); _JustDied(); } + void OpenDoors(bool Boss_Killed) + { + if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN))) + door1->SetGoState(GO_STATE_ACTIVE); + if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS))) + door2->SetGoState(GO_STATE_ACTIVE); + if (Boss_Killed) + if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_OUT))) + door3->SetGoState(GO_STATE_ACTIVE); + } + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) + return; events.Update(diff); diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp index b5b1b34a593..fdb73fe1196 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp @@ -49,6 +49,12 @@ public: uint64 Gyth; uint64 TheBeast; uint64 GeneralDrakkisath; + uint64 go_emberseerin; + uint64 go_doors; + uint64 go_emberseerout; + uint64 go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES]; + uint8 Runemaxprotectors[MAX_DRAGONSPIRE_HALL_RUNES]; + uint8 Runeprotectorsdead[MAX_DRAGONSPIRE_HALL_RUNES]; void Initialize() { @@ -67,6 +73,9 @@ public: Gyth = 0; TheBeast = 0; GeneralDrakkisath = 0; + go_emberseerin = 0; + go_doors = 0; + go_emberseerout = 0; } bool IsEncounterInProgress() const @@ -125,7 +134,11 @@ public: case NPC_GENERAL_DRAKKISATH: GeneralDrakkisath = creature->GetGUID(); break; - } + case NPC_BLACKHAND_DREADWEAVER: + case NPC_BLACKHAND_SUMMONER: + case NPC_BLACKHAND_VETERAN: + break; + } } void OnGameObjectCreate(GameObject* go) @@ -135,6 +148,36 @@ public: case GO_WHELP_SPAWNER: go->CastSpell(NULL, SPELL_SUMMON_ROOKERY_WHELP); break; + case GO_EMBERSEER_IN: + go_emberseerin = go->GetGUID(); + break; + case GO_DOORS: + go_doors = go->GetGUID(); + break; + case GO_EMBERSEER_OUT: + go_emberseerout = go->GetGUID(); + break; + case GO_ROOM_1_RUNE: + go_roomrunes[0] = go->GetGUID(); + break; + case GO_ROOM_2_RUNE: + go_roomrunes[1] = go->GetGUID(); + break; + case GO_ROOM_3_RUNE: + go_roomrunes[2] = go->GetGUID(); + break; + case GO_ROOM_4_RUNE: + go_roomrunes[3] = go->GetGUID(); + break; + case GO_ROOM_5_RUNE: + go_roomrunes[4] = go->GetGUID(); + break; + case GO_ROOM_6_RUNE: + go_roomrunes[5] = go->GetGUID(); + break; + case GO_ROOM_7_RUNE: + go_roomrunes[6] = go->GetGUID(); + break; } } @@ -167,6 +210,18 @@ public: return true; } + void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId) + { + switch (eventId) + { + case EVENT_PYROGUARD_EMBERSEER: + SetBossState(DATA_PYROGAURD_EMBERSEER,IN_PROGRESS); + break; + default: + break; + } + } + uint64 GetData64(uint32 type) { switch (type) @@ -199,6 +254,26 @@ public: return TheBeast; case DATA_GENERAL_DRAKKISATH: return GeneralDrakkisath; + case GO_EMBERSEER_IN: + return go_emberseerin; + case GO_DOORS: + return go_doors; + case GO_EMBERSEER_OUT: + return go_emberseerout; + case GO_ROOM_1_RUNE: + return go_roomrunes[0]; + case GO_ROOM_2_RUNE: + return go_roomrunes[1]; + case GO_ROOM_3_RUNE: + return go_roomrunes[2]; + case GO_ROOM_4_RUNE: + return go_roomrunes[3]; + case GO_ROOM_5_RUNE: + return go_roomrunes[4]; + case GO_ROOM_6_RUNE: + return go_roomrunes[5]; + case GO_ROOM_7_RUNE: + return go_roomrunes[6]; } return 0; @@ -247,30 +322,7 @@ public: }; -uint8 ActivatedRunes = 0; - -class go_dragonspire_hall_rune : public GameObjectScript -{ -public: - go_dragonspire_hall_rune() : GameObjectScript("go_dragonspire_hall_rune") { } - - void OnGameObjectStateChanged(GameObject* go, uint32 state) - { - if (state == GO_STATE_READY) - { - if (++ActivatedRunes == MAX_DRAGONSPIRE_HALL_RUNES) - { - if (GameObject* door1 = GetClosestGameObjectWithEntry(go, GO_EMBERSEER_IN, 150.0f)) - door1->SetGoState(GO_STATE_ACTIVE); - if (GameObject* door2 = GetClosestGameObjectWithEntry(go, GO_DOORS, 150.0f)) - door2->SetGoState(GO_STATE_ACTIVE); - } - } - } -}; - void AddSC_instance_blackrock_spire() { new instance_blackrock_spire(); - new go_dragonspire_hall_rune; } -- cgit v1.2.3 From 83f74263a200f8c63a24939c12db9f580252b358 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 26 May 2012 00:27:10 -0230 Subject: core: fix ubrs script --- .../scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index f84fcefd40b..97069fbef74 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -65,7 +65,7 @@ public: void Reset() { if(instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) - OpenDoors(FALSE); + OpenDoors(false); instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED); // respawn any dead Blackhand Incarcerators DoCast(me, SPELL_ENCAGED_EMBERSEER); -- cgit v1.2.3 From 74da8dc41004adcea6167a4587bded4efa025387 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sat, 26 May 2012 00:38:53 -0230 Subject: Core: another update cause case matters! --- .../EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 97069fbef74..0279f3e2834 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -76,7 +76,6 @@ public: void EnterCombat(Unit* /*who*/) { _EnterCombat(); - // activate all runes in room events.ScheduleEvent(EVENT_FIRENOVA, 6 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_FLAMEBUFFET, 3 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_PYROBLAST, 14 * IN_MILLISECONDS); @@ -85,7 +84,7 @@ public: void JustDied(Unit* /*killer*/) { instance->SetBossState(DATA_PYROGAURD_EMBERSEER,DONE); - OpenDoors(TRUE); + OpenDoors(true); _JustDied(); } -- cgit v1.2.3 From 624aab7d77c9f0a395611012d17e5c5114992f79 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sat, 26 May 2012 18:14:50 +0200 Subject: Core/Session: Fixed error "received unexpected opcode CMSG_CANCEL_TRADE" when a player is logging out. --- src/server/game/Handlers/TradeHandler.cpp | 2 +- src/server/game/Server/Protocol/Opcodes.h | 2 +- src/server/game/Server/WorldSession.cpp | 29 +++++++++++++---------------- src/server/game/Server/WorldSession.h | 1 + 4 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index dc26aaa42ca..9d7fa7da396 100755 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -531,7 +531,7 @@ void WorldSession::HandleBeginTradeOpcode(WorldPacket& /*recvPacket*/) void WorldSession::SendCancelTrade() { - if (m_playerRecentlyLogout) + if (PlayerRecentlyLoggedOut() || PlayerLogout()) return; SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index d76a0ab8dd4..65e7b3597ce 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -1354,7 +1354,7 @@ enum SessionStatus STATUS_AUTHED = 0, // Player authenticated (_player == NULL, m_playerRecentlyLogout = false or will be reset before handler call, m_GUID have garbage) STATUS_LOGGEDIN, // Player in game (_player != NULL, m_GUID == _player->GetGUID(), inWorld()) STATUS_TRANSFER, // Player transferring to another map (_player != NULL, m_GUID == _player->GetGUID(), !inWorld()) - STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, // _player!= NULL or _player == NULL && m_playerRecentlyLogout, m_GUID store last _player guid) + STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, // _player != NULL or _player == NULL && m_playerRecentlyLogout && m_playerLogout, m_GUID store last _player guid) STATUS_NEVER, // Opcode not accepted from client (deprecated or server side only) STATUS_UNHANDLED, // Opcode not handled yet }; diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 88248b7bc55..98bb0123896 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -290,7 +290,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) // lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer break; case STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT: - if (!_player && !m_playerRecentlyLogout) + if (!_player && !m_playerRecentlyLogout && !m_playerLogout) // There's a short delay between _player = null and m_playerRecentlyLogout = true during logout LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT", "the player has not logged in yet and not recently logout"); else @@ -404,7 +404,7 @@ void WorldSession::LogoutPlayer(bool Save) if (_player) { - if (uint64 lguid = GetPlayer()->GetLootGUID()) + if (uint64 lguid = _player->GetLootGUID()) DoLootRelease(lguid); ///- If the player just died before logging out, make him appear as a ghost @@ -518,21 +518,21 @@ void WorldSession::LogoutPlayer(bool Save) if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket) _player->RemoveFromGroup(); - ///- Send update to group and reset stored max enchanting level + //! Send update to group and reset stored max enchanting level if (_player->GetGroup()) { _player->GetGroup()->SendUpdate(); _player->GetGroup()->ResetMaxEnchantingLevel(); } - ///- Broadcast a logout message to the player's friends + //! Broadcast a logout message to the player's friends sSocialMgr->SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true); sSocialMgr->RemovePlayerSocial(_player->GetGUIDLow()); - // Call script hook before deletion - sScriptMgr->OnPlayerLogout(GetPlayer()); + //! Call script hook before deletion + sScriptMgr->OnPlayerLogout(_player); - ///- Remove the player from the world + //! Remove the player from the world // the player may not be in the world when logging out // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes @@ -540,22 +540,19 @@ void WorldSession::LogoutPlayer(bool Save) sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); - SetPlayer(NULL); // deleted in Remove call - ///- Send the 'logout complete' packet to the client + SetPlayer(NULL); //! Pointer already deleted during RemovePlayerFromMap + + //! Send the 'logout complete' packet to the client + //! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle WorldPacket data(SMSG_LOGOUT_COMPLETE, 0); SendPacket(&data); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); - ///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline - //No SQL injection as AccountId is uint32 - + //! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE); - stmt->setUInt32(0, GetAccountId()); - CharacterDatabase.Execute(stmt); - - sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); } m_playerLogout = false; diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 6d8a9e3ff38..00d5a8b5a86 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -221,6 +221,7 @@ class WorldSession bool PlayerLoading() const { return m_playerLoading; } bool PlayerLogout() const { return m_playerLogout; } bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; } + bool PlayerRecentlyLoggedOut() const { return m_playerRecentlyLogout; } void SizeError(WorldPacket const& packet, uint32 size) const; -- cgit v1.2.3 From ab77e597b179c864c6c2f992dfd1486245df0090 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 26 May 2012 23:00:54 +0200 Subject: Add function for SetObjectScale Author: NoFantasy Source: Mangos --- src/server/game/Entities/Corpse/Corpse.cpp | 2 +- src/server/game/Entities/Creature/Creature.cpp | 2 +- src/server/game/Entities/DynamicObject/DynamicObject.cpp | 2 +- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- src/server/game/Entities/Item/Container/Bag.cpp | 2 +- src/server/game/Entities/Item/Item.cpp | 4 ++-- src/server/game/Entities/Object/Object.h | 2 ++ src/server/game/Entities/Pet/Pet.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Entities/Transport/Transport.cpp | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/scripts/Commands/cs_modify.cpp | 2 +- src/server/scripts/Commands/cs_wp.cpp | 6 +++--- src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp | 2 +- src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp | 2 +- src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp | 2 +- .../Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp | 2 +- .../CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp | 2 +- .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 4 ++-- src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp | 8 ++++---- .../SerpentShrine/boss_fathomlord_karathress.cpp | 2 +- src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp | 2 +- src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp | 6 +++--- src/server/scripts/Outland/blades_edge_mountains.cpp | 2 +- 24 files changed, 34 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 5b7c40e5494..4613a3554db 100755 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -89,7 +89,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner) WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask()); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + SetObjectScale(1); SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID()); _gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 6506a113ae1..e8ec686daf5 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -333,7 +333,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data SetSpeed(MOVE_SWIM, 1.0f); // using 1.0 rate SetSpeed(MOVE_FLIGHT, 1.0f); // using 1.0 rate - SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->scale); + SetObjectScale(cinfo->scale); SetFloatValue(UNIT_FIELD_HOVERHEIGHT, cinfo->HoverHeight); diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index abeae0656ee..76d4cb6624b 100755 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -92,7 +92,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask()); SetEntry(spellId); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + SetObjectScale(1); SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID()); // The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 10136c5fbd7..2f6c15ff829 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -206,7 +206,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa UpdateRotationFields(rotation2, rotation3); // GAMEOBJECT_FACING, GAMEOBJECT_ROTATION, GAMEOBJECT_PARENTROTATION+2/3 - SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); + SetObjectScale(goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index 4eede93bd37..c4d4adeb6f2 100755 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -78,7 +78,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) Object::_Create(guidlow, 0, HIGHGUID_CONTAINER); SetEntry(itemid); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + SetObjectScale(1.0f); SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index f2b893896dc..af867dad76a 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -258,7 +258,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner) Object::_Create(guidlow, 0, HIGHGUID_ITEM); SetEntry(itemid); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + SetObjectScale(1.0f); SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); @@ -400,7 +400,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr // Set entry, MUST be before proto check SetEntry(entry); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + SetObjectScale(1.0f); ItemTemplate const* proto = GetTemplate(); if (!proto) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 3693f683b24..64b780bb6c3 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -137,6 +137,8 @@ class Object uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); } + void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); } + TypeID GetTypeId() const { return m_objectTypeId; } bool isType(uint16 mask) const { return (mask & m_objectType); } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index f3a736daceb..75deb8b4216 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -870,7 +870,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) else scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale); - SetFloatValue(OBJECT_FIELD_SCALE_X, scale); + SetObjectScale(scale); } // Resistance diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 41c95ac3d04..d5e2d8ba956 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3153,7 +3153,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // reset size before reapply auras - SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + SetObjectScale(1.0f); // save base values (bonuses already included in stored stats for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 9578605ac6f..4f5d5ade7ec 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -214,7 +214,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa m_goInfo = goinfo; - SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); + SetObjectScale(goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 5a29e6b325d..05114c8bc07 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2425,7 +2425,7 @@ void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode // What must be cloned? at least display and scale target->SetDisplayId(caster->GetDisplayId()); - //target->SetFloatValue(OBJECT_FIELD_SCALE_X, caster->GetFloatValue(OBJECT_FIELD_SCALE_X)); // we need retail info about how scaling is handled (aura maybe?) + //target->SetObjectScale(caster->GetFloatValue(OBJECT_FIELD_SCALE_X)); // we need retail info about how scaling is handled (aura maybe?) target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_MIRROR_IMAGE); } else diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index b6feccc10c6..3e04cb48af4 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -718,7 +718,7 @@ public: (ChatHandler(player)).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale); } - target->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale); + target->SetObjectScale(Scale); return true; } diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index f29dd8a5069..99ec263b8f9 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -949,7 +949,7 @@ public: if (target) { wpCreature->SetDisplayId(target->GetDisplayId()); - wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); + wpCreature->SetObjectScale(0.5f); wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point); } } @@ -1003,7 +1003,7 @@ public: if (target) { creature->SetDisplayId(target->GetDisplayId()); - creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); + creature->SetObjectScale(0.5f); } return true; @@ -1052,7 +1052,7 @@ public: if (target) { creature->SetDisplayId(target->GetDisplayId()); - creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); + creature->SetObjectScale(0.5f); } return true; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 783ac6baad1..2bba875ad1f 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -185,7 +185,7 @@ public: pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); pAttumen->SetTarget(pAttumen->getVictim()->GetGUID()); } - pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pAttumen->SetObjectScale(1); } } else Mount_Timer -= diff; } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 9a9f37d165f..a715dbfce9d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -332,7 +332,7 @@ class boss_akilzon : public CreatureScript CloudGUID = Cloud->GetGUID(); Cloud->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); Cloud->StopMoving(); - Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + Cloud->SetObjectScale(1.0f); Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index ce6b3b37ef8..3da74d16dc3 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -197,7 +197,7 @@ class boss_thekal : public CreatureScript if (Resurrect_Timer <= diff) { DoCast(me, SPELL_TIGER_FORM); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); + me->SetObjectScale(2.00f); me->SetStandState(UNIT_STAND_STATE_STAND); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFullHealth(); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 328d1ab1cd4..cf3c4274e48 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -354,7 +354,7 @@ public: //! HACK: Creature's can't have MOVEMENTFLAG_FLYING me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); me->setFaction(16); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + me->SetObjectScale(1.0f); DoCast(me, SPELL_FLAME_SPHERE_VISUAL); DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT); DoCast(me, SPELL_FLAME_SPHERE_PERIODIC); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index f329b940e1f..1fe7a7da569 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -615,7 +615,7 @@ class mob_frost_sphere : public CreatureScript me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); DoCast(SPELL_PERMAFROST_VISUAL); DoCast(SPELL_PERMAFROST); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f); + me->SetObjectScale(2.0f); break; } } 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 1d4961eb8b4..2643b8d60c7 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -439,7 +439,7 @@ class npc_fizzlebang_toc : public CreatureScript if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN)) { m_uiTriggerGUID = pTrigger->GetGUID(); - pTrigger->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f); + pTrigger->SetObjectScale(2.0f); pTrigger->SetDisplayId(22862); pTrigger->CastSpell(pTrigger, SPELL_WILFRED_PORTAL, false); } @@ -456,7 +456,7 @@ class npc_fizzlebang_toc : public CreatureScript if (Creature* pPortal = me->SummonCreature(NPC_WILFRED_PORTAL, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.71239f, TEMPSUMMON_MANUAL_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); - pPortal->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f); + pPortal->SetObjectScale(2.0f); pPortal->CastSpell(pPortal, SPELL_WILFRED_PORTAL, false); m_uiPortalGUID = pPortal->GetGUID(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 4d6bfc578ff..0a4fdec7222 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -299,7 +299,7 @@ public: for (itr = chained.begin(); itr != chained.end(); ++itr) { if (Player* charmed = Unit::GetPlayer(*me, (*itr).first)) - charmed->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + charmed->SetObjectScale((*itr).second); } chained.clear(); @@ -347,7 +347,7 @@ public: for (itr = chained.begin(); itr != chained.end(); ++itr) { if (Player* player = Unit::GetPlayer(*me, (*itr).first)) - player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + player->SetObjectScale((*itr).second); } chained.clear(); } @@ -512,7 +512,7 @@ public: DoCast(target, SPELL_CHAINS_OF_KELTHUZAD); float scale = target->GetFloatValue(OBJECT_FIELD_SCALE_X); chained.insert(std::make_pair(target->GetGUID(), scale)); - target->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); + target->SetObjectScale(scale * 2); events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm } } @@ -530,7 +530,7 @@ public: { if (!player->isCharmed()) { - player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + player->SetObjectScale((*itr).second); std::map::iterator next = itr; ++next; chained.erase(itr); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 206ba3d9455..3937b213e7e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -691,7 +691,7 @@ public: Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000); if (Cyclone) { - CAST_CRE(Cyclone)->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f); + CAST_CRE(Cyclone)->SetObjectScale(3.0f); Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Cyclone->setFaction(me->getFaction()); Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 77c07f5fe4d..25207073708 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -409,7 +409,7 @@ class boss_alar : public CreatureScript if (Summoned) { Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Summoned->SetFloatValue(OBJECT_FIELD_SCALE_X, Summoned->GetFloatValue(OBJECT_FIELD_SCALE_X)*2.5f); + Summoned->SetObjectScale(Summoned->GetFloatValue(OBJECT_FIELD_SCALE_X)*2.5f); Summoned->SetDisplayId(11686); Summoned->setFaction(me->getFaction()); Summoned->SetLevel(me->getLevel()); diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index c0203150789..d202fdd2f44 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -140,7 +140,7 @@ class boss_high_astromancer_solarian : public CreatureScript me->SetArmor(defaultarmor); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetVisible(true); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize); + me->SetObjectScale(defaultsize); me->SetDisplayId(MODEL_HUMAN); Summons.DespawnAll(); @@ -153,7 +153,7 @@ class boss_high_astromancer_solarian : public CreatureScript void JustDied(Unit* /*killer*/) { - me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize); + me->SetObjectScale(defaultsize); me->SetDisplayId(MODEL_HUMAN); DoScriptText(SAY_DEATH, me); if (instance) @@ -397,7 +397,7 @@ class boss_high_astromancer_solarian : public CreatureScript DoScriptText(SAY_VOIDB, me); me->SetArmor(WV_ARMOR); me->SetDisplayId(MODEL_VOIDWALKER); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize*2.5f); + me->SetObjectScale(defaultsize*2.5f); } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index cf0955ed89c..4ec1d04b6ad 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -774,7 +774,7 @@ class npc_simon_bunny : public CreatureScript colorSequence.clear(); playableSequence.clear(); playerSequence.clear(); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, large ? 2.0f : 1.0f); + me->SetObjectScale(large ? 2.0f : 1.0f); std::list ClusterList; Trinity::AllWorldObjectsInRange objects(me, searchDistance); -- cgit v1.2.3 From f1e6601032ba4077e1d1c6070c4cb20812289f7a Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 27 May 2012 19:57:31 +0200 Subject: Core/Protocol: - Allow CMSG_LOGOUT_CANCEL to be recieved during serverside logout process (ignore it however, it's too late to abort) - Fix STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes because of m_playerRecentlyLogout being set false too early in some cases --- src/server/game/Handlers/MiscHandler.cpp | 4 ++++ src/server/game/Server/Protocol/Opcodes.cpp | 4 ++-- src/server/game/Server/WorldSession.cpp | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index a280bc30b7c..8484ac52d27 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -430,6 +430,10 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_CANCEL Message"); + // Player have already logged out serverside, too late to cancel + if (!GetPlayer()) + return; + LogoutRequest(0); WorldPacket data(SMSG_LOGOUT_CANCEL_ACK, 0); diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index bd9c75c251d..8fb8ea0298b 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -104,7 +104,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x04B*/ { "CMSG_LOGOUT_REQUEST", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutRequestOpcode }, /*0x04C*/ { "SMSG_LOGOUT_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x04D*/ { "SMSG_LOGOUT_COMPLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x04E*/ { "CMSG_LOGOUT_CANCEL", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutCancelOpcode }, + /*0x04E*/ { "CMSG_LOGOUT_CANCEL", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutCancelOpcode }, /*0x04F*/ { "SMSG_LOGOUT_CANCEL_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x050*/ { "CMSG_NAME_QUERY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleNameQueryOpcode }, /*0x051*/ { "SMSG_NAME_QUERY_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, @@ -310,7 +310,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x119*/ { "CMSG_IGNORE_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleIgnoreTradeOpcode }, /*0x11A*/ { "CMSG_ACCEPT_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAcceptTradeOpcode }, /*0x11B*/ { "CMSG_UNACCEPT_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleUnacceptTradeOpcode }, - /*0x11C*/ { "CMSG_CANCEL_TRADE", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelTradeOpcode}, + /*0x11C*/ { "CMSG_CANCEL_TRADE", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelTradeOpcode }, /*0x11D*/ { "CMSG_SET_TRADE_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetTradeItemOpcode }, /*0x11E*/ { "CMSG_CLEAR_TRADE_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleClearTradeItemOpcode }, /*0x11F*/ { "CMSG_SET_TRADE_GOLD", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetTradeGoldOpcode }, diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 98bb0123896..7756e686388 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -323,9 +323,9 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) break; } - // single from authed time opcodes send in to after logout time - // and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes. - if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL) + // some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes + // however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process. + if (packet->GetOpcode() == CMSG_CHAR_ENUM) m_playerRecentlyLogout = false; sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet)); -- cgit v1.2.3 From b549cd2543c57908ee870be3a4085fdf579021b4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 27 May 2012 22:26:49 +0200 Subject: Scripts/Icecrown Citadel: Remove encounter specific auras when Blood-Queen Lana'thel fight ends (prevents exploits with Essence of the Blood Queen Closes #6610 --- .../IcecrownCitadel/boss_blood_queen_lana_thel.cpp | 27 ++++++++++++++-------- .../IcecrownCitadel/boss_deathbringer_saurfang.cpp | 8 ++----- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index f086e8dc9cf..ee966256e2b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -149,7 +149,7 @@ class boss_blood_queen_lana_thel : public CreatureScript events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 30500, EVENT_GROUP_NORMAL); events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, urand(20000, 25000), EVENT_GROUP_NORMAL); events.ScheduleEvent(EVENT_AIR_PHASE, 124000 + uint32(Is25ManRaid() ? 3000 : 0)); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); + CleanAuras(); me->SetSpeed(MOVE_FLIGHT, 0.642857f, true); _offtank = NULL; _vampires.clear(); @@ -170,6 +170,7 @@ class boss_blood_queen_lana_thel : public CreatureScript DoZoneInCombat(); Talk(SAY_AGGRO); instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, IN_PROGRESS); + CleanAuras(); DoCast(me, SPELL_SHROUD_OF_SORROW, true); DoCast(me, SPELL_FRENZIED_BLOODTHIRST_VISUAL, true); @@ -180,15 +181,7 @@ class boss_blood_queen_lana_thel : public CreatureScript { _JustDied(); Talk(SAY_DEATH); - instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN); - instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR); - instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); - instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + CleanAuras(); // Blah, credit the quest if (_creditBloodQuickening) { @@ -207,6 +200,19 @@ class boss_blood_queen_lana_thel : public CreatureScript } } + void CleanAuras() + { + instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN); + instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR); + instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); + instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + } + void DoAction(int32 const action) { if (action != ACTION_KILL_MINCHAR) @@ -227,6 +233,7 @@ class boss_blood_queen_lana_thel : public CreatureScript void EnterEvadeMode() { _EnterEvadeMode(); + CleanAuras(); if (_killMinchar) { _killMinchar = false; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index afc7c503bee..494be259baa 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -631,9 +631,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_HORDE_4, 24000); // cast _events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 30000); // move me->SetDisableGravity(false); - me->SendMovementFlagUpdate(); - me->Relocate(me->GetPositionX(), me->GetPositionY(), 539.2917f); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 0.0f); + me->GetMotionMaster()->MoveFall(); for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) (*itr)->AI()->DoAction(ACTION_DESPAWN); break; @@ -838,9 +836,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY); Talk(SAY_OUTRO_ALLIANCE_1); me->SetDisableGravity(false); - me->SendMovementFlagUpdate(); - me->Relocate(me->GetPositionX(), me->GetPositionY(), 539.2917f); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 0.0f); + me->GetMotionMaster()->MoveFall(); for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) (*itr)->AI()->DoAction(ACTION_DESPAWN); -- cgit v1.2.3 From ca07f30d0359bf5a6eecba8b9cc68702eca4071b Mon Sep 17 00:00:00 2001 From: joschiwald Date: Mon, 28 May 2012 04:07:51 +0200 Subject: Core/Spells: convert some spell effects to SpellScripts --- .../world/2012_05_28_00_world_spell_ranks.sql | 5 + .../2012_05_28_01_world_spell_script_names.sql | 38 ++++++ .../2012_05_28_02_world_spelldifficulty_dbc.sql | 5 + .../world/2012_05_28_03_world_conditions.sql | 7 ++ src/server/game/Entities/Unit/Unit.cpp | 81 ------------ src/server/game/Spells/Auras/SpellAuraEffects.cpp | 135 +------------------- src/server/game/Spells/Spell.cpp | 104 ++++----------- src/server/game/Spells/SpellEffects.cpp | 31 ----- src/server/game/Spells/SpellMgr.cpp | 19 ++- .../ShadowfangKeep/shadowfang_keep.cpp | 46 ++++++- .../EasternKingdoms/ZulAman/boss_hexlord.cpp | 140 +++++++++++++-------- .../TrialOfTheCrusader/boss_faction_champions.cpp | 62 +++++++-- .../Northrend/Naxxramas/boss_four_horsemen.cpp | 66 +++++++++- .../scripts/Northrend/Naxxramas/boss_gothik.cpp | 37 +++++- .../scripts/Northrend/Naxxramas/boss_kelthuzad.cpp | 42 +++++++ .../Ulduar/HallsOfLightning/boss_loken.cpp | 80 ++++++------ .../Northrend/Ulduar/Ulduar/boss_general_vezax.cpp | 42 +++++++ src/server/scripts/Spells/spell_dk.cpp | 16 ++- src/server/scripts/Spells/spell_druid.cpp | 125 +++++++++++++++++- src/server/scripts/Spells/spell_generic.cpp | 120 ++++++++++++++++++ src/server/scripts/Spells/spell_hunter.cpp | 29 +++++ src/server/scripts/Spells/spell_mage.cpp | 47 ++++++- src/server/scripts/Spells/spell_paladin.cpp | 92 ++++++++++++-- src/server/scripts/Spells/spell_priest.cpp | 46 +++++++ src/server/scripts/Spells/spell_shaman.cpp | 51 ++++++++ src/server/scripts/Spells/spell_warlock.cpp | 104 +++++++++++++++ 26 files changed, 1107 insertions(+), 463 deletions(-) create mode 100644 sql/updates/world/2012_05_28_00_world_spell_ranks.sql create mode 100644 sql/updates/world/2012_05_28_01_world_spell_script_names.sql create mode 100644 sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql create mode 100644 sql/updates/world/2012_05_28_03_world_conditions.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_28_00_world_spell_ranks.sql b/sql/updates/world/2012_05_28_00_world_spell_ranks.sql new file mode 100644 index 00000000000..f6641f2f095 --- /dev/null +++ b/sql/updates/world/2012_05_28_00_world_spell_ranks.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_ranks` WHERE `first_spell_id`=64694; +INSERT INTO `spell_ranks` (`first_spell_id`,`spell_id`,`rank`) VALUES +(64694,64694,1), +(64694,65263,2), +(64694,65264,3); diff --git a/sql/updates/world/2012_05_28_01_world_spell_script_names.sql b/sql/updates/world/2012_05_28_01_world_spell_script_names.sql new file mode 100644 index 00000000000..78054aa1555 --- /dev/null +++ b/sql/updates/world/2012_05_28_01_world_spell_script_names.sql @@ -0,0 +1,38 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (-633,781,-746,-8050,-34914,-44457,-48181,-30108,34438,34439,35183,43522,65812,68154,68155,68156,-33763,43421,52551,53608,57762,59990,66093,67957,67958,67959,7057,28832,28833,28834,28835,27831,55638,52942,59837,63322); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(-633, 'spell_pal_lay_on_hands'), +(781, 'spell_hun_disengage'), +(-746, 'spell_gen_bandage'), +(-8050, 'spell_sha_flame_shock'), +(-34914,'spell_pri_vampiric_touch'), +(-44457,'spell_mage_living_bomb'), +(-48181,'spell_warl_haunt'), +(-30108,'spell_warl_unstable_affliction'), +(34438, 'spell_warl_unstable_affliction'), -- using class spell script for generic spell because it uses class spell effect +(34439, 'spell_warl_unstable_affliction'), +(35183, 'spell_warl_unstable_affliction'), +(43522, 'spell_hexlord_unstable_affliction'), +(65812, 'spell_faction_champion_warl_unstable_affliction'), +(68154, 'spell_faction_champion_warl_unstable_affliction'), +(68155, 'spell_faction_champion_warl_unstable_affliction'), +(68156, 'spell_faction_champion_warl_unstable_affliction'), +(-33763,'spell_dru_lifebloom'), +(43421, 'spell_hexlord_lifebloom'), +(52551, 'spell_tur_ragepaw_lifebloom'), +(53608, 'spell_cenarion_scout_lifebloom'), +(57762, 'spell_twisted_visage_lifebloom'), +(59990, 'spell_twisted_visage_lifebloom'), +(66093, 'spell_faction_champion_dru_lifebloom'), +(67957, 'spell_faction_champion_dru_lifebloom'), +(67958, 'spell_faction_champion_dru_lifebloom'), +(67959, 'spell_faction_champion_dru_lifebloom'), +(7057, 'spell_shadowfang_keep_haunting_spirits'), +(28832, 'spell_four_horsemen_mark'), +(28833, 'spell_four_horsemen_mark'), +(28834, 'spell_four_horsemen_mark'), +(28835, 'spell_four_horsemen_mark'), +(27831, 'spell_gothic_shadow_bolt_volley'), +(55638, 'spell_gothic_shadow_bolt_volley'), +(52942, 'spell_loken_pulsing_shockwave'), +(59837, 'spell_loken_pulsing_shockwave'), +(63322, 'spell_general_vezax_saronite_vapors'); diff --git a/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql b/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql new file mode 100644 index 00000000000..93749c9c5cd --- /dev/null +++ b/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql @@ -0,0 +1,5 @@ +SET @DIFF := xxxx; -- set by TDB team +DELETE FROM `spelldifficulty_dbc` WHERE `id` IN (@DIFF+0,@DIFF+1); +INSERT INTO `spelldifficulty_dbc` (`id`,`spelld0`,`spellid1`,`spelld2`,`spellid3`) VALUES +(@DIFF+0,57762,57763,0,0), +(@DIFF+1,59990,61489,0,0); diff --git a/sql/updates/world/2012_05_28_03_world_conditions.sql b/sql/updates/world/2012_05_28_03_world_conditions.sql new file mode 100644 index 00000000000..8369352481b --- /dev/null +++ b/sql/updates/world/2012_05_28_03_world_conditions.sql @@ -0,0 +1,7 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry` IN (19938,30877); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(17,0,19938,0,0,1,1,17743,0,0,0,0,'','Awaken Peon'), +(17,0,30877,0,0,31,1,3,17326,0,0,0,'','Tag Murloc'); + +-- Lifebinder's Gift +UPDATE `conditions` SET `SourceGroup`=7 WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (62584,64185); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a04e2ac0e48..8e2738783dc 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3629,87 +3629,6 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId // Call AfterDispel hook on AuraScript aura->CallScriptAfterDispel(&dispelInfo); - switch (aura->GetSpellInfo()->SpellFamilyName) - { - case SPELLFAMILY_WARLOCK: - { - // Unstable Affliction (crash if before removeaura?) - if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x0100) - { - Unit* caster = aura->GetCaster(); - if (!caster) - break; - if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_0)) - { - int32 damage = aurEff->GetAmount() * 9; - // backfire damage and silence - caster->CastCustomSpell(dispeller, 31117, &damage, NULL, NULL, true, NULL, aurEff); - } - } - break; - } - case SPELLFAMILY_DRUID: - { - // Lifebloom - if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x10) - { - if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_1)) - { - // final heal - int32 healAmount = aurEff->GetAmount(); - if (Unit* caster = aura->GetCaster()) - { - healAmount = caster->SpellHealingBonusDone(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); - healAmount = this->SpellHealingBonusTaken(aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); - } - CastCustomSpell(this, 33778, &healAmount, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); - - // mana - if (Unit* caster = aura->GetCaster()) - { - int32 mana = CalculatePctU(caster->GetCreateMana(), aura->GetSpellInfo()->ManaCostPercentage) * chargesRemoved / 2; - caster->CastCustomSpell(caster, 64372, &mana, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); - } - } - } - break; - } - case SPELLFAMILY_SHAMAN: - { - // Flame Shock - if (aura->GetSpellInfo()->SpellFamilyFlags[0] & 0x10000000) - { - if (Unit* caster = aura->GetCaster()) - { - uint32 triggeredSpellId = 0; - // Lava Flows - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 3087, 0)) - { - switch (aurEff->GetId()) - { - case 51482: // Rank 3 - triggeredSpellId = 65264; - break; - case 51481: // Rank 2 - triggeredSpellId = 65263; - break; - case 51480: // Rank 1 - triggeredSpellId = 64694; - break; - default: - sLog->outError("Unit::RemoveAurasDueToSpellByDispel: Unknown rank of Lava Flows (%d) found", aurEff->GetId()); - } - } - - if (triggeredSpellId) - caster->CastSpell(caster, triggeredSpellId, true); - } - } - break; - } - default: - break; - } return; } else diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index e3d220d744f..c7eb4e83be8 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -777,33 +777,18 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load) m_amplitude = 1 * IN_MILLISECONDS; case SPELL_AURA_PERIODIC_DAMAGE: case SPELL_AURA_PERIODIC_HEAL: - case SPELL_AURA_PERIODIC_ENERGIZE: case SPELL_AURA_OBS_MOD_HEALTH: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL: + case SPELL_AURA_PERIODIC_ENERGIZE: case SPELL_AURA_PERIODIC_LEECH: case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: case SPELL_AURA_PERIODIC_MANA_LEECH: case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: case SPELL_AURA_POWER_BURN: - m_isPeriodic = true; - break; - case SPELL_AURA_PERIODIC_TRIGGER_SPELL: - if (GetId() == 51912) - m_amplitude = 3000; - m_isPeriodic = true; - break; - case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: case SPELL_AURA_PERIODIC_DUMMY: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: m_isPeriodic = true; break; - case SPELL_AURA_DUMMY: - // Haunting Spirits - perdiodic trigger demon - if (GetId() == 7057) - { - m_isPeriodic = true; - m_amplitude = irand (0, 60) + 30; - m_amplitude *= IN_MILLISECONDS; - } - break; default: break; } @@ -1099,14 +1084,6 @@ void AuraEffect::UpdatePeriodic(Unit* caster) { switch (GetAuraType()) { - case SPELL_AURA_DUMMY: - // Haunting Spirits - if (GetId() == 7057) - { - m_amplitude = irand (0, 60) + 30; - m_amplitude *= IN_MILLISECONDS; - } - break; case SPELL_AURA_PERIODIC_DUMMY: switch (GetSpellInfo()->SpellFamilyName) { @@ -1308,11 +1285,6 @@ void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) case SPELL_AURA_POWER_BURN: HandlePeriodicPowerBurnAuraTick(target, caster); break; - case SPELL_AURA_DUMMY: - // Haunting Spirits - if (GetId() == 7057) - target->CastSpell((Unit*)NULL, GetAmount(), true); - break; default: break; } @@ -4804,38 +4776,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (Unit* spellTarget = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget())) target->CastSpell(spellTarget, 51699, true); break; - case 28832: // Mark of Korth'azz - case 28833: // Mark of Blaumeux - case 28834: // Mark of Rivendare - case 28835: // Mark of Zeliek - if (caster) // actually we can also use cast(this, originalcasterguid) - { - int32 damage; - switch (GetBase()->GetStackAmount()) - { - case 1: damage = 0; break; - case 2: damage = 500; break; - case 3: damage = 1000; break; - case 4: damage = 1500; break; - case 5: damage = 4000; break; - case 6: damage = 12000; break; - default:damage = 20000 + 1000 * (GetBase()->GetStackAmount() - 7); break; - } - if (damage) - caster->CastCustomSpell(28836, SPELLVALUE_BASE_POINT0, damage, target); - } - break; - case 63322: // Saronite Vapors - { - if (caster) - { - int32 mana = int32(GetAmount() * pow(2.0f, GetBase()->GetStackAmount())); // mana restore - bp * 2^stackamount - int32 damage = mana * 2; // damage - caster->CastCustomSpell(target, 63337, &mana, NULL, NULL, true); - caster->CastCustomSpell(target, 63338, &damage, NULL, NULL, true); - } - break; - } case 71563: if (Aura* newAura = target->AddAura(71564, target)) newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount); @@ -4929,57 +4869,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool break; } break; - case SPELLFAMILY_MAGE: - // Living Bomb - if (m_spellInfo->SpellFamilyFlags[1] & 0x20000) - { - AuraRemoveMode removeMode = aurApp->GetRemoveMode(); - if (caster && (removeMode == AURA_REMOVE_BY_ENEMY_SPELL || removeMode == AURA_REMOVE_BY_EXPIRE)) - caster->CastSpell(target, GetAmount(), true); - } - break; - case SPELLFAMILY_PRIEST: - // Vampiric Touch - if (m_spellInfo->SpellFamilyFlags[1] & 0x0400 && aurApp->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && GetEffIndex() == 0) - if (AuraEffect const* aurEff = GetBase()->GetEffect(1)) - { - int32 damage = aurEff->GetAmount() * 8; - // backfire damage - target->CastCustomSpell(target, 64085, &damage, NULL, NULL, true, NULL, NULL, GetCasterGUID()); - } - break; - case SPELLFAMILY_WARLOCK: - // Haunt - if (m_spellInfo->SpellFamilyFlags[1] & 0x40000) - if (caster) - target->CastCustomSpell(caster, 48210, &m_amount, 0, 0, true, NULL, this, GetCasterGUID()); - break; - case SPELLFAMILY_DRUID: - // Lifebloom - if (GetSpellInfo()->SpellFamilyFlags[1] & 0x10) - { - // Final heal only on duration end - if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) - return; - - // final heal - int32 stack = GetBase()->GetStackAmount(); - int32 heal = m_amount; - if (caster) - { - heal = caster->SpellHealingBonusDone(target, GetSpellInfo(), heal, HEAL, stack); - heal = target->SpellHealingBonusTaken(GetSpellInfo(), heal, HEAL, stack); - } - target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID()); - - // restore mana - if (caster) - { - int32 returnmana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; - caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID()); - } - } - break; case SPELLFAMILY_DEATHKNIGHT: // Summon Gargoyle (Dismiss Gargoyle at remove) if (GetId() == 61777) @@ -5087,16 +4976,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool } break; } - case 57723: // Exhaustion - case 57724: // Sated - { - switch (GetId()) - { - case 57723: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 32182, apply); break; // Heroism - case 57724: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 2825, apply); break; // Bloodlust - } - break; - } case 57819: // Argent Champion case 57820: // Ebon Champion case 57821: // Champion of the Kirin Tor @@ -5884,14 +5763,6 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) if (caster) caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, NULL, this); return; - // Detonate Mana - case 27819: - if (int32 mana = (int32)(target->GetMaxPower(POWER_MANA) / 10)) - { - mana = target->ModifyPower(POWER_MANA, -mana); - target->CastCustomSpell(27820, SPELLVALUE_BASE_POINT0, -mana*10, target, true, NULL, this); - } - return; // Inoculate Nestlewood Owlkin case 29528: if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 28b089f91cd..7c4cc47b886 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1288,18 +1288,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge maxSize = m_caster->HasAura(62970) ? 6 : 5; // Glyph of Wild Growth power = POWER_HEALTH; } - else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall - { - // Remove targets not in LoS or in stealth - for (std::list::iterator itr = unitTargets.begin(); itr != unitTargets.end();) - { - if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster)) - itr = unitTargets.erase(itr); - else - ++itr; - } - break; - } else break; @@ -1340,6 +1328,11 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge } } + // todo: move to scripts, but we must call it before resize list by MaxAffectedTargets + // Intimidating Shout + if (m_spellInfo->Id == 5246 && effIndex != EFFECT_0) + unitTargets.remove(m_targets.GetUnitTarget()); + // Other special target selection goes here if (uint32 maxTargets = m_spellValue->MaxAffectedTargets) { @@ -1348,8 +1341,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge if ((*j)->IsAffectedOnSpell(m_spellInfo)) maxTargets += (*j)->GetAmount(); - if (m_spellInfo->Id == 5246) //Intimidating Shout - unitTargets.remove(m_targets.GetUnitTarget()); Trinity::Containers::RandomResizeList(unitTargets, maxTargets); } @@ -2477,12 +2468,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) caster->DealSpellDamage(&damageInfo, true); - // Haunt - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1)) - { - AuraEffect* aurEff = m_spellAura->GetEffect(1); - aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage)); - } m_damage = damageInfo.damage; } // Passive spell hits/misses or active spells only misses (only triggers) @@ -4825,19 +4810,9 @@ SpellCastResult Spell::CheckCast(bool strict) if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) return SPELL_FAILED_LINE_OF_SIGHT; } - else - { - if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster - { - // Lay on Hands - cannot be self-cast on paladin with Forbearance or after using Avenging Wrath - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && m_spellInfo->SpellFamilyFlags[0] & 0x0008000) - if (target->HasAura(61988)) // Immunity shield marker - return SPELL_FAILED_TARGET_AURASTATE; - } - } } - //Check for line of sight for spells with dest + // Check for line of sight for spells with dest if (m_targets.HasDst()) { float x, y, z; @@ -4936,7 +4911,8 @@ SpellCastResult Spell::CheckCast(bool strict) bool hasDispellableAura = false; bool hasNonDispelEffect = false; - for (int i = 0; i < MAX_SPELL_EFFECTS; i++) + uint32 dispelMask = 0; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL) { if (m_spellInfo->Effects[i].IsTargetingArea() || m_spellInfo->AttributesEx & SPELL_ATTR1_MELEE_COMBAT_START) @@ -4944,17 +4920,8 @@ SpellCastResult Spell::CheckCast(bool strict) hasDispellableAura = true; break; } - if (Unit* target = m_targets.GetUnitTarget()) - { - DispelChargesList dispelList; - uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue)); - target->GetDispellableAuraList(m_caster, dispelMask, dispelList); - if (!dispelList.empty()) - { - hasDispellableAura = true; - break; - } - } + + dispelMask |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue)); } else if (m_spellInfo->Effects[i].IsEffect()) { @@ -4962,10 +4929,18 @@ SpellCastResult Spell::CheckCast(bool strict) break; } - if (!hasNonDispelEffect && !hasDispellableAura && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL) && !IsTriggered()) - return SPELL_FAILED_NOTHING_TO_DISPEL; + if (!hasNonDispelEffect && !hasDispellableAura && dispelMask && !IsTriggered()) + { + if (Unit* target = m_targets.GetUnitTarget()) + { + DispelChargesList dispelList; + target->GetDispellableAuraList(m_caster, dispelMask, dispelList); + if (dispelList.empty()) + return SPELL_FAILED_NOTHING_TO_DISPEL; + } + } - for (int i = 0; i < MAX_SPELL_EFFECTS; i++) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { // for effects of spells that have only one target switch (m_spellInfo->Effects[i].Effect) @@ -4977,25 +4952,6 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; } - else if (m_spellInfo->SpellIconID == 156) // Holy Shock - { - // spell different for friends and enemies - // hurt version required facing - if (m_targets.GetUnitTarget() && !m_caster->IsFriendlyTo(m_targets.GetUnitTarget()) && !m_caster->HasInArc(static_cast(M_PI), m_targets.GetUnitTarget())) - return SPELL_FAILED_UNIT_NOT_INFRONT; - } - else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] == 0x2000) // Death Coil (DeathKnight) - { - Unit* target = m_targets.GetUnitTarget(); - if (!target || (target->IsFriendlyTo(m_caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)) - return SPELL_FAILED_BAD_TARGETS; - } - else if (m_spellInfo->Id == 19938) // Awaken Peon - { - Unit* unit = m_targets.GetUnitTarget(); - if (!unit || !unit->HasAura(17743)) - return SPELL_FAILED_BAD_TARGETS; - } else if (m_spellInfo->Id == 52264) // Deliver Stolen Horse { if (!m_caster->FindNearestCreature(28653, 5)) @@ -5329,10 +5285,6 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_LEAP_BACK: { - // Spell 781 (Disengage) requires player to be in combat - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Id == 781 && !m_caster->isInCombat()) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - if (m_caster->HasUnitState(UNIT_STATE_ROOT)) { if (m_caster->GetTypeId() == TYPEID_PLAYER) @@ -5363,14 +5315,6 @@ SpellCastResult Spell::CheckCast(bool strict) //custom check switch (m_spellInfo->Id) { - // Tag Murloc - case 30877: - { - Unit* target = m_targets.GetUnitTarget(); - if (!target || target->GetEntry() != 17326) - return SPELL_FAILED_BAD_TARGETS; - break; - } case 61336: if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->ToPlayer()->IsInFeralForm()) return SPELL_FAILED_ONLY_SHAPESHIFT; @@ -7173,12 +7117,6 @@ void Spell::PrepareTriggersExecutedOnHit() // todo: move this to scripts switch (m_spellInfo->SpellFamilyName) { - case SPELLFAMILY_GENERIC: - { - if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages - m_preCastSpell = 11196; // Recently Bandaged - break; - } case SPELLFAMILY_MAGE: { // Permafrost diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 06493dd070a..4df34e1a62d 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -368,28 +368,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * ((radius - distance)/radius)); break; } - // Loken Pulsing Shockwave - case 59837: - case 52942: - { - // don't damage self and only players - if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster); - if (!radius) - return; - float distance = m_caster->GetDistance2d(unitTarget); - damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * distance); - break; - } - // TODO: add spell specific target requirement hook for spells - // Shadowbolts only affects targets with Shadow Mark (Gothik) - case 27831: - case 55638: - if (!unitTarget->HasAura(27825)) - return; - break; // Gargoyle Strike case 51963: { @@ -3569,15 +3547,6 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) return; int32 addhealth; - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands - { - if (m_caster->GetGUID() == unitTarget->GetGUID()) - { - m_caster->CastSpell(m_caster, 25771, true); // Forbearance - m_caster->CastSpell(m_caster, 61988, true); // Immune shield marker (serverside) - m_caster->CastSpell(m_caster, 61987, true); // Avenging Wrath marker - } - } // damage == 0 - heal for caster max health if (damage == 0) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 06e4978eb58..87373321a36 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2960,8 +2960,10 @@ void SpellMgr::LoadDbcDataCorrections() switch (spellInfo->Id) { - case 40244: case 40245: // Simon Game Visual - case 40246: case 40247: // Simon Game Visual + case 40244: // Simon Game Visual + case 40245: // Simon Game Visual + case 40246: // Simon Game Visual + case 40247: // Simon Game Visual case 42835: // Spout, remove damage effect, only anim is needed spellInfo->Effect[0] = 0; break; @@ -3125,6 +3127,9 @@ void SpellMgr::LoadDbcDataCorrections() case 51852: // The Eye of Acherus (no spawn in phase 2 in db) spellInfo->EffectMiscValue[0] |= 1; break; + case 51912: // Crafty's Ultra-Advanced Proto-Typical Shortening Blaster + spellInfo->EffectAmplitude[0] = 3000; + break; case 29809: // Desecration Arm - 36 instead of 37 - typo? :/ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_7_YARDS; break; @@ -3293,11 +3298,6 @@ void SpellMgr::LoadDbcDataCorrections() // that will be clear if we get more spells with problem like this spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; break; - case 62584: // Lifebinder's Gift - case 64185: // Lifebinder's Gift - spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY; - spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY; - break; case 62301: // Cosmic Smash (Algalon the Observer) spellInfo->MaxAffectedTargets = 1; break; @@ -3539,11 +3539,6 @@ void SpellMgr::LoadDbcDataCorrections() switch (spellInfo->SpellFamilyName) { - case SPELLFAMILY_DRUID: - // Starfall Target Selection - if (spellInfo->SpellFamilyFlags[2] & 0x100) - spellInfo->MaxAffectedTargets = 2; - break; case SPELLFAMILY_PALADIN: // Seals of the Pure should affect Seal of Righteousness if (spellInfo->SpellIconID == 25 && spellInfo->Attributes & SPELL_ATTR0_PASSIVE) diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 63e753a18ba..676cd7be4f0 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -27,7 +27,11 @@ EndScriptData */ npc_shadowfang_prisoner EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "ScriptedEscortAI.h" #include "shadowfang_keep.h" @@ -193,8 +197,48 @@ public: }; +class spell_shadowfang_keep_haunting_spirits : public SpellScriptLoader +{ + public: + spell_shadowfang_keep_haunting_spirits() : SpellScriptLoader("spell_shadowfang_keep_haunting_spirits") { } + + class spell_shadowfang_keep_haunting_spirits_AuraScript : public AuraScript + { + PrepareAuraScript(spell_shadowfang_keep_haunting_spirits_AuraScript); + + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = (irand(0, 60) + 30) * IN_MILLISECONDS; + } + + void HandleDummyTick(AuraEffect const* aurEff) + { + GetTarget()->CastSpell((Unit*)NULL, aurEff->GetAmount(), true); + } + + void HandleUpdatePeriodic(AuraEffect* aurEff) + { + aurEff->CalculatePeriodic(GetCaster()); + } + + void Register() + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_shadowfang_keep_haunting_spirits_AuraScript(); + } +}; + void AddSC_shadowfang_keep() { new npc_shadowfang_prisoner(); new npc_arugal_voidwalker(); + new spell_shadowfang_keep_haunting_spirits(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index b5698d851f8..4fcfa8a046e 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -23,7 +23,10 @@ SDComment: SDCategory: Zul'Aman EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "zulaman.h" #define YELL_AGGRO "Da shadow gonna fall on you... " @@ -47,54 +50,58 @@ EndScriptData */ //Defines for various powers he uses after using soul drain -//Druid -#define SPELL_DR_LIFEBLOOM 43421 -#define SPELL_DR_THORNS 43420 -#define SPELL_DR_MOONFIRE 43545 - -//Hunter -#define SPELL_HU_EXPLOSIVE_TRAP 43444 -#define SPELL_HU_FREEZING_TRAP 43447 -#define SPELL_HU_SNAKE_TRAP 43449 - -//Mage -#define SPELL_MG_FIREBALL 41383 -#define SPELL_MG_FROSTBOLT 43428 -#define SPELL_MG_FROST_NOVA 43426 -#define SPELL_MG_ICE_LANCE 43427 - -//Paladin -#define SPELL_PA_CONSECRATION 43429 -#define SPELL_PA_HOLY_LIGHT 43451 -#define SPELL_PA_AVENGING_WRATH 43430 - -//Priest -#define SPELL_PR_HEAL 41372 -#define SPELL_PR_MIND_CONTROL 43550 -#define SPELL_PR_MIND_BLAST 41374 -#define SPELL_PR_SW_DEATH 41375 -#define SPELL_PR_PSYCHIC_SCREAM 43432 -#define SPELL_PR_PAIN_SUPP 44416 - -//Rogue -#define SPELL_RO_BLIND 43433 -#define SPELL_RO_SLICE_DICE 43457 -#define SPELL_RO_WOUND_POISON 39665 - -//Shaman -#define SPELL_SH_FIRE_NOVA 43436 -#define SPELL_SH_HEALING_WAVE 43548 -#define SPELL_SH_CHAIN_LIGHT 43435 - -//Warlock -#define SPELL_WL_CURSE_OF_DOOM 43439 -#define SPELL_WL_RAIN_OF_FIRE 43440 -#define SPELL_WL_UNSTABLE_AFFL 35183 - -//Warrior -#define SPELL_WR_SPELL_REFLECT 43443 -#define SPELL_WR_WHIRLWIND 43442 -#define SPELL_WR_MORTAL_STRIKE 43441 +enum Spells +{ + // Druid + SPELL_DR_THORNS = 43420, + SPELL_DR_LIFEBLOOM = 43421, + SPELL_DR_MOONFIRE = 43545, + + // Hunter + SPELL_HU_EXPLOSIVE_TRAP = 43444, + SPELL_HU_FREEZING_TRAP = 43447, + SPELL_HU_SNAKE_TRAP = 43449, + + // Mage + SPELL_MG_FIREBALL = 41383, + SPELL_MG_FROST_NOVA = 43426, + SPELL_MG_ICE_LANCE = 43427, + SPELL_MG_FROSTBOLT = 43428, + + // Paladin + SPELL_PA_CONSECRATION = 43429, + SPELL_PA_AVENGING_WRATH = 43430, + SPELL_PA_HOLY_LIGHT = 43451, + + // Priest + SPELL_PR_HEAL = 41372, + SPELL_PR_MIND_BLAST = 41374, + SPELL_PR_SW_DEATH = 41375, + SPELL_PR_PSYCHIC_SCREAM = 43432, + SPELL_PR_MIND_CONTROL = 43550, + SPELL_PR_PAIN_SUPP = 44416, + + // Rogue + SPELL_RO_BLIND = 43433, + SPELL_RO_SLICE_DICE = 43457, + SPELL_RO_WOUND_POISON = 43461, + + // Shaman + SPELL_SH_CHAIN_LIGHT = 43435, + SPELL_SH_FIRE_NOVA = 43436, + SPELL_SH_HEALING_WAVE = 43548, + + // Warlock + SPELL_WL_CURSE_OF_DOOM = 43439, + SPELL_WL_RAIN_OF_FIRE = 43440, + SPELL_WL_UNSTABLE_AFFL = 43522, + SPELL_WL_UNSTABLE_AFFL_DISPEL = 43523, + + // Warrior + SPELL_WR_MORTAL_STRIKE = 43441, + SPELL_WR_WHIRLWIND = 43442, + SPELL_WR_SPELL_REFLECT = 43443 +}; #define ORIENT 1.5696f #define POS_Y 921.2795f @@ -936,6 +943,40 @@ class boss_koragg : public CreatureScript } }; +class spell_hexlord_unstable_affliction : public SpellScriptLoader +{ + public: + spell_hexlord_unstable_affliction() : SpellScriptLoader("spell_hexlord_unstable_affliction") { } + + class spell_hexlord_unstable_affliction_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hexlord_unstable_affliction_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_WL_UNSTABLE_AFFL_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, true, NULL, GetEffect(EFFECT_0)); + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_hexlord_unstable_affliction_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hexlord_unstable_affliction_AuraScript(); + } +}; + void AddSC_boss_hex_lord_malacrass() { new boss_hexlord_malacrass(); @@ -947,5 +988,6 @@ void AddSC_boss_hex_lord_malacrass() new boss_fenstalker(); new boss_koragg(); new boss_alyson_antille(); + new spell_hexlord_unstable_affliction(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 79bbb470edf..3b0aeb958cb 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -27,7 +27,10 @@ EndScriptData */ // All - untested // Pets aren't being summoned by their masters -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "trial_of_the_crusader.h" enum eYell @@ -945,18 +948,18 @@ public: }; -enum eWarlockSpells +enum WarlockSpells { - SPELL_HELLFIRE = 65816, - SPELL_CORRUPTION = 65810, - SPELL_CURSE_OF_AGONY = 65814, - SPELL_CURSE_OF_EXHAUSTION = 65815, - SPELL_FEAR = 65809, //8s - SPELL_SEARING_PAIN = 65819, - SPELL_SHADOW_BOLT = 65821, - SPELL_UNSTABLE_AFFLICTION = 65812, - SPELL_SUMMON_FELHUNTER = 67514, - H_SPELL_UNSTABLE_AFFLICTION = 68155, //15s + SPELL_HELLFIRE = 65816, + SPELL_CORRUPTION = 65810, + SPELL_CURSE_OF_AGONY = 65814, + SPELL_CURSE_OF_EXHAUSTION = 65815, + SPELL_FEAR = 65809, // 8s + SPELL_SEARING_PAIN = 65819, + SPELL_SHADOW_BOLT = 65821, + SPELL_UNSTABLE_AFFLICTION = 65812, // 15s + SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813, + SPELL_SUMMON_FELHUNTER = 67514, }; class mob_toc_warlock : public CreatureScript @@ -2030,6 +2033,40 @@ public: }; }; +class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader +{ + public: + spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { } + + class spell_faction_champion_warl_unstable_affliction_AuraScript : public AuraScript + { + PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, NULL, GetEffect(EFFECT_0)); + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_faction_champion_warl_unstable_affliction_AuraScript(); + } +}; + void AddSC_boss_faction_champions() { new boss_toc_champion_controller(); @@ -2049,4 +2086,5 @@ void AddSC_boss_faction_champions() new mob_toc_retro_paladin(); new mob_toc_pet_warlock(); new mob_toc_pet_hunter(); + new spell_faction_champion_warl_unstable_affliction(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 17ed6a79c76..f81ddbf6bf8 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "naxxramas.h" enum Horsemen @@ -26,6 +29,11 @@ enum Horsemen HORSEMEN_SIR, }; +enum Spells +{ + SPELL_MARK_DAMAGE = 28836 +}; + enum Events { EVENT_NONE, @@ -395,7 +403,63 @@ public: }; +class spell_four_horsemen_mark : public SpellScriptLoader +{ + public: + spell_four_horsemen_mark() : SpellScriptLoader("spell_four_horsemen_mark") { } + + class spell_four_horsemen_mark_AuraScript : public AuraScript + { + PrepareAuraScript(spell_four_horsemen_mark_AuraScript); + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + int32 damage; + switch (GetStackAmount()) + { + case 1: + damage = 0; + break; + case 2: + damage = 500; + break; + case 3: + damage = 1000; + break; + case 4: + damage = 1500; + break; + case 5: + damage = 4000; + break; + case 6: + damage = 12000; + break; + default: + damage = 20000 + 1000 * (GetStackAmount() - 7); + break; + } + if (damage) + caster->CastCustomSpell(SPELL_MARK_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget()); + } + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_four_horsemen_mark_AuraScript(); + } +}; + void AddSC_boss_four_horsemen() { new boss_four_horsemen(); + new spell_four_horsemen_mark(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 8d23de5427c..227dfaada9c 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "naxxramas.h" enum Yells @@ -25,6 +27,7 @@ enum Yells SAY_DEATH = -1533042, SAY_TELEPORT = -1533043 }; + //Gothik enum Spells { @@ -36,8 +39,11 @@ enum Spells SPELL_INFORM_LIVE_RIDER = 27935, SPELL_INFORM_DEAD_TRAINEE = 27915, SPELL_INFORM_DEAD_KNIGHT = 27931, - SPELL_INFORM_DEAD_RIDER = 27937 + SPELL_INFORM_DEAD_RIDER = 27937, + + SPELL_SHADOW_MARK = 27825 }; + enum Creatures { MOB_LIVE_TRAINEE = 16124, @@ -585,8 +591,35 @@ class mob_gothik_minion : public CreatureScript } }; +class spell_gothic_shadow_bolt_volley : public SpellScriptLoader +{ + public: + spell_gothic_shadow_bolt_volley() : SpellScriptLoader("spell_gothic_shadow_bolt_volley") { } + + class spell_gothic_shadow_bolt_volley_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gothic_shadow_bolt_volley_SpellScript); + + void FilterTargets(std::list& unitList) + { + unitList.remove_if(Trinity::UnitAuraCheck(false, SPELL_SHADOW_MARK)); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_gothic_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gothic_shadow_bolt_volley_SpellScript(); + } +}; + void AddSC_boss_gothik() { new boss_gothik(); new mob_gothik_minion(); + new spell_gothic_shadow_bolt_volley(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 4d6bfc578ff..f6c65f9c67d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -86,6 +86,7 @@ enum Spells SPELL_SHADOW_FISURE = 27810, SPELL_VOID_BLAST = 27812, SPELL_MANA_DETONATION = 27819, + SPELL_MANA_DETONATION_DAMAGE = 27820, SPELL_FROST_BLAST = 27808, SPELL_CHAINS_OF_KELTHUZAD = 28410, //28408 script effect SPELL_KELTHUZAD_CHANNEL = 29423, @@ -773,6 +774,46 @@ class npc_kelthuzad_abomination : public CreatureScript } }; +class spell_kelthuzad_detonate_mana : public SpellScriptLoader +{ + public: + spell_kelthuzad_detonate_mana() : SpellScriptLoader("spell_kelthuzad_detonate_mana") { } + + class spell_kelthuzad_detonate_mana_AuraScript : public AuraScript + { + PrepareAuraScript(spell_kelthuzad_detonate_mana_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MANA_DETONATION_DAMAGE)) + return false; + return true; + } + + void HandleScript(AuraEffect const* aurEff) + { + PreventDefaultAction(); + + Unit* target = GetTarget(); + if (int32 mana = int32(target->GetMaxPower(POWER_MANA) / 10)) + { + mana = target->ModifyPower(POWER_MANA, -mana); + target->CastCustomSpell(SPELL_MANA_DETONATION_DAMAGE, SPELLVALUE_BASE_POINT0, -mana * 10, target, true, NULL, aurEff); + } + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_kelthuzad_detonate_mana_AuraScript::HandleScript, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_kelthuzad_detonate_mana_AuraScript(); + } +}; + class achievement_just_cant_get_enough : public AchievementCriteriaScript { public: @@ -796,5 +837,6 @@ void AddSC_boss_kelthuzad() new boss_kelthuzad(); new at_kelthuzad_center(); new npc_kelthuzad_abomination(); + new spell_kelthuzad_detonate_mana(); new achievement_just_cant_get_enough(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index 2e2744baa3c..0034747c6c2 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -19,11 +19,13 @@ /* ScriptData SDName: Boss Loken SD%Complete: 60% -SDComment: Missing intro. Remove hack of Pulsing Shockwave when core supports. Aura is not working (59414) +SDComment: Missing intro. Aura is not working (59414) SDCategory: Halls of Lightning EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "halls_of_lightning.h" enum eEnums @@ -73,22 +75,16 @@ public: InstanceScript* instance; - bool m_bIsAura; - uint32 m_uiArcLightning_Timer; uint32 m_uiLightningNova_Timer; - uint32 m_uiPulsingShockwave_Timer; uint32 m_uiResumePulsingShockwave_Timer; uint32 m_uiHealthAmountModifier; void Reset() { - m_bIsAura = false; - m_uiArcLightning_Timer = 15000; m_uiLightningNova_Timer = 20000; - m_uiPulsingShockwave_Timer = 2000; m_uiResumePulsingShockwave_Timer = 15000; m_uiHealthAmountModifier = 1; @@ -130,44 +126,14 @@ public: if (!UpdateVictim()) return; - if (m_bIsAura) - { - // workaround for PULSING_SHOCKWAVE - if (m_uiPulsingShockwave_Timer <= uiDiff) - { - Map* map = me->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (PlayerList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) - { - int32 dmg; - float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ()); - - dmg = DUNGEON_MODE(100, 150); // need to correct damage - if (m_fDist > 1.0f) // Further from 1 yard - dmg = int32(dmg*m_fDist); - - me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false); - } - } - m_uiPulsingShockwave_Timer = 2000; - } else m_uiPulsingShockwave_Timer -= uiDiff; - } - else + if (m_uiResumePulsingShockwave_Timer) { if (m_uiResumePulsingShockwave_Timer <= uiDiff) { //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement? DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); - DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support - m_bIsAura = true; + DoCast(me, SPELL_PULSING_SHOCKWAVE_N, true); m_uiResumePulsingShockwave_Timer = 0; } else @@ -190,7 +156,7 @@ public: Talk(EMOTE_NOVA); DoCast(me, SPELL_LIGHTNING_NOVA_N); - m_bIsAura = false; + me->RemoveAurasDueToSpell(DUNGEON_MODE(SPELL_PULSING_SHOCKWAVE_N, SPELL_PULSING_SHOCKWAVE_H)); m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura m_uiLightningNova_Timer = urand(20000, 21000); } @@ -216,7 +182,39 @@ public: }; +class spell_loken_pulsing_shockwave : public SpellScriptLoader +{ + public: + spell_loken_pulsing_shockwave() : SpellScriptLoader("spell_loken_pulsing_shockwave") { } + + class spell_loken_pulsing_shockwave_SpellScript : public SpellScript + { + PrepareSpellScript(spell_loken_pulsing_shockwave_SpellScript); + + void CalculateDamage() + { + if (!GetHitUnit()) + return; + + float distance = GetCaster()->GetDistance2d(GetHitUnit()); + if (distance > 1.0f) + SetHitDamage(int32(GetHitDamage() * distance)); + } + + void Register() + { + OnHit += SpellHitFn(spell_loken_pulsing_shockwave_SpellScript::CalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_loken_pulsing_shockwave_SpellScript(); + } +}; + void AddSC_boss_loken() { new boss_loken(); + new spell_loken_pulsing_shockwave(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 3556bf188de..8090b9e8a3e 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -51,6 +51,8 @@ enum VezaxSpells SPELL_SHADOW_CRASH_HIT = 62659, SPELL_SURGE_OF_DARKNESS = 62662, SPELL_SARONITE_VAPORS = 63323, + SPELL_SARONITE_VAPORS_ENERGIZE = 63337, + SPELL_SARONITE_VAPORS_DAMAGE = 63338, SPELL_SUMMON_SARONITE_VAPORS = 63081, SPELL_BERSERK = 26662, @@ -463,6 +465,45 @@ class spell_mark_of_the_faceless : public SpellScriptLoader } }; +class spell_general_vezax_saronite_vapors : public SpellScriptLoader +{ + public: + spell_general_vezax_saronite_vapors() : SpellScriptLoader("spell_general_vezax_saronite_vapors") { } + + class spell_general_vezax_saronite_vapors_AuraScript : public AuraScript + { + PrepareAuraScript(spell_general_vezax_saronite_vapors_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SARONITE_VAPORS_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_SARONITE_VAPORS_DAMAGE)) + return false; + return true; + } + + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + int32 mana = int32(aurEff->GetAmount() * pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount + int32 damage = mana * 2; + caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true); + caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, &damage, NULL, NULL, true); + } + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_general_vezax_saronite_vapors_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_general_vezax_saronite_vapors_AuraScript(); + } +}; + class achievement_shadowdodger : public AchievementCriteriaScript { public: @@ -509,6 +550,7 @@ void AddSC_boss_general_vezax() new boss_saronite_animus(); new npc_saronite_vapors(); new spell_mark_of_the_faceless(); + new spell_general_vezax_saronite_vapors(); new achievement_shadowdodger(); new achievement_smell_saronite(); } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 13190ed013f..2f778336433 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -723,14 +723,25 @@ class spell_dk_death_coil : public SpellScriptLoader { PrepareSpellScript(spell_dk_death_coil_SpellScript); - bool Validate(SpellInfo const* /*SpellEntry*/) + bool Validate(SpellInfo const* /*spell*/) { if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL)) return false; return true; } - void HandleDummy(SpellEffIndex /* effIndex */) + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + { + if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD) + return SPELL_FAILED_BAD_TARGETS; + } + return SPELL_CAST_OK; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); Unit* caster = GetCaster(); @@ -752,6 +763,7 @@ class spell_dk_death_coil : public SpellScriptLoader void Register() { + OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 898350dbd71..7fe7c769a33 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -28,7 +28,9 @@ enum DruidSpells { DRUID_INCREASED_MOONFIRE_DURATION = 38414, - DRUID_NATURES_SPLENDOR = 57865 + DRUID_NATURES_SPLENDOR = 57865, + DRUID_LIFEBLOOM_FINAL_HEAL = 33778, + DRUID_LIFEBLOOM_ENERGIZE = 64372 }; // 54846 Glyph of Starfire @@ -154,7 +156,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // reduces all damage taken while Stunned in Cat Form - if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<HasStealthAura() || target->HasInvisibilityAura()) + return true; + + if (!target->IsWithinLOSInMap(_caster)) + return true; + + return false; + } + + private: + Unit* _caster; +}; + class spell_dru_starfall_dummy : public SpellScriptLoader { public: @@ -337,7 +359,14 @@ class spell_dru_starfall_dummy : public SpellScriptLoader { PrepareSpellScript(spell_dru_starfall_dummy_SpellScript); - void HandleDummy(SpellEffIndex /* effIndex */) + void FilterTargets(std::list& unitList) + { + // Remove targets not in LoS or in stealth + unitList.remove_if(StarfallDummyTargetFilter(GetCaster())); + Trinity::Containers::RandomResizeList(unitList, 2); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); // Shapeshifting into an animal form or mounting cancels the effect @@ -348,15 +377,16 @@ class spell_dru_starfall_dummy : public SpellScriptLoader return; } - //Any effect which causes you to lose control of your character will supress the starfall effect. + // Any effect which causes you to lose control of your character will supress the starfall effect. if (caster->HasUnitState(UNIT_STATE_CONTROLLED)) return; - caster->CastSpell(GetHitUnit(), GetEffectValue(), true); + caster->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); } void Register() { + OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -367,6 +397,90 @@ class spell_dru_starfall_dummy : public SpellScriptLoader } }; +class spell_dru_lifebloom : public SpellScriptLoader +{ + public: + spell_dru_lifebloom() : SpellScriptLoader("spell_dru_lifebloom") { } + + class spell_dru_lifebloom_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_lifebloom_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_FINAL_HEAL)) + return false; + if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_ENERGIZE)) + return false; + return true; + } + + void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + // Final heal only on duration end + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + + // final heal + int32 stack = GetStackAmount(); + int32 healAmount = aurEff->GetAmount(); + Unit* caster = GetCaster(); + if (caster) + { + healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack); + healAmount = GetTarget()->SpellHealingBonusTaken(GetSpellInfo(), healAmount, HEAL, stack); + } + + GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + + // restore mana + if (caster) + { + int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; + caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + } + } + + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* target = GetUnitOwner()) + { + if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) + { + // final heal + int32 healAmount = aurEff->GetAmount(); + Unit* caster = GetCaster(); + if (caster) + { + healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); + healAmount = target->SpellHealingBonusTaken(GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); + } + + target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + + // restore mana + if (caster) + { + int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; + caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + } + } + } + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dru_lifebloom_AuraScript(); + } +}; + void AddSC_druid_spell_scripts() { new spell_dru_glyph_of_starfire(); @@ -377,4 +491,5 @@ void AddSC_druid_spell_scripts() new spell_dru_starfall_aoe(); new spell_dru_swift_flight_passive(); new spell_dru_starfall_dummy(); + new spell_dru_lifebloom(); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 501c7c47676..bd8f6e3b387 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2688,6 +2688,120 @@ public: } }; +enum GenericBandage +{ + SPELL_RECENTLY_BANDAGED = 11196, +}; + +class spell_gen_bandage : public SpellScriptLoader +{ + public: + spell_gen_bandage() : SpellScriptLoader("spell_gen_bandage") { } + + class spell_gen_bandage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_bandage_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_RECENTLY_BANDAGED)) + return false; + return true; + } + + SpellCastResult CheckCast() + { + if (Unit* target = GetExplTargetUnit()) + { + if (target->HasAura(SPELL_RECENTLY_BANDAGED)) + return SPELL_FAILED_TARGET_AURASTATE; + } + return SPELL_CAST_OK; + } + + void HandleScript() + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_RECENTLY_BANDAGED, true); + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_gen_bandage_SpellScript::CheckCast); + AfterHit += SpellHitFn(spell_gen_bandage_SpellScript::HandleScript); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_bandage_SpellScript(); + } +}; + +enum GenericLifebloom +{ + SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL = 43422, + SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL = 52552, + SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL = 53692, + SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL = 57763, + SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL = 66094, +}; + +class spell_gen_lifebloom : public SpellScriptLoader +{ + public: + spell_gen_lifebloom(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } + + class spell_gen_lifebloom_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_lifebloom_AuraScript); + + public: + spell_gen_lifebloom_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(_spellId)) + return false; + return true; + } + + void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + // Final heal only on duration end + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + + // final heal + GetTarget()->CastSpell(GetTarget(), _spellId, true, NULL, aurEff, GetCasterGUID()); + } + + void HandleDispel(DispelInfo* /*dispelInfo*/) + { + // final heal + if (Unit* target = GetUnitOwner()) + target->CastSpell(target, _spellId, true, NULL, GetEffect(EFFECT_0), GetCasterGUID()); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_lifebloom_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + AfterDispel += AuraDispelFn(spell_gen_lifebloom_AuraScript::HandleDispel); + } + + private: + uint32 _spellId; + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_lifebloom_AuraScript(_spellId); + } + + private: + uint32 _spellId; +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2742,4 +2856,10 @@ void AddSC_generic_spell_scripts() new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); new spell_gen_despawn_self(); + new spell_gen_bandage(); + new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_twisted_visage_lifebloom", SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 53a78e42c3c..e2272e0cdb4 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -618,6 +618,34 @@ class spell_hun_misdirection_proc : public SpellScriptLoader } }; +class spell_hun_disengage : public SpellScriptLoader +{ + public: + spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { } + + class spell_hun_disengage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_hun_disengage_SpellScript); + + SpellCastResult CheckCast() + { + if (GetCaster()->GetTypeId() == TYPEID_PLAYER && !GetCaster()->isInCombat()) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_disengage_SpellScript(); + } +}; void AddSC_hunter_spell_scripts() { @@ -633,4 +661,5 @@ void AddSC_hunter_spell_scripts() new spell_hun_pet_carrion_feeder(); new spell_hun_misdirection(); new spell_hun_misdirection_proc(); + new spell_hun_disengage(); } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 050741ffaba..0edfbaee437 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -342,13 +342,52 @@ public: } }; +class spell_mage_living_bomb : public SpellScriptLoader +{ + public: + spell_mage_living_bomb() : SpellScriptLoader("spell_mage_living_bomb") { } + + class spell_mage_living_bomb_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mage_living_bomb_AuraScript); + + bool Validate(SpellInfo const* spell) + { + if (!sSpellMgr->GetSpellInfo(uint32(spell->Effects[EFFECT_1].CalcValue()))) + return false; + return true; + } + + void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode(); + if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE) + return; + + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true, NULL, aurEff); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_mage_living_bomb_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_mage_living_bomb_AuraScript(); + } +}; + void AddSC_mage_spell_scripts() { - new spell_mage_blast_wave; - new spell_mage_cold_snap; + new spell_mage_blast_wave(); + new spell_mage_cold_snap(); new spell_mage_frost_warding_trigger(); new spell_mage_incanters_absorbtion_absorb(); new spell_mage_incanters_absorbtion_manashield(); - new spell_mage_polymorph_cast_visual; - new spell_mage_summon_water_elemental; + new spell_mage_polymorph_cast_visual(); + new spell_mage_summon_water_elemental(); + new spell_mage_living_bomb(); } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index cf8cae68c58..95bb1429dc3 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -43,6 +43,10 @@ enum PaladinSpells SPELL_DIVINE_STORM = 53385, SPELL_DIVINE_STORM_DUMMY = 54171, SPELL_DIVINE_STORM_HEAL = 54172, + + SPELL_FORBEARANCE = 25771, + SPELL_AVENGING_WRATH_MARKER = 61987, + SPELL_IMMUNE_SHIELD_MARKER = 61988, }; // 31850 - Ardent Defender @@ -255,17 +259,18 @@ class spell_pal_holy_shock : public SpellScriptLoader class spell_pal_holy_shock_SpellScript : public SpellScript { - PrepareSpellScript(spell_pal_holy_shock_SpellScript) - bool Validate(SpellInfo const* spellEntry) + PrepareSpellScript(spell_pal_holy_shock_SpellScript); + + bool Validate(SpellInfo const* spell) { if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1)) return false; // can't use other spell than holy shock due to spell_ranks dependency - if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) + if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spell->Id)) return false; - uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id); + uint8 rank = sSpellMgr->GetSpellRank(spell->Id); if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true)) return false; @@ -287,10 +292,18 @@ class spell_pal_holy_shock : public SpellScriptLoader SpellCastResult CheckCast() { - Player* caster = GetCaster()->ToPlayer(); + Unit* caster = GetCaster(); if (Unit* target = GetExplTargetUnit()) - if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) - return SPELL_FAILED_BAD_TARGETS; + { + if (!caster->IsFriendlyTo(target)) + { + if (!caster->HasInArc(static_cast(M_PI), target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + + if (!caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; + } + } return SPELL_CAST_OK; } @@ -423,6 +436,70 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader } }; +class spell_pal_lay_on_hands : public SpellScriptLoader +{ + public: + spell_pal_lay_on_hands() : SpellScriptLoader("spell_pal_lay_on_hands") { } + + class spell_pal_lay_on_hands_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pal_lay_on_hands_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_FORBEARANCE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_AVENGING_WRATH_MARKER)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_IMMUNE_SHIELD_MARKER)) + return false; + return true; + } + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + { + if (caster == target) + { + if (target->HasAura(SPELL_FORBEARANCE)) + return SPELL_FAILED_TARGET_AURASTATE; + + if (target->HasAura(SPELL_AVENGING_WRATH_MARKER)) + return SPELL_FAILED_TARGET_AURASTATE; + + if (target->HasAura(SPELL_IMMUNE_SHIELD_MARKER)) + return SPELL_FAILED_TARGET_AURASTATE; + } + } + return SPELL_CAST_OK; + } + + void HandleScript() + { + Unit* caster = GetCaster(); + if (caster == GetHitUnit()) + { + caster->CastSpell(caster, SPELL_FORBEARANCE, true); + caster->CastSpell(caster, SPELL_AVENGING_WRATH_MARKER, true); + caster->CastSpell(caster, SPELL_IMMUNE_SHIELD_MARKER, true); + } + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_pal_lay_on_hands_SpellScript::CheckCast); + AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pal_lay_on_hands_SpellScript(); + } +}; + void AddSC_paladin_spell_scripts() { new spell_pal_ardent_defender(); @@ -433,4 +510,5 @@ void AddSC_paladin_spell_scripts() new spell_pal_judgement_of_command(); new spell_pal_divine_storm(); new spell_pal_divine_storm_dummy(); + new spell_pal_lay_on_hands(); } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 8088004c9d1..a20534effaf 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -34,6 +34,7 @@ enum PriestSpells PRIEST_SPELL_PENANCE_R1_HEAL = 47757, PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619, PRIEST_SPELL_REFLECTIVE_SHIELD_R1 = 33201, + PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL = 64085, }; // Guardian Spirit @@ -330,6 +331,50 @@ public: } }; +class spell_pri_vampiric_touch : public SpellScriptLoader +{ + public: + spell_pri_vampiric_touch() : SpellScriptLoader("spell_pri_vampiric_touch") { } + + class spell_pri_vampiric_touch_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pri_vampiric_touch_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* /*dispelInfo*/) + { + if (Unit* caster = GetCaster()) + { + if (Unit* target = GetUnitOwner()) + { + if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) + { + int32 damage = aurEff->GetAmount() * 8; + // backfire damage + caster->CastCustomSpell(target, PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); + } + } + } + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_pri_vampiric_touch_AuraScript(); + } +}; + void AddSC_priest_spell_scripts() { new spell_pri_guardian_spirit(); @@ -339,4 +384,5 @@ void AddSC_priest_spell_scripts() new spell_pri_reflective_shield_trigger(); new spell_pri_mind_sear(); new spell_pri_prayer_of_mending_heal(); + new spell_pri_vampiric_touch(); } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 7e2756f28a5..4cb3818cdb8 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -42,6 +42,10 @@ enum ShamanSpells // For Earthen Power SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474, SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566, + + ICON_ID_SHAMAN_LAVA_FLOW = 3087, + SHAMAN_LAVA_FLOWS_R1 = 51480, + SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694, }; // 51474 - Astral shift @@ -652,6 +656,52 @@ class spell_sha_chain_heal : public SpellScriptLoader } }; +class spell_sha_flame_shock : public SpellScriptLoader +{ + public: + spell_sha_flame_shock() : SpellScriptLoader("spell_sha_flame_shock") { } + + class spell_sha_flame_shock_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_flame_shock_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_R1)) + return false; + if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_TRIGGERED_R1)) + return false; + return true; + } + + void HandleDispel(DispelInfo* /*dispelInfo*/) + { + if (Unit* caster = GetCaster()) + { + // Lava Flows + if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, ICON_ID_SHAMAN_LAVA_FLOW, 0)) + { + if (sSpellMgr->GetFirstSpellInChain(SHAMAN_LAVA_FLOWS_R1) != sSpellMgr->GetFirstSpellInChain(aurEff->GetId())) + return; + + uint8 rank = sSpellMgr->GetSpellRank(aurEff->GetId()); + caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true); + } + } + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_sha_flame_shock_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_sha_flame_shock_AuraScript(); + } +}; + void AddSC_shaman_spell_scripts() { new spell_sha_astral_shift(); @@ -667,4 +717,5 @@ void AddSC_shaman_spell_scripts() new spell_sha_mana_spring_totem(); new spell_sha_lava_lash(); new spell_sha_chain_heal(); + new spell_sha_flame_shock(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 838b9e4f932..1b24a9ec09f 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -37,6 +37,8 @@ enum WarlockSpells WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018, WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020, WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388, + WARLOCK_HAUNT_HEAL = 48210, + WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117, }; class spell_warl_banish : public SpellScriptLoader @@ -523,6 +525,106 @@ class spell_warl_demonic_circle_teleport : public SpellScriptLoader } }; +class spell_warl_haunt : public SpellScriptLoader +{ + public: + spell_warl_haunt() : SpellScriptLoader("spell_warl_haunt") { } + + class spell_warl_haunt_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warl_haunt_SpellScript); + + void HandleOnHit() + { + if (Aura* aura = GetHitAura()) + if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1)) + aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage())); + } + + void Register() + { + OnHit += SpellHitFn(spell_warl_haunt_SpellScript::HandleOnHit); + } + }; + + class spell_warl_haunt_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_haunt_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(WARLOCK_HAUNT_HEAL)) + return false; + return true; + } + + void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + int32 amount = aurEff->GetAmount(); + GetTarget()->CastCustomSpell(caster, WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + } + } + + void Register() + { + OnEffectRemove += AuraEffectApplyFn(spell_warl_haunt_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_haunt_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_warl_haunt_AuraScript(); + } +}; + +class spell_warl_unstable_affliction : public SpellScriptLoader +{ + public: + spell_warl_unstable_affliction() : SpellScriptLoader("spell_warl_unstable_affliction") { } + + class spell_warl_unstable_affliction_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_unstable_affliction_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(WARLOCK_UNSTABLE_AFFLICTION_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* caster = GetCaster()) + { + if (AuraEffect const* aurEff = GetEffect(EFFECT_0)) + { + int32 damage = aurEff->GetAmount() * 9; + // backfire damage and silence + caster->CastCustomSpell(dispelInfo->GetDispeller(), WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); + } + } + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_warl_unstable_affliction_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_unstable_affliction_AuraScript(); + } +}; + void AddSC_warlock_spell_scripts() { new spell_warl_banish(); @@ -535,4 +637,6 @@ void AddSC_warlock_spell_scripts() new spell_warl_life_tap(); new spell_warl_demonic_circle_summon(); new spell_warl_demonic_circle_teleport(); + new spell_warl_haunt(); + new spell_warl_unstable_affliction(); } -- cgit v1.2.3 From 1bfd6605af4cf32cb7bbc136665c2bee54fb8d6f Mon Sep 17 00:00:00 2001 From: joschiwald Date: Mon, 28 May 2012 04:29:59 +0200 Subject: fix compile --- src/server/scripts/Spells/spell_druid.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 7fe7c769a33..1d152e6f208 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -428,7 +428,7 @@ class spell_dru_lifebloom : public SpellScriptLoader if (caster) { healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack); - healAmount = GetTarget()->SpellHealingBonusTaken(GetSpellInfo(), healAmount, HEAL, stack); + healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack); } GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); @@ -453,7 +453,7 @@ class spell_dru_lifebloom : public SpellScriptLoader if (caster) { healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); - healAmount = target->SpellHealingBonusTaken(GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); + healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); } target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); -- cgit v1.2.3 From 34a1dd763b5978cde86bbb2d9b34ae11540a14ab Mon Sep 17 00:00:00 2001 From: AliveShiro Date: Mon, 28 May 2012 19:18:03 +0200 Subject: Core/Scripts: Fix Anub'arak spikes in Trial of the Crusader now they only attack players. Thanks to Warpten who brought the Idea and thanks to Nayd :) --- .../CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index f329b940e1f..1934efa1cbf 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -659,6 +659,11 @@ public: m_uiTargetGUID = 0; } + bool CanAIAttack(Unit const* victim) const + { + return victim->GetTypeId() == TYPEID_PLAYER; + } + void EnterCombat(Unit* who) { m_uiTargetGUID = who->GetGUID(); -- cgit v1.2.3 From e83f913fc501a84d57bb96b308a747e4fce468cb Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 28 May 2012 22:16:47 +0100 Subject: Core/Spells: Ignore LoS when spells are cast/triggered by gameobjects ... and this is why you shouldn't use the so called hacks. You will just keep adding sh*t on top of more sh*t (like this). Currently, GO spell casts spawn an invisible WORLD_TRIGGER (npc 12999) inside of the gameobject (for certain forms of gameobjects) (and this is why the LoS check was failing). It shouldn't be like that. GOs should be able to cast the spells without having to spawn an auxiliary creature. Fixes "Eye of Acherus" and others --- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- src/server/game/Spells/Spell.cpp | 7 +++---- src/server/game/Spells/SpellMgr.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 10136c5fbd7..eb10a1f54b1 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1674,7 +1674,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId) else { trigger->setFaction(14); - // Set owner guid for target if no owner avalible - needed by trigger auras + // Set owner guid for target if no owner available - needed by trigger auras // - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell()) trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, target ? target->GetGUID() : 0); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index de432229e2c..58a89f75fd3 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -585,9 +585,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme CleanupEffectExecuteData(); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - { m_destTargets[i] = SpellDestination(*m_caster); - } } Spell::~Spell() @@ -4837,8 +4835,9 @@ SpellCastResult Spell::CheckCast(bool strict) if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast(M_PI), m_caster)) return SPELL_FAILED_NOT_INFRONT; - if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) - return SPELL_FAILED_LINE_OF_SIGHT; + if (m_caster->GetEntry() != WORLD_TRIGGER) // Ignore LOS for gameobjects casts (wrongly casted by a trigger) + if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) + return SPELL_FAILED_LINE_OF_SIGHT; } else { diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 521070f7879..dcf3c38fe4f 100755 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -605,7 +605,7 @@ class SpellMgr // Accessors (const or static functions) public: - // Spell correctess for client using + // Spell correctness for client using static bool IsSpellValid(SpellInfo const* spellInfo, Player* player = NULL, bool msg = true); // Spell difficulty -- cgit v1.2.3 From 013fe44b9229469e142bd152b43e80841dc9cb0e Mon Sep 17 00:00:00 2001 From: Discover- Date: Tue, 29 May 2012 12:19:46 +0200 Subject: Core/SAI: Implement SMART_ACTION_SET_RANGED_MOVEMENT (79) and SMART_ACTION_SET_STAND_STATE (101). Updated wiki accordingly. These were required in order to properly be able to convert EventAI to SmartAI. --- src/server/game/AI/SmartScripts/SmartAI.h | 2 +- src/server/game/AI/SmartScripts/SmartScript.cpp | 27 ++++++++++++++++++++++++ src/server/game/AI/SmartScripts/SmartScriptMgr.h | 16 ++++++++++++-- 3 files changed, 42 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index bfd1c7b9d41..435aa176d4d 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -62,6 +62,7 @@ class SmartAI : public CreatureAI void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; } void SetAutoAttack(bool on) { mCanAutoAttack = on; } void SetCombatMove(bool on); + bool CanCombatMove() { return mCanCombatMove; } void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0); void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker); @@ -224,7 +225,6 @@ class SmartAI : public CreatureAI bool mCanCombatMove; bool mForcedPaused; uint32 mInvincibilityHpLevel; - bool AssistPlayerInCombat(Unit* who); uint32 mDespawnTime; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 85b117ccd8c..bb5b54829b8 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1534,6 +1534,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u case SMART_ACTION_CALL_SCRIPT_RESET: OnReset(); break; + case SMART_ACTION_SET_RANGED_MOVEMENT: + { + float attackDistance = (float)e.action.setRangedMovement.distance; + float attackAngle = e.action.setRangedMovement.angle / 180.0f * M_PI; + + if (CAST_AI(SmartAI, me->AI())->CanCombatMove()) + me->GetMotionMaster()->MoveChase(me->getVictim(), attackDistance, attackAngle); + break; + } case SMART_ACTION_CALL_TIMED_ACTIONLIST: { if (e.GetTargetType() == SMART_TARGET_NONE) @@ -1924,6 +1933,24 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; break; } + case SMART_ACTION_SET_STAND_STATE: + { + ObjectList* targets = GetTargets(e, unit); + if (!targets) + break; + + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (IsUnit(*itr)) + { + (*itr)->ToUnit()->SetStandState(e.action.setStandState.standState); + sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set standstate to %u", (*itr)->GetGUIDLow(), e.action.emote.emote); + } + } + + delete targets; + break; + } default: sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index bde7768f036..7efc137205e 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -451,7 +451,7 @@ enum SMART_ACTION SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT = 76, // WARNING: CAN CRASH CORE, do not use if you dont know what you are doing SMART_ACTION_RESET_SCRIPT_BASE_OBJECT = 77, // none SMART_ACTION_CALL_SCRIPT_RESET = 78, // none - // Unused = 79, + SMART_ACTION_SET_RANGED_MOVEMENT = 79, // Distance, angle SMART_ACTION_CALL_TIMED_ACTIONLIST = 80, // ID (overwrites already running actionlist), stop after combat?(0/1), timer update type(0-OOC, 1-IC, 2-ALWAYS) SMART_ACTION_SET_NPC_FLAG = 81, // Flags SMART_ACTION_ADD_NPC_FLAG = 82, // Flags @@ -473,8 +473,9 @@ enum SMART_ACTION SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId SMART_ACTION_GO_SET_LOOT_STATE = 99, // state SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id + SMART_ACTION_SET_STAND_STATE = 101, // standState - SMART_ACTION_END = 101, + SMART_ACTION_END = 102, }; struct SmartAction @@ -893,6 +894,17 @@ struct SmartAction uint32 id; } sendTargetToTarget; + struct + { + uint32 standState; + } setStandState; + + struct + { + float distance; + float angle; + } setRangedMovement; + struct { uint32 param1; -- cgit v1.2.3 From 154a030a68672ab8ec22a78f2a91d63ef3607b32 Mon Sep 17 00:00:00 2001 From: Discover- Date: Tue, 29 May 2012 12:29:10 +0200 Subject: Core/SAI: Fix previous commit. Thanks Shauren for notifying. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index bb5b54829b8..9a562e3f6c4 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1536,11 +1536,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; case SMART_ACTION_SET_RANGED_MOVEMENT: { + if (!IsSmart()) + break; + float attackDistance = (float)e.action.setRangedMovement.distance; float attackAngle = e.action.setRangedMovement.angle / 180.0f * M_PI; - if (CAST_AI(SmartAI, me->AI())->CanCombatMove()) - me->GetMotionMaster()->MoveChase(me->getVictim(), attackDistance, attackAngle); + ObjectList* targets = GetTargets(e, unit); + if (targets) + { + for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr) + if (Creature* target = (*itr)->ToCreature()) + if (IsSmart(target) && target->getVictim()) + if (CAST_AI(SmartAI, target->AI())->CanCombatMove()) + target->GetMotionMaster()->MoveChase(target->getVictim(), attackDistance, attackAngle); + + delete targets; + } break; } case SMART_ACTION_CALL_TIMED_ACTIONLIST: -- cgit v1.2.3 From 1b77fd45fa5f3eb34ef8c6c462bfcbe2e7d8a9a1 Mon Sep 17 00:00:00 2001 From: Discover- Date: Wed, 30 May 2012 01:00:55 +0200 Subject: Core/SAI: Revert SMART_ACTION_SET_STAND_STATE from 013fe44b9229469e142bd152b43e80841dc9cb0e, can be done with SMART_ACTION_SET_UNIT_FIELD_BYTES_1. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 18 ------------------ src/server/game/AI/SmartScripts/SmartScriptMgr.h | 8 +------- 2 files changed, 1 insertion(+), 25 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 9a562e3f6c4..01a9b777358 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1945,24 +1945,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; break; } - case SMART_ACTION_SET_STAND_STATE: - { - ObjectList* targets = GetTargets(e, unit); - if (!targets) - break; - - for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - { - if (IsUnit(*itr)) - { - (*itr)->ToUnit()->SetStandState(e.action.setStandState.standState); - sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set standstate to %u", (*itr)->GetGUIDLow(), e.action.emote.emote); - } - } - - delete targets; - break; - } default: sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 7efc137205e..c23e288f66d 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -473,9 +473,8 @@ enum SMART_ACTION SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId SMART_ACTION_GO_SET_LOOT_STATE = 99, // state SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id - SMART_ACTION_SET_STAND_STATE = 101, // standState - SMART_ACTION_END = 102, + SMART_ACTION_END = 101, }; struct SmartAction @@ -894,11 +893,6 @@ struct SmartAction uint32 id; } sendTargetToTarget; - struct - { - uint32 standState; - } setStandState; - struct { float distance; -- cgit v1.2.3 From 5eee40249c51b35719a18907da94d64d98f89258 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 31 May 2012 15:39:18 +0200 Subject: Core/Items: Added custom flags field to item_template, currently 2 flag values are available * ITEM_FLAGS_CU_DURATION_REAL_TIME determines item duration counts even if offline (replaced ugly negative duration workaround, easy to lose data when importing fresh wdb) * ITEM_FLAGS_CU_IGNORE_QUEST_STATUS quest status will not affect this item appearing in loot, currently needed for Arena Master trinket --- sql/updates/world/2012_05_31_01_world_item_template.sql | 4 ++++ src/server/game/Entities/Item/Item.cpp | 4 ++-- src/server/game/Entities/Item/ItemPrototype.h | 9 ++++++++- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Globals/ObjectMgr.cpp | 15 +++++++++++---- src/server/game/Handlers/ItemHandler.cpp | 2 +- src/server/game/Loot/LootMgr.cpp | 15 +++------------ 7 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 sql/updates/world/2012_05_31_01_world_item_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_05_31_01_world_item_template.sql b/sql/updates/world/2012_05_31_01_world_item_template.sql new file mode 100644 index 00000000000..144ee6715a9 --- /dev/null +++ b/sql/updates/world/2012_05_31_01_world_item_template.sql @@ -0,0 +1,4 @@ +ALTER TABLE `item_template` ADD `flagsCustom` INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `maxMoneyLoot`; +UPDATE `item_template` SET `flagsCustom`=`flagsCustom`|0x1 WHERE `Duration`<0; +UPDATE `item_template` SET `duration`=ABS(`duration`); +ALTER TABLE `item_template` CHANGE `Duration` `duration` INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `ArmorDamageModifier`; diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index af867dad76a..209fdae8ce6 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -274,7 +274,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner) for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) SetSpellCharges(i, itemProto->Spells[i].SpellCharges); - SetUInt32Value(ITEM_FIELD_DURATION, abs(itemProto->Duration)); + SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration); SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0); return true; } @@ -420,7 +420,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr // update duration if need, and remove if not need if ((proto->Duration == 0) != (duration == 0)) { - SetUInt32Value(ITEM_FIELD_DURATION, abs(proto->Duration)); + SetUInt32Value(ITEM_FIELD_DURATION, proto->Duration); need_save = true; } diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h index 2eae7234229..1b5eec7fbaf 100755 --- a/src/server/game/Entities/Item/ItemPrototype.h +++ b/src/server/game/Entities/Item/ItemPrototype.h @@ -192,6 +192,12 @@ enum ItemFlagsExtra ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED = 0x00000100 }; +enum ItemFlagsCustom +{ + ITEM_FLAGS_CU_DURATION_REAL_TIME = 0x0001, // Item duration will tick even if player is offline + ITEM_FLAGS_CU_IGNORE_QUEST_STATUS = 0x0002, // No quest status will be checked when this item drops +}; + enum BAG_FAMILY_MASK { BAG_FAMILY_MASK_NONE = 0x00000000, @@ -644,7 +650,7 @@ struct ItemTemplate uint32 GemProperties; // id from GemProperties.dbc uint32 RequiredDisenchantSkill; float ArmorDamageModifier; - int32 Duration; // negative = realtime, positive = ingame time + uint32 Duration; uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc uint32 HolidayId; // id from Holidays.dbc uint32 ScriptId; @@ -652,6 +658,7 @@ struct ItemTemplate uint32 FoodType; uint32 MinMoneyLoot; uint32 MaxMoneyLoot; + uint32 FlagsCu; // helpers bool CanChangeEquipStateInCombat() const diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d5e2d8ba956..4cf6d4ad979 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -13665,7 +13665,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly) Item* item = *itr; ++itr; // current element can be erased in UpdateDuration - if ((realtimeonly && item->GetTemplate()->Duration < 0) || !realtimeonly) + if (!realtimeonly || item->GetTemplate()->FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME) item->UpdateDuration(this, time); } } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 1e36b4c732b..df6018faf39 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2111,9 +2111,9 @@ void ObjectMgr::LoadItemTemplates() // 118 119 120 121 122 123 124 125 "TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, " // 126 127 128 129 130 131 132 133 - "GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, Duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, " + "GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, " // 134 135 136 - "FoodType, minMoneyLoot, maxMoneyLoot FROM item_template"); + "FoodType, minMoneyLoot, maxMoneyLoot, flagsCustom FROM item_template"); if (!result) { @@ -2230,7 +2230,7 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.GemProperties = fields[126].GetUInt32(); itemTemplate.RequiredDisenchantSkill = uint32(fields[127].GetInt16()); itemTemplate.ArmorDamageModifier = fields[128].GetFloat(); - itemTemplate.Duration = fields[129].GetInt32(); + itemTemplate.Duration = fields[129].GetUInt32(); itemTemplate.ItemLimitCategory = uint32(fields[130].GetInt16()); itemTemplate.HolidayId = fields[131].GetUInt32(); itemTemplate.ScriptId = sObjectMgr->GetScriptId(fields[132].GetCString()); @@ -2238,6 +2238,7 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.FoodType = uint32(fields[134].GetUInt8()); itemTemplate.MinMoneyLoot = fields[135].GetUInt32(); itemTemplate.MaxMoneyLoot = fields[136].GetUInt32(); + itemTemplate.FlagsCu = fields[137].GetUInt32(); // Checks @@ -2645,6 +2646,12 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.HolidayId = 0; } + if (itemTemplate.FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate.Duration) + { + sLog->outErrorDb("Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); + itemTemplate.FlagsCu &= ~ITEM_FLAGS_CU_DURATION_REAL_TIME; + } + ++count; } while (result->NextRow()); @@ -2731,7 +2738,7 @@ void ObjectMgr::LoadItemSetNames() if (setEntry->itemId[i]) itemSetItems.insert(setEntry->itemId[i]); } - + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT `entry`, `name`, `InventoryType` FROM `item_set_names`"); diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index d537fc5b4aa..a569c914be0 100755 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -423,7 +423,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data) data << pProto->GemProperties; data << pProto->RequiredDisenchantSkill; data << pProto->ArmorDamageModifier; - data << uint32(abs(pProto->Duration)); // added in 2.4.2.8209, duration (seconds) + data << pProto->Duration; // added in 2.4.2.8209, duration (seconds) data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory data << pProto->HolidayId; // Holiday.dbc? SendPacket(&data); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 75065158ef6..a5ad46c9ec4 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -356,18 +356,9 @@ bool LootItem::AllowedForPlayer(Player const* player) const if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE) return false; - if (needs_quest) - { - // Checking quests for quest-only drop (check only quests requirements in this case) - if (!player->HasQuestForItem(itemid)) - return false; - } - else - { - // Not quest only drop (check quest starting items for already accepted non-repeatable quests) - if (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid)) - return false; - } + // check quest requirements + if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid))) + return false; return true; } -- cgit v1.2.3 From 425eeb828048e7506acc974540ca8ab8c99047b0 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 31 May 2012 19:45:11 +0200 Subject: Core/Movement * Implemented creature movement on transports * Set minimum speed for creature allowed to start movement (too low speed leads to overflows in movement time calculations which in turn leads to crashes) --- src/server/game/Entities/Creature/Creature.h | 6 ++ src/server/game/Entities/Transport/Transport.cpp | 33 +++++++++-- src/server/game/Entities/Transport/Transport.h | 2 + src/server/game/Entities/Unit/Unit.cpp | 32 ++++++++--- src/server/game/Movement/MotionMaster.cpp | 6 +- src/server/game/Movement/MotionMaster.h | 4 +- src/server/game/Movement/Spline/MoveSpline.cpp | 2 +- src/server/game/Movement/Spline/MoveSplineInit.cpp | 67 +++++++++++++++++++--- src/server/game/Movement/Spline/MoveSplineInit.h | 23 +++++--- .../game/Movement/Spline/MoveSplineInitArgs.h | 3 +- .../game/Movement/Spline/MovementPacketBuilder.cpp | 14 +---- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 6 +- .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 2 +- .../UtgardeKeep/UtgardePinnacle/boss_svala.cpp | 4 +- 14 files changed, 146 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index f6021a7d7ec..c8ebf1aa13b 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -677,6 +677,11 @@ class Creature : public Unit, public GridObject, public MapCreature void GetHomePosition(float &x, float &y, float &z, float &ori) { m_homePosition.GetPosition(x, y, z, ori); } Position GetHomePosition() { return m_homePosition; } + void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); } + void SetTransportHomePosition(const Position &pos) { m_transportHomePosition.Relocate(pos); } + void GetTransportHomePosition(float &x, float &y, float &z, float &ori) { m_transportHomePosition.GetPosition(x, y, z, ori); } + Position GetTransportHomePosition() { return m_transportHomePosition; } + uint32 GetWaypointPath(){return m_path_id;} void LoadPath(uint32 pathid) { m_path_id = pathid; } @@ -750,6 +755,7 @@ class Creature : public Unit, public GridObject, public MapCreature uint32 m_originalEntry; Position m_homePosition; + Position m_transportHomePosition; bool DisableReputationGain; diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 4f5d5ade7ec..95c6d308626 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -656,6 +656,7 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, o + GetOrientation()); creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation()); + creature->SetTransportHomePosition(creature->m_movementInfo.t_pos); if (!creature->IsPositionValid()) { @@ -698,11 +699,33 @@ void Transport::UpdateNPCPositions() Creature* npc = *itr; float x, y, z, o; - o = GetOrientation() + npc->m_movementInfo.t_pos.m_orientation; - x = GetPositionX() + (npc->m_movementInfo.t_pos.m_positionX * cos(GetOrientation()) + npc->m_movementInfo.t_pos.m_positionY * sin(GetOrientation() + M_PI)); - y = GetPositionY() + (npc->m_movementInfo.t_pos.m_positionY * cos(GetOrientation()) + npc->m_movementInfo.t_pos.m_positionX * sin(GetOrientation())); - z = GetPositionZ() + npc->m_movementInfo.t_pos.m_positionZ; - npc->SetHomePosition(x, y, z, o); + npc->m_movementInfo.t_pos.GetPosition(x, y, z, o); + CalculatePassengerPosition(x, y, z, o); GetMap()->CreatureRelocation(npc, x, y, z, o, false); + npc->GetTransportHomePosition(x, y, z, o); + CalculatePassengerPosition(x, y, z, o); + npc->SetHomePosition(x, y, z, o); } } + +//! This method transforms supplied transport offsets into global coordinates +void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o) +{ + float inx = x, iny = y, inz = z, ino = o; + o = GetOrientation() + ino; + x = GetPositionX() + (inx * cos(GetOrientation()) + iny * sin(GetOrientation() + M_PI)); + y = GetPositionY() + (iny * cos(GetOrientation()) + inx * sin(GetOrientation())); + z = GetPositionZ() + inz; +} + +//! This method transforms supplied global coordinates into local offsets +void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o) +{ + o -= GetOrientation(); + z -= GetPositionZ(); + y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o) + x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi) + float inx = x, iny = y; + y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) - sin(GetOrientation() + M_PI) * tan(GetOrientation())); + x = (inx - iny * sin(GetOrientation() + M_PI) / cos(GetOrientation())) / (cos(GetOrientation()) - tan(GetOrientation()) * sin(GetOrientation() + M_PI)); +} diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index 518dcf6359d..4b0c42c9071 100755 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.h @@ -47,6 +47,8 @@ class Transport : public GameObject uint32 AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim=0); void UpdatePosition(MovementInfo* mi); void UpdateNPCPositions(); + void CalculatePassengerPosition(float& x, float& y, float& z, float& o); + void CalculatePassengerOffset(float& x, float& y, float& z, float& o); void BuildStartMovePacket(Map const* targetMap); void BuildStopMovePacket(Map const* targetMap); uint32 GetScriptId() const { return ScriptId; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 71977bf469c..1ff7b9f4d4b 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -396,10 +396,25 @@ void Unit::UpdateSplineMovement(uint32 t_diff) m_movesplineTimer.Reset(POSITION_UPDATE_DELAY); Movement::Location loc = movespline->ComputePosition(); - if (GetTypeId() == TYPEID_PLAYER) - ((Player*)this)->UpdatePosition(loc.x,loc.y,loc.z,loc.orientation); - else - GetMap()->CreatureRelocation((Creature*)this,loc.x,loc.y,loc.z,loc.orientation); + if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + { + Position& pos = m_movementInfo.t_pos; + pos.m_positionX = loc.x; + pos.m_positionY = loc.y; + pos.m_positionZ = loc.z; + pos.m_orientation = loc.orientation; + if (Unit* vehicle = GetVehicleBase()) + { + loc.x += vehicle->GetPositionX(); + loc.y += vehicle->GetPositionY(); + loc.z += vehicle->GetPositionZMinusOffset(); + loc.orientation = vehicle->GetOrientation(); + } + else if (Transport* trans = GetTransport()) + trans->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation); + } + + UpdatePosition(loc.x, loc.y, loc.z, loc.orientation); } } @@ -414,7 +429,7 @@ void Unit::SendMonsterMoveExitVehicle(Position const* newPos) WorldPacket data(SMSG_MONSTER_MOVE, 1+12+4+1+4+4+4+12+GetPackGUID().size()); data.append(GetPackGUID()); - data << uint8(GetTypeId() == TYPEID_PLAYER ? 1 : 0); // new in 3.1, bool + data << uint8(GetTypeId() == TYPEID_PLAYER ? 1 : 0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40) data << GetPositionX() << GetPositionY() << GetPositionZ(); data << getMSTime(); @@ -437,7 +452,7 @@ void Unit::SendMonsterMoveTransport(Unit* vehicleOwner) data.append(GetPackGUID()); data.append(vehicleOwner->GetPackGUID()); data << int8(GetTransSeat()); - data << uint8(0); + data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40) data << GetPositionX() - vehicleOwner->GetPositionX(); data << GetPositionY() - vehicleOwner->GetPositionY(); data << GetPositionZ() - vehicleOwner->GetPositionZ(); @@ -12662,7 +12677,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) { // Set creature speed rate from CreatureInfo if (GetTypeId() == TYPEID_UNIT) - speed *= ToCreature()->GetCreatureTemplate()->speed_walk; + speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need // TODO: possible affect only on MOVE_RUN @@ -12982,8 +12997,7 @@ void Unit::TauntFadeOut(Unit* taunter) return; } - //m_ThreatManager.tauntFadeOut(taunter); - target = m_ThreatManager.getHostilTarget(); + target = creature->SelectVictim(); // might have more taunt auras remaining if (target && target != taunter) { diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index c0e1eb842ae..bc0570bb73b 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -298,7 +298,7 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z) } } -void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed) +void MotionMaster::MoveLand(uint32 id, Position const& pos) { float x, y, z; pos.GetPosition(x, y, z); @@ -307,13 +307,12 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed) Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); - init.SetVelocity(speed); init.SetAnimation(Movement::ToGround); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE); } -void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) +void MotionMaster::MoveTakeoff(uint32 id, Position const& pos) { float x, y, z; pos.GetPosition(x, y, z); @@ -322,7 +321,6 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); - init.SetVelocity(speed); init.SetAnimation(Movement::ToFly); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE); diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index d6144bfcc3a..727f626cdea 100755 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -157,8 +157,8 @@ class MotionMaster //: private std::stack void MovePoint(uint32 id, float x, float y, float z); // These two movement types should only be used with creatures having landing/takeoff animations - void MoveLand(uint32 id, Position const& pos, float speed); - void MoveTakeoff(uint32 id, Position const& pos, float speed); + void MoveLand(uint32 id, Position const& pos); + void MoveTakeoff(uint32 id, Position const& pos); void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE); void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ); diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 91b4ff08250..b1c25aedfd7 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -203,7 +203,7 @@ bool MoveSplineInitArgs::Validate() const return false;\ } CHECK(path.size() > 1); - CHECK(velocity > 0.f); + CHECK(velocity > 0.1f); CHECK(time_perc >= 0.f && time_perc <= 1.f); //CHECK(_checkPathBounds()); return true; diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index e586cb4f4f9..b8440e06076 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -20,6 +20,8 @@ #include "MoveSpline.h" #include "MovementPacketBuilder.h" #include "Unit.h" +#include "Transport.h" +#include "Vehicle.h" namespace Movement { @@ -58,17 +60,25 @@ namespace Movement { MoveSpline& move_spline = *unit.movespline; - Location real_position(unit.GetPositionX(),unit.GetPositionY(),unit.GetPositionZMinusOffset(),unit.GetOrientation()); - // there is a big chane that current position is unknown if current state is not finalized, need compute it + bool transport = false; + Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZMinusOffset(), unit.GetOrientation()); + if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + { + transport = true; + real_position.x = unit.GetTransOffsetX(); + real_position.y = unit.GetTransOffsetY(); + real_position.z = unit.GetTransOffsetZ(); + real_position.orientation = unit.GetTransOffsetO(); + } + + // there is a big chance that current position is unknown if current state is not finalized, need compute it // this also allows calculate spline position and update map position in much greater intervals if (!move_spline.Finalized()) real_position = move_spline.ComputePosition(); + // should i do the things that user should do? - no. if (args.path.empty()) - { - // should i do the things that user should do? - MoveTo(real_position); - } + return; // corrent first vertex args.path[0] = real_position; @@ -82,7 +92,7 @@ namespace Movement moveFlags |= (MOVEMENTFLAG_SPLINE_ENABLED|MOVEMENTFLAG_FORWARD); - if (args.velocity == 0.f) + if (!args.HasVelocity) args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags)); if (!args.Validate()) @@ -94,8 +104,20 @@ namespace Movement unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags); move_spline.Initialize(args); - WorldPacket data(SMSG_MONSTER_MOVE, 64); + WorldPacket data(!transport ? SMSG_MONSTER_MOVE : SMSG_MONSTER_MOVE_TRANSPORT, 64); data.append(unit.GetPackGUID()); + if (transport) + { + if (unit.GetVehicle()) + data.appendPackGUID(unit.GetVehicleBase()->GetGUID()); + else if (unit.GetTransport()) + data.appendPackGUID(unit.GetTransGUID()); + else + data << uint8(0); + + data << int8(unit.GetTransSeat()); + } + PacketBuilder::WriteMonsterMove(move_spline, data); unit.SendMessageToSet(&data,true); } @@ -119,4 +141,33 @@ namespace Movement args.facing.angle = G3D::wrap(angle, 0.f, (float)G3D::twoPi()); args.flags.EnableFacingAngle(); } + + void MoveSplineInit::MoveTo(Vector3 const& dest) + { + args.path_Idx_offset = 0; + args.path.resize(2); + TransportPathTransform transform(unit); + args.path[1] = transform(dest); + } + + Vector3 TransportPathTransform::operator()(Vector3 input) + { + if (_owner.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + { + if (Unit* vehicle = _owner.GetVehicleBase()) + { + input.x -= vehicle->GetPositionX(); + input.y -= vehicle->GetPositionY(); + input.z -= vehicle->GetPositionZMinusOffset(); + } + else if (Transport* transport = _owner.GetTransport()) + { + float unused = 0.0f; + transport->CalculatePassengerOffset(input.x, input.y, input.z, unused); + } + } + + return input; + } + } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h index 7ef6cd7a120..b1b08d97cfa 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.h +++ b/src/server/game/Movement/Spline/MoveSplineInit.h @@ -33,6 +33,17 @@ namespace Movement FlyToGround = 3, // 463 = FlyToGround }; + // Transforms coordinates from global to transport offsets + class TransportPathTransform + { + public: + TransportPathTransform(Unit& owner) : _owner(owner) { } + Vector3 operator()(Vector3 input); + + private: + Unit& _owner; + }; + /* Initializes and launches spline movement */ class MoveSplineInit @@ -123,14 +134,15 @@ namespace Movement inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();} inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;} inline void MoveSplineInit::SetFall() { args.flags.EnableFalling();} - inline void MoveSplineInit::SetVelocity(float vel){ args.velocity = vel;} + inline void MoveSplineInit::SetVelocity(float vel) { args.velocity = vel; args.HasVelocity = true; } inline void MoveSplineInit::SetOrientationInversed() { args.flags.orientationInversed = true;} inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable;} inline void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset) { args.path_Idx_offset = path_offset; - args.path.assign(controls.begin(),controls.end()); + args.path.resize(controls.size()); + std::transform(controls.begin(), controls.end(), args.path.begin(), TransportPathTransform(unit)); } inline void MoveSplineInit::MoveTo(float x, float y, float z) @@ -139,13 +151,6 @@ namespace Movement MoveTo(v); } - inline void MoveSplineInit::MoveTo(const Vector3& dest) - { - args.path_Idx_offset = 0; - args.path.resize(2); - args.path[1] = dest; - } - inline void MoveSplineInit::SetParabolic(float amplitude, float time_shift) { args.time_perc = time_shift; diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h index 26fbbdd0fcc..74409c9562b 100644 --- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h +++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h @@ -42,7 +42,7 @@ namespace Movement struct MoveSplineInitArgs { MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0), - velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f) + velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f), HasVelocity(false) { path.reserve(path_capacity); } @@ -56,6 +56,7 @@ namespace Movement float time_perc; uint32 splineId; float initialOrientation; + bool HasVelocity; /** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */ bool Validate() const; diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index 0260767dbe2..16f06a25058 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -44,20 +44,8 @@ namespace Movement void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data) { MoveSplineFlag splineflags = move_spline.splineflags; - /*if (unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - { - data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT); - if (unit->GetVehicle()) - data << unit->GetVehicle()->GetBase()->GetPackGUID(); - else if (unit->GetTransport()) - data << unit->GetTransport()->GetPackGUID(); - else - data << uint64(0); - - data << int8(unit->GetTransSeat()); - }*/ - data << uint8(0); + data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40) data << move_spline.spline.getPoint(move_spline.spline.first()); data << move_spline.GetId(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 6039ace44ab..734639a8b51 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -167,7 +167,7 @@ class FrostwyrmLandEvent : public BasicEvent bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) { - _owner.GetMotionMaster()->MoveLand(POINT_FROSTWYRM_LAND, _dest, 8.247422f); + _owner.GetMotionMaster()->MoveLand(POINT_FROSTWYRM_LAND, _dest); return true; } @@ -481,7 +481,7 @@ class boss_sindragosa : public CreatureScript Position pos; pos.Relocate(me); pos.m_positionZ += 17.0f; - me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos, 8.30078125f); + me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos); events.CancelEventGroup(EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_AIR_PHASE, 110000); break; @@ -523,7 +523,7 @@ class boss_sindragosa : public CreatureScript events.ScheduleEvent(EVENT_FROST_BREATH, urand(10000, 15000), EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(12000, 17000), EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_ICY_GRIP, urand(35000, 40000), EVENT_GROUP_LAND_PHASE); - me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SindragosaLandPos, 0.0f); + me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SindragosaLandPos); break; case EVENT_THIRD_PHASE_CHECK: { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index fab9a5f0740..6fd3cd2a294 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1926,7 +1926,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader //pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f); //pos.m_positionZ += 0.05f; caster->SetHomePosition(pos); - caster->GetMotionMaster()->MoveLand(POINT_LAND, pos, caster->GetSpeed(MOVE_FLIGHT)); + caster->GetMotionMaster()->MoveLand(POINT_LAND, pos); } void Register() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 29b8f2e7f48..44cd1184098 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -276,7 +276,7 @@ public: arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, false); pos.Relocate(me); pos.m_positionZ += 8.0f; - me->GetMotionMaster()->MoveTakeoff(0, pos, 3.30078125f); + me->GetMotionMaster()->MoveTakeoff(0, pos); // spectators flee event if (instance) { @@ -333,7 +333,7 @@ public: pos.m_positionX = me->GetHomePosition().GetPositionX(); pos.m_positionY = me->GetHomePosition().GetPositionY(); pos.m_positionZ = 90.6065f; - me->GetMotionMaster()->MoveLand(0, pos, 6.247422f); + me->GetMotionMaster()->MoveLand(0, pos); me->SetDisableGravity(false, true); me->SetHover(true); ++introPhase; -- cgit v1.2.3 From f5ab1a3a5ccda29a5a67c4fcbdfd7a61e78ddb43 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 31 May 2012 23:04:09 +0200 Subject: Core/Movement: Fixed Unit::StopMoving() --- src/server/game/Entities/Unit/Unit.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1ff7b9f4d4b..c90b86f2349 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14795,6 +14795,7 @@ void Unit::StopMoving() return; Movement::MoveSplineInit init(*this); + init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset()); init.SetFacing(GetOrientation()); init.Launch(); } -- cgit v1.2.3 From 99b23429db65adf4d4e7463f74ba5278d930e196 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 1 Jun 2012 10:43:36 -0400 Subject: Core/Spells: fix damage from touch the nightmare for the caster and fix damage and healing for dream funnel. closes #6669 closes #6676 --- .../2012_06_01_00_world_spell_script_names.sql | 4 + src/server/scripts/Spells/spell_generic.cpp | 93 ++++++++++++++++++---- 2 files changed, 80 insertions(+), 17 deletions(-) create mode 100644 sql/updates/world/2012_06_01_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_01_00_world_spell_script_names.sql b/sql/updates/world/2012_06_01_00_world_spell_script_names.sql new file mode 100644 index 00000000000..cc024fe71cb --- /dev/null +++ b/sql/updates/world/2012_06_01_00_world_spell_script_names.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (50341,50344); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(50341, 'spell_gen_touch_the_nightmare'), +(50344, 'spell_gen_dream_funnel'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 0c879cfb029..e23e21cf2cd 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2052,9 +2052,9 @@ class spell_gen_defend : public SpellScriptLoader public: spell_gen_defend() : SpellScriptLoader("spell_gen_defend") { } - class spell_gen_defendAuraScript : public AuraScript + class spell_gen_defend_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_defendAuraScript); + PrepareAuraScript(spell_gen_defend_AuraScript); bool Validate(SpellInfo const* /*spellEntry*/) { @@ -2103,26 +2103,26 @@ class spell_gen_defend : public SpellScriptLoader // Defend spells casted by NPCs (add visuals) if (spell->Effects[EFFECT_0].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) { - AfterEffectApply += AuraEffectApplyFn(spell_gen_defendAuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_defendAuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); } // Remove Defend spell from player when he dismounts if (spell->Effects[EFFECT_2].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) - OnEffectRemove += AuraEffectRemoveFn(spell_gen_defendAuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); // Defend spells casted by players (add/remove visuals) if (spell->Effects[EFFECT_1].ApplyAuraName == SPELL_AURA_DUMMY) { - AfterEffectApply += AuraEffectApplyFn(spell_gen_defendAuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_defendAuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); } } }; AuraScript* GetAuraScript() const { - return new spell_gen_defendAuraScript(); + return new spell_gen_defend_AuraScript(); } }; @@ -2326,9 +2326,9 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader public: spell_gen_on_tournament_mount() : SpellScriptLoader("spell_gen_on_tournament_mount") { } - class spell_gen_on_tournament_mountAuraScript : public AuraScript + class spell_gen_on_tournament_mount_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_on_tournament_mountAuraScript); + PrepareAuraScript(spell_gen_on_tournament_mount_AuraScript); uint32 _pennantSpellId; @@ -2468,14 +2468,14 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader void Register() { - AfterEffectApply += AuraEffectApplyFn(spell_gen_on_tournament_mountAuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_on_tournament_mountAuraScript::HandleRemoveEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_gen_on_tournament_mount_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_on_tournament_mount_AuraScript::HandleRemoveEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); } }; AuraScript* GetAuraScript() const { - return new spell_gen_on_tournament_mountAuraScript(); + return new spell_gen_on_tournament_mount_AuraScript(); } }; @@ -2484,9 +2484,9 @@ class spell_gen_tournament_pennant : public SpellScriptLoader public: spell_gen_tournament_pennant() : SpellScriptLoader("spell_gen_tournament_pennant") { } - class spell_gen_tournament_pennantAuraScript : public AuraScript + class spell_gen_tournament_pennant_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_tournament_pennantAuraScript); + PrepareAuraScript(spell_gen_tournament_pennant_AuraScript); bool Load() { @@ -2502,13 +2502,13 @@ class spell_gen_tournament_pennant : public SpellScriptLoader void Register() { - OnEffectApply += AuraEffectApplyFn(spell_gen_tournament_pennantAuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectApply += AuraEffectApplyFn(spell_gen_tournament_pennant_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); } }; AuraScript* GetAuraScript() const { - return new spell_gen_tournament_pennantAuraScript(); + return new spell_gen_tournament_pennant_AuraScript(); } }; @@ -2688,6 +2688,63 @@ public: } }; +class spell_gen_touch_the_nightmare : public SpellScriptLoader +{ +public: + spell_gen_touch_the_nightmare() : SpellScriptLoader("spell_gen_touch_the_nightmare") { } + + class spell_gen_touch_the_nightmare_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_touch_the_nightmare_SpellScript); + + void HandleDamageCalc(SpellEffIndex effIndex) + { + uint32 bp = GetCaster()->GetMaxHealth() * 0.3f; + SetHitDamage(bp); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_touch_the_nightmare_SpellScript::HandleDamageCalc, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_touch_the_nightmare_SpellScript(); + } +}; + +class spell_gen_dream_funnel: public SpellScriptLoader +{ +public: + spell_gen_dream_funnel() : SpellScriptLoader("spell_gen_dream_funnel") { } + + class spell_gen_dream_funnel_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_dream_funnel_AuraScript); + + void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + { + if (GetCaster()) + amount = GetCaster()->GetMaxHealth() * 0.05f; + + canBeRecalculated = false; + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_dream_funnel_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2742,4 +2799,6 @@ void AddSC_generic_spell_scripts() new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); new spell_gen_despawn_self(); + new spell_gen_touch_the_nightmare(); + new spell_gen_dream_funnel(); } -- cgit v1.2.3 From dfbd7a820b6f577d7a38bc88e6152903571b3dd1 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Fri, 1 Jun 2012 12:23:55 -0230 Subject: Core/scripts: Add generic script to prevent cannon movement. --- .../world/2012_06_01_01_world_creature_script.sql | 2 ++ src/server/scripts/World/npcs_special.cpp | 27 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 sql/updates/world/2012_06_01_01_world_creature_script.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_01_01_world_creature_script.sql b/sql/updates/world/2012_06_01_01_world_creature_script.sql new file mode 100644 index 00000000000..d90800bd1af --- /dev/null +++ b/sql/updates/world/2012_06_01_01_world_creature_script.sql @@ -0,0 +1,2 @@ +-- Add Generic Harpoon gun script to prevent movement +UPDATE `creature_template` SET `ScriptName`= 'npc_generic_harpoon_cannon' WHERE `entry` IN (27714,30066,30337); diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index ecd1a439a58..bfe4ac07bdc 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2988,6 +2988,32 @@ public: }; }; +/*###### +## npc_generic_harpoon_cannon +######*/ + +class npc_generic_harpoon_cannon : public CreatureScript +{ +public: + npc_generic_harpoon_cannon() : CreatureScript("npc_generic_harpoon_cannon") { } + + struct npc_generic_harpoon_cannonAI : public ScriptedAI + { + npc_generic_harpoon_cannonAI(Creature* creature) : ScriptedAI(creature) {} + + void Reset() + { + me->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); + me->SetExtraUnitMovementFlags(MOVEMENTFLAG2_NO_STRAFE | MOVEMENTFLAG2_NO_JUMPING | MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_generic_harpoon_cannonAI(creature); + } +}; + void AddSC_npcs_special() { new npc_air_force_bots(); @@ -3020,4 +3046,5 @@ void AddSC_npcs_special() new npc_earth_elemental(); new npc_firework(); new npc_spring_rabbit(); + new npc_generic_harpoon_cannon(); } -- cgit v1.2.3 From 8cc19196a653194a765738a02daa287714ab0dd3 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Fri, 1 Jun 2012 12:34:08 -0230 Subject: Core/script: Informed by Kaelima this line is handled by dbc and not required. --- src/server/scripts/World/npcs_special.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index bfe4ac07bdc..c9aeea07382 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -3004,7 +3004,6 @@ public: void Reset() { me->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); - me->SetExtraUnitMovementFlags(MOVEMENTFLAG2_NO_STRAFE | MOVEMENTFLAG2_NO_JUMPING | MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING); } }; -- cgit v1.2.3 From 925657cc9885c2c2b1cd6b379bfdd72555af49ea Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 1 Jun 2012 19:48:43 +0100 Subject: Scripts/Sholazar: Fix quest Kick, What Kick? - Closes #370 --- sql/updates/world/2012_06_01_02_world_misc.sql | 70 ++++++++++++++ src/server/scripts/Northrend/sholazar_basin.cpp | 122 ++++++++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100644 sql/updates/world/2012_06_01_02_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_01_02_world_misc.sql b/sql/updates/world/2012_06_01_02_world_misc.sql new file mode 100644 index 00000000000..23663ef9270 --- /dev/null +++ b/sql/updates/world/2012_06_01_02_world_misc.sql @@ -0,0 +1,70 @@ +/* Quest: Kick, What Kick? - 12589 by Nay */ + +-- Lucky Wilhelm: 0xF150006D960041CB +-- Drostan: 0xF130006EA80041CA +-- Apple: 0xF130006D950041C8 + +-- Remove old conditions, now done in cpp +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=51330; + +-- Spells conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (51331,51332,51366); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 51331, 0, 0, 31, 0, 3, 28053, 0, 0, 0, '', 'Hit Apple - Apple - Q: Kick, What Kick?'), +(13, 1, 51332, 0, 0, 31, 0, 3, 28054, 0, 0, 0, '', 'Miss Apple - Wilhelm - Q: Kick, What Kick?'), +(13, 1, 51366, 0, 0, 31, 0, 3, 28093, 0, 0, 0, '', 'Miss Apple, Hit Bird - Sholazar Tickbird - Q: Kick, What Kick?'); + +-- Assign script to spell +DELETE FROM `spell_script_names` WHERE `spell_id`=51330; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(51330, 'spell_q12589_shoot_rjr'); + +-- Spellclick spell for Wilhelm +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`=28054; +INSERT INTO `npc_spellclick_spells` (`npc_entry`,`spell_id`,`cast_flags`,`user_type`) VALUES +(28054,50556,1,0); + +-- Addon data +DELETE FROM `creature_template_addon` WHERE `entry` IN (28053,28328,30737,28346); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(28053,0,0,1,0, NULL), -- Apple +(28328,0,0,257,0, NULL), -- Drostan +(30737,0,0,256,0, NULL), -- Nesingwary Game Warden +(28346,0,0,1,0, NULL); -- Crunchy + +-- Put Apple in Wilhelm's head +DELETE FROM `vehicle_template_accessory` WHERE `entry`=28054 AND `accessory_entry`=28053; +INSERT INTO `vehicle_template_accessory` (`entry`,`accessory_entry`, `seat_id`, `minion`, `description`, `summontype`, `summontimer`) VALUES +(28054, 28053, -1, 0, 'Lucky Wilhelm - Apple', 6, 10000); + +-- Says and yells +DELETE FROM `creature_text` WHERE `entry`=28328 OR (`entry`=28054 AND `groupid` IN (0,1)); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(28328, 0, 0, 'The only thing hurt is your pride, lad. Buck up!', 12, 0, 100, 11, 0, 0, 'Drostan to Lucky Wilhelm'), +(28328, 0, 1, 'Stop whining. You''ve still got your luck.', 12, 0, 100, 11, 0, 0, 'Drostan to Lucky Wilhelm'), +(28328, 0, 2, 'Bah, it''s an improvement.', 12, 0, 100, 0, 0, 0, 'Drostan to Lucky Wilhelm'), +(28328, 0, 3, 'Calm down lad, it''s just a birdshot!', 12, 0, 100, 0, 0, 0, 'Drostan to Lucky Wilhelm'), +(28054, 0, 0, 'Not the ''stache! Now I''m asymmetrical!', 12, 0, 100, 5, 0, 0, 'Lucky Wilhelm'), +(28054, 0, 1, 'Ouch! That''s it, I quit the target business!', 12, 0, 100, 0, 0, 0, 'Lucky Wilhelm'), +(28054, 0, 2, 'My ear! You grazed my ear!', 12, 0, 100, 0, 0, 0, 'Lucky Wilhelm'), +(28054, 1, 0, 'Good shot!', 12, 0, 100, 4, 0, 0, 'Lucky Wilhelm'); + +/* * Hit: */ +/* player casts Shoot RJR on Lucky */ +/* apple gets hit by 51331 (Hit Apple) by player */ +/* after that apple casts 51371 (Apple Falls to ground) on self */ +/* Wilhelm says Good shot! */ +/* reward killcredit 28053 */ + +/* * Miss: */ +/* player casts Shoot RJR on Lucky */ +/* lucky gets hit by 51332 (Miss Apple) by player */ +/* lucky says random text */ +/* drostan says random text */ + +/* * Miss, Hit Bird - guessed */ +/* player casts Shoot RJR on Lucky */ +/* bird gets hit by 51366 (Miss Apple, Hit Bird and dies) */ +/* bird gets hit by 51369 (Tickbird Signal to Fall) */ +/* lucky says random text */ +/* drostan says random text */ diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 93d0182ea08..2a03e44d5b2 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -746,6 +746,127 @@ public: } }; +/*###### +## Quest Kick, What Kick? (12589) +######*/ + +enum KickWhatKick +{ + NPC_LUCKY_WILHELM = 28054, + NPC_APPLE = 28053, + NPC_DROSTAN = 28328, + NPC_CRUNCHY = 28346, + NPC_THICKBIRD = 28093, + + SPELL_HIT_APPLE = 51331, + SPELL_MISS_APPLE = 51332, + SPELL_MISS_BIRD_APPLE = 51366, + SPELL_APPLE_FALL = 51371, + SPELL_BIRD_FALL = 51369, + + EVENT_MISS = 0, + EVENT_HIT = 1, + EVENT_MISS_BIRD = 2, + + SAY_WILHELM_MISS = 0, + SAY_WILHELM_HIT = 1, + SAY_DROSTAN_REPLY_MISS = 0, +}; + +class spell_q12589_shoot_rjr : public SpellScriptLoader +{ +public: + spell_q12589_shoot_rjr() : SpellScriptLoader("spell_q12589_shoot_rjr") { } + + class spell_q12589_shoot_rjr_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12589_shoot_rjr_SpellScript); + + SpellCastResult CheckCast() + { + if (Unit* target = GetExplTargetUnit()) + if (target->GetEntry() == NPC_LUCKY_WILHELM) + return SPELL_CAST_OK; + + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_TARGET_WILHELM); + return SPELL_FAILED_CUSTOM_ERROR; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint32 roll = urand(1, 100); + + uint8 ev; + if (roll <= 50) + ev = EVENT_MISS; + else if (roll <= 83) + ev = EVENT_HIT; + else + ev = EVENT_MISS_BIRD; + + Unit* shooter = GetCaster(); + Creature* wilhelm = GetHitUnit()->ToCreature(); + Creature* apple = shooter->FindNearestCreature(NPC_APPLE, 30); + Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30); + Creature* drostan = shooter->FindNearestCreature(NPC_DROSTAN, 30); + Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30); + + if (!wilhelm || !apple || !drostan) + return; + + switch (ev) + { + case EVENT_MISS_BIRD: + { + if (!bird || !crunchy) + ; // fall to EVENT_MISS + else + { + shooter->CastSpell(bird, SPELL_MISS_BIRD_APPLE); + shooter->CastSpell(bird, SPELL_BIRD_FALL); + wilhelm->AI()->Talk(SAY_WILHELM_MISS); + drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS); + + bird->Kill(bird); + crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(), + bird->GetMap()->GetWaterOrGroundLevel(bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ())); + // TODO: Make crunchy perform emote eat when he reaches the bird + } + } + case EVENT_MISS: + { + shooter->CastSpell(wilhelm, SPELL_MISS_APPLE); + wilhelm->AI()->Talk(SAY_WILHELM_MISS); + drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS); + break; + } + case EVENT_HIT: + { + shooter->CastSpell(apple, SPELL_HIT_APPLE); + apple->CastSpell(apple, SPELL_APPLE_FALL); + wilhelm->AI()->Talk(SAY_WILHELM_HIT); + if (Player* player = shooter->ToPlayer()) + player->KilledMonsterCredit(NPC_APPLE, 0); + apple->DespawnOrUnsummon(); + + break; + } + } + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_q12589_shoot_rjr_SpellScript::CheckCast); + OnEffectHitTarget += SpellEffectFn(spell_q12589_shoot_rjr_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12589_shoot_rjr_SpellScript(); + } +}; + void AddSC_sholazar_basin() { new npc_injured_rainspeaker_oracle(); @@ -756,4 +877,5 @@ void AddSC_sholazar_basin() new npc_adventurous_dwarf(); new npc_jungle_punch_target(); new spell_q12620_the_lifewarden_wrath(); + new spell_q12589_shoot_rjr(); } -- cgit v1.2.3 From f89ef6da5b6d59e9d758059549d95759711d0cf9 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 1 Jun 2012 19:59:44 +0100 Subject: DB/Misc: Fix DB startup errors - Closes #6666 Also add a missing break; to previous commit --- sql/updates/world/2012_06_01_03_world_creature_template.sql | 2 ++ src/server/scripts/Northrend/sholazar_basin.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/2012_06_01_03_world_creature_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_01_03_world_creature_template.sql b/sql/updates/world/2012_06_01_03_world_creature_template.sql new file mode 100644 index 00000000000..fb20691ad69 --- /dev/null +++ b/sql/updates/world/2012_06_01_03_world_creature_template.sql @@ -0,0 +1,2 @@ +-- Set same flag for diff_entry_1 +UPDATE `creature_template` SET `npcflag`=129 WHERE `entry`=30796; diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 2a03e44d5b2..afab9b90a4a 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -807,9 +807,7 @@ public: Unit* shooter = GetCaster(); Creature* wilhelm = GetHitUnit()->ToCreature(); Creature* apple = shooter->FindNearestCreature(NPC_APPLE, 30); - Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30); Creature* drostan = shooter->FindNearestCreature(NPC_DROSTAN, 30); - Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30); if (!wilhelm || !apple || !drostan) return; @@ -818,12 +816,15 @@ public: { case EVENT_MISS_BIRD: { + Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30); + Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30); + if (!bird || !crunchy) ; // fall to EVENT_MISS else { shooter->CastSpell(bird, SPELL_MISS_BIRD_APPLE); - shooter->CastSpell(bird, SPELL_BIRD_FALL); + bird->CastSpell(bird, SPELL_BIRD_FALL); wilhelm->AI()->Talk(SAY_WILHELM_MISS); drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS); @@ -831,6 +832,8 @@ public: crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(), bird->GetMap()->GetWaterOrGroundLevel(bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ())); // TODO: Make crunchy perform emote eat when he reaches the bird + + break; } } case EVENT_MISS: -- cgit v1.2.3 From f89da81406c919d24ebd373979f54a8cb90d45c5 Mon Sep 17 00:00:00 2001 From: hexa- Date: Fri, 1 Jun 2012 21:22:58 +0200 Subject: Core/Battlegrounds: Introduce Arena.RatedUpdateTimer to configure time between checks for rated arena matches. --- src/server/game/Battlegrounds/BattlegroundMgr.cpp | 12 ++++++------ src/server/game/Battlegrounds/BattlegroundMgr.h | 2 +- src/server/game/World/World.cpp | 1 + src/server/game/World/World.h | 1 + src/server/worldserver/worldserver.conf.dist | 7 +++++++ 5 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index a106f11ae82..2b2265dad84 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -55,7 +55,7 @@ BattlegroundMgr::BattlegroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTe { for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++) m_Battlegrounds[i].clear(); - m_NextRatingDiscardUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); + m_NextRatedArenaUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER); m_Testing=false; } @@ -143,10 +143,10 @@ void BattlegroundMgr::Update(uint32 diff) } // if rating difference counts, maybe force-update queues - if (sWorld->getIntConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld->getIntConfig(CONFIG_ARENA_RATING_DISCARD_TIMER)) + if (sWorld->getIntConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER)) { // it's time to force update - if (m_NextRatingDiscardUpdate < diff) + if (m_NextRatedArenaUpdate < diff) { // forced update for rated arenas (scan all, but skipped non rated) sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr: UPDATING ARENA QUEUES"); @@ -156,10 +156,10 @@ void BattlegroundMgr::Update(uint32 diff) BATTLEGROUND_AA, BattlegroundBracketId(bracket), BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId(qtype)), true, 0); - m_NextRatingDiscardUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); + m_NextRatedArenaUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER); } else - m_NextRatingDiscardUpdate -= diff; + m_NextRatedArenaUpdate -= diff; } if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS)) { @@ -1137,4 +1137,4 @@ BattlegroundTypeId BattlegroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday) bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId) { return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId)); -} \ No newline at end of file +} diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index 7afb83da0a6..10a49408c06 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -141,7 +141,7 @@ class BattlegroundMgr BattlegroundSelectionWeightMap m_BGSelectionWeights; std::vector m_QueueUpdateScheduler; std::set m_ClientBattlegroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client - uint32 m_NextRatingDiscardUpdate; + uint32 m_NextRatedArenaUpdate; time_t m_NextAutoDistributionTime; uint32 m_AutoDistributionTimeChecker; bool m_ArenaTesting; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 6e32d33a7bb..fa4943ce625 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1022,6 +1022,7 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_BG_XP_FOR_KILL] = ConfigMgr::GetBoolDefault("Battleground.GiveXPForKills", false); m_int_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = ConfigMgr::GetIntDefault ("Arena.MaxRatingDifference", 150); m_int_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = ConfigMgr::GetIntDefault ("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS); + m_int_configs[CONFIG_ARENA_RATED_UPDATE_TIMER] = ConfigMgr::GetIntDefault ("Arena.RatedUpdateTimer", 5 * IN_MILLISECONDS); m_bool_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS] = ConfigMgr::GetBoolDefault("Arena.AutoDistributePoints", false); m_int_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS] = ConfigMgr::GetIntDefault ("Arena.AutoDistributeInterval", 7); m_bool_configs[CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE] = ConfigMgr::GetBoolDefault("Arena.QueueAnnouncer.Enable", false); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 95e9fbda8ca..f0dbc3c84ad 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -279,6 +279,7 @@ enum WorldIntConfigs CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH, CONFIG_ARENA_MAX_RATING_DIFFERENCE, CONFIG_ARENA_RATING_DISCARD_TIMER, + CONFIG_ARENA_RATED_UPDATE_TIMER, CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS, CONFIG_ARENA_SEASON_ID, CONFIG_ARENA_START_RATING, diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 5d837100b0e..db167fb86fb 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2513,6 +2513,13 @@ Arena.MaxRatingDifference = 150 Arena.RatingDiscardTimer = 600000 +# +# Arena.RatedUpdateTimer +# Description: Time (in milliseconds) between checks for matchups in rated arena +# Default: 5000 - (5 seconds) + +Arena.RatedUpdateTimer = 5000 + # # Arena.AutoDistributePoints # Description: Automatically distribute arena points. -- cgit v1.2.3 From d75ea8837b4ede12a8f37f1123ae835228683fc7 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 1 Jun 2012 23:03:57 +0100 Subject: Scripts/Dragonblight: Fix quest Strengthen the Ancients - Closes #2043 --- sql/updates/world/2012_06_01_04_world_misc.sql | 41 +++++++++++ src/server/scripts/Northrend/dragonblight.cpp | 99 ++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 sql/updates/world/2012_06_01_04_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_01_04_world_misc.sql b/sql/updates/world/2012_06_01_04_world_misc.sql new file mode 100644 index 00000000000..d5273cec233 --- /dev/null +++ b/sql/updates/world/2012_06_01_04_world_misc.sql @@ -0,0 +1,41 @@ +-- Creature addon +DELETE FROM `creature_template_addon` WHERE `entry` IN (26421,26321,26333); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(26421,0,0,1,0, NULL), -- Woodlands Walker +(26321,0,0,1,64, '47044'), -- Lothalor Ancient (Cosmetic - Confused State Visual (Big)) +(26333,0,0,1,0, '32566 46967'); -- Corrupted Lothalor Ancient (Purple Banish State, Purple Banish State - Breath) + +-- Woodlands Walker already has spellclick spell: 47575 (Strengthen the Ancients: On Interact Dummy to Woodlands Walker) + +-- Monster emotes +DELETE FROM `creature_text` WHERE `entry` IN (26421,26321); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(26421, 0, 0, 'Breaking off a piece of its bark, the %s hands it to you before departing.', 16, 0, 100, 0, 0, 0, 'Woodlands Walker'), +(26421, 1, 0, 'The %s is angered by your request and attacks!', 16, 0, 100, 0, 0, 0, 'Woodlands Walker'), +(26321, 0, 0, 'The %s gives you its thanks.', 16, 0, 100, 0, 0, 1525, 'Lothalor Ancient'); + +-- Assign scripts to spells +DELETE FROM `spell_script_names` WHERE `spell_id` IN (47575,47530); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(47575, 'spell_q12096_q12092_dummy'), +(47530, 'spell_q12096_q12092_bark'); + +/* +- player spellclicks Woodlands Walker, casts 47575 on the tree Woodlands Walker: two outcomes: + +- - tree turns enemy: +* say The %s is angered by your request and attacks! +* change faction to 14 +* start attack + +- - tree stays friendly: +* cast 47550 (Create Bark of the Walkers)on player +* say Breaking off a piece of its bark, the %s hands it to you before departing. +* despawn + + +- player uses item on Lothalor Ancient (47530 (Bark of the Walkers)): +* tree says The %s gives you its thanks. +* aura 47044 (Cosmetic - Confused State Visual (Big)) is removed +* despawns after 4 secs +*/ diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp index 4cbe280a9f2..1b339b24549 100644 --- a/src/server/scripts/Northrend/dragonblight.cpp +++ b/src/server/scripts/Northrend/dragonblight.cpp @@ -69,7 +69,106 @@ public: } }; +/*###### +## Quest Strengthen the Ancients (12096|12092) +######*/ + +enum StrengthenAncientsMisc +{ + SAY_WALKER_FRIENDLY = 0, + SAY_WALKER_ENEMY = 1, + SAY_LOTHALOR = 0, + + SPELL_CREATE_ITEM_BARK = 47550, + SPELL_CONFUSED = 47044, + + NPC_LOTHALOR = 26321, + + FACTION_WALKER_ENEMY = 14, +}; + +class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker +{ +public: + spell_q12096_q12092_dummy() : SpellScriptLoader("spell_q12096_q12092_dummy") { } + + class spell_q12096_q12092_dummy_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12096_q12092_dummy_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint32 roll = rand() % 2; + + Creature* tree = GetHitCreature(); + Player* player = GetCaster()->ToPlayer(); + + if (!tree || !player) + return; + + tree->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + + if (roll == 1) // friendly version + { + tree->CastSpell(player, SPELL_CREATE_ITEM_BARK); + tree->AI()->Talk(SAY_WALKER_FRIENDLY, player->GetGUID()); + tree->DespawnOrUnsummon(1000); + } + else if (roll == 0) // enemy version + { + tree->AI()->Talk(SAY_WALKER_ENEMY, player->GetGUID()); + tree->setFaction(FACTION_WALKER_ENEMY); + tree->Attack(player, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12096_q12092_dummy_SpellScript(); + } +}; + +class spell_q12096_q12092_bark : public SpellScriptLoader // Bark of the Walkers +{ +public: + spell_q12096_q12092_bark() : SpellScriptLoader("spell_q12096_q12092_bark") { } + + class spell_q12096_q12092_bark_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12096_q12092_bark_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Creature* lothalor = GetHitCreature(); + if (!lothalor || lothalor->GetEntry() != NPC_LOTHALOR) + return; + + lothalor->AI()->Talk(SAY_LOTHALOR); + lothalor->RemoveAura(SPELL_CONFUSED); + lothalor->DespawnOrUnsummon(4000); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_bark_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12096_q12092_bark_SpellScript(); + } +}; + void AddSC_dragonblight() { new npc_alexstrasza_wr_gate; + new spell_q12096_q12092_dummy; + new spell_q12096_q12092_bark; } -- cgit v1.2.3 From 09c497bce2e5a924d85ff524f14bdf98fb793f38 Mon Sep 17 00:00:00 2001 From: click Date: Sat, 2 Jun 2012 14:43:07 +0200 Subject: Core/AI: Remove "enforced override"-check in the EventAI-manager in case of AI not being set to EventAI. --- src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 517e55af457..f95645611f1 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -740,10 +740,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(itr->first)) { if (cInfo->AIName != "EventAI") - { - sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI', changing to EventAI", itr->first); - const_cast(cInfo)->AIName = "EventAI"; - } + sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", itr->first); } } -- cgit v1.2.3 From cffcf633c3e89e2152d7f6d008ae42b88ed928c0 Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 2 Jun 2012 14:28:24 +0100 Subject: Core/SAI: If spell id in SMART_ACTION_REMOVEAURASFROMSPELL is 0, remove all auras instead Signed-off-by: Nay --- src/server/game/AI/SmartScripts/SmartScript.cpp | 6 +++++- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 01a9b777358..21dc92b25d1 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -789,7 +789,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsUnit((*itr))) continue; - (*itr)->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell); + if (e.action.removeAura.spell == 0) + (*itr)->ToUnit()->RemoveAllAuras(); + else + (*itr)->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell); + sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %u, spell %u", (*itr)->GetGUIDLow(), e.action.removeAura.spell); } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index a7149f37480..d529479d9dd 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -709,7 +709,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; break; case SMART_ACTION_REMOVEAURASFROMSPELL: - if (!IsSpellValid(e, e.action.removeAura.spell)) + if (e.action.removeAura.spell != 0 && !IsSpellValid(e, e.action.removeAura.spell)) return false; break; case SMART_ACTION_RANDOM_PHASE: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index c23e288f66d..5b54a4d3048 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -398,7 +398,7 @@ enum SMART_ACTION SMART_ACTION_FLEE_FOR_ASSIST = 25, // With Emote SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // QuestID SMART_ACTION_CALL_CASTEDCREATUREORGO = 27, // CreatureId, SpellId - SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid + SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid, 0 removes all auras SMART_ACTION_FOLLOW = 29, // Distance (0 = default), Angle (0 = default), EndCreatureEntry, credit, creditType (0monsterkill, 1event) SMART_ACTION_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3... SMART_ACTION_RANDOM_PHASE_RANGE = 31, // PhaseMin, PhaseMax -- cgit v1.2.3 From b14b9cd6a349cbe5bb6f78829c56867ea78667a8 Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Sat, 2 Jun 2012 17:58:05 +0200 Subject: Core/Scripts: Use proper headers, code style and cleanup (Blackfathom Deeps, Maraudon and Onyxias Lair) --- .../BlackfathomDeeps/blackfathom_deeps.cpp | 23 +- .../Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp | 11 +- .../Kalimdor/BlackfathomDeeps/boss_gelihast.cpp | 3 +- .../Kalimdor/BlackfathomDeeps/boss_kelris.cpp | 3 +- .../instance_blackfathom_deeps.cpp | 3 +- .../Kalimdor/Maraudon/boss_celebras_the_cursed.cpp | 39 ++- .../scripts/Kalimdor/Maraudon/boss_landslide.cpp | 39 +-- .../scripts/Kalimdor/Maraudon/boss_noxxion.cpp | 58 ++--- .../Kalimdor/Maraudon/boss_princess_theradras.cpp | 57 +++-- .../scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp | 279 +++++++++++---------- .../Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp | 107 ++++---- .../scripts/Kalimdor/OnyxiasLair/onyxias_lair.h | 12 +- 12 files changed, 323 insertions(+), 311 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index a86b2b8b17a..a70d05fa0ef 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -15,11 +15,13 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "blackfathom_deeps.h" #include "ScriptedEscortAI.h" -enum eSpells +enum Spells { SPELL_BLESSING_OF_BLACKFATHOM = 8733, SPELL_RAVAGE = 8391, @@ -94,11 +96,11 @@ public: uint32 frostNovaTimer; uint32 frostBoltVolleyTimer; - bool bFlee; + bool Flee; void Reset() { - bFlee = false; + Flee = false; ravageTimer = urand(5000, 8000); frostNovaTimer = urand(9000, 12000); @@ -140,7 +142,7 @@ public: { if (ravageTimer <= diff) { - DoCast(me->getVictim(), SPELL_RAVAGE); + DoCastVictim(SPELL_RAVAGE); ravageTimer = urand(9000, 14000); } else ravageTimer -= diff; break; @@ -148,9 +150,9 @@ public: case NPC_MURKSHALLOW_SOFTSHELL: case NPC_BARBED_CRUSTACEAN: { - if (!bFlee && HealthBelowPct(15)) + if (!Flee && HealthBelowPct(15)) { - bFlee = true; + Flee = true; me->DoFleeToGetAssistance(); } break; @@ -160,10 +162,7 @@ public: if (frostBoltVolleyTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - if (target) - DoCast(target, SPELL_FROST_BOLT_VOLLEY); - } + DoCast(target, SPELL_FROST_BOLT_VOLLEY); frostBoltVolleyTimer = urand(5000, 8000); } else frostBoltVolleyTimer -= diff; @@ -190,7 +189,7 @@ public: }; }; -enum eMorridune +enum Morridune { SAY_MORRIDUNE_1 = -1048003, SAY_MORRIDUNE_2 = -1048004 diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp index 32a6bcbde77..7071395812e 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blackfathom_deeps.h" enum Spells @@ -42,14 +43,14 @@ public: } uint32 poisonCloudTimer; - bool bIsEnraged; + bool IsEnraged; InstanceScript* instance; void Reset() { poisonCloudTimer = urand(5000, 9000); - bIsEnraged = false; + IsEnraged = false; if (instance) instance->SetData(TYPE_AKU_MAI, NOT_STARTED); } @@ -77,10 +78,10 @@ public: poisonCloudTimer = urand(25000, 50000); } else poisonCloudTimer -= diff; - if (!bIsEnraged && HealthBelowPct(30)) + if (!IsEnraged && HealthBelowPct(30)) { DoCast(me, SPELL_FRENZIED_RAGE); - bIsEnraged = true; + IsEnraged = true; } DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp index 5a60a849b75..1488772dc8a 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blackfathom_deeps.h" enum Spells diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp index 7ee17172102..1c754b78672 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blackfathom_deeps.h" enum Spells diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index ea33499a960..236c7b1ba69 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Blackfathom Deeps EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "blackfathom_deeps.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp index d7043965271..b23d15cd1b5 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Maraudon EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { @@ -46,15 +47,15 @@ public: { celebras_the_cursedAI(Creature* creature) : ScriptedAI(creature) {} - uint32 Wrath_Timer; - uint32 EntanglingRoots_Timer; - uint32 CorruptForces_Timer; + uint32 WrathTimer; + uint32 EntanglingRootsTimer; + uint32 CorruptForcesTimer; void Reset() { - Wrath_Timer = 8000; - EntanglingRoots_Timer = 2000; - CorruptForces_Timer = 30000; + WrathTimer = 8000; + EntanglingRootsTimer = 2000; + CorruptForcesTimer = 30000; } void EnterCombat(Unit* /*who*/) { } @@ -70,32 +71,30 @@ public: return; //Wrath - if (Wrath_Timer <= diff) + if (WrathTimer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_WRATH); - Wrath_Timer = 8000; + WrathTimer = 8000; } - else Wrath_Timer -= diff; + else WrathTimer -= diff; //EntanglingRoots - if (EntanglingRoots_Timer <= diff) + if (EntanglingRootsTimer <= diff) { - DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS); - EntanglingRoots_Timer = 20000; + DoCastVictim(SPELL_ENTANGLINGROOTS); + EntanglingRootsTimer = 20000; } - else EntanglingRoots_Timer -= diff; + else EntanglingRootsTimer -= diff; //CorruptForces - if (CorruptForces_Timer <= diff) + if (CorruptForcesTimer <= diff) { me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_CORRUPT_FORCES); - CorruptForces_Timer = 20000; + CorruptForcesTimer = 20000; } - else CorruptForces_Timer -= diff; + else CorruptForcesTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp index ea419793ae8..b4128ea80ee 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Maraudon EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { @@ -46,15 +47,15 @@ public: { boss_landslideAI(Creature* creature) : ScriptedAI(creature) {} - uint32 KnockAway_Timer; - uint32 Trample_Timer; - uint32 Landslide_Timer; + uint32 KnockAwayTimer; + uint32 TrampleTimer; + uint32 LandslideTimer; void Reset() { - KnockAway_Timer = 8000; - Trample_Timer = 2000; - Landslide_Timer = 0; + KnockAwayTimer = 8000; + TrampleTimer = 2000; + LandslideTimer = 0; } void EnterCombat(Unit* /*who*/) @@ -66,32 +67,32 @@ public: if (!UpdateVictim()) return; - //KnockAway_Timer - if (KnockAway_Timer <= diff) + //KnockAwayTimer + if (KnockAwayTimer <= diff) { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - KnockAway_Timer = 15000; + DoCastVictim(SPELL_KNOCKAWAY); + KnockAwayTimer = 15000; } - else KnockAway_Timer -= diff; + else KnockAwayTimer -= diff; - //Trample_Timer - if (Trample_Timer <= diff) + //TrampleTimer + if (TrampleTimer <= diff) { DoCast(me, SPELL_TRAMPLE); - Trample_Timer = 8000; + TrampleTimer = 8000; } - else Trample_Timer -= diff; + else TrampleTimer -= diff; //Landslide if (HealthBelowPct(50)) { - if (Landslide_Timer <= diff) + if (LandslideTimer <= diff) { me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_LANDSLIDE); - Landslide_Timer = 60000; + LandslideTimer = 60000; } - else Landslide_Timer -= diff; + else LandslideTimer -= diff; } DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp index 18ce7be0f0a..ece3ff83776 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp @@ -23,7 +23,9 @@ SDComment: SDCategory: Maraudon EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" + enum Spells { SPELL_TOXICVOLLEY = 21687, @@ -44,24 +46,22 @@ public: { boss_noxxionAI(Creature* creature) : ScriptedAI(creature) {} - uint32 ToxicVolley_Timer; - uint32 Uppercut_Timer; - uint32 Adds_Timer; - uint32 Invisible_Timer; + uint32 ToxicVolleyTimer; + uint32 UppercutTimer; + uint32 AddsTimer; + uint32 InvisibleTimer; bool Invisible; void Reset() { - ToxicVolley_Timer = 7000; - Uppercut_Timer = 16000; - Adds_Timer = 19000; - Invisible_Timer = 15000; //Too much too low? + ToxicVolleyTimer = 7000; + UppercutTimer = 16000; + AddsTimer = 19000; + InvisibleTimer = 15000; //Too much too low? Invisible = false; } - void EnterCombat(Unit* /*who*/) - { - } + void EnterCombat(Unit* /*who*/) {} void SummonAdds(Unit* victim) { @@ -71,7 +71,7 @@ public: void UpdateAI(const uint32 diff) { - if (Invisible && Invisible_Timer <= diff) + if (Invisible && InvisibleTimer <= diff) { //Become visible again me->setFaction(14); @@ -83,7 +83,7 @@ public: } else if (Invisible) { - Invisible_Timer -= diff; + InvisibleTimer -= diff; //Do nothing while invisible return; } @@ -92,24 +92,24 @@ public: if (!UpdateVictim()) return; - //ToxicVolley_Timer - if (ToxicVolley_Timer <= diff) + //ToxicVolleyTimer + if (ToxicVolleyTimer <= diff) { - DoCast(me->getVictim(), SPELL_TOXICVOLLEY); - ToxicVolley_Timer = 9000; + DoCastVictim(SPELL_TOXICVOLLEY); + ToxicVolleyTimer = 9000; } - else ToxicVolley_Timer -= diff; + else ToxicVolleyTimer -= diff; - //Uppercut_Timer - if (Uppercut_Timer <= diff) + //UppercutTimer + if (UppercutTimer <= diff) { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 12000; + DoCastVictim(SPELL_UPPERCUT); + UppercutTimer = 12000; } - else Uppercut_Timer -= diff; + else UppercutTimer -= diff; - //Adds_Timer - if (!Invisible && Adds_Timer <= diff) + //AddsTimer + if (!Invisible && AddsTimer <= diff) { //Interrupt any spell casting //me->m_canMove = true; @@ -124,11 +124,11 @@ public: SummonAdds(me->getVictim()); SummonAdds(me->getVictim()); Invisible = true; - Invisible_Timer = 15000; + InvisibleTimer = 15000; - Adds_Timer = 40000; + AddsTimer = 40000; } - else Adds_Timer -= diff; + else AddsTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp index 039d30071d2..1f887d7ce64 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Maraudon EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { @@ -47,17 +48,17 @@ public: { boss_ptheradrasAI(Creature* creature) : ScriptedAI(creature) {} - uint32 Dustfield_Timer; - uint32 Boulder_Timer; - uint32 Thrash_Timer; - uint32 RepulsiveGaze_Timer; + uint32 DustfieldTimer; + uint32 BoulderTimer; + uint32 ThrashTimer; + uint32 RepulsiveGazeTimer; void Reset() { - Dustfield_Timer = 8000; - Boulder_Timer = 2000; - Thrash_Timer = 5000; - RepulsiveGaze_Timer = 23000; + DustfieldTimer = 8000; + BoulderTimer = 2000; + ThrashTimer = 5000; + RepulsiveGazeTimer = 23000; } void EnterCombat(Unit* /*who*/) {} @@ -72,40 +73,38 @@ public: if (!UpdateVictim()) return; - //Dustfield_Timer - if (Dustfield_Timer <= diff) + //DustfieldTimer + if (DustfieldTimer <= diff) { DoCast(me, SPELL_DUSTFIELD); - Dustfield_Timer = 14000; + DustfieldTimer = 14000; } - else Dustfield_Timer -= diff; + else DustfieldTimer -= diff; - //Boulder_Timer - if (Boulder_Timer <= diff) + //BoulderTimer + if (BoulderTimer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_BOULDER); - Boulder_Timer = 10000; + BoulderTimer = 10000; } - else Boulder_Timer -= diff; + else BoulderTimer -= diff; - //RepulsiveGaze_Timer - if (RepulsiveGaze_Timer <= diff) + //RepulsiveGazeTimer + if (RepulsiveGazeTimer <= diff) { - DoCast(me->getVictim(), SPELL_REPULSIVEGAZE); - RepulsiveGaze_Timer = 20000; + DoCastVictim(SPELL_REPULSIVEGAZE); + RepulsiveGazeTimer = 20000; } - else RepulsiveGaze_Timer -= diff; + else RepulsiveGazeTimer -= diff; - //Thrash_Timer - if (Thrash_Timer <= diff) + //ThrashTimer + if (ThrashTimer <= diff) { DoCast(me, SPELL_THRASH); - Thrash_Timer = 18000; + ThrashTimer = 18000; } - else Thrash_Timer -= diff; + else ThrashTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 6e6e089ba02..1fdf941d75c 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -25,10 +25,15 @@ SDComment: SDCategory: Onyxia's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "onyxias_lair.h" -enum eYells +enum Yells { SAY_AGGRO = -1249000, SAY_KILL = -1249001, @@ -37,7 +42,7 @@ enum eYells EMOTE_BREATH = -1249004, }; -enum eSpells +enum Spells { // Phase 1 spells SPELL_WING_BUFFET = 18500, @@ -67,15 +72,15 @@ enum eSpells SPELL_BELLOWING_ROAR = 18431, }; -struct sOnyxMove +struct OnyxMove { - uint32 uiLocId; - uint32 uiLocIdEnd; - uint32 uiSpellId; + uint8 LocId; + uint8 LocIdEnd; + uint32 SpellId; float fX, fY, fZ; }; -static sOnyxMove aMoveData[]= +static OnyxMove MoveData[8]= { {0, 1, SPELL_BREATH_WEST_TO_EAST, -33.5561f, -182.682f, -56.9457f}, //west {1, 0, SPELL_BREATH_EAST_TO_WEST, -31.4963f, -250.123f, -55.1278f}, //east @@ -87,11 +92,11 @@ static sOnyxMove aMoveData[]= {7, 6, SPELL_BREATH_NORTH_TO_SOUTH, 22.8763f, -217.152f, -55.0548f}, //north }; -const Position MiddleRoomLocation = {-23.6155f, -215.357f, -55.7344f, 0.0f}; +Position const MiddleRoomLocation = {-23.6155f, -215.357f, -55.7344f, 0.0f}; -const Position Phase2Location = {-80.924f, -214.299f, -82.942f, 0.0f}; +Position const Phase2Location = {-80.924f, -214.299f, -82.942f, 0.0f}; -static Position aSpawnLocations[3]= +Position const SpawnLocations[3]= { //Whelps {-30.127f, -254.463f, -89.440f, 0.0f}, @@ -121,58 +126,58 @@ public: InstanceScript* instance; SummonList Summons; - uint32 m_uiPhase; + uint32 Phase; - uint32 m_uiFlameBreathTimer; - uint32 m_uiCleaveTimer; - uint32 m_uiTailSweepTimer; - uint32 m_uiWingBuffetTimer; + uint32 FlameBreathTimer; + uint32 CleaveTimer; + uint32 TailSweepTimer; + uint32 WingBuffetTimer; - uint32 m_uiMovePoint; - uint32 m_uiMovementTimer; - sOnyxMove* m_pPointData; + uint8 MovePoint; + uint32 MovementTimer; + OnyxMove* PointData; - uint32 m_uiFireballTimer; - uint32 m_uiWhelpTimer; - uint32 m_uiLairGuardTimer; - uint32 m_uiDeepBreathTimer; + uint32 FireballTimer; + uint32 WhelpTimer; + uint32 LairGuardTimer; + uint32 DeepBreathTimer; - uint32 m_uiBellowingRoarTimer; + uint32 BellowingRoarTimer; - uint8 m_uiSummonWhelpCount; - bool m_bIsMoving; + uint8 SummonWhelpCount; + bool IsMoving; void Reset() { if (!IsCombatMovementAllowed()) SetCombatMovement(true); - m_uiPhase = PHASE_START; + Phase = PHASE_START; - m_uiFlameBreathTimer = urand(10000, 20000); - m_uiTailSweepTimer = urand(15000, 20000); - m_uiCleaveTimer = urand(2000, 5000); - m_uiWingBuffetTimer = urand(10000, 20000); + FlameBreathTimer = urand(10000, 20000); + TailSweepTimer = urand(15000, 20000); + CleaveTimer = urand(2000, 5000); + WingBuffetTimer = urand(10000, 20000); - m_uiMovePoint = urand(0, 5); - m_uiMovementTimer = 14000; - m_pPointData = GetMoveData(); + MovePoint = urand(0, 5); + MovementTimer = 14000; + PointData = GetMoveData(); - m_uiFireballTimer = 15000; - m_uiWhelpTimer = 60000; - m_uiLairGuardTimer = 60000; - m_uiDeepBreathTimer = 85000; + FireballTimer = 15000; + WhelpTimer = 60000; + LairGuardTimer = 60000; + DeepBreathTimer = 85000; - m_uiBellowingRoarTimer = 30000; + BellowingRoarTimer = 30000; Summons.DespawnAll(); - m_uiSummonWhelpCount = 0; - m_bIsMoving = false; + SummonWhelpCount = 0; + IsMoving = false; if (instance) { instance->SetData(DATA_ONYXIA, NOT_STARTED); - instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + instance->SetData(DATA_ONYXIA_PHASE, Phase); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } @@ -206,7 +211,7 @@ public: switch (summoned->GetEntry()) { case NPC_WHELP: - ++m_uiSummonWhelpCount; + ++SummonWhelpCount; break; case NPC_LAIRGUARD: summoned->setActive(true); @@ -225,17 +230,17 @@ public: DoScriptText(SAY_KILL, me); } - void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) + void SpellHit(Unit* /*pCaster*/, const SpellInfo* Spell) { - if (pSpell->Id == SPELL_BREATH_EAST_TO_WEST || - pSpell->Id == SPELL_BREATH_WEST_TO_EAST || - pSpell->Id == SPELL_BREATH_SE_TO_NW || - pSpell->Id == SPELL_BREATH_NW_TO_SE || - pSpell->Id == SPELL_BREATH_SW_TO_NE || - pSpell->Id == SPELL_BREATH_NE_TO_SW) + if (Spell->Id == SPELL_BREATH_EAST_TO_WEST || + Spell->Id == SPELL_BREATH_WEST_TO_EAST || + Spell->Id == SPELL_BREATH_SE_TO_NW || + Spell->Id == SPELL_BREATH_NW_TO_SE || + Spell->Id == SPELL_BREATH_SW_TO_NE || + Spell->Id == SPELL_BREATH_NE_TO_SW) { - m_pPointData = GetMoveData(); - m_uiMovePoint = m_pPointData->uiLocIdEnd; + PointData = GetMoveData(); + MovePoint = PointData->LocIdEnd; me->SetSpeed(MOVE_FLIGHT, 1.5f); me->GetMotionMaster()->MovePoint(8, MiddleRoomLocation); @@ -249,16 +254,16 @@ public: switch (id) { case 8: - m_pPointData = GetMoveData(); - if (m_pPointData) + PointData = GetMoveData(); + if (PointData) { me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ); } break; case 9: me->GetMotionMaster()->MoveChase(me->getVictim()); - m_uiBellowingRoarTimer = 1000; + BellowingRoarTimer = 1000; break; case 10: me->SetCanFly(true); @@ -266,39 +271,39 @@ public: me->SetSpeed(MOVE_FLIGHT, 1.0f); DoScriptText(SAY_PHASE_2_TRANS, me); if (instance) - instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); - m_uiWhelpTimer = 5000; - m_uiLairGuardTimer = 15000; + instance->SetData(DATA_ONYXIA_PHASE, Phase); + WhelpTimer = 5000; + LairGuardTimer = 15000; break; case 11: - if (m_pPointData) - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + if (PointData) + me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ); me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); break; default: - m_bIsMoving = false; + IsMoving = false; break; } } } - void SpellHitTarget(Unit* target, const SpellInfo* pSpell) + void SpellHitTarget(Unit* target, const SpellInfo* Spell) { //Workaround - Couldn't find a way to group this spells (All Eruption) - if (((pSpell->Id >= 17086 && pSpell->Id <= 17095) || - (pSpell->Id == 17097) || - (pSpell->Id >= 18351 && pSpell->Id <= 18361) || - (pSpell->Id >= 18564 && pSpell->Id <= 18576) || - (pSpell->Id >= 18578 && pSpell->Id <= 18607) || - (pSpell->Id == 18609) || - (pSpell->Id >= 18611 && pSpell->Id <= 18628) || - (pSpell->Id >= 21132 && pSpell->Id <= 21133) || - (pSpell->Id >= 21135 && pSpell->Id <= 21139) || - (pSpell->Id >= 22191 && pSpell->Id <= 22202) || - (pSpell->Id >= 22267 && pSpell->Id <= 22268)) && + if (((Spell->Id >= 17086 && Spell->Id <= 17095) || + (Spell->Id == 17097) || + (Spell->Id >= 18351 && Spell->Id <= 18361) || + (Spell->Id >= 18564 && Spell->Id <= 18576) || + (Spell->Id >= 18578 && Spell->Id <= 18607) || + (Spell->Id == 18609) || + (Spell->Id >= 18611 && Spell->Id <= 18628) || + (Spell->Id >= 21132 && Spell->Id <= 21133) || + (Spell->Id >= 21135 && Spell->Id <= 21139) || + (Spell->Id >= 22191 && Spell->Id <= 22202) || + (Spell->Id >= 22267 && Spell->Id <= 22268)) && (target->GetTypeId() == TYPEID_PLAYER)) { if (instance) @@ -308,14 +313,14 @@ public: } } - sOnyxMove* GetMoveData() + OnyxMove* GetMoveData() { - uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); + uint8 MaxCount = sizeof(MoveData)/sizeof(OnyxMove); - for (uint32 i = 0; i < uiMaxCount; ++i) + for (uint8 i = 0; i < MaxCount; ++i) { - if (aMoveData[i].uiLocId == m_uiMovePoint) - return &aMoveData[i]; + if (MoveData[i].LocId == MovePoint) + return &MoveData[i]; } return NULL; @@ -323,84 +328,84 @@ public: void SetNextRandomPoint() { - uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); + uint8 MaxCount = sizeof(MoveData)/sizeof(OnyxMove); - uint32 iTemp = rand()%(uiMaxCount-1); + uint8 iTemp = urand(0, MaxCount-1); - if (iTemp >= m_uiMovePoint) + if (iTemp >= MovePoint) ++iTemp; - m_uiMovePoint = iTemp; + MovePoint = iTemp; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (!UpdateVictim()) return; //Common to PHASE_START && PHASE_END - if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END) + if (Phase == PHASE_START || Phase == PHASE_END) { //Specific to PHASE_START || PHASE_END - if (m_uiPhase == PHASE_START) + if (Phase == PHASE_START) { if (HealthBelowPct(60)) { SetCombatMovement(false); - m_uiPhase = PHASE_BREATH; + Phase = PHASE_BREATH; me->GetMotionMaster()->MovePoint(10, Phase2Location); return; } } else { - if (m_uiBellowingRoarTimer <= uiDiff) + if (BellowingRoarTimer <= Diff) { DoCastVictim(SPELL_BELLOWING_ROAR); // Eruption - GameObject* pFloor = NULL; + GameObject* Floor = NULL; Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15); - Trinity::GameObjectLastSearcher searcher(me, pFloor, check); + Trinity::GameObjectLastSearcher searcher(me, Floor, check); me->VisitNearbyGridObject(30, searcher); - if (instance && pFloor) - instance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID()); - m_uiBellowingRoarTimer = 30000; + if (instance && Floor) + instance->SetData64(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID()); + BellowingRoarTimer = 30000; } else - m_uiBellowingRoarTimer -= uiDiff; + BellowingRoarTimer -= Diff; } - if (m_uiFlameBreathTimer <= uiDiff) + if (FlameBreathTimer <= Diff) { DoCastVictim(SPELL_FLAME_BREATH); - m_uiFlameBreathTimer = urand(10000, 20000); + FlameBreathTimer = urand(10000, 20000); } else - m_uiFlameBreathTimer -= uiDiff; + FlameBreathTimer -= Diff; - if (m_uiTailSweepTimer <= uiDiff) + if (TailSweepTimer <= Diff) { DoCastAOE(SPELL_TAIL_SWEEP); - m_uiTailSweepTimer = urand(15000, 20000); + TailSweepTimer = urand(15000, 20000); } else - m_uiTailSweepTimer -= uiDiff; + TailSweepTimer -= Diff; - if (m_uiCleaveTimer <= uiDiff) + if (CleaveTimer <= Diff) { DoCastVictim(SPELL_CLEAVE); - m_uiCleaveTimer = urand(2000, 5000); + CleaveTimer = urand(2000, 5000); } else - m_uiCleaveTimer -= uiDiff; + CleaveTimer -= Diff; - if (m_uiWingBuffetTimer <= uiDiff) + if (WingBuffetTimer <= Diff) { DoCastVictim(SPELL_WING_BUFFET); - m_uiWingBuffetTimer = urand(15000, 30000); + WingBuffetTimer = urand(15000, 30000); } else - m_uiWingBuffetTimer -= uiDiff; + WingBuffetTimer -= Diff; DoMeleeAttackIfReady(); } @@ -408,86 +413,86 @@ public: { if (HealthBelowPct(40)) { - m_uiPhase = PHASE_END; + Phase = PHASE_END; if (instance) - instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + instance->SetData(DATA_ONYXIA_PHASE, Phase); DoScriptText(SAY_PHASE_3_TRANS, me); SetCombatMovement(true); me->SetCanFly(false); - m_bIsMoving = false; + IsMoving = false; me->GetMotionMaster()->MovePoint(9, me->GetHomePosition()); return; } - if (m_uiDeepBreathTimer <= uiDiff) + if (DeepBreathTimer <= Diff) { - if (!m_bIsMoving) + if (!IsMoving) { if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); DoScriptText(EMOTE_BREATH, me); - DoCast(me, m_pPointData->uiSpellId); - m_uiDeepBreathTimer = 70000; + DoCast(me, PointData->SpellId); + DeepBreathTimer = 70000; } } else - m_uiDeepBreathTimer -= uiDiff; + DeepBreathTimer -= Diff; - if (m_uiMovementTimer <= uiDiff) + if (MovementTimer <= Diff) { - if (!m_bIsMoving) + if (!IsMoving) { SetNextRandomPoint(); - m_pPointData = GetMoveData(); + PointData = GetMoveData(); - if (!m_pPointData) + if (!PointData) return; - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); - m_bIsMoving = true; - m_uiMovementTimer = 25000; + me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ); + IsMoving = true; + MovementTimer = 25000; } } else - m_uiMovementTimer -= uiDiff; + MovementTimer -= Diff; - if (m_uiFireballTimer <= uiDiff) + if (FireballTimer <= Diff) { if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_FIREBALL); - m_uiFireballTimer = 8000; + FireballTimer = 8000; } } else - m_uiFireballTimer -= uiDiff; + FireballTimer -= Diff; - if (m_uiLairGuardTimer <= uiDiff) + if (LairGuardTimer <= Diff) { - me->SummonCreature(NPC_LAIRGUARD, aSpawnLocations[2].GetPositionX(), aSpawnLocations[2].GetPositionY(), aSpawnLocations[2].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - m_uiLairGuardTimer = 30000; + me->SummonCreature(NPC_LAIRGUARD, SpawnLocations[2], TEMPSUMMON_CORPSE_DESPAWN); + LairGuardTimer = 30000; } else - m_uiLairGuardTimer -= uiDiff; + LairGuardTimer -= Diff; - if (m_uiWhelpTimer <= uiDiff) + if (WhelpTimer <= Diff) { - me->SummonCreature(NPC_WHELP, aSpawnLocations[0].GetPositionX(), aSpawnLocations[0].GetPositionY(), aSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_WHELP, aSpawnLocations[1].GetPositionX(), aSpawnLocations[1].GetPositionY(), aSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - if (m_uiSummonWhelpCount >= RAID_MODE(20, 40)) + me->SummonCreature(NPC_WHELP, SpawnLocations[0], TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_WHELP, SpawnLocations[1], TEMPSUMMON_CORPSE_DESPAWN); + if (SummonWhelpCount >= RAID_MODE(20, 40)) { - m_uiSummonWhelpCount = 0; - m_uiWhelpTimer = 90000; + SummonWhelpCount = 0; + WhelpTimer = 90000; } else - m_uiWhelpTimer = 500; + WhelpTimer = 500; } else - m_uiWhelpTimer -= uiDiff; + WhelpTimer -= Diff; } } }; diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 1c599ce7c6f..0689a8872bb 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -22,7 +22,12 @@ SDComment: SDCategory: Onyxia's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "onyxias_lair.h" class instance_onyxias_lair : public InstanceMapScript @@ -44,27 +49,27 @@ public: std::map FloorEruptionGUID[2]; std::queue FloorEruptionGUIDQueue; - uint64 m_uiOnyxiasGUID; - uint32 m_uiOnyxiaLiftoffTimer; - uint32 m_uiManyWhelpsCounter; - uint32 m_uiEruptTimer; + uint64 OnyxiasGUID; + uint32 OnyxiaLiftoffTimer; + uint32 ManyWhelpsCounter; + uint32 EruptTimer; - uint8 m_auiEncounter[MAX_ENCOUNTER]; + uint8 Encounter[MAX_ENCOUNTER]; - bool m_bAchievManyWhelpsHandleIt; - bool m_bAchievSheDeepBreathMore; + bool AchievManyWhelpsHandleIt; + bool AchievSheDeepBreathMore; void Initialize() { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + memset(&Encounter, 0, sizeof(Encounter)); - m_uiOnyxiasGUID = 0; - m_uiOnyxiaLiftoffTimer = 0; - m_uiManyWhelpsCounter = 0; - m_bAchievManyWhelpsHandleIt = false; - m_bAchievSheDeepBreathMore = true; + OnyxiasGUID = 0; + OnyxiaLiftoffTimer = 0; + ManyWhelpsCounter = 0; + AchievManyWhelpsHandleIt = false; + AchievSheDeepBreathMore = true; - m_uiEruptTimer = 0; + EruptTimer = 0; } void OnCreatureCreate(Creature* creature) @@ -72,7 +77,7 @@ public: switch (creature->GetEntry()) { case NPC_ONYXIA: - m_uiOnyxiasGUID = creature->GetGUID(); + OnyxiasGUID = creature->GetGUID(); break; } } @@ -93,7 +98,7 @@ public: if (Creature* temp = go->SummonCreature(NPC_WHELP, goPos, TEMPSUMMON_CORPSE_DESPAWN)) { temp->SetInCombatWithZone(); - ++m_uiManyWhelpsCounter; + ++ManyWhelpsCounter; } break; } @@ -139,88 +144,88 @@ public: FloorEruptionGUID[1].erase(floorEruptedGUID); } - void SetData(uint32 uiType, uint32 uiData) + void SetData(uint32 Type, uint32 Data) { - switch (uiType) + switch (Type) { case DATA_ONYXIA: - m_auiEncounter[0] = uiData; - if (uiData == IN_PROGRESS) + Encounter[0] = Data; + if (Data == IN_PROGRESS) SetData(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS); break; case DATA_ONYXIA_PHASE: - if (uiData == PHASE_BREATH) //Used to mark the liftoff phase + if (Data == PHASE_BREATH) //Used to mark the liftoff phase { - m_bAchievManyWhelpsHandleIt = false; - m_uiManyWhelpsCounter = 0; - m_uiOnyxiaLiftoffTimer = 10*IN_MILLISECONDS; + AchievManyWhelpsHandleIt = false; + ManyWhelpsCounter = 0; + OnyxiaLiftoffTimer = 10*IN_MILLISECONDS; } break; case DATA_SHE_DEEP_BREATH_MORE: - if (uiData == IN_PROGRESS) + if (Data == IN_PROGRESS) { - m_bAchievSheDeepBreathMore = true; + AchievSheDeepBreathMore = true; } - else if (uiData == FAIL) + else if (Data == FAIL) { - m_bAchievSheDeepBreathMore = false; + AchievSheDeepBreathMore = false; } break; } - if (uiType < MAX_ENCOUNTER && uiData == DONE) + if (Type < MAX_ENCOUNTER && Data == DONE) SaveToDB(); } - void SetData64(uint32 uiType, uint64 uiData) + void SetData64(uint32 Type, uint64 Data) { - switch (uiType) + switch (Type) { case DATA_FLOOR_ERUPTION_GUID: FloorEruptionGUID[1] = FloorEruptionGUID[0]; - FloorEruptionGUIDQueue.push(uiData); - m_uiEruptTimer = 2500; + FloorEruptionGUIDQueue.push(Data); + EruptTimer = 2500; break; } } - uint32 GetData(uint32 uiType) + uint32 GetData(uint32 Type) { - switch (uiType) + switch (Type) { case DATA_ONYXIA: - return m_auiEncounter[0]; + return Encounter[0]; } return 0; } - uint64 GetData64(uint32 uiData) + uint64 GetData64(uint32 Data) { - switch (uiData) + switch (Data) { case DATA_ONYXIA_GUID: - return m_uiOnyxiasGUID; + return OnyxiasGUID; } return 0; } - void Update(uint32 uiDiff) + void Update(uint32 Diff) { if (GetData(DATA_ONYXIA) == IN_PROGRESS) { - if (m_uiOnyxiaLiftoffTimer && m_uiOnyxiaLiftoffTimer <= uiDiff) + if (OnyxiaLiftoffTimer && OnyxiaLiftoffTimer <= Diff) { - m_uiOnyxiaLiftoffTimer = 0; - if (m_uiManyWhelpsCounter >= 50) - m_bAchievManyWhelpsHandleIt = true; - } else m_uiOnyxiaLiftoffTimer -= uiDiff; + OnyxiaLiftoffTimer = 0; + if (ManyWhelpsCounter >= 50) + AchievManyWhelpsHandleIt = true; + } else OnyxiaLiftoffTimer -= Diff; } if (!FloorEruptionGUIDQueue.empty()) { - if (m_uiEruptTimer <= uiDiff) + if (EruptTimer <= Diff) { uint32 treeHeight = 0; do @@ -229,10 +234,10 @@ public: FloorEruption(FloorEruptionGUIDQueue.front()); FloorEruptionGUIDQueue.pop(); } while (!FloorEruptionGUIDQueue.empty() && (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second == treeHeight); - m_uiEruptTimer = 1000; + EruptTimer = 1000; } else - m_uiEruptTimer -= uiDiff; + EruptTimer -= Diff; } } @@ -242,10 +247,10 @@ public: { case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s - return m_bAchievManyWhelpsHandleIt; + return AchievManyWhelpsHandleIt; case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath - return m_bAchievSheDeepBreathMore; + return AchievSheDeepBreathMore; } return false; } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h index eaf6cac43af..26fd9284ea2 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h +++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h @@ -18,13 +18,13 @@ #ifndef DEF_ONYXIAS_LAIR_H #define DEF_ONYXIAS_LAIR_H -enum eData64 +enum Data64 { DATA_ONYXIA_GUID, DATA_FLOOR_ERUPTION_GUID }; -enum eInstanceData +enum InstanceData { DATA_ONYXIA, MAX_ENCOUNTER, @@ -34,7 +34,7 @@ enum eInstanceData DATA_MANY_WHELPS_COUNT }; -enum eCreatures +enum Creatures { NPC_WHELP = 11262, NPC_LAIRGUARD = 36561, @@ -42,20 +42,20 @@ enum eCreatures NPC_ONYXIA = 10184 }; -enum eOnyxiaPhases +enum OnyxiaPhases { PHASE_START = 1, PHASE_BREATH = 2, PHASE_END = 3 }; -enum eGameObjects +enum GameObjects { GO_WHELP_SPAWNER = 176510, GO_WHELP_EGG = 176511 }; -enum eAchievementData +enum AchievementData { ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER = 12565, // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER = 12568, // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s -- cgit v1.2.3 From b90050a528f685865fdc5a7430c2631548ac42f7 Mon Sep 17 00:00:00 2001 From: zori Date: Sat, 2 Jun 2012 18:38:02 +0200 Subject: Core/Movement: Properly handle cases when jumping from one transport directly to another --- src/server/game/Handlers/MovementHandler.cpp | 40 +++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index c271a43462a..ff9030f04d5 100755 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -295,16 +295,42 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) } // if we boarded a transport, add us to it - if (plrMover && !plrMover->GetTransport()) + if (plrMover) { - // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list - for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter) + if (!plrMover->GetTransport()) { - if ((*iter)->GetGUID() == movementInfo.t_guid) + // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list + for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter) { - plrMover->m_transport = (*iter); - (*iter)->AddPassenger(plrMover); - break; + if ((*iter)->GetGUID() == movementInfo.t_guid) + { + plrMover->m_transport = *iter; + (*iter)->AddPassenger(plrMover); + break; + } + } + } + else if (plrMover->GetTransport()->GetGUID() != movementInfo.t_guid) + { + bool foundNewTransport = false; + plrMover->m_transport->RemovePassenger(plrMover); + for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter) + { + if ((*iter)->GetGUID() == movementInfo.t_guid) + { + foundNewTransport = true; + plrMover->m_transport = *iter; + (*iter)->AddPassenger(plrMover); + break; + } + } + + if (!foundNewTransport) + { + plrMover->m_transport = NULL; + movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); + movementInfo.t_time = 0; + movementInfo.t_seat = -1; } } } -- cgit v1.2.3 From 79e00cfcbe13c22e8d2f56ec0c8e217452a46cd2 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 2 Jun 2012 16:14:36 +0200 Subject: Core/Movement: Add missing SplineFlags / SplineTypes to enums --- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Entities/Unit/Unit.h | 43 ++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c90b86f2349..bb2d057bfaa 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -435,7 +435,7 @@ void Unit::SendMonsterMoveExitVehicle(Position const* newPos) data << uint8(SPLINETYPE_FACING_ANGLE); data << float(GetOrientation()); // guess - data << uint32(SPLINEFLAG_EXIT_VEHICLE); + data << uint32(SPLINEFLAG_TRANSPORT_EXIT); data << uint32(0); // Time in between points data << uint32(1); // 1 single waypoint data << newPos->GetPositionX(); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index f246f595dec..65a165b40d2 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -737,15 +737,48 @@ enum MovementFlags2 enum SplineFlags { - SPLINEFLAG_WALKMODE = 0x00001000, - SPLINEFLAG_FLYING = 0x00002000, - SPLINEFLAG_TRANSPORT = 0x00800000, - SPLINEFLAG_EXIT_VEHICLE = 0x01000000, + SPLINEFLAG_NONE = 0x00000000, + SPLINEFLAG_FORWARD = 0x00000001, + SPLINEFLAG_BACKWARD = 0x00000002, + SPLINEFLAG_STRAFE_LEFT = 0x00000004, + SPLINEFLAG_STRAFE_RIGHT = 0x00000008, + SPLINEFLAG_TURN_LEFT = 0x00000010, + SPLINEFLAG_TURN_RIGHT = 0x00000020, + SPLINEFLAG_PITCH_UP = 0x00000040, + SPLINEFLAG_PITCH_DOWN = 0x00000080, + SPLINEFLAG_DONE = 0x00000100, + SPLINEFLAG_FALLING = 0x00000200, + SPLINEFLAG_NO_SPLINE = 0x00000400, + SPLINEFLAG_TRAJECTORY = 0x00000800, + SPLINEFLAG_WALK_MODE = 0x00001000, + SPLINEFLAG_FLYING = 0x00002000, + SPLINEFLAG_KNOCKBACK = 0x00004000, + SPLINEFLAG_FINAL_POINT = 0x00008000, + SPLINEFLAG_FINAL_TARGET = 0x00010000, + SPLINEFLAG_FINAL_FACING = 0x00020000, + SPLINEFLAG_CATMULL_ROM = 0x00040000, + SPLINEFLAG_CYCLIC = 0x00080000, + SPLINEFLAG_ENTER_CYCLE = 0x00100000, + SPLINEFLAG_ANIMATION_TIER = 0x00200000, + SPLINEFLAG_FROZEN = 0x00400000, + SPLINEFLAG_TRANSPORT = 0x00800000, + SPLINEFLAG_TRANSPORT_EXIT = 0x01000000, + SPLINEFLAG_UNKNOWN7 = 0x02000000, + SPLINEFLAG_UNKNOWN8 = 0x04000000, + SPLINEFLAG_ORIENTATION_INVERTED = 0x08000000, + SPLINEFLAG_USE_PATH_SMOOTHING = 0x10000000, + SPLINEFLAG_ANIMATION = 0x20000000, + SPLINEFLAG_UNCOMPRESSED_PATH = 0x40000000, + SPLINEFLAG_UNKNOWN10 = 0x80000000, }; enum SplineType { - SPLINETYPE_FACING_ANGLE = 4, + SPLINETYPE_NORMAL = 0, + SPLINETYPE_STOP = 1, + SPLINETYPE_FACING_SPOT = 2, + SPLINETYPE_FACING_TARGET = 3, + SPLINETYPE_FACING_ANGLE = 4, }; enum UnitTypeMask -- cgit v1.2.3 From 7e454b26ac28250967dbd3519a39ecb5eb6cd014 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sun, 3 Jun 2012 02:35:00 +0200 Subject: more updates --- .../2012_05_28_01_world_spell_script_names.sql | 28 +- .../2012_05_28_02_world_spelldifficulty_dbc.sql | 7 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 122 +------- src/server/game/Spells/Spell.cpp | 43 --- src/server/game/Spells/SpellEffects.cpp | 340 +-------------------- .../BattleForMountHyjal/boss_kazrogal.cpp | 102 +++++-- .../Ulduar/HallsOfStone/boss_krystallus.cpp | 78 ++++- .../scripts/Outland/GruulsLair/boss_gruul.cpp | 89 +++++- .../scripts/Outland/boss_doomlord_kazzak.cpp | 54 +++- src/server/scripts/Spells/spell_dk.cpp | 11 - src/server/scripts/Spells/spell_druid.cpp | 167 +++++++++- src/server/scripts/Spells/spell_generic.cpp | 242 +++++++++++++++ src/server/scripts/Spells/spell_hunter.cpp | 55 +++- src/server/scripts/Spells/spell_paladin.cpp | 39 +++ src/server/scripts/Spells/spell_shaman.cpp | 49 +++ 15 files changed, 882 insertions(+), 544 deletions(-) (limited to 'src') diff --git a/sql/updates/world/2012_05_28_01_world_spell_script_names.sql b/sql/updates/world/2012_05_28_01_world_spell_script_names.sql index 78054aa1555..e1db8fff869 100644 --- a/sql/updates/world/2012_05_28_01_world_spell_script_names.sql +++ b/sql/updates/world/2012_05_28_01_world_spell_script_names.sql @@ -1,9 +1,13 @@ -DELETE FROM `spell_script_names` WHERE `spell_id` IN (-633,781,-746,-8050,-34914,-44457,-48181,-30108,34438,34439,35183,43522,65812,68154,68155,68156,-33763,43421,52551,53608,57762,59990,66093,67957,67958,67959,7057,28832,28833,28834,28835,27831,55638,52942,59837,63322); +DELETE FROM `spell_script_names` WHERE `spell_id` IN (-633,781,-746,1515,6495,-8050,-16972,31789,-34914,-44457,-48181,-30108,34438,34439,35183,43522,65812,68154,68155,68156,52610,61336,-33763,40133,40132,43421,52551,53608,57762,59990,66093,67957,67958,67959,7057,28832,28833,28834,28835,27831,55638,31447,32960,33654,33671,50810,61546,50811,61547,52942,59837,63322,47977,48025,54729,71342,72286,74856,75614,75973); INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (-633, 'spell_pal_lay_on_hands'), (781, 'spell_hun_disengage'), (-746, 'spell_gen_bandage'), +(1515, 'spell_hun_tame_beast'), +(6495, 'spell_sha_sentry_totem'), (-8050, 'spell_sha_flame_shock'), +(-16972,'spell_dru_predatory_strikes'), +(31789, 'spell_pal_righteous_defense'), (-34914,'spell_pri_vampiric_touch'), (-44457,'spell_mage_living_bomb'), (-48181,'spell_warl_haunt'), @@ -16,7 +20,11 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (68154, 'spell_faction_champion_warl_unstable_affliction'), (68155, 'spell_faction_champion_warl_unstable_affliction'), (68156, 'spell_faction_champion_warl_unstable_affliction'), +(52610, 'spell_dru_savage_roar'), +(61336, 'spell_dru_survival_instincts'), (-33763,'spell_dru_lifebloom'), +(40133, 'spell_gen_summon_fire_elemental'), +(40132, 'spell_gen_summon_earth_elemental'), (43421, 'spell_hexlord_lifebloom'), (52551, 'spell_tur_ragepaw_lifebloom'), (53608, 'spell_cenarion_scout_lifebloom'), @@ -33,6 +41,22 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (28835, 'spell_four_horsemen_mark'), (27831, 'spell_gothic_shadow_bolt_volley'), (55638, 'spell_gothic_shadow_bolt_volley'), +(31447, 'spell_mark_of_kazrogal'), +(32960, 'spell_mark_of_kazzak'), +(33654, 'spell_gruul_shatter'), +(33671, 'spell_gruul_shatter_effect'), +(50810, 'spell_krystallus_shatter'), +(61546, 'spell_krystallus_shatter'), +(50811, 'spell_krystallus_shatter_effect'), +(61547, 'spell_krystallus_shatter_effect'), (52942, 'spell_loken_pulsing_shockwave'), (59837, 'spell_loken_pulsing_shockwave'), -(63322, 'spell_general_vezax_saronite_vapors'); +(63322, 'spell_general_vezax_saronite_vapors'), +(47977, 'spell_magic_broom'), +(48025, 'spell_headless_horseman_mount'), +(54729, 'spell_winged_steed_of_the_ebon_blade'), +(71342, 'spell_big_love_rocket'), +(72286, 'spell_invincible'), +(74856, 'spell_blazing_hippogryph'), +(75614, 'spell_celestial_steed'), +(75973, 'spell_x53_touring_rocket'); diff --git a/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql b/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql index 93749c9c5cd..8caaf1a6fc7 100644 --- a/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql +++ b/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql @@ -1,5 +1,6 @@ SET @DIFF := xxxx; -- set by TDB team -DELETE FROM `spelldifficulty_dbc` WHERE `id` IN (@DIFF+0,@DIFF+1); +DELETE FROM `spelldifficulty_dbc` WHERE `id` BETWEEN @DIFF+0 AND @DIFF+2; INSERT INTO `spelldifficulty_dbc` (`id`,`spelld0`,`spellid1`,`spelld2`,`spellid3`) VALUES -(@DIFF+0,57762,57763,0,0), -(@DIFF+1,59990,61489,0,0); +(@DIFF+0,50811,61547,0,0), +(@DIFF+1,57762,59990,0,0), +(@DIFF+2,57763,61489,0,0); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 84007370a9a..6783efea5f9 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4948,38 +4948,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->SetEntry(apply ? 17654 : 17326); break; } - //Summon Fire Elemental - case 40133: - { - if (!caster) - break; - - Unit* owner = caster->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) - { - if (apply) - owner->CastSpell(owner, 8985, true); - else - owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); - } - break; - } - //Summon Earth Elemental - case 40132 : - { - if (!caster) - break; - - Unit* owner = caster->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) - { - if (apply) - owner->CastSpell(owner, 19704, true); - else - owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); - } - break; - } case 57819: // Argent Champion case 57820: // Ebon Champion case 57821: // Champion of the Kirin Tor @@ -5072,69 +5040,14 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool } case SPELLFAMILY_DRUID: { - if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK)) - break; - switch (GetId()) - { - case 52610: // Savage Roar - { - uint32 spellId = 62071; - if (apply) - { - if (target->GetShapeshiftForm() != FORM_CAT) - break; - - target->CastSpell(target, spellId, true, NULL, NULL, GetCasterGUID()); - break; - } - target->RemoveAurasDueToSpell(spellId); - break; - } - case 61336: // Survival Instincts - { - if (!(mode & AURA_EFFECT_HANDLE_REAL)) - break; - - if (apply) - { - if (!target->IsInFeralForm()) - break; - - int32 bp0 = int32(target->CountPctFromMaxHealth(GetAmount())); - target->CastCustomSpell(target, 50322, &bp0, NULL, NULL, true); - } - else - target->RemoveAurasDueToSpell(50322); - break; - } - } - // Predatory Strikes - if (target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->SpellIconID == 1563) - { - target->ToPlayer()->UpdateAttackPowerAndDamage(); - } + //if (!(mode & AURA_EFFECT_HANDLE_REAL)) + //break; break; } case SPELLFAMILY_SHAMAN: { - if (!(mode & AURA_EFFECT_HANDLE_REAL)) - break; - // Sentry Totem - if (GetId() == 6495 && caster && caster->GetTypeId() == TYPEID_PLAYER) - { - if (apply) - { - if (uint64 guid = caster->m_SummonSlot[4]) - { - if (Creature* totem = caster->GetMap()->GetCreature(guid)) - if (totem->isTotem()) - caster->ToPlayer()->CastSpell(totem, 6277, true); - } - } - else - caster->ToPlayer()->StopCastingBindSight(); - return; - } + //if (!(mode & AURA_EFFECT_HANDLE_REAL)) + //break; break; } case SPELLFAMILY_PALADIN: @@ -6428,33 +6341,6 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo()); } - // spell-specific code - switch (GetId()) - { - case 31447: // Mark of Kaz'rogal - if (target->GetPower(powerType) == 0) - { - target->CastSpell(target, 31463, true, 0, this); - // Remove aura - GetBase()->SetDuration(0); - } - break; - case 32960: // Mark of Kazzak - { - int32 modifier = int32(target->GetPower(powerType) * 0.05f); - target->ModifyPower(powerType, -modifier); - - if (target->GetPower(powerType) == 0) - { - target->CastSpell(target, 32961, true, 0, this); - // Remove aura - GetBase()->SetDuration(0); - } - break; - } - default: - break; - } // Drain Mana if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[0] & 0x00000010) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e2fe6159ac5..8165c8172d7 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4960,20 +4960,6 @@ SpellCastResult Spell::CheckCast(bool strict) // for effects of spells that have only one target switch (m_spellInfo->Effects[i].Effect) { - case SPELL_EFFECT_DUMMY: - { - if (m_spellInfo->Id == 31789) // Righteous Defense - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return SPELL_FAILED_DONT_REPORT; - - Unit* target = m_targets.GetUnitTarget(); - if (!target || !target->IsFriendlyTo(m_caster) || target->getAttackers().empty()) - return SPELL_FAILED_BAD_TARGETS; - - } - break; - } case SPELL_EFFECT_LEARN_SPELL: { if (m_caster->GetTypeId() != TYPEID_PLAYER) @@ -5320,35 +5306,6 @@ SpellCastResult Spell::CheckCast(bool strict) //custom check switch (m_spellInfo->Id) { - case 61336: - if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->ToPlayer()->IsInFeralForm()) - return SPELL_FAILED_ONLY_SHAPESHIFT; - break; - case 1515: - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return SPELL_FAILED_BAD_TARGETS; - - if (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget()->GetTypeId() == TYPEID_PLAYER) - return SPELL_FAILED_BAD_IMPLICIT_TARGETS; - - Creature* target = m_targets.GetUnitTarget()->ToCreature(); - - if (target->getLevel() > m_caster->getLevel()) - return SPELL_FAILED_HIGHLEVEL; - - // use SMSG_PET_TAME_FAILURE? - if (!target->GetCreatureTemplate()->isTameable (m_caster->ToPlayer()->CanTameExoticPets())) - return SPELL_FAILED_BAD_TARGETS; - - if (m_caster->GetPetGUID()) - return SPELL_FAILED_ALREADY_HAVE_SUMMON; - - if (m_caster->GetCharmGUID()) - return SPELL_FAILED_ALREADY_HAVE_CHARM; - - break; - } case 44795: // Parachute { float x, y, z; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 547a384920a..2f98bbcf7ec 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -353,21 +353,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) return; break; } - case 33671: // gruul's shatter - case 50811: // krystallus shatter ( Normal ) - case 61547: // krystallus shatter ( Heroic ) - { - // don't damage self and only players - if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster); - if (!radius) - return; - float distance = m_caster->GetDistance2d(unitTarget); - damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * ((radius - distance)/radius)); - break; - } // Gargoyle Strike case 51963: { @@ -3774,12 +3759,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER) return; - uint32 spell_id = 0; - switch (urand(1, 5)) - { - case 1: spell_id = 8854; break; - default: spell_id = 8855; break; - } + uint32 spell_id = roll_chance_i(20) ? 8854 : 8855; m_caster->CastSpell(m_caster, spell_id, true, NULL); return; @@ -3826,10 +3806,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) unitTarget->HandleEmoteCommand(EMOTE_STATE_DANCE); return; } - // Escape artist - case 20589: - m_caster->RemoveMovementImpairingAuras(); - return; // Decimate case 28374: case 54426: @@ -3860,15 +3836,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) DoCreateItem(effIndex, item); break; } - // Improved Sprint - case 30918: - { - // Removes snares and roots. - unitTarget->RemoveMovementImpairingAuras(); - break; - } - // Spirit Walk - case 58876: + case 20589: // Escape artist + case 30918: // Improved Sprint { // Removes snares and roots. unitTarget->RemoveMovementImpairingAuras(); @@ -3886,96 +3855,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } } break; - case 48025: // Headless Horseman's Mount - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 75: unitTarget->CastSpell(unitTarget, 51621, true); break; - case 150: unitTarget->CastSpell(unitTarget, 48024, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 51617, true); - else - unitTarget->CastSpell(unitTarget, 48024, true); - }break; - case 300: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 48023, true); - else - unitTarget->CastSpell(unitTarget, 48024, true); - }break; - } - return; - } - case 47977: // Magic Broom - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 75: unitTarget->CastSpell(unitTarget, 42680, true); break; - case 150: unitTarget->CastSpell(unitTarget, 42683, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 42667, true); - else - unitTarget->CastSpell(unitTarget, 42683, true); - }break; - case 300: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 42668, true); - else - unitTarget->CastSpell(unitTarget, 42683, true); - }break; - } - return; - } // Mug Transformation case 41931: { @@ -4167,25 +4046,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (unitTarget) unitTarget->CastSpell(m_caster, damage, true); return; - // Winged Steed of the Ebon Blade - case 54729: - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill - if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING)) - { - if (skillval >= 300) - unitTarget->CastSpell(unitTarget, 54727, true); - else - unitTarget->CastSpell(unitTarget, 54726, true); - } - return; - } case 57347: // Retrieving (Wintergrasp RP-GG pickup spell) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->GetTypeId() != TYPEID_PLAYER) @@ -4268,188 +4128,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) m_caster->CastSpell(m_caster, 63919, true); return; } - case 71342: // Big Love Rocket - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 0: unitTarget->CastSpell(unitTarget, 71343, true); break; - case 75: unitTarget->CastSpell(unitTarget, 71344, true); break; - case 150: unitTarget->CastSpell(unitTarget, 71345, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 71346, true); - else - unitTarget->CastSpell(unitTarget, 71345, true); - }break; - case 300: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 71347, true); - else - unitTarget->CastSpell(unitTarget, 71345, true); - }break; - } - return; - } - case 72286: // Invincible - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 75: unitTarget->CastSpell(unitTarget, 72281, true); break; - case 150: unitTarget->CastSpell(unitTarget, 72282, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 72283, true); - else - unitTarget->CastSpell(unitTarget, 72282, true); - }break; - case 300: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 72284, true); - else - unitTarget->CastSpell(unitTarget, 72282, true); - }break; - } - return; - } - case 74856: // Blazing Hippogryph - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill - if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING)) - { - if (skillval >= 300) - unitTarget->CastSpell(unitTarget, 74855, true); - else - unitTarget->CastSpell(unitTarget, 74854, true); - } - return; - } - case 75614: // Celestial Steed - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 75: unitTarget->CastSpell(unitTarget, 75619, true); break; - case 150: unitTarget->CastSpell(unitTarget, 75620, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 75617, true); - else - unitTarget->CastSpell(unitTarget, 75620, true); - }break; - case 300: - { - if (canFly) - { - if (unitTarget->ToPlayer()->Has310Flyer(false)) - unitTarget->CastSpell(unitTarget, 76153, true); - else - unitTarget->CastSpell(unitTarget, 75618, true); - } - else - unitTarget->CastSpell(unitTarget, 75620, true); - }break; - } - return; - } - case 75973: // X-53 Touring Rocket - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill - if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING)) - { - if (skillval >= 300) - { - if (unitTarget->ToPlayer()->Has310Flyer(false)) - unitTarget->CastSpell(unitTarget, 76154, true); - else - unitTarget->CastSpell(unitTarget, 75972, true); - } - else - unitTarget->CastSpell(unitTarget, 75957, true); - } - return; - } case 59317: // Teleporting if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -5065,16 +4743,14 @@ void Spell::EffectDisEnchant(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - Player* p_caster = (Player*)m_caster; if (!itemTarget || !itemTarget->GetTemplate()->DisenchantID) return; - p_caster->UpdateCraftSkill(m_spellInfo->Id); - - m_caster->ToPlayer()->SendLoot(itemTarget->GetGUID(), LOOT_DISENCHANTING); + if (Player* caster = m_caster->ToPlayer()) + { + caster->UpdateCraftSkill(m_spellInfo->Id); + caster->SendLoot(itemTarget->GetGUID(), LOOT_DISENCHANTING); + } // item will be removed at disenchanting end } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 407faa19eaa..c1ae04cf4c0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -15,13 +15,20 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" #include "hyjal.h" #include "hyjal_trash.h" -#define SPELL_CLEAVE 31436 -#define SPELL_WARSTOMP 31480 -#define SPELL_MARK 31447 +enum Spells +{ + SPELL_CLEAVE = 31436, + SPELL_WARSTOMP = 31480, + SPELL_MARK = 31447, + SPELL_MARK_DAMAGE = 31463 +}; #define SOUND_ONDEATH 11018 @@ -162,22 +169,10 @@ public: WarStompTimer = 60000; } else WarStompTimer -= diff; - if (me->HasAura(SPELL_MARK)) - me->RemoveAurasDueToSpell(SPELL_MARK); if (MarkTimer <= diff) { - //cast dummy, useful for bos addons - me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID()); + DoCastAOE(SPELL_MARK); - std::list t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (target && target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA) - { - target->CastSpell(target, SPELL_MARK, true);//only cast on mana users - } - } MarkTimerBase -= 5000; if (MarkTimerBase < 5500) MarkTimerBase = 5500; @@ -201,7 +196,80 @@ public: }; +class MarkTargetFilter +{ + public: + bool operator()(Unit* target) const + { + if (target->getPowerType() != POWER_MANA) + return true; + + return false; + } +}; + +class spell_mark_of_kazrogal : public SpellScriptLoader +{ + public: + spell_mark_of_kazrogal() : SpellScriptLoader("spell_mark_of_kazrogal") { } + + class spell_mark_of_kazrogal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_mark_of_kazrogal_SpellScript); + + void FilterTargets(std::list& unitList) + { + unitList.remove_if(MarkTargetFilter()); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_mark_of_kazrogal_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + class spell_mark_of_kazrogal_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mark_of_kazrogal_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MARK_DAMAGE)) + return false; + return true; + } + + void OnPeriodic(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + + if (target->GetPower(POWER_MANA) == 0) + { + target->CastSpell(target, SPELL_MARK_DAMAGE, true, NULL, aurEff); + // Remove aura + SetDuration(0); + } + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazrogal_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_mark_of_kazrogal_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_mark_of_kazrogal_AuraScript(); + } +}; + void AddSC_boss_kazrogal() { new boss_kazrogal(); + new spell_mark_of_kazrogal(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index bc57ce21a4d..e5e3daede91 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -23,7 +23,9 @@ SDComment: SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "halls_of_stone.h" enum Spells @@ -162,12 +164,7 @@ public: //this part should be in the core if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER) { - //this spell must have custom handling in the core, dealing damage based on distance - target->CastSpell(target, DUNGEON_MODE(SPELL_SHATTER_EFFECT, H_SPELL_SHATTER_EFFECT), true); - - if (target->HasAura(SPELL_STONED)) - target->RemoveAurasDueToSpell(SPELL_STONED); - + // todo: we need eventmap to kill this stuff //clear this, if we are still performing if (bIsSlam) { @@ -186,7 +183,74 @@ public: }; +class spell_krystallus_shatter : public SpellScriptLoader +{ + public: + spell_krystallus_shatter() : SpellScriptLoader("spell_krystallus_shatter") { } + + class spell_krystallus_shatter_SpellScript : public SpellScript + { + PrepareSpellScript(spell_krystallus_shatter_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->RemoveAurasDueToSpell(SPELL_STONED); + target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_krystallus_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_krystallus_shatter_SpellScript(); + } +}; + +class spell_krystallus_shatter_effect : public SpellScriptLoader +{ + public: + spell_krystallus_shatter_effect() : SpellScriptLoader("spell_krystallus_shatter_effect") { } + + class spell_krystallus_shatter_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_krystallus_shatter_effect_SpellScript); + + void CalculateDamage() + { + if (!GetHitUnit()) + return; + + float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + if (!radius) + return; + + float distance = GetCaster()->GetDistance2d(GetHitUnit()); + if (distance > 1.0f) + SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius))); + } + + void Register() + { + OnHit += SpellHitFn(spell_krystallus_shatter_effect_SpellScript::CalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_krystallus_shatter_effect_SpellScript(); + } +}; + void AddSC_boss_krystallus() { new boss_krystallus(); + new spell_krystallus_shatter(); + new spell_krystallus_shatter_effect(); } diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index 0e654ade995..3443103fa70 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -19,11 +19,13 @@ /* ScriptData SDName: Boss_Gruul SD%Complete: 60 -SDComment: Ground Slam need further development (knock back effect and shatter effect must be added to the core) +SDComment: Ground Slam need further development (knock back effect must be added to the core) SDCategory: Gruul's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "gruuls_lair.h" enum eEnums @@ -144,12 +146,7 @@ public: //this part should be in the core if (pSpell->Id == SPELL_SHATTER) { - //this spell must have custom handling in the core, dealing damage based on distance - target->CastSpell(target, SPELL_SHATTER_EFFECT, true); - - if (target->HasAura(SPELL_STONED)) - target->RemoveAurasDueToSpell(SPELL_STONED); - + // todo: use eventmap to kill this stuff //clear this, if we are still performing if (m_bPerformingGroundSlam) { @@ -258,7 +255,83 @@ public: }; +class spell_gruul_shatter : public SpellScriptLoader +{ + public: + spell_gruul_shatter() : SpellScriptLoader("spell_gruul_shatter") { } + + class spell_gruul_shatter_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gruul_shatter_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_STONED)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SHATTER_EFFECT)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->RemoveAurasDueToSpell(SPELL_STONED); + target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gruul_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gruul_shatter_SpellScript(); + } +}; + +class spell_gruul_shatter_effect : public SpellScriptLoader +{ + public: + spell_gruul_shatter_effect() : SpellScriptLoader("spell_gruul_shatter_effect") { } + + class spell_gruul_shatter_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gruul_shatter_effect_SpellScript); + + void CalculateDamage() + { + if (!GetHitUnit()) + return; + + float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + if (!radius) + return; + + float distance = GetCaster()->GetDistance2d(GetHitUnit()); + if (distance > 1.0f) + SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius))); + } + + void Register() + { + OnHit += SpellHitFn(spell_gruul_shatter_effect_SpellScript::CalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gruul_shatter_effect_SpellScript(); + } +}; + void AddSC_boss_gruul() { new boss_gruul(); + new spell_gruul_shatter(); + new spell_gruul_shatter_effect(); } diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index a213713ae1a..ab568249027 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -16,7 +16,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" enum Texts { @@ -36,6 +39,7 @@ enum Spells SPELL_THUNDERCLAP = 36706, SPELL_VOID_BOLT = 39329, SPELL_MARK_OF_KAZZAK = 32960, + SPELL_MARK_OF_KAZZAK_DAMAGE = 32961, SPELL_ENRAGE = 32964, SPELL_CAPTURE_SOUL = 32966, SPELL_TWISTED_REFLECTION = 21063, @@ -171,7 +175,55 @@ class boss_doomlord_kazzak : public CreatureScript } }; +class spell_mark_of_kazzak : public SpellScriptLoader +{ + public: + spell_mark_of_kazzak() : SpellScriptLoader("spell_mark_of_kazzak") { } + + class spell_mark_of_kazzak_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mark_of_kazzak_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_KAZZAK_DAMAGE)) + return false; + return true; + } + + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* owner = GetUnitOwner()) + amount = CalculatePctU(owner->GetPower(POWER_MANA), 5); + } + + void OnPeriodic(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + + if (target->GetPower(POWER_MANA) == 0) + { + target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, NULL, aurEff); + // Remove aura + SetDuration(0); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_mark_of_kazzak_AuraScript(); + } +}; + void AddSC_boss_doomlordkazzak() { new boss_doomlord_kazzak(); + new spell_mark_of_kazzak(); } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 4593d955566..b31ee0a7d3e 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -730,17 +730,6 @@ class spell_dk_death_coil : public SpellScriptLoader return true; } - SpellCastResult CheckCast() - { - Unit* caster = GetCaster(); - if (Unit* target = GetExplTargetUnit()) - { - if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD) - return SPELL_FAILED_BAD_TARGETS; - } - return SPELL_CAST_OK; - } - void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 1d152e6f208..f759efbee83 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -30,7 +30,9 @@ enum DruidSpells DRUID_INCREASED_MOONFIRE_DURATION = 38414, DRUID_NATURES_SPLENDOR = 57865, DRUID_LIFEBLOOM_FINAL_HEAL = 33778, - DRUID_LIFEBLOOM_ENERGIZE = 64372 + DRUID_LIFEBLOOM_ENERGIZE = 64372, + DRUID_SURVIVAL_INSTINCTS = 50322, + DRUID_SAVAGE_ROAR = 62071 }; // 54846 Glyph of Starfire @@ -481,6 +483,166 @@ class spell_dru_lifebloom : public SpellScriptLoader } }; +class spell_dru_predatory_strikes : public SpellScriptLoader +{ + public: + spell_dru_predatory_strikes() : SpellScriptLoader("spell_dru_predatory_strikes") { } + + class spell_dru_predatory_strikes_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_predatory_strikes_AuraScript); + + void UpdateAmount(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* target = GetTarget()->ToPlayer()) + target->UpdateAttackPowerAndDamage(); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dru_predatory_strikes_AuraScript(); + } +}; + +class spell_dru_savage_roar : public SpellScriptLoader +{ + public: + spell_dru_savage_roar() : SpellScriptLoader("spell_dru_savage_roar") { } + + class spell_dru_savage_roar_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dru_savage_roar_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetShapeshiftForm() != FORM_CAT) + return SPELL_FAILED_ONLY_SHAPESHIFT; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_dru_savage_roar_SpellScript::CheckCast); + } + }; + + class spell_dru_savage_roar_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_savage_roar_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(DRUID_SAVAGE_ROAR)) + return false; + return true; + } + + void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + int32 bp0 = aurEff->GetAmount(); // todo: check if needed + target->CastCustomSpell(target, DRUID_SAVAGE_ROAR, &bp0, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(DRUID_SAVAGE_ROAR); + } + + void Register() + { + // todo: check AuraEffectHandleModes + AfterEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_savage_roar_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dru_savage_roar_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_dru_savage_roar_AuraScript(); + } +}; + +class spell_dru_survival_instincts : public SpellScriptLoader +{ + public: + spell_dru_survival_instincts() : SpellScriptLoader("spell_dru_survival_instincts") { } + + class spell_dru_survival_instincts_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dru_survival_instincts_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (!caster->IsInFeralForm()) + return SPELL_FAILED_ONLY_SHAPESHIFT; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_dru_survival_instincts_SpellScript::CheckCast); + } + }; + + class spell_dru_survival_instincts_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_survival_instincts_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(DRUID_SURVIVAL_INSTINCTS)) + return false; + return true; + } + + void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + int32 bp0 = target->CountPctFromMaxHealth(aurEff->GetAmount()); + target->CastCustomSpell(target, DRUID_SURVIVAL_INSTINCTS, &bp0, NULL, NULL, true); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(DRUID_SURVIVAL_INSTINCTS); + } + + void Register() + { + // todo: check AuraEffectHandleModes + AfterEffectApply += AuraEffectApplyFn(spell_dru_survival_instincts_AuraScript::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_survival_instincts_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dru_survival_instincts_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_dru_survival_instincts_AuraScript(); + } +}; + void AddSC_druid_spell_scripts() { new spell_dru_glyph_of_starfire(); @@ -492,4 +654,7 @@ void AddSC_druid_spell_scripts() new spell_dru_swift_flight_passive(); new spell_dru_starfall_dummy(); new spell_dru_lifebloom(); + new spell_dru_predatory_strikes(); + new spell_dru_savage_roar(); + new spell_dru_survival_instincts(); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index f61bad8db9b..b619dd9ac6f 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2802,6 +2802,238 @@ class spell_gen_lifebloom : public SpellScriptLoader uint32 _spellId; }; +enum SummonElemental +{ + SPELL_SUMMON_FIRE_ELEMENTAL = 8985, + SPELL_SUMMON_EARTH_ELEMENTAL = 19704 +}; + +class spell_gen_summon_elemental : public SpellScriptLoader +{ + public: + spell_gen_summon_elemental(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } + + class spell_gen_summon_elemental_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_summon_elemental_AuraScript); + + public: + spell_gen_summon_elemental_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(_spellId)) + return false; + return true; + } + + void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetCaster()) + if (Unit* owner = GetCaster()->GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER) // todo: this check is maybe wrong + owner->CastSpell(owner, _spellId, true); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetCaster()) + if (Unit* owner = GetCaster()->GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER) // todo: this check is maybe wrong + owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_gen_summon_elemental_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_summon_elemental_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + + private: + uint32 _spellId; + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_summon_elemental_AuraScript(_spellId); + } + + private: + uint32 _spellId; +}; + +enum Mounts +{ + // Magic Broom + SPELL_MAGIC_BROOM_60 = 42680, + SPELL_MAGIC_BROOM_100 = 42683, + SPELL_MAGIC_BROOM_150 = 42667, + SPELL_MAGIC_BROOM_280 = 42668, + + // Headless Horseman's Mount + SPELL_HEADLESS_HORSEMAN_MOUNT_60 = 51621, + SPELL_HEADLESS_HORSEMAN_MOUNT_100 = 48024, + SPELL_HEADLESS_HORSEMAN_MOUNT_150 = 51617, + SPELL_HEADLESS_HORSEMAN_MOUNT_280 = 48023, + + // Winged Steed of the Ebon Blade + SPELL_WINGED_STEED_150 = 54726, + SPELL_WINGED_STEED_280 = 54727, + + // Big Love Rocket + SPELL_BIG_LOVE_ROCKET_0 = 71343, + SPELL_BIG_LOVE_ROCKET_60 = 71344, + SPELL_BIG_LOVE_ROCKET_100 = 71345, + SPELL_BIG_LOVE_ROCKET_150 = 71346, + SPELL_BIG_LOVE_ROCKET_310 = 71347, + + // Invincible + SPELL_INVINCIBLE_60 = 72281, + SPELL_INVINCIBLE_100 = 72282, + SPELL_INVINCIBLE_150 = 72283, + SPELL_INVINCIBLE_310 = 72284, + + // Blazing Hippogryph + SPELL_BLAZING_HIPPOGRYPH_150 = 74854, + SPELL_BLAZING_HIPPOGRYPH_280 = 74855, + + // Celestial Steed + SPELL_CELESTIAL_STEED_60 = 75619, + SPELL_CELESTIAL_STEED_100 = 75620, + SPELL_CELESTIAL_STEED_150 = 75617, + SPELL_CELESTIAL_STEED_280 = 75618, + SPELL_CELESTIAL_STEED_310 = 76153, + + // X-53 Touring Rocket + SPELL_X53_TOURING_ROCKET_150 = 75957, + SPELL_X53_TOURING_ROCKET_280 = 75972, + SPELL_X53_TOURING_ROCKET_310 = 76154, +}; + +class spell_gen_mount : public SpellScriptLoader +{ + public: + spell_gen_mount(const char* name, uint32 mount0 = 0, uint32 mount60 = 0, uint32 mount100 = 0, uint32 mount150 = 0, uint32 mount280 = 0, uint32 mount310 = 0) : SpellScriptLoader(name), + _mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { } + + class spell_gen_mount_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_mount_SpellScript); + + public: + spell_gen_mount_SpellScript(uint32 mount0, uint32 mount60, uint32 mount100, uint32 mount150, uint32 mount280, uint32 mount310) : SpellScript(), + _mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { } + + bool Validate(SpellInfo const* /*spell*/) + { + if (_mount0 && !sSpellMgr->GetSpellInfo(_mount0)) + return false; + if (_mount60 && !sSpellMgr->GetSpellInfo(_mount60)) + return false; + if (_mount100 && !sSpellMgr->GetSpellInfo(_mount100)) + return false; + if (_mount150 && !sSpellMgr->GetSpellInfo(_mount150)) + return false; + if (_mount280 && !sSpellMgr->GetSpellInfo(_mount280)) + return false; + if (_mount310 && !sSpellMgr->GetSpellInfo(_mount310)) + return false; + return true; + } + + void HandleMount(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + + if (Player* target = GetHitPlayer()) + { + // Prevent stacking of mounts and client crashes upon dismounting + target->RemoveAurasByType(SPELL_AURA_MOUNTED, 0, GetHitAura()); + + // Triggered spell id dependent on riding skill and zone + bool canFly = false; + uint32 vmap = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId()); + if (vmap == 530 || (vmap == 571 && target->HasSpell(54197))) + canFly = true; + + float x, y, z; + target->GetPosition(x, y, z); + uint32 areaFlag = target->GetBaseMap()->GetAreaFlag(x, y, z); + AreaTableEntry const* area = sAreaStore.LookupEntry(areaFlag); + if (!area || (canFly && (area->flags & AREA_FLAG_NO_FLY_ZONE))) + canFly = false; + + uint32 mount = 0; + switch (target->GetBaseSkillValue(SKILL_RIDING)) + { + case 0: + mount = _mount0; + break; + case 75: + mount = _mount60; + break; + case 150: + mount = _mount100; + break; + case 225: + if (canFly) + mount = _mount150; + else + mount = _mount100; + break; + case 300: + if (canFly) + { + if (_mount310 && target->Has310Flyer(false)) + mount = _mount310; + else + mount = _mount280; + } + else + mount = _mount100; + break; + default: + break; + } + + if (mount) + { + // Prevent stacking of mounts and client crashes upon dismounting + //target->RemoveAurasByType(SPELL_AURA_MOUNTED, 0, GetHitAura()); + + target->CastSpell(target, mount, true); + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_mount_SpellScript::HandleMount, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } + + private: + uint32 _mount0; + uint32 _mount60; + uint32 _mount100; + uint32 _mount150; + uint32 _mount280; + uint32 _mount310; + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_mount_SpellScript(_mount0, _mount60, _mount100, _mount150, _mount280, _mount310); + } + + private: + uint32 _mount0; + uint32 _mount60; + uint32 _mount100; + uint32 _mount150; + uint32 _mount280; + uint32 _mount310; +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2862,4 +3094,14 @@ void AddSC_generic_spell_scripts() new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_twisted_visage_lifebloom", SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL); + new spell_gen_summon_elemental("spell_gen_summon_fire_elemental", SPELL_SUMMON_FIRE_ELEMENTAL); + new spell_gen_summon_elemental("spell_gen_summon_earth_elemental", SPELL_SUMMON_EARTH_ELEMENTAL); + new spell_gen_mount("spell_magic_broom", 0, SPELL_MAGIC_BROOM_60, SPELL_MAGIC_BROOM_100, SPELL_MAGIC_BROOM_150, SPELL_MAGIC_BROOM_280); + new spell_gen_mount("spell_headless_horseman_mount", 0, SPELL_HEADLESS_HORSEMAN_MOUNT_60, SPELL_HEADLESS_HORSEMAN_MOUNT_100, SPELL_HEADLESS_HORSEMAN_MOUNT_150, SPELL_HEADLESS_HORSEMAN_MOUNT_280); + new spell_gen_mount("spell_winged_steed_of_the_ebon_blade", 0, 0, 0, SPELL_WINGED_STEED_150, SPELL_WINGED_STEED_280); + new spell_gen_mount("spell_big_love_rocket", SPELL_BIG_LOVE_ROCKET_0, SPELL_BIG_LOVE_ROCKET_60, SPELL_BIG_LOVE_ROCKET_100, SPELL_BIG_LOVE_ROCKET_150, SPELL_BIG_LOVE_ROCKET_310); + new spell_gen_mount("spell_invincible", 0, SPELL_INVINCIBLE_60, SPELL_INVINCIBLE_100, SPELL_INVINCIBLE_150, SPELL_INVINCIBLE_310); + new spell_gen_mount("spell_blazing_hippogryph", 0, 0, 0, SPELL_BLAZING_HIPPOGRYPH_150, SPELL_BLAZING_HIPPOGRYPH_280); + new spell_gen_mount("spell_celestial_steed", 0, SPELL_CELESTIAL_STEED_60, SPELL_CELESTIAL_STEED_100, SPELL_CELESTIAL_STEED_150, SPELL_CELESTIAL_STEED_280, SPELL_CELESTIAL_STEED_310); + new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 44bc6b43c96..a2ee6c1c3a3 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -629,7 +629,8 @@ class spell_hun_disengage : public SpellScriptLoader SpellCastResult CheckCast() { - if (GetCaster()->GetTypeId() == TYPEID_PLAYER && !GetCaster()->isInCombat()) + Unit* caster = GetCaster(); + if (caster->GetTypeId() == TYPEID_PLAYER && !caster->isInCombat()) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; return SPELL_CAST_OK; @@ -647,6 +648,57 @@ class spell_hun_disengage : public SpellScriptLoader } }; +class spell_hun_tame_beast : public SpellScriptLoader +{ + public: + spell_hun_tame_beast() : SpellScriptLoader("spell_hun_tame_beast") { } + + class spell_hun_tame_beast_SpellScript : public SpellScript + { + PrepareSpellScript(spell_hun_tame_beast_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_DONT_REPORT; + + if (!GetExplTargetUnit()) + return SPELL_FAILED_BAD_IMPLICIT_TARGETS; + + if (Creature* target = GetExplTargetUnit()->ToCreature()) + { + if (target->getLevel() > caster->getLevel()) + return SPELL_FAILED_HIGHLEVEL; + + // use SMSG_PET_TAME_FAILURE? + if (!target->GetCreatureTemplate()->isTameable(caster->ToPlayer()->CanTameExoticPets())) + return SPELL_FAILED_BAD_TARGETS; + + if (caster->GetPetGUID()) + return SPELL_FAILED_ALREADY_HAVE_SUMMON; + + if (caster->GetCharmGUID()) + return SPELL_FAILED_ALREADY_HAVE_CHARM; + } + else + return SPELL_FAILED_BAD_IMPLICIT_TARGETS; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_hun_tame_beast_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_tame_beast_SpellScript(); + } +}; + void AddSC_hunter_spell_scripts() { new spell_hun_aspect_of_the_beast(); @@ -662,4 +714,5 @@ void AddSC_hunter_spell_scripts() new spell_hun_misdirection(); new spell_hun_misdirection_proc(); new spell_hun_disengage(); + new spell_hun_tame_beast(); } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 1bc8bb20a3e..fe681032c1c 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -502,6 +502,44 @@ class spell_pal_lay_on_hands : public SpellScriptLoader } }; +class spell_pal_righteous_defense : public SpellScriptLoader +{ + public: + spell_pal_righteous_defense() : SpellScriptLoader("spell_pal_righteous_defense") { } + + class spell_pal_righteous_defense_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pal_righteous_defense_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_DONT_REPORT; + + if (Unit* target = GetExplTargetUnit()) + { + if (!target->IsFriendlyTo(caster) || target->getAttackers().empty()) + return SPELL_FAILED_BAD_TARGETS; + } + else + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_pal_righteous_defense_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pal_righteous_defense_SpellScript(); + } +}; + void AddSC_paladin_spell_scripts() { new spell_pal_ardent_defender(); @@ -513,4 +551,5 @@ void AddSC_paladin_spell_scripts() new spell_pal_divine_storm(); new spell_pal_divine_storm_dummy(); new spell_pal_lay_on_hands(); + new spell_pal_righteous_defense(); } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 1fcc9da06c4..a7c196701ad 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -43,6 +43,8 @@ enum ShamanSpells SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474, SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566, + SHAMAN_BIND_SIGHT = 6277, + ICON_ID_SHAMAN_LAVA_FLOW = 3087, SHAMAN_LAVA_FLOWS_R1 = 51480, SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694, @@ -702,6 +704,52 @@ class spell_sha_flame_shock : public SpellScriptLoader } }; +class spell_sha_sentry_totem : public SpellScriptLoader +{ + public: + spell_sha_sentry_totem() : SpellScriptLoader("spell_sha_sentry_totem") { } + + class spell_sha_sentry_totem_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_sentry_totem_AuraScript); + + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SHAMAN_BIND_SIGHT)) + return false; + return true; + } + + void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[4])) + if (totem->isTotem()) + caster->CastSpell(totem, SHAMAN_BIND_SIGHT, true); + } + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetCaster) + if (Player* caster = GetCaster()->ToPlayer()) + caster->StopCastingBindSight(); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_sha_sentry_totem_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_sha_sentry_totem_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_sha_sentry_totem_AuraScript(); + } +}; + void AddSC_shaman_spell_scripts() { new spell_sha_astral_shift(); @@ -718,4 +766,5 @@ void AddSC_shaman_spell_scripts() new spell_sha_lava_lash(); new spell_sha_chain_heal(); new spell_sha_flame_shock(); + new spell_sha_sentry_totem(); } -- cgit v1.2.3 From c9efe057519ef79e4a41c9aae91ee2ef07c69086 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 3 Jun 2012 05:36:27 +0200 Subject: Core/Visibility: Change the default visibility distance for instances and battlegrounds to blizz-like values. --- src/server/game/Entities/Object/Object.h | 8 ++++---- src/server/worldserver/worldserver.conf.dist | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 64b780bb6c3..5a6a5799fee 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -34,11 +34,11 @@ #define CONTACT_DISTANCE 0.5f #define INTERACTION_DISTANCE 5.0f #define ATTACK_DISTANCE 5.0f -#define MAX_VISIBILITY_DISTANCE 500.0f // max distance for visible objects +#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max distance for visible objects #define SIGHT_RANGE_UNIT 50.0f -#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents -#define DEFAULT_VISIBILITY_INSTANCE 120.0f // default visible distance in instances, 120 yards -#define DEFAULT_VISIBILITY_BGARENAS 180.0f // default visible distance in BG/Arenas, 180 yards +#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents +#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards +#define DEFAULT_VISIBILITY_BGARENAS 533.0f // default visible distance in BG/Arenas, roughly 533 yards #define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects #define DEFAULT_COMBAT_REACH 1.5f diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 5d837100b0e..d8a576f4031 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2024,17 +2024,17 @@ Visibility.GroupMode = 1 # Visibility.Distance.Instances # Visibility.Distance.BGArenas # Description: Visibility distance to see other players or gameobjects. -# Visibility on continents on retail ~90 yards. In BG/Arenas ~180. -# For instances default ~120. -# Max limited by active player zone: ~ 333 +# Visibility on continents on retail ~90 yards. In BG/Arenas ~533. +# For instances default ~170. +# Max limited by grid size: 533.33333 # Min limit is max aggro radius (45) * Rate.Creature.Aggro # Default: 90 - (Visibility.Distance.Continents) -# 120 - (Visibility.Distance.Instances) -# 180 - (Visibility.Distance.BGArenas) +# 170 - (Visibility.Distance.Instances) +# 533 - (Visibility.Distance.BGArenas) Visibility.Distance.Continents = 90 -Visibility.Distance.Instances = 120 -Visibility.Distance.BGArenas = 180 +Visibility.Distance.Instances = 170 +Visibility.Distance.BGArenas = 533 # # Visibility.Notify.Period.OnContinents -- cgit v1.2.3 From a32f4f439b609b368ad2d57408f27ec7a78e8f39 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 3 Jun 2012 05:41:30 +0200 Subject: Core/Protocol: Move some debug messages to their appropriate debug output mask. --- src/server/game/Handlers/AuthHandler.cpp | 2 +- src/server/game/Handlers/MiscHandler.cpp | 38 +++++++++++++++---------------- src/server/game/Handlers/PetHandler.cpp | 6 +++-- src/server/game/Handlers/QueryHandler.cpp | 10 ++++---- src/server/game/Handlers/SpellHandler.cpp | 23 +++++++++++-------- src/server/game/Server/WorldSession.cpp | 6 ++--- 6 files changed, 45 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp index 9a3e756dda3..49027bdf497 100755 --- a/src/server/game/Handlers/AuthHandler.cpp +++ b/src/server/game/Handlers/AuthHandler.cpp @@ -31,7 +31,7 @@ void WorldSession::SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos) if (!shortForm) { packet << uint32(queuePos); // Queue position - packet << uint8(0); // Unk 3.3.0 + packet << uint8(0); // Realm has a free character migration - bool } SendPacket(&packet); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 8484ac52d27..11f0857ca2b 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -494,7 +494,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data) uint32 newZone; recv_data >> newZone; - sLog->outDetail("WORLD: Recvd ZONE_UPDATE: %u", newZone); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd ZONE_UPDATE: %u", newZone); // use server size data uint32 newzone, newarea; @@ -730,7 +730,7 @@ void WorldSession::HandleBugOpcode(WorldPacket & recv_data) void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) { - sLog->outDetail("WORLD: Received CMSG_RECLAIM_CORPSE"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RECLAIM_CORPSE"); uint64 guid; recv_data >> guid; @@ -767,7 +767,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data) { - sLog->outDetail("WORLD: Received CMSG_RESURRECT_RESPONSE"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RESURRECT_RESPONSE"); uint64 guid; uint8 status; @@ -938,7 +938,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) { - sLog->outDetail("WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); uint32 type, timestamp, decompressedSize; recv_data >> type >> timestamp >> decompressedSize; @@ -993,7 +993,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) { - sLog->outDetail("WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); uint32 type; recv_data >> type; @@ -1072,18 +1072,18 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) void WorldSession::HandleCompleteCinematic(WorldPacket & /*recv_data*/) { - sLog->outStaticDebug("WORLD: Player is watching cinema"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_COMPLETE_CINEMATIC"); } void WorldSession::HandleNextCinematicCamera(WorldPacket & /*recv_data*/) { - sLog->outStaticDebug("WORLD: Which movie to play"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA"); } void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data) { /* WorldSession::Update(getMSTime());*/ - sLog->outStaticDebug("WORLD: Time Lag/Synchronization Resent/Update"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_TIME_SKIPPED"); uint64 guid; recv_data.readPackGUID(guid); @@ -1105,7 +1105,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data) void WorldSession::HandleFeatherFallAck(WorldPacket &recv_data) { - sLog->outStaticDebug("WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); // no used recv_data.rfinish(); // prevent warnings spam @@ -1193,13 +1193,17 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) { uint64 guid; recv_data >> guid; - sLog->outStaticDebug("Inspected guid is " UI64FMTD, guid); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_INSPECT"); _player->SetSelection(guid); Player* player = ObjectAccessor::FindPlayer(guid); - if (!player) // wrong player + if (!player) + { + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid); return; + } uint32 talent_points = 0x47; uint32 guid_size = player->GetPackGUID().wpos(); @@ -1230,7 +1234,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) if (!player) { - sLog->outError("InspectHonorStats: WTF, player not found..."); + sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid); return; } @@ -1246,10 +1250,6 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) { - // write in client console: worldport 469 452 6454 2536 180 or /console worldport 469 452 6454 2536 180 - // Received opcode CMSG_WORLD_TELEPORT - // Time is ***, map=469, x=452.000000, y=6454.000000, z=2536.000000, orient=3.141593 - uint32 time; uint32 mapid; float PositionX; @@ -1264,20 +1264,20 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) recv_data >> PositionZ; recv_data >> Orientation; // o (3.141593 = 180 degrees) - //sLog->outDebug("Received opcode CMSG_WORLD_TELEPORT"); + 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()); return; } - sLog->outStaticDebug("Time %u sec, map=%u, x=%f, y=%f, z=%f, orient=%f", time/1000, 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(), time, mapid, PositionX, PositionY, PositionZ, Orientation); if (AccountMgr::IsAdminAccount(GetSecurity())) GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation); else SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received worldport command from player %s", GetPlayer()->GetName()); } void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index e54bee96b8b..321c0ada247 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -339,9 +339,11 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid if (unit_target2->GetTypeId() == TYPEID_PLAYER) pet->SendUpdateToPlayer((Player*)unit_target2); } + if (Unit* powner = pet->GetCharmerOrOwner()) if (powner->GetTypeId() == TYPEID_PLAYER) - pet->SendUpdateToPlayer(powner->ToPlayer()); + pet->SendUpdateToPlayer(powner->ToPlayer()); + result = SPELL_CAST_OK; } @@ -741,7 +743,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { - sLog->outDetail("WORLD: CMSG_PET_CAST_SPELL"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL"); uint64 guid; uint8 castCount; diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 628cdbbdd5e..4fb90bed10b 100755 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -113,7 +113,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) ObjectMgr::GetLocaleString(cl->SubName, loc_idx, SubName); } } - sLog->outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry); // guess size WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 100); data << uint32(entry); // creature entry @@ -179,7 +179,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) ObjectMgr::GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption); } } - sLog->outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150); data << uint32(entry); data << uint32(info->type); @@ -209,7 +209,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) { - sLog->outDetail("WORLD: Received MSG_CORPSE_QUERY"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_CORPSE_QUERY"); Corpse* corpse = GetPlayer()->GetCorpse(); @@ -264,7 +264,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) uint64 guid; recv_data >> textID; - sLog->outDetail("WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); recv_data >> guid; GetPlayer()->SetSelection(guid); @@ -344,7 +344,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) /// Only _static_ data is sent in this packet !!! void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) { - sLog->outDetail("WORLD: Received CMSG_PAGE_TEXT_QUERY"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY"); uint32 pageID; recv_data >> pageID; diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 1affdf0aff7..c02bb43a353 100755 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -99,7 +99,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } - sLog->outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); ItemTemplate const* proto = pItem->GetTemplate(); if (!proto) @@ -175,7 +175,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) { - sLog->outDetail("WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); Player* pUser = _player; @@ -658,13 +658,16 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) recvPacket >> z; Unit* caster = ObjectAccessor::GetUnit(*_player, casterGuid); - Spell* spell = caster ? caster->FindCurrentSpellBySpellId(spellId) : NULL; - if (spell && spell->m_targets.HasDst()) - { - Position pos = *spell->m_targets.GetDstPos(); - pos.Relocate(x, y, z); - spell->m_targets.ModDst(pos); - } + if (!caster) + return; + + Spell* spell = caster->FindCurrentSpellBySpellId(spellId); + if (!spell || !spell->m_targets.HasDst()) + return; + + Position pos = *spell->m_targets.GetDstPos(); + pos.Relocate(x, y, z); + spell->m_targets.ModDst(pos); WorldPacket data(SMSG_SET_PROJECTILE_POSITION, 21); data << uint64(casterGuid); @@ -672,5 +675,5 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) data << float(x); data << float(y); data << float(z); - SendPacket(&data); + caster->SendMessageToSet(&data, true); } diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 7756e686388..81ec5495421 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -208,7 +208,7 @@ void WorldSession::QueuePacket(WorldPacket* new_packet) /// Logging helper for unexpected opcodes void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason) { - sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s", + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s", GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), status, reason); } @@ -216,7 +216,7 @@ void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, /// Logging helper for unexpected opcodes void WorldSession::LogUnprocessedTail(WorldPacket* packet) { - sLog->outError("SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)", + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), uint32(packet->rpos()), uint32(packet->wpos())); packet->print_storage(); } @@ -334,7 +334,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) LogUnprocessedTail(packet); break; case STATUS_NEVER: - sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)", + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)", GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); break; -- cgit v1.2.3 From 985e8cdcd33f1bf993527da72e24820ffdd15b30 Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Sun, 3 Jun 2012 06:13:28 +0200 Subject: Core/Commands: Fixed lookup quest command to show [rewarded] mark on rewarded quests --- src/server/game/Chat/Commands/Level3.cpp | 34 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 30562bb9662..4b2f1c5e7bb 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -1144,15 +1144,20 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args) { QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); - if (status == QUEST_STATUS_COMPLETE) + switch (status) { - if (target->GetQuestRewardStatus(qinfo->GetQuestId())) - statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); - else + case QUEST_STATUS_COMPLETE: statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); + break; + case QUEST_STATUS_INCOMPLETE: + statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); + break; + case QUEST_STATUS_REWARDED: + statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); + break; + default: + break; } - else if (status == QUEST_STATUS_INCOMPLETE) - statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); } if (m_session) @@ -1187,15 +1192,20 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args) { QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); - if (status == QUEST_STATUS_COMPLETE) + switch (status) { - if (target->GetQuestRewardStatus(qinfo->GetQuestId())) - statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); - else + case QUEST_STATUS_COMPLETE: statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); + break; + case QUEST_STATUS_INCOMPLETE: + statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); + break; + case QUEST_STATUS_REWARDED: + statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); + break; + default: + break; } - else if (status == QUEST_STATUS_INCOMPLETE) - statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); } if (m_session) -- cgit v1.2.3 From 3b44401aa66b8f6109a9499a71e40adc015219f4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 3 Jun 2012 15:31:37 +0200 Subject: Core/Movement: Fixed Facing* splines on transports --- src/server/game/Movement/Spline/MoveSplineInit.cpp | 8 ++++++++ src/server/game/Movement/Spline/MoveSplineInit.h | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index b8440e06076..c5f959e2f1d 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -138,6 +138,14 @@ namespace Movement void MoveSplineInit::SetFacing(float angle) { + if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + { + if (Unit* vehicle = unit.GetVehicleBase()) + angle -= vehicle->GetOrientation(); + else if (Transport* transport = unit.GetTransport()) + angle -= transport->GetOrientation(); + } + args.facing.angle = G3D::wrap(angle, 0.f, (float)G3D::twoPi()); args.flags.EnableFacingAngle(); } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h index b1b08d97cfa..786324e3f77 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.h +++ b/src/server/game/Movement/Spline/MoveSplineInit.h @@ -166,9 +166,11 @@ namespace Movement inline void MoveSplineInit::SetFacing(Vector3 const& spot) { - args.facing.f.x = spot.x; - args.facing.f.y = spot.y; - args.facing.f.z = spot.z; + TransportPathTransform transform(unit); + Vector3 finalSpot = transform(spot); + args.facing.f.x = finalSpot.x; + args.facing.f.y = finalSpot.y; + args.facing.f.z = finalSpot.z; args.flags.EnableFacingPoint(); } } -- cgit v1.2.3 From 4e745d2888783e326bda9ac3f0fd940e11411b7f Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 3 Jun 2012 15:10:47 +0100 Subject: Core/Enums: Update vehicle seat flags and vehicle seat b flags (from WPP) --- src/server/game/DataStores/DBCEnums.h | 14 +++++++++++++- src/server/game/Entities/Vehicle/Vehicle.cpp | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index 23578a55816..e73480cb4de 100755 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -416,16 +416,27 @@ enum SummonPropFlags enum VehicleSeatFlags { + VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_ENTER = 0x00000001, + VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_RIDE = 0x00000002, + VEHICLE_SEAT_FLAG_SHOULD_USE_VEH_SEAT_EXIT_ANIM_ON_VOLUNTARY_EXIT = 0x00000008, VEHICLE_SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden - VEHICLE_SEAT_FLAG_UNK1 = 0x00000400, // needed for CGCamera__SyncFreeLookFacing + VEHICLE_SEAT_FLAG_ALLOW_TURNING = 0x00000400, // needed for CGCamera__SyncFreeLookFacing VEHICLE_SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat VEHICLE_SEAT_FLAG_CAN_CAST_MOUNT_SPELL = 0x00001000, // Can cast spells with SPELL_AURA_MOUNTED from seat (possibly 4.x only, 0 seats on 3.3.5a) VEHICLE_SEAT_FLAG_UNCONTROLLED = 0x00002000, // can override !& VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT VEHICLE_SEAT_FLAG_CAN_ATTACK = 0x00004000, // Can attack, cast spells and use items from vehicle + VEHICLE_SEAT_FLAG_SHOULD_USE_VEH_SEAT_EXIT_ANIMN_ON_FORCED_EXIT = 0x00008000, + VEHICLE_SEAT_FLAG_HAS_VEH_EXIT_ANIM_VOLUNTARY_EXIT = 0x00040000, + VEHICLE_SEAT_FLAG_HAS_VEH_EXIT_ANIM_FORCED_EXIT = 0x00080000, + VEHICLE_SEAT_FLAG_REC_HAS_VEHICLE_ENTER_ANIM = 0x00400000, + VEHICLE_SEAT_FLAG_ENABLE_VEHICLE_ZOOM = 0x01000000, VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT = 0x02000000, // Lua_CanExitVehicle - can enter and exit at free will VEHICLE_SEAT_FLAG_CAN_SWITCH = 0x04000000, // Lua_CanSwitchVehicleSeats + VEHICLE_SEAT_FLAG_HAS_START_WARITING_FOR_VEH_TRANSITION_ANIM_ENTER = 0x08000000, + VEHICLE_SEAT_FLAG_HAS_START_WARITING_FOR_VEH_TRANSITION_ANIM_EXIT = 0x10000000, VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI VEHICLE_SEAT_FLAG_UNK2 = 0x40000000, // checked in conjunction with 0x800 in CastSpell2 + VEHICLE_SEAT_FLAG_ALLOWS_INTERACTION = 0x80000000, }; enum VehicleSeatFlagsB @@ -437,6 +448,7 @@ enum VehicleSeatFlagsB VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 = 0x00000040, VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100, VEHICLE_SEAT_FLAG_B_USABLE_FORCED_4 = 0x02000000, + VEHICLE_SEAT_FLAG_B_CAN_SWITCH = 0x04000000, VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000, // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000 }; diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index c297ce1e792..04bcfdcc375 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -338,7 +338,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) } } - if (seat->second.SeatInfo->m_flags && !(seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_UNK1)) + if (seat->second.SeatInfo->m_flags && !(seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING)) unit->AddUnitState(UNIT_STATE_ONVEHICLE); unit->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); -- cgit v1.2.3 From 820ce262779c05a95649fcaa10e9310f0563c7e2 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 3 Jun 2012 15:12:32 +0100 Subject: DB/Quests: Fix quest Magic Carpet Ride --- sql/updates/world/2012_06_03_00_world_sai.sql | 71 +++++++++++++++++++++++++++ src/server/game/Spells/SpellMgr.cpp | 3 ++ 2 files changed, 74 insertions(+) create mode 100644 sql/updates/world/2012_06_03_00_world_sai.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_03_00_world_sai.sql b/sql/updates/world/2012_06_03_00_world_sai.sql new file mode 100644 index 00000000000..dec53519ee7 --- /dev/null +++ b/sql/updates/world/2012_06_03_00_world_sai.sql @@ -0,0 +1,71 @@ +SET @YANNI := 25459; +SET @CARPET := 25460; +SET @Q_CarpetRide := 11636; + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@YANNI,@CARPET) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@CARPET*100,@CARPET*101,@CARPET*100+1) AND `source_type`=9; +INSERT INTO `smart_scripts`(`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`)VALUES +(@YANNI,0,0,0,62,0,100,0,9162,0,0,0,11,45600,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Yanni - Cast Call of the Carpet on player'), +(@YANNI,0,1,0,62,0,100,0,9162,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Yanni - On Gossip option - Close gossip'), + +(@CARPET,0,0,0,25,0,100,0,0,0,0,0,80,@CARPET*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Amazing Carpet - Call actionlist 2546000 on spawn'), +(@CARPET,0,1,0,40,0,100,0,14,0,0,0,80,@CARPET*100+1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Amazing Carpet - On WP reach - Call actionlist 2546001'), + +(@CARPET*100,9,0,0,0,0,100,0,1000,1000,0,0,11,45603,0,0,0,0,0,23,0,0,0,0,0,0,0, 'Amazing Carpet - Cast Ride Carpet on summoner'), +(@CARPET*100,9,1,0,0,0,100,0,100,100,0,0,53,0,@CARPET,0,0,0,0,1,0,0,0,0,0,0,0, 'Amazing Carpet - Load waypath'), + +(@CARPET*100+1,9,0,0,0,0,100,0,0,0,0,0,15,@Q_CarpetRide,0,0,0,0,0,23,0,0,0,0,0,0,0, 'Amazing Carpet - Give quest credit'), +(@CARPET*100+1,9,1,0,0,0,100,0,500,500,0,0,28,45602,0,0,0,0,0,23,0,0,0,0,0,0,0, 'Amazing Carpet - Remove aura 45602'), +(@CARPET*100+1,9,2,0,0,0,100,0,100,100,0,0,28,46598,0,0,0,0,0,23,0,0,0,0,0,0,0, 'Amazing Carpet - Remove aura 46598'), +(@CARPET*100+1,9,3,0,0,0,100,0,200,200,0,0,41,200,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Amazing Carpet - Despawn'); + +DELETE FROM `waypoints` WHERE `entry`=@CARPET; +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(@CARPET,1,2751.96,6133.514,214.3789, 'Start WP'), +(@CARPET,2,2728.81,6146.472,213.5733, ''), +(@CARPET,3,2634.248,6188.829,185.9068, ''), +(@CARPET,4,2597.958,6255.91,159.7123, ''), +(@CARPET,5,2538.717,6307.643,138.9901, ''), +(@CARPET,6,2393.912,6321.946,85.79566, ''), +(@CARPET,7,2420.326,6461.604,89.3512, ''), +(@CARPET,8,2439.194,6494.39,84.93455, ''), +(@CARPET,9,2496.371,6496.766,78.76788, ''), +(@CARPET,10,2567.008,6550.509,79.90676, ''), +(@CARPET,11,2652.553,6572.071,58.54562, ''), +(@CARPET,12,2725.122,6642.299,41.57339, ''), +(@CARPET,13,2773.236,6694.341,25.49007, ''), +(@CARPET,14,2797.658,6718.523,9.212306, 'Run SmartAI script 2546001'); + +DELETE FROM `creature_template_addon` WHERE `entry` IN (@CARPET,@YANNI); +INSERT INTO `creature_template_addon` (`entry`,`bytes2`,`auras`) VALUES +(@CARPET,257, '61307'), +(@YANNI,257,NULL); + +-- Update gossip_menu to proper entry from sniff (delete wrong one 21233) +UPDATE `creature_template` SET `gossip_menu_id`=9162,`AiName`= 'SmartAI' WHERE `entry`=@YANNI; +UPDATE `creature_template` SET `exp`=2,`minlevel`=72,`maxlevel`=72,`unit_flags`=`unit_flags`|520,`speed_run`=1.42857,`VehicleId`=317,`AiName`='SmartAI',`InhabitType`=5 WHERE `entry`=@CARPET; + +UPDATE `creature_model_info` SET `bounding_radius`=0.31,`combat_reach`=1,`gender`=2 WHERE `modelid`=28082; -- Amazing Flying Carpet + +DELETE FROM `gossip_menu` WHERE `entry` IN (21233,9162); +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(9162,12417); + +UPDATE `quest_template` SET `SpecialFlags`=`SpecialFlags`|2 WHERE `Id`=@Q_CarpetRide; + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9162; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9162; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`Comment`) VALUES +(15,9162,0,0,9,@Q_CarpetRide,0,0,0,'Show gossip option 9162 if player has quest Carpet Ride'); + +DELETE FROM `spell_target_position` WHERE `id`=45601; +INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES +(45601,571,2753.64,6131.41,210.4463,2.892622); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceGroup`=1 AND `SourceEntry`=45602; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13,1,45602,0,0,31,0,3,@CARPET,0,0,0, '', 'Ride Carpet - Target Amazing Flying Carpet'); + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`=@CARPET; +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES +(@CARPET,46598,1,0); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 06e4978eb58..cdaecdcaa20 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3238,6 +3238,9 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectDieSides[0] = 0; // was 1, that should probably mean seat 0, but instead it's treated as spell 1 spellInfo->EffectBasePoints[0] = 52391; // Ride Vehicle (forces seat 0) break; + case 45602: // Ride Carpet + spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)" + break; case 64745: // Item - Death Knight T8 Tank 4P Bonus case 64936: // Item - Warrior T8 Protection 4P Bonus spellInfo->EffectBasePoints[0] = 100; // 100% chance of procc'ing, not -10% (chance calculated in PrepareTriggersExecutedOnHit) -- cgit v1.2.3 From fa1375b7d66392279cdac94961344e5a3cc0f158 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 3 Jun 2012 23:12:02 +0200 Subject: Script/Shadowfiend: Use PetAI for shadowfiends, fixes shadowcrawl autocasting --- src/server/scripts/World/npcs_special.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index c9aeea07382..57a65423b6f 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -47,6 +47,7 @@ EndContentData */ #include "ObjectMgr.h" #include "ScriptMgr.h" #include "World.h" +#include "PetAI.h" /*######## # npc_air_force_bots @@ -2100,16 +2101,18 @@ class npc_shadowfiend : public CreatureScript public: npc_shadowfiend() : CreatureScript("npc_shadowfiend") { } - struct npc_shadowfiendAI : public ScriptedAI + struct npc_shadowfiendAI : public PetAI { - npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {} + npc_shadowfiendAI(Creature* creature) : PetAI(creature) {} - void DamageTaken(Unit* /*killer*/, uint32& damage) + void JustDied(Unit* killer) { if (me->isSummon()) if (Unit* owner = me->ToTempSummon()->GetSummoner()) - if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth()) + if (owner->HasAura(GLYPH_OF_SHADOWFIEND)) owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); + + PetAI::JustDied(killer); } }; -- cgit v1.2.3 From c7cb120449d47bc9da69b8b65fa80272582d4371 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 3 Jun 2012 16:27:25 -0500 Subject: Core/EventAI: Check AIName for EventAI scripts while loading them, avoid iterating again --- src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index f95645611f1..448e43db316 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -204,12 +204,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() temp.raw.param3 = fields[8].GetInt32(); temp.raw.param4 = fields[9].GetInt32(); + CreatureTemplate* cInfo = sObjectMgr->GetCreatureTemplate(temp.creature_id); //Creature does not exist in database - if (!sObjectMgr->GetCreatureTemplate(temp.creature_id)) + if (!cInfo) { sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id); continue; } + + if (cInfo->AIName != "EventAI") + sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id); //No chance of this event occuring if (temp.event_chance == 0) @@ -735,15 +739,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } while (result->NextRow()); - for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr) - { - if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(itr->first)) - { - if (cInfo->AIName != "EventAI") - sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", itr->first); - } - } - sLog->outString(">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } -- cgit v1.2.3 From 1dc6bd69aa58b77b4ff79e72181d214f1eb7192b Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 3 Jun 2012 23:34:08 +0200 Subject: Core/Auth: Correct a bad error log during authentication --- src/server/game/Server/WorldSocket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 64137dfe7c7..98ec517cdac 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -955,6 +955,8 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) sha.UpdateBigNumbers (&k, NULL); sha.Finalize(); + std::string address = GetRemoteAddress(); + if (memcmp (sha.GetDigest(), digest, 20)) { packet.Initialize (SMSG_AUTH_RESPONSE, 1); @@ -962,13 +964,11 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (authentification failed)."); + sLog->outError("WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); return -1; } - std::string address = GetRemoteAddress(); - - sLog->outStaticDebug ("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", + sLog->outStaticDebug("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", account.c_str(), address.c_str()); -- cgit v1.2.3 From a757187d7d74a612f29ea2808302faf8ab12565d Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 3 Jun 2012 16:39:10 -0500 Subject: Fixed build --- src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 448e43db316..a863f2f89cf 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -204,15 +204,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() temp.raw.param3 = fields[8].GetInt32(); temp.raw.param4 = fields[9].GetInt32(); - CreatureTemplate* cInfo = sObjectMgr->GetCreatureTemplate(temp.creature_id); + CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature_id); //Creature does not exist in database if (!cInfo) { - sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id); + sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id); continue; } - if (cInfo->AIName != "EventAI") + // Only on the first script + if (cInfo->AIName != "EventAI" && m_CreatureEventAI_Event_Map[creature_id].empty()) sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id); //No chance of this event occuring -- cgit v1.2.3 From 37cd5081c19a11abad9b4f362cf3cdcead51ceda Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 3 Jun 2012 22:12:04 -0230 Subject: Core/spells: Set max targets for Spell Skartax Purple Beam --- src/server/game/Spells/SpellMgr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index cdaecdcaa20..05566bdf712 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3043,6 +3043,7 @@ void SpellMgr::LoadDbcDataCorrections() case 61588: // Blazing Harpoon case 52479: // Gift of the Harvester case 48246: // Ball of Flame + case 36384: // Skartax Purple Beam spellInfo->MaxAffectedTargets = 1; break; case 41376: // Spite @@ -3084,7 +3085,7 @@ void SpellMgr::LoadDbcDataCorrections() case 50312: // Unholy Frenzy spellInfo->MaxAffectedTargets = 15; break; - case 33711: //Murmur's Touch + case 33711: // Murmur's Touch case 38794: spellInfo->MaxAffectedTargets = 1; spellInfo->EffectTriggerSpell[0] = 33760; -- cgit v1.2.3 From d86246b86138c3786971b30ce5e411097e7b54ce Mon Sep 17 00:00:00 2001 From: kaelima Date: Mon, 4 Jun 2012 08:51:56 +0200 Subject: Core/Logging: Add optional binary packet logger usable with WowPacketParser, and remove the now useless WorldLog. TODO: Port this to .pkt 3.1 format --- src/server/game/Server/Protocol/PacketLog.cpp | 61 ++++++++++++++ src/server/game/Server/Protocol/PacketLog.h | 48 +++++++++++ src/server/game/Server/Protocol/WorldLog.cpp | 114 -------------------------- src/server/game/Server/Protocol/WorldLog.h | 61 -------------- src/server/game/Server/WorldSocket.cpp | 46 ++--------- src/server/worldserver/worldserver.conf.dist | 9 +- 6 files changed, 121 insertions(+), 218 deletions(-) create mode 100644 src/server/game/Server/Protocol/PacketLog.cpp create mode 100644 src/server/game/Server/Protocol/PacketLog.h delete mode 100755 src/server/game/Server/Protocol/WorldLog.cpp delete mode 100755 src/server/game/Server/Protocol/WorldLog.h (limited to 'src') diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp new file mode 100644 index 00000000000..bede48ace87 --- /dev/null +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +#include "PacketLog.h" +#include "Config.h" +#include "ByteBuffer.h" + +PacketLog::PacketLog() : _file(NULL) +{ + Initialize(); +} + +PacketLog::~PacketLog() +{ + if (_file) + fclose(_file); + + _file = NULL; +} + +void PacketLog::Initialize() +{ + std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + + if (!logsDir.empty()) + if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\')) + logsDir.push_back('/'); + + std::string logname = ConfigMgr::GetStringDefault("PacketLogFile", ""); + if (!logname.empty()) + _file = fopen((logsDir + logname).c_str(), "wb"); +} + +void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) +{ + ByteBuffer data(4+4+4+1+packet.size()); + data << int32(packet.GetOpcode()); + data << int32(packet.size()); + data << int32(time(NULL)); + data << uint8(direction); + + for (uint32 i = 0; i < packet.size(); i++) + data << const_cast(packet)[i]; + + fwrite(data.contents(), 1, data.size(), _file); + fflush(_file); +} diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h new file mode 100644 index 00000000000..6efdcfe67f2 --- /dev/null +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +#ifndef TRINITY_PACKETLOG_H +#define TRINITY_PACKETLOG_H + +#include "Common.h" +#include + +enum Direction +{ + CLIENT_TO_SERVER, + SERVER_TO_CLIENT +}; + +class PacketLog +{ + friend class ACE_Singleton; + + private: + PacketLog(); + ~PacketLog(); + + public: + void Initialize(); + bool CanLogPacket() const { return (_file != NULL); } + void LogPacket(WorldPacket const& packet, Direction direction); + + private: + FILE* _file; +}; + +#define sPacketLog ACE_Singleton::instance() +#endif diff --git a/src/server/game/Server/Protocol/WorldLog.cpp b/src/server/game/Server/Protocol/WorldLog.cpp deleted file mode 100755 index 38b13dff095..00000000000 --- a/src/server/game/Server/Protocol/WorldLog.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * 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 . - */ - -/** \file - \ingroup u2w -*/ - -#include "WorldLog.h" -#include "Config.h" -#include "Log.h" -#include "DatabaseWorkerPool.h" - -WorldLog::WorldLog() : i_file(NULL) -{ - Initialize(); -} - -WorldLog::~WorldLog() -{ - if (i_file != NULL) - fclose(i_file); - - i_file = NULL; -} - -/// Open the log file (if specified so in the configuration file) -void WorldLog::Initialize() -{ - std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); - - if (!logsDir.empty()) - { - if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\')) - logsDir.push_back('/'); - } - - std::string logname = ConfigMgr::GetStringDefault("WorldLogFile", ""); - if (!logname.empty()) - { - i_file = fopen((logsDir+logname).c_str(), "w"); - } - - m_dbWorld = ConfigMgr::GetBoolDefault("LogDB.World", false); // can be VERY heavy if enabled -} - -void WorldLog::outTimestampLog(char const* fmt, ...) -{ - if (LogWorld()) - { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); - ASSERT(i_file); - - Log::outTimestamp(i_file); - va_list args; - va_start(args, fmt); - vfprintf(i_file, fmt, args); - //fprintf(i_file, "\n"); - va_end(args); - - fflush(i_file); - } - - if (sLog->GetLogDB() && m_dbWorld) - { - va_list ap2; - va_start(ap2, fmt); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, fmt, ap2); - sLog->outDB(LOG_TYPE_WORLD, nnew_str); - va_end(ap2); - } -} - -void WorldLog::outLog(char const* fmt, ...) -{ - if (LogWorld()) - { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); - ASSERT(i_file); - - va_list args; - va_start(args, fmt); - vfprintf(i_file, fmt, args); - //fprintf(i_file, "\n"); - va_end(args); - - fflush(i_file); - } - - if (sLog->GetLogDB() && m_dbWorld) - { - va_list ap2; - va_start(ap2, fmt); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, fmt, ap2); - sLog->outDB(LOG_TYPE_WORLD, nnew_str); - va_end(ap2); - } -} diff --git a/src/server/game/Server/Protocol/WorldLog.h b/src/server/game/Server/Protocol/WorldLog.h deleted file mode 100755 index fb344f195de..00000000000 --- a/src/server/game/Server/Protocol/WorldLog.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * 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 . - */ - -/// \addtogroup u2w -/// @{ -/// \file - -#ifndef TRINITY_WORLDLOG_H -#define TRINITY_WORLDLOG_H - -#include "Common.h" -#include -#include "Errors.h" - -#include - -/// %Log packets to a file -class WorldLog -{ - friend class ACE_Singleton; - - private: - WorldLog(); - ~WorldLog(); - WorldLog(const WorldLog &); - WorldLog& operator=(const WorldLog &); - ACE_Thread_Mutex Lock; - - public: - void Initialize(); - /// Is the world logger active? - bool LogWorld(void) const { return (i_file != NULL); } - /// %Log to the file - void outLog(char const* fmt, ...); - void outTimestampLog(char const* fmt, ...); - - private: - FILE* i_file; - - bool m_dbWorld; -}; - -#define sWorldLog ACE_Singleton::instance() -#endif -/// @} - diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 98ec517cdac..74e414a43a9 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -42,7 +42,7 @@ #include "WorldSession.h" #include "WorldSocketMgr.h" #include "Log.h" -#include "WorldLog.h" +#include "PacketLog.h" #include "ScriptMgr.h" #include "AccountMgr.h" @@ -152,7 +152,7 @@ const std::string& WorldSocket::GetRemoteAddress (void) const return m_Address; } -int WorldSocket::SendPacket(const WorldPacket& pct) +int WorldSocket::SendPacket(WorldPacket const& pct) { ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); @@ -160,24 +160,8 @@ int WorldSocket::SendPacket(const WorldPacket& pct) return -1; // Dump outgoing packet. - if (sWorldLog->LogWorld()) - { - sWorldLog->outTimestampLog ("SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - (uint32) get_handle(), - pct.size(), - LookupOpcodeName (pct.GetOpcode()), - pct.GetOpcode()); - - uint32 p = 0; - while (p < pct.size()) - { - for (uint32 j = 0; j < 16 && p < pct.size(); j++) - sWorldLog->outLog("%.2X ", const_cast(pct)[p++]); - - sWorldLog->outLog("\n"); - } - sWorldLog->outLog("\n"); - } + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(pct, SERVER_TO_CLIENT); // Create a copy of the original packet; this is to avoid issues if a hook modifies it. sScriptMgr->OnPacketSend(this, WorldPacket(pct)); @@ -674,7 +658,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g) return 0; } -int WorldSocket::ProcessIncoming (WorldPacket* new_pct) +int WorldSocket::ProcessIncoming(WorldPacket* new_pct) { ACE_ASSERT (new_pct); @@ -687,24 +671,8 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) return -1; // Dump received packet. - if (sWorldLog->LogWorld()) - { - sWorldLog->outTimestampLog ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - (uint32) get_handle(), - new_pct->size(), - LookupOpcodeName (new_pct->GetOpcode()), - new_pct->GetOpcode()); - - uint32 p = 0; - while (p < new_pct->size()) - { - for (uint32 j = 0; j < 16 && p < new_pct->size(); j++) - sWorldLog->outLog ("%.2X ", (*new_pct)[p++]); - - sWorldLog->outLog ("\n"); - } - sWorldLog->outLog ("\n"); - } + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER); try { diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index d8a576f4031..b14038c9571 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -483,12 +483,13 @@ LogFileLevel = 0 DebugLogMask = 0 # -# WorldLogFile -# Description: Packet logging file for the world server. -# Example: "World.log" - (Enabled) +# PacketLogFile +# Description: Binary packet logging file for the world server. +# Filename extension must be .bin to be parsable with WowPacketParser. +# Example: "World.bin" - (Enabled) # Default: "" - (Disabled) -WorldLogFile = "" +PacketLogFile = "" # # DBErrorLogFile -- cgit v1.2.3 From d3c45cc3f2b7ad843208e5be37f95e25b7e77826 Mon Sep 17 00:00:00 2001 From: kaelima Date: Mon, 4 Jun 2012 09:14:31 +0200 Subject: Fixed build and removed an unused variable --- src/server/game/Battlegrounds/Battleground.cpp | 8 ++------ src/server/game/Server/Protocol/PacketLog.h | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index c589edcee7a..85bbd2f3b89 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -850,12 +850,8 @@ void Battleground::EndBattleground(uint32 winner) if (team == winner) { // update achievement BEFORE personal rating update - if (ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID())) - { - uint32 rating = player->GetArenaPersonalRating(winner_arena_team->GetSlot()); - player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, - rating ? rating : 1); - } + uint32 rating = player->GetArenaPersonalRating(winner_arena_team->GetSlot()); + player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1); winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change); } diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h index 6efdcfe67f2..b899daae198 100644 --- a/src/server/game/Server/Protocol/PacketLog.h +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -27,6 +27,8 @@ enum Direction SERVER_TO_CLIENT }; +class WorldPacket; + class PacketLog { friend class ACE_Singleton; -- cgit v1.2.3 From 19dbfbeb622101267a43ae7a87fc7e5fa2ccd588 Mon Sep 17 00:00:00 2001 From: Discover- Date: Mon, 4 Jun 2012 17:20:40 +0200 Subject: Core/SAI: Fixed a mistake in SMART_TARGET_INVOKER_PARTY which made it add the same player to the targetlist twice if there was a group. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 21dc92b25d1..e4c9e4a3047 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2123,12 +2123,20 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* case SMART_TARGET_INVOKER_PARTY: if (trigger) { - l->push_back(trigger); if (Player* player = trigger->ToPlayer()) + { if (Group* group = player->GetGroup()) + { for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) if (Player* member = groupRef->getSource()) l->push_back(member); + } + // We still add the player to the list if there is no group. If we do + // this even if there is a group (thus the else-check), it will add the + // same player to the list twice. We don't want that to happen. + else + l->push_back(trigger); + } } break; case SMART_TARGET_CREATURE_RANGE: -- cgit v1.2.3 From ff77610e1d3fee89507b8469b10bea800f8c0815 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 5 Jun 2012 10:30:44 +0200 Subject: Core/Quests: Fixed auto-accepting chain quests Closes #6475 --- src/server/game/Handlers/QuestHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 34fed5e9a97..ca5a5c311c5 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -324,7 +324,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) // Send next quest if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { - if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(quest, true)) + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) { _player->AddQuest(nextQuest, object); if (_player->CanCompleteQuest(nextQuest->GetQuestId())) -- cgit v1.2.3 From 933fad5183a57c0a40300d5c083a8e563ed72b27 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 5 Jun 2012 13:14:15 +0200 Subject: Core/Loot: Correct some values sent for roll packets --- src/server/game/Groups/Group.cpp | 62 +++++++++++++++---------------- src/server/game/Groups/Group.h | 6 +-- src/server/game/Handlers/GroupHandler.cpp | 14 +++---- src/server/game/Handlers/LootHandler.cpp | 8 ++-- 4 files changed, 46 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index c7648bf1ccc..9a898dbfc4c 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -525,7 +525,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV roll->playerVote.erase(itr2); - CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, MAX_ROLL_TYPE); + CountRollVote(guid, roll->itemGUID, MAX_ROLL_TYPE); } // Update subgroups @@ -732,7 +732,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r) WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4+1)); data << uint64(r.itemGUID); // guid of rolled item data << uint32(mapid); // 3.3.3 mapid - data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it??? + data << uint32(r.itemSlot); // itemslot data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for data << uint32(r.itemRandomSuffix); // randomSuffix data << uint32(r.itemRandomPropId); // item random property ID @@ -759,7 +759,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1)); data << uint64(r.itemGUID); // guid of rolled item data << uint32(mapId); // 3.3.3 mapid - data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it??? + data << uint32(r.itemSlot); // itemslot data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for data << uint32(r.itemRandomSuffix); // randomSuffix data << uint32(r.itemRandomPropId); // item random property ID @@ -773,20 +773,20 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, p->GetSession()->SendPacket(&data); } -void Group::SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r) +void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll) { WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1)); - data << uint64(SourceGuid); // guid of the item rolled - data << uint32(0); // unknown, maybe amount of players - data << uint64(TargetGuid); - data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for - data << uint32(r.itemRandomSuffix); // randomSuffix - data << uint32(r.itemRandomPropId); // Item random property ID - data << uint8(RollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number - data << uint8(RollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll - data << uint8(0); // auto pass on NeedBeforeGreed loot because player cannot use the object + data << uint64(sourceGuid); // guid of the item rolled + data << uint32(roll.itemSlot); // slot + data << uint64(targetGuid); + data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for + data << uint32(roll.itemRandomSuffix); // randomSuffix + data << uint32(roll.itemRandomPropId); // Item random property ID + data << uint8(rollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number + data << uint8(rollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll + data << uint8(0); // 1: "You automatically passed on: %s because you cannot loot that item." - Possibly used in need befor greed - for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) + for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr) { Player* p = ObjectAccessor::FindPlayer(itr->first); if (!p || !p->GetSession()) @@ -797,19 +797,19 @@ void Group::SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, } } -void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r) +void Group::SendLootRollWon(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll) { WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1)); - data << uint64(SourceGuid); // guid of the item rolled - data << uint32(0); // unknown, maybe amount of players - data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for - data << uint32(r.itemRandomSuffix); // randomSuffix - data << uint32(r.itemRandomPropId); // Item random property - data << uint64(TargetGuid); // guid of the player who won. - data << uint8(RollNumber); // rollnumber realted to SMSG_LOOT_ROLL - data << uint8(RollType); // Rolltype related to SMSG_LOOT_ROLL + data << uint64(sourceGuid); // guid of the item rolled + data << uint32(roll.itemSlot); // slot + data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for + data << uint32(roll.itemRandomSuffix); // randomSuffix + data << uint32(roll.itemRandomPropId); // Item random property + data << uint64(targetGuid); // guid of the player who won. + data << uint8(rollNumber); // rollnumber realted to SMSG_LOOT_ROLL + data << uint8(rollType); // rollType related to SMSG_LOOT_ROLL - for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) + for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr) { Player* p = ObjectAccessor::FindPlayer(itr->first); if (!p || !p->GetSession()) @@ -820,11 +820,11 @@ void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumb } } -void Group::SendLootAllPassed(uint32 numberOfPlayers, Roll const& roll) +void Group::SendLootAllPassed(Roll const& roll) { WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4)); data << uint64(roll.itemGUID); // Guid of the item rolled - data << uint32(numberOfPlayers); // The number of players rolling for it + data << uint32(roll.itemSlot); // Item loot slot data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for data << uint32(roll.itemRandomPropId); // Item random property ID data << uint32(roll.itemRandomSuffix); // Item random suffix ID @@ -1067,7 +1067,7 @@ void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) } } -void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint32 NumberOfPlayers, uint8 Choice) +void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice) { Rolls::iterator rollI = GetRoll(Guid); if (rollI == RollId.end()) @@ -1108,7 +1108,7 @@ void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint32 NumberOfPlayers } if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling) - CountTheRoll(rollI, NumberOfPlayers); + CountTheRoll(rollI); } //called when roll timer expires @@ -1117,7 +1117,7 @@ void Group::EndRoll(Loot* pLoot) for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();) { if ((*itr)->getLoot() == pLoot) { - CountTheRoll(itr, GetMembersCount()); //i don't have to edit player votes, who didn't vote ... he will pass + CountTheRoll(itr); //i don't have to edit player votes, who didn't vote ... he will pass itr = RollId.begin(); } else @@ -1125,7 +1125,7 @@ void Group::EndRoll(Loot* pLoot) } } -void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) +void Group::CountTheRoll(Rolls::iterator rollI) { Roll* roll = *rollI; if (!roll->isValid()) // is loot already deleted ? @@ -1248,7 +1248,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) } else { - SendLootAllPassed(NumberOfPlayers, *roll); + SendLootAllPassed(*roll); // remove is_blocked so that the item is lootable by all players LootItem* item = &(roll->getLoot()->items[roll->itemSlot]); diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 03f946cd3b6..1f932567319 100755 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -276,14 +276,14 @@ class Group void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, bool canNeed, Roll const& r); void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); - void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r); + void SendLootAllPassed(Roll const& roll); void SendLooter(Creature* creature, Player* pLooter); void GroupLoot(Loot* loot, WorldObject* pLootedObject); void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject); void MasterLoot(Loot* loot, WorldObject* pLootedObject); Rolls::iterator GetRoll(uint64 Guid); - void CountTheRoll(Rolls::iterator roll, uint32 NumberOfPlayers); - void CountRollVote(uint64 playerGUID, uint64 Guid, uint32 NumberOfPlayers, uint8 Choise); + void CountTheRoll(Rolls::iterator roll); + void CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choise); void EndRoll(Loot* loot); // related to disenchant rolls diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index de8dc2b90f6..1dec75628fb 100755 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -429,7 +429,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data) group->SendUpdate(); } -void WorldSession::HandleLootRoll(WorldPacket &recv_data) +void WorldSession::HandleLootRoll(WorldPacket& recvData) { Group* group = GetPlayer()->GetGroup(); if (!group) @@ -438,15 +438,15 @@ void WorldSession::HandleLootRoll(WorldPacket &recv_data) return; } - uint64 Guid; - uint32 NumberOfPlayers; + uint64 guid; + uint32 itemSlot; uint8 rollType; - recv_data >> Guid; //guid of the item rolled - recv_data >> NumberOfPlayers; - recv_data >> rollType; //0: pass, 1: need, 2: greed + recvData >> guid; // guid of the item rolled + recvData >> itemSlot; + recvData >> rollType; // 0: pass, 1: need, 2: greed // everything's fine, do it - group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, rollType); + group->CountRollVote(GetPlayer()->GetGUID(), guid, rollType); switch (rollType) { diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 8e4b41a9be4..339c7a44d9f 100755 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -220,16 +220,18 @@ void WorldSession::HandleLootOpcode(WorldPacket & recv_data) GetPlayer()->InterruptNonMeleeSpells(false); } -void WorldSession::HandleLootReleaseOpcode(WorldPacket & recv_data) +void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_RELEASE"); // cheaters can modify lguid to prevent correct apply loot release code and re-loot // use internal stored guid - recv_data.read_skip(); // guid; + uint64 guid; + recvData >> guid; if (uint64 lguid = GetPlayer()->GetLootGUID()) - DoLootRelease(lguid); + if (lguid == guid) + DoLootRelease(lguid); } void WorldSession::DoLootRelease(uint64 lguid) -- cgit v1.2.3 From a43c3e815a34ffa6f905fb005044f848b3d38741 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 5 Jun 2012 13:17:43 +0200 Subject: Core/Protocol: Correct cooldowns sent with SMSG_PET_SPELLS and add summon duration --- .../game/Entities/Creature/TemporarySummon.h | 1 + src/server/game/Entities/Pet/Pet.h | 1 + src/server/game/Entities/Player/Player.cpp | 149 ++++++++++++--------- 3 files changed, 85 insertions(+), 66 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index 829eb73bf80..537bbd9c099 100755 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -36,6 +36,7 @@ class TempSummon : public Creature Unit* GetSummoner() const; uint64 GetSummonerGUID() { return m_summonerGUID; } TempSummonType const& GetSummonType() { return m_type; } + uint32 GetTimer() { return m_timer; } const SummonPropertiesEntry* const m_Properties; private: diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 1b1a6c0f62d..3475817816d 100755 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -164,6 +164,7 @@ class Pet : public Guardian bool HaveInDiet(ItemTemplate const* item) const; uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel); void SetDuration(int32 dur) { m_duration = dur; } + int32 GetDuration() { return m_duration; } /* bool UpdateStats(Stats stat); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 4cf6d4ad979..53defc0c017 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3322,7 +3322,7 @@ void Player::SendInitialSpells() uint16 spellCooldowns = m_spellCooldowns.size(); data << uint16(spellCooldowns); - for (SpellCooldowns::const_iterator itr=m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr) + for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr) { SpellInfo const* sEntry = sSpellMgr->GetSpellInfo(itr->first); if (!sEntry) @@ -9103,7 +9103,6 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot->loot_type = loot_type; WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size - data << uint64(guid); data << uint8(loot_type); data << LootView(*loot, this, permission); @@ -13555,9 +13554,9 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint } case EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM: // no idea about this one... { - data << uint64(0); - data << uint32(0); - data << uint64(0); + data << uint64(0); // item guid + data << uint32(0); // slot + data << uint64(0); // container break; } case EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED: @@ -14242,7 +14241,7 @@ void Player::SendNewItem(Item* item, uint32 count, bool received, bool created, data << uint64(GetGUID()); // player GUID data << uint32(received); // 0=looted, 1=from npc data << uint32(created); // 0=received, 1=created - data << uint32(1); // always 0x01 (probably meant to be count of listed items) + data << uint32(1); // bool print error to chat data << uint8(item->GetBagSlot()); // bagslot // item slot, but when added to stack: 0xFFFFFFFF data << uint32((item->GetCount() == count) ? item->GetSlot() : -1); @@ -20121,8 +20120,10 @@ void Player::PetSpellInitialize() WorldPacket data(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1); data << uint64(pet->GetGUID()); data << uint16(pet->GetCreatureTemplate()->family); // creature family (required for pet talents) - data << uint32(0); - data << uint8(pet->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0); + data << uint32(pet->GetDuration()); + data << uint8(pet->GetReactState()); + data << uint8(charmInfo->GetCommandState()); + data << uint16(0); // Flags, mostly unknown // action bar loop charmInfo->BuildActionBar(&data); @@ -20155,22 +20156,33 @@ void Player::PetSpellInitialize() for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr) { - time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0; - - data << uint32(itr->first); // spellid - data << uint16(0); // spell category? - data << uint32(cooldown); // cooldown - data << uint32(0); // category cooldown - } + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); + if (!spellInfo) + { + data << uint32(0); + data << uint16(0); + data << uint32(0); + data << uint32(0); + continue; + } - for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureCategoryCooldowns.begin(); itr != pet->m_CreatureCategoryCooldowns.end(); ++itr) - { time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0; + data << uint32(itr->first); // spell ID - data << uint32(itr->first); // spellid - data << uint16(0); // spell category? - data << uint32(0); // cooldown - data << uint32(cooldown); // category cooldown + CreatureSpellCooldowns::const_iterator categoryitr = pet->m_CreatureCategoryCooldowns.find(spellInfo->Category); + if (categoryitr != pet->m_CreatureCategoryCooldowns.end()) + { + time_t categoryCooldown = (categoryitr->second > curTime) ? (categoryitr->second - curTime) * IN_MILLISECONDS : 0; + data << uint16(spellInfo->Category); // spell category + data << uint32(cooldown); // spell cooldown + data << uint32(categoryCooldown); // category cooldown + } + else + { + data << uint16(0); + data << uint32(cooldown); + data << uint32(0); + } } GetSession()->SendPacket(&data); @@ -20206,24 +20218,24 @@ void Player::PossessSpellInitialize() void Player::VehicleSpellInitialize() { - Creature* veh = GetVehicleCreatureBase(); - if (!veh) + Creature* vehicle = GetVehicleCreatureBase(); + if (!vehicle) return; - uint8 cooldownCount = veh->m_CreatureSpellCooldowns.size() + veh->m_CreatureCategoryCooldowns.size(); + uint8 cooldownCount = vehicle->m_CreatureSpellCooldowns.size(); WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * 10 + 1 + 1 + cooldownCount * (4 + 2 + 4 + 4)); - data << uint64(veh->GetGUID()); - data << uint16(veh->GetCreatureTemplate()->family); - data << uint32(0); - // The following three segments are read as one uint32 - data << uint8(veh->GetReactState()); - data << uint8(0); // CommandState? - data << uint16(0); // unk + data << uint64(vehicle->GetGUID()); // Guid + data << uint16(0); // Pet Family (0 for all vehicles) + data << uint32(vehicle->isSummon() ? vehicle->ToTempSummon()->GetTimer() : 0); // Duration + // The following three segments are read by the client as one uint32 + data << uint8(vehicle->GetReactState()); // React State + data << uint8(0); // Command State + data << uint16(0x800); // DisableActions (set for all vehicles) for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { - uint32 spellId = veh->m_spells[i]; + uint32 spellId = vehicle->m_spells[i]; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { @@ -20231,54 +20243,59 @@ void Player::VehicleSpellInitialize() continue; } - ConditionList conditions = sConditionMgr->GetConditionsForVehicleSpell(veh->GetEntry(), spellId); - if (!sConditionMgr->IsObjectMeetToConditions(this, veh, conditions)) + ConditionList conditions = sConditionMgr->GetConditionsForVehicleSpell(vehicle->GetEntry(), spellId); + if (!sConditionMgr->IsObjectMeetToConditions(this, vehicle, conditions)) { - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", veh->ToCreature()->GetEntry(), spellId); + sLog->outDebug(LOG_FILTER_CONDITIONSYS, "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", vehicle->ToCreature()->GetEntry(), spellId); data << uint16(0) << uint8(0) << uint8(i+8); continue; } if (spellInfo->IsPassive()) - { - veh->CastSpell(veh, spellId, true); - data << uint16(0) << uint8(0) << uint8(i+8); - } - else - data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, i+8)); + vehicle->CastSpell(vehicle, spellId, true); + + data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, i+8)); } for (uint32 i = CREATURE_MAX_SPELLS; i < MAX_SPELL_CONTROL_BAR; ++i) - data << uint16(0) << uint8(0) << uint8(i+8); + data << uint32(0); - data << uint8(0); - /*if (v23 > 0) - { - for (uint32 i = 0; i < v23; ++i) - data << uint32(v16); // Some spellid? - }*/ + data << uint8(0); // Auras? // Cooldowns - data << cooldownCount; + data << uint8(cooldownCount); time_t now = sWorld->GetGameTime(); - CreatureSpellCooldowns::const_iterator itr; - for (itr = veh->m_CreatureSpellCooldowns.begin(); itr != veh->m_CreatureSpellCooldowns.end(); ++itr) - { - time_t cooldown = (itr->second > now) ? (itr->second - now) * IN_MILLISECONDS : 0; - data << uint32(itr->first); // SpellId - data << uint16(0); // unk - data << uint32(cooldown); // spell cooldown - data << uint32(0); // category cooldown - } - for (itr = veh->m_CreatureCategoryCooldowns.begin(); itr != veh->m_CreatureCategoryCooldowns.end(); ++itr) + for (CreatureSpellCooldowns::const_iterator itr = vehicle->m_CreatureSpellCooldowns.begin(); itr != vehicle->m_CreatureSpellCooldowns.end(); ++itr) { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); + if (!spellInfo) + { + data << uint32(0); + data << uint16(0); + data << uint32(0); + data << uint32(0); + continue; + } + time_t cooldown = (itr->second > now) ? (itr->second - now) * IN_MILLISECONDS : 0; - data << uint32(itr->first); // SpellId - data << uint16(0); // unk - data << uint32(0); // spell cooldown - data << uint32(cooldown); // category cooldown + data << uint32(itr->first); // spell ID + + CreatureSpellCooldowns::const_iterator categoryitr = vehicle->m_CreatureCategoryCooldowns.find(spellInfo->Category); + if (categoryitr != vehicle->m_CreatureCategoryCooldowns.end()) + { + time_t categoryCooldown = (categoryitr->second > now) ? (categoryitr->second - now) * IN_MILLISECONDS : 0; + data << uint16(spellInfo->Category); // spell category + data << uint32(cooldown); // spell cooldown + data << uint32(categoryCooldown); // category cooldown + } + else + { + data << uint16(0); + data << uint32(cooldown); + data << uint32(0); + } } GetSession()->SendPacket(&data); @@ -20317,7 +20334,7 @@ void Player::CharmSpellInitialize() if (charm->GetTypeId() != TYPEID_PLAYER) data << uint8(charm->ToCreature()->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0); else - data << uint8(0) << uint8(0) << uint16(0); + data << uint32(0); charmInfo->BuildActionBar(&data); @@ -22299,8 +22316,8 @@ void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint3 data << uint32(time); if (type == RAID_INSTANCE_WELCOME) { - data << uint8(0); // is your (1) - data << uint8(0); // is extended (1), ignored if prev field is 0 + data << uint8(0); // is locked + data << uint8(0); // is extended, ignored if prev field is 0 } GetSession()->SendPacket(&data); } -- cgit v1.2.3 From 7e71488a1ea9f86b605821980a5ee7dbbb375b81 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 5 Jun 2012 13:23:37 +0200 Subject: Fixed build (forgot to save file) --- src/server/game/Handlers/GroupHandler.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 1dec75628fb..18435263b2e 100755 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -431,13 +431,6 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data) void WorldSession::HandleLootRoll(WorldPacket& recvData) { - Group* group = GetPlayer()->GetGroup(); - if (!group) - { - recv_data.rfinish(); - return; - } - uint64 guid; uint32 itemSlot; uint8 rollType; @@ -445,7 +438,10 @@ void WorldSession::HandleLootRoll(WorldPacket& recvData) recvData >> itemSlot; recvData >> rollType; // 0: pass, 1: need, 2: greed - // everything's fine, do it + Group* group = GetPlayer()->GetGroup(); + if (!group) + return; + group->CountRollVote(GetPlayer()->GetGUID(), guid, rollType); switch (rollType) -- cgit v1.2.3 From 295b1a00c8fa111c8a959fd2bf58534f759d7d5d Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 5 Jun 2012 14:53:18 +0200 Subject: Scripts/Icecrown Citadel: Fixed Sindragosa, Spinestalker and Rimefang flying in after related trash packs are dead - this solution is resistant to grid unload. --- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 22 +-- .../IcecrownCitadel/instance_icecrown_citadel.cpp | 187 +++++++++++---------- 2 files changed, 108 insertions(+), 101 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 734639a8b51..9baf6ba7a00 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -651,7 +651,7 @@ class npc_spinestalker : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -674,13 +674,12 @@ class npc_spinestalker : public CreatureScript void JustRespawned() { ScriptedAI::JustRespawned(); - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) { _events.Reset(); - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 0); } void DoAction(int32 const action) @@ -778,7 +777,7 @@ class npc_rimefang : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -801,13 +800,12 @@ class npc_rimefang : public CreatureScript void JustRespawned() { ScriptedAI::JustRespawned(); - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) { _events.Reset(); - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 0); } void DoAction(int32 const action) @@ -934,7 +932,8 @@ class npc_sindragosa_trash : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetData(_frostwyrmId, 1); // this cannot be in Reset because reset also happens on evade + if (me->GetEntry() == NPC_FROSTWING_WHELP) + _instance->SetData64(_frostwyrmId, me->GetGUID()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -956,13 +955,8 @@ class npc_sindragosa_trash : public CreatureScript ScriptedAI::JustRespawned(); // Increase add count - _instance->SetData(_frostwyrmId, 1); // this cannot be in Reset because reset also happens on evade - } - - void JustDied(Unit* /*killer*/) - { - // Decrease add count - _instance->SetData(_frostwyrmId, 0); + if (me->GetEntry() == NPC_FROSTWING_WHELP) + _instance->SetData64(_frostwyrmId, me->GetGUID()); // this cannot be in Reset because reset also happens on evade } void SetData(uint32 type, uint32 data) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index cb83efc748f..288fde28c38 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -89,6 +89,13 @@ WeeklyQuest const WeeklyQuestData[WeeklyNPCs] = {NPC_VALITHRIA_DREAMWALKER_QUEST, {QUEST_RESPITE_FOR_A_TORNMENTED_SOUL_10, QUEST_RESPITE_FOR_A_TORNMENTED_SOUL_25}}, // Respite for a Tormented Soul }; +enum FrostwyrmFlags +{ + FLAG_SPINESTALKER_SUMMONED = 0x01, + FLAG_RIMEFANG_SUMMONED = 0x02, + FLAG_SINDRAGOSA_SUMMONED = 0x04, +}; + class instance_icecrown_citadel : public InstanceMapScript { public: @@ -138,9 +145,6 @@ class instance_icecrown_citadel : public InstanceMapScript FrozenThroneEdgeGUID = 0; FrozenThroneWindGUID = 0; FrozenThroneWarningGUID = 0; - FrostwyrmCount = 0; - SpinestalkerTrashCount = 0; - RimefangTrashCount = 0; IsBonedEligible = true; IsOozeDanceEligible = true; IsNauseaEligible = true; @@ -148,6 +152,7 @@ class instance_icecrown_citadel : public InstanceMapScript ColdflameJetsState = NOT_STARTED; BloodQuickeningState = NOT_STARTED; BloodQuickeningMinutes = 0; + FrostwyrmFlags = 0; } void FillInitialWorldStates(WorldPacket& data) @@ -279,9 +284,13 @@ class instance_icecrown_citadel : public InstanceMapScript break; case NPC_SPINESTALKER: SpinestalkerGUID = creature->GetGUID(); + if (!creature->isAlive()) + FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; break; case NPC_RIMEFANG: RimefangGUID = creature->GetGUID(); + if (!creature->isAlive()) + FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; break; case NPC_THE_LICH_KING: TheLichKingGUID = creature->GetGUID(); @@ -347,6 +356,56 @@ class instance_icecrown_citadel : public InstanceMapScript if (Creature* crok = instance->GetCreature(CrokScourgebaneGUID)) crok->AI()->SetGUID(creature->GetGUID(), ACTION_VRYKUL_DEATH); break; + case NPC_FROSTWING_WHELP: + if (creature->AI()->GetData(1/*DATA_FROSTWYRM_OWNER*/) == DATA_SPINESTALKER) + { + if (FrostwyrmFlags & FLAG_SPINESTALKER_SUMMONED) + return; + + SpinestalkerTrash.erase(creature->GetGUID()); + if (SpinestalkerTrash.empty()) + { + FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; + if (Creature* spinestalk = instance->GetCreature(SpinestalkerGUID)) + spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM); + } + } + else + { + if (FrostwyrmFlags & FLAG_RIMEFANG_SUMMONED) + return; + + RimefangTrash.erase(creature->GetGUID()); + if (RimefangTrash.empty()) + { + FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; + if (Creature* spinestalk = instance->GetCreature(RimefangGUID)) + spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM); + } + } + break; + case NPC_RIMEFANG: + case NPC_SPINESTALKER: + { + if (FrostwyrmFlags & FLAG_SINDRAGOSA_SUMMONED) + return; + + if (instance->IsHeroic() && !HeroicAttempts) + return; + + if (GetBossState(DATA_SINDRAGOSA) == DONE) + return; + + FrostwyrmGUIDs.erase(creature->GetGUID()); + if (FrostwyrmGUIDs.empty()) + { + FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; + instance->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY()); + if (Creature* boss = instance->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos)) + boss->AI()->DoAction(ACTION_START_FROSTWYRM); + } + break; + } default: break; } @@ -538,11 +597,17 @@ class instance_icecrown_citadel : public InstanceMapScript switch (type) { case DATA_SINDRAGOSA_FROSTWYRMS: - return FrostwyrmCount; + if (FrostwyrmFlags & FLAG_SINDRAGOSA_SUMMONED) + return 255; + return FrostwyrmGUIDs.size(); case DATA_SPINESTALKER: - return SpinestalkerTrashCount; + if (FrostwyrmFlags & FLAG_SPINESTALKER_SUMMONED) + return 255; + return SpinestalkerTrash.size(); case DATA_RIMEFANG: - return RimefangTrashCount; + if (FrostwyrmFlags & FLAG_RIMEFANG_SUMMONED) + return 255; + return RimefangTrash.size(); case DATA_COLDFLAME_JETS: return ColdflameJetsState; case DATA_TEAM_IN_INSTANCE: @@ -741,6 +806,9 @@ class instance_icecrown_citadel : public InstanceMapScript sindra->DespawnOrUnsummon(); } } + // Reached when loading from DB + if (state == DONE) + FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; break; case DATA_THE_LICH_KING: { @@ -798,89 +866,17 @@ class instance_icecrown_citadel : public InstanceMapScript IsOrbWhispererEligible = data ? true : false; break; case DATA_SINDRAGOSA_FROSTWYRMS: - { - if (FrostwyrmCount == 255) - return; - - if (instance->IsHeroic() && !HeroicAttempts) - return; - - if (GetBossState(DATA_SINDRAGOSA) == DONE) - return; - - switch (data) - { - case 0: - if (FrostwyrmCount) - { - --FrostwyrmCount; - if (!FrostwyrmCount) - { - instance->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY()); - if (Creature* boss = instance->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos)) - boss->AI()->DoAction(ACTION_START_FROSTWYRM); - } - } - break; - case 1: - ++FrostwyrmCount; - break; - default: - FrostwyrmCount = data; - break; - } + if (data == 255) + FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; break; - } case DATA_SPINESTALKER: - { - if (SpinestalkerTrashCount == 255) - return; - - switch (data) - { - case 0: - if (SpinestalkerTrashCount) - { - --SpinestalkerTrashCount; - if (!SpinestalkerTrashCount) - if (Creature* spinestalk = instance->GetCreature(SpinestalkerGUID)) - spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM); - } - break; - case 1: - ++SpinestalkerTrashCount; - break; - default: - SpinestalkerTrashCount = data; - break; - } + if (data == 255) + FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; break; - } case DATA_RIMEFANG: - { - if (RimefangTrashCount == 255) - return; - - switch (data) - { - case 0: - if (RimefangTrashCount) - { - --RimefangTrashCount; - if (!RimefangTrashCount) - if (Creature* rime = instance->GetCreature(RimefangGUID)) - rime->AI()->DoAction(ACTION_START_FROSTWYRM); - } - break; - case 1: - ++RimefangTrashCount; - break; - default: - RimefangTrashCount = data; - break; - } + if (data == 255) + FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; break; - } case DATA_COLDFLAME_JETS: ColdflameJetsState = data; if (ColdflameJetsState == DONE) @@ -922,6 +918,22 @@ class instance_icecrown_citadel : public InstanceMapScript } } + void SetData64(uint32 id, uint64 data) + { + switch (id) + { + case DATA_SINDRAGOSA_FROSTWYRMS: + FrostwyrmGUIDs.insert(data); + break; + case DATA_SPINESTALKER: + SpinestalkerTrash.insert(data); + break; + case DATA_RIMEFANG: + RimefangTrash.insert(data); + break; + } + } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) { switch (criteria_id) @@ -1289,12 +1301,13 @@ class instance_icecrown_citadel : public InstanceMapScript uint64 PillarsUnchainedGUID; uint32 TeamInInstance; uint32 ColdflameJetsState; - uint32 FrostwyrmCount; - uint32 SpinestalkerTrashCount; - uint32 RimefangTrashCount; + std::set FrostwyrmGUIDs; + std::set SpinestalkerTrash; + std::set RimefangTrash; uint32 BloodQuickeningState; uint32 HeroicAttempts; uint16 BloodQuickeningMinutes; + uint16 FrostwyrmFlags; bool IsBonedEligible; bool IsOozeDanceEligible; bool IsNauseaEligible; -- cgit v1.2.3 From 8c841d12b3e00c6f4e50a72113dbaac03a6158f4 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 5 Jun 2012 20:44:13 +0200 Subject: Scripts/Ulduar: Fixed some various bugs with XT-002 Deconstructor. He will now properly reset if he evades while being submerged. He will not always die directly after heart phase. Adds will now despawn on reset. Heart will now change seat and set unit flags properly, but is still not attackable by melee (seems like a vehicle flag bug) --- .../scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp | 61 ++++++++++++---------- 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index c7091b42c5a..a2044854672 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -170,7 +170,11 @@ enum AchievementCredits ACHIEV_MUST_DECONSTRUCT_FASTER = 21027, }; -#define HEART_VEHICLE_SEAT 0 +enum VehicleSeats +{ + HEART_VEHICLE_SEAT_NORMAL = 0, + HEART_VEHICLE_SEAT_EXPOSED = 1, +}; /*------------------------------------------------------- * @@ -198,6 +202,8 @@ class boss_xt002 : public CreatureScript _Reset(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + DoCast(me, SPELL_STAND); _healthRecovered = false; _gravityBombCasualty = false; @@ -356,15 +362,16 @@ class boss_xt002 : public CreatureScript me->AttackStop(); me->SetReactState(REACT_PASSIVE); - Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL; + Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT_NORMAL) : NULL; if (heart) { heart->CastSpell(heart, SPELL_HEART_OVERLOAD, false); heart->CastSpell(me, SPELL_HEART_LIGHTNING_TETHER, false); heart->CastSpell(heart, SPELL_HEART_HEAL_TO_FULL, true); heart->CastSpell(heart, SPELL_EXPOSED_HEART, false); // Channeled - - heart->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + heart->ChangeSeat(HEART_VEHICLE_SEAT_EXPOSED, true); + heart->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); } events.CancelEvent(EVENT_SEARING_LIGHT); @@ -392,11 +399,13 @@ class boss_xt002 : public CreatureScript events.RescheduleEvent(EVENT_GRAVITY_BOMB, TIMER_GRAVITY_BOMB); events.RescheduleEvent(EVENT_TYMPANIC_TANTRUM, urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX)); - Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL; + Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT_EXPOSED) : NULL; if (!heart) return; - heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + heart->ChangeSeat(HEART_VEHICLE_SEAT_NORMAL, false); + heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + heart->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); heart->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART); if (!_hardMode) @@ -425,43 +434,39 @@ class boss_xt002 : public CreatureScript * XT-002 HEART * *///---------------------------------------------------- + class mob_xt002_heart : public CreatureScript { public: mob_xt002_heart() : CreatureScript("mob_xt002_heart") { } - CreatureAI* GetAI(Creature* creature) const + struct mob_xt002_heartAI : public Scripted_NoMovementAI { - return new mob_xt002_heartAI(creature); - } - - struct mob_xt002_heartAI : public ScriptedAI - { - mob_xt002_heartAI(Creature* creature) : ScriptedAI(creature) + mob_xt002_heartAI(Creature* creature) : Scripted_NoMovementAI(creature), + _instance(creature->GetInstanceScript()) { - _instance = creature->GetInstanceScript(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetReactState(REACT_PASSIVE); } - void DamageTaken(Unit* /*pDone*/, uint32 &damage) + void UpdateAI(uint32 const /*diff*/) { } + + void JustDied(Unit* /*killer*/) { - Creature* xt002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002)); + Creature* xt002 = _instance ? me->GetCreature(*me, _instance->GetData64(BOSS_XT002)) : NULL; if (!xt002 || !xt002->AI()) return; - if (damage >= me->GetHealth()) - { - xt002->AI()->SetData(DATA_TRANSFERED_HEALTH, me->GetMaxHealth()); - xt002->AI()->DoAction(ACTION_ENTER_HARD_MODE); - damage = 0; - } + xt002->AI()->SetData(DATA_TRANSFERED_HEALTH, me->GetHealth()); + xt002->AI()->DoAction(ACTION_ENTER_HARD_MODE); } - private: - InstanceScript* _instance; - uint32 _damageTaken; + private: + InstanceScript* _instance; }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_xt002_heartAI(creature); + } }; /*------------------------------------------------------- @@ -915,7 +920,7 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader { uint8 a = urand(0, 4); uint32 spellId = spells[a]; - toyPile->CastSpell(toyPile, spellId, true); + toyPile->CastSpell(toyPile, spellId, true, NULL, NULL, instance->GetData64(BOSS_XT002)); } } } -- cgit v1.2.3 From 565aa070feb53db2a91b25cdc27f0e166cff48c9 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Tue, 5 Jun 2012 20:52:38 -0230 Subject: DB/Gossip Core/Scripts: Fix Gossip for Witch Doctor Mau'ari --- sql/updates/world/2012_06_05_01_world_gossip.sql | 24 ++++++++++++++ src/server/scripts/Kalimdor/winterspring.cpp | 42 ------------------------ 2 files changed, 24 insertions(+), 42 deletions(-) create mode 100644 sql/updates/world/2012_06_05_01_world_gossip.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_05_01_world_gossip.sql b/sql/updates/world/2012_06_05_01_world_gossip.sql new file mode 100644 index 00000000000..11697eeffd4 --- /dev/null +++ b/sql/updates/world/2012_06_05_01_world_gossip.sql @@ -0,0 +1,24 @@ +-- Witch Doctor Mau'ari SAI +SET @ENTRY := 10307; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0 AND `id` IN (1,2); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,1,2,62,0,100,0,2703,2,0,0,85,16351,0,0,0,0,0,7,0,0,0,0,0,0,0,'Witch Doctor Mau''ari - On Gossip Option 2 Select - Cast Spell'), +(@ENTRY,0,2,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Witch Doctor Mau''ari - On Gossip Option 2 Select - Close gossip'); +-- Add some missing gossip for Witch Doctor Mau'ari +UPDATE `creature_template` SET `gossip_menu_id`=2703,`ScriptName`='' WHERE `entry`=10307; +DELETE FROM `gossip_menu` WHERE `entry` IN (2703,21320,21321); +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (2703,3375),(2703,3377),(21320,3382),(21321,3383); +DELETE FROM `gossip_menu_option` WHERE `menu_id`=2703 AND `id` IN (0,1,2); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`) VALUES +(2703,0,0, 'How do I use the Cache of Mau''ari?',1,1,21320,0,0,0, ''), +(2703,1,0, 'What is E''ko?',1,1,21321,0,0,0, ''), +(2703,2,0, 'I''d like you to make me a new Cache of Mau''ari please',1,1,0,0,0,0, ''); +-- Add conditions for gossip text +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=2703; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(14,2703,3377,0,8,975,0,0,0,0,'','Only show gossip text 3377 if player has completed quest 975'); +-- Add conditions for gossip options +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=2703; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,2703,2,0,8,975,0,0,0,0,'','Only show gossip option if player has completed quest 975'), +(15,2703,2,0,2,12384,1,1,1,0,'','Only show gossip option if player Does not have item 12384'); diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index a02156ee110..6143fbaf74b 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -26,7 +26,6 @@ EndScriptData */ /* ContentData npc_lorax npc_rivern_frostwind -npc_witch_doctor_mauari EndContentData */ #include "ScriptMgr.h" @@ -131,49 +130,8 @@ public: }; -/*###### -## npc_witch_doctor_mauari -######*/ - -#define GOSSIP_HWDM "I'd like you to make me a new Cache of Mau'ari please." - -class npc_witch_doctor_mauari : public CreatureScript -{ -public: - npc_witch_doctor_mauari() : CreatureScript("npc_witch_doctor_mauari") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF+1) - { - player->CLOSE_GOSSIP_MENU(); - creature->CastSpell(player, 16351, false); - } - - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestRewardStatus(975)) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(3377, creature->GetGUID()); - } - else - player->SEND_GOSSIP_MENU(3375, creature->GetGUID()); - - return true; - } -}; - void AddSC_winterspring() { new npc_lorax(); new npc_rivern_frostwind(); - new npc_witch_doctor_mauari(); } -- cgit v1.2.3 From 4ca77c5b0bf01752f9302a7591ba0c4226b889e1 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Tue, 5 Jun 2012 21:50:05 -0230 Subject: DB/Gossip Core/Scripts: Replace core script with db gossip for Lorax --- .../world/2012_06_05_01_world_gossip_sai.sql | 23 ++++++++ src/server/scripts/Kalimdor/winterspring.cpp | 67 ---------------------- 2 files changed, 23 insertions(+), 67 deletions(-) create mode 100644 sql/updates/world/2012_06_05_01_world_gossip_sai.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_05_01_world_gossip_sai.sql b/sql/updates/world/2012_06_05_01_world_gossip_sai.sql new file mode 100644 index 00000000000..84893613c75 --- /dev/null +++ b/sql/updates/world/2012_06_05_01_world_gossip_sai.sql @@ -0,0 +1,23 @@ +-- Lorax SAI +SET @ENTRY := 10918; +UPDATE `creature_template` SET `AIName`= 'SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,62,0,100,0,3051,0,0,0,5,11,0,0,0,0,0,1,0,0,0,0,0,0,0,'Lorax - On Gossip Option Select - Laugh emote'), +(@ENTRY,0,1,2,62,0,100,0,3054,0,0,0,15,5126,0,0,0,0,0,7,0,0,0,0,0,0,0,'Lorax - On Gossip Option Select - Give Quest Credit'), +(@ENTRY,0,2,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Lorax - On Gossip Option Select - Close gossip'); +-- Lorax Gossip +DELETE FROM `gossip_menu` WHERE `entry` IN (3050,3051,3052,3053,3054); +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (3050,3759),(3051,3760),(3052,3761),(3053,3762),(3054,3763); +DELETE FROM `gossip_menu_option` WHERE `menu_id` BETWEEN 3049 AND 3054; +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`) VALUES +(3049,0,0, 'You will have to excuse me, Lorax, I do not speak ''crazy''.',1,1,3050,0,0,0, ''), +(3050,0,0, 'My apologies, I did not realize that you could understand what I was saying. What is it you are doing out here?',1,1,3051,0,0,0, ''), +(3051,0,0, 'Do you? Perhaps you should tell me what it is that is bothering you',1,1,3052,0,0,0, ''), +(3052,0,0, 'What deal?',1,1,3053,0,0,0, ''), +(3053,0,0, 'So how did he break the deal?',1,1,3054,0,0,0, ''), +(3054,0,0, 'Perhaps I can be of some assistance. I will make a deal with you, Satyr. I shall recover this unforged breastplate and slay the beast. In exchange for this task, you will teach me how to create the breastplate',1,1,0,0,0,0, ''); +-- Add conditions for gossip options +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=3049; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,3049,0,0,9,5126,0,0,0,0,'','Only show gossip option if player has quest 5126'); diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index 6143fbaf74b..cdcfedb9892 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -24,7 +24,6 @@ SDCategory: Winterspring EndScriptData */ /* ContentData -npc_lorax npc_rivern_frostwind EndContentData */ @@ -32,71 +31,6 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" -/*###### -## npc_lorax -######*/ - -#define GOSSIP_HL "Talk to me" - -#define GOSSIP_SL1 "What do you do here?" -#define GOSSIP_SL2 "I can help you" -#define GOSSIP_SL3 "What deal?" -#define GOSSIP_SL4 "Then what happened?" -#define GOSSIP_SL5 "He is not safe, i'll make sure of that." - -class npc_lorax : public CreatureScript -{ -public: - npc_lorax() : CreatureScript("npc_lorax") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(3759, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(3760, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(3761, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->SEND_GOSSIP_MENU(3762, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - player->SEND_GOSSIP_MENU(3763, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->CLOSE_GOSSIP_MENU(); - player->AreaExploredOrEventHappens(5126); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - - return true; - } - -}; - /*###### ## npc_rivern_frostwind ######*/ @@ -132,6 +66,5 @@ public: void AddSC_winterspring() { - new npc_lorax(); new npc_rivern_frostwind(); } -- cgit v1.2.3 From f08bc7d5028d70716c2a2e13473607d85515fc14 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Tue, 5 Jun 2012 23:32:09 -0230 Subject: Core/Scripts: Script for Frostblade Shrine to start The Cleansing quest. Quest is not yet scripted. --- sql/updates/world/2012_06_05_03_world_script.sql | 2 ++ src/server/scripts/World/go_scripts.cpp | 28 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 sql/updates/world/2012_06_05_03_world_script.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_05_03_world_script.sql b/sql/updates/world/2012_06_05_03_world_script.sql new file mode 100644 index 00000000000..d10247979d9 --- /dev/null +++ b/sql/updates/world/2012_06_05_03_world_script.sql @@ -0,0 +1,2 @@ +-- Frostblade Shrine Script for Quest The Cleansing +UPDATE `gameobject_template` SET `ScriptName`= 'go_frostblade_shrine' WHERE `entry`=186649; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 790a9d0f814..e691aed7395 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1245,6 +1245,33 @@ class go_veil_skith_cage : public GameObjectScript } }; +/*###### +## go_frostblade_shrine +######*/ + +enum TheCleansing +{ + QUEST_THE_CLEANSING_HORDE = 11317, + QUEST_THE_CLEANSING_ALLIANCE = 11322, + SPELL_CLEANSING_SOUL = 43351, +}; + +class go_frostblade_shrine : public GameObjectScript +{ +public: + go_frostblade_shrine() : GameObjectScript("go_frostblade_shrine") { } + + bool OnGossipHello(Player* player, GameObject* go) + { + if (player->GetQuestStatus(QUEST_THE_CLEANSING_HORDE) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_THE_CLEANSING_ALLIANCE) == QUEST_STATUS_INCOMPLETE) + { + go->UseDoorOrButton(10); + player->CastSpell(player,SPELL_CLEANSING_SOUL); + } + return true; + } +}; + void AddSC_go_scripts() { new go_cat_figurine; @@ -1285,4 +1312,5 @@ void AddSC_go_scripts() new go_gjalerbron_cage; new go_large_gjalerbron_cage; new go_veil_skith_cage; + new go_frostblade_shrine; } -- cgit v1.2.3 From ee194a4f43664604a92b11928b983c09abc7ab0f Mon Sep 17 00:00:00 2001 From: Malcrom Date: Wed, 6 Jun 2012 00:08:07 -0230 Subject: Core/Scripts: Addition to previous commit. --- src/server/scripts/World/go_scripts.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index e691aed7395..b566b3d3b5b 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1254,6 +1254,7 @@ enum TheCleansing QUEST_THE_CLEANSING_HORDE = 11317, QUEST_THE_CLEANSING_ALLIANCE = 11322, SPELL_CLEANSING_SOUL = 43351, + SPELL_RECENT_MEDITATION = 61720, }; class go_frostblade_shrine : public GameObjectScript @@ -1263,12 +1264,13 @@ public: bool OnGossipHello(Player* player, GameObject* go) { - if (player->GetQuestStatus(QUEST_THE_CLEANSING_HORDE) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_THE_CLEANSING_ALLIANCE) == QUEST_STATUS_INCOMPLETE) - { - go->UseDoorOrButton(10); - player->CastSpell(player,SPELL_CLEANSING_SOUL); - } - return true; + if (!player->HasAura(SPELL_RECENT_MEDITATION)) + if (player->GetQuestStatus(QUEST_THE_CLEANSING_HORDE) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_THE_CLEANSING_ALLIANCE) == QUEST_STATUS_INCOMPLETE) + { + go->UseDoorOrButton(10); + player->CastSpell(player, SPELL_CLEANSING_SOUL); + } + return true; } }; -- cgit v1.2.3 From 810f21efbceaa2e3a4f9ca487c904dfaa5e7a4ba Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 6 Jun 2012 20:36:34 +0200 Subject: Core/Movement * Moved enter/exit vehicle packets to spline. * Fixed spline movement on transports such as elevators (for which we do not keep track of its exact position) - path will be using normal coordinates (not transport offsets) --- src/server/game/Entities/Unit/Unit.cpp | 64 ++++-------------- src/server/game/Entities/Unit/Unit.h | 48 -------------- src/server/game/Entities/Vehicle/Vehicle.cpp | 11 +++- src/server/game/Movement/Spline/MoveSplineFlag.h | 76 +++++++++++----------- src/server/game/Movement/Spline/MoveSplineInit.cpp | 20 +++--- src/server/game/Movement/Spline/MoveSplineInit.h | 25 +++++-- .../game/Movement/Spline/MoveSplineInitArgs.h | 4 +- 7 files changed, 91 insertions(+), 157 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bb2d057bfaa..d415d06e76f 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -424,50 +424,6 @@ void Unit::DisableSpline() movespline->_Interrupt(); } -void Unit::SendMonsterMoveExitVehicle(Position const* newPos) -{ - WorldPacket data(SMSG_MONSTER_MOVE, 1+12+4+1+4+4+4+12+GetPackGUID().size()); - data.append(GetPackGUID()); - - data << uint8(GetTypeId() == TYPEID_PLAYER ? 1 : 0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40) - data << GetPositionX() << GetPositionY() << GetPositionZ(); - data << getMSTime(); - - data << uint8(SPLINETYPE_FACING_ANGLE); - data << float(GetOrientation()); // guess - data << uint32(SPLINEFLAG_TRANSPORT_EXIT); - data << uint32(0); // Time in between points - data << uint32(1); // 1 single waypoint - data << newPos->GetPositionX(); - data << newPos->GetPositionY(); - data << newPos->GetPositionZ(); - - SendMessageToSet(&data, true); -} - -void Unit::SendMonsterMoveTransport(Unit* vehicleOwner) -{ - // TODO: Turn into BuildMonsterMoveTransport packet and allow certain variables (for npc movement aboard vehicles) - WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicleOwner->GetPackGUID().size() + 47); - data.append(GetPackGUID()); - data.append(vehicleOwner->GetPackGUID()); - data << int8(GetTransSeat()); - data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40) - data << GetPositionX() - vehicleOwner->GetPositionX(); - data << GetPositionY() - vehicleOwner->GetPositionY(); - data << GetPositionZ() - vehicleOwner->GetPositionZ(); - data << uint32(getMSTime()); // should be an increasing constant that indicates movement packet count - data << uint8(SPLINETYPE_FACING_ANGLE); - data << GetTransOffsetO(); // facing angle? - data << uint32(SPLINEFLAG_TRANSPORT); - data << uint32(GetTransTime()); // move time - data << uint32(1); // amount of waypoints - data << uint32(0); // waypoint X - data << uint32(0); // waypoint Y - data << uint32(0); // waypoint Z - SendMessageToSet(&data, true); -} - void Unit::resetAttackTimer(WeaponAttackType type) { m_attackTimer[type] = uint32(GetAttackTime(type) * m_modAttackSpeedPct[type]); @@ -16308,7 +16264,7 @@ Creature* Unit::GetVehicleCreatureBase() const uint64 Unit::GetTransGUID() const { if (GetVehicle()) - return GetVehicle()->GetBase()->GetGUID(); + return GetVehicleBase()->GetGUID(); if (GetTransport()) return GetTransport()->GetGUID(); @@ -17171,11 +17127,12 @@ void Unit::_ExitVehicle(Position const* exitPosition) Vehicle* vehicle = m_vehicle; m_vehicle = NULL; - SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT + SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT Position pos; - if (!exitPosition) // Exit position not specified - vehicle->GetBase()->GetPosition(&pos); + if (!exitPosition) // Exit position not specified + vehicle->GetBase()->GetPosition(&pos); // This should use passenger's current position, leaving it as it is now + // because we calculate positions incorrect (sometimes under map) else pos = *exitPosition; @@ -17190,14 +17147,17 @@ void Unit::_ExitVehicle(Position const* exitPosition) SendMessageToSet(&data, false); } - SendMonsterMoveExitVehicle(&pos); - Relocate(&pos); + Movement::MoveSplineInit init(*this); + init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); + init.SetFacing(GetOrientation()); + init.SetTransportExit(); + init.Launch(); + + //GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above) if (Player* player = ToPlayer()) player->ResummonPetTemporaryUnSummonedIfAny(); - SendMovementFlagUpdate(); - if (vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION)) if (((Minion*)vehicle->GetBase())->GetOwner() == this) vehicle->Dismiss(); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 65a165b40d2..9b63de0cdb8 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -735,52 +735,6 @@ enum MovementFlags2 MOVEMENTFLAG2_UNK16 = 0x00008000, }; -enum SplineFlags -{ - SPLINEFLAG_NONE = 0x00000000, - SPLINEFLAG_FORWARD = 0x00000001, - SPLINEFLAG_BACKWARD = 0x00000002, - SPLINEFLAG_STRAFE_LEFT = 0x00000004, - SPLINEFLAG_STRAFE_RIGHT = 0x00000008, - SPLINEFLAG_TURN_LEFT = 0x00000010, - SPLINEFLAG_TURN_RIGHT = 0x00000020, - SPLINEFLAG_PITCH_UP = 0x00000040, - SPLINEFLAG_PITCH_DOWN = 0x00000080, - SPLINEFLAG_DONE = 0x00000100, - SPLINEFLAG_FALLING = 0x00000200, - SPLINEFLAG_NO_SPLINE = 0x00000400, - SPLINEFLAG_TRAJECTORY = 0x00000800, - SPLINEFLAG_WALK_MODE = 0x00001000, - SPLINEFLAG_FLYING = 0x00002000, - SPLINEFLAG_KNOCKBACK = 0x00004000, - SPLINEFLAG_FINAL_POINT = 0x00008000, - SPLINEFLAG_FINAL_TARGET = 0x00010000, - SPLINEFLAG_FINAL_FACING = 0x00020000, - SPLINEFLAG_CATMULL_ROM = 0x00040000, - SPLINEFLAG_CYCLIC = 0x00080000, - SPLINEFLAG_ENTER_CYCLE = 0x00100000, - SPLINEFLAG_ANIMATION_TIER = 0x00200000, - SPLINEFLAG_FROZEN = 0x00400000, - SPLINEFLAG_TRANSPORT = 0x00800000, - SPLINEFLAG_TRANSPORT_EXIT = 0x01000000, - SPLINEFLAG_UNKNOWN7 = 0x02000000, - SPLINEFLAG_UNKNOWN8 = 0x04000000, - SPLINEFLAG_ORIENTATION_INVERTED = 0x08000000, - SPLINEFLAG_USE_PATH_SMOOTHING = 0x10000000, - SPLINEFLAG_ANIMATION = 0x20000000, - SPLINEFLAG_UNCOMPRESSED_PATH = 0x40000000, - SPLINEFLAG_UNKNOWN10 = 0x80000000, -}; - -enum SplineType -{ - SPLINETYPE_NORMAL = 0, - SPLINETYPE_STOP = 1, - SPLINETYPE_FACING_SPOT = 2, - SPLINETYPE_FACING_TARGET = 3, - SPLINETYPE_FACING_ANGLE = 4, -}; - enum UnitTypeMask { UNIT_MASK_NONE = 0x00000000, @@ -1662,9 +1616,7 @@ class Unit : public WorldObject void MonsterMoveWithSpeed(float x, float y, float z, float speed); //void SetFacing(float ori, WorldObject* obj = NULL); - void SendMonsterMoveExitVehicle(Position const* newPos); //void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL); - void SendMonsterMoveTransport(Unit* vehicleOwner); void SendMovementFlagUpdate(); /*! These methods send the same packet to the client in apply and unapply case. diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 04bcfdcc375..710821f2f24 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -28,6 +28,7 @@ #include "ZoneScript.h" #include "SpellMgr.h" #include "SpellInfo.h" +#include "MoveSplineInit.h" Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry) { @@ -364,7 +365,12 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) unit->SendClearTarget(); // SMSG_BREAK_TARGET unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures) // also adds MOVEMENTFLAG_ROOT - unit->SendMonsterMoveTransport(_me); // SMSG_MONSTER_MOVE_TRANSPORT + Movement::MoveSplineInit init(*unit); + init.DisableTransportPathTransformations(); + init.MoveTo(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ); + init.SetFacing(0.0f); + init.SetTransportEnter(); + init.Launch(); if (_me->GetTypeId() == TYPEID_UNIT) { @@ -372,7 +378,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) _me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, true); // update all passenger's positions - RelocatePassengers(_me->GetPositionX(), _me->GetPositionY(), _me->GetPositionZ(), _me->GetOrientation()); + //Passenger's spline OR vehicle movement will update positions + //RelocatePassengers(_me->GetPositionX(), _me->GetPositionY(), _me->GetPositionZ(), _me->GetOrientation()); } } diff --git a/src/server/game/Movement/Spline/MoveSplineFlag.h b/src/server/game/Movement/Spline/MoveSplineFlag.h index 33973064e09..cfc2fdee450 100644 --- a/src/server/game/Movement/Spline/MoveSplineFlag.h +++ b/src/server/game/Movement/Spline/MoveSplineFlag.h @@ -34,43 +34,43 @@ namespace Movement { public: enum eFlags{ - None = 0x00000000, - // x00-xFF(first byte) used as animation Ids storage in pair with Animation flag - Done = 0x00000100, - Falling = 0x00000200, // Affects elevation computation, can't be combined with Parabolic flag - No_Spline = 0x00000400, - Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag - Walkmode = 0x00001000, - Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation - OrientationFixed = 0x00004000, // Model orientation fixed - Final_Point = 0x00008000, - Final_Target = 0x00010000, - Final_Angle = 0x00020000, - Catmullrom = 0x00040000, // Used Catmullrom interpolation mode - Cyclic = 0x00080000, // Movement by cycled spline - Enter_Cycle = 0x00100000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done - Animation = 0x00200000, // Plays animation after some time passed - Frozen = 0x00400000, // Will never arrive - Unknown5 = 0x00800000, - Unknown6 = 0x01000000, - Unknown7 = 0x02000000, - Unknown8 = 0x04000000, + None = 0x00000000, + // x00-xFF(first byte) used as animation Ids storage in pair with Animation flag + Done = 0x00000100, + Falling = 0x00000200, // Affects elevation computation, can't be combined with Parabolic flag + No_Spline = 0x00000400, + Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag + Walkmode = 0x00001000, + Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation + OrientationFixed = 0x00004000, // Model orientation fixed + Final_Point = 0x00008000, + Final_Target = 0x00010000, + Final_Angle = 0x00020000, + Catmullrom = 0x00040000, // Used Catmullrom interpolation mode + Cyclic = 0x00080000, // Movement by cycled spline + Enter_Cycle = 0x00100000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done + Animation = 0x00200000, // Plays animation after some time passed + Frozen = 0x00400000, // Will never arrive + TransportEnter = 0x00800000, + TransportExit = 0x01000000, + Unknown7 = 0x02000000, + Unknown8 = 0x04000000, OrientationInversed = 0x08000000, - Unknown10 = 0x10000000, - Unknown11 = 0x20000000, - Unknown12 = 0x40000000, - Unknown13 = 0x80000000, + Unknown10 = 0x10000000, + Unknown11 = 0x20000000, + Unknown12 = 0x40000000, + Unknown13 = 0x80000000, // Masks - Mask_Final_Facing = Final_Point | Final_Target | Final_Angle, + Mask_Final_Facing = Final_Point | Final_Target | Final_Angle, // animation ids stored here, see AnimType enum, used with Animation flag - Mask_Animations = 0xFF, + Mask_Animations = 0xFF, // flags that shouldn't be appended into SMSG_MONSTER_MOVE\SMSG_MONSTER_MOVE_TRANSPORT packet, should be more probably Mask_No_Monster_Move = Mask_Final_Facing | Mask_Animations | Done, // CatmullRom interpolation mode used - Mask_CatmullRom = Flying | Catmullrom, + Mask_CatmullRom = Flying | Catmullrom, // Unused, not suported flags - Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown5|Unknown6|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13, + Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13, }; inline uint32& raw() { return (uint32&)*this;} @@ -98,14 +98,16 @@ namespace Movement void operator &= (uint32 f) { raw() &= f;} void operator |= (uint32 f) { raw() |= f;} - void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations|Falling|Parabolic)) | Animation|anim;} - void EnableParabolic() { raw() = (raw() & ~(Mask_Animations|Falling|Animation)) | Parabolic;} - void EnableFalling() { raw() = (raw() & ~(Mask_Animations|Parabolic|Animation)) | Falling;} + void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations | Falling | Parabolic)) | Animation | anim; } + void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation)) | Parabolic; } + void EnableFalling() { raw() = (raw() & ~(Mask_Animations | Parabolic | Animation)) | Falling; } void EnableFlying() { raw() = (raw() & ~Catmullrom) | Flying; } void EnableCatmullRom() { raw() = (raw() & ~Flying) | Catmullrom; } - void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;} - void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle;} - void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target;} + void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point; } + void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle; } + void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target; } + void EnableTransportEnter() { raw() = (raw() & ~TransportExit) | TransportEnter; } + void EnableTransportExit() { raw() = (raw() & ~TransportEnter) | TransportExit; } uint8 animId : 8; bool done : 1; @@ -123,8 +125,8 @@ namespace Movement bool enter_cycle : 1; bool animation : 1; bool frozen : 1; - bool unknown5 : 1; - bool unknown6 : 1; + bool transportEnter: 1; + bool transportExit : 1; bool unknown7 : 1; bool unknown8 : 1; bool orientationInversed : 1; diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index c5f959e2f1d..ffc09a10e22 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -62,7 +62,8 @@ namespace Movement bool transport = false; Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZMinusOffset(), unit.GetOrientation()); - if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + // Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes + if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit.GetTransGUID()) { transport = true; real_position.x = unit.GetTransOffsetX(); @@ -108,13 +109,7 @@ namespace Movement data.append(unit.GetPackGUID()); if (transport) { - if (unit.GetVehicle()) - data.appendPackGUID(unit.GetVehicleBase()->GetGUID()); - else if (unit.GetTransport()) - data.appendPackGUID(unit.GetTransGUID()); - else - data << uint8(0); - + data.appendPackGUID(unit.GetTransGUID()); data << int8(unit.GetTransSeat()); } @@ -124,6 +119,8 @@ namespace Movement MoveSplineInit::MoveSplineInit(Unit& m) : unit(m) { + // Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes + args.TransformForTransport = unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit.GetTransGUID(); // mix existing state into new args.flags.walkmode = unit.m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING); args.flags.flying = unit.m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY)); @@ -138,7 +135,7 @@ namespace Movement void MoveSplineInit::SetFacing(float angle) { - if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + if (args.TransformForTransport) { if (Unit* vehicle = unit.GetVehicleBase()) angle -= vehicle->GetOrientation(); @@ -154,13 +151,13 @@ namespace Movement { args.path_Idx_offset = 0; args.path.resize(2); - TransportPathTransform transform(unit); + TransportPathTransform transform(unit, args.TransformForTransport); args.path[1] = transform(dest); } Vector3 TransportPathTransform::operator()(Vector3 input) { - if (_owner.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + if (_transformForTransport) { if (Unit* vehicle = _owner.GetVehicleBase()) { @@ -177,5 +174,4 @@ namespace Movement return input; } - } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h index 786324e3f77..ef847809ac8 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.h +++ b/src/server/game/Movement/Spline/MoveSplineInit.h @@ -37,11 +37,13 @@ namespace Movement class TransportPathTransform { public: - TransportPathTransform(Unit& owner) : _owner(owner) { } + TransportPathTransform(Unit& owner, bool transformForTransport) + : _owner(owner), _transformForTransport(transformForTransport) { } Vector3 operator()(Vector3 input); private: Unit& _owner; + bool _transformForTransport; }; /* Initializes and launches spline movement @@ -107,6 +109,12 @@ namespace Movement /* Enables falling mode. Disabled by default */ void SetFall(); + /* Enters transport. Disabled by default + */ + void SetTransportEnter(); + /* Exits transport. Disabled by default + */ + void SetTransportExit(); /* Inverses unit model orientation. Disabled by default */ void SetOrientationInversed(); @@ -123,31 +131,36 @@ namespace Movement PointsArray& Path() { return args.path; } + /* Disables transport coordinate transformations for cases where raw offsets are available + */ + void DisableTransportPathTransformations(); protected: MoveSplineInitArgs args; Unit& unit; }; - inline void MoveSplineInit::SetFly() { args.flags.EnableFlying();} + inline void MoveSplineInit::SetFly() { args.flags.EnableFlying(); } inline void MoveSplineInit::SetWalk(bool enable) { args.flags.walkmode = enable;} inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();} inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;} inline void MoveSplineInit::SetFall() { args.flags.EnableFalling();} inline void MoveSplineInit::SetVelocity(float vel) { args.velocity = vel; args.HasVelocity = true; } inline void MoveSplineInit::SetOrientationInversed() { args.flags.orientationInversed = true;} + inline void MoveSplineInit::SetTransportEnter() { args.flags.EnableTransportEnter(); } + inline void MoveSplineInit::SetTransportExit() { args.flags.EnableTransportExit(); } inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable;} inline void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset) { args.path_Idx_offset = path_offset; args.path.resize(controls.size()); - std::transform(controls.begin(), controls.end(), args.path.begin(), TransportPathTransform(unit)); + std::transform(controls.begin(), controls.end(), args.path.begin(), TransportPathTransform(unit, args.TransformForTransport)); } inline void MoveSplineInit::MoveTo(float x, float y, float z) { - Vector3 v(x,y,z); + Vector3 v(x, y, z); MoveTo(v); } @@ -166,12 +179,14 @@ namespace Movement inline void MoveSplineInit::SetFacing(Vector3 const& spot) { - TransportPathTransform transform(unit); + TransportPathTransform transform(unit, args.TransformForTransport); Vector3 finalSpot = transform(spot); args.facing.f.x = finalSpot.x; args.facing.f.y = finalSpot.y; args.facing.f.z = finalSpot.z; args.flags.EnableFacingPoint(); } + + inline void MoveSplineInit::DisableTransportPathTransformations() { args.TransformForTransport = false; } } #endif // TRINITYSERVER_MOVESPLINEINIT_H diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h index 74409c9562b..de02b35d0a0 100644 --- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h +++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h @@ -42,7 +42,8 @@ namespace Movement struct MoveSplineInitArgs { MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0), - velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f), HasVelocity(false) + velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f), + HasVelocity(false), TransformForTransport(true) { path.reserve(path_capacity); } @@ -57,6 +58,7 @@ namespace Movement uint32 splineId; float initialOrientation; bool HasVelocity; + bool TransformForTransport; /** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */ bool Validate() const; -- cgit v1.2.3 From 3e3a940a1c1904353058ef5b00dd683a696968dd Mon Sep 17 00:00:00 2001 From: Malcrom Date: Wed, 6 Jun 2012 18:54:13 -0230 Subject: DB/SAI: Fix for Quest 11317 & 11322 "The Cleansing" --- sql/updates/world/2012_06_06_01_world_sai.sql | 42 +++++++++++++++++++++++++++ src/server/scripts/World/go_scripts.cpp | 1 + 2 files changed, 43 insertions(+) create mode 100644 sql/updates/world/2012_06_06_01_world_sai.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_06_01_world_sai.sql b/sql/updates/world/2012_06_06_01_world_sai.sql new file mode 100644 index 00000000000..97e175652d2 --- /dev/null +++ b/sql/updates/world/2012_06_06_01_world_sai.sql @@ -0,0 +1,42 @@ +-- Fix for Quest 11317 & 11322 "The Cleansing" +-- Your Inner Turmoil SAI +SET @ENTRY := 27959; +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`unit_flags`=`unit_flags`|256,`AIName`= 'SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY*100 AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,1,54,0,100,0,0,0,0,0,11,41408,2,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On Summon - Cast Shadowform on self'), +(@ENTRY,0,1,2,61,0,100,0,0,0,0,0,85,50218,2,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On Summon - Player Cast The Cleansing: Your Inner Turmoil''s Mirror Image Aura on npc'), +(@ENTRY,0,2,3,61,0,100,0,0,0,0,0,85,41054,2,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On Summon - Player Cast Copy Weapon on npc'), +(@ENTRY,0,3,4,61,0,100,0,0,0,0,0,85,41055,2,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On Summon - Player Cast Copy Weapon on npc'), +(@ENTRY,0,4,5,61,0,100,0,0,0,0,0,85,45205,2,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On Summon - Player Cast Copy Offhand Weapon on npc'), +(@ENTRY,0,5,6,61,0,100,0,0,0,0,0,85,45206,2,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On Summon - Player Cast Copy Offhand Weapon on npc'), +(@ENTRY,0,6,0,61,0,100,0,0,0,0,0,80,@ENTRY*100,2,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On Summon - Run Script'), +(@ENTRY,0,7,0,2,0,100,1,0,50,0,0,1,2,2,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - @50%hp - Say 2'), +(@ENTRY,0,8,9,6,0,100,1,0,0,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On death - Say 3'), +(@ENTRY,0,9,0,61,0,100,1,0,0,0,0,3,0,11686,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - On death - set model'), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,66,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Your Inner Turmoil - Script - Turn to invoker'), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Your Inner Turmoil - Script - Say 0'), +(@ENTRY*100,9,2,0,0,0,100,0,6000,6000,0,0,66,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Your Inner Turmoil - Script - Turn to invoker'), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,7,0,0,0,0,0,0,0,'Your Inner Turmoil - Script - Say 1'), +(@ENTRY*100,9,4,0,0,0,100,0,7000,7000,0,0,19,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'Your Inner Turmoil - Script - remove unit flags'), +(@ENTRY*100,9,5,0,0,0,100,0,0,0,0,0,49,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Your Inner Turmoil - Script - Attack invoker'); +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,'You think that you can get rid of me through meditation?',15,0,100,0,0,0,'Your Inner Turmoil text 0'), +(@ENTRY,1,0,'Fool! I will destroy you and finally become that which has been building inside of you all of these years!',15,0,100,0,0,0,'Your Inner Turmoil text 1'), +(@ENTRY,2,0,'You cannot defeat me. I''m an inseparable part of you!',15,0,100,0,0,0,'Your Inner Turmoil text 50%'), +(@ENTRY,3,0,'NOOOOOOOoooooooooo!',15,0,100,0,0,0,'Your Inner Turmoil text death'); +-- Spell Conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (50218,41054,41055,45205,45206); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,50218,0,31,3,27959,0,0,'','Spell 50218 can target Your Inner Turmoil'), +(13,1,41054,0,31,3,27959,0,0,'','Spell 41054 can target Your Inner Turmoil'), +(13,1,41055,0,31,3,27959,0,0,'','Spell 41055 can target Your Inner Turmoil'), +(13,1,45205,0,31,3,27959,0,0,'','Spell 45205 can target Your Inner Turmoil'), +(13,1,45206,0,31,3,27959,0,0,'','Spell 45206 can target Your Inner Turmoil'); +-- Spell Linking +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=-43351; +INSERT INTO spell_linked_spell VALUES +(-43351,50167,0, ''), +(-43351,61720,0, ''); diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index b566b3d3b5b..308c7f9afa3 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1269,6 +1269,7 @@ public: { go->UseDoorOrButton(10); player->CastSpell(player, SPELL_CLEANSING_SOUL); + player->SetStandState(UNIT_STAND_STATE_SIT); } return true; } -- cgit v1.2.3 From e4af5e4e2f88a200353ac2f17f75df9db289f3d7 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Wed, 6 Jun 2012 19:05:17 -0230 Subject: Core/Misc: A couple misc fixes. --- src/server/game/Spells/SpellMgr.cpp | 4 +++- src/server/scripts/Kalimdor/winterspring.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 05566bdf712..d9459b11ba1 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3043,9 +3043,11 @@ void SpellMgr::LoadDbcDataCorrections() case 61588: // Blazing Harpoon case 52479: // Gift of the Harvester case 48246: // Ball of Flame - case 36384: // Skartax Purple Beam spellInfo->MaxAffectedTargets = 1; break; + case 36384: // Skartax Purple Beam + spellInfo->MaxAffectedTargets = 2; + break; case 41376: // Spite case 39992: // Needle Spine case 29576: // Multi-Shot diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index cdcfedb9892..2c4da0fdf7c 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -18,8 +18,8 @@ /* ScriptData SDName: Winterspring -SD%Complete: 90 -SDComment: Quest support: 5126 (Loraxs' tale missing proper gossip items text). Vendor Rivern Frostwind. Obtain Cache of Mau'ari +SD%Complete: Almost Completely Emptied +SDComment: Vendor Rivern Frostwind. SDCategory: Winterspring EndScriptData */ -- cgit v1.2.3 From 2c153b8a437dbf78646cc7463722bcfdd132eef9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 7 Jun 2012 15:02:51 +0200 Subject: Core/Movement: Fixed Unit::SetFacingTo --- src/server/game/Entities/Unit/Unit.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d415d06e76f..0ea8731e591 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -17553,6 +17553,7 @@ void Unit::SetInFront(Unit const* target) void Unit::SetFacingTo(float ori) { Movement::MoveSplineInit init(*this); + init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset()); init.SetFacing(ori); init.Launch(); } -- cgit v1.2.3 From 089b0a44d71a63a9949ab4ad69a435c9546b30da Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 7 Jun 2012 08:09:16 -0500 Subject: Core/SAI: Fixed the cage GameObject template script, the script should start when the gameobject is activated, not in gossip hello --- src/server/game/AI/SmartScripts/SmartScript.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index e4c9e4a3047..9feca1c073a 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2020,16 +2020,16 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e) if (!go) return; //store hostage as id1 - AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_CREATURE, e.action.installTtemplate.param1, 10, 0, 0); + AddEvent(SMART_EVENT_GO_STATE_CHANGED, 0, 2, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_CREATURE, e.action.installTtemplate.param1, 10, 0, 0); //store invoker as id2 - AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 2, 0, 0, 0, 0, 0, SMART_TARGET_NONE, 0, 0, 0, 0); + AddEvent(SMART_EVENT_GO_STATE_CHANGED, 0, 2, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 2, 0, 0, 0, 0, 0, SMART_TARGET_NONE, 0, 0, 0, 0); //signal hostage - AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_SET_DATA, 0, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 1, 0, 0, 0); + AddEvent(SMART_EVENT_GO_STATE_CHANGED, 0, 2, 0, 0, 0, SMART_ACTION_SET_DATA, 0, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 1, 0, 0, 0); //when hostage raeched end point, give credit to invoker if (e.action.installTtemplate.param2) AddEvent(SMART_EVENT_DATA_SET, 0, 0, 0, 0, 0, SMART_ACTION_CALL_KILLEDMONSTER, e.action.installTtemplate.param1, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 2, 0, 0, 0); else - AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_CALL_KILLEDMONSTER, e.action.installTtemplate.param1, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 2, 0, 0, 0); + AddEvent(SMART_EVENT_GO_STATE_CHANGED, 0, 2, 0, 0, 0, SMART_ACTION_CALL_KILLEDMONSTER, e.action.installTtemplate.param1, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 2, 0, 0, 0); break; } case SMARTAI_TEMPLATE_BASIC: -- cgit v1.2.3 From d719730929db84674cee0b56834e2a9ef248e472 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 7 Jun 2012 12:02:06 -0400 Subject: Core/Spells: do not apply unit_state_casting for instant cast spells. --- src/server/game/Entities/Unit/Unit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0ea8731e591..3315760a2af 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2893,7 +2893,8 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); m_AutoRepeatFirstCast = true; } - AddUnitState(UNIT_STATE_CASTING); + if (m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->CalcCastTime(this) > 0 && IsNonMeleeSpellCasted(false, false, true)) + AddUnitState(UNIT_STATE_CASTING); } break; case CURRENT_CHANNELED_SPELL: -- cgit v1.2.3 From 0965e1f4c22f4e47a0b478329ecbe48a7738f21e Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 7 Jun 2012 13:01:49 -0400 Subject: Core/Loot: fix loot rules for looting quest items that have the party loot flag --- src/server/game/Loot/LootMgr.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index a5ad46c9ec4..e1dcf8e5d27 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -358,7 +358,12 @@ bool LootItem::AllowedForPlayer(Player const* player) const // check quest requirements if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid))) - return false; + if (Group const* group = player->GetGroup()) + { + if ((pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT) == 0 || (pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT && (group->GetLootMethod() != MASTER_LOOT || group->GetLooterGuid() != player->GetGUID()))) + return false; + } + else return false; return true; } @@ -889,6 +894,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) } LootSlotType slotType = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT; + LootSlotType partySlotType = lv.permission == MASTER_PERMISSION ? LOOT_SLOT_TYPE_MASTER : (lv.permission == GROUP_PERMISSION ? LOOT_SLOT_TYPE_ROLL_ONGOING : slotType); QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems(); QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow()); if (q_itr != lootPlayerQuestItems.end()) @@ -901,7 +907,10 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { b << uint8(l.items.size() + (qi - q_list->begin())); b << item; - b << uint8(slotType); + if (!item.freeforall) + b << uint8(partySlotType); + else + b << uint8(slotType); ++itemsShown; } } @@ -919,7 +928,10 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { b << uint8(fi->index); b << item; - b << uint8(slotType); + if (!item.freeforall) + b << uint8(partySlotType); + else + b << uint8(slotType); ++itemsShown; } } @@ -937,7 +949,10 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { b << uint8(ci->index); b << item; - b << uint8(slotType); + if (!item.freeforall) + b << uint8(partySlotType); + else + b << uint8(slotType); ++itemsShown; } } -- cgit v1.2.3 From 22efc5e2bd91ebc0a1e019fb2d5144ae6302250c Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 7 Jun 2012 13:10:27 -0400 Subject: Core/Spells: fix mocking blow doing damage to players and non tauntable creatures. --- src/server/game/Spells/SpellEffects.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 17e79501d16..0d5dac8f8e0 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3317,6 +3317,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) fixed_bonus += (aur->GetStackAmount() - 1) * CalculateDamage(2, unitTarget); } } + if (m_spellInfo->SpellFamilyFlags[0] & 0x8000000) // Mocking Blow + { + if (unitTarget->IsImmunedToSpellEffect(m_spellInfo,EFFECT_1) || unitTarget->GetTypeId() == TYPEID_PLAYER) + { + m_damage = 0; + return; + } + } break; } case SPELLFAMILY_ROGUE: -- cgit v1.2.3 From 4bfb96fbcfb5a64cbaf70ede0a2f682987f1a877 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 7 Jun 2012 14:05:52 -0400 Subject: Core/Loot: fix mistake in previous commit. also fix flags in sql. i did things backwards ^^ --- sql/updates/world/2012_06_07_03_world_item_template.sql | 1 + src/server/game/Loot/LootMgr.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2012_06_07_03_world_item_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_07_03_world_item_template.sql b/sql/updates/world/2012_06_07_03_world_item_template.sql new file mode 100644 index 00000000000..a6caa15632e --- /dev/null +++ b/sql/updates/world/2012_06_07_03_world_item_template.sql @@ -0,0 +1 @@ +UPDATE `item_template` SET `flags` = 0 WHERE `entry` IN (50274,50226,50231); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index e1dcf8e5d27..53b560e0b77 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -360,7 +360,7 @@ bool LootItem::AllowedForPlayer(Player const* player) const if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid))) if (Group const* group = player->GetGroup()) { - if ((pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT) == 0 || (pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT && (group->GetLootMethod() != MASTER_LOOT || group->GetLooterGuid() != player->GetGUID()))) + if (pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT || ((pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT) == 0 && (group->GetLootMethod() != MASTER_LOOT || group->GetLooterGuid() != player->GetGUID()))) return false; } else return false; -- cgit v1.2.3 From f92ae938063060c8c1eeae9ec863dca1645e1985 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 7 Jun 2012 14:48:43 -0400 Subject: Core/Spells: fix crash introduced in d719730929db84674cee0b56834e2a9ef248e472 (thx vincent-michael) --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3315760a2af..e89e5df2a0c 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2893,7 +2893,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); m_AutoRepeatFirstCast = true; } - if (m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->CalcCastTime(this) > 0 && IsNonMeleeSpellCasted(false, false, true)) + if ((m_currentSpells[CURRENT_GENERIC_SPELL] && m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->CalcCastTime(this) > 0) && IsNonMeleeSpellCasted(false, false, true)) AddUnitState(UNIT_STATE_CASTING); } break; -- cgit v1.2.3 From 870503059341723bb9ec76b3ef103d1cfc7a9134 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 7 Jun 2012 16:00:16 -0400 Subject: Core/Auras: use a case for SPELL_AURA_MECHANIC_IMMUNITY_MASK. distinguish between spells manually. blizzard probably has a seperate database as to which spells have which immunities. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 259 +++++++++++++++++++--- 1 file changed, 231 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 05114c8bc07..1b6ae348b1c 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3368,41 +3368,244 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 return; Unit* target = aurApp->GetTarget(); + std::list aura_immunity_list; + uint32 mechanic_immunity_list; + int32 miscVal = GetMiscValue(); - std::list immunity_list; - if (GetMiscValue() & (1<<10)) - immunity_list.push_back(SPELL_AURA_MOD_STUN); - if (GetMiscValue() & (1<<1)) - immunity_list.push_back(SPELL_AURA_TRANSFORM); - - // These flag can be recognized wrong: - if (GetMiscValue() & (1<<6)) - immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); - if (GetMiscValue() & (1<<0)) - immunity_list.push_back(SPELL_AURA_MOD_ROOT); - if (GetMiscValue() & (1<<2)) - immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); - if (GetMiscValue() & (1<<9)) - immunity_list.push_back(SPELL_AURA_MOD_FEAR); - - // an exception for Bladestorm - if ((GetMiscValue() & (1<<7)) && (GetId() != 46924)) - immunity_list.push_back(SPELL_AURA_MOD_DISARM); - - // apply immunities - for (std::list ::iterator iter = immunity_list.begin(); iter != immunity_list.end(); ++iter) - target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply); + switch (miscVal) + { + case 96: + case 1615: + { + if (GetBaseAmount()) + { + mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) + | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) + | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM) + | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR) + | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED) + | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN); + + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); + aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); + } + break; + } + case 679: + { + if (GetId() == 57742) + { + mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) + | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) + | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM) + | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR) + | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED) + | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN); + + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); + aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); + } + break; + } + case 1557: + { + if (GetId() == 64187) + { + mechanic_immunity_list = (1 << MECHANIC_STUN); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + } + else + { + mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) + | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) + | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM) + | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR) + | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED) + | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN); + + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); + aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); + } + break; + } + case 1614: + case 1694: + { + target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT); + break; + } + case 1630: + { + if (!GetBaseAmount()) + { + target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT); + } + else + { + mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) + | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) + | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM) + | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR) + | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED) + | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN); + + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); + aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); + } + break; + } + case 477: + case 1733: + { + if (!GetBaseAmount()) + { + mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) + | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) + | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM) + | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR) + | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED) + | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN); + + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); + aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); + } + break; + } + case 878: + { + if (GetBaseAmount() == 1) + { + mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN) + | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE); + + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + } + break; + } + default: + break; + } - // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated. - if (apply && GetId() == 46924) + if (aura_immunity_list.size() == 0) { - target->RemoveAurasByType(SPELL_AURA_MOD_ROOT); - target->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); + if (miscVal & (1<<10)) + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + if (miscVal & (1<<1)) + aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); + + // These flag can be recognized wrong: + if (miscVal & (1<<6)) + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + if (miscVal & (1<<0)) + aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); + if (miscVal & (1<<2)) + aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + if (miscVal & (1<<9)) + aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); + if (miscVal & (1<<7)) + aura_immunity_list.push_back(SPELL_AURA_MOD_DISARM); } + // apply immunities + for (std::list ::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter) + target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply); + if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY) - for (std::list ::iterator iter = immunity_list.begin(); iter != immunity_list.end(); ++iter) + { + target->RemoveAurasWithMechanic(mechanic_immunity_list, AURA_REMOVE_BY_DEFAULT, GetId()); + for (std::list ::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter) target->RemoveAurasByType(*iter); + } } void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const -- cgit v1.2.3 From c7775c8d72fb8618ad96c243910f923b239ea39b Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 7 Jun 2012 23:20:57 +0200 Subject: Core/Maps: Moved object respawn time storage from global to map level. This removes unneccessary locking since all objects run within its map's thread. --- .../2012_06_07_00_characters_respawn.sql | 2 + src/server/game/Entities/Creature/Creature.cpp | 10 +- src/server/game/Entities/GameObject/GameObject.cpp | 12 +- src/server/game/Globals/ObjectMgr.cpp | 178 --------------------- src/server/game/Globals/ObjectMgr.h | 38 ----- src/server/game/Instances/InstanceSaveMgr.cpp | 2 +- src/server/game/Maps/Map.cpp | 127 ++++++++++++++- src/server/game/Maps/Map.h | 34 ++++ src/server/game/Maps/MapInstanced.cpp | 2 + src/server/game/Maps/MapManager.cpp | 1 + src/server/game/Movement/Spline/MoveSplineInit.cpp | 3 +- src/server/game/OutdoorPvP/OutdoorPvP.cpp | 4 +- src/server/game/World/World.cpp | 6 - .../Database/Implementation/CharacterDatabase.cpp | 17 +- .../Database/Implementation/CharacterDatabase.h | 1 - 15 files changed, 189 insertions(+), 248 deletions(-) create mode 100644 sql/updates/characters/2012_06_07_00_characters_respawn.sql (limited to 'src') diff --git a/sql/updates/characters/2012_06_07_00_characters_respawn.sql b/sql/updates/characters/2012_06_07_00_characters_respawn.sql new file mode 100644 index 00000000000..168aa312713 --- /dev/null +++ b/sql/updates/characters/2012_06_07_00_characters_respawn.sql @@ -0,0 +1,2 @@ +ALTER TABLE `creature_respawn` ADD `mapId` SMALLINT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `respawnTime`; +ALTER TABLE `gameobject_respawn` ADD `mapId` SMALLINT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `respawnTime`; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index e8ec686daf5..07e8e37e82a 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -486,7 +486,7 @@ void Creature::Update(uint32 diff) break; uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_UNIT); - time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(dbtableHighGuid, GetMap()->GetInstanceId()); + time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid); if (!linkedRespawntime) // Can respawn Respawn(); else // the master is dead @@ -1303,7 +1303,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) m_respawnDelay = data->spawntimesecs; m_deathState = ALIVE; - m_respawnTime = sObjectMgr->GetCreatureRespawnTime(m_DBTableGuid, GetInstanceId()); + m_respawnTime = GetMap()->GetCreatureRespawnTime(m_DBTableGuid); if (m_respawnTime) // respawn on Update { m_deathState = DEAD; @@ -1398,7 +1398,7 @@ void Creature::DeleteFromDB() return; } - sObjectMgr->RemoveCreatureRespawnTime(m_DBTableGuid, GetInstanceId()); + GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid); sObjectMgr->DeleteCreatureData(m_DBTableGuid); SQLTransaction trans = WorldDatabase.BeginTransaction(); @@ -1598,7 +1598,7 @@ void Creature::Respawn(bool force) if (getDeathState() == DEAD) { if (m_DBTableGuid) - sObjectMgr->RemoveCreatureRespawnTime(m_DBTableGuid, GetInstanceId()); + GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid); sLog->outStaticDebug("Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName(), GetGUIDLow(), GetGUID(), GetEntry()); m_respawnTime = 0; @@ -2013,7 +2013,7 @@ void Creature::SaveRespawnTime() if (isSummon() || !m_DBTableGuid || (m_creatureData && !m_creatureData->dbData)) return; - sObjectMgr->SaveCreatureRespawnTime(m_DBTableGuid, GetInstanceId(), m_respawnTime); + GetMap()->SaveCreatureRespawnTime(m_DBTableGuid, m_respawnTime); } // this should not be called by petAI or diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 5101d01899d..58440095075 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -338,7 +338,7 @@ void GameObject::Update(uint32 diff) if (m_respawnTime <= now) // timer expired { uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT); - time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(dbtableHighGuid, GetMap()->GetInstanceId()); + time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid); if (linkedRespawntime) // Can't respawn, the master is dead { uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid); @@ -761,13 +761,13 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap) else { m_respawnDelayTime = data->spawntimesecs; - m_respawnTime = sObjectMgr->GetGORespawnTime(m_DBTableGuid, map->GetInstanceId()); + m_respawnTime = GetMap()->GetGORespawnTime(m_DBTableGuid); // ready to respawn if (m_respawnTime && m_respawnTime <= time(NULL)) { m_respawnTime = 0; - sObjectMgr->RemoveGORespawnTime(m_DBTableGuid, GetInstanceId()); + GetMap()->RemoveGORespawnTime(m_DBTableGuid); } } } @@ -788,7 +788,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap) void GameObject::DeleteFromDB() { - sObjectMgr->RemoveGORespawnTime(m_DBTableGuid, GetInstanceId()); + GetMap()->RemoveGORespawnTime(m_DBTableGuid); sObjectMgr->DeleteGOData(m_DBTableGuid); PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT); @@ -863,7 +863,7 @@ Unit* GameObject::GetOwner() const void GameObject::SaveRespawnTime() { if (m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault) - sObjectMgr->SaveGORespawnTime(m_DBTableGuid, GetInstanceId(), m_respawnTime); + GetMap()->SaveGORespawnTime(m_DBTableGuid, m_respawnTime); } bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const @@ -908,7 +908,7 @@ void GameObject::Respawn() if (m_spawnedByDefault && m_respawnTime > 0) { m_respawnTime = time(NULL); - sObjectMgr->RemoveGORespawnTime(m_DBTableGuid, GetInstanceId()); + GetMap()->RemoveGORespawnTime(m_DBTableGuid); } } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index df6018faf39..65f2ccff476 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1872,71 +1872,6 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data } } -void ObjectMgr::LoadCreatureRespawnTimes() -{ - uint32 oldMSTime = getMSTime(); - - uint32 count = 0; - - PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CREATURE_RESPAWNS)); - if (!result) - { - sLog->outString(">> Loaded 0 creature respawn time."); - sLog->outString(); - return; - } - - do - { - Field* fields = result->Fetch(); - - uint32 loguid = fields[0].GetUInt32(); - uint32 respawn_time = fields[1].GetUInt32(); - uint32 instance = fields[2].GetUInt32(); - - _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)] = time_t(respawn_time); - - ++count; - } while (result->NextRow()); - - sLog->outString(">> Loaded %lu creature respawn times in %u ms", (unsigned long)_creatureRespawnTimes.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); -} - -void ObjectMgr::LoadGameobjectRespawnTimes() -{ - uint32 oldMSTime = getMSTime(); - - // Remove outdated data - CharacterDatabase.DirectExecute("DELETE FROM gameobject_respawn WHERE respawnTime <= UNIX_TIMESTAMP(NOW())"); - - uint32 count = 0; - - PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_GO_RESPAWNS)); - if (!result) - { - sLog->outString(">> Loaded 0 gameobject respawn times. DB table `gameobject_respawn` is empty!"); - sLog->outString(); - return; - } - - do - { - Field* fields = result->Fetch(); - - uint32 loguid = fields[0].GetUInt32(); - uint32 respawn_time = fields[1].GetUInt32(); - uint32 instance = fields[2].GetUInt32(); - - _goRespawnTimes[MAKE_PAIR64(loguid, instance)] = time_t(respawn_time); - - ++count; - } while (result->NextRow()); - - sLog->outString(); - sLog->outString(">> Loaded %lu gameobject respawn times in %u ms", (unsigned long)_goRespawnTimes.size(), GetMSTimeDiffToNow(oldMSTime)); -} - Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const { uint64 guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER); @@ -7172,44 +7107,6 @@ void ObjectMgr::LoadNPCSpellClickSpells() sLog->outString(); } -void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t) -{ - if (!t) - { - // Delete only - RemoveCreatureRespawnTime(loguid, instance); - return; - } - - // This function can be called from various map threads concurrently - { - _creatureRespawnTimesMutex.acquire(); - _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)] = t; - _creatureRespawnTimesMutex.release(); - } - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN); - stmt->setUInt32(0, loguid); - stmt->setUInt32(1, uint32(t)); - stmt->setUInt32(2, instance); - CharacterDatabase.Execute(stmt); -} - -void ObjectMgr::RemoveCreatureRespawnTime(uint32 loguid, uint32 instance) -{ - // This function can be called from various map threads concurrently - { - _creatureRespawnTimesMutex.acquire(); - _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)] = 0; - _creatureRespawnTimesMutex.release(); - } - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN); - stmt->setUInt32(0, loguid); - stmt->setUInt32(1, instance); - CharacterDatabase.Execute(stmt); -} - void ObjectMgr::DeleteCreatureData(uint32 guid) { // remove mapid*cellid -> guid_set map @@ -7220,81 +7117,6 @@ void ObjectMgr::DeleteCreatureData(uint32 guid) _creatureDataStore.erase(guid); } -void ObjectMgr::SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t) -{ - if (!t) - { - // Delete only - RemoveGORespawnTime(loguid, instance); - return; - } - - // This function can be called from different map threads concurrently - { - _goRespawnTimesMutex.acquire(); - _goRespawnTimes[MAKE_PAIR64(loguid, instance)] = t; - _goRespawnTimesMutex.release(); - } - - PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GO_RESPAWN); - stmt->setUInt32(0, loguid); - stmt->setUInt64(1, uint64(t)); - stmt->setUInt32(2, instance); - CharacterDatabase.Execute(stmt); -} - -void ObjectMgr::RemoveGORespawnTime(uint32 loguid, uint32 instance) -{ - // This function can be called from different map threads concurrently - { - _goRespawnTimesMutex.acquire(); - _goRespawnTimes[MAKE_PAIR64(loguid, instance)] = 0; - _goRespawnTimesMutex.release(); - } - - PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN); - stmt->setUInt32(0, loguid); - stmt->setUInt32(1, instance); - CharacterDatabase.Execute(stmt); -} - -void ObjectMgr::DeleteRespawnTimeForInstance(uint32 instance) -{ - // This function can be called from different map threads concurrently - RespawnTimes::iterator next; - - { - _goRespawnTimesMutex.acquire(); - for (RespawnTimes::iterator itr = _goRespawnTimes.begin(); itr != _goRespawnTimes.end(); itr = next) - { - next = itr; - ++next; - - if (GUID_HIPART(itr->first) == instance) - _goRespawnTimes.erase(itr); - } - _goRespawnTimesMutex.release(); - } - { - _creatureRespawnTimesMutex.acquire(); - for (RespawnTimes::iterator itr = _creatureRespawnTimes.begin(); itr != _creatureRespawnTimes.end(); itr = next) - { - next = itr; - ++next; - - if (GUID_HIPART(itr->first) == instance) - _creatureRespawnTimes.erase(itr); - } - _creatureRespawnTimesMutex.release(); - } - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE); - stmt->setUInt32(0, instance); - CharacterDatabase.Execute(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE); - stmt->setUInt32(0, instance); - CharacterDatabase.Execute(stmt); -} - void ObjectMgr::DeleteGOData(uint32 guid) { // remove mapid*cellid -> guid_set map diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index f81e7f1f074..97c2f0234ba 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -367,8 +367,6 @@ struct CellObjectGuids typedef UNORDERED_MAP CellObjectGuidsMap; typedef UNORDERED_MAP MapObjectGuids; -typedef UNORDERED_MAP RespawnTimes; - // Trinity string ranges #define MIN_TRINITY_STRING_ID 1 // 'trinity_string' #define MAX_TRINITY_STRING_ID 2000000000 @@ -854,13 +852,11 @@ class ObjectMgr void LoadCreatures(); void LoadLinkedRespawn(); bool SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid); - void LoadCreatureRespawnTimes(); void LoadCreatureAddons(); void LoadCreatureModelInfo(); void LoadEquipmentTemplates(); void LoadGameObjectLocales(); void LoadGameobjects(); - void LoadGameobjectRespawnTimes(); void LoadItemTemplates(); void LoadItemLocales(); void LoadItemSetNames(); @@ -1048,36 +1044,6 @@ class ObjectMgr void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance); void DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid); - time_t GetLinkedRespawnTime(uint64 guid, uint32 instance) - { - uint64 linkedGuid = GetLinkedRespawnGuid(guid); - switch (GUID_HIPART(linkedGuid)) - { - case HIGHGUID_UNIT: - return GetCreatureRespawnTime(GUID_LOPART(linkedGuid), instance); - case HIGHGUID_GAMEOBJECT: - return GetGORespawnTime(GUID_LOPART(linkedGuid), instance); - default: - return 0; - } - } - - time_t GetCreatureRespawnTime(uint32 loguid, uint32 instance) - { - TRINITY_GUARD(ACE_Thread_Mutex, _creatureRespawnTimesMutex); - return _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)]; - } - void SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t); - void RemoveCreatureRespawnTime(uint32 loguid, uint32 instance); - time_t GetGORespawnTime(uint32 loguid, uint32 instance) - { - TRINITY_GUARD(ACE_Thread_Mutex, _goRespawnTimesMutex); - return _goRespawnTimes[MAKE_PAIR64(loguid, instance)]; - } - void SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t); - void RemoveGORespawnTime(uint32 loguid, uint32 instance); - void DeleteRespawnTimeForInstance(uint32 instance); - // grid objects void AddCreatureToGrid(uint32 guid, CreatureData const* data); void RemoveCreatureFromGrid(uint32 guid, CreatureData const* data); @@ -1307,10 +1273,6 @@ class ObjectMgr TrinityStringLocaleContainer _trinityStringLocaleStore; GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore; PointOfInterestLocaleContainer _pointOfInterestLocaleStore; - RespawnTimes _creatureRespawnTimes; - ACE_Thread_Mutex _creatureRespawnTimesMutex; - RespawnTimes _goRespawnTimes; - ACE_Thread_Mutex _goRespawnTimesMutex; CacheVendorItemContainer _cacheVendorItemStore; CacheTrainerSpellContainer _cacheTrainerSpellStore; diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 8078a91d082..2e0d1e47c92 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -543,7 +543,7 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) if (iMap && iMap->IsDungeon()) ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY); - sObjectMgr->DeleteRespawnTimeForInstance(instanceId); // even if map is not loaded + iMap->DeleteRespawnTimes(); // Free up the instance id and allow it to be reused sMapMgr->FreeInstanceId(instanceId); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 162dd12d121..6f19fdcbc0a 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2632,7 +2632,7 @@ void InstanceMap::UnloadAll() ASSERT(!HavePlayers()); if (m_resetAfterUnload == true) - sObjectMgr->DeleteRespawnTimeForInstance(GetInstanceId()); + DeleteRespawnTimes(); Map::UnloadAll(); } @@ -2781,3 +2781,128 @@ void Map::UpdateIteratorBack(Player* player) if (m_mapRefIter == player->GetMapRef()) m_mapRefIter = m_mapRefIter->nocheck_prev(); } + +void Map::SaveCreatureRespawnTime(uint32 dbGuid, time_t respawnTime) +{ + if (!respawnTime) + { + // Delete only + RemoveCreatureRespawnTime(dbGuid); + return; + } + + _creatureRespawnTimes[dbGuid] = respawnTime; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN); + stmt->setUInt32(0, dbGuid); + stmt->setUInt32(1, uint32(respawnTime)); + stmt->setUInt16(2, GetId()); + stmt->setUInt32(3, GetInstanceId()); + CharacterDatabase.Execute(stmt); +} + +void Map::RemoveCreatureRespawnTime(uint32 dbGuid) +{ + _creatureRespawnTimes.erase(dbGuid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN); + stmt->setUInt32(0, dbGuid); + stmt->setUInt16(1, GetId()); + stmt->setUInt32(2, GetInstanceId()); + CharacterDatabase.Execute(stmt); +} + +void Map::SaveGORespawnTime(uint32 dbGuid, time_t respawnTime) +{ + if (!respawnTime) + { + // Delete only + RemoveGORespawnTime(dbGuid); + return; + } + + _goRespawnTimes[dbGuid] = respawnTime; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GO_RESPAWN); + stmt->setUInt32(0, dbGuid); + stmt->setUInt32(1, uint32(respawnTime)); + stmt->setUInt16(2, GetId()); + stmt->setUInt32(3, GetInstanceId()); + CharacterDatabase.Execute(stmt); +} + +void Map::RemoveGORespawnTime(uint32 dbGuid) +{ + _goRespawnTimes.erase(dbGuid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN); + stmt->setUInt32(0, dbGuid); + stmt->setUInt16(1, GetId()); + stmt->setUInt32(2, GetInstanceId()); + CharacterDatabase.Execute(stmt); +} + +void Map::LoadRespawnTimes() +{ + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CREATURE_RESPAWNS); + stmt->setUInt16(0, GetId()); + stmt->setUInt32(1, GetInstanceId()); + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) + { + do + { + Field* fields = result->Fetch(); + uint32 loguid = fields[0].GetUInt32(); + uint32 respawnTime = fields[1].GetUInt32(); + + _creatureRespawnTimes[loguid] = time_t(respawnTime); + } while (result->NextRow()); + } + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GO_RESPAWNS); + stmt->setUInt16(0, GetId()); + stmt->setUInt32(1, GetInstanceId()); + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) + { + do + { + Field* fields = result->Fetch(); + uint32 loguid = fields[0].GetUInt32(); + uint32 respawnTime = fields[1].GetUInt32(); + + _goRespawnTimes[loguid] = time_t(respawnTime); + } while (result->NextRow()); + } +} + +void Map::DeleteRespawnTimes() +{ + _creatureRespawnTimes.clear(); + _goRespawnTimes.clear(); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE); + stmt->setUInt16(0, GetId()); + stmt->setUInt32(1, GetInstanceId()); + CharacterDatabase.Execute(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE); + stmt->setUInt16(0, GetId()); + stmt->setUInt32(1, GetInstanceId()); + CharacterDatabase.Execute(stmt); +} + +time_t Map::GetLinkedRespawnTime(uint64 guid) const +{ + uint64 linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid); + switch (GUID_HIPART(linkedGuid)) + { + case HIGHGUID_UNIT: + return GetCreatureRespawnTime(GUID_LOPART(linkedGuid)); + case HIGHGUID_GAMEOBJECT: + return GetGORespawnTime(GUID_LOPART(linkedGuid)); + default: + break; + } + + return time_t(0); +} diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 6ba08646f25..94a64126da1 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -443,6 +443,36 @@ class Map : public GridRefManager void Insert(const GameObjectModel& mdl) { _dynamicTree.insert(mdl); } bool Contains(const GameObjectModel& mdl) const { return _dynamicTree.contains(mdl);} bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist); + + /* + RESPAWN TIMES + */ + time_t GetLinkedRespawnTime(uint64 guid) const; + time_t GetCreatureRespawnTime(uint32 dbGuid) const + { + UNORDERED_MAP::const_iterator itr = _creatureRespawnTimes.find(dbGuid); + if (itr != _creatureRespawnTimes.end()) + return itr->second; + + return time_t(0); + } + + time_t GetGORespawnTime(uint32 dbGuid) const + { + UNORDERED_MAP::const_iterator itr = _goRespawnTimes.find(dbGuid); + if (itr != _goRespawnTimes.end()) + return itr->second; + + return time_t(0); + } + + void SaveCreatureRespawnTime(uint32 dbGuid, time_t respawnTime); + void RemoveCreatureRespawnTime(uint32 dbGuid); + void SaveGORespawnTime(uint32 dbGuid, time_t respawnTime); + void RemoveGORespawnTime(uint32 dbGuid); + void LoadRespawnTimes(); + void DeleteRespawnTimes(); + private: void LoadMapAndVMap(int gx, int gy); void LoadVMap(int gx, int gy); @@ -488,6 +518,7 @@ class Map : public GridRefManager void ScriptsProcess(); void UpdateActiveCells(const float &x, const float &y, const uint32 t_diff); + protected: void SetUnloadReferenceLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); } @@ -570,6 +601,9 @@ class Map : public GridRefManager else m_activeNonPlayers.erase(obj); } + + UNORDERED_MAP _creatureRespawnTimes; + UNORDERED_MAP _goRespawnTimes; }; enum InstanceResetMethod diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 5543251e115..2c1bdb00834 100755 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -211,6 +211,8 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this); ASSERT(map->IsDungeon()); + map->LoadRespawnTimes(); + bool load_data = save != NULL; map->CreateInstanceData(load_data); diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index eb09538721d..e9de3ae001f 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -110,6 +110,7 @@ Map* MapManager::CreateBaseMap(uint32 id) else { map = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY); + map->LoadRespawnTimes(); } i_maps[id] = map; } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index ffc09a10e22..c539dd3cc39 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -129,8 +129,7 @@ namespace Movement void MoveSplineInit::SetFacing(const Unit * target) { args.flags.EnableFacingTarget(); - //args.facing.target = target->GetObjectGuid().GetRawValue(); - args.facing.target = target->GetUInt64Value(OBJECT_FIELD_GUID); + args.facing.target = target->GetGUID(); } void MoveSplineInit::SetFacing(float angle) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 465fca75030..dfdd4fc4ffc 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -166,8 +166,10 @@ bool OPvPCapturePoint::DelCreature(uint32 type) //if (Map* map = sMapMgr->FindMap(cr->GetMapId())) // map->Remove(cr, false); // delete respawn time for this creature - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_GUID); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN); stmt->setUInt32(0, guid); + stmt->setUInt16(1, cr->GetMapId()); + stmt->setUInt32(2, 0); // instance id, always 0 for world maps CharacterDatabase.Execute(stmt); cr->AddObjectToRemoveList(); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 6e32d33a7bb..5bd5961a05b 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1410,15 +1410,9 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Creature Addon Data..."); sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() - sLog->outString("Loading Creature Respawn Data..."); // must be after PackInstances() - sObjectMgr->LoadCreatureRespawnTimes(); - sLog->outString("Loading Gameobject Data..."); sObjectMgr->LoadGameobjects(); - sLog->outString("Loading Gameobject Respawn Data..."); // must be after PackInstances() - sObjectMgr->LoadGameobjectRespawnTimes(); - sLog->outString("Loading Creature Linked Respawn..."); sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects() diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index d315c6417ea..89cc6ab25e5 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -314,18 +314,17 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC) // Creature respawn - PREPARE_STATEMENT(CHAR_SEL_CREATURE_RESPAWNS, "SELECT guid, respawnTime, instanceId FROM creature_respawn", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_REP_CREATURE_RESPAWN, "REPLACE INTO creature_respawn (guid, respawnTime, instanceId) VALUES (?, ?, ?)", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN, "DELETE FROM creature_respawn WHERE guid = ? AND instanceId = ?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN_BY_GUID, "DELETE FROM creature_respawn WHERE guid = ?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, "DELETE FROM creature_respawn WHERE instanceId = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_SEL_CREATURE_RESPAWNS, "SELECT guid, respawnTime FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH) + PREPARE_STATEMENT(CHAR_REP_CREATURE_RESPAWN, "REPLACE INTO creature_respawn (guid, respawnTime, mapId, instanceId) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN, "DELETE FROM creature_respawn WHERE guid = ? AND mapId = ? AND instanceId = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, "DELETE FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_MAX_CREATURE_RESPAWNS, "SELECT MAX(respawnTime), instanceId FROM creature_respawn WHERE instanceId > 0 GROUP BY instanceId", CONNECTION_SYNCH) // Gameobject respawn - PREPARE_STATEMENT(CHAR_SEL_GO_RESPAWNS, "SELECT guid, respawnTime, instanceId FROM gameobject_respawn", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_REP_GO_RESPAWN, "REPLACE INTO gameobject_respawn (guid, respawnTime, instanceId) VALUES (?, ?, ?)", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN, "DELETE FROM gameobject_respawn WHERE guid = ? AND instanceId = ?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN_BY_INSTANCE, "DELETE FROM gameobject_respawn WHERE instanceId = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_SEL_GO_RESPAWNS, "SELECT guid, respawnTime FROM gameobject_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH) + PREPARE_STATEMENT(CHAR_REP_GO_RESPAWN, "REPLACE INTO gameobject_respawn (guid, respawnTime, mapId, instanceId) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN, "DELETE FROM gameobject_respawn WHERE guid = ? AND mapId = ? AND instanceId = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN_BY_INSTANCE, "DELETE FROM gameobject_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_ASYNC) // GM Tickets PREPARE_STATEMENT(CHAR_SEL_GM_TICKETS, "SELECT ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed FROM gm_tickets", CONNECTION_SYNCH) diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index cf6bbd7bdfa..e1530f36e44 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -296,7 +296,6 @@ enum CharacterDatabaseStatements CHAR_SEL_CREATURE_RESPAWNS, CHAR_REP_CREATURE_RESPAWN, CHAR_DEL_CREATURE_RESPAWN, - CHAR_DEL_CREATURE_RESPAWN_BY_GUID, CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, CHAR_SEL_MAX_CREATURE_RESPAWNS, -- cgit v1.2.3 From 32aa983fe23ffc49ae0cf5322bae9f31beab5d47 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 8 Jun 2012 14:52:52 +0200 Subject: Core/Maps: Fixed possible crash when resetting instances --- src/server/game/Instances/InstanceSaveMgr.cpp | 5 ++++- src/server/game/Maps/Map.cpp | 14 ++++++++++---- src/server/game/Maps/Map.h | 2 ++ 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 2e0d1e47c92..59bb86cb68e 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -543,7 +543,10 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) if (iMap && iMap->IsDungeon()) ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY); - iMap->DeleteRespawnTimes(); + if (iMap) + iMap->DeleteRespawnTimes(); + else + Map::DeleteRespawnTimesInDB(mapid, instanceId); // Free up the instance id and allow it to be reused sMapMgr->FreeInstanceId(instanceId); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 6f19fdcbc0a..82659e32016 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2880,14 +2880,19 @@ void Map::DeleteRespawnTimes() _creatureRespawnTimes.clear(); _goRespawnTimes.clear(); + DeleteRespawnTimesInDB(GetId(), GetInstanceId()); +} + +void Map::DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId) +{ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE); - stmt->setUInt16(0, GetId()); - stmt->setUInt32(1, GetInstanceId()); + stmt->setUInt16(0, mapId); + stmt->setUInt32(1, instanceId); CharacterDatabase.Execute(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE); - stmt->setUInt16(0, GetId()); - stmt->setUInt32(1, GetInstanceId()); + stmt->setUInt16(0, mapId); + stmt->setUInt32(1, instanceId); CharacterDatabase.Execute(stmt); } @@ -2906,3 +2911,4 @@ time_t Map::GetLinkedRespawnTime(uint64 guid) const return time_t(0); } + diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 94a64126da1..214f50e6d3c 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -473,6 +473,8 @@ class Map : public GridRefManager void LoadRespawnTimes(); void DeleteRespawnTimes(); + static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId); + private: void LoadMapAndVMap(int gx, int gy); void LoadVMap(int gx, int gy); -- cgit v1.2.3 From 643b68926eb895c155df76e8534bca8155dbe87d Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 8 Jun 2012 08:56:49 -0400 Subject: Core/Spells: codestyle and fix logic for adding unit state casting. (thx Moriquendu) --- src/server/game/Entities/Unit/Unit.cpp | 15 ++-- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 88 +++++++++++------------ 2 files changed, 52 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e89e5df2a0c..d133a2b6a38 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2893,10 +2893,11 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); m_AutoRepeatFirstCast = true; } - if ((m_currentSpells[CURRENT_GENERIC_SPELL] && m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->CalcCastTime(this) > 0) && IsNonMeleeSpellCasted(false, false, true)) + if ((pSpell->m_spellInfo->CalcCastTime(this) > 0) && IsNonMeleeSpellCasted(false, false, true)) AddUnitState(UNIT_STATE_CASTING); - } break; + break; + } case CURRENT_CHANNELED_SPELL: { // channel spells always break generic non-delayed and any channeled spells @@ -2908,8 +2909,9 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); AddUnitState(UNIT_STATE_CASTING); - } break; + break; + } case CURRENT_AUTOREPEAT_SPELL: { // only Auto Shoot does not break anything @@ -2921,12 +2923,11 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) } // special action: set first cast flag m_AutoRepeatFirstCast = true; - } break; + break; + } default: - { - // other spell types don't break anything now - } break; + break; // other spell types don't break anything now } // current spell (if it is still here) may be safely deleted now diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1b6ae348b1c..efbaf76406c 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3523,55 +3523,55 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 } case 477: case 1733: + { + if (!GetBaseAmount()) { - if (!GetBaseAmount()) - { - mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) - | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) - | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM) - | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR) - | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED) - | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN); - - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, apply); - aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); - aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); - aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); - aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); - aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); - aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); - } - break; + mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) + | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) + | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM) + | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR) + | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED) + | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN); + + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); + aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); } + break; + } case 878: + { + if (GetBaseAmount() == 1) { - if (GetBaseAmount() == 1) - { - mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN) - | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE); - - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); - aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); - aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); - } - break; + mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN) + | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE); + + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); } + break; + } default: break; } -- cgit v1.2.3 From 6107e48f8b0f80cdefa725055ef662c41ff4bb82 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 8 Jun 2012 10:08:02 -0400 Subject: Core/Spells: fix scourge strike extra damage. thanks to tibbi --- src/server/scripts/Spells/spell_dk.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 36dcb53ad00..7a4b8f273d2 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -381,6 +381,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader class spell_dk_scourge_strike_SpellScript : public SpellScript { PrepareSpellScript(spell_dk_scourge_strike_SpellScript); + float multiplier; bool Validate(SpellInfo const* /*spellEntry*/) { @@ -390,11 +391,18 @@ class spell_dk_scourge_strike : public SpellScriptLoader } void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f); + } + + void HandleAfterHit() { Unit* caster = GetCaster(); if (Unit* unitTarget = GetHitUnit()) { - int32 bp = CalculatePctN(GetHitDamage(), GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID())); + int32 bp = GetHitDamage() * multiplier; caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true); } } @@ -402,6 +410,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); + AfterHit += SpellHitFn(spell_dk_scourge_strike_SpellScript::HandleAfterHit); } }; -- cgit v1.2.3 From 69bf716c1b24ccac1b4a6a226467f731e3ce369c Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 8 Jun 2012 11:01:27 -0400 Subject: Core/Spells: set default multiplier for scourge strike bonus damage to 1. --- src/server/scripts/Spells/spell_dk.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 7a4b8f273d2..c33ca548d73 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -383,6 +383,12 @@ class spell_dk_scourge_strike : public SpellScriptLoader PrepareSpellScript(spell_dk_scourge_strike_SpellScript); float multiplier; + bool Load() + { + multiplier = 1.0f; + return true; + } + bool Validate(SpellInfo const* /*spellEntry*/) { if (!sSpellMgr->GetSpellInfo(DK_SPELL_SCOURGE_STRIKE_TRIGGERED)) -- cgit v1.2.3 From 69ea6b5d323a6834fd4e54c6979de20ffc596be2 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 8 Jun 2012 13:08:38 -0400 Subject: Core/Pets: base implementation for pet aura scaling system. not currently hooked into anything. (thx vincent-michael for the base work) --- src/server/scripts/Spells/spell_pet.cpp | 178 ++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 src/server/scripts/Spells/spell_pet.cpp (limited to 'src') diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp new file mode 100644 index 00000000000..1265b808ecd --- /dev/null +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* + * Scripts for spells with SPELLFAMILY_DEATHKNIGHT and SPELLFAMILY_GENERIC spells used by deathknight players. + * Ordered alphabetically using scriptname. + * Scriptnames of files in this file should be prefixed with "spell_dk_". + */ + +#include "ScriptMgr.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" + +enum PetCalculate +{ + SPELL_HUNTER_PET_CRIT = 19591, + SPELL_HUNTER_PET_SCALING_01 = 34902, + SPELL_HUNTER_PET_SCALING_02 = 34903, + SPELL_HUNTER_PET_SCALING_03 = 34904, + SPELL_HUNTER_PET_SCALING_04 = 61017, + SPELL_WARLOCK_PET_CRIT = 35695, + SPELL_WARLOCK_PET_HIT_EXPERTISE = 61013, + SPELL_DK_PET_HIT = 61697, + SPELL_SHAMAN_PET_HIT = 61783, +}; + +class spell_gen_pet_calculate : public SpellScriptLoader +{ + public: + spell_gen_pet_calculate() : SpellScriptLoader("spell_gen_pet_calculate") { } + + class spell_gen_pet_calculate_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_pet_calculate_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float CritSpell = 0.0f; + // Crit from Intellect + CritSpell += owner->GetSpellCritFromIntellect(); + // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE + CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); + // Increase crit from SPELL_AURA_MOD_CRIT_PCT + CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); + // Increase crit spell from spell crit ratings + CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL); + + amount += int32(CritSpell); + } + } + + void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float CritMelee = 0.0f; + // Crit from Agility + CritMelee += owner->GetMeleeCritFromAgility(); + // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT + CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); + // Increase crit from SPELL_AURA_MOD_CRIT_PCT + CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); + // Increase crit melee from melee crit ratings + CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE); + + amount += int32(CritMelee); + } + } + + void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitMelee = 0.0f; + // Increase hit from SPELL_AURA_MOD_HIT_CHANCE + HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); + // Increase hit melee from meele hit ratings + HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE); + + amount += int32(HitMelee); + } + } + + void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitSpell = 0.0f; + // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE + HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); + // Increase hit spell from spell hit ratings + HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL); + + amount += int32(HitSpell); + } + } + + void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float Expertise = 0.0f; + // Increase hit from SPELL_AURA_MOD_EXPERTISE + Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE); + // Increase Expertise from Expertise ratings + Expertise += owner->GetRatingBonusValue(CR_EXPERTISE); + + amount += int32(Expertise); + } + } + + void Register() + { + switch (m_scriptSpellId) + { + case SPELL_HUNTER_PET_CRIT: + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritMelee, EFFECT_0, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritSpell, EFFECT_1, SPELL_AURA_MOD_SPELL_CRIT_CHANCE); + break; + case SPELL_WARLOCK_PET_CRIT: + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritSpell, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritMelee, EFFECT_1, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); + break; + case SPELL_WARLOCK_PET_HIT_EXPERTISE: + case SPELL_HUNTER_PET_SCALING_04: + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE); + break; + case SPELL_DK_PET_HIT: + case SPELL_SHAMAN_PET_HIT: + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); + break; + default: + break; + } + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_pet_calculate_AuraScript(); + } +}; + +void AddSC_pet_spell_scripts() +{ + new spell_gen_pet_calculate(); +} -- cgit v1.2.3 From 38424024e610356d75e4333e3198698d85dfd847 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 8 Jun 2012 14:05:17 -0400 Subject: Core/Pets: more updates to spells for pet scaling. based on research and sniffs. (some spells are unk at this moment) --- src/server/scripts/Spells/spell_pet.cpp | 54 +++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 1265b808ecd..d1c71817316 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -25,17 +25,51 @@ #include "SpellScript.h" #include "SpellAuraEffects.h" -enum PetCalculate +enum HunterPetCalculate { - SPELL_HUNTER_PET_CRIT = 19591, + SPELL_TAMED_PET_PASSIVE_06 = 19591, + SPELL_TAMED_PET_PASSIVE_07 = 20784, + SPELL_TAMED_PET_PASSIVE_08 = 34666, + SPELL_TAMED_PET_PASSIVE_09 = 34667, + SPELL_TAMED_PET_PASSIVE_10 = 34675, SPELL_HUNTER_PET_SCALING_01 = 34902, SPELL_HUNTER_PET_SCALING_02 = 34903, SPELL_HUNTER_PET_SCALING_03 = 34904, SPELL_HUNTER_PET_SCALING_04 = 61017, - SPELL_WARLOCK_PET_CRIT = 35695, - SPELL_WARLOCK_PET_HIT_EXPERTISE = 61013, - SPELL_DK_PET_HIT = 61697, - SPELL_SHAMAN_PET_HIT = 61783, +}; + +enum WarlockPetCalculate +{ + SPELL_PET_PASSIVE_CRIT = 35695, + SPELL_PET_PASSIVE_DAMAGE_TAKEN = 35697, + SPELL_WARLOCK_PET_SCALING_01 = 34947, + SPELL_WARLOCK_PET_SCALING_02 = 34956, + SPELL_WARLOCK_PET_SCALING_03 = 34957, + SPELL_WARLOCK_PET_SCALING_04 = 34958, + SPELL_WARLOCK_PET_SCALING_05 = 61013, +}; + +enum DKPetCalculate +{ + SPELL_DEATH_KNIGHT_PET_SCALING_01 = 54566, + SPELL_DEATH_KNIGHT_PET_SCALING_02 = 51996, + SPELL_DEATH_KNIGHT_PET_SCALING_03 = 61697, +}; + +enum ShamanPetCalculate +{ + SPELL_FERAL_SPIRIT_PET_UNK_01 = 35674, + SPELL_FERAL_SPIRIT_PET_UNK_02 = 35675, + SPELL_FERAL_SPIRIT_PET_UNK_03 = 35676, + SPELL_FERAL_SPIRIT_PET_SCALING_04 = 61783, +}; + +enum MiscPetCalculate +{ + SPELL_FERAL_SPIRIT_PET_SCALING_04 = 61783, + SPELL_PET_HEALTH_SCALING = 61679, + SPELL_PET_UNK_01 = 67561, + SPELL_PET_UNK_01 = 67557, }; class spell_gen_pet_calculate : public SpellScriptLoader @@ -141,21 +175,21 @@ class spell_gen_pet_calculate : public SpellScriptLoader { switch (m_scriptSpellId) { - case SPELL_HUNTER_PET_CRIT: + case SPELL_TAMED_PET_PASSIVE_06: DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritMelee, EFFECT_0, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritSpell, EFFECT_1, SPELL_AURA_MOD_SPELL_CRIT_CHANCE); break; - case SPELL_WARLOCK_PET_CRIT: + case SPELL_PET_PASSIVE_CRIT: DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritSpell, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritMelee, EFFECT_1, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); break; - case SPELL_WARLOCK_PET_HIT_EXPERTISE: + case SPELL_WARLOCK_PET_SCALING_05: case SPELL_HUNTER_PET_SCALING_04: DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE); break; - case SPELL_DK_PET_HIT: + case SPELL_DEATH_KNIGHT_PET_SCALING_03: case SPELL_SHAMAN_PET_HIT: DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); -- cgit v1.2.3 From 8e8bf5c67d346e61ce81b971043e56a01ac2ed6c Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 8 Jun 2012 14:10:05 -0400 Subject: Core/Pets: one more update before i leave for the weekend! --- src/server/scripts/Spells/spell_pet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index d1c71817316..27cb0d3bb71 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -66,7 +66,7 @@ enum ShamanPetCalculate enum MiscPetCalculate { - SPELL_FERAL_SPIRIT_PET_SCALING_04 = 61783, + SPELL_MAGE_PET_PASSIVE_ELEMENTAL = 44559, SPELL_PET_HEALTH_SCALING = 61679, SPELL_PET_UNK_01 = 67561, SPELL_PET_UNK_01 = 67557, -- cgit v1.2.3 From 8ab6d578ce207c3e195939960c8e81a1da90554d Mon Sep 17 00:00:00 2001 From: joschiwald Date: Fri, 8 Jun 2012 22:25:33 +0200 Subject: fix typos - i failed so hard :( --- .../2012_05_28_01_world_spell_script_names.sql | 4 ++-- .../2012_05_28_02_world_spelldifficulty_dbc.sql | 2 +- .../world/2012_05_28_03_world_conditions.sql | 2 +- src/server/game/Spells/Spell.cpp | 21 +-------------------- src/server/game/Spells/SpellMgr.cpp | 5 ++++- .../scripts/Northrend/Naxxramas/boss_gothik.cpp | 16 +++++++++------- .../Ulduar/HallsOfLightning/boss_loken.cpp | 8 +++++--- src/server/scripts/Spells/spell_druid.cpp | 11 ++++------- src/server/scripts/Spells/spell_generic.cpp | 17 +++++++++++------ src/server/scripts/Spells/spell_shaman.cpp | 8 ++++---- 10 files changed, 42 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/sql/updates/world/2012_05_28_01_world_spell_script_names.sql b/sql/updates/world/2012_05_28_01_world_spell_script_names.sql index e1db8fff869..00ceb1df9e9 100644 --- a/sql/updates/world/2012_05_28_01_world_spell_script_names.sql +++ b/sql/updates/world/2012_05_28_01_world_spell_script_names.sql @@ -39,8 +39,8 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (28833, 'spell_four_horsemen_mark'), (28834, 'spell_four_horsemen_mark'), (28835, 'spell_four_horsemen_mark'), -(27831, 'spell_gothic_shadow_bolt_volley'), -(55638, 'spell_gothic_shadow_bolt_volley'), +(27831, 'spell_gothik_shadow_bolt_volley'), +(55638, 'spell_gothik_shadow_bolt_volley'), (31447, 'spell_mark_of_kazrogal'), (32960, 'spell_mark_of_kazzak'), (33654, 'spell_gruul_shatter'), diff --git a/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql b/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql index 8caaf1a6fc7..198a2bf839d 100644 --- a/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql +++ b/sql/updates/world/2012_05_28_02_world_spelldifficulty_dbc.sql @@ -1,6 +1,6 @@ SET @DIFF := xxxx; -- set by TDB team DELETE FROM `spelldifficulty_dbc` WHERE `id` BETWEEN @DIFF+0 AND @DIFF+2; -INSERT INTO `spelldifficulty_dbc` (`id`,`spelld0`,`spellid1`,`spelld2`,`spellid3`) VALUES +INSERT INTO `spelldifficulty_dbc` (`id`,`spellid0`,`spellid1`,`spellid2`,`spellid3`) VALUES (@DIFF+0,50811,61547,0,0), (@DIFF+1,57762,59990,0,0), (@DIFF+2,57763,61489,0,0); diff --git a/sql/updates/world/2012_05_28_03_world_conditions.sql b/sql/updates/world/2012_05_28_03_world_conditions.sql index 8369352481b..43d422e9239 100644 --- a/sql/updates/world/2012_05_28_03_world_conditions.sql +++ b/sql/updates/world/2012_05_28_03_world_conditions.sql @@ -1,5 +1,5 @@ DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry` IN (19938,30877); -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES (17,0,19938,0,0,1,1,17743,0,0,0,0,'','Awaken Peon'), (17,0,30877,0,0,31,1,3,17326,0,0,0,'','Tag Murloc'); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 8165c8172d7..da1841f7400 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5297,29 +5297,10 @@ SpellCastResult Spell::CheckCast(bool strict) } } - for (int i = 0; i < MAX_SPELL_EFFECTS; i++) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { switch (m_spellInfo->Effects[i].ApplyAuraName) { - case SPELL_AURA_DUMMY: - { - //custom check - switch (m_spellInfo->Id) - { - case 44795: // Parachute - { - float x, y, z; - m_caster->GetPosition(x, y, z); - float ground_Z = m_caster->GetMap()->GetHeight(m_caster->GetPhaseMask(), x, y, z); - if (fabs(ground_Z - z) < 0.1f) - return SPELL_FAILED_DONT_REPORT; - break; - } - default: - break; - } - break; - } case SPELL_AURA_MOD_POSSESS_PET: { if (m_caster->GetTypeId() != TYPEID_PLAYER) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 87373321a36..fd71ee294d7 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2975,7 +2975,6 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetB[0] = 0; break; case 63665: // Charge (Argent Tournament emote on riders) - case 31447: // Mark of Kaz'rogal (needs target selection script) case 31298: // Sleep (needs target selection script) case 51904: // Summon Ghouls On Scarlet Crusade (this should use conditions table, script for this spell needs to be fixed) case 2895: // Wrath of Air Totem rank 1 (Aura) @@ -3257,6 +3256,10 @@ void SpellMgr::LoadDbcDataCorrections() case 53313: // Entangling Roots (Rank 8) -- Nature's Grasp Proc spellInfo->CastingTimeIndex = 1; break; + case 59414: // Pulsing Shockwave Aura (Loken) + // this flag breaks movement, remove it + spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1; + break; case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE; break; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 227dfaada9c..7f4915cb3f1 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" +#include "GridNotifiers.h" +#include "CombatAI.h" #include "naxxramas.h" enum Yells @@ -591,14 +593,14 @@ class mob_gothik_minion : public CreatureScript } }; -class spell_gothic_shadow_bolt_volley : public SpellScriptLoader +class spell_gothik_shadow_bolt_volley : public SpellScriptLoader { public: - spell_gothic_shadow_bolt_volley() : SpellScriptLoader("spell_gothic_shadow_bolt_volley") { } + spell_gothik_shadow_bolt_volley() : SpellScriptLoader("spell_gothik_shadow_bolt_volley") { } - class spell_gothic_shadow_bolt_volley_SpellScript : public SpellScript + class spell_gothik_shadow_bolt_volley_SpellScript : public SpellScript { - PrepareSpellScript(spell_gothic_shadow_bolt_volley_SpellScript); + PrepareSpellScript(spell_gothik_shadow_bolt_volley_SpellScript); void FilterTargets(std::list& unitList) { @@ -607,13 +609,13 @@ class spell_gothic_shadow_bolt_volley : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_gothic_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; SpellScript* GetSpellScript() const { - return new spell_gothic_shadow_bolt_volley_SpellScript(); + return new spell_gothik_shadow_bolt_volley_SpellScript(); } }; @@ -621,5 +623,5 @@ void AddSC_boss_gothik() { new boss_gothik(); new mob_gothik_minion(); - new spell_gothic_shadow_bolt_volley(); + new spell_gothik_shadow_bolt_volley(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index 0034747c6c2..bdaaa002b3f 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -19,7 +19,7 @@ /* ScriptData SDName: Boss Loken SD%Complete: 60% -SDComment: Missing intro. Aura is not working (59414) +SDComment: Missing intro. SDCategory: Halls of Lightning EndScriptData */ @@ -85,7 +85,7 @@ public: { m_uiArcLightning_Timer = 15000; m_uiLightningNova_Timer = 20000; - m_uiResumePulsingShockwave_Timer = 15000; + m_uiResumePulsingShockwave_Timer = 1000; m_uiHealthAmountModifier = 1; @@ -112,7 +112,10 @@ public: Talk(SAY_DEATH); if (instance) + { instance->SetData(TYPE_LOKEN, DONE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PULSING_SHOCKWAVE_AURA); + } } void KilledUnit(Unit* /*victim*/) @@ -130,7 +133,6 @@ public: { if (m_uiResumePulsingShockwave_Timer <= uiDiff) { - //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement? DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); DoCast(me, SPELL_PULSING_SHOCKWAVE_N, true); diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index f759efbee83..9dedeaf5bd7 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -388,7 +388,7 @@ class spell_dru_starfall_dummy : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -549,8 +549,7 @@ class spell_dru_savage_roar : public SpellScriptLoader void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - int32 bp0 = aurEff->GetAmount(); // todo: check if needed - target->CastCustomSpell(target, DRUID_SAVAGE_ROAR, &bp0, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + target->CastSpell(target, DRUID_SAVAGE_ROAR, true, NULL, aurEff, GetCasterGUID()); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -560,9 +559,8 @@ class spell_dru_savage_roar : public SpellScriptLoader void Register() { - // todo: check AuraEffectHandleModes - AfterEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); - AfterEffectRemove += AuraEffectRemoveFn(spell_dru_savage_roar_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_savage_roar_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -626,7 +624,6 @@ class spell_dru_survival_instincts : public SpellScriptLoader void Register() { - // todo: check AuraEffectHandleModes AfterEffectApply += AuraEffectApplyFn(spell_dru_survival_instincts_AuraScript::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); AfterEffectRemove += AuraEffectRemoveFn(spell_dru_survival_instincts_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index b619dd9ac6f..85b1a79efd7 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -239,7 +239,7 @@ class spell_gen_parachute : public SpellScriptLoader { PrepareAuraScript(spell_gen_parachute_AuraScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spell*/) { if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF)) return false; @@ -252,7 +252,12 @@ class spell_gen_parachute : public SpellScriptLoader if (target->IsFalling()) { target->RemoveAurasDueToSpell(SPELL_PARACHUTE); - target->CastSpell(target, SPELL_PARACHUTE_BUFF, true); + + float x, y, z; + target->GetPosition(x, y, z); + float groundZ = target->GetMap()->GetHeight(target->GetPhaseMask(), x, y, z); + if (fabs(groundZ - z) > 0.1f) + target->CastSpell(target, SPELL_PARACHUTE_BUFF, true); } } @@ -2864,6 +2869,8 @@ class spell_gen_summon_elemental : public SpellScriptLoader enum Mounts { + SPELL_COLD_WEATHER_FLYING = 54197, + // Magic Broom SPELL_MAGIC_BROOM_60 = 42680, SPELL_MAGIC_BROOM_100 = 42683, @@ -2953,7 +2960,7 @@ class spell_gen_mount : public SpellScriptLoader // Triggered spell id dependent on riding skill and zone bool canFly = false; uint32 vmap = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId()); - if (vmap == 530 || (vmap == 571 && target->HasSpell(54197))) + if (vmap == 530 || (vmap == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING))) canFly = true; float x, y, z; @@ -2998,9 +3005,7 @@ class spell_gen_mount : public SpellScriptLoader if (mount) { - // Prevent stacking of mounts and client crashes upon dismounting - //target->RemoveAurasByType(SPELL_AURA_MOUNTED, 0, GetHitAura()); - + PreventHitAura(); target->CastSpell(target, mount, true); } } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index a7c196701ad..da15c5c5046 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -713,7 +713,7 @@ class spell_sha_sentry_totem : public SpellScriptLoader { PrepareAuraScript(spell_sha_sentry_totem_AuraScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spell*/) { if (!sSpellMgr->GetSpellInfo(SHAMAN_BIND_SIGHT)) return false; @@ -732,9 +732,9 @@ class spell_sha_sentry_totem : public SpellScriptLoader void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (GetCaster) - if (Player* caster = GetCaster()->ToPlayer()) - caster->StopCastingBindSight(); + if (Unit* caster = GetCaster()) + if (caster->GetTypeId() == TYPEID_PLAYER) + caster->ToPlayer()->StopCastingBindSight(); } void Register() -- cgit v1.2.3 From 7d98f2ffc7652e4797839a86063abfff86603de9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 9 Jun 2012 13:09:49 +0200 Subject: Core/Spells: Fixed WotF and PvP trinket shared cooldown --- src/server/scripts/Spells/spell_generic.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index e23e21cf2cd..07e9546173d 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -660,22 +660,16 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader return true; } - void HandleScript(SpellEffIndex /*effIndex*/) + void HandleScript() { - Player* caster = GetCaster()->ToPlayer(); - SpellInfo const* spellInfo = GetSpellInfo(); - caster->AddSpellCooldown(spellInfo->Id, 0, time(NULL) + sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER)->GetRecoveryTime() / IN_MILLISECONDS); - WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); - data << uint64(caster->GetGUID()); - data << uint8(0); - data << uint32(spellInfo->Id); - data << uint32(0); - caster->GetSession()->SendPacket(&data); + // This is only needed because spells cast from spell_linked_spell are triggered by default + // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD + GetCaster()->ToPlayer()->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell()); } void Register() { - OnEffectHit += SpellEffectFn(spell_pvp_trinket_wotf_shared_cd_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + AfterCast += SpellCastFn(spell_pvp_trinket_wotf_shared_cd_SpellScript::HandleScript); } }; -- cgit v1.2.3 From be5f0b0f478dec5f9a49680dec24ba0dd1870f63 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 9 Jun 2012 22:50:56 +0200 Subject: Core/Scripts: Fixed crash in mob_phase_hunterAI, this entire script is crappy and needs rewrite anyway. --- src/server/scripts/Outland/netherstorm.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index afc18c71b92..16dac13d1a9 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -777,10 +777,10 @@ public: PlayerGUID = who->GetGUID(); } - void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/) - { - DoCast(me, SPELL_DE_MATERIALIZE); - } + //void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/) + //{ + // DoCast(me, SPELL_DE_MATERIALIZE); + //} void UpdateAI(const uint32 diff) { -- cgit v1.2.3 From f6fc2ef8cfa6cd67ec6c7595de6b4101d6877385 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 10 Jun 2012 03:28:51 +0200 Subject: Fix non PCH build --- src/server/game/Server/Protocol/PacketLog.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp index bede48ace87..a8e184c369a 100644 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -18,6 +18,7 @@ #include "PacketLog.h" #include "Config.h" #include "ByteBuffer.h" +#include "WorldPacket.h" PacketLog::PacketLog() : _file(NULL) { -- cgit v1.2.3 From 41d2de2ca3affcc7fbb900a6d7e177960cb569ef Mon Sep 17 00:00:00 2001 From: kandera Date: Sun, 10 Jun 2012 16:10:43 -0300 Subject: Core/Spells: fix addition of unit_state_casting. thx vincent-michael --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d133a2b6a38..a99356681e2 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2893,7 +2893,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); m_AutoRepeatFirstCast = true; } - if ((pSpell->m_spellInfo->CalcCastTime(this) > 0) && IsNonMeleeSpellCasted(false, false, true)) + if (pSpell->m_spellInfo->CalcCastTime(this) > 0) AddUnitState(UNIT_STATE_CASTING); break; -- cgit v1.2.3 From 41b1416445d917e7cce09853829ef9f1a8e632bf Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 10 Jun 2012 21:40:27 -0500 Subject: Core/Warden: Fixed a crash when Warden.ClientCheckFailAction was set to ban in the config, and Warden::Penalty was called in a context where check is NULL closes #6736 --- src/server/game/Warden/Warden.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 0734e0a0f63..cc1c2ff50c6 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -188,7 +188,11 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/) std::string accountName; AccountMgr::GetName(_session->GetAccountId(), accountName); std::stringstream banReason; - banReason << "Warden Anticheat Violation: " << check->Comment << " (CheckId: " << check->CheckId << ")"; + banReason << "Warden Anticheat Violation"; + // Check can be NULL, for example if the client sent a wrong signature in the warden packet (CHECKSUM FAIL) + if (check) + banReason << ": " << check->Comment << " (CheckId: " << check->CheckId << ")"; + sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), banReason.str(),"Server"); return "Ban"; -- cgit v1.2.3 From 28f8e42a69fa6348600c7a45629830bfe5b2dbdc Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 11 Jun 2012 11:10:46 +0200 Subject: Core/AI: Added EventInform hook for GameObjectAI and implemented it in SAI --- src/server/game/AI/CoreAI/GameObjectAI.h | 3 +- src/server/game/AI/SmartScripts/SmartAI.cpp | 5 +++ src/server/game/AI/SmartScripts/SmartAI.h | 51 +++++++++++----------- src/server/game/AI/SmartScripts/SmartScript.cpp | 7 +++ src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 1 + src/server/game/AI/SmartScripts/SmartScriptMgr.h | 10 ++++- src/server/game/Entities/GameObject/GameObject.cpp | 8 +++- 7 files changed, 56 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index f4555649210..21466f8c796 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -53,7 +53,8 @@ class GameObjectAI virtual uint64 GetData64(uint32 /*id*/) { return 0; } virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {} - virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) { } + virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {} + virtual void EventInform(uint32 eventId) {} }; class NullGameObjectAI : public GameObjectAI diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 08f1b18ffad..98b5c0a6ba3 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -937,6 +937,11 @@ void SmartGameObjectAI::OnStateChanged(uint32 state, Unit* unit) GetScript()->ProcessEventsFor(SMART_EVENT_GO_STATE_CHANGED, unit, state); } +void SmartGameObjectAI::EventInform(uint32 eventId) +{ + GetScript()->ProcessEventsFor(SMART_EVENT_GO_EVENT_INFORM, NULL, eventId); +} + class SmartTrigger : public AreaTriggerScript { public: diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 435aa176d4d..3a3a7dc9510 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -235,30 +235,31 @@ class SmartAI : public CreatureAI class SmartGameObjectAI : public GameObjectAI { -public: - SmartGameObjectAI(GameObject* g) : GameObjectAI(g), go(g) {} - ~SmartGameObjectAI() {} - - void UpdateAI(uint32 diff); - void InitializeAI(); - void Reset(); - SmartScript* GetScript() { return &mScript; } - static int Permissible(const GameObject* g); - - bool GossipHello(Player* player); - bool GossipSelect(Player* player, uint32 sender, uint32 action); - bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/); - bool QuestAccept(Player* player, Quest const* quest); - bool QuestReward(Player* player, Quest const* quest, uint32 opt); - uint32 GetDialogStatus(Player* /*player*/); - void Destroyed(Player* player, uint32 eventId); - void SetData(uint32 id, uint32 value); - void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker); - void OnGameEvent(bool start, uint16 eventId); - void OnStateChanged(uint32 state, Unit* unit); - -protected: - GameObject* const go; - SmartScript mScript; + public: + SmartGameObjectAI(GameObject* g) : GameObjectAI(g), go(g) {} + ~SmartGameObjectAI() {} + + void UpdateAI(uint32 diff); + void InitializeAI(); + void Reset(); + SmartScript* GetScript() { return &mScript; } + static int Permissible(const GameObject* g); + + bool GossipHello(Player* player); + bool GossipSelect(Player* player, uint32 sender, uint32 action); + bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/); + bool QuestAccept(Player* player, Quest const* quest); + bool QuestReward(Player* player, Quest const* quest, uint32 opt); + uint32 GetDialogStatus(Player* /*player*/); + void Destroyed(Player* player, uint32 eventId); + void SetData(uint32 id, uint32 value); + void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker); + void OnGameEvent(bool start, uint16 eventId); + void OnStateChanged(uint32 state, Unit* unit); + void EventInform(uint32 eventId); + + protected: + GameObject* const go; + SmartScript mScript; }; #endif diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 9feca1c073a..fb17237fdc5 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2771,6 +2771,13 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui ProcessAction(e, unit, var0, var1); break; } + case SMART_EVENT_GO_EVENT_INFORM: + { + if (e.event.eventInform.eventId != var0) + return; + ProcessAction(e, NULL, var0); + break; + } default: sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index d529479d9dd..bf84f39747a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -533,6 +533,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_EVENT_GO_STATE_CHANGED: + case SMART_EVENT_GO_EVENT_INFORM: case SMART_EVENT_TIMED_EVENT_TRIGGERED: case SMART_EVENT_INSTANCE_PLAYER_ENTER: case SMART_EVENT_TRANSPORT_RELOCATE: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 5b54a4d3048..6c43a9297fc 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -153,9 +153,10 @@ enum SMART_EVENT SMART_EVENT_IS_BEHIND_TARGET = 67, //1 // cooldownMin, CooldownMax SMART_EVENT_GAME_EVENT_START = 68, //1 // game_event.Entry SMART_EVENT_GAME_EVENT_END = 69, //1 // game_event.Entry - SMART_EVENT_GO_STATE_CHANGED = 70, // go state + SMART_EVENT_GO_STATE_CHANGED = 70, //1 // go state + SMART_EVENT_GO_EVENT_INFORM = 71, //1 // eventId - SMART_EVENT_END = 71, + SMART_EVENT_END = 72, }; struct SmartEvent @@ -350,6 +351,11 @@ struct SmartEvent uint32 state; } goStateChanged; + struct + { + uint32 eventId; + } eventInform; + struct { uint32 param1; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 58440095075..1d9958a6524 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1711,7 +1711,13 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const void GameObject::EventInform(uint32 eventId) { - if (eventId && m_zoneScript) + if (!eventId) + return; + + if (AI()) + AI()->EventInform(eventId); + + if (m_zoneScript) m_zoneScript->ProcessEvent(this, eventId); } -- cgit v1.2.3 From 38f6f9d8cb6f31b6d9690e56e0e12da190c504fc Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 11 Jun 2012 11:15:33 -0500 Subject: Core/SAI: Missing change from previous commit --- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 6c43a9297fc..b82d0724f53 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1172,7 +1172,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = {SMART_EVENT_GAME_EVENT_START, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GAME_EVENT_END, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GO_STATE_CHANGED, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, - + {SMART_EVENT_GO_EVENT_INFORM, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, }; enum SmartEventFlags -- cgit v1.2.3 From 042f825400c347dd5144317dde969b41299ac1f2 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 11 Jun 2012 12:22:15 -0400 Subject: Core/Spells: use raw basepoint value for extra attacks. damage gets fuddled somewhere for this spell. fixes hardened steel berserker doing insane damages! --- src/server/game/Spells/SpellEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 0d5dac8f8e0..a01497d87dc 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5320,7 +5320,7 @@ void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex) if (unitTarget->m_extraAttacks) return; - unitTarget->m_extraAttacks = damage; + unitTarget->m_extraAttacks = GetSpellInfo()->Effects[effIndex].BasePoints; ExecuteLogEffectExtraAttacks(effIndex, unitTarget->getVictim(), damage); } -- cgit v1.2.3 From 9fe66cafbef1eeae5e7da7dcb90ba5136a645e76 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 11 Jun 2012 12:26:10 -0400 Subject: Core/Pets: add ghoul reactions to owner emotes. thx joshwhedon --- src/server/game/AI/CoreAI/PetAI.cpp | 18 ++++++++++++++++++ src/server/game/AI/CoreAI/PetAI.h | 1 + 2 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 160b406a6ea..5551f45cb6a 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -532,3 +532,21 @@ bool PetAI::CanAttack(Unit* target) // default, though we shouldn't ever get here return false; } + + +void PetAI::ReceiveEmote(Player* player, uint32 emote) +{ + sLog->outError("recieved emote : %d", emote); + if (me->GetOwnerGUID() && me->GetOwnerGUID() == player->GetGUID()) + switch (emote) + { + case TEXT_EMOTE_COWER: + if (me->isPet() && me->ToPet()->IsPetGhoul()) + me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + break; + case TEXT_EMOTE_ANGRY: + if (me->isPet() && me->ToPet()->IsPetGhoul()) + me->HandleEmoteCommand(EMOTE_ONESHOT_COWER); + break; + } +} \ No newline at end of file diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index ed3e2305556..8e5311fa000 100755 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -42,6 +42,7 @@ class PetAI : public CreatureAI void MovementInform(uint32 moveType, uint32 data); void OwnerDamagedBy(Unit* attacker); void OwnerAttacked(Unit* target); + void ReceiveEmote(Player* player, uint32 textEmote); private: bool _isVisible(Unit*) const; -- cgit v1.2.3 From cdb3ab809b133b379258c82f72c652d9ee0c25cc Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 11 Jun 2012 12:28:27 -0400 Subject: Core/Pets: removed logerror from previous commit --- src/server/game/AI/CoreAI/PetAI.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 5551f45cb6a..97ae0581a18 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -533,10 +533,8 @@ bool PetAI::CanAttack(Unit* target) return false; } - void PetAI::ReceiveEmote(Player* player, uint32 emote) { - sLog->outError("recieved emote : %d", emote); if (me->GetOwnerGUID() && me->GetOwnerGUID() == player->GetGUID()) switch (emote) { @@ -549,4 +547,4 @@ void PetAI::ReceiveEmote(Player* player, uint32 emote) me->HandleEmoteCommand(EMOTE_ONESHOT_COWER); break; } -} \ No newline at end of file +} -- cgit v1.2.3 From 5b8d3f8109c629b1a50b467e0d5ba49f525b9de8 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 11 Jun 2012 12:40:20 -0400 Subject: Core/Pets: more functionality for pet auras. thx to joshwhedon for the new functions. still have a lot to do! --- src/server/scripts/Spells/spell_pet.cpp | 1568 ++++++++++++++++++++++++++++++- 1 file changed, 1566 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 27cb0d3bb71..5c1eb2f1ccd 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -36,6 +36,7 @@ enum HunterPetCalculate SPELL_HUNTER_PET_SCALING_02 = 34903, SPELL_HUNTER_PET_SCALING_03 = 34904, SPELL_HUNTER_PET_SCALING_04 = 61017, + SPELL_HUNTER_ANIMAL_HANDLER = 34453, }; enum WarlockPetCalculate @@ -47,10 +48,15 @@ enum WarlockPetCalculate SPELL_WARLOCK_PET_SCALING_03 = 34957, SPELL_WARLOCK_PET_SCALING_04 = 34958, SPELL_WARLOCK_PET_SCALING_05 = 61013, + ENTRY_FELGUARD = 17252, + ENTRY_VOIDWALKER = 1860, + ENTRY_FELHUNTER = 417, + ENTRY_SUCCUBUS = 1863, }; enum DKPetCalculate { + SPELL_DEATH_KNIGHT_RUNE_WEAPON_02 = 51906, SPELL_DEATH_KNIGHT_PET_SCALING_01 = 54566, SPELL_DEATH_KNIGHT_PET_SCALING_02 = 51996, SPELL_DEATH_KNIGHT_PET_SCALING_03 = 61697, @@ -69,7 +75,7 @@ enum MiscPetCalculate SPELL_MAGE_PET_PASSIVE_ELEMENTAL = 44559, SPELL_PET_HEALTH_SCALING = 61679, SPELL_PET_UNK_01 = 67561, - SPELL_PET_UNK_01 = 67557, + SPELL_PET_UNK_02 = 67557, }; class spell_gen_pet_calculate : public SpellScriptLoader @@ -190,7 +196,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE); break; case SPELL_DEATH_KNIGHT_PET_SCALING_03: - case SPELL_SHAMAN_PET_HIT: +// case SPELL_SHAMAN_PET_HIT: DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); break; @@ -206,6 +212,1564 @@ class spell_gen_pet_calculate : public SpellScriptLoader } }; +class spell_warl_pet_scaling_01 : public SpellScriptLoader +{ +public: + spell_warl_pet_scaling_01() : SpellScriptLoader("spell_warl_pet_scaling_01") { } + + class spell_warl_pet_scaling_01_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_pet_scaling_01_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + _tempHealth = 0; + return true; + } + + void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75); + + amount += ownerBonus; + } + } + + void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* pet = GetUnitOwner()) + if (_tempHealth) + pet->SetHealth(_tempHealth); + } + + void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* pet = GetUnitOwner()) + _tempHealth = pet->GetHealth(); + } + + void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE); + int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW); + int32 maximum = (fire > shadow) ? fire : shadow; + if (maximum < 0) + maximum = 0; + float bonusAP = maximum * 0.57f; + + amount += bonusAP; + + // Glyph of felguard + if (pet->GetEntry() == ENTRY_FELGUARD) + { + if (AuraEffect* aurEffect = owner->GetAuraEffect(56246, EFFECT_0)) + { + float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT); + amount += CalculatePctN(amount+base_attPower, aurEffect->GetAmount()); + } + } + } + } + + void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + //the damage bonus used for pets is either fire or shadow damage, whatever is higher + int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE); + int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW); + int32 maximum = (fire > shadow) ? fire : shadow; + if (maximum < 0) + maximum = 0; + float bonusDamage = maximum * 0.15f; + + amount += bonusDamage; + } + } + + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_warl_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_warl_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE); + } + + private: + uint32 _tempHealth; + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_pet_scaling_01_AuraScript(); + } +}; + +class spell_warl_pet_scaling_02 : public SpellScriptLoader +{ +public: + spell_warl_pet_scaling_02() : SpellScriptLoader("spell_warl_pet_scaling_02") { } + + class spell_warl_pet_scaling_02_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_pet_scaling_02_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + _tempMana = 0; + return true; + } + + void CalculateIntellectAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30); + + amount += ownerBonus; + } + } + + void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* pet = GetUnitOwner()) + if (_tempMana) + pet->SetPower(POWER_MANA, _tempMana); + } + + void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* pet = GetUnitOwner()) + _tempMana = pet->GetPower(POWER_MANA); + } + + void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetArmor(), 35); + + amount += ownerBonus; + } + } + + void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40); + + amount += ownerBonus; + } + } + + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_warl_pet_scaling_02_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_warl_pet_scaling_02_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateIntellectAmount, EFFECT_0, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateArmorAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateFireResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE); + } + + private: + uint32 _tempMana; + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_pet_scaling_02_AuraScript(); + } +}; + +class spell_warl_pet_scaling_03 : public SpellScriptLoader +{ +public: + spell_warl_pet_scaling_03() : SpellScriptLoader("spell_warl_pet_scaling_03") { } + + class spell_warl_pet_scaling_03_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_pet_scaling_03_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40); + + amount += ownerBonus; + } + } + + void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40); + + amount += ownerBonus; + } + } + + void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40); + + amount += ownerBonus; + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateFrostResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateNatureResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_pet_scaling_03_AuraScript(); + } +}; + + +class spell_warl_pet_scaling_04 : public SpellScriptLoader +{ +public: + spell_warl_pet_scaling_04() : SpellScriptLoader("spell_warl_pet_scaling_04") { } + + class spell_warl_pet_scaling_04_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_pet_scaling_04_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40); + + amount += ownerBonus; + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_04_AuraScript::CalculateShadowResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_pet_scaling_04_AuraScript(); + } +}; + +class spell_warl_pet_scaling_05 : public SpellScriptLoader +{ +public: + spell_warl_pet_scaling_05() : SpellScriptLoader("spell_warl_pet_scaling_05") { } + + class spell_warl_pet_scaling_05_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_pet_scaling_05_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitMelee = 0.0f; + // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE + HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); + // Increase hit spell from spell hit ratings + HitMelee += owner->GetRatingBonusValue(CR_HIT_SPELL); + + amount += int32(HitMelee); + } + } + + void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitSpell = 0.0f; + // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE + HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); + // Increase hit spell from spell hit ratings + HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL); + + amount += int32(HitSpell); + } + } + + void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float Expertise = 0.0f; + // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE + Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); + // Increase hit spell from spell hit ratings + Expertise += owner->GetRatingBonusValue(CR_HIT_SPELL); + + amount += int32(Expertise); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_pet_scaling_05_AuraScript(); + } +}; + +class spell_warl_pet_passive : public SpellScriptLoader +{ +public: + spell_warl_pet_passive() : SpellScriptLoader("spell_warl_pet_passive") { } + + class spell_warl_pet_passive_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_pet_passive_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float CritSpell = 0.0f; + // Crit from Intellect + CritSpell += owner->GetSpellCritFromIntellect(); + // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE + CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); + // Increase crit from SPELL_AURA_MOD_CRIT_PCT + CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); + // Increase crit spell from spell crit ratings + CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL); + + if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347)) + if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase()) + if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0)) + amount += CalculatePctN(CritSpell, improvedDemonicTacticsEffect->GetAmount()); + } + } + + void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float CritMelee = 0.0f; + // Crit from Agility + CritMelee += owner->GetMeleeCritFromAgility(); + // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT + CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); + // Increase crit from SPELL_AURA_MOD_CRIT_PCT + CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); + // Increase crit melee from melee crit ratings + CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE); + + if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347)) + if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase()) + if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0)) + amount += CalculatePctN(CritMelee, improvedDemonicTacticsEffect->GetAmount()); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_AuraScript::CalculateAmountCritSpell, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_AuraScript::CalculateAmountCritMelee, EFFECT_1, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_pet_passive_AuraScript(); + } +}; + +class spell_warl_pet_passive_damage_done : public SpellScriptLoader +{ +public: + spell_warl_pet_passive_damage_done() : SpellScriptLoader("spell_warl_pet_passive_damage_done") { } + + class spell_warl_pet_passive_damage_done_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_pet_passive_damage_done_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + switch (GetCaster()->GetEntry()) + { + case ENTRY_VOIDWALKER: + amount += -16; + break; + case ENTRY_FELHUNTER: + amount += -20; + break; + case ENTRY_SUCCUBUS: + case ENTRY_FELGUARD: + amount += 5; + break; + } + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_pet_passive_damage_done_AuraScript(); + } +}; + +class spell_warl_pet_passive_voidwalker : public SpellScriptLoader +{ +public: + spell_warl_pet_passive_voidwalker() : SpellScriptLoader("spell_warl_pet_passive_voidwalker") { } + + class spell_warl_pet_passive_voidwalker_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_pet_passive_voidwalker_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + if (AuraEffect* aurEffect = owner->GetAuraEffect(56247, EFFECT_0)) + amount += aurEffect->GetAmount(); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_voidwalker_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_pet_passive_voidwalker_AuraScript(); + } +}; + + +class spell_sha_pet_scaling_04 : public SpellScriptLoader +{ +public: + spell_sha_pet_scaling_04() : SpellScriptLoader("spell_sha_pet_scaling_04") { } + + class spell_sha_pet_scaling_04_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_pet_scaling_04_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitMelee = 0.0f; + // Increase hit from SPELL_AURA_MOD_HIT_CHANCE + HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); + // Increase hit melee from meele hit ratings + HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE); + + amount += int32(HitMelee); + } + } + + void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitSpell = 0.0f; + // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE + HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); + // Increase hit spell from spell hit ratings + HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL); + + amount += int32(HitSpell); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_pet_scaling_04_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_pet_scaling_04_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_sha_pet_scaling_04_AuraScript(); + } +}; + +class spell_hun_pet_scaling_01 : public SpellScriptLoader +{ +public: + spell_hun_pet_scaling_01() : SpellScriptLoader("spell_hun_pet_scaling_01") { } + + class spell_hun_pet_scaling_01_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_pet_scaling_01_AuraScript); + + void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float mod = 0.45f; + float ownerBonus = 0.0f; + + PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1 + if (itr == pet->ToPet()->m_spells.end()) + itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2 + + if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value + AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue()); + } + + ownerBonus = owner->GetStat(STAT_STAMINA)*mod; + + amount += ownerBonus; + } + } + + void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* pet = GetUnitOwner()) + if (_tempHealth) + pet->SetHealth(_tempHealth); + } + + void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* pet = GetUnitOwner()) + _tempHealth = pet->GetHealth(); + } + + void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float mod = 1.0f; //Hunter contribution modifier + float bonusAP = 0.0f; + + PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1 + if (itr == pet->ToPet()->m_spells.end()) + itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2 + + if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value + mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue()); + } + + bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod; + + amount += bonusAP; + } + } + + void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float mod = 1.0f; //Hunter contribution modifier + float bonusDamage = 0.0f; + + PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1 + if (itr == pet->ToPet()->m_spells.end()) + itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2 + + if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value + mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue()); + } + + bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod; + + amount += bonusDamage; + } + } + + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_hun_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_hun_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE); + } + + private: + uint32 _tempHealth; + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_pet_scaling_01_AuraScript(); + } +}; + +class spell_hun_pet_scaling_02 : public SpellScriptLoader +{ +public: + spell_hun_pet_scaling_02() : SpellScriptLoader("spell_hun_pet_scaling_02") { } + + class spell_hun_pet_scaling_02_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_pet_scaling_02_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40); + + amount += ownerBonus; + } + } + + void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40); + + amount += ownerBonus; + } + } + + void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40); + + amount += ownerBonus; + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateFrostResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateFireResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateNatureResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_pet_scaling_02_AuraScript(); + } +}; + +class spell_hun_pet_scaling_03 : public SpellScriptLoader +{ +public: + spell_hun_pet_scaling_03() : SpellScriptLoader("spell_hun_pet_scaling_03") { } + + class spell_hun_pet_scaling_03_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_pet_scaling_03_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40); + + amount += ownerBonus; + } + } + + void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40); + + amount += ownerBonus; + } + } + + void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isPet()) + return; + + Unit* owner = pet->ToPet()->GetOwner(); + if (!owner) + return; + + float ownerBonus = 0.0f; + + ownerBonus = CalculatePctN(owner->GetArmor(), 35); + + amount += ownerBonus; + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateShadowResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateArmorAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_pet_scaling_03_AuraScript(); + } +}; + +class spell_hun_pet_scaling_04 : public SpellScriptLoader +{ +public: + spell_hun_pet_scaling_04() : SpellScriptLoader("spell_hun_pet_scaling_04") { } + + class spell_hun_pet_scaling_04_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_pet_scaling_04_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitMelee = 0.0f; + // Increase hit from SPELL_AURA_MOD_HIT_CHANCE + HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); + // Increase hit melee from meele hit ratings + HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE); + + amount += int32(HitMelee); + } + } + + void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitSpell = 0.0f; + // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE + HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); + // Increase hit spell from spell hit ratings + HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL); + + amount += int32(HitSpell); + } + } + + void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float Expertise = 0.0f; + // Increase hit from SPELL_AURA_MOD_EXPERTISE + Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE); + // Increase Expertise from Expertise ratings + Expertise += owner->GetRatingBonusValue(CR_EXPERTISE); + + amount += int32(Expertise); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_pet_scaling_04_AuraScript(); + } +}; + +class spell_hun_pet_passive_crit : public SpellScriptLoader +{ +public: + spell_hun_pet_passive_crit() : SpellScriptLoader("spell_hun_pet_passive_crit") { } + + class spell_hun_pet_passive_crit_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_pet_passive_crit_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float CritSpell = 0.0f; + // Crit from Intellect + // CritSpell += owner->GetSpellCritFromIntellect(); + // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE + // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); + // Increase crit from SPELL_AURA_MOD_CRIT_PCT + // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); + // Increase crit spell from spell crit ratings + // CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL); + + amount += (CritSpell*0.8f); + } + } + + void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float CritMelee = 0.0f; + // Crit from Agility + // CritMelee += owner->GetMeleeCritFromAgility(); + // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT + // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); + // Increase crit from SPELL_AURA_MOD_CRIT_PCT + // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); + // Increase crit melee from melee crit ratings + // CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE); + + amount += (CritMelee*0.8f); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_crit_AuraScript::CalculateAmountCritSpell, EFFECT_1, SPELL_AURA_MOD_SPELL_CRIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_crit_AuraScript::CalculateAmountCritMelee, EFFECT_0, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_pet_passive_crit_AuraScript(); + } +}; + +class spell_hun_pet_passive_damage_done : public SpellScriptLoader +{ +public: + spell_hun_pet_passive_damage_done() : SpellScriptLoader("spell_hun_pet_passive_damage_done") { } + + class spell_hun_pet_passive_damage_done_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_pet_passive_damage_done_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // Pet's base damage changes depending on happiness + if (GetCaster()->isPet() && GetCaster()->ToPet()->isHunterPet()) + { + switch (GetCaster()->ToPet()->GetHappinessState()) + { + case HAPPY: + // 125% of normal damage + amount += 25.0f; + break; + case CONTENT: + // 100% of normal damage, nothing to modify + break; + case UNHAPPY: + // 75% of normal damage + amount += -25.0f; + break; + } + } + // Cobra Reflexes + if (AuraEffect* cobraReflexes = GetCaster()->GetAuraEffectOfRankedSpell(61682, EFFECT_0)) + amount -= cobraReflexes->GetAmount(); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_pet_passive_damage_done_AuraScript(); + } +}; + +class spell_hun_animal_handler : public SpellScriptLoader +{ +public: + spell_hun_animal_handler() : SpellScriptLoader("spell_hun_animal_handler") { } + + class spell_hun_animal_handler_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_animal_handler_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + if (AuraEffect* aurEffect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1)) + amount = aurEffect->GetAmount(); + else + amount = 0; + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_animal_handler_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_ATTACK_POWER_PCT); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_animal_handler_AuraScript(); + } +}; + + +class spell_dk_avoidance_passive : public SpellScriptLoader +{ +public: + spell_dk_avoidance_passive() : SpellScriptLoader("spell_dk_avoidance_passive") { } + + class spell_dk_avoidance_passive_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_avoidance_passive_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAvoidanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + Unit* owner = pet->GetOwner(); + if (!owner) + return; + + // Army of the dead ghoul + if (pet->GetEntry() == 24207) + amount = -90; + // Night of the dead + else if (owner->HasAura(55623)) + amount = -90; + else if (owner->HasAura(55620)) + amount = -45; + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_avoidance_passive_AuraScript::CalculateAvoidanceAmount, EFFECT_0, SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dk_avoidance_passive_AuraScript(); + } +}; + +class spell_dk_pet_scaling_01 : public SpellScriptLoader +{ +public: + spell_dk_pet_scaling_01() : SpellScriptLoader("spell_dk_pet_scaling_01") { } + + class spell_dk_pet_scaling_01_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_pet_scaling_01_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + _tempHealth = 0; + return true; + } + + void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isGuardian()) + return; + + Unit* owner = pet->GetOwner(); + if (!owner) + return; + + float mod = 0.3f; + + // Ravenous Dead + AuraEffect const* aurEff = NULL; + // Check just if owner has Ravenous Dead since it's effect is not an aura + aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); + if (aurEff) + { + mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale + } + // Glyph of the Ghoul + aurEff = owner->GetAuraEffect(58686, 0); + if (aurEff) + mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod + float ownerBonus = float(owner->GetStat(STAT_STAMINA)) * mod; + amount += ownerBonus; + } + } + + void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* pet = GetUnitOwner()) + if (_tempHealth) + pet->SetHealth(_tempHealth); + } + + void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* pet = GetUnitOwner()) + _tempHealth = pet->GetHealth(); + } + + void CalculateStrengthAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + if (!pet->isGuardian()) + return; + + Unit* owner = pet->GetOwner(); + if (!owner) + return; + + float mod = 0.7f; + + // Ravenous Dead + AuraEffect const* aurEff = NULL; + // Check just if owner has Ravenous Dead since it's effect is not an aura + aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); + if (aurEff) + { + mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale + } + // Glyph of the Ghoul + aurEff = owner->GetAuraEffect(58686, 0); + if (aurEff) + mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod + float ownerBonus = float(owner->GetStat(STAT_STRENGTH)) * mod; + amount += ownerBonus; + } + } + + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_dk_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_dk_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStrengthAmount, EFFECT_1, SPELL_AURA_MOD_STAT); + } + + private: + uint32 _tempHealth; + }; + + AuraScript* GetAuraScript() const + { + return new spell_dk_pet_scaling_01_AuraScript(); + } +}; + +class spell_dk_pet_scaling_02 : public SpellScriptLoader +{ +public: + spell_dk_pet_scaling_02() : SpellScriptLoader("spell_dk_pet_scaling_02") { } + + class spell_dk_pet_scaling_02_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_pet_scaling_02_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountMeleeHaste(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HasteMelee = 0.0f; + // Increase hit from SPELL_AURA_MOD_HIT_CHANCE + HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100; + + amount += int32(HasteMelee); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_02_AuraScript::CalculateAmountMeleeHaste, EFFECT_1, SPELL_AURA_MELEE_SLOW); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dk_pet_scaling_02_AuraScript(); + } +}; + +class spell_dk_pet_scaling_03 : public SpellScriptLoader +{ +public: + spell_dk_pet_scaling_03() : SpellScriptLoader("spell_dk_pet_scaling_03") { } + + class spell_dk_pet_scaling_03_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_pet_scaling_03_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitMelee = 0.0f; + // Increase hit from SPELL_AURA_MOD_HIT_CHANCE + HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); + // Increase hit melee from meele hit ratings + HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE); + + amount += int32(HitMelee); + } + } + + void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HitSpell = 0.0f; + // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE + HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); + // Increase hit spell from spell hit ratings + HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL); + + amount += int32(HitSpell); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_03_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_03_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dk_pet_scaling_03_AuraScript(); + } +}; + +class spell_dk_rune_weapon_scaling_02 : public SpellScriptLoader +{ +public: + spell_dk_rune_weapon_scaling_02() : SpellScriptLoader("spell_dk_rune_weapon_scaling_02") { } + + class spell_dk_rune_weapon_scaling_02_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_rune_weapon_scaling_02_AuraScript); + + bool Load() + { + if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* pet = GetUnitOwner()) + { + Unit* owner = pet->GetOwner(); + if (!owner) + return; + + if (pet->isGuardian()) + ((Guardian*)pet)->SetBonusDamage(owner->GetTotalAttackPowerValue(BASE_ATTACK)); + + amount += owner->CalculateDamage(BASE_ATTACK, true, true);; + } + } + + void CalculateAmountMeleeHaste(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster() || !GetCaster()->GetOwner()) + return; + if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + { + // For others recalculate it from: + float HasteMelee = 0.0f; + // Increase hit from SPELL_AURA_MOD_HIT_CHANCE + HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100; + + amount += int32(HasteMelee); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_rune_weapon_scaling_02_AuraScript::CalculateDamageDoneAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_rune_weapon_scaling_02_AuraScript::CalculateAmountMeleeHaste, EFFECT_1, SPELL_AURA_MELEE_SLOW); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dk_rune_weapon_scaling_02_AuraScript(); + } +}; + void AddSC_pet_spell_scripts() { new spell_gen_pet_calculate(); -- cgit v1.2.3 From b80621838a1594cc11dc273c43655ed4f65698c5 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 11 Jun 2012 13:26:30 -0400 Subject: Core/Spells: Correctly fix basepoint calculation for adding extra attacks. --- src/server/game/Spells/SpellEffects.cpp | 2 +- src/server/game/Spells/SpellInfo.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index a01497d87dc..0d5dac8f8e0 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5320,7 +5320,7 @@ void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex) if (unitTarget->m_extraAttacks) return; - unitTarget->m_extraAttacks = GetSpellInfo()->Effects[effIndex].BasePoints; + unitTarget->m_extraAttacks = damage; ExecuteLogEffectExtraAttacks(effIndex, unitTarget->getVictim(), damage); } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index a931f759163..7995087f2c1 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -450,6 +450,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const if (!basePointsPerLevel && (_spellInfo->Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION && _spellInfo->SpellLevel) && Effect != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE && Effect != SPELL_EFFECT_KNOCK_BACK && + Effect != SPELL_EFFECT_ADD_EXTRA_ATTACKS && ApplyAuraName != SPELL_AURA_MOD_SPEED_ALWAYS && ApplyAuraName != SPELL_AURA_MOD_SPEED_NOT_STACK && ApplyAuraName != SPELL_AURA_MOD_INCREASE_SPEED && -- cgit v1.2.3 From a2848f543e1f265f712be0b5bdd20be557a29208 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 12 Jun 2012 08:53:21 -0400 Subject: Core/Spells: use calculated basepoints for mechanic_immunity_mask aura effect. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index efbaf76406c..849a7136ea8 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3377,7 +3377,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 case 96: case 1615: { - if (GetBaseAmount()) + if (GetAmount()) { mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) @@ -3486,7 +3486,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 } case 1630: { - if (!GetBaseAmount()) + if (!GetAmount()) { target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, apply); aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT); @@ -3524,7 +3524,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 case 477: case 1733: { - if (!GetBaseAmount()) + if (!GetAmount()) { mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN) @@ -3558,7 +3558,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 } case 878: { - if (GetBaseAmount() == 1) + if (GetAmount() == 1) { mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN) | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE); -- cgit v1.2.3 From c6c23b7f7ef148f88b64346a44a46f51d2cad212 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 12 Jun 2012 18:14:33 +0200 Subject: Core/DungeonFinder: - Prevent players from vote kicking in combat (basic implementation, still needs a timer) partially closes #2563 - Prevent players from teleporting to a finished dungeon using macro commands. Closes #6748 Also add a missing change for ff77610e1d3fee89507b8469b10bea800f8c0815 thanks 2010phenix for the hint. --- src/server/game/DungeonFinding/LFGMgr.cpp | 13 ++++++------- src/server/game/Entities/Player/Player.cpp | 8 ++++++-- src/server/game/Handlers/QuestHandler.cpp | 2 +- src/server/game/Server/Protocol/PacketLog.cpp | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 47c298d7467..f63d3172e52 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1626,6 +1626,7 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas { if (!grp) return; + uint64 gguid = grp->GetGUID(); SetState(gguid, LFG_STATE_BOOT); @@ -1635,7 +1636,6 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas pBoot->reason = reason; pBoot->victim = victim; pBoot->votedNeeded = GetVotesNeeded(gguid); - PlayerSet players; // Set votes for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) @@ -1651,15 +1651,11 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas else { pBoot->votes[guid] = LFG_ANSWER_PENDING; // Other members need to vote - players.insert(plrg); + plrg->GetSession()->SendLfgBootPlayer(pBoot); } } } - // Notify players - for (PlayerSet::const_iterator it = players.begin(); it != players.end(); ++it) - (*it)->GetSession()->SendLfgBootPlayer(pBoot); - m_Boots[grp->GetLowGUID()] = pBoot; } @@ -1770,6 +1766,9 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* uint64 gguid = grp->GetGUID(); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(gguid)); + if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) + error = LFG_TELEPORTERROR_INVALID_LOCATION; + if (!dungeon) error = LFG_TELEPORTERROR_INVALID_LOCATION; else if (player->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance @@ -1817,7 +1816,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (error == LFG_TELEPORTERROR_OK) { - if (!player->GetMap()->IsDungeon() && !player->GetMap()->IsRaid()) + if (!player->GetMap()->IsDungeon()) player->SetBattlegroundEntryPoint(); if (player->isInFlight()) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 53defc0c017..5dd3acfa13c 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23362,7 +23362,7 @@ Player* Player::GetNextRandomRaidMember(float radius) PartyResult Player::CanUninviteFromGroup() const { - const Group* grp = GetGroup(); + Group const* grp = GetGroup(); if (!grp) return ERR_NOT_IN_GROUP; @@ -23385,8 +23385,12 @@ PartyResult Player::CanUninviteFromGroup() const if (grp->isRollLootActive()) return ERR_PARTY_LFG_BOOT_LOOT_ROLLS; + // TODO: Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer. + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + if (itr->getSource() && itr->getSource()->isInCombat()) + return ERR_PARTY_LFG_BOOT_IN_COMBAT; + /* Missing support for these types - return ERR_PARTY_LFG_BOOT_IN_COMBAT; // also have a cooldown (some secs after combat finish return ERR_PARTY_LFG_BOOT_COOLDOWN_S; return ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S; */ diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index ca5a5c311c5..d13c2fb0956 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -343,7 +343,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) // Send next quest if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { - if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(quest, true)) + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) { _player->AddQuest(nextQuest, object); if (_player->CanCompleteQuest(nextQuest->GetQuestId())) diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp index a8e184c369a..cb6dcdbdb9e 100644 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -51,7 +51,7 @@ void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) ByteBuffer data(4+4+4+1+packet.size()); data << int32(packet.GetOpcode()); data << int32(packet.size()); - data << int32(time(NULL)); + data << uint32(time(NULL)); data << uint8(direction); for (uint32 i = 0; i < packet.size(); i++) -- cgit v1.2.3 From 76a2d132397ba859f99fc08034486ef63833d20d Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 12 Jun 2012 12:18:49 -0400 Subject: Core/Pets: more updates for pet calculations. feedback would be nice! (nothing is applied to anything yet so this will not reflect ingame atm) --- src/server/scripts/Spells/spell_pet.cpp | 210 +++++++++++++++++--------------- 1 file changed, 110 insertions(+), 100 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 5c1eb2f1ccd..0f16a340863 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -24,6 +24,9 @@ #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" +#include "Unit.h" +#include "Player.h" +#include "Pet.h" enum HunterPetCalculate { @@ -52,6 +55,7 @@ enum WarlockPetCalculate ENTRY_VOIDWALKER = 1860, ENTRY_FELHUNTER = 417, ENTRY_SUCCUBUS = 1863, + ENTRY_IMP = 416, }; enum DKPetCalculate @@ -60,6 +64,9 @@ enum DKPetCalculate SPELL_DEATH_KNIGHT_PET_SCALING_01 = 54566, SPELL_DEATH_KNIGHT_PET_SCALING_02 = 51996, SPELL_DEATH_KNIGHT_PET_SCALING_03 = 61697, + SPELL_NIGHT_OF_THE_DEAD = 55620, + ENTRY_ARMY_OF_THE_DEAD_GHOUL = 24207, + SPELL_DEATH_KNIGHT_GLYPH_OF_GHOUL = 58686, }; enum ShamanPetCalculate @@ -225,95 +232,111 @@ public: { if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) return false; - _tempHealth = 0; + _tempBonus = 0; return true; } void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float ownerBonus = 0.0f; - - ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75); + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75); - amount += ownerBonus; - } + amount += ownerBonus; + } } void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) - if (_tempHealth) - pet->SetHealth(_tempHealth); + if (_tempBonus) + { + PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel()); + uint32 healthMod = 0; + uint32 baseHealth = pInfo->health; + switch (pet->GetEntry()) + { + case ENTRY_IMP: + healthMod = uint32(_tempBonus * 8.4f); + break; + case ENTRY_VOIDWALKER: + healthMod = _tempBonus * 11; + break; + case ENTRY_SUCCUBUS: + healthMod = uint32(_tempBonus * 9.1f); + break; + case ENTRY_FELHUNTER: + healthMod = uint32(_tempBonus * 9.5f); + break; + case ENTRY_FELGUARD: + healthMod = _tempBonus * 11; + break; + default: + healthMod = 0; + break; + } + if (healthMod) + pet->ToPet()->SetCreateHealth(baseHealth + healthMod); + } } void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) - _tempHealth = pet->GetHealth(); + if (pet->isPet()) + { + PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel()); + pet->ToPet()->SetCreateHealth(pInfo->health); + } } void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; + if (pet->isPet()) - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE); - int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW); - int32 maximum = (fire > shadow) ? fire : shadow; - if (maximum < 0) - maximum = 0; - float bonusAP = maximum * 0.57f; + if (Unit* owner = pet->ToPet()->GetOwner()) + { + int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE); + int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW); + int32 maximum = (fire > shadow) ? fire : shadow; + if (maximum < 0) + maximum = 0; + float bonusAP = maximum * 0.57f; - amount += bonusAP; + amount += bonusAP; - // Glyph of felguard - if (pet->GetEntry() == ENTRY_FELGUARD) - { - if (AuraEffect* aurEffect = owner->GetAuraEffect(56246, EFFECT_0)) + // Glyph of felguard + if (pet->GetEntry() == ENTRY_FELGUARD) { - float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT); - amount += CalculatePctN(amount+base_attPower, aurEffect->GetAmount()); + if (AuraEffect* aurEffect = owner->GetAuraEffect(56246, EFFECT_0)) + { + float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT); + amount += CalculatePctN(amount+base_attPower, aurEffect->GetAmount()); + } } } - } } void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + //the damage bonus used for pets is either fire or shadow damage, whatever is higher + int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE); + int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW); + int32 maximum = (fire > shadow) ? fire : shadow; + float bonusDamage = 0.0f; - //the damage bonus used for pets is either fire or shadow damage, whatever is higher - int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE); - int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW); - int32 maximum = (fire > shadow) ? fire : shadow; - if (maximum < 0) - maximum = 0; - float bonusDamage = maximum * 0.15f; + if (maximum > 0) + bonusDamage = maximum * 0.15f; - amount += bonusDamage; - } + amount += bonusDamage; + } } void Register() @@ -326,7 +349,7 @@ public: } private: - uint32 _tempHealth; + uint32 _tempBonus; }; AuraScript* GetAuraScript() const @@ -355,20 +378,15 @@ public: void CalculateIntellectAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float ownerBonus = 0.0f; + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30); + ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30); - amount += ownerBonus; - } + amount += ownerBonus; + } } void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -1470,18 +1488,14 @@ public: { if (Unit* pet = GetUnitOwner()) { - Unit* owner = pet->GetOwner(); - if (!owner) - return; - - // Army of the dead ghoul - if (pet->GetEntry() == 24207) - amount = -90; - // Night of the dead - else if (owner->HasAura(55623)) - amount = -90; - else if (owner->HasAura(55620)) - amount = -45; + if (Unit* owner = pet->GetOwner()) + + // Army of the dead ghoul + if (pet->GetEntry() == ENTRY_ARMY_OF_THE_DEAD_GHOUL) + amount = -90; + // Night of the dead + else if ( Aura * aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD)) + amount = aur->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); } } @@ -1518,29 +1532,25 @@ public: { if (Unit* pet = GetUnitOwner()) { - if (!pet->isGuardian()) - return; - - Unit* owner = pet->GetOwner(); - if (!owner) - return; - - float mod = 0.3f; - - // Ravenous Dead - AuraEffect const* aurEff = NULL; - // Check just if owner has Ravenous Dead since it's effect is not an aura - aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); - if (aurEff) + if (pet->isGuardian()) { - mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale + if (Unit* owner = pet->GetOwner()) + { + float mod = 0.3f; + + // Ravenous Dead. Check just if owner has Ravenous Dead since it's effect is not an aura + if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0)) + { + mod += aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()/100; // Ravenous Dead edits the original scale + } + // Glyph of the Ghoul + if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_DEATH_KNIGHT_GLYPH_OF_GHOUL, 0)) + mod += aurEff->GetAmount()/100; + + float ownerBonus = float(owner->GetStat(STAT_STAMINA)) * mod; + amount += ownerBonus; + } } - // Glyph of the Ghoul - aurEff = owner->GetAuraEffect(58686, 0); - if (aurEff) - mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod - float ownerBonus = float(owner->GetStat(STAT_STAMINA)) * mod; - amount += ownerBonus; } } -- cgit v1.2.3 From b24c15740f59668160b7a7d98674ad3c9d709a55 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 12 Jun 2012 20:17:55 +0200 Subject: Build fix --- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Groups/Group.cpp | 14 -------------- src/server/game/Groups/Group.h | 8 +++++--- src/server/game/Groups/GroupRefManager.h | 3 ++- src/server/game/Groups/GroupReference.h | 1 + 5 files changed, 9 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 5dd3acfa13c..42d342cbcf9 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23386,7 +23386,7 @@ PartyResult Player::CanUninviteFromGroup() const return ERR_PARTY_LFG_BOOT_LOOT_ROLLS; // TODO: Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer. - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference const* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) if (itr->getSource() && itr->getSource()->isInCombat()) return ERR_PARTY_LFG_BOOT_IN_COMBAT; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 9a898dbfc4c..3a6390cd83a 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -2076,20 +2076,6 @@ bool Group::HasFreeSlotSubGroup(uint8 subgroup) const return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE); } -Group::MemberSlotList const& Group::GetMemberSlots() const -{ - return m_memberSlots; -} - -GroupReference* Group::GetFirstMember() -{ - return m_memberMgr.getFirst(); -} - -uint32 Group::GetMembersCount() const -{ - return m_memberSlots.size(); -} uint8 Group::GetMemberGroup(uint64 guid) const { diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 1f932567319..e5f174c4230 100755 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -230,9 +230,11 @@ class Group bool SameSubGroup(Player const* member1, Player const* member2) const; bool HasFreeSlotSubGroup(uint8 subgroup) const; - MemberSlotList const& GetMemberSlots() const; - GroupReference* GetFirstMember(); - uint32 GetMembersCount() const; + MemberSlotList const& GetMemberSlots() const { return m_memberSlots; } + GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); } + GroupReference const* GetFirstMember() const { return m_memberMgr.getFirst(); } + uint32 GetMembersCount() const { return m_memberSlots.size(); } + uint8 GetMemberGroup(uint64 guid) const; void ConvertToLFG(); diff --git a/src/server/game/Groups/GroupRefManager.h b/src/server/game/Groups/GroupRefManager.h index 9bcc05f8724..d9fef8611de 100755 --- a/src/server/game/Groups/GroupRefManager.h +++ b/src/server/game/Groups/GroupRefManager.h @@ -28,7 +28,8 @@ class GroupReference; class GroupRefManager : public RefManager { public: - GroupReference* getFirst() { return ((GroupReference*) RefManager::getFirst()); } + GroupReference* getFirst() { return ((GroupReference*)RefManager::getFirst()); } + GroupReference const* getFirst() const { return ((GroupReference const*)RefManager::getFirst()); } }; #endif diff --git a/src/server/game/Groups/GroupReference.h b/src/server/game/Groups/GroupReference.h index 2048fd9cb0d..7960dd21035 100755 --- a/src/server/game/Groups/GroupReference.h +++ b/src/server/game/Groups/GroupReference.h @@ -35,6 +35,7 @@ class GroupReference : public Reference GroupReference() : Reference(), iSubGroup(0) {} ~GroupReference() { unlink(); } GroupReference* next() { return (GroupReference*)Reference::next(); } + GroupReference const* next() const { return (GroupReference const*)Reference::next(); } uint8 getSubGroup() const { return iSubGroup; } void setSubGroup(uint8 pSubGroup) { iSubGroup = pSubGroup; } }; -- cgit v1.2.3 From 15eb5f07492490e2fd7a87345301f2fbcab252c7 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 12 Jun 2012 22:22:18 +0200 Subject: Core/SmartAI: Allow calling talk action on targeted creature even if scripted object itself is not a creature --- src/server/game/AI/SmartScripts/SmartScript.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index fb17237fdc5..1b414029366 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -160,9 +160,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { case SMART_ACTION_TALK: { - if (!me) - break; - ObjectList* targets = GetTargets(e, unit); Creature* talker = me; Player* targetPlayer = NULL; @@ -185,6 +182,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; } + if (!talker) + break; + mTalkerEntry = talker->GetEntry(); mLastTextID = e.action.talk.textGroupID; mTextTimer = e.action.talk.duration; -- cgit v1.2.3 From e8f4eb28f5f975f7f11b73a643c1b88500b2f0e4 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 12 Jun 2012 16:32:50 -0500 Subject: Core/DF: Add Dungeon Deserter debuff when leaving an incomplete DF match, and implemented Dungeon Cooldown for random dungeons --- src/server/game/DungeonFinding/LFGMgr.cpp | 11 ++++++++--- src/server/game/DungeonFinding/LFGScripts.cpp | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index f63d3172e52..5bd0780847b 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1417,6 +1417,10 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) waitTimesMap[(*it)->GetGUID()] = int32(joinTime - itQueue->second->joinTime); } + // Set the dungeon difficulty + LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId); + ASSERT(dungeon); + // Create a new group (if needed) LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND); Group* grp = pProposal->groupLowGuid ? sGroupMgr->GetGroupByGUID(pProposal->groupLowGuid) : NULL; @@ -1481,11 +1485,12 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) m_teleport.push_back(pguid); grp->SetLfgRoles(pguid, pProposal->players[pguid]->role); SetState(pguid, LFG_STATE_DUNGEON); + + // Add the cooldown spell if queued for a random dungeon + if (dungeon->type == LFG_TYPE_RANDOM) + player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false); } - // Set the dungeon difficulty - LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId); - ASSERT(dungeon); grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty)); uint64 gguid = grp->GetGUID(); SetDungeon(gguid, dungeon->Entry()); diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 6175addfae2..1fa7fe0ca9f 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -117,13 +117,14 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth return; } + uint32 state = sLFGMgr->GetState(gguid); sLFGMgr->ClearState(guid); sLFGMgr->SetState(guid, LFG_STATE_NONE); if (Player* player = ObjectAccessor::FindPlayer(guid)) { + if (method == GROUP_REMOVEMETHOD_LEAVE && state != LFG_STATE_FINISHED_DUNGEON && player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) + player->CastSpell(player, LFG_SPELL_DUNGEON_DESERTER, false); /* - if (method == GROUP_REMOVEMETHOD_LEAVE) - // Add deserter flag else if (group->isLfgKickActive()) // Update internal kick cooldown of kicked */ @@ -134,7 +135,7 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth sLFGMgr->TeleportPlayer(player, true); } - if (sLFGMgr->GetState(gguid) != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon + if (state != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon sLFGMgr->OfferContinue(group); } -- cgit v1.2.3 From 9cdf3fb4c03b856a808e4b202112ccce42652057 Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 13 Jun 2012 08:21:29 +0200 Subject: Core/DungeonFinder: - Corrections to c6c23b7f7ef148f88b64346a44a46f51d2cad212: Properly fixed #6748 after misunderstanding the issue. - Display proper error message when teleportating as fatigued --- src/server/game/DungeonFinding/LFGMgr.cpp | 33 +++++++++++++++++++------------ src/server/game/DungeonFinding/LFGMgr.h | 1 + src/server/game/Entities/Player/Player.h | 1 + 3 files changed, 22 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 5bd0780847b..a5ff89136b8 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1420,7 +1420,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) // Set the dungeon difficulty LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId); ASSERT(dungeon); - + // Create a new group (if needed) LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND); Group* grp = pProposal->groupLowGuid ? sGroupMgr->GetGroupByGUID(pProposal->groupLowGuid) : NULL; @@ -1431,6 +1431,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) Group* group = player->GetGroup(); if (sendUpdate) player->GetSession()->SendLfgUpdateProposal(proposalId, pProposal); + if (group) { player->GetSession()->SendLfgUpdateParty(updateData); @@ -1482,10 +1483,11 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) break; } } + m_teleport.push_back(pguid); grp->SetLfgRoles(pguid, pProposal->players[pguid]->role); SetState(pguid, LFG_STATE_DUNGEON); - + // Add the cooldown spell if queued for a random dungeon if (dungeon->type == LFG_TYPE_RANDOM) player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false); @@ -1749,14 +1751,7 @@ void LFGMgr::UpdateBoot(Player* player, 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"); - if (out) - { - player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); - player->TeleportToBGEntryPoint(); - return; - } - // TODO Add support for LFG_TELEPORTERROR_FATIGUE LfgTeleportError error = LFG_TELEPORTERROR_OK; Group* grp = player->GetGroup(); @@ -1766,13 +1761,25 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* error = LFG_TELEPORTERROR_PLAYER_DEAD; else if (player->IsFalling() || player->HasUnitState(UNIT_STATE_JUMPING)) error = LFG_TELEPORTERROR_FALLING; + else if (player->IsMirrorTimerActive(FATIGUE_TIMER)) + error = LFG_TELEPORTERROR_FATIGUE; else { - uint64 gguid = grp->GetGUID(); - LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(gguid)); + LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(grp->GetGUID())); - if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) - error = LFG_TELEPORTERROR_INVALID_LOCATION; + if (out) + { + // Player needs to be inside the LFG dungeon to be able to teleport out + if (dungeon && player->GetMapId() == uint32(dungeon->map)) + { + player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); + player->TeleportToBGEntryPoint(); + } + else + player->GetSession()->SendLfgTeleportError(LFG_TELEPORTERROR_DONT_REPORT); // Not sure which error message to send + + return; + } if (!dungeon) error = LFG_TELEPORTERROR_INVALID_LOCATION; diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index d10902b9553..f21818deb64 100755 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -68,6 +68,7 @@ enum LfgTeleportError LFG_TELEPORTERROR_OK = 0, // Internal use LFG_TELEPORTERROR_PLAYER_DEAD = 1, LFG_TELEPORTERROR_FALLING = 2, + LFG_TELEPORTERROR_DONT_REPORT = 3, LFG_TELEPORTERROR_FATIGUE = 4, LFG_TELEPORTERROR_INVALID_LOCATION = 6 }; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index ed887994bca..b0cbb5c7927 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1970,6 +1970,7 @@ class Player : public Unit, public GridObject StopMirrorTimer(BREATH_TIMER); StopMirrorTimer(FIRE_TIMER); } + bool IsMirrorTimerActive(MirrorTimerType type) { return m_MirrorTimer[type] == getMaxTimer(type); } void SetMovement(PlayerMovementType pType); -- cgit v1.2.3 From 5daa540d3ab5198e7c7ad678517d43c2baa15f50 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 13 Jun 2012 12:34:59 -0400 Subject: Core/Spells: handle SPELL_AURA_MOD_DEBUFF_RESISTANCE only for auras. fixes sacred cleansing causing the whole spell to be resisted. --- src/server/game/Entities/Unit/Unit.cpp | 6 +++--- src/server/game/Spells/Spell.cpp | 27 +++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a99356681e2..3305c4a9325 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2465,12 +2465,12 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) // Chance resist debuff if (!spell->IsPositive()) { - bool bNegativeAura = false; + bool bNegativeAura = true; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (spell->Effects[i].ApplyAuraName != 0) + if (spell->Effects[i].ApplyAuraName == 0) { - bNegativeAura = true; + bNegativeAura = false; break; } } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 58a89f75fd3..b51a3e8ee73 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2547,12 +2547,31 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA return SPELL_MISS_EVADE; // For delayed spells immunity may be applied between missile launch and hit - check immunity for that case + if (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo))) + return SPELL_MISS_IMMUNE; + // disable effects to which unit is immune + SpellMissInfo returnVal = SPELL_MISS_IMMUNE; for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) - if (effectMask & (1 << effectNumber) && unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber)) - effectMask &= ~(1 << effectNumber); - if (!effectMask || (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))) - return SPELL_MISS_IMMUNE; + { + if (effectMask & (1 << effectNumber)) + if (unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber)) + effectMask &= ~(1 << effectNumber); + else if (m_spellInfo->Effects[effectNumber].IsAura() && !m_spellInfo->IsPositiveEffect(effectNumber)) + { + int32 debuff_resist_chance = unit->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(m_spellInfo->Dispel)); + debuff_resist_chance += unit->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(m_spellInfo->Dispel)); + + if (debuff_resist_chance > 0) + if (irand(0,10000) <= (debuff_resist_chance * 100)) + { + effectMask &= ~(1 << effectNumber); + returnVal = SPELL_MISS_RESIST; + } + } + } + if (!effectMask) + return returnVal; PrepareScriptHitHandlers(); CallScriptBeforeHitHandlers(); -- cgit v1.2.3 From 50bd43661ca2e70a6f068ae8ba7c63e3ede646c0 Mon Sep 17 00:00:00 2001 From: click Date: Wed, 13 Jun 2012 18:38:21 +0200 Subject: Core: Remove a few silly warnings here and there (and adjust a comment to allow System.cpp to show properly in the nano-editor) --- src/server/game/AI/CoreAI/GameObjectAI.h | 2 +- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/tools/map_extractor/System.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index 21466f8c796..fbc8675cc47 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -54,7 +54,7 @@ class GameObjectAI virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {} virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {} - virtual void EventInform(uint32 eventId) {} + virtual void EventInform(uint32 /*eventId*/) {} }; class NullGameObjectAI : public GameObjectAI diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 07e9546173d..5b65d0ca763 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2691,7 +2691,7 @@ public: { PrepareSpellScript(spell_gen_touch_the_nightmare_SpellScript); - void HandleDamageCalc(SpellEffIndex effIndex) + void HandleDamageCalc(SpellEffIndex /*effIndex*/) { uint32 bp = GetCaster()->GetMaxHealth() * 0.3f; SetHitDamage(bp); diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 1505f2c2cee..d64276c6363 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -48,9 +48,9 @@ char output_path[128] = "."; char input_path[128] = "."; uint32 maxAreaId = 0; -//************************************************** +// ************************************************** // Extractor options -//************************************************** +// ************************************************** enum Extract { EXTRACT_MAP = 1, @@ -221,7 +221,7 @@ uint32 ReadMapDBC() map_ids[x].id = dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc.getRecord(x).getString(1)); } - printf("Done! (%u maps loaded)\n", map_count); + printf("Done! (%zu maps loaded)\n", map_count); return map_count; } @@ -246,7 +246,7 @@ void ReadAreaTableDBC() maxAreaId = dbc.getMaxId(); - printf("Done! (%u areas loaded)\n", area_count); + printf("Done! (%zu areas loaded)\n", area_count); } void ReadLiquidTypeTableDBC() @@ -267,7 +267,7 @@ void ReadLiquidTypeTableDBC() for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); - printf("Done! (%u LiqTypes loaded)\n", liqTypeCount); + printf("Done! (%zu LiqTypes loaded)\n", liqTypeCount); } // @@ -572,7 +572,7 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/, // Try store as packed in uint16 or uint8 values if (!(heightHeader.flags & MAP_HEIGHT_NO_HEIGHT)) { - float step; + float step = 0; // Try Store as uint values if (CONF_allow_float_to_int) { -- cgit v1.2.3 From 0ddaeaddc8d433908aa3ba3f3828507bed914fc1 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 13 Jun 2012 12:39:56 -0400 Subject: Core/Pets: more updates for pets and add spell_pet.cpp to the cmakelist file --- src/server/scripts/Spells/CMakeLists.txt | 1 + src/server/scripts/Spells/spell_pet.cpp | 194 +++++++++++++------------------ 2 files changed, 81 insertions(+), 114 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/CMakeLists.txt b/src/server/scripts/Spells/CMakeLists.txt index 04dcee9287c..2bb695bd8a9 100644 --- a/src/server/scripts/Spells/CMakeLists.txt +++ b/src/server/scripts/Spells/CMakeLists.txt @@ -24,6 +24,7 @@ set(scripts_STAT_SRCS Spells/spell_paladin.cpp Spells/spell_item.cpp Spells/spell_holiday.cpp + Spells/spell_pet.cpp ) message(" -> Prepared: Spells") diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 0f16a340863..6ed0f18c785 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -56,6 +56,7 @@ enum WarlockPetCalculate ENTRY_FELHUNTER = 417, ENTRY_SUCCUBUS = 1863, ENTRY_IMP = 416, + SPELL_WARLOCK_GLYPH_OF_VOIDWALKER = 56247, }; enum DKPetCalculate @@ -261,6 +262,7 @@ public: case ENTRY_IMP: healthMod = uint32(_tempBonus * 8.4f); break; + case ENTRY_FELGUARD: case ENTRY_VOIDWALKER: healthMod = _tempBonus * 11; break; @@ -270,9 +272,6 @@ public: case ENTRY_FELHUNTER: healthMod = uint32(_tempBonus * 9.5f); break; - case ENTRY_FELGUARD: - healthMod = _tempBonus * 11; - break; default: healthMod = 0; break; @@ -371,7 +370,7 @@ public: { if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER) return false; - _tempMana = 0; + _tempBonus = 0; return true; } @@ -386,58 +385,70 @@ public: ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30); amount += ownerBonus; + _tempBonus = ownerBonus; } } void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) - if (_tempMana) - pet->SetPower(POWER_MANA, _tempMana); + if (_tempBonus) + { + PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel()); + uint32 manaMod = 0; + uint32 baseMana = pInfo->mana; + switch (pet->GetEntry()) + { + case ENTRY_IMP: + manaMod = uint32(_tempBonus * 4.9f); + break; + case ENTRY_VOIDWALKER: + case ENTRY_SUCCUBUS: + case ENTRY_FELHUNTER: + case ENTRY_FELGUARD: + manaMod = uint32(_tempBonus * 11.5f); + break; + default: + manaMod = 0; + break; + } + if (manaMod) + pet->ToPet()->SetCreateMana(baseMana + manaMod); + } } void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) - _tempMana = pet->GetPower(POWER_MANA); + if (pet->isPet()) + { + PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel()); + pet->ToPet()->SetCreateMana(pInfo->mana); + } } void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float ownerBonus = 0.0f; - - ownerBonus = CalculatePctN(owner->GetArmor(), 35); - - amount += ownerBonus; - } + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float ownerBonus = 0.0f; + ownerBonus = CalculatePctN(owner->GetArmor(), 35); + amount += ownerBonus; + } } void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float ownerBonus = 0.0f; - - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40); - - amount += ownerBonus; - } + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float ownerBonus = 0.0f; + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40); + amount += ownerBonus; + } } void Register() @@ -450,7 +461,7 @@ public: } private: - uint32 _tempMana; + uint32 _tempBonus; }; AuraScript* GetAuraScript() const @@ -478,58 +489,37 @@ public: void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float ownerBonus = 0.0f; - - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40); - - amount += ownerBonus; - } + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float ownerBonus = 0.0f; + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40); + amount += ownerBonus; + } } void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float ownerBonus = 0.0f; - - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40); - - amount += ownerBonus; - } + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float ownerBonus = 0.0f; + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40); + amount += ownerBonus; + } } void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float ownerBonus = 0.0f; - - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40); - - amount += ownerBonus; - } + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float ownerBonus = 0.0f; + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40); + amount += ownerBonus; + } } void Register() @@ -566,20 +556,13 @@ public: void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float ownerBonus = 0.0f; - - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40); - - amount += ownerBonus; - } + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float ownerBonus = 0.0f; + ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40); + amount += ownerBonus; + } } void Register() @@ -612,8 +595,6 @@ public: void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -629,8 +610,6 @@ public: void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -646,8 +625,6 @@ public: void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -693,8 +670,6 @@ public: void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -717,8 +692,6 @@ public: void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -751,7 +724,7 @@ public: return new spell_warl_pet_passive_AuraScript(); } }; - +// this doesnt actually fit in here class spell_warl_pet_passive_damage_done : public SpellScriptLoader { public: @@ -822,17 +795,10 @@ public: void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - if (AuraEffect* aurEffect = owner->GetAuraEffect(56247, EFFECT_0)) - amount += aurEffect->GetAmount(); - } + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + if (AuraEffect* aurEffect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0)) + amount += aurEffect->GetAmount(); } void Register() -- cgit v1.2.3 From 62c64920f17dc08834098c383a8a8ba7044e4c8d Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 9 Jun 2012 00:14:55 +0200 Subject: Core/Spells: Fix Empowered Renew calculation --- .../world/2012_06_09_00_world_spell_bonus_data.sql | 3 ++ .../2012_06_09_00_world_spell_script_names.sql | 3 ++ src/server/game/Spells/Auras/SpellAuras.cpp | 13 ------- src/server/scripts/Spells/spell_priest.cpp | 45 ++++++++++++++++++++++ 4 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 sql/updates/world/2012_06_09_00_world_spell_bonus_data.sql create mode 100644 sql/updates/world/2012_06_09_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_09_00_world_spell_bonus_data.sql b/sql/updates/world/2012_06_09_00_world_spell_bonus_data.sql new file mode 100644 index 00000000000..aa9c1b732c4 --- /dev/null +++ b/sql/updates/world/2012_06_09_00_world_spell_bonus_data.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry`=63544; +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES +(63544,0,0,0,0,'Priest - Empowered Renew'); diff --git a/sql/updates/world/2012_06_09_00_world_spell_script_names.sql b/sql/updates/world/2012_06_09_00_world_spell_script_names.sql new file mode 100644 index 00000000000..a9faa529143 --- /dev/null +++ b/sql/updates/world/2012_06_09_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=-139; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(-139,'spell_priest_renew'); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 4dda1c731a7..9456a219274 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1221,19 +1221,6 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0)); } } - // Renew - else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000040 && GetEffect(0)) - { - // Empowered Renew - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1)) - { - uint32 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL); - damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, HEAL); - - int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; - caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); - } - } // Power Word: Shield else if (m_spellInfo->SpellFamilyFlags[0] & 0x1 && m_spellInfo->SpellFamilyFlags[2] & 0x400 && GetEffect(0)) { diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 8088004c9d1..cb9f2ad1753 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -34,6 +34,8 @@ enum PriestSpells PRIEST_SPELL_PENANCE_R1_HEAL = 47757, PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619, PRIEST_SPELL_REFLECTIVE_SHIELD_R1 = 33201, + PRIEST_SPELL_EMPOWERED_RENEW = 63544, + PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT = 3021, }; // Guardian Spirit @@ -330,6 +332,48 @@ public: } }; +class spell_priest_renew : public SpellScriptLoader +{ + public: + spell_priest_renew() : SpellScriptLoader("spell_priest_renew") { } + + class spell_priest_renew_AuraScript : public AuraScript + { + PrepareAuraScript(spell_priest_renew_AuraScript); + + bool Load() + { + return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleApplyEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + // Empowered Renew + if (AuraEffect const* empoweredRenewAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT, EFFECT_1)) + { + uint32 heal = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), GetEffect(EFFECT_0)->GetAmount(), DOT); + heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT); + + int32 basepoints0 = empoweredRenewAurEff->GetAmount() * GetEffect(EFFECT_0)->GetTotalTicks() * int32(heal) / 100; + caster->CastCustomSpell(GetTarget(), PRIEST_SPELL_EMPOWERED_RENEW, &basepoints0, NULL, NULL, true, NULL, aurEff); + } + } + } + + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_priest_renew_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_priest_renew_AuraScript(); + } +}; + void AddSC_priest_spell_scripts() { new spell_pri_guardian_spirit(); @@ -339,4 +383,5 @@ void AddSC_priest_spell_scripts() new spell_pri_reflective_shield_trigger(); new spell_pri_mind_sear(); new spell_pri_prayer_of_mending_heal(); + new spell_priest_renew(); } -- cgit v1.2.3 From 63dd6251540eb3e392d8789f92035b021fb773e2 Mon Sep 17 00:00:00 2001 From: "dr.skull" Date: Thu, 14 Jun 2012 00:39:09 +0200 Subject: Fix wrong magnet aura takeCharges when spell hit not magnet unit This will fix issue 3151 second problem Signed-off-by: dr.skull --- src/server/game/Entities/Unit/Unit.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3305c4a9325..daa8c1e05de 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14525,6 +14525,11 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u if (procSpell && (triggeredByAura->GetMiscValue() & procSpell->SchoolMask)) // School check takeCharges = true; break; + case SPELL_AURA_SPELL_MAGNET: + // Skip Melee hits and targets with magnet aura + if (procSpell && (triggeredByAura->GetBase()->GetUnitOwner()->ToUnit() == ToUnit())) // Magnet + takeCharges = true; + break; case SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT: case SPELL_AURA_MOD_POWER_COST_SCHOOL: // Skip melee hits and spells ws wrong school or zero cost -- cgit v1.2.3 From 0e8889415d0c28b23666ee3329deed2b94ce3b3e Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 14 Jun 2012 17:33:46 +0200 Subject: Core/Chat: Convert instance commands in commandscript --- src/server/game/Chat/Chat.cpp | 10 -- src/server/game/Chat/Chat.h | 5 - src/server/game/Chat/Commands/Level3.cpp | 126 ------------------ src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Commands/CMakeLists.txt | 2 +- src/server/scripts/Commands/cs_instance.cpp | 193 ++++++++++++++++++++++++++++ 6 files changed, 196 insertions(+), 142 deletions(-) create mode 100644 src/server/scripts/Commands/cs_instance.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index cc64a8e22dd..72011a339f8 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -156,15 +156,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand instanceCommandTable[] = - { - { "listbinds", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleInstanceListBindsCommand>, "", NULL }, - { "unbind", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleInstanceUnbindCommand>, "", NULL }, - { "stats", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleInstanceStatsCommand>, "", NULL }, - { "savedata", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleInstanceSaveDataCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand listCommandTable[] = { { "creature", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListCreatureCommand>, "", NULL }, @@ -339,7 +330,6 @@ ChatCommand* ChatHandler::getCommandTable() { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable }, { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, - { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index e88914a2daf..0a5cd9391f6 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -180,11 +180,6 @@ class ChatHandler bool HandleGuildRankCommand(const char* args); bool HandleGuildDeleteCommand(const char* args); - bool HandleInstanceListBindsCommand(const char* args); - bool HandleInstanceUnbindCommand(const char* args); - bool HandleInstanceStatsCommand(const char* args); - bool HandleInstanceSaveDataCommand(const char * args); - bool HandleListAurasCommand(const char * args); bool HandleListCreatureCommand(const char* args); bool HandleListItemCommand(const char* args); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 4b2f1c5e7bb..4decc7a523f 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -4096,132 +4096,6 @@ bool ChatHandler::HandleCastSelfCommand(const char *args) return true; } -std::string GetTimeString(uint64 time) -{ - uint64 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE; - std::ostringstream ss; - if (days) ss << days << "d "; - if (hours) ss << hours << "h "; - ss << minute << 'm'; - return ss.str(); -} - -bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) -{ - Player* player = getSelectedPlayer(); - if (!player) player = m_session->GetPlayer(); - uint32 counter = 0; - for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) - { - Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); - for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) - { - InstanceSave* save = itr->second.save; - std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); - PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); - counter++; - } - } - PSendSysMessage("player binds: %d", counter); - counter = 0; - Group* group = player->GetGroup(); - if (group) - { - for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) - { - Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i)); - for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) - { - InstanceSave* save = itr->second.save; - std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); - PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); - counter++; - } - } - } - PSendSysMessage("group binds: %d", counter); - - return true; -} - -bool ChatHandler::HandleInstanceUnbindCommand(const char *args) -{ - if (!*args) - return false; - - Player* player = getSelectedPlayer(); - if (!player) - player = m_session->GetPlayer(); - - char* map = strtok((char*)args, " "); - char* pDiff = strtok(NULL, " "); - int8 diff = -1; - if (pDiff) - diff = atoi(pDiff); - uint16 counter = 0; - uint16 MapId = 0; - - if (strcmp(map, "all")) - { - MapId = uint16(atoi(map)); - if (!MapId) - return false; - } - - for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) - { - Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); - for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) - { - InstanceSave* save = itr->second.save; - if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty())) - { - std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); - PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); - player->UnbindInstance(itr, Difficulty(i)); - counter++; - } - else - ++itr; - } - } - PSendSysMessage("instances unbound: %d", counter); - return true; -} - -bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/) -{ - PSendSysMessage("instances loaded: %d", sMapMgr->GetNumInstances()); - PSendSysMessage("players in instances: %d", sMapMgr->GetNumPlayersInInstances()); - PSendSysMessage("instance saves: %d", sInstanceSaveMgr->GetNumInstanceSaves()); - PSendSysMessage("players bound: %d", sInstanceSaveMgr->GetNumBoundPlayersTotal()); - PSendSysMessage("groups bound: %d", sInstanceSaveMgr->GetNumBoundGroupsTotal()); - return true; -} - -bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/) -{ - Player* player = m_session->GetPlayer(); - - Map* map = player->GetMap(); - if (!map->IsDungeon()) - { - PSendSysMessage("Map is not a dungeon."); - SetSentErrorMessage(true); - return false; - } - - if (!((InstanceMap*)map)->GetInstanceScript()) - { - PSendSysMessage("Map has no instance data."); - SetSentErrorMessage(true); - return false; - } - - ((InstanceMap*)map)->GetInstanceScript()->SaveToDB(); - return true; -} - /// Define the 'Message of the day' for the realm bool ChatHandler::HandleServerSetMotdCommand(const char *args) { diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index f64d0953e86..a1a23ca7074 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -52,6 +52,7 @@ void AddSC_gm_commandscript(); void AddSC_go_commandscript(); void AddSC_gobject_commandscript(); void AddSC_honor_commandscript(); +void AddSC_instance_commandscript(); void AddSC_learn_commandscript(); void AddSC_misc_commandscript(); void AddSC_modify_commandscript(); @@ -654,6 +655,7 @@ void AddCommandScripts() AddSC_go_commandscript(); AddSC_gobject_commandscript(); AddSC_honor_commandscript(); + AddSC_instance_commandscript(); AddSC_learn_commandscript(); AddSC_misc_commandscript(); AddSC_modify_commandscript(); diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 86fe984e197..867d54a3cc6 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -18,6 +18,7 @@ set(scripts_STAT_SRCS Commands/cs_go.cpp Commands/cs_gobject.cpp Commands/cs_honor.cpp + Commands/cs_instance.cpp Commands/cs_learn.cpp Commands/cs_misc.cpp Commands/cs_modify.cpp @@ -34,7 +35,6 @@ set(scripts_STAT_SRCS # Commands/cs_guild.cpp # Commands/cs_cast.cpp # Commands/cs_reset.cpp -# Commands/cs_instance.cpp # Commands/cs_server.cpp # Commands/cs_channel.cpp # Commands/cs_pet.cpp diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp new file mode 100644 index 00000000000..127a3848ebc --- /dev/null +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: instance_commandscript +%Complete: 100 +Comment: All instance related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "Group.h" +#include "InstanceSaveMgr.h" +#include "InstanceScript.h" +#include "MapManager.h" + +class instance_commandscript : public CommandScript +{ +public: + instance_commandscript() : CommandScript("instance_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand instanceCommandTable[] = + { + { "listbinds", SEC_ADMINISTRATOR, false, &HandleInstanceListBindsCommand, "", NULL }, + { "unbind", SEC_ADMINISTRATOR, false, &HandleInstanceUnbindCommand, "", NULL }, + { "stats", SEC_ADMINISTRATOR, true, &HandleInstanceStatsCommand, "", NULL }, + { "savedata", SEC_ADMINISTRATOR, false, &HandleInstanceSaveDataCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand commandTable[] = + { + { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + + return commandTable; + } + + static std::string GetTimeString(uint64 time) + { + uint64 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE; + std::ostringstream ss; + if (days) + ss << days << "d "; + if (hours) + ss << hours << "h "; + ss << minute << 'm'; + return ss.str(); + } + + static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* args) + { + Player* player = handler->getSelectedPlayer(); + if (!player) + player = handler->GetSession()->GetPlayer(); + + uint32 counter = 0; + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); + for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) + { + InstanceSave* save = itr->second.save; + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + counter++; + } + } + handler->PSendSysMessage("player binds: %d", counter); + + counter = 0; + if (Group* group = player->GetGroup()) + { + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i)); + for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) + { + InstanceSave* save = itr->second.save; + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + counter++; + } + } + } + handler->PSendSysMessage("group binds: %d", counter); + + return true; + } + + static bool HandleInstanceUnbindCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->getSelectedPlayer(); + if (!player) + player = handler->GetSession()->GetPlayer(); + + char* map = strtok((char*)args, " "); + char* pDiff = strtok(NULL, " "); + int8 diff = -1; + if (pDiff) + diff = atoi(pDiff); + uint16 counter = 0; + uint16 MapId = 0; + + if (strcmp(map, "all")) + { + MapId = uint16(atoi(map)); + if (!MapId) + return false; + } + + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); + for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) + { + InstanceSave* save = itr->second.save; + if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty())) + { + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + handler->PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + player->UnbindInstance(itr, Difficulty(i)); + counter++; + } + else + ++itr; + } + } + handler->PSendSysMessage("instances unbound: %d", counter); + + return true; + } + + static bool HandleInstanceStatsCommand(ChatHandler* handler, char const* /*args*/) + { + handler->PSendSysMessage("instances loaded: %d", sMapMgr->GetNumInstances()); + handler->PSendSysMessage("players in instances: %d", sMapMgr->GetNumPlayersInInstances()); + handler->PSendSysMessage("instance saves: %d", sInstanceSaveMgr->GetNumInstanceSaves()); + handler->PSendSysMessage("players bound: %d", sInstanceSaveMgr->GetNumBoundPlayersTotal()); + handler->PSendSysMessage("groups bound: %d", sInstanceSaveMgr->GetNumBoundGroupsTotal()); + + return true; + } + + static bool HandleInstanceSaveDataCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + Map* map = player->GetMap(); + if (!map->IsDungeon()) + { + handler->PSendSysMessage("Map is not a dungeon."); + handler->SetSentErrorMessage(true); + return false; + } + + if (!((InstanceMap*)map)->GetInstanceScript()) + { + handler->PSendSysMessage("Map has no instance data."); + handler->SetSentErrorMessage(true); + return false; + } + + ((InstanceMap*)map)->GetInstanceScript()->SaveToDB(); + + return true; + } +}; + +void AddSC_instance_commandscript() +{ + new instance_commandscript(); +} -- cgit v1.2.3 From c6dd149f1bbbdb66fdbe50515c5901da1d37d274 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 14 Jun 2012 21:11:37 +0200 Subject: Core/Spells: Fix Curse of Doom (thx to Warpten / joschiwald for helping) --- .../2012_06_14_09_world_spell_script_names.sql | 3 ++ src/server/game/Spells/Auras/SpellAuras.cpp | 11 +---- src/server/scripts/Spells/spell_warlock.cpp | 48 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 sql/updates/world/2012_06_14_09_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_14_09_world_spell_script_names.sql b/sql/updates/world/2012_06_14_09_world_spell_script_names.sql new file mode 100644 index 00000000000..f14e44e35ff --- /dev/null +++ b/sql/updates/world/2012_06_14_09_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=-603; +INSERT INTO `spell_script_names` (`spell_id` ,`ScriptName`) VALUES +(-603,'spell_warl_curse_of_doom'); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 9456a219274..a1ac69826c4 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1373,17 +1373,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case SPELLFAMILY_WARLOCK: if (!caster) break; - // Curse of Doom - if (GetSpellInfo()->SpellFamilyFlags[1] & 0x02) - { - if (removeMode == AURA_REMOVE_BY_DEATH) - { - if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target)) - caster->CastSpell(target, 18662, true, NULL, GetEffect(0)); - } - } // Improved Fear - else if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400) + if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400) { if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_WARLOCK, 98, 0)) { diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 1b24a9ec09f..be10efc8eae 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -39,6 +39,7 @@ enum WarlockSpells WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388, WARLOCK_HAUNT_HEAL = 48210, WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117, + WARLOCK_CURSE_OF_DOOM_EFFECT = 18662, }; class spell_warl_banish : public SpellScriptLoader @@ -625,6 +626,52 @@ class spell_warl_unstable_affliction : public SpellScriptLoader } }; +class spell_warl_curse_of_doom : public SpellScriptLoader +{ + public: + spell_warl_curse_of_doom() : SpellScriptLoader("spell_warl_curse_of_doom") { } + + class spell_warl_curse_of_doom_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_curse_of_doom_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(WARLOCK_CURSE_OF_DOOM_EFFECT)) + return false; + return true; + } + + bool Load() + { + return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (!GetCaster()) + return; + + AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode(); + if (removeMode != AURA_REMOVE_BY_DEATH || !IsExpired()) + return; + + if (GetCaster()->ToPlayer()->isHonorOrXPTarget(GetTarget())) + GetCaster()->CastSpell(GetTarget(), WARLOCK_CURSE_OF_DOOM_EFFECT, true, NULL, aurEff); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_warl_curse_of_doom_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_curse_of_doom_AuraScript(); + } +}; + void AddSC_warlock_spell_scripts() { new spell_warl_banish(); @@ -639,4 +686,5 @@ void AddSC_warlock_spell_scripts() new spell_warl_demonic_circle_teleport(); new spell_warl_haunt(); new spell_warl_unstable_affliction(); + new spell_warl_curse_of_doom(); } -- cgit v1.2.3 From d77a8568b7df8e1e7131f81c0c67487384232047 Mon Sep 17 00:00:00 2001 From: Faq Date: Thu, 14 Jun 2012 22:36:56 +0300 Subject: Fixing Death Knight T8 Melee 4P Bonus (darkruned set). tibbi --- src/server/game/Spells/SpellEffects.cpp | 19 ++++++++++++++++--- src/server/scripts/Spells/spell_dk.cpp | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index e08c7dc6d55..b4a1ba19a08 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3388,7 +3388,11 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Blood Strike if (m_spellInfo->SpellFamilyFlags[0] & 0x400000) { - AddPctF(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f); + float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f; + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) + AddPctF(bonusPct, aurEff->GetAmount()); + AddPctF(totalDamagePercentMod, bonusPct); // Glyph of Blood Strike if (m_caster->GetAuraEffect(59332, EFFECT_0)) @@ -3415,7 +3419,11 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) if (roll_chance_i(aurEff->GetAmount())) consumeDiseases = false; - AddPctF(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f); + float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f; + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) + AddPctF(bonusPct, aurEff->GetAmount()); + AddPctF(totalDamagePercentMod, bonusPct); break; } // Blood-Caked Strike - Blood-Caked Blade @@ -3427,7 +3435,12 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Heart Strike if (m_spellInfo->SpellFamilyFlags[0] & 0x1000000) { - AddPctN(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID())); + float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()); + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) + AddPctF(bonusPct, aurEff->GetAmount()); + + AddPctF(totalDamagePercentMod, bonusPct); break; } break; diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 118097a38cb..defca2b8d33 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -400,7 +400,12 @@ class spell_dk_scourge_strike : public SpellScriptLoader { Unit* caster = GetCaster(); if (Unit* unitTarget = GetHitUnit()) + { multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f); + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = caster->GetAuraEffect(64736, EFFECT_0)) + AddPctF(multiplier, aurEff->GetAmount()); + } } void HandleAfterHit() -- cgit v1.2.3 From ac7485341554d09cf7740b9a2b5a9cf43674710b Mon Sep 17 00:00:00 2001 From: Faq Date: Fri, 15 Jun 2012 01:21:02 +0300 Subject: Adding enums --- src/server/scripts/Spells/spell_dk.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index defca2b8d33..9051d9510f9 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -40,6 +40,8 @@ enum DeathKnightSpells DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, DK_SPELL_UNHOLY_PRESENCE = 48265, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622, + DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, + SPELL_DK_ITEM_T8_MALEE_4P_BONUS = 64736, }; // 50462 - Anti-Magic Shell (on raid member) @@ -403,7 +405,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader { multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f); // Death Knight T8 Melee 4P Bonus - if (AuraEffect const* aurEff = caster->GetAuraEffect(64736, EFFECT_0)) + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MALEE_4P_BONUS, EFFECT_0)) AddPctF(multiplier, aurEff->GetAmount()); } } @@ -608,7 +610,7 @@ public: if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) { int32 basePoints1 = aurEff->GetAmount(); - target->CastCustomSpell(target, 63611, NULL, &basePoints1, NULL, true, 0, aurEff); + target->CastCustomSpell(target, DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, 0, aurEff); } } -- cgit v1.2.3 From 67a0e54bb9afc4ddcd4c6c4e47c57cb5079b62af Mon Sep 17 00:00:00 2001 From: Faq Date: Fri, 15 Jun 2012 01:29:52 +0300 Subject: Correct the amount of dmg absorbed by Anti-magic shell.tibbi --- src/server/scripts/Spells/spell_dk.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 9051d9510f9..2a414c7c094 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -113,8 +113,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) { - // Set absorbtion amount to unlimited - amount = -1; + amount = GetCaster()->CountPctFromMaxHealth(hpPct); } void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) -- cgit v1.2.3 From 478de6298e4c2b1f1239cd545113b61127cf02d3 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 15 Jun 2012 15:19:31 +0200 Subject: Scripts/Icecrown Citadel: Fixed Sindragosa & her frost wyrms summoning - this time properly using constant db data (turns out creatures receive a new GUID when grid reloads in instance) --- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 44 +++++++----- .../IcecrownCitadel/instance_icecrown_citadel.cpp | 84 +++++----------------- 2 files changed, 46 insertions(+), 82 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 9baf6ba7a00..fdc9a6a21d6 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -200,7 +200,7 @@ class boss_sindragosa : public CreatureScript struct boss_sindragosaAI : public BossAI { - boss_sindragosaAI(Creature* creature) : BossAI(creature, DATA_SINDRAGOSA) + boss_sindragosaAI(Creature* creature) : BossAI(creature, DATA_SINDRAGOSA), _summoned(false) { } @@ -220,7 +220,7 @@ class boss_sindragosa : public CreatureScript _isInAirPhase = false; _isThirdPhase = false; - if (instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) != 255) + if (!_summoned) { me->SetCanFly(true); me->SetDisableGravity(true); @@ -266,10 +266,13 @@ class boss_sindragosa : public CreatureScript { if (action == ACTION_START_FROSTWYRM) { + if (_summoned) + return; + + _summoned = true; if (TempSummon* summon = me->ToTempSummon()) summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN); - instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 255); if (me->isDead()) return; @@ -550,6 +553,7 @@ class boss_sindragosa : public CreatureScript uint8 _mysticBuffetStack; bool _isInAirPhase; bool _isThirdPhase; + bool _summoned; }; CreatureAI* GetAI(Creature* creature) const @@ -642,7 +646,7 @@ class npc_spinestalker : public CreatureScript struct npc_spinestalkerAI : public ScriptedAI { - npc_spinestalkerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + npc_spinestalkerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false) { } @@ -651,7 +655,7 @@ class npc_spinestalker : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -664,7 +668,7 @@ class npc_spinestalker : public CreatureScript _events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(8000, 12000)); me->SetReactState(REACT_DEFENSIVE); - if (_instance->GetData(DATA_SPINESTALKER) != 255) + if (!_summoned) { me->SetCanFly(true); me->SetDisableGravity(true); @@ -674,7 +678,7 @@ class npc_spinestalker : public CreatureScript void JustRespawned() { ScriptedAI::JustRespawned(); - _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) @@ -686,7 +690,10 @@ class npc_spinestalker : public CreatureScript { if (action == ACTION_START_FROSTWYRM) { - _instance->SetData(DATA_SPINESTALKER, 255); + if (_summoned) + return; + + _summoned = true; if (me->isDead()) return; @@ -753,6 +760,7 @@ class npc_spinestalker : public CreatureScript private: EventMap _events; InstanceScript* _instance; + bool _summoned; }; CreatureAI* GetAI(Creature* creature) const @@ -768,7 +776,7 @@ class npc_rimefang : public CreatureScript struct npc_rimefangAI : public ScriptedAI { - npc_rimefangAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + npc_rimefangAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false) { } @@ -777,7 +785,7 @@ class npc_rimefang : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -790,7 +798,7 @@ class npc_rimefang : public CreatureScript me->SetReactState(REACT_DEFENSIVE); _icyBlastCounter = 0; - if (_instance->GetData(DATA_RIMEFANG) != 255) + if (!_summoned) { me->SetCanFly(true); me->SetDisableGravity(true); @@ -800,7 +808,7 @@ class npc_rimefang : public CreatureScript void JustRespawned() { ScriptedAI::JustRespawned(); - _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) @@ -812,7 +820,10 @@ class npc_rimefang : public CreatureScript { if (action == ACTION_START_FROSTWYRM) { - _instance->SetData(DATA_RIMEFANG, 255); + if (_summoned) + return; + + _summoned = true; if (me->isDead()) return; @@ -906,6 +917,7 @@ class npc_rimefang : public CreatureScript EventMap _events; InstanceScript* _instance; uint8 _icyBlastCounter; + bool _summoned; }; CreatureAI* GetAI(Creature* creature) const @@ -933,7 +945,7 @@ class npc_sindragosa_trash : public CreatureScript if (!me->isDead()) { if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetData64(_frostwyrmId, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -956,7 +968,7 @@ class npc_sindragosa_trash : public CreatureScript // Increase add count if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetData64(_frostwyrmId, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade } void SetData(uint32 type, uint32 data) @@ -1503,7 +1515,7 @@ class at_sindragosa_lair : public AreaTriggerScript if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_RIMEFANG))) rimefang->AI()->DoAction(ACTION_START_FROSTWYRM); - if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && instance->GetBossState(DATA_SINDRAGOSA) != DONE) + if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetData64(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE) { if (player->GetMap()->IsHeroic() && !instance->GetData(DATA_HEROIC_ATTEMPTS)) return true; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 288fde28c38..704c3c2b0c2 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -89,13 +89,6 @@ WeeklyQuest const WeeklyQuestData[WeeklyNPCs] = {NPC_VALITHRIA_DREAMWALKER_QUEST, {QUEST_RESPITE_FOR_A_TORNMENTED_SOUL_10, QUEST_RESPITE_FOR_A_TORNMENTED_SOUL_25}}, // Respite for a Tormented Soul }; -enum FrostwyrmFlags -{ - FLAG_SPINESTALKER_SUMMONED = 0x01, - FLAG_RIMEFANG_SUMMONED = 0x02, - FLAG_SINDRAGOSA_SUMMONED = 0x04, -}; - class instance_icecrown_citadel : public InstanceMapScript { public: @@ -152,7 +145,6 @@ class instance_icecrown_citadel : public InstanceMapScript ColdflameJetsState = NOT_STARTED; BloodQuickeningState = NOT_STARTED; BloodQuickeningMinutes = 0; - FrostwyrmFlags = 0; } void FillInitialWorldStates(WorldPacket& data) @@ -284,13 +276,9 @@ class instance_icecrown_citadel : public InstanceMapScript break; case NPC_SPINESTALKER: SpinestalkerGUID = creature->GetGUID(); - if (!creature->isAlive()) - FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; break; case NPC_RIMEFANG: RimefangGUID = creature->GetGUID(); - if (!creature->isAlive()) - FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; break; case NPC_THE_LICH_KING: TheLichKingGUID = creature->GetGUID(); @@ -307,6 +295,12 @@ class instance_icecrown_citadel : public InstanceMapScript } } + void OnCreatureRemove(Creature* creature) + { + if (creature->GetEntry() == NPC_SINDRAGOSA) + SindragosaGUID = 0; + } + // Weekly quest spawn prevention uint32 GetCreatureEntry(uint32 /*guidLow*/, CreatureData const* data) { @@ -357,49 +351,36 @@ class instance_icecrown_citadel : public InstanceMapScript crok->AI()->SetGUID(creature->GetGUID(), ACTION_VRYKUL_DEATH); break; case NPC_FROSTWING_WHELP: + if (FrostwyrmGUIDs.empty()) + return; + if (creature->AI()->GetData(1/*DATA_FROSTWYRM_OWNER*/) == DATA_SPINESTALKER) { - if (FrostwyrmFlags & FLAG_SPINESTALKER_SUMMONED) - return; - - SpinestalkerTrash.erase(creature->GetGUID()); + SpinestalkerTrash.erase(creature->GetDBTableGUIDLow()); if (SpinestalkerTrash.empty()) - { - FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; if (Creature* spinestalk = instance->GetCreature(SpinestalkerGUID)) spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM); - } } else { - if (FrostwyrmFlags & FLAG_RIMEFANG_SUMMONED) - return; - - RimefangTrash.erase(creature->GetGUID()); + RimefangTrash.erase(creature->GetDBTableGUIDLow()); if (RimefangTrash.empty()) - { - FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; if (Creature* spinestalk = instance->GetCreature(RimefangGUID)) spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM); - } } break; case NPC_RIMEFANG: case NPC_SPINESTALKER: { - if (FrostwyrmFlags & FLAG_SINDRAGOSA_SUMMONED) - return; - if (instance->IsHeroic() && !HeroicAttempts) return; if (GetBossState(DATA_SINDRAGOSA) == DONE) return; - FrostwyrmGUIDs.erase(creature->GetGUID()); + FrostwyrmGUIDs.erase(creature->GetDBTableGUIDLow()); if (FrostwyrmGUIDs.empty()) { - FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; instance->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY()); if (Creature* boss = instance->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos)) boss->AI()->DoAction(ACTION_START_FROSTWYRM); @@ -597,16 +578,10 @@ class instance_icecrown_citadel : public InstanceMapScript switch (type) { case DATA_SINDRAGOSA_FROSTWYRMS: - if (FrostwyrmFlags & FLAG_SINDRAGOSA_SUMMONED) - return 255; return FrostwyrmGUIDs.size(); case DATA_SPINESTALKER: - if (FrostwyrmFlags & FLAG_SPINESTALKER_SUMMONED) - return 255; return SpinestalkerTrash.size(); case DATA_RIMEFANG: - if (FrostwyrmFlags & FLAG_RIMEFANG_SUMMONED) - return 255; return RimefangTrash.size(); case DATA_COLDFLAME_JETS: return ColdflameJetsState; @@ -806,9 +781,6 @@ class instance_icecrown_citadel : public InstanceMapScript sindra->DespawnOrUnsummon(); } } - // Reached when loading from DB - if (state == DONE) - FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; break; case DATA_THE_LICH_KING: { @@ -866,16 +838,13 @@ class instance_icecrown_citadel : public InstanceMapScript IsOrbWhispererEligible = data ? true : false; break; case DATA_SINDRAGOSA_FROSTWYRMS: - if (data == 255) - FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; + FrostwyrmGUIDs.insert(data); break; case DATA_SPINESTALKER: - if (data == 255) - FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; + SpinestalkerTrash.insert(data); break; case DATA_RIMEFANG: - if (data == 255) - FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; + RimefangTrash.insert(data); break; case DATA_COLDFLAME_JETS: ColdflameJetsState = data; @@ -918,22 +887,6 @@ class instance_icecrown_citadel : public InstanceMapScript } } - void SetData64(uint32 id, uint64 data) - { - switch (id) - { - case DATA_SINDRAGOSA_FROSTWYRMS: - FrostwyrmGUIDs.insert(data); - break; - case DATA_SPINESTALKER: - SpinestalkerTrash.insert(data); - break; - case DATA_RIMEFANG: - RimefangTrash.insert(data); - break; - } - } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) { switch (criteria_id) @@ -1301,13 +1254,12 @@ class instance_icecrown_citadel : public InstanceMapScript uint64 PillarsUnchainedGUID; uint32 TeamInInstance; uint32 ColdflameJetsState; - std::set FrostwyrmGUIDs; - std::set SpinestalkerTrash; - std::set RimefangTrash; + std::set FrostwyrmGUIDs; + std::set SpinestalkerTrash; + std::set RimefangTrash; uint32 BloodQuickeningState; uint32 HeroicAttempts; uint16 BloodQuickeningMinutes; - uint16 FrostwyrmFlags; bool IsBonedEligible; bool IsOozeDanceEligible; bool IsNauseaEligible; -- cgit v1.2.3 From 6bd8a01aa5474b55dc8681e224d31b16a43a87bc Mon Sep 17 00:00:00 2001 From: Faq Date: Fri, 15 Jun 2012 17:21:34 +0300 Subject: ... --- src/server/scripts/Spells/spell_dk.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 2a414c7c094..38901287e0d 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -40,7 +40,6 @@ enum DeathKnightSpells DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, DK_SPELL_UNHOLY_PRESENCE = 48265, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622, - DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, SPELL_DK_ITEM_T8_MALEE_4P_BONUS = 64736, }; -- cgit v1.2.3 From 9d19be2ee5be7cf46ea3eb6b197647737266c69e Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 14 Jun 2012 17:07:05 -0400 Subject: Core/Spells: fix spell scripts from recent commit and cleanup scripts --- .../Ulduar/HallsOfLightning/boss_loken.cpp | 4 +- src/server/scripts/Spells/spell_druid.cpp | 65 +------- src/server/scripts/Spells/spell_generic.cpp | 29 +--- src/server/scripts/Spells/spell_paladin.cpp | 11 +- src/server/scripts/Spells/spell_pet.cpp | 178 ++++++++++----------- src/server/scripts/Spells/spell_priest.cpp | 4 - src/server/scripts/Spells/spell_shaman.cpp | 10 +- src/server/scripts/Spells/spell_warlock.cpp | 15 +- 8 files changed, 110 insertions(+), 206 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index bdaaa002b3f..f42fd87c643 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -193,7 +193,7 @@ class spell_loken_pulsing_shockwave : public SpellScriptLoader { PrepareSpellScript(spell_loken_pulsing_shockwave_SpellScript); - void CalculateDamage() + void CalculateDamage(SpellEffIndex /*effIndex*/) { if (!GetHitUnit()) return; @@ -205,7 +205,7 @@ class spell_loken_pulsing_shockwave : public SpellScriptLoader void Register() { - OnHit += SpellHitFn(spell_loken_pulsing_shockwave_SpellScript::CalculateDamage); + OnEffectHitTarget += SpellEffectFn(spell_loken_pulsing_shockwave_SpellScript::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 9dedeaf5bd7..b817036a9e4 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -332,26 +332,6 @@ class spell_dru_swift_flight_passive : public SpellScriptLoader } }; -class StarfallDummyTargetFilter -{ - public: - StarfallDummyTargetFilter(Unit* caster) : _caster(caster) { } - - bool operator()(Unit* target) const - { - if (target->HasStealthAura() || target->HasInvisibilityAura()) - return true; - - if (!target->IsWithinLOSInMap(_caster)) - return true; - - return false; - } - - private: - Unit* _caster; -}; - class spell_dru_starfall_dummy : public SpellScriptLoader { public: @@ -363,8 +343,6 @@ class spell_dru_starfall_dummy : public SpellScriptLoader void FilterTargets(std::list& unitList) { - // Remove targets not in LoS or in stealth - unitList.remove_if(StarfallDummyTargetFilter(GetCaster())); Trinity::Containers::RandomResizeList(unitList, 2); } @@ -419,61 +397,28 @@ class spell_dru_lifebloom : public SpellScriptLoader void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - // Final heal only on duration end - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + // Final heal only on duration end and dispel + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) return; // final heal int32 stack = GetStackAmount(); int32 healAmount = aurEff->GetAmount(); - Unit* caster = GetCaster(); - if (caster) + if (Unit* caster = GetCaster()) { healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack); healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack); - } - - GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); - // restore mana - if (caster) - { + // restore mana int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); } - } - - void HandleDispel(DispelInfo* dispelInfo) - { - if (Unit* target = GetUnitOwner()) - { - if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) - { - // final heal - int32 healAmount = aurEff->GetAmount(); - Unit* caster = GetCaster(); - if (caster) - { - healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); - healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); - } - - target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); - - // restore mana - if (caster) - { - int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; - caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); - } - } - } + GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); } void Register() { AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel); } }; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index f254908fe55..e7cc7360aab 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -252,12 +252,7 @@ class spell_gen_parachute : public SpellScriptLoader if (target->IsFalling()) { target->RemoveAurasDueToSpell(SPELL_PARACHUTE); - - float x, y, z; - target->GetPosition(x, y, z); - float groundZ = target->GetMap()->GetHeight(target->GetPhaseMask(), x, y, z); - if (fabs(groundZ - z) > 0.1f) - target->CastSpell(target, SPELL_PARACHUTE_BUFF, true); + target->CastSpell(target, SPELL_PARACHUTE_BUFF, true); } } @@ -2825,24 +2820,16 @@ class spell_gen_lifebloom : public SpellScriptLoader void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { // Final heal only on duration end - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) return; // final heal GetTarget()->CastSpell(GetTarget(), _spellId, true, NULL, aurEff, GetCasterGUID()); } - void HandleDispel(DispelInfo* /*dispelInfo*/) - { - // final heal - if (Unit* target = GetUnitOwner()) - target->CastSpell(target, _spellId, true, NULL, GetEffect(EFFECT_0), GetCasterGUID()); - } - void Register() { AfterEffectRemove += AuraEffectRemoveFn(spell_gen_lifebloom_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); - AfterDispel += AuraDispelFn(spell_gen_lifebloom_AuraScript::HandleDispel); } private: @@ -2887,8 +2874,7 @@ class spell_gen_summon_elemental : public SpellScriptLoader { if (GetCaster()) if (Unit* owner = GetCaster()->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) // todo: this check is maybe wrong - owner->CastSpell(owner, _spellId, true); + owner->CastSpell(owner, _spellId, true); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -3010,14 +2996,11 @@ class spell_gen_mount : public SpellScriptLoader // Triggered spell id dependent on riding skill and zone bool canFly = false; - uint32 vmap = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId()); - if (vmap == 530 || (vmap == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING))) + uint32 map = target->GetMapId(); + if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING))) canFly = true; - float x, y, z; - target->GetPosition(x, y, z); - uint32 areaFlag = target->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* area = sAreaStore.LookupEntry(areaFlag); + AreaTableEntry const* area = sAreaStore.LookupEntry(target->GetAreaId()); if (!area || (canFly && (area->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index fe681032c1c..329e0d2e170 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -462,19 +462,10 @@ class spell_pal_lay_on_hands : public SpellScriptLoader { Unit* caster = GetCaster(); if (Unit* target = GetExplTargetUnit()) - { if (caster == target) - { - if (target->HasAura(SPELL_FORBEARANCE)) - return SPELL_FAILED_TARGET_AURASTATE; - - if (target->HasAura(SPELL_AVENGING_WRATH_MARKER)) + if (target->HasAura(SPELL_FORBEARANCE) || target->HasAura(SPELL_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_IMMUNE_SHIELD_MARKER)) return SPELL_FAILED_TARGET_AURASTATE; - if (target->HasAura(SPELL_IMMUNE_SHIELD_MARKER)) - return SPELL_FAILED_TARGET_AURASTATE; - } - } return SPELL_CAST_OK; } diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 6ed0f18c785..78bdbb7f127 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -1,4 +1,4 @@ -/* + /* * Copyright (C) 2008-2012 TrinityCore * * This program is free software; you can redistribute it and/or modify it @@ -102,7 +102,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader return true; } - void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -121,7 +121,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader } } - void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -140,7 +140,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader } } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -155,7 +155,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -170,7 +170,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader } } - void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -237,7 +237,7 @@ public: return true; } - void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -249,7 +249,7 @@ public: } } - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (_tempBonus) @@ -281,7 +281,7 @@ public: } } - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -291,7 +291,7 @@ public: } } - void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -310,16 +310,16 @@ public: // Glyph of felguard if (pet->GetEntry() == ENTRY_FELGUARD) { - if (AuraEffect* aurEffect = owner->GetAuraEffect(56246, EFFECT_0)) + if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0)) { float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT); - amount += CalculatePctN(amount+base_attPower, aurEffect->GetAmount()); + amount += CalculatePctN(amount+base_attPower, /* aurEff */ect->GetAmount()); } } } } - void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -374,7 +374,7 @@ public: return true; } - void CalculateIntellectAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateIntellectAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -389,7 +389,7 @@ public: } } - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (_tempBonus) @@ -417,7 +417,7 @@ public: } } - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -427,7 +427,7 @@ public: } } - void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -439,7 +439,7 @@ public: } } - void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -486,7 +486,7 @@ public: return true; } - void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -498,7 +498,7 @@ public: } } - void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -510,7 +510,7 @@ public: } } - void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -553,7 +553,7 @@ public: return true; } - void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -593,7 +593,7 @@ public: return true; } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -608,7 +608,7 @@ public: } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -623,7 +623,7 @@ public: } } - void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -668,7 +668,7 @@ public: return true; } - void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -690,7 +690,7 @@ public: } } - void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -741,11 +741,11 @@ public: return true; } - void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; - if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + if (GetCaster()->GetOwner()->ToPlayer()) { switch (GetCaster()->GetEntry()) { @@ -792,13 +792,13 @@ public: return true; } - void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) if (Unit* owner = pet->ToPet()->GetOwner()) - if (AuraEffect* aurEffect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0)) - amount += aurEffect->GetAmount(); + if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0)) + amount += /* aurEff */ect->GetAmount(); } void Register() @@ -830,10 +830,8 @@ public: return true; } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -847,10 +845,8 @@ public: } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -886,50 +882,45 @@ public: { PrepareAuraScript(spell_hun_pet_scaling_01_AuraScript); - void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float mod = 0.45f; - float ownerBonus = 0.0f; + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float mod = 0.45f; + float ownerBonus = 0.0f; - PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1 - if (itr == pet->ToPet()->m_spells.end()) - itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2 + PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1 + if (itr == pet->ToPet()->m_spells.end()) + itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2 - if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value - AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue()); - } + if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value + AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue()); + } - ownerBonus = owner->GetStat(STAT_STAMINA)*mod; + ownerBonus = owner->GetStat(STAT_STAMINA)*mod; - amount += ownerBonus; - } + amount += ownerBonus; + } } - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (_tempHealth) pet->SetHealth(_tempHealth); } - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) _tempHealth = pet->GetHealth(); } - void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -959,7 +950,7 @@ public: } } - void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1024,7 +1015,7 @@ public: return true; } - void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1043,7 +1034,7 @@ public: } } - void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1062,7 +1053,7 @@ public: } } - void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1111,7 +1102,7 @@ public: return true; } - void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1130,7 +1121,7 @@ public: } } - void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1149,7 +1140,7 @@ public: } } - void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1198,7 +1189,7 @@ public: return true; } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1215,7 +1206,7 @@ public: } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1232,7 +1223,7 @@ public: } } - void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1279,11 +1270,11 @@ public: return true; } - void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; - if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + if (GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: float CritSpell = 0.0f; @@ -1300,11 +1291,11 @@ public: } } - void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; - if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + if (GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: float CritMelee = 0.0f; @@ -1350,11 +1341,11 @@ public: return true; } - void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; - if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + if (GetCaster()->GetOwner()->ToPlayer()) { // Pet's base damage changes depending on happiness if (GetCaster()->isPet() && GetCaster()->ToPet()->isHunterPet()) @@ -1408,14 +1399,14 @@ public: return true; } - void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { - if (AuraEffect* aurEffect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1)) - amount = aurEffect->GetAmount(); + if (AuraEffect* /* aurEff */ect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1)) + amount = /* aurEff */ect->GetAmount(); else amount = 0; } @@ -1450,18 +1441,19 @@ public: return true; } - void CalculateAvoidanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAvoidanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { if (Unit* owner = pet->GetOwner()) - + { // Army of the dead ghoul if (pet->GetEntry() == ENTRY_ARMY_OF_THE_DEAD_GHOUL) amount = -90; // Night of the dead else if ( Aura * aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD)) amount = aur->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); + } } } @@ -1494,7 +1486,7 @@ public: return true; } - void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1520,20 +1512,20 @@ public: } } - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (_tempHealth) pet->SetHealth(_tempHealth); } - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) _tempHealth = pet->GetHealth(); } - void CalculateStrengthAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateStrengthAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1597,7 +1589,7 @@ public: return true; } - void CalculateAmountMeleeHaste(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1640,7 +1632,7 @@ public: return true; } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1657,7 +1649,7 @@ public: } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1703,7 +1695,7 @@ public: return true; } - void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1718,7 +1710,7 @@ public: } } - void CalculateAmountMeleeHaste(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index dbc3a91012b..6910bf47805 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -352,17 +352,13 @@ class spell_pri_vampiric_touch : public SpellScriptLoader void HandleDispel(DispelInfo* /*dispelInfo*/) { if (Unit* caster = GetCaster()) - { if (Unit* target = GetUnitOwner()) - { if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) { int32 damage = aurEff->GetAmount() * 8; // backfire damage caster->CastCustomSpell(target, PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); } - } - } } void Register() diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index da15c5c5046..fce3d0415a6 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -35,7 +35,7 @@ enum ShamanSpells SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1 = 8349, SHAMAN_SPELL_SATED = 57724, SHAMAN_SPELL_EXHAUSTION = 57723, - + SHAMAN_SPELL_STORM_EARTH_AND_FIRE = 51483, EARTHBIND_TOTEM_SPELL_EARTHGRAB = 64695, @@ -261,7 +261,7 @@ class EarthenPowerTargetSelector { public: EarthenPowerTargetSelector() { } - + bool operator() (Unit* target) { if (!target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) @@ -679,9 +679,8 @@ class spell_sha_flame_shock : public SpellScriptLoader void HandleDispel(DispelInfo* /*dispelInfo*/) { if (Unit* caster = GetCaster()) - { // Lava Flows - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, ICON_ID_SHAMAN_LAVA_FLOW, 0)) + if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, ICON_ID_SHAMAN_LAVA_FLOW, EFFECT_0)) { if (sSpellMgr->GetFirstSpellInChain(SHAMAN_LAVA_FLOWS_R1) != sSpellMgr->GetFirstSpellInChain(aurEff->GetId())) return; @@ -689,7 +688,6 @@ class spell_sha_flame_shock : public SpellScriptLoader uint8 rank = sSpellMgr->GetSpellRank(aurEff->GetId()); caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true); } - } } void Register() @@ -723,11 +721,9 @@ class spell_sha_sentry_totem : public SpellScriptLoader void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - { if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[4])) if (totem->isTotem()) caster->CastSpell(totem, SHAMAN_BIND_SIGHT, true); - } } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 1b24a9ec09f..5f6bbe758f4 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -37,6 +37,7 @@ enum WarlockSpells WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018, WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020, WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388, + WARLOCK_HAUNT = 48181, WARLOCK_HAUNT_HEAL = 48210, WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117, }; @@ -534,16 +535,15 @@ class spell_warl_haunt : public SpellScriptLoader { PrepareSpellScript(spell_warl_haunt_SpellScript); - void HandleOnHit() + void HandleEffectHit(SpellEffIndex /*effIndex*/) { - if (Aura* aura = GetHitAura()) - if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1)) - aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage())); + if (AuraEffect* aurEff = GetExplTargetUnit()->GetAuraEffectOfRankedSpell(WARLOCK_HAUNT,EFFECT_1)) + aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage())); } void Register() { - OnHit += SpellHitFn(spell_warl_haunt_SpellScript::HandleOnHit); + OnEffectHitTarget += SpellEffectFn(spell_warl_haunt_SpellScript::HandleEffectHit, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; @@ -560,6 +560,9 @@ class spell_warl_haunt : public SpellScriptLoader void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + if (Unit* caster = GetCaster()) { int32 amount = aurEff->GetAmount(); @@ -603,14 +606,12 @@ class spell_warl_unstable_affliction : public SpellScriptLoader void HandleDispel(DispelInfo* dispelInfo) { if (Unit* caster = GetCaster()) - { if (AuraEffect const* aurEff = GetEffect(EFFECT_0)) { int32 damage = aurEff->GetAmount() * 9; // backfire damage and silence caster->CastCustomSpell(dispelInfo->GetDispeller(), WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); } - } } void Register() -- cgit v1.2.3 From 2ff2387aa529df746d32910784a307c260ac9303 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 15 Jun 2012 14:07:10 -0400 Subject: Core/Spells: revert some of previous commit and fix up a few things. --- src/server/scripts/Spells/spell_druid.cpp | 34 +++++++++++++++++++++++++++-- src/server/scripts/Spells/spell_warlock.cpp | 9 ++++---- 2 files changed, 37 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index b817036a9e4..4c8a9db1571 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -397,8 +397,8 @@ class spell_dru_lifebloom : public SpellScriptLoader void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - // Final heal only on duration end and dispel - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) + // Final heal only on duration end + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) return; // final heal @@ -409,16 +409,46 @@ class spell_dru_lifebloom : public SpellScriptLoader healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack); healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack); + GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + // restore mana int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + return; } + GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); } + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* target = GetUnitOwner()) + { + if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) + { + // final heal + int32 healAmount = aurEff->GetAmount(); + if (Unit* caster = GetCaster()) + { + healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); + healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); + target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + + // restore mana + int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; + caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + return; + } + + target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + } + } + } + void Register() { AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel); } }; diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 5f6bbe758f4..75953283113 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -535,15 +535,16 @@ class spell_warl_haunt : public SpellScriptLoader { PrepareSpellScript(spell_warl_haunt_SpellScript); - void HandleEffectHit(SpellEffIndex /*effIndex*/) + void HandleEffectHit() { - if (AuraEffect* aurEff = GetExplTargetUnit()->GetAuraEffectOfRankedSpell(WARLOCK_HAUNT,EFFECT_1)) - aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage())); + if (Aura* aura = GetHitAura()) + if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1)) + aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage())); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_warl_haunt_SpellScript::HandleEffectHit, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + OnHit += SpellHitFn(spell_warl_haunt_SpellScript::HandleOnHit); } }; -- cgit v1.2.3 From 521bf5f64ed03585ac427f1056af63c4f92de38b Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 15 Jun 2012 14:19:42 -0400 Subject: Core/Spells: fix build error from previous commit. --- src/server/scripts/Spells/spell_warlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 75953283113..e20eb07d45a 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -535,7 +535,7 @@ class spell_warl_haunt : public SpellScriptLoader { PrepareSpellScript(spell_warl_haunt_SpellScript); - void HandleEffectHit() + void HandleOnHit() { if (Aura* aura = GetHitAura()) if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1)) -- cgit v1.2.3 From 3164ba627b3405ac201539f975bb3a57333a5070 Mon Sep 17 00:00:00 2001 From: Elron103 Date: Sat, 16 Jun 2012 20:21:57 +0200 Subject: Core/Combat: Fix CanAIAttack implementation --- src/server/game/Combat/ThreatManager.cpp | 4 +++- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 9737d4584ea..0c43c9ece0e 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -354,7 +354,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR // list sorted and and we check current target, then this is best case if (currentVictim == currentRef || currentRef->getThreat() <= 1.1f * currentVictim->getThreat()) { - currentRef = currentVictim; // for second case + if (currentVictim != currentRef && attacker->canCreatureAttack(currentVictim->getTarget())) + currentRef = currentVictim; // for second case, if currentvictim is attackable + found = true; break; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 82cdb73a5ba..2646eae5351 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12958,7 +12958,7 @@ Unit* Creature::SelectVictim() else return NULL; - if (target && _IsTargetAcceptable(target)) + if (target && _IsTargetAcceptable(target) && canCreatureAttack(target)) { SetInFront(target); return target; @@ -12984,7 +12984,7 @@ Unit* Creature::SelectVictim() { target = SelectNearestTargetInAttackDistance(m_CombatDistance ? m_CombatDistance : ATTACK_DISTANCE); - if (target && _IsTargetAcceptable(target)) + if (target && _IsTargetAcceptable(target) && canCreatureAttack(target)) return target; } -- cgit v1.2.3 From f0d14c372c34e23a908b581fa90c058b32f81e06 Mon Sep 17 00:00:00 2001 From: Elron103 Date: Sun, 17 Jun 2012 00:50:21 +0200 Subject: Core/Entities: Fix possible variable overflows in health calculation functions --- src/server/game/Entities/Unit/Unit.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 9b63de0cdb8..98088f9ef6a 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1337,10 +1337,10 @@ class Unit : public WorldObject uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } bool IsFullHealth() const { return GetHealth() == GetMaxHealth(); } - bool HealthBelowPct(int32 pct) const { return GetHealth() * uint64(100) < GetMaxHealth() * uint64(pct); } - bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return (int32(GetHealth()) - damage) * int64(100) < GetMaxHealth() * int64(pct); } - bool HealthAbovePct(int32 pct) const { return GetHealth() * uint64(100) > GetMaxHealth() * uint64(pct); } - bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return (GetHealth() + heal) * uint64(100) > GetMaxHealth() * uint64(pct); } + bool HealthBelowPct(int32 pct) const { return GetHealth() < CountPctFromMaxHealth(pct); } + bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); } + bool HealthAbovePct(int32 pct) const { return GetHealth() > CountPctFromMaxHealth(pct); } + bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); } float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; } uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePctN(GetMaxHealth(), pct); } uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePctN(GetHealth(), pct); } -- cgit v1.2.3 From 3f8efb21cd46dcc0391c84916be6d8f9920aee23 Mon Sep 17 00:00:00 2001 From: "dr.skull" Date: Sun, 17 Jun 2012 02:21:40 +0200 Subject: add IsEffect() check to correct IsImmunedToSpell Signed-off-by: dr.skull --- src/server/game/Entities/Creature/Creature.cpp | 6 +++++- src/server/game/Entities/Unit/Unit.cpp | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 07e8e37e82a..6857abde2bd 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1675,12 +1675,16 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break // the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data. bool immunedToAllEffects = true; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + if(!spellInfo->Effects[i].IsEffect()) + break; if (!IsImmunedToSpellEffect(spellInfo, i)) { immunedToAllEffects = false; break; } + } if (immunedToAllEffects) return true; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index daa8c1e05de..0915f9ea3e9 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11534,10 +11534,12 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) } bool immuneToAllEffects = true; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) { // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately + if(!spellInfo->Effects[i].IsEffect()) + break; if (!IsImmunedToSpellEffect(spellInfo, i)) { immuneToAllEffects = false; -- cgit v1.2.3 From 8c16cc2260a6819083153d7b4ca707c0ba315caa Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 17 Jun 2012 21:50:01 +0100 Subject: Core/SAI: Implement SMART_EVENT_ACTION_DONE (72, DoAction) Param1 is event id This event is triggered on spellclick (id=1001), fall on ground (id=1002) and charge (id=1003) Signed-off-by: Nay --- src/server/game/AI/SmartScripts/SmartAI.cpp | 25 +--- src/server/game/AI/SmartScripts/SmartScript.cpp | 6 + src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 75 ++++++---- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 156 +++++++++++---------- 4 files changed, 133 insertions(+), 129 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 98b5c0a6ba3..f8658dd8689 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -696,8 +696,9 @@ void SmartAI::OnCharmed(bool apply) GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply); } -void SmartAI::DoAction(const int32 /*param*/) +void SmartAI::DoAction(const int32 param) { + GetScript()->ProcessEventsFor(SMART_EVENT_ACTION_DONE, NULL, param); } uint32 SmartAI::GetData(uint32 /*id*/) @@ -825,28 +826,6 @@ void SmartAI::sOnGameEvent(bool start, uint16 eventId) GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId); } -/* -SMART_EVENT_UPDATE_OOC -SMART_EVENT_SPELLHIT -SMART_EVENT_RANGE -SMART_EVENT_RESPAWN -SMART_EVENT_SUMMONED_UNIT -SMART_EVENT_ACCEPTED_QUEST -SMART_EVENT_REWARD_QUEST -SMART_EVENT_TARGET_BUFFED -SMART_EVENT_SUMMON_DESPAWNED -SMART_EVENT_AI_INIT -SMART_EVENT_DATA_SET -SMART_EVENT_TEXT_OVER -SMART_EVENT_TIMED_EVENT_TRIGGERED -SMART_EVENT_UPDATE -SMART_EVENT_LINK -SMART_EVENT_GOSSIP_SELECT -SMART_EVENT_JUST_CREATED -SMART_EVENT_GOSSIP_HELLO -SMART_EVENT_DEATH -*/ - int SmartGameObjectAI::Permissible(const GameObject* g) { if (g->GetAIName() == "SmartGameObjectAI") diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 1b414029366..f564bce1e25 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2778,6 +2778,12 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui ProcessAction(e, NULL, var0); break; } + case SMART_EVENT_ACTION_DONE: + { + if (e.event.doAction.eventId != var0) + return; + ProcessAction(e, unit, var0); + } default: sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index bf84f39747a..b01aaf5434c 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -475,63 +475,76 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_EVENT_TRANSPORT_ADDCREATURE: - { - if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature)) - return false; - break; - } + { + if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature)) + return false; + break; + } case SMART_EVENT_MOVEMENTINFORM: + { + if (e.event.movementInform.type > NULL_MOTION_TYPE) { - if (e.event.movementInform.type > NULL_MOTION_TYPE) - { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type); - return false; - } - break; + sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type); + return false; } + break; + } case SMART_EVENT_DATA_SET: - { - if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax)) - return false; - break; - } + { + if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax)) + return false; + break; + } case SMART_EVENT_AREATRIGGER_ONTRIGGER: - { - if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id)) - return false; - break; - } + { + if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id)) + return false; + break; + } case SMART_EVENT_TEXT_OVER: //if (e.event.textOver.textGroupID && !IsTextValid(e, e.event.textOver.textGroupID)) return false;// 0 is a valid text group! break; case SMART_EVENT_LINK: + { + if (e.link && e.link == e.event_id) { - if (e.link && e.link == e.event_id) - { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); - return false; - } - break; + sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); + return false; } + break; + } case SMART_EVENT_DUMMY_EFFECT: + { if (!IsSpellValid(e, e.event.dummy.spell)) return false; if (e.event.dummy.effIndex > EFFECT_2) return false; break; + } case SMART_EVENT_IS_BEHIND_TARGET: + { if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax)) return false; break; + } case SMART_EVENT_GAME_EVENT_START: case SMART_EVENT_GAME_EVENT_END: + { + GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); + if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid()) + return false; + break; + } + case SMART_EVENT_ACTION_DONE: + { + if (e.event.doAction.eventId < EventId::EVENT_SPELLCLICK || e.event.doAction.eventId > EventId::EVENT_CHARGE) { - GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); - if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid()) - return false; - break; + sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId); + return false; } + break; + } case SMART_EVENT_GO_STATE_CHANGED: case SMART_EVENT_GO_EVENT_INFORM: case SMART_EVENT_TIMED_EVENT_TRIGGERED: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index b82d0724f53..2291c21bf71 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -82,81 +82,81 @@ const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2] = enum SMART_EVENT { - SMART_EVENT_UPDATE_IC = 0, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax - SMART_EVENT_UPDATE_OOC = 1, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax - SMART_EVENT_HEALT_PCT = 2, //1 // HPMin%, HPMax%, RepeatMin, RepeatMax - SMART_EVENT_MANA_PCT = 3, //1 // ManaMin%, ManaMax%, RepeatMin, RepeatMax - SMART_EVENT_AGGRO = 4, //1 // NONE - SMART_EVENT_KILL = 5, //1 // CooldownMin0, CooldownMax1, playerOnly2, else creature entry3 - SMART_EVENT_DEATH = 6, //1 // NONE - SMART_EVENT_EVADE = 7, //1 // NONE - SMART_EVENT_SPELLHIT = 8, //1 // SpellID, School, CooldownMin, CooldownMax - SMART_EVENT_RANGE = 9, //1 // MinDist, MaxDist, RepeatMin, RepeatMax - SMART_EVENT_OOC_LOS = 10, //1 // NoHostile, MaxRnage, CooldownMin, CooldownMax - SMART_EVENT_RESPAWN = 11, //1 // type, MapId, ZoneId - SMART_EVENT_TARGET_HEALTH_PCT = 12, //1 // HPMin%, HPMax%, RepeatMin, RepeatMax - SMART_EVENT_TARGET_CASTING = 13, //1 // RepeatMin, RepeatMax - SMART_EVENT_FRIENDLY_HEALTH = 14, //1 // HPDeficit, Radius, RepeatMin, RepeatMax - SMART_EVENT_FRIENDLY_IS_CC = 15, //1 // Radius, RepeatMin, RepeatMax - SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, //1 // SpellId, Radius, RepeatMin, RepeatMax - SMART_EVENT_SUMMONED_UNIT = 17, //1 // CreatureId(0 all), CooldownMin, CooldownMax - SMART_EVENT_TARGET_MANA_PCT = 18, //1 // ManaMin%, ManaMax%, RepeatMin, RepeatMax - SMART_EVENT_ACCEPTED_QUEST = 19, //1 // QuestID(0any) - SMART_EVENT_REWARD_QUEST = 20, //1 // QuestID(0any) - SMART_EVENT_REACHED_HOME = 21, //1 // NONE - SMART_EVENT_RECEIVE_EMOTE = 22, //1 // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3 - SMART_EVENT_HAS_AURA = 23, //1 // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax - SMART_EVENT_TARGET_BUFFED = 24, //1 // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax - SMART_EVENT_RESET = 25, //1 // Called after combat, when the creature respawn and spawn. - - SMART_EVENT_IC_LOS = 26, //1 // NoHostile, MaxRnage, CooldownMin, CooldownMax - SMART_EVENT_PASSENGER_BOARDED = 27, //1 // CooldownMin, CooldownMax - SMART_EVENT_PASSENGER_REMOVED = 28, //1 // CooldownMin, CooldownMax - SMART_EVENT_CHARMED = 29, //1 // NONE - SMART_EVENT_CHARMED_TARGET = 30, //1 // NONE - SMART_EVENT_SPELLHIT_TARGET = 31, //1 // SpellID, School, CooldownMin, CooldownMax - SMART_EVENT_DAMAGED = 32, //1 // MinDmg, MaxDmg, CooldownMin, CooldownMax - SMART_EVENT_DAMAGED_TARGET = 33, //1 // MinDmg, MaxDmg, CooldownMin, CooldownMax - SMART_EVENT_MOVEMENTINFORM = 34, //1 // MovementType(any), PointID - SMART_EVENT_SUMMON_DESPAWNED = 35, //1 // Entry, CooldownMin, CooldownMax - SMART_EVENT_CORPSE_REMOVED = 36, //1 // NONE - SMART_EVENT_AI_INIT = 37, //1 // NONE - SMART_EVENT_DATA_SET = 38, //1 // Id, Value, CooldownMin, CooldownMax - SMART_EVENT_WAYPOINT_START = 39, //1 // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_REACHED = 40, //1 // PointId(0any), pathID(0any) - SMART_EVENT_TRANSPORT_ADDPLAYER = 41, //1 // NONE - SMART_EVENT_TRANSPORT_ADDCREATURE = 42, //1 // Entry (0 any) - SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, //1 // NONE - SMART_EVENT_TRANSPORT_RELOCATE = 44, //1 // PointId - SMART_EVENT_INSTANCE_PLAYER_ENTER = 45, //1 // Team (0 any), CooldownMin, CooldownMax - SMART_EVENT_AREATRIGGER_ONTRIGGER = 46, //1 // TriggerId(0 any) - SMART_EVENT_QUEST_ACCEPTED = 47, //1 // none - SMART_EVENT_QUEST_OBJ_COPLETETION = 48, //1 // none - SMART_EVENT_QUEST_COMPLETION = 49, //1 // none - SMART_EVENT_QUEST_REWARDED = 50, //1 // none - SMART_EVENT_QUEST_FAIL = 51, //1 // none - SMART_EVENT_TEXT_OVER = 52, //1 // GroupId from creature_text, creature entry who talks (0 any) - SMART_EVENT_RECEIVE_HEAL = 53, //1 // MinHeal, MaxHeal, CooldownMin, CooldownMax - SMART_EVENT_JUST_SUMMONED = 54, //1 // none - SMART_EVENT_WAYPOINT_PAUSED = 55, //1 // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_RESUMED = 56, //1 // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_STOPPED = 57, //1 // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_ENDED = 58, //1 // PointId(0any), pathID(0any) - SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, //1 // id - SMART_EVENT_UPDATE = 60, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax - SMART_EVENT_LINK = 61, //1 // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly - SMART_EVENT_GOSSIP_SELECT = 62, //1 // menuID, actionID - SMART_EVENT_JUST_CREATED = 63, //1 // none - SMART_EVENT_GOSSIP_HELLO = 64, //1 // none - SMART_EVENT_FOLLOW_COMPLETED = 65, //1 // none - SMART_EVENT_DUMMY_EFFECT = 66, //1 // spellId, effectIndex - SMART_EVENT_IS_BEHIND_TARGET = 67, //1 // cooldownMin, CooldownMax - SMART_EVENT_GAME_EVENT_START = 68, //1 // game_event.Entry - SMART_EVENT_GAME_EVENT_END = 69, //1 // game_event.Entry - SMART_EVENT_GO_STATE_CHANGED = 70, //1 // go state - SMART_EVENT_GO_EVENT_INFORM = 71, //1 // eventId - - SMART_EVENT_END = 72, + SMART_EVENT_UPDATE_IC = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax + SMART_EVENT_UPDATE_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax + SMART_EVENT_HEALT_PCT = 2, // HPMin%, HPMax%, RepeatMin, RepeatMax + SMART_EVENT_MANA_PCT = 3, // ManaMin%, ManaMax%, RepeatMin, RepeatMax + SMART_EVENT_AGGRO = 4, // NONE + SMART_EVENT_KILL = 5, // CooldownMin0, CooldownMax1, playerOnly2, else creature entry3 + SMART_EVENT_DEATH = 6, // NONE + SMART_EVENT_EVADE = 7, // NONE + SMART_EVENT_SPELLHIT = 8, // SpellID, School, CooldownMin, CooldownMax + SMART_EVENT_RANGE = 9, // MinDist, MaxDist, RepeatMin, RepeatMax + SMART_EVENT_OOC_LOS = 10, // NoHostile, MaxRnage, CooldownMin, CooldownMax + SMART_EVENT_RESPAWN = 11, // type, MapId, ZoneId + SMART_EVENT_TARGET_HEALTH_PCT = 12, // HPMin%, HPMax%, RepeatMin, RepeatMax + SMART_EVENT_TARGET_CASTING = 13, // RepeatMin, RepeatMax + SMART_EVENT_FRIENDLY_HEALTH = 14, // HPDeficit, Radius, RepeatMin, RepeatMax + SMART_EVENT_FRIENDLY_IS_CC = 15, // Radius, RepeatMin, RepeatMax + SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax + SMART_EVENT_SUMMONED_UNIT = 17, // CreatureId(0 all), CooldownMin, CooldownMax + SMART_EVENT_TARGET_MANA_PCT = 18, // ManaMin%, ManaMax%, RepeatMin, RepeatMax + SMART_EVENT_ACCEPTED_QUEST = 19, // QuestID(0any) + SMART_EVENT_REWARD_QUEST = 20, // QuestID(0any) + SMART_EVENT_REACHED_HOME = 21, // NONE + SMART_EVENT_RECEIVE_EMOTE = 22, // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3 + SMART_EVENT_HAS_AURA = 23, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax + SMART_EVENT_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax + SMART_EVENT_RESET = 25, // Called after combat, when the creature respawn and spawn. + SMART_EVENT_IC_LOS = 26, // NoHostile, MaxRnage, CooldownMin, CooldownMax + SMART_EVENT_PASSENGER_BOARDED = 27, // CooldownMin, CooldownMax + SMART_EVENT_PASSENGER_REMOVED = 28, // CooldownMin, CooldownMax + SMART_EVENT_CHARMED = 29, // NONE + SMART_EVENT_CHARMED_TARGET = 30, // NONE + SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax + SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax + SMART_EVENT_DAMAGED_TARGET = 33, // MinDmg, MaxDmg, CooldownMin, CooldownMax + SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID + SMART_EVENT_SUMMON_DESPAWNED = 35, // Entry, CooldownMin, CooldownMax + SMART_EVENT_CORPSE_REMOVED = 36, // NONE + SMART_EVENT_AI_INIT = 37, // NONE + SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax + SMART_EVENT_WAYPOINT_START = 39, // PointId(0any), pathID(0any) + SMART_EVENT_WAYPOINT_REACHED = 40, // PointId(0any), pathID(0any) + SMART_EVENT_TRANSPORT_ADDPLAYER = 41, // NONE + SMART_EVENT_TRANSPORT_ADDCREATURE = 42, // Entry (0 any) + SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, // NONE + SMART_EVENT_TRANSPORT_RELOCATE = 44, // PointId + SMART_EVENT_INSTANCE_PLAYER_ENTER = 45, // Team (0 any), CooldownMin, CooldownMax + SMART_EVENT_AREATRIGGER_ONTRIGGER = 46, // TriggerId(0 any) + SMART_EVENT_QUEST_ACCEPTED = 47, // none + SMART_EVENT_QUEST_OBJ_COPLETETION = 48, // none + SMART_EVENT_QUEST_COMPLETION = 49, // none + SMART_EVENT_QUEST_REWARDED = 50, // none + SMART_EVENT_QUEST_FAIL = 51, // none + SMART_EVENT_TEXT_OVER = 52, // GroupId from creature_text, creature entry who talks (0 any) + SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax + SMART_EVENT_JUST_SUMMONED = 54, // none + SMART_EVENT_WAYPOINT_PAUSED = 55, // PointId(0any), pathID(0any) + SMART_EVENT_WAYPOINT_RESUMED = 56, // PointId(0any), pathID(0any) + SMART_EVENT_WAYPOINT_STOPPED = 57, // PointId(0any), pathID(0any) + SMART_EVENT_WAYPOINT_ENDED = 58, // PointId(0any), pathID(0any) + SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, // id + SMART_EVENT_UPDATE = 60, // InitialMin, InitialMax, RepeatMin, RepeatMax + SMART_EVENT_LINK = 61, // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly + SMART_EVENT_GOSSIP_SELECT = 62, // menuID, actionID + SMART_EVENT_JUST_CREATED = 63, // none + SMART_EVENT_GOSSIP_HELLO = 64, // none + SMART_EVENT_FOLLOW_COMPLETED = 65, // none + SMART_EVENT_DUMMY_EFFECT = 66, // spellId, effectIndex + SMART_EVENT_IS_BEHIND_TARGET = 67, // cooldownMin, CooldownMax + SMART_EVENT_GAME_EVENT_START = 68, // game_event.Entry + SMART_EVENT_GAME_EVENT_END = 69, // game_event.Entry + SMART_EVENT_GO_STATE_CHANGED = 70, // go state + SMART_EVENT_GO_EVENT_INFORM = 71, // eventId + SMART_EVENT_ACTION_DONE = 72, // eventId (SharedDefines.EventId) + + SMART_EVENT_END = 73, }; struct SmartEvent @@ -356,6 +356,11 @@ struct SmartEvent uint32 eventId; } eventInform; + struct + { + uint32 eventId; + } doAction; + struct { uint32 param1; @@ -1173,6 +1178,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = {SMART_EVENT_GAME_EVENT_END, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GO_STATE_CHANGED, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GO_EVENT_INFORM, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, + {SMART_EVENT_ACTION_DONE, SMART_SCRIPT_TYPE_MASK_CREATURE }, }; enum SmartEventFlags -- cgit v1.2.3 From d61f9fb40cd85cd786022ceb5a040fe9629a3981 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 17 Jun 2012 22:11:27 +0100 Subject: Fix build in GCC Signed-off-by: Nay --- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index b01aaf5434c..426593d1757 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -538,7 +538,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } case SMART_EVENT_ACTION_DONE: { - if (e.event.doAction.eventId < EventId::EVENT_SPELLCLICK || e.event.doAction.eventId > EventId::EVENT_CHARGE) + if (e.event.doAction.eventId < EVENT_SPELLCLICK || e.event.doAction.eventId > EVENT_CHARGE) { sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId); return false; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 2291c21bf71..ade1c18de39 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1178,7 +1178,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = {SMART_EVENT_GAME_EVENT_END, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GO_STATE_CHANGED, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GO_EVENT_INFORM, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, - {SMART_EVENT_ACTION_DONE, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ACTION_DONE, SMART_SCRIPT_TYPE_MASK_CREATURE }, }; enum SmartEventFlags -- cgit v1.2.3 From b5a072855e53a01b263338ff9211dca862a7f39a Mon Sep 17 00:00:00 2001 From: "dr.skull" Date: Sun, 17 Jun 2012 23:17:59 +0200 Subject: Fix added check for IsImmunedToSpell Signed-off-by: dr.skull --- src/server/game/Entities/Creature/Creature.cpp | 6 +++--- src/server/game/Entities/Unit/Unit.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 6857abde2bd..4d54d1599a8 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1675,10 +1675,10 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break // the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data. bool immunedToAllEffects = true; - for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if(!spellInfo->Effects[i].IsEffect()) - break; + if (!spellInfo->Effects[i].IsEffect()) + continue; if (!IsImmunedToSpellEffect(spellInfo, i)) { immunedToAllEffects = false; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0915f9ea3e9..45c2d6b0b9a 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11534,12 +11534,12 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) } bool immuneToAllEffects = true; - for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately - if(!spellInfo->Effects[i].IsEffect()) - break; + if (!spellInfo->Effects[i].IsEffect()) + continue; if (!IsImmunedToSpellEffect(spellInfo, i)) { immuneToAllEffects = false; -- cgit v1.2.3 From 0e4d6bf4df723cb57190c60f7667021a87dd4eed Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 17 Jun 2012 23:13:48 +0100 Subject: Missing break on 8c16cc2260a68 Signed-off-by: Nay --- src/server/game/AI/SmartScripts/SmartScript.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index f564bce1e25..e888d4af030 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2783,6 +2783,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui if (e.event.doAction.eventId != var0) return; ProcessAction(e, unit, var0); + break; } default: sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); -- cgit v1.2.3 From 53b561f55031eb3f2cd46d918b94626782e7a59f Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 18 Jun 2012 00:42:37 +0100 Subject: Core/SAI: Remove some unused conditions related code SAI conditions were implemented in a different way than initially planned Signed-off-by: Nay --- src/server/game/AI/SmartScripts/SmartScript.cpp | 17 ----------------- src/server/game/AI/SmartScripts/SmartScript.h | 2 -- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 21 --------------------- 3 files changed, 40 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index e888d4af030..4bc5671b84b 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2901,23 +2901,6 @@ void SmartScript::InstallEvents() } } -bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3) -{ - if (c == 0) - return true; - - if (!u || !u->ToPlayer()) - return false; - - Condition cond; - cond.ConditionType = ConditionTypes(uint32(c)); - cond.ConditionValue1 = uint32(v1); - cond.ConditionValue1 = uint32(v2); - cond.ConditionValue1 = uint32(v3); - ConditionSourceInfo srcInfo = ConditionSourceInfo(u->ToPlayer()); - return cond.Meets(srcInfo); -} - void SmartScript::OnUpdate(uint32 const diff) { if ((mScriptType == SMART_SCRIPT_TYPE_CREATURE || mScriptType == SMART_SCRIPT_TYPE_GAMEOBJECT) && !GetBaseObject()) diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 5fb691c87f2..03d533e69e5 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -83,8 +83,6 @@ class SmartScript return obj && obj->GetTypeId() == TYPEID_GAMEOBJECT; } - bool ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3); - void OnUpdate(const uint32 diff); void OnMoveInLineOfSight(Unit* who); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index ade1c18de39..0f50985cef4 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -22,7 +22,6 @@ #include "Creature.h" #include "CreatureAI.h" #include "Unit.h" -#include "ConditionMgr.h" #include "Spell.h" //#include "SmartScript.h" @@ -1391,26 +1390,6 @@ class SmartAIMgr } return true; } - /*inline bool IsConditionValid(SmartScriptHolder e, int32 t, int32 v1, int32 v2, int32 v3) - { - bool error = false; - if (t > 0 && v1 >= 0 && v2 >= 0 && v3 >= 0) - { - Condition cond; - cond.mConditionType = ConditionType(t); - cond.mConditionValue1 = uint32(v1); - cond.mConditionValue2 = uint32(v2); - cond.mConditionValue3 = uint32(v3); - if (!sConditionMgr->isConditionTypeValid(&cond)) - error = true; - } - if (error) - { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Condition, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); - return false; - } - return true; - }*/ bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry) { -- cgit v1.2.3 From 32d3e33f87318c508a297851adc64f696953ca1d Mon Sep 17 00:00:00 2001 From: Abdollah Hasan Date: Mon, 18 Jun 2012 04:54:50 +0300 Subject: Core/Commands: Update TeleDel command to support id, shift click, or name of teleport location. --- src/server/scripts/Commands/cs_tele.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index ca7c3af7fde..cd143eacb50 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -97,15 +97,16 @@ public: if (!*args) return false; - std::string name = args; - - if (!sObjectMgr->DeleteGameTele(name)) - { - handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); + // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r + GameTele const* tele = handler->extractGameTeleFromLink((char*)args); + if (!tele) + { + handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); handler->SetSentErrorMessage(true); return false; - } - + } + std::string name = tele->name; + sObjectMgr->DeleteGameTele(name); handler->SendSysMessage(LANG_COMMAND_TP_DELETED); return true; } -- cgit v1.2.3 From b3d99e968f03f1085c8a0a50267ebd4832c29471 Mon Sep 17 00:00:00 2001 From: Abdollah Hasan Date: Mon, 18 Jun 2012 05:16:00 +0300 Subject: Core/Commands: TeleDel command cleanup. --- src/server/scripts/Commands/cs_tele.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index cd143eacb50..8f390d17cd4 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -97,16 +97,16 @@ public: if (!*args) return false; - // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r + // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r GameTele const* tele = handler->extractGameTeleFromLink((char*)args); - if (!tele) - { - handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); + if (!tele) + { + handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); handler->SetSentErrorMessage(true); return false; - } + } std::string name = tele->name; - sObjectMgr->DeleteGameTele(name); + sObjectMgr->DeleteGameTele(name); handler->SendSysMessage(LANG_COMMAND_TP_DELETED); return true; } -- cgit v1.2.3 From 99381289327a2eb07c0074044e024527f7e56913 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 18 Jun 2012 13:16:01 +0200 Subject: Scripts/Icecrown Citadel * Fixed position of summoned creatures (if supposed to be in air) * Fixed casting Fury of Frostmourne initiating outro roleplay while casting something else at the same time * Fixed outro visuals --- sql/updates/world/2012_06_18_00_world_creature.sql | 26 +++++ .../IcecrownCitadel/boss_the_lich_king.cpp | 129 ++++++++++++--------- .../IcecrownCitadel/instance_icecrown_citadel.cpp | 5 + 3 files changed, 103 insertions(+), 57 deletions(-) create mode 100644 sql/updates/world/2012_06_18_00_world_creature.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_18_00_world_creature.sql b/sql/updates/world/2012_06_18_00_world_creature.sql new file mode 100644 index 00000000000..23538c33f73 --- /dev/null +++ b/sql/updates/world/2012_06_18_00_world_creature.sql @@ -0,0 +1,26 @@ +SET @CGUID := 88615; +DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+00 AND @CGUID+22; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`MovementType`) VALUES +(@CGUID+00,39190,631,12,1,505.1563,-2536.863,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+01,39190,631,12,1,502.6493,-2531.328,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+02,39190,631,12,1,503.8246,-2508.141,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+03,39190,631,12,1,495.3629,-2538.215,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+04,39190,631,12,1,506.8715,-2515.552,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+05,39190,631,12,1,481.3021,-2509.222,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+06,39190,631,12,1,481.5382,-2527.332,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+07,39190,631,12,1,500.0807,-2523.289,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+08,39190,631,12,1,486.6632,-2517.747,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+09,39190,631,12,1,513.8802,-2511.795,1069.596,0,10,10,1), -- Wicked Spirit +(@CGUID+10,39190,631,12,1,499.6406,-2500.783,1069.656,0,10,10,1), -- Wicked Spirit +(@CGUID+11,39190,631,12,1,513.7101,-2530.931,1069.596,0,10,10,1), -- Wicked Spirit +(@CGUID+12,39190,631,12,1,502.6811,-2522.542,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+13,39190,631,12,1,518.7483,-2521.240,1069.596,0,10,10,1), -- Wicked Spirit +(@CGUID+14,39190,631,12,1,478.9774,-2517.446,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+15,39190,631,12,1,489.0104,-2538.535,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+16,39190,631,12,1,511.6320,-2522.373,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+17,39190,631,12,1,500.8976,-2527.198,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+18,39190,631,12,1,484.7934,-2533.592,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+19,39190,631,12,1,490.4132,-2504.323,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+20,39190,631,12,1,485.0298,-2527.724,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+21,39190,631,12,1,494.2899,-2511.384,1069.598,0,10,10,1), -- Wicked Spirit +(@CGUID+22,39190,631,12,1,491.7170,-2532.490,1069.598,0,10,10,1); -- Wicked Spirit diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 4dab215d1da..03d6c0ef919 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -138,7 +138,7 @@ enum Spells SPELL_IN_FROSTMOURNE_ROOM = 74276, SPELL_KILL_FROSTMOURNE_PLAYERS = 75127, SPELL_HARVESTED_SOUL = 72679, - SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582, + SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582, // TODO: Cast every 3 seconds during Frostmourne phase, targets a Wicked Spirit amd activates it // Frostmourne SPELL_LIGHTS_FAVOR = 69382, @@ -152,6 +152,7 @@ enum Spells SPELL_SUMMON_SPIRIT_BOMB_1 = 73581, // (Heroic) SPELL_SUMMON_SPIRIT_BOMB_2 = 74299, // (Heroic) SPELL_EXPLOSION = 73576, // Spirit Bomb (Heroic) + SPELL_HARVEST_SOUL_DAMAGE_AURA = 73655, // Outro SPELL_FURY_OF_FROSTMOURNE = 72350, @@ -221,7 +222,7 @@ enum Events EVENT_QUAKE_2 = 27, EVENT_VILE_SPIRITS = 28, EVENT_HARVEST_SOULS = 29, // heroic only - EVENT_WICKED_SPIRITS = 30, + EVENT_BERSERK = 30, EVENT_SOUL_RIP = 31, EVENT_DESTROY_SOUL = 32, EVENT_FROSTMOURNE_TALK_1 = 33, @@ -249,19 +250,18 @@ enum Events EVENT_OUTRO_TERENAS_TALK_2 = 55, EVENT_OUTRO_TALK_7 = 56, EVENT_OUTRO_TALK_8 = 57, - EVENT_BERSERK = 58, // Shambling Horror - EVENT_SHOCKWAVE = 59, - EVENT_ENRAGE = 60, + EVENT_SHOCKWAVE = 58, + EVENT_ENRAGE = 59, // Raging Spirit - EVENT_SOUL_SHRIEK = 61, + EVENT_SOUL_SHRIEK = 60, // Strangulate Vehicle (Harvest Soul) - EVENT_TELEPORT = 62, - EVENT_MOVE_TO_LICH_KING = 63, - EVENT_DESPAWN_SELF = 64, + EVENT_TELEPORT = 61, + EVENT_MOVE_TO_LICH_KING = 62, + EVENT_DESPAWN_SELF = 63, }; enum EventGroups @@ -475,6 +475,25 @@ class VileSpiritActivateEvent : public BasicEvent Creature* _owner; }; +class TriggerWickedSpirit : public BasicEvent +{ + public: + explicit TriggerWickedSpirit(Creature* owner) + : _owner(owner), _counter(13) + { + } + + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, NULL, true); + return --_counter > 0; + } + + private: + Creature* _owner; + int32 _counter; +}; + class boss_the_lich_king : public CreatureScript { public: @@ -503,6 +522,8 @@ class boss_the_lich_king : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->GetMotionMaster()->MoveFall(); + if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) + frostmourne->DespawnOrUnsummon(); } void EnterCombat(Unit* target) @@ -601,8 +622,6 @@ class boss_the_lich_king : public CreatureScript summons.DoAction(ACTION_TELEPORT_BACK, pred); if (!IsHeroic()) Talk(SAY_LK_FROSTMOURNE_ESCAPE); - else - DoCastAOE(SPELL_TRIGGER_VILE_SPIRIT_HEROIC); break; } default: @@ -645,6 +664,8 @@ class boss_the_lich_king : public CreatureScript if (events.GetPhaseMask() & PHASE_MASK_ONE && !HealthAbovePct(70)) { events.SetPhase(PHASE_TRANSITION); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); me->GetMotionMaster()->MovePoint(POINT_CENTER_1, CenterPosition); return; } @@ -652,6 +673,8 @@ class boss_the_lich_king : public CreatureScript if (events.GetPhaseMask() & PHASE_MASK_TWO && !HealthAbovePct(40)) { events.SetPhase(PHASE_TRANSITION); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); me->GetMotionMaster()->MovePoint(POINT_CENTER_2, CenterPosition); return; } @@ -664,7 +687,8 @@ class boss_the_lich_king : public CreatureScript events.SetPhase(PHASE_OUTRO); summons.DespawnAll(); SendMusicToPlayers(MUSIC_FURY_OF_FROSTMOURNE); - DoCastAOE(SPELL_FURY_OF_FROSTMOURNE); + me->InterruptNonMeleeSpells(true); + me->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE, TRIGGERED_NONE); me->SetWalk(true); events.ScheduleEvent(EVENT_OUTRO_TALK_1, 2600, 0, PHASE_OUTRO); events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 6600, 0, PHASE_OUTRO); @@ -712,7 +736,6 @@ class boss_the_lich_king : public CreatureScript break; case NPC_FROSTMOURNE_TRIGGER: { - summons.Summon(summon); summon->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE, true); SendLightOverride(LIGHT_SOULSTORM, 10000); @@ -724,16 +747,11 @@ class boss_the_lich_king : public CreatureScript case NPC_VILE_SPIRIT: { summons.Summon(summon); - if (events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE) - { - TeleportSpirit(summon); - return; - } - summon->SetReactState(REACT_PASSIVE); summon->SetSpeed(MOVE_FLIGHT, 0.5f); summon->GetMotionMaster()->MoveRandom(10.0f); - summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000)); + if (!(events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE)) + summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000)); return; } case NPC_STRANGULATE_VEHICLE: @@ -756,7 +774,6 @@ class boss_the_lich_king : public CreatureScript case NPC_VALKYR_SHADOWGUARD: case NPC_RAGING_SPIRIT: case NPC_VILE_SPIRIT: - case NPC_WICKED_SPIRIT: summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); break; default: @@ -802,8 +819,6 @@ class boss_the_lich_king : public CreatureScript me->SetFacingTo(0.0f); Talk(SAY_LK_REMORSELESS_WINTER); SendMusicToPlayers(MUSIC_SPECIAL); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); DoCast(me, SPELL_REMORSELESS_WINTER_1); events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions events.ScheduleEvent(EVENT_QUAKE, 62500, 0, PHASE_TRANSITION); @@ -819,8 +834,6 @@ class boss_the_lich_king : public CreatureScript me->SetFacingTo(0.0f); Talk(SAY_LK_REMORSELESS_WINTER); SendMusicToPlayers(MUSIC_SPECIAL); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); DoCast(me, SPELL_REMORSELESS_WINTER_2); summons.DespawnEntry(NPC_VALKYR_SHADOWGUARD); events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions @@ -992,10 +1005,6 @@ class boss_the_lich_king : public CreatureScript DoCastAOE(SPELL_VILE_SPIRITS); events.ScheduleEvent(EVENT_VILE_SPIRITS, urand(35000, 40000), EVENT_GROUP_VILE_SPIRITS, PHASE_THREE); break; - case EVENT_WICKED_SPIRITS: - DoCastAOE(SPELL_VILE_SPIRITS); - events.ScheduleEvent(EVENT_WICKED_SPIRITS, urand(35000, 40000), 0, PHASE_FROSTMOURNE); - break; case EVENT_HARVEST_SOULS: Talk(SAY_LK_HARVEST_SOUL); DoCastAOE(SPELL_HARVEST_SOULS); @@ -1003,7 +1012,6 @@ class boss_the_lich_king : public CreatureScript events.SetPhase(PHASE_FROSTMOURNE); // will stop running UpdateVictim (no evading) me->SetReactState(REACT_PASSIVE); me->AttackStop(); - events.ScheduleEvent(EVENT_WICKED_SPIRITS, events.GetNextEventTime(EVENT_VILE_SPIRITS) - events.GetTimer(), 0, PHASE_FROSTMOURNE); events.DelayEvents(50000, EVENT_GROUP_VILE_SPIRITS); events.RescheduleEvent(EVENT_DEFILE, 50000, 0, PHASE_THREE); events.RescheduleEvent(EVENT_SOUL_REAPER, urand(57000, 62000), 0, PHASE_THREE); @@ -1019,16 +1027,22 @@ class boss_the_lich_king : public CreatureScript if (!triggers.empty()) { triggers.sort(Trinity::ObjectDistanceOrderPred(terenas, true)); - Unit* spawner = triggers.front(); + Creature* spawner = triggers.front(); spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players + spawner->m_Events.AddEvent(new TriggerWickedSpirit(spawner), spawner->m_Events.CalculateTime(3000)); } for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) { Creature* summon = ObjectAccessor::GetCreature(*me, *i); if (summon && summon->GetEntry() == NPC_VILE_SPIRIT) - TeleportSpirit(summon); + { + summon->m_Events.KillAllEvents(true); + summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(50000)); + summon->GetMotionMaster()->MoveRandom(10.0f); + summon->SetReactState(REACT_PASSIVE); + } } } break; @@ -1099,22 +1113,6 @@ class boss_the_lich_king : public CreatureScript } private: - - void TeleportSpirit(Creature* summon) - { - float dist = me->GetObjectSize() + (15.0f - me->GetObjectSize()) * float(rand_norm()); - float angle = float(rand_norm()) * float(2.0f * M_PI); - Position dest = TerenasSpawnHeroic; - me->MovePosition(dest, dist, angle); - dest.m_positionZ += 15.0f; - summon->UpdateEntry(NPC_WICKED_SPIRIT); - summon->SetReactState(REACT_PASSIVE); - summon->NearTeleportTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.GetOrientation()); - summon->SetSpeed(MOVE_FLIGHT, 0.5f); - summon->m_Events.KillAllEvents(true); - summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(1000)); - } - void SendMusicToPlayers(uint32 musicId) const { WorldPacket data(SMSG_PLAY_MUSIC, 4); @@ -1635,8 +1633,13 @@ class npc_strangulate_vehicle : public CreatureScript return; if (TempSummon* summ = me->ToTempSummon()) + { if (Unit* summoner = summ->GetSummoner()) + { DoCast(summoner, SPELL_HARVEST_SOUL_TELEPORT_BACK); + summoner->RemoveAurasDueToSpell(SPELL_HARVEST_SOUL_DAMAGE_AURA); + } + } if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) lichKing->AI()->SummonedCreatureDespawn(me); @@ -1993,6 +1996,10 @@ class npc_broken_frostmourne : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_SUMMON_TERENAS, 6000, 0, PHASE_OUTRO); } + void EnterEvadeMode() + { + } + void UpdateAI(uint32 const diff) { UpdateVictim(); @@ -2472,14 +2479,18 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f}; WorldLocation* dest = const_cast(GetExplTargetDest()); dest->RelocateOffset(offset); + GetHitDest()->RelocateOffset(offset); // spirit bombs get higher if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB) + { dest->RelocateOffset(offset); + GetHitDest()->RelocateOffset(offset); + } } void Register() { - OnEffectLaunch += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + OnEffectHit += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); } }; @@ -2954,6 +2965,15 @@ class spell_the_lich_king_restore_soul : public SpellScriptLoader lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); if (Creature* spawner = GetCaster()->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 50.0f)) spawner->RemoveAllAuras(); + + std::list spirits; + GetCaster()->GetCreatureListWithEntryInGrid(spirits, NPC_WICKED_SPIRIT, 200.0f); + for (std::list::iterator itr = spirits.begin(); itr != spirits.end(); ++itr) + { + (*itr)->m_Events.KillAllEvents(true); + (*itr)->SetReactState(REACT_PASSIVE); + (*itr)->AI()->EnterEvadeMode(); + } } void RemoveAura() @@ -3046,23 +3066,18 @@ class spell_the_lich_king_trigger_vile_spirit : public SpellScriptLoader { PrepareSpellScript(spell_the_lich_king_trigger_vile_spirit_SpellScript); - void TeleportOutside() + void ActivateSpirit() { Creature* target = GetHitCreature(); if (!target) return; - Position dest; - Position offset; - TerenasSpawnHeroic.GetPositionOffsetTo(*target, offset); - GetCaster()->GetPosition(&dest); - dest.RelocateOffset(offset); - target->NearTeleportTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.GetOrientation()); + VileSpiritActivateEvent(target).Execute(0, 0); } void Register() { - OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::TeleportOutside); + OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::ActivateSpirit); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 704c3c2b0c2..270f56674eb 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -290,6 +290,11 @@ class instance_icecrown_citadel : public InstanceMapScript case NPC_TERENAS_MENETHIL_FROSTMOURNE_H: TerenasMenethilGUID = creature->GetGUID(); break; + case NPC_WICKED_SPIRIT: + // Remove corpse as soon as it dies (and respawn 10 seconds later) + creature->SetCorpseDelay(0); + creature->SetReactState(REACT_PASSIVE); + break; default: break; } -- cgit v1.2.3 From 2cafa85daacb8e1908953f1e529a87d6f8371dd1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 18 Jun 2012 13:19:09 +0200 Subject: Scripts/Icecrown Citadel: Minor correction for previous commit --- .../scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 03d6c0ef919..d2eaab361a1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -486,12 +486,19 @@ class TriggerWickedSpirit : public BasicEvent bool Execute(uint64 /*time*/, uint32 /*diff*/) { _owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, NULL, true); - return --_counter > 0; + + if (--_counter) + { + _owner->m_Events.AddEvent(this, _owner->m_Events.CalculateTime(3000)); + return false; + } + + return true; } private: Creature* _owner; - int32 _counter; + uint32 _counter; }; class boss_the_lich_king : public CreatureScript -- cgit v1.2.3 From bd7299ac35600f4f084074c95c64ba27cad04ac4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 18 Jun 2012 13:27:10 +0200 Subject: Scripts/Spells: Reverted part of 9d19be2ee5be7cf46ea3eb6b197647737266c69e, fixes scaling mounts Closes #6815. --- src/server/scripts/Spells/spell_generic.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index e7cc7360aab..9cbf81b39af 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2996,11 +2996,14 @@ class spell_gen_mount : public SpellScriptLoader // Triggered spell id dependent on riding skill and zone bool canFly = false; - uint32 map = target->GetMapId(); + uint32 map = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId()); if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING))) canFly = true; - AreaTableEntry const* area = sAreaStore.LookupEntry(target->GetAreaId()); + float x, y, z; + target->GetPosition(x, y, z); + uint32 areaFlag = target->GetBaseMap()->GetAreaFlag(x, y, z); + AreaTableEntry const* area = sAreaStore.LookupEntry(areaFlag); if (!area || (canFly && (area->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; -- cgit v1.2.3 From 2affb39bc0adcfa5758268222a115e3eb3a3247d Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 18 Jun 2012 12:48:34 -0400 Subject: Core/Spells: fix bloodthirst. again. --- .../2012_06_18_01_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_warrior.cpp | 34 ++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/2012_06_18_01_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_18_01_world_spell_script_names.sql b/sql/updates/world/2012_06_18_01_world_spell_script_names.sql new file mode 100644 index 00000000000..5f227a887d7 --- /dev/null +++ b/sql/updates/world/2012_06_18_01_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = 23880; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(23880, 'spell_warr_bloodthirst_heal'); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 0ba5c866d63..f1276c24a75 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -184,9 +184,9 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); - + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; @@ -405,7 +405,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader void Register() { - OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + OnEffectHit += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); } }; @@ -415,6 +415,33 @@ class spell_warr_bloodthirst : public SpellScriptLoader } }; +class spell_warr_bloodthirst_heal : public SpellScriptLoader +{ +public: + spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { } + + class spell_warr_bloodthirst_heal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript); + + void HandleHeal(SpellEffIndex /* effIndex */) + { + if (GetTriggeringSpell()) + SetHitHeal(CalculatePctN(GetCaster()->GetMaxHealth(),GetTriggeringSpell()->Effects[EFFECT_1].CalcValue())); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_bloodthirst_heal_SpellScript(); + } +}; + enum Overpower { SPELL_UNRELENTING_ASSAULT_RANK_1 = 46859, @@ -472,4 +499,5 @@ void AddSC_warrior_spell_scripts() new spell_warr_concussion_blow(); new spell_warr_bloodthirst(); new spell_warr_overpower(); + new spell_warr_bloodthirst_heal(); } -- cgit v1.2.3 From c1a014807015a30152fdc02d64546ab27d77c775 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 18 Jun 2012 12:57:33 -0400 Subject: Core/Scripts: fix professor oozes being able to be knocked back. --- .../scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index a0fca522f61..b2662b644a7 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -296,6 +296,7 @@ class boss_professor_putricide : public CreatureScript summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true); summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true); summon->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, summon, false); + summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); summon->SetReactState(REACT_PASSIVE); return; case NPC_VOLATILE_OOZE: @@ -303,6 +304,7 @@ class boss_professor_putricide : public CreatureScript summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true); summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true); summon->CastSpell(summon, SPELL_VOLATILE_OOZE_ADHESIVE, false); + summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); summon->SetReactState(REACT_PASSIVE); return; case NPC_CHOKING_GAS_BOMB: -- cgit v1.2.3 From 29f1ab2438d6bf7ac1370696033788df46f9ff27 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 18 Jun 2012 19:05:25 +0200 Subject: Core/Achievements: Corrected map requirement for Once Bitten, Twice Shy (10 player) - was requiring Ulduar --- src/server/game/Achievements/AchievementMgr.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 2a9f4212f46..450c05329b4 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2208,7 +2208,6 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId) { - AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId); if (!criteria) continue; @@ -2239,7 +2238,6 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId) { - AchievementEntry const* achievement = sAchievementStore.LookupEntry(entryId); if (!achievement || !achievement->refAchievement) continue; @@ -2248,6 +2246,10 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() ++count; } + // Once Bitten, Twice Shy (10 player) - Icecrown Citadel + if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539)) + const_cast(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar) + sLog->outString(">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } -- cgit v1.2.3 From e190a202cac3787c95749a0a628fa2dd6b082015 Mon Sep 17 00:00:00 2001 From: Discover- Date: Tue, 19 Jun 2012 00:07:20 +0200 Subject: Core/CreatureAI: Implement an OnSpellClick hook instead of the ugly way that uses DoAction with EVENT_SPELLCLICK. Core/SmartAI: Implement SMART_EVENT_ON_SPELLCLICK. Parameter is the clicker. If someone could update the wiki accordingly for SAI I would appreciate that. Thanks to @Shauren for some help! --- src/server/game/AI/CreatureAI.h | 4 ++-- src/server/game/AI/SmartScripts/SmartAI.cpp | 5 +++++ src/server/game/AI/SmartScripts/SmartAI.h | 2 ++ src/server/game/AI/SmartScripts/SmartScript.cpp | 1 + src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 3 ++- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 4 +++- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Miscellaneous/SharedDefines.h | 2 -- .../MovementGenerators/PointMovementGenerator.cpp | 5 ----- .../IcecrownCitadel/boss_valithria_dreamwalker.cpp | 5 +---- .../Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp | 20 +++++++++----------- 11 files changed, 26 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 94ac452b9f3..68752b82e7f 100755 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -128,8 +128,6 @@ class CreatureAI : public UnitAI void OnCharmed(bool apply); - //virtual void SpellClick(Player* player) {} - // Called at reaching home after evade virtual void JustReachedHome() {} @@ -171,6 +169,8 @@ class CreatureAI : public UnitAI virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) {} + virtual void OnSpellClick(Unit* /*clicker*/) { } + virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; } protected: virtual void MoveInLineOfSight(Unit* /*who*/); diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index f8658dd8689..96fc43e0572 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -826,6 +826,11 @@ void SmartAI::sOnGameEvent(bool start, uint16 eventId) GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId); } +void SmartAI::OnSpellClick(Unit* clicker) +{ + GetScript()->ProcessEventsFor(SMART_EVENT_ON_SPELLCLICK, clicker); +} + int SmartGameObjectAI::Permissible(const GameObject* g) { if (g->GetAIName() == "SmartGameObjectAI") diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 3a3a7dc9510..79cef0c3b37 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -198,6 +198,8 @@ class SmartAI : public CreatureAI void RemoveAuras(); + void OnSpellClick(Unit* clicker); + private: uint32 mFollowCreditType; uint32 mFollowArrivedTimer; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 4bc5671b84b..b6624586551 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2534,6 +2534,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui case SMART_EVENT_JUST_CREATED: case SMART_EVENT_GOSSIP_HELLO: case SMART_EVENT_FOLLOW_COMPLETED: + case SMART_EVENT_ON_SPELLCLICK: ProcessAction(e, unit, var0, var1, bvar, spell, gob); break; case SMART_EVENT_IS_BEHIND_TARGET: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 426593d1757..de766d2a7e1 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -538,7 +538,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } case SMART_EVENT_ACTION_DONE: { - if (e.event.doAction.eventId < EVENT_SPELLCLICK || e.event.doAction.eventId > EVENT_CHARGE) + if (e.event.doAction.eventId > EVENT_CHARGE) { sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId); return false; @@ -577,6 +577,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_GOSSIP_HELLO: case SMART_EVENT_JUST_CREATED: case SMART_EVENT_FOLLOW_COMPLETED: + case SMART_EVENT_ON_SPELLCLICK: break; default: sLog->outErrorDb("SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 0f50985cef4..d71d71ce519 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -154,8 +154,9 @@ enum SMART_EVENT SMART_EVENT_GO_STATE_CHANGED = 70, // go state SMART_EVENT_GO_EVENT_INFORM = 71, // eventId SMART_EVENT_ACTION_DONE = 72, // eventId (SharedDefines.EventId) + SMART_EVENT_ON_SPELLCLICK = 73, // clicker (unit) - SMART_EVENT_END = 73, + SMART_EVENT_END = 74, }; struct SmartEvent @@ -1178,6 +1179,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = {SMART_EVENT_GO_STATE_CHANGED, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GO_EVENT_INFORM, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_ACTION_DONE, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ON_SPELLCLICK, SMART_SCRIPT_TYPE_MASK_CREATURE }, }; enum SmartEventFlags diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a261a633499..50c8920a0d3 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16935,7 +16935,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) Creature* creature = ToCreature(); if (creature && creature->IsAIEnabled) - creature->AI()->DoAction(EVENT_SPELLCLICK); + creature->AI()->OnSpellClick(clicker); return true; } diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 06aca10879d..f74d6c44be7 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -3151,8 +3151,6 @@ enum SummonType enum EventId { - EVENT_SPELLCLICK = 1001, - EVENT_FALL_GROUND = 1002, EVENT_CHARGE = 1003, }; diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index a922c937b5f..940be26abe2 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -81,11 +81,6 @@ void PointMovementGenerator::MovementInform(T & /*unit*/) template <> void PointMovementGenerator::MovementInform(Creature &unit) { - //if (id == EVENT_FALL_GROUND) - //{ - // unit.setDeathState(JUST_DIED); - // unit.SetFlying(true); - //} if (unit.AI()) unit.AI()->MovementInform(POINT_MOTION_TYPE, id); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index c40a521c794..31ed1eedf10 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -1013,11 +1013,8 @@ class npc_dream_portal : public CreatureScript { } - void DoAction(int32 const action) + void OnSpellClick(Unit* /*clicker*/) { - if (action != EVENT_SPELLCLICK) - return; - _used = true; me->DespawnOrUnsummon(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 0e453eceaa1..8ff6c2e1a3a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -720,20 +720,18 @@ class boss_flame_leviathan_overload_device : public CreatureScript { } - void DoAction(const int32 param) + void OnSpellClick(Unit* /*clicker*/) { - if (param == EVENT_SPELLCLICK) + if (me->GetVehicle()) { - if (me->GetVehicle()) + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) - { - me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true); - player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30); - player->ExitVehicle(); - } + me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true); + player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30); + player->ExitVehicle(); } } } -- cgit v1.2.3 From c19f13e6fcf48650888254a759bfd4a9c17a26c6 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 18 Jun 2012 15:00:45 +0200 Subject: Core/Commands: Convert cast commands in commandscript --- src/server/game/Chat/Chat.cpp | 12 -- src/server/game/Chat/Chat.h | 7 - src/server/game/Chat/Commands/Level3.cpp | 256 ------------------------ src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Commands/CMakeLists.txt | 2 +- src/server/scripts/Commands/cs_cast.cpp | 310 +++++++++++++++++++++++++++++ 6 files changed, 313 insertions(+), 276 deletions(-) create mode 100644 src/server/scripts/Commands/cs_cast.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 72011a339f8..7d23b14110b 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -92,17 +92,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand castCommandTable[] = - { - { "back", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastBackCommand>, "", NULL }, - { "dist", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastDistCommand>, "", NULL }, - { "self", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastSelfCommand>, "", NULL }, - { "target", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastTargetCommand>, "", NULL }, - { "dest", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastDestCommand>, "", NULL }, - { "", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand characterDeletedCommandTable[] = { { "delete", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleCharacterDeletedDeleteCommand>, "", NULL }, @@ -328,7 +317,6 @@ ChatCommand* ChatHandler::getCommandTable() { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, - { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable }, { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 0a5cd9391f6..1612de741a6 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -147,13 +147,6 @@ class ChatHandler bool HandleBanListCharacterCommand(const char* args); bool HandleBanListIPCommand(const char* args); - bool HandleCastCommand(const char *args); - bool HandleCastBackCommand(const char *args); - bool HandleCastDistCommand(const char *args); - bool HandleCastSelfCommand(const char *args); - bool HandleCastTargetCommand(const char *args); - bool HandleCastDestCommand(const char *args); - bool HandleCharacterCustomizeCommand(const char* args); bool HandleCharacterChangeFactionCommand(const char* args); bool HandleCharacterChangeRaceCommand(const char * args); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 4decc7a523f..3898232fa40 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -3814,227 +3814,6 @@ bool ChatHandler::HandleServerPLimitCommand(const char *args) return true; } -bool ChatHandler::HandleCastCommand(const char *args) -{ - if (!*args) - return false; - - Unit* target = getSelectedUnit(); - - if (!target) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spell = extractSpellIdFromLink((char*)args); - if (!spell) - return false; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell); - if (!spellInfo) - { - PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); - SetSentErrorMessage(true); - return false; - } - - if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer())) - { - PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell); - SetSentErrorMessage(true); - return false; - } - - char* trig_str = strtok(NULL, " "); - if (trig_str) - { - int l = strlen(trig_str); - if (strncmp(trig_str, "triggered", l) != 0) - return false; - } - - bool triggered = (trig_str != NULL); - - m_session->GetPlayer()->CastSpell(target, spell, triggered); - - return true; -} - -bool ChatHandler::HandleCastBackCommand(const char *args) -{ - Creature* caster = getSelectedCreature(); - - if (!caster) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spell = extractSpellIdFromLink((char*)args); - if (!spell || !sSpellMgr->GetSpellInfo(spell)) - { - PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); - SetSentErrorMessage(true); - return false; - } - - char* trig_str = strtok(NULL, " "); - if (trig_str) - { - int l = strlen(trig_str); - if (strncmp(trig_str, "triggered", l) != 0) - return false; - } - - bool triggered = (trig_str != NULL); - - caster->CastSpell(m_session->GetPlayer(), spell, triggered); - - return true; -} - -bool ChatHandler::HandleCastDistCommand(const char *args) -{ - if (!*args) - return false; - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spell = extractSpellIdFromLink((char*)args); - if (!spell) - return false; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell); - if (!spellInfo) - { - PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); - SetSentErrorMessage(true); - return false; - } - - if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer())) - { - PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell); - SetSentErrorMessage(true); - return false; - } - - char *distStr = strtok(NULL, " "); - - float dist = 0; - - if (distStr) - sscanf(distStr, "%f", &dist); - - char* trig_str = strtok(NULL, " "); - if (trig_str) - { - int l = strlen(trig_str); - if (strncmp(trig_str, "triggered", l) != 0) - return false; - } - - bool triggered = (trig_str != NULL); - - float x, y, z; - m_session->GetPlayer()->GetClosePoint(x, y, z, dist); - - m_session->GetPlayer()->CastSpell(x, y, z, spell, triggered); - return true; -} - -bool ChatHandler::HandleCastTargetCommand(const char *args) -{ - Creature* caster = getSelectedCreature(); - - if (!caster) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - if (!caster->getVictim()) - { - SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM); - SetSentErrorMessage(true); - return false; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spell = extractSpellIdFromLink((char*)args); - if (!spell || !sSpellMgr->GetSpellInfo(spell)) - { - PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); - SetSentErrorMessage(true); - return false; - } - - char* trig_str = strtok(NULL, " "); - if (trig_str) - { - int l = strlen(trig_str); - if (strncmp(trig_str, "triggered", l) != 0) - return false; - } - - bool triggered = (trig_str != NULL); - - caster->CastSpell(caster->getVictim(), spell, triggered); - - return true; -} - -bool ChatHandler::HandleCastDestCommand(const char *args) -{ - Unit* caster = getSelectedUnit(); - if (!caster) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spell = extractSpellIdFromLink((char*)args); - if (!spell || !sSpellMgr->GetSpellInfo(spell)) - { - PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); - SetSentErrorMessage(true); - return false; - } - - char* px = strtok(NULL, " "); - char* py = strtok(NULL, " "); - char* pz = strtok(NULL, " "); - - if (!px || !py || !pz) - return false; - - float x = (float)atof(px); - float y = (float)atof(py); - float z = (float)atof(pz); - - char* trig_str = strtok(NULL, " "); - if (trig_str) - { - int l = strlen(trig_str); - if (strncmp(trig_str, "triggered", l) != 0) - return false; - } - - bool triggered = (trig_str != NULL); - - caster->CastSpell(x, y, z, spell, triggered); - - return true; -} - /* ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator Without this function 3rd party scripting library will get linking errors (unresolved external) @@ -4061,41 +3840,6 @@ bool ChatHandler::HandleComeToMeCommand(const char *args) return true; } -bool ChatHandler::HandleCastSelfCommand(const char *args) -{ - if (!*args) - return false; - - Unit* target = getSelectedUnit(); - - if (!target) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spell = extractSpellIdFromLink((char*)args); - if (!spell) - return false; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell); - if (!spellInfo) - return false; - - if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer())) - { - PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell); - SetSentErrorMessage(true); - return false; - } - - target->CastSpell(target, spell, false); - - return true; -} - /// Define the 'Message of the day' for the realm bool ChatHandler::HandleServerSetMotdCommand(const char *args) { diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index a1a23ca7074..8bc4ce24665 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -46,6 +46,7 @@ void AddSC_SmartSCripts(); //Commands void AddSC_account_commandscript(); void AddSC_achievement_commandscript(); +void AddSC_cast_commandscript(); void AddSC_debug_commandscript(); void AddSC_event_commandscript(); void AddSC_gm_commandscript(); @@ -649,6 +650,7 @@ void AddCommandScripts() { AddSC_account_commandscript(); AddSC_achievement_commandscript(); + AddSC_cast_commandscript(); AddSC_debug_commandscript(); AddSC_event_commandscript(); AddSC_gm_commandscript(); diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 867d54a3cc6..77d42ac5fd1 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -12,6 +12,7 @@ set(scripts_STAT_SRCS ${scripts_STAT_SRCS} Commands/cs_account.cpp Commands/cs_achievement.cpp + Commands/cs_cast.cpp Commands/cs_debug.cpp Commands/cs_event.cpp Commands/cs_gm.cpp @@ -33,7 +34,6 @@ set(scripts_STAT_SRCS # Commands/cs_lookup.cpp # Commands/cs_pdump.cpp # Commands/cs_guild.cpp -# Commands/cs_cast.cpp # Commands/cs_reset.cpp # Commands/cs_server.cpp # Commands/cs_channel.cpp diff --git a/src/server/scripts/Commands/cs_cast.cpp b/src/server/scripts/Commands/cs_cast.cpp new file mode 100644 index 00000000000..33983411427 --- /dev/null +++ b/src/server/scripts/Commands/cs_cast.cpp @@ -0,0 +1,310 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: cast_commandscript +%Complete: 100 +Comment: All cast related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" + +class cast_commandscript : public CommandScript +{ +public: + cast_commandscript() : CommandScript("cast_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand castCommandTable[] = + { + { "back", SEC_ADMINISTRATOR, false, &HandleCastBackCommand, "", NULL }, + { "dist", SEC_ADMINISTRATOR, false, &HandleCastDistCommand, "", NULL }, + { "self", SEC_ADMINISTRATOR, false, &HandleCastSelfCommand, "", NULL }, + { "target", SEC_ADMINISTRATOR, false, &HandleCastTargetCommad, "", NULL }, + { "dest", SEC_ADMINISTRATOR, false, &HandleCastDestCommand, "", NULL }, + { "", SEC_ADMINISTRATOR, false, &HandleCastCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleCastCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Unit* target = handler->getSelectedUnit(); + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId) + return false; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo) + { + handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + handler->SetSentErrorMessage(true); + return false; + } + + if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer())) + { + handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); + handler->SetSentErrorMessage(true); + return false; + } + + char* triggeredStr = strtok(NULL, " "); + if (triggeredStr) + { + int l = strlen(triggeredStr); + if (strncmp(triggeredStr, "triggered", l) != 0) + return false; + } + + bool triggered = (triggeredStr != NULL); + + handler->GetSession()->GetPlayer()->CastSpell(target, spellId, triggered); + + return true; + } + + static bool HandleCastBackCommand(ChatHandler* handler, char const* args) + { + Creature* caster = handler->getSelectedCreature(); + if (!caster) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) + { + handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + handler->SetSentErrorMessage(true); + return false; + } + + char* triggeredStr = strtok(NULL, " "); + if (triggeredStr) + { + int l = strlen(triggeredStr); + if (strncmp(triggeredStr, "triggered", l) != 0) + return false; + } + + bool triggered = (triggeredStr != NULL); + + caster->CastSpell(handler->GetSession()->GetPlayer(), spellId, triggered); + + return true; + } + + static bool HandleCastDistCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId) + return false; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo) + { + handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + handler->SetSentErrorMessage(true); + return false; + } + + if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer())) + { + handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); + handler->SetSentErrorMessage(true); + return false; + } + + char* distStr = strtok(NULL, " "); + + float dist = 0; + + if (distStr) + sscanf(distStr, "%f", &dist); + + char* triggeredStr = strtok(NULL, " "); + if (triggeredStr) + { + int l = strlen(triggeredStr); + if (strncmp(triggeredStr, "triggered", l) != 0) + return false; + } + + bool triggered = (triggeredStr != NULL); + + float x, y, z; + handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist); + + handler->GetSession()->GetPlayer()->CastSpell(x, y, z, spellId, triggered); + + return true; + } + + static bool HandleCastSelfCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Unit* target = handler->getSelectedUnit(); + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId) + return false; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo) + return false; + + if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer())) + { + handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); + handler->SetSentErrorMessage(true); + return false; + } + + target->CastSpell(target, spellId, false); + + return true; + } + + static bool HandleCastTargetCommad(ChatHandler* handler, char const* args) + { + Creature* caster = handler->getSelectedCreature(); + if (!caster) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (!caster->getVictim()) + { + handler->SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM); + handler->SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) + { + handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + handler->SetSentErrorMessage(true); + return false; + } + + char* triggeredStr = strtok(NULL, " "); + if (triggeredStr) + { + int l = strlen(triggeredStr); + if (strncmp(triggeredStr, "triggered", l) != 0) + return false; + } + + bool triggered = (triggeredStr != NULL); + + caster->CastSpell(caster->getVictim(), spellId, triggered); + + return true; + } + + static bool HandleCastDestCommand(ChatHandler* handler, char const* args) + { + Unit* caster = handler->getSelectedUnit(); + if (!caster) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) + { + handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + handler->SetSentErrorMessage(true); + return false; + } + + char* posX = strtok(NULL, " "); + char* posY = strtok(NULL, " "); + char* posZ = strtok(NULL, " "); + + if (!posX || !posY || !posZ) + return false; + + float x = float(atof(posX)); + float y = float(atof(posY)); + float z = float(atof(posZ)); + + char* triggeredStr = strtok(NULL, " "); + if (triggeredStr) + { + int l = strlen(triggeredStr); + if (strncmp(triggeredStr, "triggered", l) != 0) + return false; + } + + bool triggered = (triggeredStr != NULL); + + caster->CastSpell(x, y, z, spellId, triggered); + + return true; + } +}; + +void AddSC_cast_commandscript() +{ + new cast_commandscript(); +} -- cgit v1.2.3 From 35b444fdb8e1be43c261b23bbeb8a94cefada93a Mon Sep 17 00:00:00 2001 From: Elron103 Date: Wed, 20 Jun 2012 01:52:31 +0200 Subject: Core/Movement: Implement speed changes for PointMovementGenerator --- .../Movement/MovementGenerators/PointMovementGenerator.cpp | 12 ++++++++++++ .../Movement/MovementGenerators/PointMovementGenerator.h | 3 +++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index a922c937b5f..0496d0862af 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -33,6 +33,7 @@ void PointMovementGenerator::Initialize(T &unit) unit.StopMoving(); unit.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); + i_recalculateSpeed = false; Movement::MoveSplineInit init(unit); init.MoveTo(i_x, i_y, i_z); if (speed > 0.0f) @@ -53,6 +54,17 @@ bool PointMovementGenerator::Update(T &unit, const uint32 & /*diff*/) } unit.AddUnitState(UNIT_STATE_ROAMING_MOVE); + + if (i_recalculateSpeed && !unit.movespline->Finalized()) + { + i_recalculateSpeed = false; + Movement::MoveSplineInit init(unit); + init.MoveTo(i_x, i_y, i_z); + if (speed > 0.0f) // Default value for point motion type is 0.0, if 0.0 spline will use GetSpeed on unit + init.SetVelocity(speed); + init.Launch(); + } + return !unit.movespline->Finalized(); } diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h index 13be9fee77b..d2833a5ee10 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h @@ -36,6 +36,8 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG void MovementInform(T &); + void unitSpeedChanged() { i_recalculateSpeed = true; } + MovementGeneratorType GetMovementGeneratorType() { return POINT_MOTION_TYPE; } bool GetDestination(float& x, float& y, float& z) const { x=i_x; y=i_y; z=i_z; return true; } @@ -43,6 +45,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG uint32 id; float i_x, i_y, i_z; float speed; + bool i_recalculateSpeed; }; class AssistanceMovementGenerator : public PointMovementGenerator -- cgit v1.2.3 From ab3430762d965f84717fdf7a18e2cbc2271c436a Mon Sep 17 00:00:00 2001 From: Malcrom Date: Wed, 20 Jun 2012 12:39:34 -0230 Subject: DB/Gossip: Some gossip updates from pitcrawler and remove old cpp script he replaced in last commit. Also a couple little fixes of my own. Closes #6866 Closes #6862 Closes #6842 --- sql/updates/world/2012_06_20_00_world_gossip.sql | 132 +++++++++++++++++++++++ src/server/scripts/Kalimdor/dustwallow_marsh.cpp | 108 ------------------- 2 files changed, 132 insertions(+), 108 deletions(-) create mode 100644 sql/updates/world/2012_06_20_00_world_gossip.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_20_00_world_gossip.sql b/sql/updates/world/2012_06_20_00_world_gossip.sql new file mode 100644 index 00000000000..b4d61887223 --- /dev/null +++ b/sql/updates/world/2012_06_20_00_world_gossip.sql @@ -0,0 +1,132 @@ +-- Insert npc_text from sniff +DELETE FROM `npc_text` WHERE `ID`=11428; +INSERT INTO `npc_text` (`ID`,`text0_0`,`text0_1`,`lang0`,`prob0`,`em0_0`,`em0_1`,`em0_2`,`em0_3`,`em0_4`,`em0_5`,`text1_0`,`text1_1`,`lang1`,`prob1`,`em1_0`,`em1_1`,`em1_2`,`em1_3`,`em1_4`,`em1_5`,`text2_0`,`text2_1`,`lang2`,`prob2`,`em2_0`,`em2_1`,`em2_2`,`em2_3`,`em2_4`,`em2_5`,`text3_0`,`text3_1`,`lang3`,`prob3`,`em3_0`,`em3_1`,`em3_2`,`em3_3`,`em3_4`,`em3_5`,`text4_0`,`text4_1`,`lang4`,`prob4`,`em4_0`,`em4_1`,`em4_2`,`em4_3`,`em4_4`,`em4_5`,`text5_0`,`text5_1`,`lang5`,`prob5`,`em5_0`,`em5_1`,`em5_2`,`em5_3`,`em5_4`,`em5_5`,`text6_0`,`text6_1`,`lang6`,`prob6`,`em6_0`,`em6_1`,`em6_2`,`em6_3`,`em6_4`,`em6_5`,`text7_0`,`text7_1`,`lang7`,`prob7`,`em7_0`,`em7_1`,`em7_2`,`em7_3`,`em7_4`,`em7_5`,`WDBVerified`) VALUES +(11428,'Are you here to relieve me? I''m certain it''s almost time. Well, if you want to relieve me anyway, let me know. I could use a drink or three.','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,12340); + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=23567; +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=23602; + +-- Creature Gossip_menu_id Update from sniff +UPDATE `creature_template` SET `gossip_menu_id`=7981 WHERE `entry`=19217; -- Ravandwyr +UPDATE `creature_template` SET `gossip_menu_id`=7996 WHERE `entry`=19488; -- Custodian Dieworth +UPDATE `creature_template` SET `gossip_menu_id`=7995 WHERE `entry`=19489; -- Lieutenant-Sorcerer Morran +UPDATE `creature_template` SET `gossip_menu_id`=7991 WHERE `entry`=19569; -- Netherologist Coppernickels +UPDATE `creature_template` SET `gossip_menu_id`=7994 WHERE `entry`=19578; -- Bot-Specialist Alley +UPDATE `creature_template` SET `gossip_menu_id`=8001 WHERE `entry`=19617; -- Boots +UPDATE `creature_template` SET `gossip_menu_id`=8003 WHERE `entry`=19634; -- Lead Sapper Blastfizzle +UPDATE `creature_template` SET `gossip_menu_id`=8024 WHERE `entry`=19644; -- Image of Archmage Vargoth +UPDATE `creature_template` SET `gossip_menu_id`=8008 WHERE `entry`=19645; -- Papa Wheeler +UPDATE `creature_template` SET `gossip_menu_id`=8030 WHERE `entry`=19709; -- Chief Engineer Trep +UPDATE `creature_template` SET `gossip_menu_id`=8032 WHERE `entry`=19728; -- Mama Wheeler +UPDATE `creature_template` SET `gossip_menu_id`=8048 WHERE `entry`=19880; -- Nether-Stalker Khay'ji +UPDATE `creature_template` SET `gossip_menu_id`=8054 WHERE `entry`=20066; -- Gahruj +UPDATE `creature_template` SET `gossip_menu_id`=8055 WHERE `entry`=20067; -- Zuben Elgenubi +UPDATE `creature_template` SET `gossip_menu_id`=8056 WHERE `entry`=20068; -- Zuben Eschamali +UPDATE `creature_template` SET `gossip_menu_id`=8071 WHERE `entry`=20071; -- Wind Trader Marid +UPDATE `creature_template` SET `gossip_menu_id`=8063 WHERE `entry`=20092; -- Dealer Hazzin +UPDATE `creature_template` SET `gossip_menu_id`=8068 WHERE `entry`=20110; -- Tyri +UPDATE `creature_template` SET `gossip_menu_id`=8070 WHERE `entry`=20112; -- Wind Trader Tuluman +UPDATE `creature_template` SET `gossip_menu_id`=8084 WHERE `entry`=20194; -- Dealer Dunar +UPDATE `creature_template` SET `gossip_menu_id`=8101 WHERE `entry`=20281; -- Drijya +UPDATE `creature_template` SET `gossip_menu_id`=8106 WHERE `entry`=20389; -- Lee Sparks +UPDATE `creature_template` SET `gossip_menu_id`=8107 WHERE `entry`=20393; -- Foreman Sundown +UPDATE `creature_template` SET `gossip_menu_id`=8120 WHERE `entry`=20448; -- Commander Ameer +UPDATE `creature_template` SET `gossip_menu_id`=8180 WHERE `entry`=20449; -- Researcher Navuud +UPDATE `creature_template` SET `gossip_menu_id`=8183 WHERE `entry`=20450; -- Flesh Handler Viridius +UPDATE `creature_template` SET `gossip_menu_id`=8126 WHERE `entry`=20463; -- Apprentice Andrethan +UPDATE `creature_template` SET `gossip_menu_id`=8128 WHERE `entry`=20551; -- Agent Araxes +UPDATE `creature_template` SET `gossip_menu_id`=8231 WHERE `entry`=20810; -- Mehrdad +UPDATE `creature_template` SET `gossip_menu_id`=8229 WHERE `entry`=20903; -- Protectorate Nether Drake +UPDATE `creature_template` SET `gossip_menu_id`=8207 WHERE `entry`=20907; -- Professor Dabiri +UPDATE `creature_template` SET `gossip_menu_id`=8228 WHERE `entry`=20985; -- Captain Saeed +UPDATE `creature_template` SET `gossip_menu_id`=8308 WHERE `entry`=21493; -- Kablamm Farflinger +UPDATE `creature_template` SET `gossip_menu_id`=8542 WHERE `entry`=22427; -- Zarevhi +UPDATE `creature_template` SET `gossip_menu_id`=8710 WHERE `entry`=23396; -- Krixel Pinchwhistle +UPDATE `creature_template` SET `gossip_menu_id`=9781 WHERE `entry`=29145; -- Pulik Swiftsnip + +-- Gossip Menu insert from sniff +DELETE FROM `gossip_menu` WHERE `entry`=7981 AND `text_id` IN (9826,9828); +DELETE FROM `gossip_menu` WHERE `entry`=7991 AND `text_id`=9841; +DELETE FROM `gossip_menu` WHERE `entry`=7994 AND `text_id`=9846; +DELETE FROM `gossip_menu` WHERE `entry`=7995 AND `text_id`=9847; +DELETE FROM `gossip_menu` WHERE `entry`=7996 AND `text_id`=9848; +DELETE FROM `gossip_menu` WHERE `entry`=8001 AND `text_id`=9863; +DELETE FROM `gossip_menu` WHERE `entry`=8003 AND `text_id`=9869; +DELETE FROM `gossip_menu` WHERE `entry`=8008 AND `text_id`=9875; +DELETE FROM `gossip_menu` WHERE `entry`=8024 AND `text_id`=9901; +DELETE FROM `gossip_menu` WHERE `entry`=8030 AND `text_id`=9916; +DELETE FROM `gossip_menu` WHERE `entry`=8032 AND `text_id`=9919; +DELETE FROM `gossip_menu` WHERE `entry`=8048 AND `text_id`=9937; +DELETE FROM `gossip_menu` WHERE `entry`=8054 AND `text_id`=9947; +DELETE FROM `gossip_menu` WHERE `entry`=8055 AND `text_id`=9948; +DELETE FROM `gossip_menu` WHERE `entry`=8056 AND `text_id`=9949; +DELETE FROM `gossip_menu` WHERE `entry`=8063 AND `text_id`=9959; +DELETE FROM `gossip_menu` WHERE `entry`=8068 AND `text_id`=9968; +DELETE FROM `gossip_menu` WHERE `entry`=8070 AND `text_id`=9970; +DELETE FROM `gossip_menu` WHERE `entry`=8071 AND `text_id`=9971; +DELETE FROM `gossip_menu` WHERE `entry`=8084 AND `text_id`=9994; +DELETE FROM `gossip_menu` WHERE `entry`=8101 AND `text_id`=10019; +DELETE FROM `gossip_menu` WHERE `entry`=8106 AND `text_id`=10031; +DELETE FROM `gossip_menu` WHERE `entry`=8107 AND `text_id`=10032; +DELETE FROM `gossip_menu` WHERE `entry`=8120 AND `text_id`=10058; +DELETE FROM `gossip_menu` WHERE `entry`=8121 AND `text_id`=10061; +DELETE FROM `gossip_menu` WHERE `entry`=8122 AND `text_id`=10060; +DELETE FROM `gossip_menu` WHERE `entry`=8123 AND `text_id`=10059; +DELETE FROM `gossip_menu` WHERE `entry`=8126 AND `text_id`=10064; +DELETE FROM `gossip_menu` WHERE `entry`=8128 AND `text_id`=10065; +DELETE FROM `gossip_menu` WHERE `entry`=8180 AND `text_id`=10152; +DELETE FROM `gossip_menu` WHERE `entry`=8183 AND `text_id`=10179; +DELETE FROM `gossip_menu` WHERE `entry`=8207 AND `text_id`=10202; +DELETE FROM `gossip_menu` WHERE `entry`=8228 AND `text_id`=10229; +DELETE FROM `gossip_menu` WHERE `entry`=8229 AND `text_id`=10230; +DELETE FROM `gossip_menu` WHERE `entry`=8231 AND `text_id`=10233; +DELETE FROM `gossip_menu` WHERE `entry`=8308 AND `text_id`=10365; +DELETE FROM `gossip_menu` WHERE `entry`=8542 AND `text_id`=10687; +DELETE FROM `gossip_menu` WHERE `entry`=8710 AND `text_id`=10957; +DELETE FROM `gossip_menu` WHERE `entry`=9781 AND `text_id`=13459; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(7981,9828),(7981, 9826),(7991,9841),(7994,9846),(7995,9847), +(7996,9848),(8001,9863),(8003,9869),(8008,9875),(8024,9901), +(8030,9916),(8032,9919),(8048,9937),(8054,9947),(8055,9948), +(8056,9949),(8063,9959),(8068,9968),(8070,9970),(8071,9971), +(8084,9994),(8101,10019),(8106,10031),(8107,10032),(8120,10058), +(8121,10061),(8122,10060),(8123,10059),(8126,10064),(8128,10065), +(8180,10152),(8183,10179),(8207,10202),(8228,10229),(8229,10230), +(8231,10233),(8308,10365),(8542,10687),(8710,10957),(9781,13459); + +-- Insert npc_text from sniff +DELETE FROM `npc_text` WHERE `ID` IN (10059,10061); +INSERT INTO `npc_text` (`ID`,`text0_0`,`text0_1`,`lang0`,`prob0`,`em0_0`,`em0_1`,`em0_2`,`em0_3`,`em0_4`,`em0_5`,`text1_0`,`text1_1`,`lang1`,`prob1`,`em1_0`,`em1_1`,`em1_2`,`em1_3`,`em1_4`,`em1_5`,`text2_0`,`text2_1`,`lang2`,`prob2`,`em2_0`,`em2_1`,`em2_2`,`em2_3`,`em2_4`,`em2_5`,`text3_0`,`text3_1`,`lang3`,`prob3`,`em3_0`,`em3_1`,`em3_2`,`em3_3`,`em3_4`,`em3_5`,`text4_0`,`text4_1`,`lang4`,`prob4`,`em4_0`,`em4_1`,`em4_2`,`em4_3`,`em4_4`,`em4_5`,`text5_0`,`text5_1`,`lang5`,`prob5`,`em5_0`,`em5_1`,`em5_2`,`em5_3`,`em5_4`,`em5_5`,`text6_0`,`text6_1`,`lang6`,`prob6`,`em6_0`,`em6_1`,`em6_2`,`em6_3`,`em6_4`,`em6_5`,`text7_0`,`text7_1`,`lang7`,`prob7`,`em7_0`,`em7_1`,`em7_2`,`em7_3`,`em7_4`,`em7_5`,`WDBVerified`) VALUES +(10059,'The Ethereum were the ruling class of ethereal on my homeworld of K''aresh. Tragically, we were forced to evacuate K''aresh shortly before the void lord, Dimensius, unleashed his void armies upon the world and utterly decimated all that stood in his way. For this act, the Ethereum vowed vengeance. They have been tracking Dimensius ever since...$B$BThe Protectorate, however, were not a reaction to Dimensius. We were a reaction to Ethereum.','',0,1,0,1,0,1,0,1,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,1,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,12340), +(10061,'We feel that the Ethereum are as great a threat to our existence as Dimensius. Both must be stopped...','',0,1,0,1,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,12340); + +-- Creature Gossip_menu_option insert from sniff +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (8001,8063,8070,8084,8103,8120,8121,8122,8123,8126,8710) AND `id`=0; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(8001, 0, 1, 'Boots, what do you have back there that goes down smooth?', 3, 128, 0, 0, 0, 0, ''), +(8063, 0, 1, 'Dealer Hazzin, what do you have to offer?', 3, 128, 0, 0, 0, 0, ''), +(8070, 0, 1, 'What do you have to sell, Tuluman?', 3, 128, 0, 0, 0, 0, ''), +(8084, 0, 1, 'Dealer Dunar, I wish to browse your wares.', 3, 128, 0, 0, 0, 0, ''), +(8103, 0, 5, 'Make this inn your home.', 8, 65536, 0, 0, 0, 0, ''), +(8120, 0, 0, 'What are Ethereum?', 1, 1, 8123, 0, 0, 0, ''), +(8121, 0, 0, 'I think I understand now. Can I help with any of this? The Ethereum and void creatures are a threat to our survival as well.', 1, 1, 8120, 0, 0, 0, ''), +(8122, 0, 0, 'So what is your purpose?', 1, 1, 8121, 0, 0, 0, ''), +(8123, 0, 0, 'I don''t understand. What do you mean, Ameer?', 1, 1, 8122, 0, 0, 0, ''), +(8126, 0, 1, 'I wish to browse your wares.', 3, 128, 0, 0, 0, 0, ''), +(8710, 0, 1, 'Let me browse your goods.', 3, 128, 0, 0, 0, 0, ''); + +-- Conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=7981 AND `SourceEntry`=9828; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(14,7981,9828,0,0,9,0,10173,0,0,0,0,'','Ravandwyr - Show different gossip if player has taken quest 10173'); + +-- Remove some old script text +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000649 AND -1000641; + +-- Add missing loot +DELETE FROM `creature_loot_template` WHERE `entry`=30524 AND `item`=35490; +INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +(30524,35490,-100,1,0,1,1); + +-- Add a missing gossip +UPDATE `creature_template` SET `gossip_menu_id`=1100 WHERE `entry`=4963; diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 45e1c1808c1..0aeb3c3ac11 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -25,7 +25,6 @@ EndScriptData */ /* ContentData mobs_risen_husk_spirit -npc_deserter_agitator npc_lady_jaina_proudmoore npc_nat_pagle npc_private_hendel @@ -217,112 +216,6 @@ public: }; }; -/*###### -## npc_deserter_agitator -######*/ - -enum TheramoreGuard -{ - SAY_QUEST1 = -1000641, - SAY_QUEST2 = -1000642, - SAY_QUEST3 = -1000643, - SAY_QUEST4 = -1000644, - SAY_QUEST5 = -1000645, - SAY_QUEST6 = -1000646, - SAY_QUEST7 = -1000647, - SAY_QUEST8 = -1000648, - SAY_QUEST9 = -1000649, - - QUEST_DISCREDITING_THE_DESERTERS = 11133, - - NPC_THERAMORE_GUARD = 4979, - - SPELL_DOCTORED_LEAFLET = 42725, - SPELL_PROPAGANDIZED = 42246, -}; - -#define GOSSIP_ITEM_THERAMORE_GUARD "You look like an intelligent person. Why don't you read one of these leaflets and give it some thought?" - -class npc_theramore_guard : public CreatureScript -{ -public: - npc_theramore_guard() : CreatureScript("npc_theramore_guard") { } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (player->GetQuestStatus(QUEST_DISCREDITING_THE_DESERTERS) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THERAMORE_GUARD, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - - if (action == GOSSIP_SENDER_INFO) - { - player->CLOSE_GOSSIP_MENU(); - player->KilledMonsterCredit(NPC_THERAMORE_GUARD, 0); - DoScriptText(SAY_QUEST1, creature); - creature->CastSpell(creature, SPELL_DOCTORED_LEAFLET, false); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->YellTimer = 4000; - CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->bYellTimer = true; - } - - return true; - } - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_theramore_guardAI(creature); - } - - struct npc_theramore_guardAI : public ScriptedAI - { - npc_theramore_guardAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 YellTimer; - uint32 Step; - bool bYellTimer; - - void Reset() - { - bYellTimer = false; - Step = 0; - } - - void UpdateAI(const uint32 Diff) - { - if (!me->HasAura(SPELL_PROPAGANDIZED)) - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - - if (bYellTimer && YellTimer <= Diff) - { - switch (Step) - { - case 0: - DoScriptText(RAND(SAY_QUEST2, SAY_QUEST3, SAY_QUEST4, SAY_QUEST5, SAY_QUEST6), me); - YellTimer = 3000; - ++Step; - break; - case 1: - DoScriptText(RAND(SAY_QUEST7, SAY_QUEST8, SAY_QUEST9), me); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - Step = 0; - bYellTimer = false; - break; - } - } - else - YellTimer -= Diff; - } - }; -}; - /*###### ## npc_lady_jaina_proudmoore ######*/ @@ -865,7 +758,6 @@ void AddSC_dustwallow_marsh() new npc_zelfrax(); new npc_stinky(); new npc_theramore_guard(); - new npc_deserter_agitator(); new spell_ooze_zap(); new spell_ooze_zap_channel_end(); new spell_energize_aoe(); -- cgit v1.2.3 From ef4d9dd4ae188aeabe19388f0cad7543dae3c907 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 20 Jun 2012 18:06:29 +0200 Subject: Core/Spells: * Fix bloodthirst Heal * Move bloodthirst damage calculation in Spell script * Fix some codestyle --- src/server/game/Entities/Unit/Unit.cpp | 6 --- src/server/game/Spells/SpellEffects.cpp | 5 +-- src/server/scripts/Spells/spell_pet.cpp | 2 +- src/server/scripts/Spells/spell_warrior.cpp | 59 +++++++++++++++++++---------- 4 files changed, 41 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 50c8920a0d3..d8e7e1c9717 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8865,12 +8865,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg CastSpell(this, 70721, true); break; } - // Bloodthirst (($m/100)% of max health) - case 23880: - { - basepoints0 = int32(CountPctFromMaxHealth(triggerAmount)); - break; - } // Shamanistic Rage triggered spell case 30824: { diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index b4a1ba19a08..84c1401bb5b 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -365,11 +365,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) } case SPELLFAMILY_WARRIOR: { - // Bloodthirst - if (m_spellInfo->SpellFamilyFlags[1] & 0x400) - ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); // Shield Slam - else if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209) + if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209) { uint8 level = m_caster->getLevel(); uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 24.5f), uint32(float(level) * 34.5f)); diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 78bdbb7f127..7830d46260c 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -1,4 +1,4 @@ - /* +/* * Copyright (C) 2008-2012 TrinityCore * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index f1276c24a75..463b9b2fb97 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -397,7 +397,20 @@ class spell_warr_bloodthirst : public SpellScriptLoader { PrepareSpellScript(spell_warr_bloodthirst_SpellScript); - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleDamage(SpellEffIndex /*effIndex*/) + { + int32 damage = GetEffectValue(); + ApplyPctF(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)); + + if (Unit* target = GetHitUnit()) + { + damage = GetCaster()->SpellDamageBonusDone(target, GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE); + damage = target->SpellDamageBonusTaken(GetCaster(), GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE); + } + SetHitDamage(damage); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); GetCaster()->CastCustomSpell(GetCaster(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL); @@ -405,6 +418,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader void Register() { + OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); OnEffectHit += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); } }; @@ -415,31 +429,36 @@ class spell_warr_bloodthirst : public SpellScriptLoader } }; -class spell_warr_bloodthirst_heal : public SpellScriptLoader +enum BloodthirstHeal { -public: - spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { } + SPELL_BLOODTHIRST_DAMAGE = 23881, +}; - class spell_warr_bloodthirst_heal_SpellScript : public SpellScript - { - PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript); +class spell_warr_bloodthirst_heal : public SpellScriptLoader +{ + public: + spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { } - void HandleHeal(SpellEffIndex /* effIndex */) + class spell_warr_bloodthirst_heal_SpellScript : public SpellScript { - if (GetTriggeringSpell()) - SetHitHeal(CalculatePctN(GetCaster()->GetMaxHealth(),GetTriggeringSpell()->Effects[EFFECT_1].CalcValue())); - } + PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript); - void Register() + void HandleHeal(SpellEffIndex /*effIndex*/) + { + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_BLOODTHIRST_DAMAGE)) + SetHitHeal(GetCaster()->CountPctFromMaxHealth(spellInfo->Effects[EFFECT_1].CalcValue(GetCaster()))); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + return new spell_warr_bloodthirst_heal_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_warr_bloodthirst_heal_SpellScript(); - } }; enum Overpower @@ -498,6 +517,6 @@ void AddSC_warrior_spell_scripts() new spell_warr_execute(); new spell_warr_concussion_blow(); new spell_warr_bloodthirst(); - new spell_warr_overpower(); new spell_warr_bloodthirst_heal(); + new spell_warr_overpower(); } -- cgit v1.2.3 From 66c9973d44faededc8597bb1a3af9d657577c1f5 Mon Sep 17 00:00:00 2001 From: Nay Date: Wed, 20 Jun 2012 17:17:34 +0100 Subject: Fix build, replace script that should have been removed --- src/server/scripts/Kalimdor/dustwallow_marsh.cpp | 100 ++++++++++++++--------- 1 file changed, 60 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 0aeb3c3ac11..397b0849d5e 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -131,28 +131,40 @@ class mobs_risen_husk_spirit : public CreatureScript }; /*###### -## npc_deserter_agitator +## npc_theramor_guard ######*/ -enum Deserter +enum TheramoreGuard { - QUEST_TRAITORS_AMONG_US = 11126, - NPC_THERAMORE_DESERTER = 23602, + SAY_QUEST1 = -1000641, + SAY_QUEST2 = -1000642, + SAY_QUEST3 = -1000643, + SAY_QUEST4 = -1000644, + SAY_QUEST5 = -1000645, + SAY_QUEST6 = -1000646, + SAY_QUEST7 = -1000647, + SAY_QUEST8 = -1000648, + SAY_QUEST9 = -1000649, + + QUEST_DISCREDITING_THE_DESERTERS = 11133, + + NPC_THERAMORE_GUARD = 4979, + + SPELL_DOCTORED_LEAFLET = 42725, + SPELL_PROPAGANDIZED = 42246, }; -const Position DeserterDisappearPos = {-3609.03f, -4332.91f, 9.39354f, 3.73862f}; +#define GOSSIP_ITEM_THERAMORE_GUARD "You look like an intelligent person. Why don't you read one of these leaflets and give it some thought?" -#define GOSSIP_ITEM_DESERTER "Your propaganda wont`t work on me. Spout your treasonous filth elsewhere traitor!" - -class npc_deserter_agitator : public CreatureScript +class npc_theramore_guard : public CreatureScript { public: - npc_deserter_agitator() : CreatureScript("npc_deserter_agitator") { } + npc_theramore_guard() : CreatureScript("npc_theramore_guard") { } bool OnGossipHello(Player* player, Creature* creature) { - if (player->GetQuestStatus(QUEST_TRAITORS_AMONG_US) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DESERTER, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); + if (player->GetQuestStatus(QUEST_DISCREDITING_THE_DESERTERS) == QUEST_STATUS_INCOMPLETE) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THERAMORE_GUARD, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); @@ -166,23 +178,12 @@ public: if (action == GOSSIP_SENDER_INFO) { player->CLOSE_GOSSIP_MENU(); - switch (urand(0, 1)) - { - case 0: - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - creature->setFaction(14); - creature->AI()->AttackStart(player); - break; - case 1: - player->KilledMonsterCredit(NPC_THERAMORE_DESERTER, 0); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - creature->SetSpeed(MOVE_RUN, creature->GetSpeedRate(MOVE_RUN), true); - creature->setFaction(35); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE); - creature->SetReactState(REACT_PASSIVE); - creature->GetMotionMaster()->MovePoint(1, DeserterDisappearPos); - break; - } + player->KilledMonsterCredit(NPC_THERAMORE_GUARD, 0); + DoScriptText(SAY_QUEST1, creature); + creature->CastSpell(creature, SPELL_DOCTORED_LEAFLET, false); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->YellTimer = 4000; + CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->bYellTimer = true; } return true; @@ -190,28 +191,47 @@ public: CreatureAI* GetAI(Creature* creature) const { - return new npc_deserter_agitatorAI(creature); + return new npc_theramore_guardAI(creature); } - struct npc_deserter_agitatorAI : public ScriptedAI + struct npc_theramore_guardAI : public ScriptedAI { - npc_deserter_agitatorAI(Creature* creature) : ScriptedAI(creature) { } + npc_theramore_guardAI(Creature* creature) : ScriptedAI(creature) { } + + uint32 YellTimer; + uint32 Step; + bool bYellTimer; void Reset() { - me->RestoreFaction(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + bYellTimer = false; + Step = 0; } - void MovementInform(uint32 Type, uint32 Id) + void UpdateAI(const uint32 Diff) { - if (Type != POINT_MOTION_TYPE) - return; + if (!me->HasAura(SPELL_PROPAGANDIZED)) + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if (Id == 1) - me->DisappearAndDie(); + if (bYellTimer && YellTimer <= Diff) + { + switch (Step) + { + case 0: + DoScriptText(RAND(SAY_QUEST2, SAY_QUEST3, SAY_QUEST4, SAY_QUEST5, SAY_QUEST6), me); + YellTimer = 3000; + ++Step; + break; + case 1: + DoScriptText(RAND(SAY_QUEST7, SAY_QUEST8, SAY_QUEST9), me); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); + Step = 0; + bYellTimer = false; + break; + } + } + else + YellTimer -= Diff; } }; }; -- cgit v1.2.3 From f3aacb669ca1ad3147bdcc1c541ebf3a7e2d7343 Mon Sep 17 00:00:00 2001 From: Elron103 Date: Wed, 20 Jun 2012 21:29:41 +0200 Subject: Scripts/Miscellaneous: Enable const-ness for various functions in ScriptedAI (Author: DorianGrey) - Improve codestyle, since objects internal state is not changed here - Make these functions available for inherited CanAIAttack() function --- src/server/game/AI/ScriptedAI/ScriptedCreature.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 4fac8b3cba5..ba0a94d2590 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -191,7 +191,7 @@ struct ScriptedAI : public CreatureAI //Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims void SetCombatMovement(bool allowMovement); - bool IsCombatMovementAllowed() { return _isCombatMovementAllowed; } + bool IsCombatMovementAllowed() const { return _isCombatMovementAllowed; } bool EnterEvadeIfOutOfCombatArea(uint32 const diff); @@ -200,16 +200,16 @@ struct ScriptedAI : public CreatureAI // - for raid in mode 10-Heroic // - for raid in mode 25-heroic // DO NOT USE to check raid in mode 25-normal. - bool IsHeroic() { return _isHeroic; } + bool IsHeroic() const { return _isHeroic; } // return the dungeon or raid difficulty - Difficulty GetDifficulty() { return _difficulty; } + Difficulty GetDifficulty() const { return _difficulty; } // return true for 25 man or 25 man heroic mode - bool Is25ManRaid() { return _difficulty & RAID_DIFFICULTY_MASK_25MAN; } + bool Is25ManRaid() const { return _difficulty & RAID_DIFFICULTY_MASK_25MAN; } template inline - const T& DUNGEON_MODE(const T& normal5, const T& heroic10) + const T& DUNGEON_MODE(const T& normal5, const T& heroic10) const { switch (_difficulty) { @@ -225,7 +225,7 @@ struct ScriptedAI : public CreatureAI } template inline - const T& RAID_MODE(const T& normal10, const T& normal25) + const T& RAID_MODE(const T& normal10, const T& normal25) const { switch (_difficulty) { @@ -241,7 +241,7 @@ struct ScriptedAI : public CreatureAI } template inline - const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25) + const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25) const { switch (_difficulty) { -- cgit v1.2.3 From a312cd4ba1f47d3dceb774091ec143c90a298cda Mon Sep 17 00:00:00 2001 From: Xees Date: Wed, 20 Jun 2012 23:28:16 +0100 Subject: Scripts/Commands: Convert character and server commands to commandscript Closes #6856 Signed-off-by: Nay --- src/server/game/Chat/Chat.cpp | 79 --- src/server/game/Chat/Chat.h | 59 +- src/server/game/Chat/Commands/Level0.cpp | 30 - src/server/game/Chat/Commands/Level2.cpp | 231 ------- src/server/game/Chat/Commands/Level3.cpp | 266 -------- src/server/game/Scripting/ScriptLoader.cpp | 4 + src/server/scripts/Commands/CMakeLists.txt | 3 +- src/server/scripts/Commands/cs_character.cpp | 680 +++++++++++++++++++++ src/server/scripts/Commands/cs_server.cpp | 430 +++++++++++++ src/server/scripts/Kalimdor/ashenvale.cpp | 6 +- src/server/worldserver/CommandLine/CliRunnable.cpp | 452 -------------- 11 files changed, 1126 insertions(+), 1114 deletions(-) create mode 100644 src/server/scripts/Commands/cs_character.cpp create mode 100644 src/server/scripts/Commands/cs_server.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 7d23b14110b..f96199f9bd3 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -92,29 +92,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand characterDeletedCommandTable[] = - { - { "delete", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleCharacterDeletedDeleteCommand>, "", NULL }, - { "list", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleCharacterDeletedListCommand>, "", NULL }, - { "restore", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleCharacterDeletedRestoreCommand>, "", NULL }, - { "old", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleCharacterDeletedOldCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand characterCommandTable[] = - { - { "customize", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterCustomizeCommand>, "", NULL }, - { "changefaction", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterChangeFactionCommand>, "", NULL }, - { "changerace", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterChangeRaceCommand>, "", NULL }, - { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable}, - { "erase", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleCharacterEraseCommand>, "", NULL }, - { "level", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleCharacterLevelCommand>, "", NULL }, - { "rename", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterRenameCommand>, "", NULL }, - { "reputation", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterReputationCommand>, "", NULL }, - { "titles", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterTitlesCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand channelSetCommandTable[] = { { "ownership", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleChannelSetOwnership>, "", NULL }, @@ -218,60 +195,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverIdleRestartCommandTable[] = - { - { "cancel", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCancelCommand>, "", NULL }, - { "" , SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerIdleRestartCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand serverIdleShutdownCommandTable[] = - { - { "cancel", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCancelCommand>, "", NULL }, - { "" , SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerIdleShutDownCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand serverRestartCommandTable[] = - { - { "cancel", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCancelCommand>, "", NULL }, - { "" , SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerRestartCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand serverShutdownCommandTable[] = - { - { "cancel", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCancelCommand>, "", NULL }, - { "" , SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand serverSetCommandTable[] = - { - { "difftime", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerSetDiffTimeCommand>, "", NULL }, - { "loglevel", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerSetLogLevelCommand>, "", NULL }, - { "logfilelevel", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerSetLogFileLevelCommand>, "", NULL }, - { "motd", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerSetMotdCommand>, "", NULL }, - { "closed", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerSetClosedCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand serverCommandTable[] = - { - { "corpses", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleServerCorpsesCommand>, "", NULL }, - { "exit", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerExitCommand>, "", NULL }, - { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, - { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable }, - { "info", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleServerInfoCommand>, "", NULL }, - { "motd", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleServerMotdCommand>, "", NULL }, - { "plimit", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerPLimitCommand>, "", NULL }, - { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, - { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, - { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, - { "togglequerylog", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerToggleQueryLogging>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand unbanCommandTable[] = { { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanAccountCommand>, "", NULL }, @@ -311,14 +234,12 @@ ChatCommand* ChatHandler::getCommandTable() static ChatCommand commandTable[] = { - { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable}, { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, - { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 1612de741a6..c43b0fa9aca 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -119,10 +119,13 @@ class ChatHandler GameObject* GetNearbyGameObject(); GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry); - bool HasSentErrorMessage() const { return sentErrorMessage;} - void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; - static bool LoadCommandTable() { return load_command_table;} - static void SetLoadCommandTable(bool val){ load_command_table = val;}; + bool HasSentErrorMessage() const { return sentErrorMessage; } + void SetSentErrorMessage(bool val){ sentErrorMessage = val; } + static bool LoadCommandTable() { return load_command_table; } + static void SetLoadCommandTable(bool val) { load_command_table = val; } + + // cs_character + void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel); protected: explicit ChatHandler() : m_session(NULL) {} // for CLI subclass @@ -147,19 +150,6 @@ class ChatHandler bool HandleBanListCharacterCommand(const char* args); bool HandleBanListIPCommand(const char* args); - bool HandleCharacterCustomizeCommand(const char* args); - bool HandleCharacterChangeFactionCommand(const char* args); - bool HandleCharacterChangeRaceCommand(const char * args); - bool HandleCharacterDeletedDeleteCommand(const char* args); - bool HandleCharacterDeletedListCommand(const char* args); - bool HandleCharacterDeletedRestoreCommand(const char* args); - bool HandleCharacterDeletedOldCommand(const char* args); - bool HandleCharacterEraseCommand(const char* args); - bool HandleCharacterLevelCommand(const char* args); - bool HandleCharacterRenameCommand(const char* args); - bool HandleCharacterReputationCommand(const char* args); - bool HandleCharacterTitlesCommand(const char* args); - bool HandleChannelSetOwnership(const char *args); bool HandlePossessCommand(const char* args); @@ -212,24 +202,6 @@ class ChatHandler bool HandleSendMessageCommand(const char * args); bool HandleSendMoneyCommand(const char* args); - bool HandleServerCorpsesCommand(const char* args); - bool HandleServerExitCommand(const char* args); - bool HandleServerIdleRestartCommand(const char* args); - bool HandleServerIdleShutDownCommand(const char* args); - bool HandleServerInfoCommand(const char* args); - bool HandleServerMotdCommand(const char* args); - bool HandleServerPLimitCommand(const char* args); - bool HandleServerRestartCommand(const char* args); - bool HandleServerSetLogLevelCommand(const char* args); - bool HandleServerSetMotdCommand(const char* args); - bool HandleServerShutDownCommand(const char* args); - bool HandleServerShutDownCancelCommand(const char* args); - bool HandleServerSetClosedCommand(const char* args); - bool HandleServerToggleQueryLogging(const char* args); - - bool HandleServerSetLogFileLevelCommand(const char* args); - bool HandleServerSetDiffTimeCommand(const char* args); - bool HandleUnBanAccountCommand(const char* args); bool HandleUnBanAccountByCharCommand(const char* args); bool HandleUnBanCharacterCommand(const char* args); @@ -342,25 +314,8 @@ class ChatHandler bool HandleBanHelper(BanMode mode, char const* args); bool HandleBanInfoHelper(uint32 accountid, char const* accountname); bool HandleUnBanHelper(BanMode mode, char const* args); - void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel); void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id); - // Stores informations about a deleted character - struct DeletedInfo - { - uint32 lowguid; ///< the low GUID from the character - std::string name; ///< the character name - uint32 accountId; ///< the account id - std::string accountName; ///< the account name - time_t deleteDate; ///< the date at which the character has been deleted - }; - - typedef std::list DeletedInfoList; - bool GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString = ""); - std::string GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList::const_iterator& itr, DeletedInfoList::const_iterator const& itr_end); - void HandleCharacterDeletedListHelper(DeletedInfoList const& foundList); - void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo); - private: bool _HandleGMTicketResponseAppendCommand(const char* args, bool newLine); diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp index b2ac090c313..b05ba9b4194 100755 --- a/src/server/game/Chat/Commands/Level0.cpp +++ b/src/server/game/Chat/Commands/Level0.cpp @@ -80,29 +80,6 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) -{ - uint32 playersNum = sWorld->GetPlayerCount(); - uint32 maxPlayersNum = sWorld->GetMaxPlayerCount(); - uint32 activeClientsNum = sWorld->GetActiveSessionCount(); - uint32 queuedClientsNum = sWorld->GetQueuedSessionCount(); - uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount(); - uint32 maxQueuedClientsNum = sWorld->GetMaxQueuedSessionCount(); - std::string uptime = secsToTimeString(sWorld->GetUptime()); - uint32 updateTime = sWorld->GetUpdateTime(); - - SendSysMessage(_FULLVERSION); - PSendSysMessage(LANG_CONNECTED_PLAYERS, playersNum, maxPlayersNum); - PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum); - PSendSysMessage(LANG_UPTIME, uptime.c_str()); - PSendSysMessage(LANG_UPDATE_DIFF, updateTime); - //! Can't use sWorld->ShutdownMsg here in case of console command - if (sWorld->IsShuttingDown()) - PSendSysMessage(LANG_SHUTDOWN_TIMELEFT, secsToTimeString(sWorld->GetShutDownTimeLeft()).c_str()); - - return true; -} - bool ChatHandler::HandleDismountCommand(const char* /*args*/) { Player* player = m_session->GetPlayer(); @@ -150,10 +127,3 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/) return true; } -/// Display the 'Message of the day' for the realm -bool ChatHandler::HandleServerMotdCommand(const char* /*args*/) -{ - PSendSysMessage(LANG_MOTD_CURRENT, sWorld->GetMotd()); - return true; -} - diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index 52bdcd15163..42a379753d5 100755 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -456,190 +456,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args) return true; } -//rename characters -bool ChatHandler::HandleCharacterRenameCommand(const char* args) -{ - Player* target; - uint64 targetGuid; - std::string targetName; - if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - if (target) - { - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - PSendSysMessage(LANG_RENAME_PLAYER, GetNameLink(target).c_str()); - target->SetAtLoginFlag(AT_LOGIN_RENAME); - } - else - { - // check offline security - if (HasLowerSecurity(NULL, targetGuid)) - return false; - - std::string oldNameLink = playerLink(targetName); - - PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); - - stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); - - CharacterDatabase.Execute(stmt); - } - - return true; -} - -// customize characters -bool ChatHandler::HandleCharacterCustomizeCommand(const char* args) -{ - Player* target; - uint64 targetGuid; - std::string targetName; - if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); - - stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE)); - - if (target) - { - PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str()); - target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE); - - stmt->setUInt32(1, target->GetGUIDLow()); - } - else - { - std::string oldNameLink = playerLink(targetName); - - stmt->setUInt32(1, GUID_LOPART(targetGuid)); - - PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); - } - - CharacterDatabase.Execute(stmt); - - return true; -} - -bool ChatHandler::HandleCharacterChangeFactionCommand(const char* args) -{ - Player* target; - uint64 targetGuid; - std::string targetName; - - if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); - - stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION)); - - if (target) - { - PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str()); - target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION); - - stmt->setUInt32(1, target->GetGUIDLow()); - } - else - { - std::string oldNameLink = playerLink(targetName); - - PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); - - stmt->setUInt32(1, GUID_LOPART(targetGuid)); - } - - CharacterDatabase.Execute(stmt); - - return true; -} - -bool ChatHandler::HandleCharacterChangeRaceCommand(const char * args) -{ - Player* target; - uint64 targetGuid; - std::string targetName; - if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); - - stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE)); - - if (target) - { - // TODO : add text into database - PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str()); - target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE); - - stmt->setUInt32(1, target->GetGUIDLow()); - } - else - { - std::string oldNameLink = playerLink(targetName); - - // TODO : add text into database - PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); - - stmt->setUInt32(1, GUID_LOPART(targetGuid)); - } - - CharacterDatabase.Execute(stmt); - - return true; -} - -bool ChatHandler::HandleCharacterReputationCommand(const char* args) -{ - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; - - LocaleConstant loc = GetSessionDbcLocale(); - - FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList(); - for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr) - { - const FactionState& faction = itr->second; - FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID); - char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#"; - ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); - std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]); - std::ostringstream ss; - if (m_session) - ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r"; - else - ss << faction.ID << " - " << factionName << ' ' << localeNames[loc]; - - ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')'; - - if (faction.Flags & FACTION_FLAG_VISIBLE) - ss << GetTrinityString(LANG_FACTION_VISIBLE); - if (faction.Flags & FACTION_FLAG_AT_WAR) - ss << GetTrinityString(LANG_FACTION_ATWAR); - if (faction.Flags & FACTION_FLAG_PEACE_FORCED) - ss << GetTrinityString(LANG_FACTION_PEACE_FORCED); - if (faction.Flags & FACTION_FLAG_HIDDEN) - ss << GetTrinityString(LANG_FACTION_HIDDEN); - if (faction.Flags & FACTION_FLAG_INVISIBLE_FORCED) - ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); - if (faction.Flags & FACTION_FLAG_INACTIVE) - ss << GetTrinityString(LANG_FACTION_INACTIVE); - - SendSysMessage(ss.str().c_str()); - } - return true; -} - bool ChatHandler::HandleLookupEventCommand(const char* args) { if (!*args) @@ -846,13 +662,6 @@ bool ChatHandler::LookupPlayerSearchCommand(PreparedQueryResult result, int32 li return true; } -/// Triggering corpses expire check in world -bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/) -{ - sObjectAccessor->RemoveOldCorpses(); - return true; -} - bool ChatHandler::HandleRepairitemsCommand(const char* args) { Player* target; @@ -1128,43 +937,3 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args) SendSysMessage(LANG_COMMAND_NOTITLEFOUND); return true; } - -bool ChatHandler::HandleCharacterTitlesCommand(const char* args) -{ - if (!*args) - return false; - - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; - - LocaleConstant loc = GetSessionDbcLocale(); - char const* targetName = target->GetName(); - char const* knownStr = GetTrinityString(LANG_KNOWN); - - // Search in CharTitles.dbc - for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) - { - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); - if (titleInfo && target->HasTitle(titleInfo)) - { - std::string name = titleInfo->name[loc]; - if (name.empty()) - continue; - - char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index - ? GetTrinityString(LANG_ACTIVE) - : ""; - - char titleNameStr[80]; - snprintf(titleNameStr, 80, name.c_str(), targetName); - - // send title in "id (idx:idx) - [namedlink locale]" format - if (m_session) - PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr); - else - PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr); - } - } - return true; -} diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 3898232fa40..33855a96617 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -2198,47 +2198,6 @@ void ChatHandler::HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 } } -bool ChatHandler::HandleCharacterLevelCommand(const char *args) -{ - char* nameStr; - char* levelStr; - extractOptFirstArg((char*)args, &nameStr, &levelStr); - if (!levelStr) - return false; - - // exception opt second arg: .character level $name - if (isalpha(levelStr[0])) - { - nameStr = levelStr; - levelStr = NULL; // current level will used - } - - Player* target; - uint64 target_guid; - std::string target_name; - if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) - return false; - - int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid); - int32 newlevel = levelStr ? atoi(levelStr) : oldlevel; - - if (newlevel < 1) - return false; // invalid level - - if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level - newlevel = STRONG_MAX_LEVEL; - - HandleCharacterLevel(target, target_guid, oldlevel, newlevel); - - if (!m_session || m_session->GetPlayer() != target) // including player == NULL - { - std::string nameLink = playerLink(target_name); - PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); - } - - return true; -} - bool ChatHandler::HandleLevelUpCommand(const char *args) { char* nameStr; @@ -2698,152 +2657,6 @@ bool ChatHandler::HandleResetAllCommand(const char * args) return true; } -bool ChatHandler::HandleServerShutDownCancelCommand(const char* /*args*/) -{ - sWorld->ShutdownCancel(); - return true; -} - -bool ChatHandler::HandleServerShutDownCommand(const char *args) -{ - if (!*args) - return false; - - char* time_str = strtok ((char*) args, " "); - char* exitcode_str = strtok (NULL, ""); - - int32 time = atoi (time_str); - - ///- Prevent interpret wrong arg value as 0 secs shutdown time - if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) - return false; - - if (exitcode_str) - { - int32 exitcode = atoi (exitcode_str); - - // Handle atoi() errors - if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) - return false; - - // Exit code should be in range of 0-125, 126-255 is used - // in many shells for their own return codes and code > 255 - // is not supported in many others - if (exitcode < 0 || exitcode > 125) - return false; - - sWorld->ShutdownServ(time, 0, exitcode); - } - else - sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE); - return true; -} - -bool ChatHandler::HandleServerRestartCommand(const char *args) -{ - if (!*args) - return false; - - char* time_str = strtok ((char*) args, " "); - char* exitcode_str = strtok (NULL, ""); - - int32 time = atoi (time_str); - - ///- Prevent interpret wrong arg value as 0 secs shutdown time - if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) - return false; - - if (exitcode_str) - { - int32 exitcode = atoi (exitcode_str); - - // Handle atoi() errors - if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) - return false; - - // Exit code should be in range of 0-125, 126-255 is used - // in many shells for their own return codes and code > 255 - // is not supported in many others - if (exitcode < 0 || exitcode > 125) - return false; - - sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitcode); - } - else - sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); - return true; -} - -bool ChatHandler::HandleServerIdleRestartCommand(const char *args) -{ - if (!*args) - return false; - - char* time_str = strtok ((char*) args, " "); - char* exitcode_str = strtok (NULL, ""); - - int32 time = atoi (time_str); - - ///- Prevent interpret wrong arg value as 0 secs shutdown time - if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) - return false; - - if (exitcode_str) - { - int32 exitcode = atoi (exitcode_str); - - // Handle atoi() errors - if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) - return false; - - // Exit code should be in range of 0-125, 126-255 is used - // in many shells for their own return codes and code > 255 - // is not supported in many others - if (exitcode < 0 || exitcode > 125) - return false; - - sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); - } - else - sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE); - return true; -} - -bool ChatHandler::HandleServerIdleShutDownCommand(const char *args) -{ - if (!*args) - return false; - - char* time_str = strtok ((char*) args, " "); - char* exitcode_str = strtok (NULL, ""); - - int32 time = atoi (time_str); - - ///- Prevent interpret wrong arg value as 0 secs shutdown time - if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) - return false; - - if (exitcode_str) - { - int32 exitcode = atoi (exitcode_str); - - // Handle atoi() errors - if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) - return false; - - // Exit code should be in range of 0-125, 126-255 is used - // in many shells for their own return codes and code > 255 - // is not supported in many others - if (exitcode < 0 || exitcode > 125) - return false; - - sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitcode); - } - else - sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE); - return true; -} - bool ChatHandler::HandleBanAccountCommand(const char *args) { return HandleBanHelper(BAN_ACCOUNT, args); @@ -3764,56 +3577,6 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleServerPLimitCommand(const char *args) -{ - if (*args) - { - char* param = strtok((char*)args, " "); - if (!param) - return false; - - int l = strlen(param); - - if (strncmp(param, "player", l) == 0) - sWorld->SetPlayerSecurityLimit(SEC_PLAYER); - else if (strncmp(param, "moderator", l) == 0) - sWorld->SetPlayerSecurityLimit(SEC_MODERATOR); - else if (strncmp(param, "gamemaster", l) == 0) - sWorld->SetPlayerSecurityLimit(SEC_GAMEMASTER); - else if (strncmp(param, "administrator", l) == 0) - sWorld->SetPlayerSecurityLimit(SEC_ADMINISTRATOR); - else if (strncmp(param, "reset", l) == 0) - { - sWorld->SetPlayerAmountLimit(ConfigMgr::GetIntDefault("PlayerLimit", 100)); - sWorld->LoadDBAllowedSecurityLevel(); - } - else - { - int val = atoi(param); - if (val < 0) - sWorld->SetPlayerSecurityLimit(AccountTypes(uint32(-val))); - else - sWorld->SetPlayerAmountLimit(uint32(val)); - } - } - - uint32 pLimit = sWorld->GetPlayerAmountLimit(); - AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); - char const* secName = ""; - switch (allowedAccountType) - { - case SEC_PLAYER: secName = "Player"; break; - case SEC_MODERATOR: secName = "Moderator"; break; - case SEC_GAMEMASTER: secName = "Gamemaster"; break; - case SEC_ADMINISTRATOR: secName = "Administrator"; break; - default: secName = ""; break; - } - - PSendSysMessage("Player limits: amount %u, min. security level %s.", pLimit, secName); - - return true; -} - /* ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator Without this function 3rd party scripting library will get linking errors (unresolved external) @@ -3840,35 +3603,6 @@ bool ChatHandler::HandleComeToMeCommand(const char *args) return true; } -/// Define the 'Message of the day' for the realm -bool ChatHandler::HandleServerSetMotdCommand(const char *args) -{ - sWorld->SetMotd(args); - PSendSysMessage(LANG_MOTD_NEW, args); - return true; -} - -/// Set whether we accept new clients -bool ChatHandler::HandleServerSetClosedCommand(const char *args) -{ - if (strncmp(args, "on", 3) == 0) - { - SendSysMessage(LANG_WORLD_CLOSED); - sWorld->SetClosed(true); - return true; - } - else if (strncmp(args, "off", 4) == 0) - { - SendSysMessage(LANG_WORLD_OPENED); - sWorld->SetClosed(false); - return true; - } - - SendSysMessage(LANG_USE_BOL); - SetSentErrorMessage(true); - return false; -} - //Send items by mail bool ChatHandler::HandleSendItemsCommand(const char *args) { diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 8bc4ce24665..c18c6914096 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -61,8 +61,10 @@ void AddSC_npc_commandscript(); void AddSC_quest_commandscript(); void AddSC_reload_commandscript(); void AddSC_tele_commandscript(); +void AddSC_server_commandscript(); void AddSC_titles_commandscript(); void AddSC_wp_commandscript(); +void AddSC_character_commandscript(); #ifdef SCRIPTS //world @@ -665,8 +667,10 @@ void AddCommandScripts() AddSC_quest_commandscript(); AddSC_reload_commandscript(); AddSC_tele_commandscript(); + AddSC_server_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); + AddSC_character_commandscript(); } void AddWorldScripts() diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 77d42ac5fd1..86e1baeb52d 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -27,9 +27,10 @@ set(scripts_STAT_SRCS Commands/cs_quest.cpp Commands/cs_reload.cpp Commands/cs_tele.cpp + Commands/cs_server.cpp Commands/cs_titles.cpp Commands/cs_wp.cpp -# Commands/cs_character.cpp + Commands/cs_character.cpp # Commands/cs_list.cpp # Commands/cs_lookup.cpp # Commands/cs_pdump.cpp diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp new file mode 100644 index 00000000000..d5e674a1097 --- /dev/null +++ b/src/server/scripts/Commands/cs_character.cpp @@ -0,0 +1,680 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: character_commandscript +%Complete: 100 +Comment: All character related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "AccountMgr.h" + +class character_commandscript : public CommandScript +{ +public: + character_commandscript() : CommandScript("character_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand characterDeletedCommandTable[] = + { + { "delete", SEC_CONSOLE, true, &HandleCharacterDeletedDeleteCommand, "", NULL }, + { "list", SEC_ADMINISTRATOR, true, &HandleCharacterDeletedListCommand, "", NULL }, + { "restore", SEC_ADMINISTRATOR, true, &HandleCharacterDeletedRestoreCommand, "", NULL }, + { "old", SEC_CONSOLE, true, &HandleCharacterDeletedOldCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand characterCommandTable[] = + { + { "customize", SEC_GAMEMASTER, true, &HandleCharacterCustomizeCommand, "", NULL }, + { "changefaction", SEC_GAMEMASTER, true, &HandleCharacterChangeFactionCommand, "", NULL }, + { "changerace", SEC_GAMEMASTER, true, &HandleCharacterChangeRaceCommand, "", NULL }, + { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable}, + { "erase", SEC_CONSOLE, true, &HandleCharacterEraseCommand, "", NULL }, + { "level", SEC_ADMINISTRATOR, true, &HandleCharacterLevelCommand, "", NULL }, + { "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "", NULL }, + { "reputation", SEC_GAMEMASTER, true, &HandleCharacterReputationCommand, "", NULL }, + { "titles", SEC_GAMEMASTER, true, &HandleCharacterTitlesCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand commandTable[] = + { + { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable}, + { NULL, 0, false, NULL, "", NULL } + }; + + return commandTable; + } + + // Stores informations about a deleted character + struct DeletedInfo + { + uint32 lowguid; ///< the low GUID from the character + std::string name; ///< the character name + uint32 accountId; ///< the account id + std::string accountName; ///< the account name + time_t deleteDate; ///< the date at which the character has been deleted + }; + + typedef std::list DeletedInfoList; + + /** + * Collects all GUIDs (and related info) from deleted characters which are still in the database. + * + * @param foundList a reference to an std::list which will be filled with info data + * @param searchString the search string which either contains a player GUID or a part fo the character-name + * @return returns false if there was a problem while selecting the characters (e.g. player name not normalizeable) + */ + static bool GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString) + { + PreparedQueryResult result; + PreparedStatement* stmt; + if (!searchString.empty()) + { + // search by GUID + if (isNumeric(searchString.c_str())) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID); + + stmt->setUInt32(0, uint32(atoi(searchString.c_str()))); + + result = CharacterDatabase.Query(stmt); + } + // search by name + else + { + if (!normalizePlayerName(searchString)) + return false; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME); + + stmt->setString(0, searchString); + + result = CharacterDatabase.Query(stmt); + } + } + else + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO); + + result = CharacterDatabase.Query(stmt); + } + + if (result) + { + do + { + Field* fields = result->Fetch(); + + DeletedInfo info; + + info.lowguid = fields[0].GetUInt32(); + info.name = fields[1].GetString(); + info.accountId = fields[2].GetUInt32(); + + // account name will be empty for not existed account + AccountMgr::GetName(info.accountId, info.accountName); + + info.deleteDate = time_t(fields[3].GetUInt32()); + + foundList.push_back(info); + } while (result->NextRow()); + } + + return true; + } + + /** + * Shows all deleted characters which matches the given search string, expected non empty list + * + * @see HandleCharacterDeletedListCommand + * @see HandleCharacterDeletedRestoreCommand + * @see HandleCharacterDeletedDeleteCommand + * @see DeletedInfoList + * + * @param foundList contains a list with all found deleted characters + */ + static void HandleCharacterDeletedListHelper(DeletedInfoList const& foundList, ChatHandler* handler) + { + if (!handler->GetSession()) + { + handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); + handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_HEADER); + handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); + } + + for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) + { + std::string dateStr = TimeToTimestampStr(itr->deleteDate); + + if (!handler->GetSession()) + handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE, + itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), + itr->accountId, dateStr.c_str()); + else + handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT, + itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), + itr->accountId, dateStr.c_str()); + } + + if (!handler->GetSession()) + handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); + } + + /** + * Restore a previously deleted character + * + * @see HandleCharacterDeletedListHelper + * @see HandleCharacterDeletedRestoreCommand + * @see HandleCharacterDeletedDeleteCommand + * @see DeletedInfoList + * + * @param delInfo the informations about the character which will be restored + */ + static void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo, ChatHandler* handler) + { + if (delInfo.accountName.empty()) // account not exist + { + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); + return; + } + + // check character count + uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId); + if (charcount >= 10) + { + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); + return; + } + + if (sObjectMgr->GetPlayerGUIDByName(delInfo.name)) + { + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); + return; + } + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO); + + stmt->setString(0, delInfo.name); + stmt->setUInt32(1, delInfo.accountId); + stmt->setUInt32(2, delInfo.lowguid); + + CharacterDatabase.Execute(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); + stmt->setUInt32(0, delInfo.lowguid); + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) + sWorld->AddCharacterNameData(delInfo.lowguid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8()); + } + + static bool HandleCharacterTitlesCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + LocaleConstant loc = handler->GetSessionDbcLocale(); + char const* targetName = target->GetName(); + char const* knownStr = handler->GetTrinityString(LANG_KNOWN); + + // Search in CharTitles.dbc + for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) + { + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); + + if (titleInfo && target->HasTitle(titleInfo)) + { + std::string name = titleInfo->name[loc]; + if (name.empty()) + continue; + + char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index + ? handler->GetTrinityString(LANG_ACTIVE) + : ""; + + char titleNameStr[80]; + snprintf(titleNameStr, 80, name.c_str(), targetName); + + // send title in "id (idx:idx) - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr); + else + handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr); + } + } + return true; + } + + //rename characters + static bool HandleCharacterRenameCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_RENAME); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + std::string oldNameLink = handler->playerLink(targetName); + handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); + stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); + stmt->setUInt32(1, GUID_LOPART(targetGuid)); + CharacterDatabase.Execute(stmt); + } + return true; + } + + static bool HandleCharacterLevelCommand(ChatHandler* handler, char const* args) + { + char* nameStr; + char* levelStr; + handler->extractOptFirstArg((char*)args, &nameStr, &levelStr); + if (!levelStr) + return false; + + // exception opt second arg: .character level $name + if (isalpha(levelStr[0])) + { + nameStr = levelStr; + levelStr = NULL; // current level will used + } + + Player* target; + uint64 target_guid; + std::string target_name; + if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) + return false; + + int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid); + int32 newlevel = levelStr ? atoi(levelStr) : oldlevel; + + if (newlevel < 1) + return false; // invalid level + + if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level + newlevel = STRONG_MAX_LEVEL; + + handler->HandleCharacterLevel(target, target_guid, oldlevel, newlevel); + if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == NULL + { + std::string nameLink = handler->playerLink(target_name); + handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); + } + + return true; + } + + // customize characters + static bool HandleCharacterCustomizeCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); + stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE)); + if (target) + { + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE); + stmt->setUInt32(1, target->GetGUIDLow()); + } + else + { + std::string oldNameLink = handler->playerLink(targetName); + stmt->setUInt32(1, GUID_LOPART(targetGuid)); + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + } + CharacterDatabase.Execute(stmt); + + return true; + } + + static bool HandleCharacterChangeFactionCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); + stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION)); + if (target) + { + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION); + stmt->setUInt32(1, target->GetGUIDLow()); + } + else + { + std::string oldNameLink = handler->playerLink(targetName); + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + stmt->setUInt32(1, GUID_LOPART(targetGuid)); + } + CharacterDatabase.Execute(stmt); + + return true; + } + + static bool HandleCharacterChangeRaceCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); + stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE)); + if (target) + { + // TODO : add text into database + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE); + stmt->setUInt32(1, target->GetGUIDLow()); + } + else + { + std::string oldNameLink = handler->playerLink(targetName); + // TODO : add text into database + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + stmt->setUInt32(1, GUID_LOPART(targetGuid)); + } + CharacterDatabase.Execute(stmt); + + return true; + } + + static bool HandleCharacterReputationCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + LocaleConstant loc = handler->GetSessionDbcLocale(); + + FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList(); + for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr) + { + const FactionState& faction = itr->second; + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID); + char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#"; + ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); + std::string rankName = handler->GetTrinityString(ReputationRankStrIndex[rank]); + std::ostringstream ss; + if (handler->GetSession()) + ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r"; + else + ss << faction.ID << " - " << factionName << ' ' << localeNames[loc]; + + ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')'; + + if (faction.Flags & FACTION_FLAG_VISIBLE) + ss << handler->GetTrinityString(LANG_FACTION_VISIBLE); + if (faction.Flags & FACTION_FLAG_AT_WAR) + ss << handler->GetTrinityString(LANG_FACTION_ATWAR); + if (faction.Flags & FACTION_FLAG_PEACE_FORCED) + ss << handler->GetTrinityString(LANG_FACTION_PEACE_FORCED); + if (faction.Flags & FACTION_FLAG_HIDDEN) + ss << handler->GetTrinityString(LANG_FACTION_HIDDEN); + if (faction.Flags & FACTION_FLAG_INVISIBLE_FORCED) + ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); + if (faction.Flags & FACTION_FLAG_INACTIVE) + ss << handler->GetTrinityString(LANG_FACTION_INACTIVE); + + handler->SendSysMessage(ss.str().c_str()); + } + return true; + } + + /** + * Handles the '.character deleted list' command, which shows all deleted characters which matches the given search string + * + * @see HandleCharacterDeletedListHelper + * @see HandleCharacterDeletedRestoreCommand + * @see HandleCharacterDeletedDeleteCommand + * @see DeletedInfoList + * + * @param args the search string which either contains a player GUID or a part fo the character-name + */ + static bool HandleCharacterDeletedListCommand(ChatHandler* handler, char const* args) + { + DeletedInfoList foundList; + if (!GetDeletedCharacterInfoList(foundList, args)) + return false; + + // if no characters have been found, output a warning + if (foundList.empty()) + { + handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY); + return false; + } + + HandleCharacterDeletedListHelper(foundList, handler); + return true; + } + + /** + * Handles the '.character deleted restore' command, which restores all deleted characters which matches the given search string + * + * The command automatically calls '.character deleted list' command with the search string to show all restored characters. + * + * @see HandleCharacterDeletedRestoreHelper + * @see HandleCharacterDeletedListCommand + * @see HandleCharacterDeletedDeleteCommand + * + * @param args the search string which either contains a player GUID or a part of the character-name + */ + static bool HandleCharacterDeletedRestoreCommand(ChatHandler* handler, char const* args) + { + // It is required to submit at least one argument + if (!*args) + return false; + + std::string searchString; + std::string newCharName; + uint32 newAccount = 0; + + // GCC by some strange reason fail build code without temporary variable + std::istringstream params(args); + params >> searchString >> newCharName >> newAccount; + + DeletedInfoList foundList; + if (!GetDeletedCharacterInfoList(foundList, searchString)) + return false; + + if (foundList.empty()) + { + handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY); + return false; + } + + handler->SendSysMessage(LANG_CHARACTER_DELETED_RESTORE); + HandleCharacterDeletedListHelper(foundList, handler); + + if (newCharName.empty()) + { + // Drop not existed account cases + for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr) + HandleCharacterDeletedRestoreHelper(*itr, handler); + } + else if (foundList.size() == 1 && normalizePlayerName(newCharName)) + { + DeletedInfo delInfo = foundList.front(); + + // update name + delInfo.name = newCharName; + + // if new account provided update deleted info + if (newAccount && newAccount != delInfo.accountId) + { + delInfo.accountId = newAccount; + AccountMgr::GetName(newAccount, delInfo.accountName); + } + + HandleCharacterDeletedRestoreHelper(delInfo, handler); + } + else + handler->SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME); + + return true; + } + + /** + * Handles the '.character deleted delete' command, which completely deletes all deleted characters which matches the given search string + * + * @see Player::GetDeletedCharacterGUIDs + * @see Player::DeleteFromDB + * @see HandleCharacterDeletedListCommand + * @see HandleCharacterDeletedRestoreCommand + * + * @param args the search string which either contains a player GUID or a part fo the character-name + */ + static bool HandleCharacterDeletedDeleteCommand(ChatHandler* handler, char const* args) + { + // It is required to submit at least one argument + if (!*args) + return false; + + DeletedInfoList foundList; + if (!GetDeletedCharacterInfoList(foundList, args)) + return false; + + if (foundList.empty()) + { + handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY); + return false; + } + + handler->SendSysMessage(LANG_CHARACTER_DELETED_DELETE); + HandleCharacterDeletedListHelper(foundList, handler); + + // Call the appropriate function to delete them (current account for deleted characters is 0) + for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) + Player::DeleteFromDB(itr->lowguid, 0, false, true); + + return true; + } + + /** + * Handles the '.character deleted old' command, which completely deletes all deleted characters deleted with some days ago + * + * @see Player::DeleteOldCharacters + * @see Player::DeleteFromDB + * @see HandleCharacterDeletedDeleteCommand + * @see HandleCharacterDeletedListCommand + * @see HandleCharacterDeletedRestoreCommand + * + * @param args the search string which either contains a player GUID or a part fo the character-name + */ + static bool HandleCharacterDeletedOldCommand(ChatHandler* handler, char const* args) + { + int32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS); + + char* px = strtok((char*)args, " "); + if (px) + { + if (!isNumeric(px)) + return false; + + keepDays = atoi(px); + if (keepDays < 0) + return false; + } + // config option value 0 -> disabled and can't be used + else if (keepDays <= 0) + return false; + + Player::DeleteOldCharacters((uint32)keepDays); + return true; + } + + static bool HandleCharacterEraseCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char *character_name_str = strtok((char*)args, " "); + if (!character_name_str) + return false; + + std::string character_name = character_name_str; + if (!normalizePlayerName(character_name)) + return false; + + uint64 character_guid; + uint32 account_id; + + Player* player = sObjectAccessor->FindPlayerByName(character_name.c_str()); + if (player) + { + character_guid = player->GetGUID(); + account_id = player->GetSession()->GetAccountId(); + player->GetSession()->KickPlayer(); + } + else + { + character_guid = sObjectMgr->GetPlayerGUIDByName(character_name); + if (!character_guid) + { + handler->PSendSysMessage(LANG_NO_PLAYER, character_name.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + account_id = sObjectMgr->GetPlayerAccountIdByGUID(character_guid); + } + + std::string account_name; + AccountMgr::GetName (account_id, account_name); + + Player::DeleteFromDB(character_guid, account_id, true, true); + handler->PSendSysMessage(LANG_CHARACTER_DELETED, character_name.c_str(), GUID_LOPART(character_guid), account_name.c_str(), account_id); + return true; + } +}; + +void AddSC_character_commandscript() +{ + new character_commandscript(); +} \ No newline at end of file diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp new file mode 100644 index 00000000000..12528f384a4 --- /dev/null +++ b/src/server/scripts/Commands/cs_server.cpp @@ -0,0 +1,430 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: server_commandscript +%Complete: 100 +Comment: All server related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "SystemConfig.h" +#include "Config.h" + +class server_commandscript : public CommandScript +{ +public: + server_commandscript() : CommandScript("server_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand serverIdleRestartCommandTable[] = + { + { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, + { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverIdleShutdownCommandTable[] = + { + { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, + { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverRestartCommandTable[] = + { + { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, + { "" , SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverShutdownCommandTable[] = + { + { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, + { "" , SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverSetCommandTable[] = + { + { "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "", NULL }, + { "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "", NULL }, + { "logfilelevel", SEC_CONSOLE, true, &HandleServerSetLogFileLevelCommand, "", NULL }, + { "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "", NULL }, + { "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverCommandTable[] = + { + { "corpses", SEC_GAMEMASTER, true, &HandleServerCorpsesCommand, "", NULL }, + { "exit", SEC_CONSOLE, true, &HandleServerExitCommand, "", NULL }, + { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, + { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable }, + { "info", SEC_PLAYER, true, &HandleServerInfoCommand, "", NULL }, + { "motd", SEC_PLAYER, true, &HandleServerMotdCommand, "", NULL }, + { "plimit", SEC_ADMINISTRATOR, true, &HandleServerPLimitCommand, "", NULL }, + { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, + { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, + { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, + { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand commandTable[] = + { + { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + // Triggering corpses expire check in world + static bool HandleServerCorpsesCommand(ChatHandler* handler, char const* args) + { + sObjectAccessor->RemoveOldCorpses(); + return true; + } + + static bool HandleServerInfoCommand(ChatHandler* handler, char const* args) + { + uint32 playersNum = sWorld->GetPlayerCount(); + uint32 maxPlayersNum = sWorld->GetMaxPlayerCount(); + uint32 activeClientsNum = sWorld->GetActiveSessionCount(); + uint32 queuedClientsNum = sWorld->GetQueuedSessionCount(); + uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount(); + uint32 maxQueuedClientsNum = sWorld->GetMaxQueuedSessionCount(); + std::string uptime = secsToTimeString(sWorld->GetUptime()); + uint32 updateTime = sWorld->GetUpdateTime(); + + handler->SendSysMessage(_FULLVERSION); + handler->PSendSysMessage(LANG_CONNECTED_PLAYERS, playersNum, maxPlayersNum); + handler->PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum); + handler->PSendSysMessage(LANG_UPTIME, uptime.c_str()); + handler->PSendSysMessage(LANG_UPDATE_DIFF, updateTime); + // Can't use sWorld->ShutdownMsg here in case of console command + if (sWorld->IsShuttingDown()) + handler->PSendSysMessage(LANG_SHUTDOWN_TIMELEFT, secsToTimeString(sWorld->GetShutDownTimeLeft()).c_str()); + + return true; + } + // Display the 'Message of the day' for the realm + static bool HandleServerMotdCommand(ChatHandler* handler, char const* args) + { + handler->PSendSysMessage(LANG_MOTD_CURRENT, sWorld->GetMotd()); + return true; + } + + static bool HandleServerPLimitCommand(ChatHandler* handler, char const* args) + { + if (*args) + { + char* param = strtok((char*)args, " "); + if (!param) + return false; + + int l = strlen(param); + + if (strncmp(param, "player", l) == 0) + sWorld->SetPlayerSecurityLimit(SEC_PLAYER); + else if (strncmp(param, "moderator", l) == 0) + sWorld->SetPlayerSecurityLimit(SEC_MODERATOR); + else if (strncmp(param, "gamemaster", l) == 0) + sWorld->SetPlayerSecurityLimit(SEC_GAMEMASTER); + else if (strncmp(param, "administrator", l) == 0) + sWorld->SetPlayerSecurityLimit(SEC_ADMINISTRATOR); + else if (strncmp(param, "reset", l) == 0) + { + sWorld->SetPlayerAmountLimit(ConfigMgr::GetIntDefault("PlayerLimit", 100)); + sWorld->LoadDBAllowedSecurityLevel(); + } + else + { + int val = atoi(param); + if (val < 0) + sWorld->SetPlayerSecurityLimit(AccountTypes(uint32(-val))); + else + sWorld->SetPlayerAmountLimit(uint32(val)); + } + } + + uint32 pLimit = sWorld->GetPlayerAmountLimit(); + AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); + char const* secName = ""; + switch (allowedAccountType) + { + case SEC_PLAYER: secName = "Player"; break; + case SEC_MODERATOR: secName = "Moderator"; break; + case SEC_GAMEMASTER: secName = "Gamemaster"; break; + case SEC_ADMINISTRATOR: secName = "Administrator"; break; + default: secName = ""; break; + } + handler->PSendSysMessage("Player limits: amount %u, min. security level %s.", pLimit, secName); + + return true; + } + + static bool HandleServerShutDownCancelCommand(ChatHandler* handler, char const* args) + { + sWorld->ShutdownCancel(); + return true; + } + + static bool HandleServerShutDownCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* time_str = strtok ((char*) args, " "); + char* exitcode_str = strtok (NULL, ""); + + int32 time = atoi (time_str); + + // Prevent interpret wrong arg value as 0 secs shutdown time + if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) + return false; + + if (exitcode_str) + { + int32 exitcode = atoi(exitcode_str); + + // Handle atoi() errors + if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) + return false; + + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitcode < 0 || exitcode > 125) + return false; + + sWorld->ShutdownServ(time, 0, exitcode); + } + else + sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE); + return true; + } + + static bool HandleServerRestartCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* time_str = strtok ((char*) args, " "); + char* exitcode_str = strtok (NULL, ""); + + int32 time = atoi (time_str); + + // Prevent interpret wrong arg value as 0 secs shutdown time + if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) + return false; + + if (exitcode_str) + { + int32 exitcode = atoi (exitcode_str); + + // Handle atoi() errors + if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) + return false; + + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitcode < 0 || exitcode > 125) + return false; + + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitcode); + } + else + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); + return true; + } + + static bool HandleServerIdleRestartCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* time_str = strtok ((char*) args, " "); + char* exitcode_str = strtok (NULL, ""); + + int32 time = atoi (time_str); + + // Prevent interpret wrong arg value as 0 secs shutdown time + if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) + return false; + + if (exitcode_str) + { + int32 exitcode = atoi (exitcode_str); + + // Handle atoi() errors + if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) + return false; + + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitcode < 0 || exitcode > 125) + return false; + + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); + } + else + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE); + return true; + } + + static bool HandleServerIdleShutDownCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* time_str = strtok ((char*) args, " "); + char* exitcode_str = strtok (NULL, ""); + + int32 time = atoi (time_str); + + // Prevent interpret wrong arg value as 0 secs shutdown time + if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) + return false; + + if (exitcode_str) + { + int32 exitcode = atoi (exitcode_str); + + // Handle atoi() errors + if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) + return false; + + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitcode < 0 || exitcode > 125) + return false; + + sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitcode); + } + else + sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE); + return true; + } + + // Exit the realm + static bool HandleServerExitCommand(ChatHandler* handler, char const* args) + { + handler->SendSysMessage(LANG_COMMAND_EXIT); + World::StopNow(SHUTDOWN_EXIT_CODE); + return true; + } + + // Define the 'Message of the day' for the realm + static bool HandleServerSetMotdCommand(ChatHandler* handler, char const* args) + { + sWorld->SetMotd(args); + handler->PSendSysMessage(LANG_MOTD_NEW, args); + return true; + } + + // Set whether we accept new clients + static bool HandleServerSetClosedCommand(ChatHandler* handler, char const* args) + { + if (strncmp(args, "on", 3) == 0) + { + handler->SendSysMessage(LANG_WORLD_CLOSED); + sWorld->SetClosed(true); + return true; + } + else if (strncmp(args, "off", 4) == 0) + { + handler->SendSysMessage(LANG_WORLD_OPENED); + sWorld->SetClosed(false); + return true; + } + + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + // Set the level of logging + static bool HandleServerSetLogFileLevelCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char *NewLevel = strtok((char*)args, " "); + if (!NewLevel) + return false; + + sLog->SetLogFileLevel(NewLevel); + return true; + } + + // Set the level of logging + static bool HandleServerSetLogLevelCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char *NewLevel = strtok((char*)args, " "); + if (!NewLevel) + return false; + + sLog->SetLogLevel(NewLevel); + return true; + } + + // set diff time record interval + static bool HandleServerSetDiffTimeCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char *NewTimeStr = strtok((char*)args, " "); + if (!NewTimeStr) + return false; + + int32 NewTime =atoi(NewTimeStr); + if (NewTime < 0) + return false; + + sWorld->SetRecordDiffInterval(NewTime); + printf( "Record diff every %u ms\n", NewTime); + return true; + } + + // toggle sql driver query logging + static bool HandleServerToggleQueryLogging(ChatHandler* handler,const char* args ) + { + sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging()); + if (sLog->GetSQLDriverQueryLogging()) + handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED); + else + handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED); + + return true; + } +}; + +void AddSC_server_commandscript() +{ + new server_commandscript(); +} \ No newline at end of file diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp index e28665c038e..9e8cdaa8b92 100644 --- a/src/server/scripts/Kalimdor/ashenvale.cpp +++ b/src/server/scripts/Kalimdor/ashenvale.cpp @@ -169,15 +169,15 @@ class npc_torek : public CreatureScript # npc_ruul_snowhoof ####*/ -enum RuulSnowhoof -{ +enum RuulSnowhoof +{ NPC_THISTLEFUR_URSA = 3921, NPC_THISTLEFUR_TOTEMIC = 3922, NPC_THISTLEFUR_PATHFINDER = 3926, QUEST_FREEDOM_TO_RUUL = 6482, - GO_CAGE = 178147 + GO_CAGE = 178147 }; Position const RuulSnowhoofSummonsCoord[6] = diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index e85a3e1870d..699e7cad97c 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -116,458 +116,6 @@ void commandFinished(void*, bool /*success*/) fflush(stdout); } -/** - * Collects all GUIDs (and related info) from deleted characters which are still in the database. - * - * @param foundList a reference to an std::list which will be filled with info data - * @param searchString the search string which either contains a player GUID or a part fo the character-name - * @return returns false if there was a problem while selecting the characters (e.g. player name not normalizeable) - */ -bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString) -{ - PreparedQueryResult result; - PreparedStatement* stmt; - if (!searchString.empty()) - { - // search by GUID - if (isNumeric(searchString.c_str())) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID); - - stmt->setUInt32(0, uint32(atoi(searchString.c_str()))); - - result = CharacterDatabase.Query(stmt); - } - // search by name - else - { - if (!normalizePlayerName(searchString)) - return false; - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME); - - stmt->setString(0, searchString); - - result = CharacterDatabase.Query(stmt); - } - } - else - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO); - - result = CharacterDatabase.Query(stmt); - } - - if (result) - { - do - { - Field* fields = result->Fetch(); - - DeletedInfo info; - - info.lowguid = fields[0].GetUInt32(); - info.name = fields[1].GetString(); - info.accountId = fields[2].GetUInt32(); - - // account name will be empty for not existed account - AccountMgr::GetName(info.accountId, info.accountName); - - info.deleteDate = time_t(fields[3].GetUInt32()); - - foundList.push_back(info); - } while (result->NextRow()); - } - - return true; -} - -/** - * Generate WHERE guids list by deleted info in way preventing return too long where list for existed query string length limit. - * - * @param itr a reference to an deleted info list iterator, it updated in function for possible next function call if list to long - * @param itr_end a reference to an deleted info list iterator end() - * @return returns generated where list string in form: 'guid IN (gui1, guid2, ...)' - */ -std::string ChatHandler::GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList::const_iterator& itr, DeletedInfoList::const_iterator const& itr_end) -{ - std::ostringstream wherestr; - wherestr << "guid IN ('"; - for (; itr != itr_end; ++itr) - { - wherestr << itr->lowguid; - - if (wherestr.str().size() > MAX_QUERY_LEN - 50) // near to max query - { - ++itr; - break; - } - - DeletedInfoList::const_iterator itr2 = itr; - if (++itr2 != itr_end) - wherestr << "', '"; - } - wherestr << "')"; - return wherestr.str(); -} - -/** - * Shows all deleted characters which matches the given search string, expected non empty list - * - * @see ChatHandler::HandleCharacterDeletedListCommand - * @see ChatHandler::HandleCharacterDeletedRestoreCommand - * @see ChatHandler::HandleCharacterDeletedDeleteCommand - * @see ChatHandler::DeletedInfoList - * - * @param foundList contains a list with all found deleted characters - */ -void ChatHandler::HandleCharacterDeletedListHelper(DeletedInfoList const& foundList) -{ - if (!m_session) - { - SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); - SendSysMessage(LANG_CHARACTER_DELETED_LIST_HEADER); - SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); - } - - for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) - { - std::string dateStr = TimeToTimestampStr(itr->deleteDate); - - if (!m_session) - PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE, - itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), - itr->accountId, dateStr.c_str()); - else - PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT, - itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), - itr->accountId, dateStr.c_str()); - } - - if (!m_session) - SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); -} - -/** - * Handles the '.character deleted list' command, which shows all deleted characters which matches the given search string - * - * @see ChatHandler::HandleCharacterDeletedListHelper - * @see ChatHandler::HandleCharacterDeletedRestoreCommand - * @see ChatHandler::HandleCharacterDeletedDeleteCommand - * @see ChatHandler::DeletedInfoList - * - * @param args the search string which either contains a player GUID or a part fo the character-name - */ -bool ChatHandler::HandleCharacterDeletedListCommand(const char* args) -{ - DeletedInfoList foundList; - if (!GetDeletedCharacterInfoList(foundList, args)) - return false; - - // if no characters have been found, output a warning - if (foundList.empty()) - { - SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY); - return false; - } - - HandleCharacterDeletedListHelper(foundList); - return true; -} - -/** - * Restore a previously deleted character - * - * @see ChatHandler::HandleCharacterDeletedListHelper - * @see ChatHandler::HandleCharacterDeletedRestoreCommand - * @see ChatHandler::HandleCharacterDeletedDeleteCommand - * @see ChatHandler::DeletedInfoList - * - * @param delInfo the informations about the character which will be restored - */ -void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo) -{ - if (delInfo.accountName.empty()) // account not exist - { - PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); - return; - } - - // check character count - uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId); - if (charcount >= 10) - { - PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); - return; - } - - if (sObjectMgr->GetPlayerGUIDByName(delInfo.name)) - { - PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); - return; - } - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO); - - stmt->setString(0, delInfo.name); - stmt->setUInt32(1, delInfo.accountId); - stmt->setUInt32(2, delInfo.lowguid); - - CharacterDatabase.Execute(stmt); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); - stmt->setUInt32(0, delInfo.lowguid); - if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) - sWorld->AddCharacterNameData(delInfo.lowguid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8()); -} - -/** - * Handles the '.character deleted restore' command, which restores all deleted characters which matches the given search string - * - * The command automatically calls '.character deleted list' command with the search string to show all restored characters. - * - * @see ChatHandler::HandleCharacterDeletedRestoreHelper - * @see ChatHandler::HandleCharacterDeletedListCommand - * @see ChatHandler::HandleCharacterDeletedDeleteCommand - * - * @param args the search string which either contains a player GUID or a part of the character-name - */ -bool ChatHandler::HandleCharacterDeletedRestoreCommand(const char* args) -{ - // It is required to submit at least one argument - if (!*args) - return false; - - std::string searchString; - std::string newCharName; - uint32 newAccount = 0; - - // GCC by some strange reason fail build code without temporary variable - std::istringstream params(args); - params >> searchString >> newCharName >> newAccount; - - DeletedInfoList foundList; - if (!GetDeletedCharacterInfoList(foundList, searchString)) - return false; - - if (foundList.empty()) - { - SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY); - return false; - } - - SendSysMessage(LANG_CHARACTER_DELETED_RESTORE); - HandleCharacterDeletedListHelper(foundList); - - if (newCharName.empty()) - { - // Drop not existed account cases - for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr) - HandleCharacterDeletedRestoreHelper(*itr); - } - else if (foundList.size() == 1 && normalizePlayerName(newCharName)) - { - DeletedInfo delInfo = foundList.front(); - - // update name - delInfo.name = newCharName; - - // if new account provided update deleted info - if (newAccount && newAccount != delInfo.accountId) - { - delInfo.accountId = newAccount; - AccountMgr::GetName(newAccount, delInfo.accountName); - } - - HandleCharacterDeletedRestoreHelper(delInfo); - } - else - SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME); - - return true; -} - -/** - * Handles the '.character deleted delete' command, which completely deletes all deleted characters which matches the given search string - * - * @see Player::GetDeletedCharacterGUIDs - * @see Player::DeleteFromDB - * @see ChatHandler::HandleCharacterDeletedListCommand - * @see ChatHandler::HandleCharacterDeletedRestoreCommand - * - * @param args the search string which either contains a player GUID or a part fo the character-name - */ -bool ChatHandler::HandleCharacterDeletedDeleteCommand(const char* args) -{ - // It is required to submit at least one argument - if (!*args) - return false; - - DeletedInfoList foundList; - if (!GetDeletedCharacterInfoList(foundList, args)) - return false; - - if (foundList.empty()) - { - SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY); - return false; - } - - SendSysMessage(LANG_CHARACTER_DELETED_DELETE); - HandleCharacterDeletedListHelper(foundList); - - // Call the appropriate function to delete them (current account for deleted characters is 0) - for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) - Player::DeleteFromDB(itr->lowguid, 0, false, true); - - return true; -} - -/** - * Handles the '.character deleted old' command, which completely deletes all deleted characters deleted with some days ago - * - * @see Player::DeleteOldCharacters - * @see Player::DeleteFromDB - * @see ChatHandler::HandleCharacterDeletedDeleteCommand - * @see ChatHandler::HandleCharacterDeletedListCommand - * @see ChatHandler::HandleCharacterDeletedRestoreCommand - * - * @param args the search string which either contains a player GUID or a part fo the character-name - */ -bool ChatHandler::HandleCharacterDeletedOldCommand(const char* args) -{ - int32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS); - - char* px = strtok((char*)args, " "); - if (px) - { - if (!isNumeric(px)) - return false; - - keepDays = atoi(px); - if (keepDays < 0) - return false; - } - // config option value 0 -> disabled and can't be used - else if (keepDays <= 0) - return false; - - Player::DeleteOldCharacters((uint32)keepDays); - return true; -} - -bool ChatHandler::HandleCharacterEraseCommand(const char* args){ - if (!*args) - return false; - - char *character_name_str = strtok((char*)args, " "); - if (!character_name_str) - return false; - - std::string character_name = character_name_str; - if (!normalizePlayerName(character_name)) - return false; - - uint64 character_guid; - uint32 account_id; - - Player* player = sObjectAccessor->FindPlayerByName(character_name.c_str()); - if (player) - { - character_guid = player->GetGUID(); - account_id = player->GetSession()->GetAccountId(); - player->GetSession()->KickPlayer(); - } - else - { - character_guid = sObjectMgr->GetPlayerGUIDByName(character_name); - if (!character_guid) - { - PSendSysMessage(LANG_NO_PLAYER, character_name.c_str()); - SetSentErrorMessage(true); - return false; - } - - account_id = sObjectMgr->GetPlayerAccountIdByGUID(character_guid); - } - - std::string account_name; - AccountMgr::GetName (account_id, account_name); - - Player::DeleteFromDB(character_guid, account_id, true, true); - PSendSysMessage(LANG_CHARACTER_DELETED, character_name.c_str(), GUID_LOPART(character_guid), account_name.c_str(), account_id); - return true; -} - -/// Exit the realm -bool ChatHandler::HandleServerExitCommand(const char* /*args*/) -{ - SendSysMessage(LANG_COMMAND_EXIT); - World::StopNow(SHUTDOWN_EXIT_CODE); - return true; -} - -/// Set the level of logging -bool ChatHandler::HandleServerSetLogFileLevelCommand(const char *args) -{ - if (!*args) - return false; - - char *NewLevel = strtok((char*)args, " "); - if (!NewLevel) - return false; - - sLog->SetLogFileLevel(NewLevel); - return true; -} - -/// Set the level of logging -bool ChatHandler::HandleServerSetLogLevelCommand(const char *args) -{ - if (!*args) - return false; - - char *NewLevel = strtok((char*)args, " "); - if (!NewLevel) - return false; - - sLog->SetLogLevel(NewLevel); - return true; -} - -/// set diff time record interval -bool ChatHandler::HandleServerSetDiffTimeCommand(const char *args) -{ - if (!*args) - return false; - - char *NewTimeStr = strtok((char*)args, " "); - if (!NewTimeStr) - return false; - - int32 NewTime =atoi(NewTimeStr); - if (NewTime < 0) - return false; - - sWorld->SetRecordDiffInterval(NewTime); - printf( "Record diff every %u ms\n", NewTime); - return true; -} - -/// toggle sql driver query logging -bool ChatHandler::HandleServerToggleQueryLogging(const char* /* args */) -{ - sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging()); - if (sLog->GetSQLDriverQueryLogging()) - PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED); - else - PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED); - - return true; -} - -/// @} - #ifdef linux // Non-blocking keypress detector, when return pressed, return 1, else always return 0 int kb_hit_return() -- cgit v1.2.3 From 7e6273315cea7877063dc0e901dab7fdfbb44e60 Mon Sep 17 00:00:00 2001 From: Nay Date: Thu, 21 Jun 2012 00:27:13 +0100 Subject: Scripts/Commands: Fix non pch build (add missing includes) --- src/server/scripts/Commands/cs_character.cpp | 1 + src/server/scripts/Commands/cs_server.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index d5e674a1097..1784d73cbab 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" #include "AccountMgr.h" +#include "ObjectMgr.h" class character_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index 12528f384a4..2e5b929d460 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "Chat.h" #include "SystemConfig.h" #include "Config.h" +#include "ObjectAccessor.h" class server_commandscript : public CommandScript { -- cgit v1.2.3 From 874dff2050da98b2ca164319430e76148020ff23 Mon Sep 17 00:00:00 2001 From: Nay Date: Thu, 21 Jun 2012 01:38:55 +0100 Subject: Scripts/Commands: No one likes tabs :( --- src/server/game/Scripting/ScriptLoader.cpp | 2 +- src/server/scripts/Commands/cs_modify.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index c18c6914096..94da23110b8 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -667,7 +667,7 @@ void AddCommandScripts() AddSC_quest_commandscript(); AddSC_reload_commandscript(); AddSC_tele_commandscript(); - AddSC_server_commandscript(); + AddSC_server_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); AddSC_character_commandscript(); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 3e04cb48af4..60c5e1cf162 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1390,7 +1390,7 @@ public: if (!target) target = handler->GetSession()->GetPlayer(); - // check online security + // check online security else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) return false; -- cgit v1.2.3 From d3bf4626d05883ed856785e19f70f29340157ad2 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 20 Jun 2012 14:57:03 +0200 Subject: Core/Commands: Convert list commands in commandscript --- src/server/game/Chat/Chat.cpp | 10 - src/server/game/Chat/Chat.h | 5 - src/server/game/Chat/Commands/Level3.cpp | 407 ------------------------- src/server/scripts/Commands/CMakeLists.txt | 5 +- src/server/scripts/Commands/cs_list.cpp | 467 +++++++++++++++++++++++++++++ 5 files changed, 469 insertions(+), 425 deletions(-) create mode 100644 src/server/scripts/Commands/cs_list.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index f96199f9bd3..bbfab474e22 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -122,15 +122,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand listCommandTable[] = - { - { "creature", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListCreatureCommand>, "", NULL }, - { "item", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListItemCommand>, "", NULL }, - { "object", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListObjectCommand>, "", NULL }, - { "auras", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleListAurasCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand lookupPlayerCommandTable[] = { { "ip", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerIpCommand>, "", NULL }, @@ -234,7 +225,6 @@ ChatCommand* ChatHandler::getCommandTable() static ChatCommand commandTable[] = { - { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index c43b0fa9aca..9fc9b394947 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -163,11 +163,6 @@ class ChatHandler bool HandleGuildRankCommand(const char* args); bool HandleGuildDeleteCommand(const char* args); - bool HandleListAurasCommand(const char * args); - bool HandleListCreatureCommand(const char* args); - bool HandleListItemCommand(const char* args); - bool HandleListObjectCommand(const char* args); - bool HandleLookupAreaCommand(const char* args); bool HandleLookupCreatureCommand(const char* args); bool HandleLookupEventCommand(const char* args); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 33855a96617..eed4c11e1a9 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -385,365 +385,6 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args) return true; } -bool ChatHandler::HandleListItemCommand(const char *args) -{ - if (!*args) - return false; - - char* cId = extractKeyFromLink((char*)args, "Hitem"); - if (!cId) - return false; - - uint32 item_id = atol(cId); - if (!item_id) - { - PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); - SetSentErrorMessage(true); - return false; - } - - ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id); - if (!itemProto) - { - PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); - SetSentErrorMessage(true); - return false; - } - - char* c_count = strtok(NULL, " "); - int _count = c_count ? atol(c_count) : 10; - - if (_count < 0) - return false; - uint32 count = uint32(_count); - - PreparedQueryResult result; - - // inventory case - uint32 inv_count = 0; - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM); - stmt->setUInt32(0, item_id); - result = CharacterDatabase.Query(stmt); - - if (result) - inv_count = (*result)[0].GetUInt64(); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY); - stmt->setUInt32(0, item_id); - stmt->setUInt32(1, count); - result = CharacterDatabase.Query(stmt); - - if (result) - { - do - { - Field* fields = result->Fetch(); - uint32 item_guid = fields[0].GetUInt32(); - uint32 item_bag = fields[1].GetUInt32(); - uint8 item_slot = fields[2].GetUInt8(); - uint32 owner_guid = fields[3].GetUInt32(); - uint32 owner_acc = fields[4].GetUInt32(); - std::string owner_name = fields[5].GetString(); - - char const* item_pos = 0; - if (Player::IsEquipmentPos(item_bag, item_slot)) - item_pos = "[equipped]"; - else if (Player::IsInventoryPos(item_bag, item_slot)) - item_pos = "[in inventory]"; - else if (Player::IsBankPos(item_bag, item_slot)) - item_pos = "[in bank]"; - else - item_pos = ""; - - PSendSysMessage(LANG_ITEMLIST_SLOT, item_guid, owner_name.c_str(), owner_guid, owner_acc, item_pos); - } - while (result->NextRow()); - - uint32 res_count = uint32(result->GetRowCount()); - - if (count > res_count) - count -= res_count; - else if (count) - count = 0; - } - - // mail case - uint32 mail_count = 0; - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM); - stmt->setUInt32(0, item_id); - result = CharacterDatabase.Query(stmt); - - if (result) - mail_count = (*result)[0].GetUInt64(); - - if (count > 0) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ITEMS_BY_ENTRY); - stmt->setUInt32(0, item_id); - stmt->setUInt32(1, count); - result = CharacterDatabase.Query(stmt); - } - else - result = PreparedQueryResult(NULL); - - if (result) - { - do - { - Field* fields = result->Fetch(); - uint32 item_guid = fields[0].GetUInt32(); - uint32 item_s = fields[1].GetUInt32(); - uint32 item_r = fields[2].GetUInt32(); - uint32 item_s_acc = fields[3].GetUInt32(); - std::string item_s_name = fields[4].GetString(); - uint32 item_r_acc = fields[5].GetUInt32(); - std::string item_r_name = fields[6].GetString(); - - char const* item_pos = "[in mail]"; - - PSendSysMessage(LANG_ITEMLIST_MAIL, item_guid, item_s_name.c_str(), item_s, item_s_acc, item_r_name.c_str(), item_r, item_r_acc, item_pos); - } - while (result->NextRow()); - - uint32 res_count = uint32(result->GetRowCount()); - - if (count > res_count) - count -= res_count; - else if (count) - count = 0; - } - - // auction case - uint32 auc_count = 0; - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM); - stmt->setUInt32(0, item_id); - result = CharacterDatabase.Query(stmt); - - if (result) - auc_count = (*result)[0].GetUInt64(); - - if (count > 0) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY); - stmt->setUInt32(0, item_id); - stmt->setUInt32(1, count); - result = CharacterDatabase.Query(stmt); - } - else - result = PreparedQueryResult(NULL); - - if (result) - { - do - { - Field* fields = result->Fetch(); - uint32 item_guid = fields[0].GetUInt32(); - uint32 owner = fields[1].GetUInt32(); - uint32 owner_acc = fields[2].GetUInt32(); - std::string owner_name = fields[3].GetString(); - - char const* item_pos = "[in auction]"; - - PSendSysMessage(LANG_ITEMLIST_AUCTION, item_guid, owner_name.c_str(), owner, owner_acc, item_pos); - } - while (result->NextRow()); - } - - // guild bank case - uint32 guild_count = 0; - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_COUNT_ITEM); - stmt->setUInt32(0, item_id); - result = CharacterDatabase.Query(stmt); - - if (result) - guild_count = (*result)[0].GetUInt64(); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY); - stmt->setUInt32(0, item_id); - stmt->setUInt32(1, count); - result = CharacterDatabase.Query(stmt); - - if (result) - { - do - { - Field* fields = result->Fetch(); - uint32 item_guid = fields[0].GetUInt32(); - uint32 guild_guid = fields[1].GetUInt32(); - std::string guild_name = fields[2].GetString(); - - char const* item_pos = "[in guild bank]"; - - PSendSysMessage(LANG_ITEMLIST_GUILD, item_guid, guild_name.c_str(), guild_guid, item_pos); - } - while (result->NextRow()); - - uint32 res_count = uint32(result->GetRowCount()); - - if (count > res_count) - count -= res_count; - else if (count) - count = 0; - } - - if (inv_count + mail_count + auc_count + guild_count == 0) - { - SendSysMessage(LANG_COMMAND_NOITEMFOUND); - SetSentErrorMessage(true); - return false; - } - - PSendSysMessage(LANG_COMMAND_LISTITEMMESSAGE, item_id, inv_count + mail_count + auc_count + guild_count, inv_count, mail_count, auc_count, guild_count); - return true; -} - -bool ChatHandler::HandleListObjectCommand(const char *args) -{ - if (!*args) - return false; - - // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r - char* cId = extractKeyFromLink((char*)args, "Hgameobject_entry"); - if (!cId) - return false; - - uint32 go_id = atol(cId); - if (!go_id) - { - PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); - SetSentErrorMessage(true); - return false; - } - - GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(go_id); - if (!gInfo) - { - PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); - SetSentErrorMessage(true); - return false; - } - - char* c_count = strtok(NULL, " "); - int count = c_count ? atol(c_count) : 10; - - if (count < 0) - return false; - - QueryResult result; - - uint32 obj_count = 0; - result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id); - if (result) - obj_count = (*result)[0].GetUInt64(); - - if (m_session) - { - Player* player = m_session->GetPlayer(); - result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", - player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), go_id, uint32(count)); - } - else - result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u", - go_id, uint32(count)); - - if (result) - { - do - { - Field* fields = result->Fetch(); - uint32 guid = fields[0].GetUInt32(); - float x = fields[1].GetFloat(); - float y = fields[2].GetFloat(); - float z = fields[3].GetFloat(); - int mapid = fields[4].GetUInt16(); - uint32 entry = fields[5].GetUInt32(); - - if (m_session) - PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapid); - else - PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name.c_str(), x, y, z, mapid); - } while (result->NextRow()); - } - - PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, go_id, obj_count); - return true; -} - -bool ChatHandler::HandleListCreatureCommand(const char *args) -{ - if (!*args) - return false; - - // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r - char* cId = extractKeyFromLink((char*)args, "Hcreature_entry"); - if (!cId) - return false; - - uint32 cr_id = atol(cId); - if (!cr_id) - { - PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); - SetSentErrorMessage(true); - return false; - } - - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cr_id); - if (!cInfo) - { - PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); - SetSentErrorMessage(true); - return false; - } - - char* c_count = strtok(NULL, " "); - int count = c_count ? atol(c_count) : 10; - - if (count < 0) - return false; - - QueryResult result; - - uint32 cr_count = 0; - result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id); - if (result) - cr_count = (*result)[0].GetUInt64(); - - if (m_session) - { - Player* player = m_session->GetPlayer(); - result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", - player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), cr_id, uint32(count)); - } - else - result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u", - cr_id, uint32(count)); - - if (result) - { - do - { - Field* fields = result->Fetch(); - uint32 guid = fields[0].GetUInt32(); - float x = fields[1].GetFloat(); - float y = fields[2].GetFloat(); - float z = fields[3].GetFloat(); - int mapid = fields[4].GetUInt16(); - - if (m_session) - PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name.c_str(), x, y, z, mapid); - else - PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name.c_str(), x, y, z, mapid); - } while (result->NextRow()); - } - - PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, cr_id, cr_count); - return true; -} - bool ChatHandler::HandleLookupItemCommand(const char *args) { if (!*args) @@ -2349,54 +1990,6 @@ bool ChatHandler::HandleChangeWeather(const char *args) return true; } -bool ChatHandler::HandleListAurasCommand (const char * /*args*/) -{ - Unit* unit = getSelectedUnit(); - if (!unit) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - char const* talentStr = GetTrinityString(LANG_TALENT); - char const* passiveStr = GetTrinityString(LANG_PASSIVE); - - Unit::AuraApplicationMap const& uAuras = unit->GetAppliedAuras(); - PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size()); - for (Unit::AuraApplicationMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr) - { - bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0; - - AuraApplication const* aurApp = itr->second; - Aura const* aura = aurApp->GetBase(); - char const* name = aura->GetSpellInfo()->SpellName[GetSessionDbcLocale()]; - - std::ostringstream ss_name; - ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r"; - - PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (m_session ? ss_name.str().c_str() : name), - aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(), - aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""), - (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature", - GUID_LOPART(aura->GetCasterGUID())); - } - for (uint16 i = 0; i < TOTAL_AURAS; ++i) - { - Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i)); - if (uAuraList.empty()) - continue; - - PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i); - for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) - { - PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), - (*itr)->GetAmount()); - } - } - return true; -} - bool ChatHandler::HandleResetAchievementsCommand (const char * args) { Player* target; diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 86e1baeb52d..962efd1d79c 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -13,6 +13,7 @@ set(scripts_STAT_SRCS Commands/cs_account.cpp Commands/cs_achievement.cpp Commands/cs_cast.cpp + Commands/cs_character.cpp Commands/cs_debug.cpp Commands/cs_event.cpp Commands/cs_gm.cpp @@ -21,6 +22,7 @@ set(scripts_STAT_SRCS Commands/cs_honor.cpp Commands/cs_instance.cpp Commands/cs_learn.cpp + Commands/cs_list.cpp Commands/cs_misc.cpp Commands/cs_modify.cpp Commands/cs_npc.cpp @@ -30,13 +32,10 @@ set(scripts_STAT_SRCS Commands/cs_server.cpp Commands/cs_titles.cpp Commands/cs_wp.cpp - Commands/cs_character.cpp -# Commands/cs_list.cpp # Commands/cs_lookup.cpp # Commands/cs_pdump.cpp # Commands/cs_guild.cpp # Commands/cs_reset.cpp -# Commands/cs_server.cpp # Commands/cs_channel.cpp # Commands/cs_pet.cpp # Commands/cs_ticket.cpp diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp new file mode 100644 index 00000000000..bec5eacdc21 --- /dev/null +++ b/src/server/scripts/Commands/cs_list.cpp @@ -0,0 +1,467 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: list_commandscript +%Complete: 100 +Comment: All list related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "SpellAuraEffects.h" + +class list_commandscript : public CommandScript +{ +public: + list_commandscript() : CommandScript("list_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand listCommandTable[] = + { + { "creature", SEC_ADMINISTRATOR, true, &HandleListCreatureCommand, "", NULL }, + { "item", SEC_ADMINISTRATOR, true, &HandleListItemCommand, "", NULL }, + { "object", SEC_ADMINISTRATOR, true, &HandleListObjectCommand, "", NULL }, + { "auras", SEC_ADMINISTRATOR, false, &HandleListAurasCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleListCreatureCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r + char* id = handler->extractKeyFromLink((char*)args, "Hcreature_entry"); + if (!id) + return false; + + uint32 creatureId = atol(id); + if (!creatureId) + { + handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId); + handler->SetSentErrorMessage(true); + return false; + } + + CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureId); + if (!cInfo) + { + handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId); + handler->SetSentErrorMessage(true); + return false; + } + + char* countStr = strtok(NULL, " "); + uint32 count = countStr ? atol(countStr) : 10; + + if (count < 0) + return false; + + QueryResult result; + + uint32 creatureCount = 0; + result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", creatureId); + if (result) + creatureCount = (*result)[0].GetUInt64(); + + if (handler->GetSession()) + { + Player* player = handler->GetSession()->GetPlayer(); + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), creatureId, count); + } + else + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u", + creatureId, count); + + if (result) + { + do + { + Field* fields = result->Fetch(); + uint32 guid = fields[0].GetUInt32(); + float x = fields[1].GetFloat(); + float y = fields[2].GetFloat(); + float z = fields[3].GetFloat(); + uint16 mapId = fields[4].GetUInt16(); + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name.c_str(), x, y, z, mapId); + else + handler->PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name.c_str(), x, y, z, mapId); + } + while (result->NextRow()); + } + + handler->PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, creatureId, creatureCount); + + return true; + } + + static bool HandleListItemCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* id = handler->extractKeyFromLink((char*)args, "Hitem"); + if (!id) + return false; + + uint32 itemId = atol(id); + if (!itemId) + { + handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); + if (!itemTemplate) + { + handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + char* countStr = strtok(NULL, " "); + uint32 count = countStr ? atol(countStr) : 10; + + if (count < 0) + return false; + + PreparedQueryResult result; + + // inventory case + uint32 inventoryCount = 0; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM); + stmt->setUInt32(0, itemId); + result = CharacterDatabase.Query(stmt); + + if (result) + inventoryCount = (*result)[0].GetUInt64(); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY); + stmt->setUInt32(0, itemId); + stmt->setUInt32(1, count); + result = CharacterDatabase.Query(stmt); + + if (result) + { + do + { + Field* fields = result->Fetch(); + uint32 itemGuid = fields[0].GetUInt32(); + uint32 itemBag = fields[1].GetUInt32(); + uint8 itemSlot = fields[2].GetUInt8(); + uint32 ownerGuid = fields[3].GetUInt32(); + uint32 ownerAccountId = fields[4].GetUInt32(); + std::string ownerName = fields[5].GetString(); + + char const* itemPos = 0; + if (Player::IsEquipmentPos(itemBag, itemSlot)) + itemPos = "[equipped]"; + else if (Player::IsInventoryPos(itemBag, itemSlot)) + itemPos = "[in inventory]"; + else if (Player::IsBankPos(itemBag, itemSlot)) + itemPos = "[in bank]"; + else + itemPos = ""; + + handler->PSendSysMessage(LANG_ITEMLIST_SLOT, itemGuid, ownerName.c_str(), ownerGuid, ownerAccountId, itemPos); + } + while (result->NextRow()); + + uint32 resultCount = uint32(result->GetRowCount()); + + if (count > resultCount) + count -= resultCount; + else if (count) + count = 0; + } + + // mail case + uint32 mailCount; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM); + stmt->setUInt32(0, itemId); + result = CharacterDatabase.Query(stmt); + + if (result) + mailCount = (*result)[0].GetUInt64(); + + if (count > 0) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ITEMS_BY_ENTRY); + stmt->setUInt32(0, itemId); + stmt->setUInt32(1, count); + result = CharacterDatabase.Query(stmt); + } + else + result = PreparedQueryResult(NULL); + + if (result) + { + do + { + Field* fields = result->Fetch(); + uint32 itemGuid = fields[0].GetUInt32(); + uint32 itemSender = fields[1].GetUInt32(); + uint32 itemReceiver = fields[2].GetUInt32(); + uint32 itemSenderAccountId = fields[3].GetUInt32(); + std::string itemSenderName = fields[4].GetString(); + uint32 itemReceiverAccount = fields[5].GetUInt32(); + std::string itemReceiverName = fields[6].GetString(); + + char const* itemPos = "[in mail]"; + + handler->PSendSysMessage(LANG_ITEMLIST_MAIL, itemGuid, itemSenderName.c_str(), itemSender, itemSenderAccountId, itemReceiverName.c_str(), itemReceiver, itemReceiverAccount, itemPos); + } + while (result->NextRow()); + + uint32 resultCount = uint32(result->GetRowCount()); + + if (count > resultCount) + count -= resultCount; + else if (count) + count = 0; + } + + // auction case + uint32 auctionCount = 0; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM); + stmt->setUInt32(0, itemId); + result = CharacterDatabase.Query(stmt); + + if (result) + auctionCount = (*result)[0].GetUInt64(); + + if (count > 0) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY); + stmt->setUInt32(0, itemId); + stmt->setUInt32(1, count); + result = CharacterDatabase.Query(stmt); + } + else + result = PreparedQueryResult(NULL); + + if (result) + { + do + { + Field* fields = result->Fetch(); + uint32 itemGuid = fields[0].GetUInt32(); + uint32 owner = fields[1].GetUInt32(); + uint32 ownerAccountId = fields[2].GetUInt32(); + std::string ownerName = fields[3].GetString(); + + char const* itemPos = "[in auction]"; + + handler->PSendSysMessage(LANG_ITEMLIST_AUCTION, itemGuid, ownerName.c_str(), owner, ownerAccountId, itemPos); + } + while (result->NextRow()); + } + + // guild bank case + uint32 guildCount = 0; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_COUNT_ITEM); + stmt->setUInt32(0, itemId); + result = CharacterDatabase.Query(stmt); + + if (result) + guildCount = (*result)[0].GetUInt64(); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY); + stmt->setUInt32(0, itemId); + stmt->setUInt32(1, count); + result = CharacterDatabase.Query(stmt); + + if (result) + { + do + { + Field* fields = result->Fetch(); + uint32 itemGuid = fields[0].GetUInt32(); + uint32 guildGuid = fields[1].GetUInt32(); + std::string guildName = fields[2].GetString(); + + char const* itemPos = "[in guild bank]"; + + handler->PSendSysMessage(LANG_ITEMLIST_GUILD, itemGuid, guildName.c_str(), guildGuid, itemPos); + } + while (result->NextRow()); + + uint32 resultCount = uint32(result->GetRowCount()); + + if (count > resultCount) + count -= resultCount; + else if (count) + count = 0; + } + + if (inventoryCount + mailCount + auctionCount + guildCount == 0) + { + handler->SendSysMessage(LANG_COMMAND_NOITEMFOUND); + handler->SetSentErrorMessage(true); + return false; + } + + handler->PSendSysMessage(LANG_COMMAND_LISTITEMMESSAGE, itemId, inventoryCount + mailCount + auctionCount + guildCount, inventoryCount, mailCount, auctionCount, guildCount); + + return true; + } + + static bool HandleListObjectCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject_entry"); + if (!id) + return false; + + uint32 gameObjectId = atol(id); + if (!gameObjectId) + { + handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId); + handler->SetSentErrorMessage(true); + return false; + } + + GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(gameObjectId); + if (!gInfo) + { + handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId); + handler->SetSentErrorMessage(true); + return false; + } + + char* countStr = strtok(NULL, " "); + uint32 count = countStr ? atol(countStr) : 10; + + if (count < 0) + return false; + + QueryResult result; + + uint32 objectCount = 0; + result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", gameObjectId); + if (result) + objectCount = (*result)[0].GetUInt64(); + + if (handler->GetSession()) + { + Player* player = handler->GetSession()->GetPlayer(); + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), gameObjectId, count); + } + else + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u", + gameObjectId, count); + + if (result) + { + do + { + Field* fields = result->Fetch(); + uint32 guid = fields[0].GetUInt32(); + float x = fields[1].GetFloat(); + float y = fields[2].GetFloat(); + float z = fields[3].GetFloat(); + uint16 mapId = fields[4].GetUInt16(); + uint32 entry = fields[5].GetUInt32(); + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapId); + else + handler->PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name.c_str(), x, y, z, mapId); + } + while (result->NextRow()); + } + + handler->PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, gameObjectId, objectCount); + + return true; + } + + static bool HandleListAurasCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + char const* talentStr = handler->GetTrinityString(LANG_TALENT); + char const* passiveStr = handler->GetTrinityString(LANG_PASSIVE); + + Unit::AuraApplicationMap const& auras = unit->GetAppliedAuras(); + handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, auras.size()); + for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0; + + AuraApplication const* aurApp = itr->second; + Aura const* aura = aurApp->GetBase(); + char const* name = aura->GetSpellInfo()->SpellName[handler->GetSessionDbcLocale()]; + + std::ostringstream ss_name; + ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r"; + + handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name), + aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(), + aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""), + (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature", + GUID_LOPART(aura->GetCasterGUID())); + } + + for (uint16 i = 0; i < TOTAL_AURAS; ++i) + { + Unit::AuraEffectList const& auraList = unit->GetAuraEffectsByType(AuraType(i)); + if (auraList.empty()) + continue; + + handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, auraList.size(), i); + + for (Unit::AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end(); ++itr) + handler->PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), (*itr)->GetAmount()); + } + + return true; + } +}; + +void AddSC_list_commandscript() +{ + new list_commandscript(); +} -- cgit v1.2.3 From 3368e888a182969e2a6a5bf56ee35b8971714628 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 21 Jun 2012 18:21:34 +0200 Subject: Core/Commands: Fix some codestyle for a312cd4ba1f47d3dceb774091ec143c90a298cda --- src/server/scripts/Commands/cs_character.cpp | 150 ++++++------ src/server/scripts/Commands/cs_server.cpp | 342 ++++++++++++++------------- 2 files changed, 252 insertions(+), 240 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 1784d73cbab..a40b586f8c8 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -48,7 +48,7 @@ public: { "customize", SEC_GAMEMASTER, true, &HandleCharacterCustomizeCommand, "", NULL }, { "changefaction", SEC_GAMEMASTER, true, &HandleCharacterChangeFactionCommand, "", NULL }, { "changerace", SEC_GAMEMASTER, true, &HandleCharacterChangeRaceCommand, "", NULL }, - { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable}, + { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable}, { "erase", SEC_CONSOLE, true, &HandleCharacterEraseCommand, "", NULL }, { "level", SEC_ADMINISTRATOR, true, &HandleCharacterLevelCommand, "", NULL }, { "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "", NULL }, @@ -59,17 +59,16 @@ public: static ChatCommand commandTable[] = { - { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable}, - { NULL, 0, false, NULL, "", NULL } - }; - + { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable}, + { NULL, 0, false, NULL, "", NULL } + }; return commandTable; } // Stores informations about a deleted character struct DeletedInfo { - uint32 lowguid; ///< the low GUID from the character + uint32 lowGuid; ///< the low GUID from the character std::string name; ///< the character name uint32 accountId; ///< the account id std::string accountName; ///< the account name @@ -95,9 +94,7 @@ public: if (isNumeric(searchString.c_str())) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID); - stmt->setUInt32(0, uint32(atoi(searchString.c_str()))); - result = CharacterDatabase.Query(stmt); } // search by name @@ -105,42 +102,38 @@ public: { if (!normalizePlayerName(searchString)) return false; - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME); - - stmt->setString(0, searchString); - + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME); + stmt->setString(0, searchString); result = CharacterDatabase.Query(stmt); } } else { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO); - + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO); result = CharacterDatabase.Query(stmt); } - + if (result) { do { Field* fields = result->Fetch(); - + DeletedInfo info; - - info.lowguid = fields[0].GetUInt32(); + + info.lowGuid = fields[0].GetUInt32(); info.name = fields[1].GetString(); info.accountId = fields[2].GetUInt32(); - + // account name will be empty for not existed account AccountMgr::GetName(info.accountId, info.accountName); - - info.deleteDate = time_t(fields[3].GetUInt32()); - + info.deleteDate = time_t(fields[3].GetUInt32()); foundList.push_back(info); - } while (result->NextRow()); + } + while (result->NextRow()); } - + return true; } @@ -162,21 +155,21 @@ public: handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_HEADER); handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); } - + for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) { std::string dateStr = TimeToTimestampStr(itr->deleteDate); - + if (!handler->GetSession()) handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE, - itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), + itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), itr->accountId, dateStr.c_str()); else handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT, - itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), + itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), itr->accountId, dateStr.c_str()); } - + if (!handler->GetSession()) handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); } @@ -195,36 +188,34 @@ public: { if (delInfo.accountName.empty()) // account not exist { - handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId); return; } - + // check character count uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId); if (charcount >= 10) { - handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId); return; } - + if (sObjectMgr->GetPlayerGUIDByName(delInfo.name)) { - handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId); return; } - + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO); - stmt->setString(0, delInfo.name); stmt->setUInt32(1, delInfo.accountId); - stmt->setUInt32(2, delInfo.lowguid); - + stmt->setUInt32(2, delInfo.lowGuid); CharacterDatabase.Execute(stmt); - + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); - stmt->setUInt32(0, delInfo.lowguid); + stmt->setUInt32(0, delInfo.lowGuid); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) - sWorld->AddCharacterNameData(delInfo.lowguid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8()); + sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8()); } static bool HandleCharacterTitlesCommand(ChatHandler* handler, char const* args) @@ -265,6 +256,7 @@ public: handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr); } } + return true; } @@ -294,11 +286,13 @@ public: std::string oldNameLink = handler->playerLink(targetName); handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); stmt->setUInt32(1, GUID_LOPART(targetGuid)); CharacterDatabase.Execute(stmt); } + return true; } @@ -318,12 +312,12 @@ public: } Player* target; - uint64 target_guid; - std::string target_name; - if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) - return false; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) + return false; - int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid); + int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(targetGuid); int32 newlevel = levelStr ? atoi(levelStr) : oldlevel; if (newlevel < 1) @@ -332,10 +326,10 @@ public: if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level newlevel = STRONG_MAX_LEVEL; - handler->HandleCharacterLevel(target, target_guid, oldlevel, newlevel); + handler->HandleCharacterLevel(target, targetGuid, oldlevel, newlevel); if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == NULL { - std::string nameLink = handler->playerLink(target_name); + std::string nameLink = handler->playerLink(targetName); handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); } @@ -438,7 +432,7 @@ public: FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList(); for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr) { - const FactionState& faction = itr->second; + FactionState const& faction = itr->second; FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID); char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#"; ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); @@ -463,9 +457,10 @@ public: ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); if (faction.Flags & FACTION_FLAG_INACTIVE) ss << handler->GetTrinityString(LANG_FACTION_INACTIVE); - + handler->SendSysMessage(ss.str().c_str()); } + return true; } @@ -493,6 +488,7 @@ public: } HandleCharacterDeletedListHelper(foundList, handler); + return true; } @@ -593,7 +589,7 @@ public: // Call the appropriate function to delete them (current account for deleted characters is 0) for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) - Player::DeleteFromDB(itr->lowguid, 0, false, true); + Player::DeleteFromDB(itr->lowGuid, 0, false, true); return true; } @@ -609,17 +605,17 @@ public: * * @param args the search string which either contains a player GUID or a part fo the character-name */ - static bool HandleCharacterDeletedOldCommand(ChatHandler* handler, char const* args) + static bool HandleCharacterDeletedOldCommand(ChatHandler* /*handler*/, char const* args) { int32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS); - char* px = strtok((char*)args, " "); - if (px) + char* daysStr = strtok((char*)args, " "); + if (daysStr) { - if (!isNumeric(px)) + if (!isNumeric(daysStr)) return false; - keepDays = atoi(px); + keepDays = atoi(daysStr); if (keepDays < 0) return false; } @@ -627,7 +623,8 @@ public: else if (keepDays <= 0) return false; - Player::DeleteOldCharacters((uint32)keepDays); + Player::DeleteOldCharacters(uint32(keepDays)); + return true; } @@ -636,41 +633,42 @@ public: if (!*args) return false; - char *character_name_str = strtok((char*)args, " "); - if (!character_name_str) + char* characterName_str = strtok((char*)args, " "); + if (!characterName_str) return false; - std::string character_name = character_name_str; - if (!normalizePlayerName(character_name)) + std::string characterName = characterName_str; + if (!normalizePlayerName(characterName)) return false; - uint64 character_guid; - uint32 account_id; + uint64 characterGuid; + uint32 accountId; - Player* player = sObjectAccessor->FindPlayerByName(character_name.c_str()); + Player* player = sObjectAccessor->FindPlayerByName(characterName.c_str()); if (player) { - character_guid = player->GetGUID(); - account_id = player->GetSession()->GetAccountId(); + characterGuid = player->GetGUID(); + accountId = player->GetSession()->GetAccountId(); player->GetSession()->KickPlayer(); } else { - character_guid = sObjectMgr->GetPlayerGUIDByName(character_name); - if (!character_guid) + characterGuid = sObjectMgr->GetPlayerGUIDByName(characterName); + if (!characterGuid) { - handler->PSendSysMessage(LANG_NO_PLAYER, character_name.c_str()); + handler->PSendSysMessage(LANG_NO_PLAYER, characterName.c_str()); handler->SetSentErrorMessage(true); return false; } - account_id = sObjectMgr->GetPlayerAccountIdByGUID(character_guid); + accountId = sObjectMgr->GetPlayerAccountIdByGUID(characterGuid); } - std::string account_name; - AccountMgr::GetName (account_id, account_name); + std::string accountName; + AccountMgr::GetName(accountId, accountName); + + Player::DeleteFromDB(characterGuid, accountId, true, true); + handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), GUID_LOPART(characterGuid), accountName.c_str(), accountId); - Player::DeleteFromDB(character_guid, account_id, true, true); - handler->PSendSysMessage(LANG_CHARACTER_DELETED, character_name.c_str(), GUID_LOPART(character_guid), account_name.c_str(), account_id); return true; } }; @@ -678,4 +676,4 @@ public: void AddSC_character_commandscript() { new character_commandscript(); -} \ No newline at end of file +} diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index 2e5b929d460..8f10af5fe2a 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -37,83 +37,83 @@ public: { static ChatCommand serverIdleRestartCommandTable[] = { - { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, - { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, + { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand serverIdleShutdownCommandTable[] = { - { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, - { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, + { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand serverRestartCommandTable[] = { - { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, - { "" , SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, + { "" , SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand serverShutdownCommandTable[] = - { - { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, - { "" , SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { + { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL }, + { "" , SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand serverSetCommandTable[] = { - { "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "", NULL }, - { "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "", NULL }, - { "logfilelevel", SEC_CONSOLE, true, &HandleServerSetLogFileLevelCommand, "", NULL }, - { "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "", NULL }, - { "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "", NULL }, + { "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "", NULL }, + { "logfilelevel", SEC_CONSOLE, true, &HandleServerSetLogFileLevelCommand, "", NULL }, + { "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "", NULL }, + { "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand serverCommandTable[] = { - { "corpses", SEC_GAMEMASTER, true, &HandleServerCorpsesCommand, "", NULL }, - { "exit", SEC_CONSOLE, true, &HandleServerExitCommand, "", NULL }, - { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, - { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable }, - { "info", SEC_PLAYER, true, &HandleServerInfoCommand, "", NULL }, - { "motd", SEC_PLAYER, true, &HandleServerMotdCommand, "", NULL }, - { "plimit", SEC_ADMINISTRATOR, true, &HandleServerPLimitCommand, "", NULL }, - { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, - { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, - { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, - { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "corpses", SEC_GAMEMASTER, true, &HandleServerCorpsesCommand, "", NULL }, + { "exit", SEC_CONSOLE, true, &HandleServerExitCommand, "", NULL }, + { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, + { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable }, + { "info", SEC_PLAYER, true, &HandleServerInfoCommand, "", NULL }, + { "motd", SEC_PLAYER, true, &HandleServerMotdCommand, "", NULL }, + { "plimit", SEC_ADMINISTRATOR, true, &HandleServerPLimitCommand, "", NULL }, + { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, + { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, + { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, + { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { - { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, + { NULL, 0, false, NULL, "", NULL } }; return commandTable; } // Triggering corpses expire check in world - static bool HandleServerCorpsesCommand(ChatHandler* handler, char const* args) + static bool HandleServerCorpsesCommand(ChatHandler* /*handler*/, char const* /*args*/) { sObjectAccessor->RemoveOldCorpses(); return true; } - static bool HandleServerInfoCommand(ChatHandler* handler, char const* args) + static bool HandleServerInfoCommand(ChatHandler* handler, char const* /*args*/) { - uint32 playersNum = sWorld->GetPlayerCount(); - uint32 maxPlayersNum = sWorld->GetMaxPlayerCount(); - uint32 activeClientsNum = sWorld->GetActiveSessionCount(); - uint32 queuedClientsNum = sWorld->GetQueuedSessionCount(); - uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount(); - uint32 maxQueuedClientsNum = sWorld->GetMaxQueuedSessionCount(); - std::string uptime = secsToTimeString(sWorld->GetUptime()); - uint32 updateTime = sWorld->GetUpdateTime(); + uint32 playersNum = sWorld->GetPlayerCount(); + uint32 maxPlayersNum = sWorld->GetMaxPlayerCount(); + uint32 activeClientsNum = sWorld->GetActiveSessionCount(); + uint32 queuedClientsNum = sWorld->GetQueuedSessionCount(); + uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount(); + uint32 maxQueuedClientsNum = sWorld->GetMaxQueuedSessionCount(); + std::string uptime = secsToTimeString(sWorld->GetUptime()); + uint32 updateTime = sWorld->GetUpdateTime(); handler->SendSysMessage(_FULLVERSION); handler->PSendSysMessage(LANG_CONNECTED_PLAYERS, playersNum, maxPlayersNum); @@ -127,7 +127,7 @@ public: return true; } // Display the 'Message of the day' for the realm - static bool HandleServerMotdCommand(ChatHandler* handler, char const* args) + static bool HandleServerMotdCommand(ChatHandler* handler, char const* /*args*/) { handler->PSendSysMessage(LANG_MOTD_CURRENT, sWorld->GetMotd()); return true; @@ -137,199 +137,212 @@ public: { if (*args) { - char* param = strtok((char*)args, " "); - if (!param) + char* paramStr = strtok((char*)args, " "); + if (!paramStr) return false; - int l = strlen(param); + int32 limit = strlen(paramStr); - if (strncmp(param, "player", l) == 0) + if (strncmp(paramStr, "player", limit) == 0) sWorld->SetPlayerSecurityLimit(SEC_PLAYER); - else if (strncmp(param, "moderator", l) == 0) + else if (strncmp(paramStr, "moderator", limit) == 0) sWorld->SetPlayerSecurityLimit(SEC_MODERATOR); - else if (strncmp(param, "gamemaster", l) == 0) + else if (strncmp(paramStr, "gamemaster", limit) == 0) sWorld->SetPlayerSecurityLimit(SEC_GAMEMASTER); - else if (strncmp(param, "administrator", l) == 0) + else if (strncmp(paramStr, "administrator", limit) == 0) sWorld->SetPlayerSecurityLimit(SEC_ADMINISTRATOR); - else if (strncmp(param, "reset", l) == 0) + else if (strncmp(paramStr, "reset", limit) == 0) { sWorld->SetPlayerAmountLimit(ConfigMgr::GetIntDefault("PlayerLimit", 100)); sWorld->LoadDBAllowedSecurityLevel(); } else { - int val = atoi(param); - if (val < 0) - sWorld->SetPlayerSecurityLimit(AccountTypes(uint32(-val))); + int32 value = atoi(paramStr); + if (value < 0) + sWorld->SetPlayerSecurityLimit(AccountTypes(-value)); else - sWorld->SetPlayerAmountLimit(uint32(val)); - } + sWorld->SetPlayerAmountLimit(uint32(value)); + } } - uint32 pLimit = sWorld->GetPlayerAmountLimit(); + uint32 playerAmountLimit = sWorld->GetPlayerAmountLimit(); AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); char const* secName = ""; switch (allowedAccountType) { - case SEC_PLAYER: secName = "Player"; break; - case SEC_MODERATOR: secName = "Moderator"; break; - case SEC_GAMEMASTER: secName = "Gamemaster"; break; - case SEC_ADMINISTRATOR: secName = "Administrator"; break; - default: secName = ""; break; + case SEC_PLAYER: + secName = "Player"; + break; + case SEC_MODERATOR: + secName = "Moderator"; + break; + case SEC_GAMEMASTER: + secName = "Gamemaster"; + break; + case SEC_ADMINISTRATOR: + secName = "Administrator"; + break; + default: + secName = ""; + break; } - handler->PSendSysMessage("Player limits: amount %u, min. security level %s.", pLimit, secName); + handler->PSendSysMessage("Player limits: amount %u, min. security level %s.", playerAmountLimit, secName); return true; } - static bool HandleServerShutDownCancelCommand(ChatHandler* handler, char const* args) + static bool HandleServerShutDownCancelCommand(ChatHandler* /*handler*/, char const* /*args*/) { sWorld->ShutdownCancel(); + return true; } - static bool HandleServerShutDownCommand(ChatHandler* handler, char const* args) + static bool HandleServerShutDownCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) - return false; + return false; - char* time_str = strtok ((char*) args, " "); - char* exitcode_str = strtok (NULL, ""); + char* timeStr = strtok((char*) args, " "); + char* exitCodeStr = strtok(NULL, ""); - int32 time = atoi (time_str); + int32 time = atoi(timeStr); // Prevent interpret wrong arg value as 0 secs shutdown time - if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) - return false; + if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0) + return false; - if (exitcode_str) + if (exitCodeStr) { - int32 exitcode = atoi(exitcode_str); + int32 exitCode = atoi(exitCodeStr); - // Handle atoi() errors - if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) - return false; + // Handle atoi() errors + if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0')) + return false; - // Exit code should be in range of 0-125, 126-255 is used - // in many shells for their own return codes and code > 255 - // is not supported in many others - if (exitcode < 0 || exitcode > 125) - return false; + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitCode < 0 || exitCode > 125) + return false; - sWorld->ShutdownServ(time, 0, exitcode); + sWorld->ShutdownServ(time, 0, exitCode); } else - sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE); + sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE); + return true; } - static bool HandleServerRestartCommand(ChatHandler* handler, char const* args) + static bool HandleServerRestartCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) return false; - char* time_str = strtok ((char*) args, " "); - char* exitcode_str = strtok (NULL, ""); + char* timeStr = strtok((char*) args, " "); + char* exitCodeStr = strtok(NULL, ""); - int32 time = atoi (time_str); + int32 time = atoi(timeStr); // Prevent interpret wrong arg value as 0 secs shutdown time - if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) + if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0) return false; - if (exitcode_str) + if (exitCodeStr) { - int32 exitcode = atoi (exitcode_str); + int32 exitCode = atoi(exitCodeStr); - // Handle atoi() errors - if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) - return false; + // Handle atoi() errors + if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0')) + return false; - // Exit code should be in range of 0-125, 126-255 is used - // in many shells for their own return codes and code > 255 - // is not supported in many others - if (exitcode < 0 || exitcode > 125) - return false; + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitCode < 0 || exitCode > 125) + return false; - sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitCode); } else - sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); + return true; } - static bool HandleServerIdleRestartCommand(ChatHandler* handler, char const* args) + static bool HandleServerIdleRestartCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) return false; - char* time_str = strtok ((char*) args, " "); - char* exitcode_str = strtok (NULL, ""); + char* timeStr = strtok((char*) args, " "); + char* exitCodeStr = strtok(NULL, ""); - int32 time = atoi (time_str); + int32 time = atoi(timeStr); // Prevent interpret wrong arg value as 0 secs shutdown time - if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) + if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0) return false; - if (exitcode_str) + if (exitCodeStr) { - int32 exitcode = atoi (exitcode_str); + int32 exitCode = atoi(exitCodeStr); - // Handle atoi() errors - if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) - return false; + // Handle atoi() errors + if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0')) + return false; - // Exit code should be in range of 0-125, 126-255 is used - // in many shells for their own return codes and code > 255 - // is not supported in many others - if (exitcode < 0 || exitcode > 125) - return false; + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitCode < 0 || exitCode > 125) + return false; - sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, exitCode); } else - sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE); - return true; + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE); + return true; } - static bool HandleServerIdleShutDownCommand(ChatHandler* handler, char const* args) + static bool HandleServerIdleShutDownCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) return false; - char* time_str = strtok ((char*) args, " "); - char* exitcode_str = strtok (NULL, ""); + char* timeStr = strtok((char*) args, " "); + char* exitCodeStr = strtok(NULL, ""); - int32 time = atoi (time_str); + int32 time = atoi(timeStr); // Prevent interpret wrong arg value as 0 secs shutdown time - if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) + if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0) return false; - if (exitcode_str) + if (exitCodeStr) { - int32 exitcode = atoi (exitcode_str); + int32 exitCode = atoi(exitCodeStr); - // Handle atoi() errors - if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) - return false; + // Handle atoi() errors + if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0')) + return false; - // Exit code should be in range of 0-125, 126-255 is used - // in many shells for their own return codes and code > 255 - // is not supported in many others - if (exitcode < 0 || exitcode > 125) - return false; + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitCode < 0 || exitCode > 125) + return false; - sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitCode); } else - sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE); return true; } // Exit the realm - static bool HandleServerExitCommand(ChatHandler* handler, char const* args) + static bool HandleServerExitCommand(ChatHandler* handler, char const* /*args*/) { handler->SendSysMessage(LANG_COMMAND_EXIT); World::StopNow(SHUTDOWN_EXIT_CODE); @@ -349,15 +362,15 @@ public: { if (strncmp(args, "on", 3) == 0) { - handler->SendSysMessage(LANG_WORLD_CLOSED); - sWorld->SetClosed(true); - return true; + handler->SendSysMessage(LANG_WORLD_CLOSED); + sWorld->SetClosed(true); + return true; } else if (strncmp(args, "off", 4) == 0) { - handler->SendSysMessage(LANG_WORLD_OPENED); - sWorld->SetClosed(false); - return true; + handler->SendSysMessage(LANG_WORLD_OPENED); + sWorld->SetClosed(false); + return true; } handler->SendSysMessage(LANG_USE_BOL); @@ -366,61 +379,62 @@ public: } // Set the level of logging - static bool HandleServerSetLogFileLevelCommand(ChatHandler* handler, char const* args) + static bool HandleServerSetLogFileLevelCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) return false; - char *NewLevel = strtok((char*)args, " "); - if (!NewLevel) + char* newLevel = strtok((char*)args, " "); + if (!newLevel) return false; - sLog->SetLogFileLevel(NewLevel); - return true; + sLog->SetLogFileLevel(newLevel); + return true; } // Set the level of logging - static bool HandleServerSetLogLevelCommand(ChatHandler* handler, char const* args) + static bool HandleServerSetLogLevelCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) return false; - char *NewLevel = strtok((char*)args, " "); - if (!NewLevel) + char* newLevel = strtok((char*)args, " "); + if (!newLevel) return false; - sLog->SetLogLevel(NewLevel); - return true; + sLog->SetLogLevel(newLevel); + return true; } // set diff time record interval - static bool HandleServerSetDiffTimeCommand(ChatHandler* handler, char const* args) + static bool HandleServerSetDiffTimeCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) return false; - char *NewTimeStr = strtok((char*)args, " "); - if (!NewTimeStr) + char* newTimeStr = strtok((char*)args, " "); + if (!newTimeStr) return false; - int32 NewTime =atoi(NewTimeStr); - if (NewTime < 0) + int32 newTime = atoi(newTimeStr); + if (newTime < 0) return false; - sWorld->SetRecordDiffInterval(NewTime); - printf( "Record diff every %u ms\n", NewTime); - return true; + sWorld->SetRecordDiffInterval(newTime); + printf("Record diff every %u ms\n", newTime); + + return true; } // toggle sql driver query logging - static bool HandleServerToggleQueryLogging(ChatHandler* handler,const char* args ) + static bool HandleServerToggleQueryLogging(ChatHandler* handler, char const* /*args*/) { sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging()); + if (sLog->GetSQLDriverQueryLogging()) handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED); else handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED); - return true; } }; @@ -428,4 +442,4 @@ public: void AddSC_server_commandscript() { new server_commandscript(); -} \ No newline at end of file +} -- cgit v1.2.3 From 716e2db0e10673401ba7d6579899a8151ae64208 Mon Sep 17 00:00:00 2001 From: Chaplain Date: Thu, 21 Jun 2012 21:05:45 +0300 Subject: Core/Misc: Code-style + some const methods. --- src/server/collision/BoundingIntervalHierarchy.h | 5 +++-- src/server/collision/Maps/TileAssembler.cpp | 2 +- src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 1 - src/server/game/DungeonFinding/LFGMgr.cpp | 2 +- src/server/game/Entities/Object/Object.h | 4 ++-- src/server/game/Entities/Player/Player.cpp | 8 ++++---- src/server/game/Entities/Unit/Unit.h | 4 ++-- src/server/game/Globals/ObjectMgr.cpp | 6 +++--- src/server/game/Globals/ObjectMgr.h | 10 +++++----- src/server/game/Maps/Map.cpp | 6 +++--- src/server/game/Maps/Map.h | 8 ++++---- src/server/game/Maps/MapManager.h | 2 +- src/server/game/Server/WorldSession.h | 6 +++--- src/server/game/Server/WorldSocket.cpp | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Warden/Warden.cpp | 1 - src/server/game/Warden/WardenMac.cpp | 6 +++--- 17 files changed, 37 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index ea70fc3e322..a4bbe21006a 100755 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -128,7 +128,7 @@ class BIH delete[] dat.primBound; delete[] dat.indices; } - uint32 primCount() { return objects.size(); } + uint32 primCount() const { return objects.size(); } template void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const @@ -400,7 +400,8 @@ class BIH void buildHierarchy(std::vector &tempTree, buildData &dat, BuildStats &stats); - void createNode(std::vector &tempTree, int nodeIndex, uint32 left, uint32 right) { + void createNode(std::vector &tempTree, int nodeIndex, uint32 left, uint32 right) const + { // write leaf node tempTree[nodeIndex + 0] = (3 << 30) | left; tempTree[nodeIndex + 1] = right - left + 1; diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index e7693a70de4..3bfed7d322d 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -312,7 +312,7 @@ namespace VMAP // write WorldModel WorldModel model; model.setRootWmoID(raw_model.RootWMOID); - if (raw_model.groupsArray.size()) + if (!raw_model.groupsArray.empty()) { std::vector groupsArray; diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 13bbbe2c338..987af82e496 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -327,7 +327,6 @@ Player* FollowerAI::GetLeaderForFollower() sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader changed and returned new leader."); m_uiLeaderGUID = member->GetGUID(); return member; - break; } } } diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index a5ff89136b8..1b7e5edaa55 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -791,7 +791,7 @@ LfgProposal* LFGMgr::FindNewGroups(LfgGuidList& check, LfgGuidList& all) sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FindNewGroup: (%s) - all(%s)", ConcatenateGuids(check).c_str(), ConcatenateGuids(all).c_str()); LfgProposal* pProposal = NULL; - if (!check.size() || check.size() > MAXGROUPSIZE || !CheckCompatibility(check, pProposal)) + if (check.empty() || check.size() > MAXGROUPSIZE || !CheckCompatibility(check, pProposal)) return NULL; // Try to match with queued groups diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 5a6a5799fee..7a91289a95d 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -500,13 +500,13 @@ struct MovementInfo t_seat = -1; } - uint32 GetMovementFlags() { return flags; } + uint32 GetMovementFlags() const { return flags; } void SetMovementFlags(uint32 flag) { flags = flag; } void AddMovementFlag(uint32 flag) { flags |= flag; } void RemoveMovementFlag(uint32 flag) { flags &= ~flag; } bool HasMovementFlag(uint32 flag) const { return flags & flag; } - uint16 GetExtraMovementFlags() { return flags2; } + uint16 GetExtraMovementFlags() const { return flags2; } void AddExtraMovementFlag(uint16 flag) { flags2 |= flag; } bool HasExtraMovementFlag(uint16 flag) const { return flags2 & flag; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 42d342cbcf9..6d9e8d6b88c 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12764,7 +12764,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ { ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); pItem->SetCount(pItem->GetCount() - count + remcount); - if (IsInWorld() & update) + if (IsInWorld() && update) pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); return; @@ -12792,7 +12792,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ { ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); pItem->SetCount(pItem->GetCount() - count + remcount); - if (IsInWorld() & update) + if (IsInWorld() && update) pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); return; @@ -12858,7 +12858,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ { ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); pItem->SetCount(pItem->GetCount() - count + remcount); - if (IsInWorld() & update) + if (IsInWorld() && update) pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); return; @@ -12966,7 +12966,7 @@ void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update) ItemRemovedQuestCheck(pItem->GetEntry(), count); pItem->SetCount(pItem->GetCount() - count); count = 0; - if (IsInWorld() & update) + if (IsInWorld() && update) pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 98088f9ef6a..2855b93b0d7 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -793,8 +793,8 @@ public: m_dispeller(_dispeller), m_dispellerSpellId(_dispellerSpellId), m_chargesRemoved(_chargesRemoved) {} Unit* GetDispeller() { return m_dispeller; } - uint32 GetDispellerSpellId() { return m_dispellerSpellId; } - uint8 GetRemovedCharges() { return m_chargesRemoved; } + uint32 GetDispellerSpellId() const { return m_dispellerSpellId; } + uint8 GetRemovedCharges() const { return m_chargesRemoved; } void SetRemovedCharges(uint8 amount) { m_chargesRemoved = amount; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 65f2ccff476..eedf84ab41c 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -4816,11 +4816,11 @@ void ObjectMgr::LoadSpellScriptNames() Field* fields = result->Fetch(); - int32 spellId = fields[0].GetInt32(); + int32 spellId = fields[0].GetInt32(); const char *scriptName = fields[1].GetCString(); bool allRanks = false; - if (spellId <=0) + if (spellId <= 0) { allRanks = true; spellId = -spellId; @@ -6553,7 +6553,7 @@ uint32 ObjectMgr::GetBaseXP(uint8 level) return _baseXPTable[level] ? _baseXPTable[level] : 0; } -uint32 ObjectMgr::GetXPForLevel(uint8 level) +uint32 ObjectMgr::GetXPForLevel(uint8 level) const { if (level < _playerXPperLevel.size()) return _playerXPperLevel[level]; diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 97c2f0234ba..fcc0315055e 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -613,14 +613,14 @@ class ObjectMgr Player* GetPlayerByLowGUID(uint32 lowguid) const; GameObjectTemplate const* GetGameObjectTemplate(uint32 entry); - GameObjectTemplateContainer const* GetGameObjectTemplates() { return &_gameObjectTemplateStore; } + GameObjectTemplateContainer const* GetGameObjectTemplates() const { return &_gameObjectTemplateStore; } int LoadReferenceVendor(int32 vendor, int32 item_id, std::set *skip_vendors); void LoadGameObjectTemplate(); void AddGameobjectInfo(GameObjectTemplate* goinfo); CreatureTemplate const* GetCreatureTemplate(uint32 entry); - CreatureTemplateContainer const* GetCreatureTemplates() { return &_creatureTemplateStore; } + CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; } CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId); CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID); static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL); @@ -629,7 +629,7 @@ class ObjectMgr CreatureAddon const* GetCreatureAddon(uint32 lowguid); CreatureAddon const* GetCreatureTemplateAddon(uint32 entry); ItemTemplate const* GetItemTemplate(uint32 entry); - ItemTemplateContainer const* GetItemTemplateStore() { return &_itemTemplateStore; } + ItemTemplateContainer const* GetItemTemplateStore() const { return &_itemTemplateStore; } ItemSetNameEntry const* GetItemSetNameEntry(uint32 itemId) { @@ -912,7 +912,7 @@ class ObjectMgr std::string GeneratePetName(uint32 entry); uint32 GetBaseXP(uint8 level); - uint32 GetXPForLevel(uint8 level); + uint32 GetXPForLevel(uint8 level) const; int32 GetFishingBaseSkillLevel(uint32 entry) const { @@ -1098,7 +1098,7 @@ class ObjectMgr void LoadScriptNames(); ScriptNameContainer &GetScriptNames() { return _scriptNamesStore; } - const char * GetScriptName(uint32 id) { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; } + const char * GetScriptName(uint32 id) const { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; } uint32 GetScriptId(const char *name); SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 82659e32016..270c4c782b6 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -1230,7 +1230,7 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/) return true; } -uint16 GridMap::getArea(float x, float y) +uint16 GridMap::getArea(float x, float y) const { if (!_areaMap) return _gridArea; @@ -1463,7 +1463,7 @@ float GridMap::getHeightFromUint16(float x, float y) const return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight; } -float GridMap::getLiquidLevel(float x, float y) +float GridMap::getLiquidLevel(float x, float y) const { if (!_liquidMap) return _liquidLevel; @@ -1483,7 +1483,7 @@ float GridMap::getLiquidLevel(float x, float y) } // Why does this return LIQUID data? -uint8 GridMap::getTerrainType(float x, float y) +uint8 GridMap::getTerrainType(float x, float y) const { if (!_liquidFlags) return 0; diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 214f50e6d3c..6d526f23a94 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -193,10 +193,10 @@ public: bool loadData(char* filaname); void unloadData(); - uint16 getArea(float x, float y); - inline float getHeight(float x, float y) {return (this->*_gridGetHeight)(x, y);} - float getLiquidLevel(float x, float y); - uint8 getTerrainType(float x, float y); + uint16 getArea(float x, float y) const; + inline float getHeight(float x, float y) const {return (this->*_gridGetHeight)(x, y);} + float getLiquidLevel(float x, float y) const; + uint8 getTerrainType(float x, float y) const; ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0); }; diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 106c2189c65..aa07eef2204 100755 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -143,7 +143,7 @@ class MapManager void RegisterInstanceId(uint32 instanceId); void FreeInstanceId(uint32 instanceId); - uint32 GetNextInstanceId() { return _nextInstanceId; }; + uint32 GetNextInstanceId() const { return _nextInstanceId; }; void SetNextInstanceId(uint32 nextInstanceId) { _nextInstanceId = nextInstanceId; }; MapUpdater * GetMapUpdater() { return &m_updater; } diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 00d5a8b5a86..b8b09531082 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -323,7 +323,7 @@ class WorldSession void LoadTutorialsData(); void SendTutorialsData(); void SaveTutorialsData(SQLTransaction& trans); - uint32 GetTutorialInt(uint8 index) { return m_Tutorials[index]; } + uint32 GetTutorialInt(uint8 index) const { return m_Tutorials[index]; } void SetTutorialInt(uint8 index, uint32 value) { if (m_Tutorials[index] != value) @@ -390,8 +390,8 @@ class WorldSession } // Recruit-A-Friend Handling - uint32 GetRecruiterId() { return recruiterId; } - bool IsARecruiter() { return isRecruiter; } + uint32 GetRecruiterId() const { return recruiterId; } + bool IsARecruiter() const { return isRecruiter; } public: // opcodes handlers diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 74e414a43a9..646e9c13392 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -78,7 +78,7 @@ struct ServerPktHeader return 2+(isLargePacket()?3:2); } - bool isLargePacket() + bool isLargePacket() const { return size > 0x7FFF; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index e1285eb2db9..aed415b0a9f 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3548,7 +3548,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 break; } - if (aura_immunity_list.size() == 0) + if (aura_immunity_list.empty()) { if (miscVal & (1<<10)) aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index cc1c2ff50c6..8608701e2ee 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -196,7 +196,6 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/) sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), banReason.str(),"Server"); return "Ban"; - break; } default: break; diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index a60ae765013..319cda304cc 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -222,7 +222,7 @@ void WardenMac::HandleData(ByteBuffer &buff) // return; //} - bool found = false; + //bool found = false; std::string str = "Test string!"; @@ -238,7 +238,7 @@ void WardenMac::HandleData(ByteBuffer &buff) if (memcmp(sha1Hash, sha1.GetDigest(), 20)) { sLog->outDebug(LOG_FILTER_WARDEN, "Handle data failed: SHA1 hash is wrong!"); - found = true; + //found = true; } MD5_CTX ctx; @@ -253,7 +253,7 @@ void WardenMac::HandleData(ByteBuffer &buff) if (memcmp(ourMD5Hash, theirsMD5Hash, 16)) { sLog->outDebug(LOG_FILTER_WARDEN, "Handle data failed: MD5 hash is wrong!"); - found = true; + //found = true; } _session->KickPlayer(); -- cgit v1.2.3 From 5de44b3632465d563cc5e5cc0cac964f228e4890 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 21 Jun 2012 19:59:47 +0200 Subject: Core/Commands: Convert reset commands in commandscript --- src/server/game/Chat/Chat.cpp | 13 -- src/server/game/Chat/Chat.h | 8 - src/server/game/Chat/Commands/Level3.cpp | 259 ------------------------ src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Commands/CMakeLists.txt | 2 +- src/server/scripts/Commands/cs_reset.cpp | 312 +++++++++++++++++++++++++++++ 6 files changed, 315 insertions(+), 281 deletions(-) create mode 100644 src/server/scripts/Commands/cs_reset.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index bbfab474e22..7a146e89505 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -165,18 +165,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand resetCommandTable[] = - { - { "achievements", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetAchievementsCommand>, "", NULL }, - { "honor", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetHonorCommand>, "", NULL }, - { "level", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetLevelCommand>, "", NULL }, - { "spells", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetSpellsCommand>, "", NULL }, - { "stats", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetStatsCommand>, "", NULL }, - { "talents", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetTalentsCommand>, "", NULL }, - { "all", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetAllCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand sendCommandTable[] = { { "items", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendItemsCommand>, "", NULL }, @@ -229,7 +217,6 @@ ChatCommand* ChatHandler::getCommandTable() { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, - { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 9fc9b394947..bbe138b923d 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -184,14 +184,6 @@ class ChatHandler bool HandlePDumpLoadCommand(const char *args); bool HandlePDumpWriteCommand(const char *args); - bool HandleResetAchievementsCommand(const char * args); - bool HandleResetAllCommand(const char * args); - bool HandleResetHonorCommand(const char * args); - bool HandleResetLevelCommand(const char * args); - bool HandleResetSpellsCommand(const char* args); - bool HandleResetStatsCommand(const char * args); - bool HandleResetTalentsCommand(const char* args); - bool HandleSendItemsCommand(const char* args); bool HandleSendMailCommand(const char* args); bool HandleSendMessageCommand(const char * args); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index eed4c11e1a9..e6419bf4e1e 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -1990,265 +1990,6 @@ bool ChatHandler::HandleChangeWeather(const char *args) return true; } -bool ChatHandler::HandleResetAchievementsCommand (const char * args) -{ - Player* target; - uint64 target_guid; - if (!extractPlayerTarget((char*)args, &target, &target_guid)) - return false; - - if (target) - target->GetAchievementMgr().Reset(); - else - AchievementMgr::DeleteFromDB(GUID_LOPART(target_guid)); - - return true; -} - -bool ChatHandler::HandleResetHonorCommand (const char * args) -{ - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; - - target->SetHonorPoints(0); - target->SetUInt32Value(PLAYER_FIELD_KILLS, 0); - target->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0); - target->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0); - target->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0); - target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL); - - return true; -} - -static bool HandleResetStatsOrLevelHelper(Player* player) -{ - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(player->getClass()); - if (!cEntry) - { - sLog->outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass()); - return false; - } - - uint8 powertype = cEntry->powerType; - - // reset m_form if no aura - if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT)) - player->SetShapeshiftForm(FORM_NONE); - - player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE); - player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH); - - player->setFactionForRace(player->getRace()); - - player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powertype << 24))); - - // reset only if player not in some form; - if (player->GetShapeshiftForm() == FORM_NONE) - player->InitDisplayIds(); - - player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); - - player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - - //-1 is default value - player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); - - //player->SetUInt32Value(PLAYER_FIELD_BYTES, 0xEEE00000); - return true; -} - -bool ChatHandler::HandleResetLevelCommand(const char * args) -{ - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; - - if (!HandleResetStatsOrLevelHelper(target)) - return false; - - uint8 oldLevel = target->getLevel(); - - // set starting level - uint32 start_level = target->getClass() != CLASS_DEATH_KNIGHT - ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL) - : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL); - - target->_ApplyAllLevelScaleItemMods(false); - target->SetLevel(start_level); - target->InitRunes(); - target->InitStatsForLevel(true); - target->InitTaxiNodesForLevel(); - target->InitGlyphsForLevel(); - target->InitTalentForLevel(); - target->SetUInt32Value(PLAYER_XP, 0); - - target->_ApplyAllLevelScaleItemMods(true); - - // reset level for pet - if (Pet* pet = target->GetPet()) - pet->SynchronizeLevelWithOwner(); - - sScriptMgr->OnPlayerLevelChanged(target, oldLevel); - - return true; -} - -bool ChatHandler::HandleResetStatsCommand(const char * args) -{ - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; - - if (!HandleResetStatsOrLevelHelper(target)) - return false; - - target->InitRunes(); - target->InitStatsForLevel(true); - target->InitTaxiNodesForLevel(); - target->InitGlyphsForLevel(); - target->InitTalentForLevel(); - - return true; -} - -bool ChatHandler::HandleResetSpellsCommand(const char* args) -{ - Player* target; - uint64 targetGuid; - std::string targetName; - if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - if (target) - { - target->resetSpells(/* bool myClassOnly */); - - ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS); - if (!m_session || m_session->GetPlayer() != target) - PSendSysMessage(LANG_RESET_SPELLS_ONLINE, GetNameLink(target).c_str()); - } - else - { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); - - stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); - - CharacterDatabase.Execute(stmt); - - PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str()); - } - - return true; -} - -bool ChatHandler::HandleResetTalentsCommand(const char* args) -{ - Player* target; - uint64 targetGuid; - std::string targetName; - if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - { - // Try reset talents as Hunter Pet - Creature* creature = getSelectedCreature(); - if (!*args && creature && creature->isPet()) - { - Unit* owner = creature->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER && creature->ToPet()->IsPermanentPetFor(owner->ToPlayer())) - { - creature->ToPet()->resetTalents(); - owner->ToPlayer()->SendTalentsInfoData(true); - - ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS); - if (!m_session || m_session->GetPlayer() != owner->ToPlayer()) - PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, GetNameLink(owner->ToPlayer()).c_str()); - } - return true; - } - - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - if (target) - { - target->resetTalents(true); - target->SendTalentsInfoData(false); - ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS); - if (!m_session || m_session->GetPlayer() != target) - PSendSysMessage(LANG_RESET_TALENTS_ONLINE, GetNameLink(target).c_str()); - - Pet* pet = target->GetPet(); - Pet::resetTalentsForAllPetsOf(target, pet); - if (pet) - target->SendTalentsInfoData(true); - return true; - } - else if (targetGuid) - { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); - - stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); - - CharacterDatabase.Execute(stmt); - - std::string nameLink = playerLink(targetName); - PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str()); - return true; - } - - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; -} - -bool ChatHandler::HandleResetAllCommand(const char * args) -{ - if (!*args) - return false; - - std::string casename = args; - - AtLoginFlags atLogin; - - // Command specially created as single command to prevent using short case names - if (casename == "spells") - { - atLogin = AT_LOGIN_RESET_SPELLS; - sWorld->SendWorldText(LANG_RESETALL_SPELLS); - if (!m_session) - SendSysMessage(LANG_RESETALL_SPELLS); - } - else if (casename == "talents") - { - atLogin = AtLoginFlags(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS); - sWorld->SendWorldText(LANG_RESETALL_TALENTS); - if (!m_session) - SendSysMessage(LANG_RESETALL_TALENTS); - } - else - { - PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE, args); - SetSentErrorMessage(true); - return false; - } - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ALL_AT_LOGIN_FLAGS); - - stmt->setUInt16(0, uint16(atLogin)); - - CharacterDatabase.Execute(stmt); - - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); - HashMapHolder::MapType const& plist = sObjectAccessor->GetPlayers(); - for (HashMapHolder::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) - itr->second->SetAtLoginFlag(atLogin); - - return true; -} bool ChatHandler::HandleBanAccountCommand(const char *args) { diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 94da23110b8..86b990253b0 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -60,6 +60,7 @@ void AddSC_modify_commandscript(); void AddSC_npc_commandscript(); void AddSC_quest_commandscript(); void AddSC_reload_commandscript(); +void AddSC_reset_commandscript(); void AddSC_tele_commandscript(); void AddSC_server_commandscript(); void AddSC_titles_commandscript(); @@ -666,6 +667,7 @@ void AddCommandScripts() AddSC_npc_commandscript(); AddSC_quest_commandscript(); AddSC_reload_commandscript(); + AddSC_reset_commandscript(); AddSC_tele_commandscript(); AddSC_server_commandscript(); AddSC_titles_commandscript(); diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 962efd1d79c..c27b51a1ca2 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -28,6 +28,7 @@ set(scripts_STAT_SRCS Commands/cs_npc.cpp Commands/cs_quest.cpp Commands/cs_reload.cpp + Commands/cs_reset.cpp Commands/cs_tele.cpp Commands/cs_server.cpp Commands/cs_titles.cpp @@ -35,7 +36,6 @@ set(scripts_STAT_SRCS # Commands/cs_lookup.cpp # Commands/cs_pdump.cpp # Commands/cs_guild.cpp -# Commands/cs_reset.cpp # Commands/cs_channel.cpp # Commands/cs_pet.cpp # Commands/cs_ticket.cpp diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp new file mode 100644 index 00000000000..deb8f710b11 --- /dev/null +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -0,0 +1,312 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: reset_commandscript +%Complete: 100 +Comment: All reset related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" + +class reset_commandscript : public CommandScript +{ +public: + reset_commandscript() : CommandScript("reset_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand resetCommandTable[] = + { + { "achievements", SEC_ADMINISTRATOR, true, &HandleResetAchievementsCommand, "", NULL }, + { "honor", SEC_ADMINISTRATOR, true, &HandleResetHonorCommand, "", NULL }, + { "level", SEC_ADMINISTRATOR, true, &HandleResetLevelCommand, "", NULL }, + { "spells", SEC_ADMINISTRATOR, true, &HandleResetSpellsCommand, "", NULL }, + { "stats", SEC_ADMINISTRATOR, true, &HandleResetStatsCommand, "", NULL }, + { "talents", SEC_ADMINISTRATOR, true, &HandleResetTalentsCommand, "", NULL }, + { "all", SEC_ADMINISTRATOR, true, &HandleResetAllCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleResetAchievementsCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) + return false; + + if (target) + target->GetAchievementMgr().Reset(); + else + AchievementMgr::DeleteFromDB(GUID_LOPART(targetGuid)); + + return true; + } + + static bool HandleResetHonorCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + target->SetHonorPoints(0); + target->SetUInt32Value(PLAYER_FIELD_KILLS, 0); + target->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0); + target->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0); + target->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0); + target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL); + + return true; + } + + static bool HandleResetStatsOrLevelHelper(Player* player) + { + ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass()); + if (!classEntry) + { + sLog->outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass()); + return false; + } + + uint8 powerType = classEntry->powerType; + + // reset m_form if no aura + if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT)) + player->SetShapeshiftForm(FORM_NONE); + + player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE); + player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH); + + player->setFactionForRace(player->getRace()); + + player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powerType << 24))); + + // reset only if player not in some form; + if (player->GetShapeshiftForm() == FORM_NONE) + player->InitDisplayIds(); + + player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); + + player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + + //-1 is default value + player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); + + //player->SetUInt32Value(PLAYER_FIELD_BYTES, 0xEEE00000); + return true; + } + + static bool HandleResetLevelCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + if (!HandleResetStatsOrLevelHelper(target)) + return false; + + uint8 oldLevel = target->getLevel(); + + // set starting level + uint32 startLevel = target->getClass() != CLASS_DEATH_KNIGHT + ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL) + : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL); + + target->_ApplyAllLevelScaleItemMods(false); + target->SetLevel(startLevel); + target->InitRunes(); + target->InitStatsForLevel(true); + target->InitTaxiNodesForLevel(); + target->InitGlyphsForLevel(); + target->InitTalentForLevel(); + target->SetUInt32Value(PLAYER_XP, 0); + + target->_ApplyAllLevelScaleItemMods(true); + + // reset level for pet + if (Pet* pet = target->GetPet()) + pet->SynchronizeLevelWithOwner(); + + sScriptMgr->OnPlayerLevelChanged(target, oldLevel); + + return true; + } + + static bool HandleResetSpellsCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + if (target) + { + target->resetSpells(/* bool myClassOnly */); + + ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS); + if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) + handler->PSendSysMessage(LANG_RESET_SPELLS_ONLINE, handler->GetNameLink(target).c_str()); + } + else + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); + stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS)); + stmt->setUInt32(1, GUID_LOPART(targetGuid)); + CharacterDatabase.Execute(stmt); + + handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str()); + } + + return true; + } + + static bool HandleResetStatsCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + if (!HandleResetStatsOrLevelHelper(target)) + return false; + + target->InitRunes(); + target->InitStatsForLevel(true); + target->InitTaxiNodesForLevel(); + target->InitGlyphsForLevel(); + target->InitTalentForLevel(); + + return true; + } + + static bool HandleResetTalentsCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + { + // Try reset talents as Hunter Pet + Creature* creature = handler->getSelectedCreature(); + if (!*args && creature && creature->isPet()) + { + Unit* owner = creature->GetOwner(); + if (owner && owner->GetTypeId() == TYPEID_PLAYER && creature->ToPet()->IsPermanentPetFor(owner->ToPlayer())) + { + creature->ToPet()->resetTalents(); + owner->ToPlayer()->SendTalentsInfoData(true); + + ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS); + if (!handler->GetSession() || handler->GetSession()->GetPlayer() != owner->ToPlayer()) + handler->PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, handler->GetNameLink(owner->ToPlayer()).c_str()); + } + return true; + } + + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + if (target) + { + target->resetTalents(true); + target->SendTalentsInfoData(false); + ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS); + if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) + handler->PSendSysMessage(LANG_RESET_TALENTS_ONLINE, handler->GetNameLink(target).c_str()); + + Pet* pet = target->GetPet(); + Pet::resetTalentsForAllPetsOf(target, pet); + if (pet) + target->SendTalentsInfoData(true); + return true; + } + else if (targetGuid) + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); + stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS)); + stmt->setUInt32(1, GUID_LOPART(targetGuid)); + CharacterDatabase.Execute(stmt); + + std::string nameLink = handler->playerLink(targetName); + handler->PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str()); + return true; + } + + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + static bool HandleResetAllCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string caseName = args; + + AtLoginFlags atLogin; + + // Command specially created as single command to prevent using short case names + if (caseName == "spells") + { + atLogin = AT_LOGIN_RESET_SPELLS; + sWorld->SendWorldText(LANG_RESETALL_SPELLS); + if (!handler->GetSession()) + handler->SendSysMessage(LANG_RESETALL_SPELLS); + } + else if (caseName == "talents") + { + atLogin = AtLoginFlags(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS); + sWorld->SendWorldText(LANG_RESETALL_TALENTS); + if (!handler->GetSession()) + handler->SendSysMessage(LANG_RESETALL_TALENTS); + } + else + { + handler->PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE, args); + handler->SetSentErrorMessage(true); + return false; + } + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ALL_AT_LOGIN_FLAGS); + stmt->setUInt16(0, uint16(atLogin)); + CharacterDatabase.Execute(stmt); + + TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + HashMapHolder::MapType const& plist = sObjectAccessor->GetPlayers(); + for (HashMapHolder::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) + itr->second->SetAtLoginFlag(atLogin); + + return true; + } +}; + +void AddSC_reset_commandscript() +{ + new reset_commandscript(); +} -- cgit v1.2.3 From df7bbf203429235297b5c683908fc63a06bf7b24 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 21 Jun 2012 23:44:02 +0200 Subject: Core/Commands: Add missing scriptLoader for d3bf4626d05883ed856785e19f70f29340157ad2 --- src/server/game/Scripting/ScriptLoader.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 94da23110b8..2a625767025 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -55,6 +55,7 @@ void AddSC_gobject_commandscript(); void AddSC_honor_commandscript(); void AddSC_instance_commandscript(); void AddSC_learn_commandscript(); +void AddSC_list_commandscript(); void AddSC_misc_commandscript(); void AddSC_modify_commandscript(); void AddSC_npc_commandscript(); @@ -661,6 +662,7 @@ void AddCommandScripts() AddSC_honor_commandscript(); AddSC_instance_commandscript(); AddSC_learn_commandscript(); + AddSC_list_commandscript(); AddSC_misc_commandscript(); AddSC_modify_commandscript(); AddSC_npc_commandscript(); -- cgit v1.2.3 From 69285b1a4d176fa4d39622212d61c79a33eb2d34 Mon Sep 17 00:00:00 2001 From: Abdollah Hasan Date: Fri, 22 Jun 2012 15:19:47 +0300 Subject: Core/Player: Modify GetItemByEntry to include Currency. --- src/server/game/Entities/Player/Player.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 42d342cbcf9..b1355ad2338 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12933,6 +12933,11 @@ Item* Player::GetItemByEntry(uint32 entry) const if (pItem->GetEntry() == entry) return pItem; + for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (pItem->GetEntry() == entry) + return pItem; + for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) if (Bag* pBag = GetBagByPos(i)) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) -- cgit v1.2.3 From b859deed80462f733323e551cabafd53701e6d9c Mon Sep 17 00:00:00 2001 From: Abdollah Hasan Date: Fri, 22 Jun 2012 16:06:02 +0300 Subject: Core/Item: Add IsCurrencyToken to override use of default ugly method. --- src/server/game/Entities/Item/Item.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 1d5fcae7d28..34754cfe570 100755 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -240,6 +240,7 @@ class Item : public Object bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); } bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; } + bool IsCurrencyToken() const { return GetTemplate()->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; } bool IsNotEmptyBag() const; bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; } bool CanBeTraded(bool mail = false, bool trade = false) const; -- cgit v1.2.3 From 24a395c82d038057e5b388ac4bc8209f7cad5134 Mon Sep 17 00:00:00 2001 From: Abdollah Hasan Date: Fri, 22 Jun 2012 16:34:06 +0300 Subject: Core/Item: Modify IsCurrencyToken to use IsCurrencyToken in item template. Changed all BAG_FAMILY_MASK_CURRENCY_TOKENS to IsCurrencyToken. --- src/server/game/Entities/Item/Item.h | 2 +- src/server/game/Entities/Item/ItemPrototype.h | 2 ++ src/server/game/Entities/Player/Player.cpp | 8 ++++---- src/server/game/Loot/LootMgr.cpp | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 34754cfe570..a5f9ed5c008 100755 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -240,7 +240,7 @@ class Item : public Object bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); } bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; } - bool IsCurrencyToken() const { return GetTemplate()->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; } + bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); } bool IsNotEmptyBag() const; bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; } bool CanBeTraded(bool mail = false, bool trade = false) const; diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h index 1b5eec7fbaf..5dbf1cad5bb 100755 --- a/src/server/game/Entities/Item/ItemPrototype.h +++ b/src/server/game/Entities/Item/ItemPrototype.h @@ -681,6 +681,8 @@ struct ItemTemplate return false; } + bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; } + uint32 GetMaxStackSize() const { return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF-1) : uint32(Stackable); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b1355ad2338..7a2c5c3c352 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -10678,7 +10678,7 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; // currencytoken case - if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)) + if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->IsCurrencyToken())) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; // prevent cheating @@ -11031,7 +11031,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } } - else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) + else if (pProto->IsCurrencyToken()) { res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot); if (res != EQUIP_ERR_OK) @@ -11198,7 +11198,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } } - else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) + else if (pProto->IsCurrencyToken()) { res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot); if (res != EQUIP_ERR_OK) @@ -11447,7 +11447,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const if (b_found) continue; - if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) + if (pProto->IsCurrencyToken()) { for (uint32 t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) { diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 53b560e0b77..b4433906674 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -479,7 +479,7 @@ void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting) if (!item->is_looted && item->freeforall && item->AllowedForPlayer(player)) if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid)) - if (proto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) + if (proto->IsCurrencyToken()) player->StoreLootItem(i, this); } } -- cgit v1.2.3 From f63328dcbe5d3490c8b0235cf0c92bc1628d1aea Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 22 Jun 2012 12:23:53 -0400 Subject: Core/LFG: commented out a previous change that was causing issues with lfg dungeon locks. --- src/server/game/DungeonFinding/LFGMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 1b7e5edaa55..91f9104b0b1 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -433,8 +433,8 @@ void LFGMgr::InitializeLockedDungeons(Player* player) locktype = LFG_LOCKSTATUS_RAID_LOCKED; else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty))) { - if (!player->GetGroup() || !player->GetGroup()->isLFGGroup() || GetDungeon(player->GetGroup()->GetGUID(), true) != dungeon->ID || GetState(player->GetGroup()->GetGUID()) != LFG_STATE_DUNGEON) - locktype = LFG_LOCKSTATUS_RAID_LOCKED; + //if (!player->GetGroup() || !player->GetGroup()->isLFGGroup() || GetDungeon(player->GetGroup()->GetGUID(), true) != dungeon->ID || GetState(player->GetGroup()->GetGUID()) != LFG_STATE_DUNGEON) + locktype = LFG_LOCKSTATUS_RAID_LOCKED; } else if (dungeon->minlevel > level) locktype = LFG_LOCKSTATUS_TOO_LOW_LEVEL; -- cgit v1.2.3 From e50fa50736034404635c5392413770529c5ad570 Mon Sep 17 00:00:00 2001 From: kandera Date: Fri, 22 Jun 2012 15:54:11 -0300 Subject: fix build --- src/server/scripts/Commands/cs_list.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index bec5eacdc21..49af62ac497 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" #include "SpellAuraEffects.h" +#include "ObjectAccessor.h" class list_commandscript : public CommandScript { -- cgit v1.2.3 From 9bf7ee3ee94c7951593ca35f973c74c0af43f517 Mon Sep 17 00:00:00 2001 From: kandera Date: Fri, 22 Jun 2012 16:31:35 -0300 Subject: fix build #2 --- src/server/scripts/Commands/cs_list.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 49af62ac497..7acbc42e20e 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "Chat.h" #include "SpellAuraEffects.h" #include "ObjectAccessor.h" +#include "ObjectMgr.h" class list_commandscript : public CommandScript { -- cgit v1.2.3 From 96286790e7263d4f611c58b2bcf8da67ce18a9c5 Mon Sep 17 00:00:00 2001 From: horn Date: Sat, 23 Jun 2012 01:22:09 +0200 Subject: Core/Mails: Allow GMs to send emails without money --- src/server/game/Handlers/MailHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index c30cbaa622e..4fb0ab2e9c1 100755 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -107,7 +107,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) uint32 reqmoney = cost + money; - if (!player->HasEnoughMoney(reqmoney)) + if (!player->HasEnoughMoney(reqmoney) && !player->isGameMaster()) { player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY); return; -- cgit v1.2.3 From ea9339b17183ac92c1164571feb65b3944504e5a Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 23 Jun 2012 12:15:52 +0200 Subject: Core/SmartAI: Fixed SMART_ACTION_SET_RANGED_MOVEMENT parameters --- src/server/game/AI/SmartScripts/SmartScript.cpp | 4 ++-- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b6624586551..103cde80f43 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1543,8 +1543,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - float attackDistance = (float)e.action.setRangedMovement.distance; - float attackAngle = e.action.setRangedMovement.angle / 180.0f * M_PI; + float attackDistance = float(e.action.setRangedMovement.distance); + float attackAngle = float(e.action.setRangedMovement.angle) / 180.0f * M_PI; ObjectList* targets = GetTargets(e, unit); if (targets) diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index d71d71ce519..55e6a7fc446 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -356,11 +356,11 @@ struct SmartEvent uint32 eventId; } eventInform; - struct + struct { uint32 eventId; } doAction; - + struct { uint32 param1; @@ -857,9 +857,9 @@ struct SmartAction struct { - bool withDelayed; + uint32 withDelayed; uint32 spell_id; - bool withInstant; + uint32 withInstant; } interruptSpellCasting; struct @@ -906,10 +906,13 @@ struct SmartAction struct { - float distance; - float angle; + uint32 distance; + uint32 angle; } setRangedMovement; + //! Note for any new future actions + //! All parameters must have type uint32 + struct { uint32 param1; -- cgit v1.2.3 From d0fa012e1df9941ad1141c861a537b308c0d0012 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 23 Jun 2012 12:16:52 +0200 Subject: Core/Auras: Properly initialize mechanic immunity mask for SPELL_AURA_MECHANIC_IMMUNITY_MASK --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index aed415b0a9f..ac51fff81f6 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3341,7 +3341,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 Unit* target = aurApp->GetTarget(); std::list aura_immunity_list; - uint32 mechanic_immunity_list; + uint32 mechanic_immunity_list = 0; int32 miscVal = GetMiscValue(); switch (miscVal) -- cgit v1.2.3 From bf5002a4d1d8374279b0325011b7ec6838b3cf09 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 23 Jun 2012 12:31:46 +0200 Subject: Core/Items: Remove item from tradeable list when clearing the flag on enchanting/gemming --- src/server/game/Handlers/ItemHandler.cpp | 1 + src/server/game/Spells/SpellEffects.cpp | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index a569c914be0..e0ba190d2fc 100755 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -1349,6 +1349,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) _player->ToggleMetaGemsActive(slot, true); //turn on all metagems (except for target item) + _player->RemoveTradeableItem(itemTarget); itemTarget->ClearSoulboundTradeable(_player); // clear tradeable flag } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 84c1401bb5b..dd674672935 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2810,6 +2810,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) // add new enchanting if equipped item_owner->ApplyEnchantment(itemTarget, PERM_ENCHANTMENT_SLOT, true); + item_owner->RemoveTradeableItem(itemTarget); itemTarget->ClearSoulboundTradeable(item_owner); } } @@ -2874,6 +2875,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) // add new enchanting if equipped item_owner->ApplyEnchantment(itemTarget, PRISMATIC_ENCHANTMENT_SLOT, true); + item_owner->RemoveTradeableItem(itemTarget); itemTarget->ClearSoulboundTradeable(item_owner); } -- cgit v1.2.3 From 830d1cd0bc29acc9e7fd8f0c595697a7bcd0b3f8 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 24 Jun 2012 19:45:58 -0230 Subject: DB/Core/Gossip: Add Gossip for Alliance & Horde bonfires, fix gameobject faction, fix quest racerequirements, fix spell 45437 to be cast upon bonfire. Spawning left to do. --- sql/updates/world/2012_06_24_00_world_gossip.sql | 296 +++++++++++++++++++++++ src/server/scripts/World/go_scripts.cpp | 23 ++ 2 files changed, 319 insertions(+) create mode 100644 sql/updates/world/2012_06_24_00_world_gossip.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_24_00_world_gossip.sql b/sql/updates/world/2012_06_24_00_world_gossip.sql new file mode 100644 index 00000000000..f8aa5213bf4 --- /dev/null +++ b/sql/updates/world/2012_06_24_00_world_gossip.sql @@ -0,0 +1,296 @@ +-- Conditions for Spell "Stamp Out Bonfire" +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (45437); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +-- Alliance Bonfires +(13,1,45437,0,0,31,0,5,187564,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,1,31,0,5,187914,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,2,31,0,5,187916,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,3,31,0,5,187917,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,4,31,0,5,187919,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,5,31,0,5,187920,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,6,31,0,5,187921,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,7,31,0,5,187922,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,8,31,0,5,187923,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,9,31,0,5,187924,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,10,31,0,5,187925,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,11,31,0,5,187926,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,12,31,0,5,187927,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,13,31,0,5,187928,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,14,31,0,5,187929,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,15,31,0,5,187930,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,16,31,0,5,187931,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,17,31,0,5,187932,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,18,31,0,5,187933,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,19,31,0,5,187934,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,20,31,0,5,187935,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,21,31,0,5,187936,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,22,31,0,5,187937,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,23,31,0,5,187938,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,24,31,0,5,187939,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,25,31,0,5,187940,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,26,31,0,5,187941,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,27,31,0,5,187942,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,28,31,0,5,187943,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,29,31,0,5,187944,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,30,31,0,5,187945,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,31,31,0,5,187946,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,32,31,0,5,194032,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,33,31,0,5,194035,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,34,31,0,5,194036,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,35,31,0,5,194038,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,36,31,0,5,194040,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,37,31,0,5,194044,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,38,31,0,5,194045,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,39,31,0,5,194049,0,0,0,'','Spell can hit go target'), +-- Horde Bonfires +(13,1,45437,0,40,31,0,5,187559,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,41,31,0,5,187947,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,42,31,0,5,187948,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,43,31,0,5,187949,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,44,31,0,5,187950,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,45,31,0,5,187951,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,46,31,0,5,187952,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,47,31,0,5,187953,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,48,31,0,5,187954,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,49,31,0,5,187955,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,50,31,0,5,187956,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,51,31,0,5,187957,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,52,31,0,5,187958,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,53,31,0,5,187959,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,54,31,0,5,187960,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,55,31,0,5,187961,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,56,31,0,5,187962,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,57,31,0,5,187963,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,58,31,0,5,187964,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,59,31,0,5,187965,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,60,31,0,5,187966,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,61,31,0,5,187967,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,62,31,0,5,187968,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,63,31,0,5,187969,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,64,31,0,5,187970,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,65,31,0,5,187971,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,66,31,0,5,187972,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,67,31,0,5,187973,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,68,31,0,5,187974,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,69,31,0,5,187975,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,70,31,0,5,194033,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,71,31,0,5,194034,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,72,31,0,5,194037,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,73,31,0,5,194039,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,74,31,0,5,194042,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,75,31,0,5,194043,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,76,31,0,5,194046,0,0,0,'','Spell can hit go target'), +(13,1,45437,0,77,31,0,5,194048,0,0,0,'','Spell can hit go target'); + +-- Add Triggered spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=45458; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(45458,45437,1,'Holiday - Midsummer, Stamp Out Bonfire, Quest Complete triggers Stamp Out Bonfire'); + +-- Add script to bonfires +UPDATE `gameobject_template` SET `ScriptName`= 'go_midsummer_bonfire' WHERE `entry` IN (187559,187564,187914,187916,187917,187919,187920,187921,187922,187923,187924,187925,187926,187927,187928,187929,187930,187931,187932,187933,187934,187935,187936,187937,187938,187939,187940,187941,187942,187943,187944,187945,187946,187947,187948,187949,187950,187951,187952,187953,187954,187955,187956,187957,187958,187959,187960,187961,187962,187963,187964,187965,187966,187967,187968,187969,187970,187971,187972,187973,187974,187975,194032,194033,194034,194035,194036,194037,194038,194039,194040,194042,194043,194044,194045,194046,194048,194049); + +-- Add gossip to Horde Bonfires +DELETE FROM `gossip_menu` WHERE `entry` IN (9370,9353,9355,9379,9380,9381,9382,9383,9356,9357,9358,9359,9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9371,9372,9373,9374,9375,9376,9377,9378,10228,10231,10232,10235,10236,10239,10241,10242); +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(9370,12374),(9353,12374),(9355,12374),(9379,12374),(9380,12374),(9381,12374),(9382,12374), +(9383,12374),(9356,12374),(9357,12374),(9358,12374),(9359,12374),(9360,12374),(9361,12374), +(9362,12374),(9363,12374),(9364,12374),(9365,12374),(9366,12374),(9367,12374),(9368,12374), +(9369,12374),(9371,12374),(9372,12374),(9373,12374),(9374,12374),(9375,12374),(9376,12374), +(9377,12374),(9378,12374),(10228,12374),(10231,12374),(10232,12374),(10235,12374),(10236,12374), +(10239,12374),(10241,12374),(10242,12374); + +-- Creature Gossip_menu_option inserts for Horde bonfires +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9370,9353,9355,9379,9380,9381,9382,9383,9356,9357,9358,9359,9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9371,9372,9373,9374,9375,9376,9377,9378,10228,10231,10232,10235,10236,10239,10241,10242) AND `id`=0; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(9370,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9353,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9355,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9379,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9380,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9381,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9382,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9383,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9356,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9357,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9358,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9359,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9360,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9361,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9362,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9363,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9364,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9365,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9366,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9367,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9368,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9369,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9371,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9372,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9373,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9374,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9375,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9376,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9377,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(9378,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(10228,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(10231,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(10232,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(10235,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(10236,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(10239,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(10241,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''), +(10242,0,0, 'Stamp out the Horde bonfire!',1,1,0,0,0,0, ''); + +-- Add conditons for Horde Bonfires +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceEntry`=0 AND `SourceGroup` IN (9370,9353,9355,9379,9380,9381,9382,9383,9356,9357,9358,9359,9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9371,9372,9373,9374,9375,9376,9377,9378,10228,10231,10232,10235,10236,10239,10241,10242); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,9370,0,0,0,8,0,11581,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9353,0,0,0,8,0,11764,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9355,0,0,0,8,0,11765,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9379,0,0,0,8,0,11766,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9380,0,0,0,8,0,11767,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9381,0,0,0,8,0,11768,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9382,0,0,0,8,0,11769,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9383,0,0,0,8,0,11770,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9356,0,0,0,8,0,11771,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9357,0,0,0,8,0,11772,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9358,0,0,0,8,0,11773,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9359,0,0,0,8,0,11774,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9360,0,0,0,8,0,11775,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9361,0,0,0,8,0,11776,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9362,0,0,0,8,0,11777,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9363,0,0,0,8,0,11778,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9364,0,0,0,8,0,11779,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9365,0,0,0,8,0,11780,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9366,0,0,0,8,0,11781,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9367,0,0,0,8,0,11782,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9368,0,0,0,8,0,11783,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9369,0,0,0,8,0,11784,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9371,0,0,0,8,0,11785,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9372,0,0,0,8,0,11786,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9373,0,0,0,8,0,11787,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9374,0,0,0,8,0,11799,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9375,0,0,0,8,0,11800,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9376,0,0,0,8,0,11801,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9377,0,0,0,8,0,11802,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9378,0,0,0,8,0,11803,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10228,0,0,0,8,0,13441,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10231,0,0,0,8,0,13450,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10232,0,0,0,8,0,13451,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10235,0,0,0,8,0,13453,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10236,0,0,0,8,0,13454,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10239,0,0,0,8,0,13455,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10241,0,0,0,8,0,13457,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10242,0,0,0,8,0,13458,0,0,0,0,'','Show gossip option only if player has quest'); + +-- Fix required side for Alliance quest +UPDATE `quest_template` SET `RequiredRaces`=1101 WHERE `Id` IN (11581,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,11776,11777,11778,11779,11780,11781,11782,11783,11784,11785,11786,11787,11799,11800,11801,11802,11803,13441,13450,13451,13453,13454,13455,13457,13458); + +-- Fix Faction for Horde bonfires +UPDATE `gameobject_template` SET `faction`=1732 WHERE `entry` IN (187949,187955,187958,187960,187962,187965,187967,187974,194037,194039,194042,194043,194046,194048); + +-- Add gossip to Alliance Bonfires +DELETE FROM `gossip_menu` WHERE `entry` IN (9406,9352,9354,9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405,9407,9408,9409,9410,9411,9412,9413,10227,10230,10233,10234,10237,10238,10240,10243); +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(9406,12377),(9352,12377),(9354,12377),(9384,12377),(9385,12377),(9386,12377),(9387,12377),(9388,12377), +(9389,12377),(9390,12377),(9391,12377),(9392,12377),(9393,12377),(9394,12377),(9395,12377),(9396,12377), +(9397,12377),(9398,12377),(9399,12377),(9400,12377),(9401,12377),(9402,12377),(9403,12377),(9404,12377), +(9405,12377),(9407,12377),(9408,12377),(9409,12377),(9410,12377),(9411,12377),(9412,12377),(9413,12377), +(10227,12377),(10230,12377),(10233,12377),(10234,12377),(10237,12377),(10238,12377),(10240,12377),(10243,12377); + +-- Creature Gossip_menu_option insert from sniff +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9406,9352,9354,9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405,9407,9408,9409,9410,9411,9412,9413,10227,10230,10233,10234,10237,10238,10240,10243) AND `id`=0; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(9406,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9352,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9354,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9384,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9385,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9386,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9387,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9388,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9389,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9390,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9391,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9392,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9393,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9394,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9395,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9396,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9397,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9398,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9399,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9400,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9401,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9402,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9403,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9404,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9405,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9407,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9408,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9409,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9410,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9411,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9412,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(9413,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(10227,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(10230,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(10233,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(10234,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(10237,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(10238,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(10240,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''), +(10243,0,0, 'Stamp out the Alliance bonfire!',1,1,0,0,0,0, ''); + +-- Add conditons for Alliance Bonfires +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceEntry`=0 AND `SourceGroup` IN (9406,9352,9354,9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405,9407,9408,9409,9410,9411,9412,9413,10227,10230,10233,10234,10237,10238,10240,10243); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,9406,0,0,0,8,0,11580,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9352,0,0,0,8,0,11732,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9354,0,0,0,8,0,11734,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9384,0,0,0,8,0,11735,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9385,0,0,0,8,0,11736,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9386,0,0,0,8,0,11737,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9387,0,0,0,8,0,11738,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9388,0,0,0,8,0,11739,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9389,0,0,0,8,0,11740,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9390,0,0,0,8,0,11741,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9391,0,0,0,8,0,11742,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9392,0,0,0,8,0,11743,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9393,0,0,0,8,0,11744,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9394,0,0,0,8,0,11745,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9395,0,0,0,8,0,11746,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9396,0,0,0,8,0,11747,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9397,0,0,0,8,0,11748,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9398,0,0,0,8,0,11749,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9399,0,0,0,8,0,11750,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9400,0,0,0,8,0,11751,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9401,0,0,0,8,0,11752,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9402,0,0,0,8,0,11753,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9403,0,0,0,8,0,11754,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9404,0,0,0,8,0,11755,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9405,0,0,0,8,0,11756,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9407,0,0,0,8,0,11757,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9408,0,0,0,8,0,11758,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9409,0,0,0,8,0,11759,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9410,0,0,0,8,0,11760,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9411,0,0,0,8,0,11761,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9412,0,0,0,8,0,11762,0,0,0,0,'','Show gossip option only if player has quest'), +(15,9413,0,0,0,8,0,11763,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10227,0,0,0,8,0,13440,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10230,0,0,0,8,0,13442,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10233,0,0,0,8,0,13443,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10234,0,0,0,8,0,13444,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10237,0,0,0,8,0,13445,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10238,0,0,0,8,0,13446,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10240,0,0,0,8,0,13447,0,0,0,0,'','Show gossip option only if player has quest'), +(15,10243,0,0,0,8,0,13449,0,0,0,0,'','Show gossip option only if player has quest'); + +-- Fix required side for Horde quest +UPDATE `quest_template` SET `RequiredRaces`=690 WHERE `Id` IN (11580,11732,11734,11735,11736,11737,11738,11739,11740,11741,11742,11743,11744,11745,11746,11747,11748,11749,11750,11751,11752,11753,11754,11755,11756,11757,11758,11759,11760,11761,11762,11763,13440,13442,13443,13444,13445,13446,13447,13449); + +-- Fix Faction for Alliance bonfires +UPDATE `gameobject_template` SET `faction`=1735 WHERE `entry` IN (187564,187914,187916,187917); +UPDATE `gameobject_template` SET `faction`=1735 WHERE `entry` BETWEEN 187919 AND 187946; +UPDATE `gameobject_template` SET `faction`=1735 WHERE `entry` IN (194032,194035,194036,194038,194040,194044,194045,194049); diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 308c7f9afa3..21a852ae9ed 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1275,6 +1275,28 @@ public: } }; +/*###### +## go_midsummer_bonfire +######*/ + +enum eMidsummerBonfire +{ + STAMP_OUT_BONFIRE_QUEST_COMPLETE = 45458, +}; + +class go_midsummer_bonfire : public GameObjectScript +{ +public: + go_midsummer_bonfire() : GameObjectScript("go_midsummer_bonfire") { } + + bool OnGossipSelect(Player* player, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/) + { + player->CastSpell(player, STAMP_OUT_BONFIRE_QUEST_COMPLETE, true); + player->CLOSE_GOSSIP_MENU(); + return false; + } +}; + void AddSC_go_scripts() { new go_cat_figurine; @@ -1316,4 +1338,5 @@ void AddSC_go_scripts() new go_large_gjalerbron_cage; new go_veil_skith_cage; new go_frostblade_shrine; + new go_midsummer_bonfire; } -- cgit v1.2.3 From 4a85def47ebd938eb5f71680692852af49c72cb5 Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Tue, 26 Jun 2012 00:45:07 +0300 Subject: DB/SAI: Fix Quest 12828 (Ample Inspiration). --- sql/updates/world/2012_06_26_00_world_sai.sql | 50 ++++++++++++++++++++++++ src/server/scripts/Spells/spell_item.cpp | 55 --------------------------- 2 files changed, 50 insertions(+), 55 deletions(-) create mode 100644 sql/updates/world/2012_06_26_00_world_sai.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_26_00_world_sai.sql b/sql/updates/world/2012_06_26_00_world_sai.sql new file mode 100644 index 00000000000..c6fe75be1e5 --- /dev/null +++ b/sql/updates/world/2012_06_26_00_world_sai.sql @@ -0,0 +1,50 @@ +-- Ample Inspiration (12828) + +SET @GOB_UDED := 191553; -- U.D.E.D. Dispenser +SET @GOSSIP_MENU := 10211; +SET @NPC_MAMMOTH := 29402; -- Ironwool Mammoth +SET @NPC_MEAT_BUNNY := 29524; -- Mammoth Meat Bunny +SET @SPELL_THROW_UDED := 54577; -- Throw U.D.E.D. +SET @SPELL_GIVE_UDED := 54576; -- Forceitem U.D.E.D. +SET @SPELL_SPAWNER := 54581; -- Mammoth Explosion Spell Spawner +SET @SPELL_MAIN_MEAT := 57444; -- Summon Main Mammoth Meat +SET @SPELL_MEAT := 54625; -- Summon Mammoth Meat +SET @SPELL_MEAT_BUNNY1 := 54627; -- Quest - Mammoth Explosion Summon Object +SET @SPELL_MEAT_BUNNY2 := 54628; -- Quest - Mammoth Explosion Summon Object +SET @SPELL_MEAT_BUNNY3 := 54623; -- Quest - Mammoth Explosion Summon Object + +DELETE FROM `spell_script_names` WHERE `spell_id`=@SPELL_THROW_UDED; + +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@GOSSIP_MENU; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(@GOSSIP_MENU,0,0,'',1,0,0,0,0,0,NULL); + +UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=@GOB_UDED; +DELETE FROM `smart_scripts` WHERE `source_type`=1 AND `entryorguid`=@GOB_UDED; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@GOB_UDED,1,0,1,62,0,100,0,@GOSSIP_MENU,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'On gossip - Close gossip'), +(@GOB_UDED,1,1,0,61,0,100,0,0,0,0,0,85,@SPELL_GIVE_UDED,0,0,0,0,0,7,0,0,0,0,0,0,0,'On link - Cast Forceitem U.D.E.D.'); + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@NPC_MAMMOTH; +UPDATE `creature_template` SET `flags_extra`=128,`AIName`='SmartAI' WHERE `entry`=@NPC_MEAT_BUNNY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@NPC_MAMMOTH; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (@NPC_MAMMOTH,@NPC_MEAT_BUNNY); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +-- Ironwool Mammoth +(@NPC_MAMMOTH,0,0,0,0,0,100,0,1000,3000,7000,10000,11,56356,0,0,0,0,0,1,0,0,0,0,0,0,0,'Cast Ironwool Coat'), +(@NPC_MAMMOTH,0,1,2,8,0,100,0,@SPELL_THROW_UDED,0,0,0,11,@SPELL_SPAWNER,0,0,0,0,0,1,0,0,0,0,0,0,0,'On spellhit - Cast Mammoth Explosion Spell Spawner'), +(@NPC_MAMMOTH,0,2,0,61,0,100,0,0,0,0,0,41,500,0,0,0,0,0,1,0,0,0,0,0,0,0,'On link - Despawn'), +-- Mammoth Meat Bunny +(@NPC_MEAT_BUNNY,0,0,0,54,0,100,1,0,0,0,0,11,@SPELL_MEAT,0,0,0,0,0,1,0,0,0,0,0,0,0,'On spawn - Cast'); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=@SPELL_SPAWNER; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(@SPELL_SPAWNER,@SPELL_MAIN_MEAT,0,'Mammoth Explosion Spell Spawner link to Summon Main Mammoth Meat'), +(@SPELL_SPAWNER,@SPELL_MEAT_BUNNY1,0,'Mammoth Explosion Spell Spawner link to Quest - Mammoth Explosion Summon Object'), +(@SPELL_SPAWNER,@SPELL_MEAT_BUNNY2,0,'Mammoth Explosion Spell Spawner link to Quest - Mammoth Explosion Summon Object'), +(@SPELL_SPAWNER,@SPELL_MEAT_BUNNY3,0,'Mammoth Explosion Spell Spawner link to Quest - Mammoth Explosion Summon Object'); + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId`=17 AND `SourceEntry`=@SPELL_THROW_UDED) OR (`SourceTypeOrReferenceId`=15 AND `SourceGroup`=@GOSSIP_MENU); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(17,0,@SPELL_THROW_UDED,0,0,31,1,3,@NPC_MAMMOTH,0,0,0,'','Require Ironwool Mammoth as target'), +(15,@GOSSIP_MENU,0,0,0,9,0,12828,0,0,0,0,'','Show gossip if quest taken'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 4e2eb633662..3c89cb7005a 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1848,60 +1848,6 @@ class spell_item_unusual_compass : public SpellScriptLoader } }; -enum UDED -{ - NPC_IRONWOOL_MAMMOTH = 53806, - SPELL_MAMMOTH_CARCASS = 57444, - SPELL_MAMMOTH_MEAT = 54625, -}; - -class spell_item_uded : public SpellScriptLoader -{ - public: - spell_item_uded() : SpellScriptLoader("spell_item_uded") { } - - class spell_item_uded_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_uded_SpellScript); - - bool Load() - { - if (GetHitCreature() && GetHitCreature()->GetEntry() == NPC_IRONWOOL_MAMMOTH) - return true; - return false; - } - - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_MAMMOTH_CARCASS) || !sSpellMgr->GetSpellInfo(SPELL_MAMMOTH_MEAT)) - return false; - return true; - } - - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - Creature* creature = GetHitCreature(); - caster->CastSpell(caster,SPELL_MAMMOTH_CARCASS,true); - - for (uint8 i = 0; i < 4; ++i) - caster->CastSpell(caster,SPELL_MAMMOTH_MEAT,true); - - creature->Kill(creature); - } - - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_item_uded_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_uded_SpellScript(); - } -}; - enum ChickenCover { SPELL_CHICKEN_NET = 51959, @@ -2109,7 +2055,6 @@ void AddSC_item_spell_scripts() new spell_item_rocket_boots(); new spell_item_pygmy_oil(); new spell_item_unusual_compass(); - new spell_item_uded(); new spell_item_chicken_cover(); new spell_item_muisek_vessel(); new spell_item_greatmothers_soulcatcher(); -- cgit v1.2.3 From 12b46945dbf2866a9f6df600348ba3247c9bd0d9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 26 Jun 2012 01:19:23 +0200 Subject: Scripts/Icecrown Citadel: Added floating souls visual in The Spire after teleport to The Lich King becomes available (killing 11/12 bosses) --- sql/updates/world/2012_06_26_01_world_creature.sql | 61 ++++++++++++++++ .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 85 ++++++++++++++++++++++ .../Northrend/IcecrownCitadel/icecrown_citadel.h | 5 ++ .../IcecrownCitadel/instance_icecrown_citadel.cpp | 40 ++++++++++ 4 files changed, 191 insertions(+) create mode 100644 sql/updates/world/2012_06_26_01_world_creature.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_26_01_world_creature.sql b/sql/updates/world/2012_06_26_01_world_creature.sql new file mode 100644 index 00000000000..1f0dfff0b04 --- /dev/null +++ b/sql/updates/world/2012_06_26_01_world_creature.sql @@ -0,0 +1,61 @@ +UPDATE `creature_template` SET `InhabitType`=4,`flags_extra`=128,`unit_flags`=0x2000000,`ScriptName`='npc_arthas_teleport_visual' WHERE `entry`=30298; -- Invisible Stalker (Float, Uninteractible, LargeAOI) + +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_icc_soul_missile'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(72585,'spell_icc_soul_missile'); + +DELETE FROM `creature_template_addon` WHERE `entry`=30298; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES +(30298,0,0x0,0x1,''); -- Invisible Stalker (Float, Uninteractible, LargeAOI) + +SET @CGUID:=88653; +DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+47; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`MovementType`) VALUES +(@CGUID+00,30298,631,15,1,4357.052,2769.421,356.1364,3.141593,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+01,30298,631,15,1,4308.511,2788.476,312.6750,3.263766,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+02,30298,631,15,1,4292.898,2793.981,310.8101,1.640610,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+03,30298,631,15,1,4306.854,2752.771,299.1382,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+04,30298,631,15,1,4317.904,2743.047,299.1328,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+05,30298,631,15,1,4319.273,2799.125,299.1442,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+06,30298,631,15,1,4312.229,2735.825,299.1255,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+07,30298,631,15,1,4295.093,2743.372,299.1294,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+08,30298,631,15,1,4342.194,2719.366,312.6750,4.799655,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+09,30298,631,15,1,4284.044,2753.073,299.1465,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+10,30298,631,15,1,4331.980,2730.547,299.1442,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+11,30298,631,15,1,4331.183,2813.701,299.1328,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+12,30298,631,15,1,4292.952,2807.547,299.1372,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+13,30298,631,15,1,4284.188,2735.236,299.1377,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+14,30298,631,15,1,4323.733,2819.085,299.1255,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+15,30298,631,15,1,4308.430,2717.113,299.1333,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+16,30298,631,15,1,4304.886,2822.116,299.1333,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+17,30298,631,15,1,4336.049,2703.986,310.8101,3.176499,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+18,30298,631,15,1,4430.367,2800.603,299.1377,3.909538,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+19,30298,631,15,1,4432.948,2749.438,307.1431,4.799655,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+20,30298,631,15,1,4340.452,2825.148,299.1382,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+21,30298,631,15,1,4322.498,2704.592,299.1372,0.820304,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+22,30298,631,15,1,4380.124,2816.074,312.6750,6.265732,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+23,30298,631,15,1,4330.582,2836.512,299.1294,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+24,30298,631,15,1,4418.384,2734.435,299.1372,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+25,30298,631,15,1,4429.439,2782.781,299.1465,3.909538,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+26,30298,631,15,1,4380.205,2727.930,299.1328,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+27,30298,631,15,1,4371.056,2716.414,299.1382,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+28,30298,631,15,1,4399.571,2746.277,312.6750,4.799655,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+29,30298,631,15,1,4382.944,2808.139,299.1442,3.909538,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+30,30298,631,15,1,4389.698,2694.647,299.1377,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+31,30298,631,15,1,4336.760,2689.307,307.1431,3.176499,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+32,30298,631,15,1,4391.995,2742.610,299.1442,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+33,30298,631,15,1,4322.008,2847.075,299.1377,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+34,30298,631,15,1,4396.241,2794.807,299.1328,3.909538,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+35,30298,631,15,1,4380.467,2834.892,310.8101,6.265732,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+36,30298,631,15,1,4337.707,2850.425,299.1465,5.567600,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+37,30298,631,15,1,4392.823,2719.806,299.1255,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+38,30298,631,15,1,4406.686,2784.457,299.1382,3.909538,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+39,30298,631,15,1,4381.028,2705.133,299.1294,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+40,30298,631,15,1,4371.884,2693.614,299.1465,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+41,30298,631,15,1,4405.702,2806.464,299.1255,3.909538,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+42,30298,631,15,1,4418.314,2747.997,310.8101,4.799655,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+43,30298,631,15,1,4380.639,2849.595,307.1431,6.265732,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+44,30298,631,15,1,4393.958,2833.470,299.1372,3.909538,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+45,30298,631,15,1,4406.588,2719.758,299.1333,2.443461,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+46,30298,631,15,1,4407.252,2820.139,299.1333,3.909538,7200,0,0), -- Invisible Stalker (Float, Uninteractible, LargeAOI) +(@CGUID+47,30298,631,15,1,4418.995,2793.132,299.1294,3.909538,7200,0,0); -- Invisible Stalker (Float, Uninteractible, LargeAOI) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 6fd3cd2a294..9cfacebf224 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -158,6 +158,9 @@ enum Spells SPELL_FEL_IRON_BOMB_UNDEAD = 71787, SPELL_MACHINE_GUN_UNDEAD = 71788, SPELL_ROCKET_LAUNCH_UNDEAD = 71786, + + // Invisible Stalker (Float, Uninteractible, LargeAOI) + SPELL_SOUL_MISSILE = 72585, }; // Helper defines @@ -248,6 +251,9 @@ enum EventTypes EVENT_RUPERT_FEL_IRON_BOMB = 52, EVENT_RUPERT_MACHINE_GUN = 53, EVENT_RUPERT_ROCKET_LAUNCH = 54, + + // Invisible Stalker (Float, Uninteractible, LargeAOI) + EVENT_SOUL_MISSILE = 55, }; enum DataTypesICC @@ -1668,6 +1674,56 @@ class npc_impaling_spear : public CreatureScript } }; +class npc_arthas_teleport_visual : public CreatureScript +{ + public: + npc_arthas_teleport_visual() : CreatureScript("npc_arthas_teleport_visual") { } + + struct npc_arthas_teleport_visualAI : public NullCreatureAI + { + npc_arthas_teleport_visualAI(Creature* creature) : NullCreatureAI(creature), _instance(creature->GetInstanceScript()) + { + } + + void Reset() + { + _events.Reset(); + if (_instance->GetBossState(DATA_PROFESSOR_PUTRICIDE) == DONE && + _instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == DONE && + _instance->GetBossState(DATA_SINDRAGOSA) == DONE) + _events.ScheduleEvent(EVENT_SOUL_MISSILE, urand(1000, 6000)); + } + + void UpdateAI(uint32 const diff) + { + if (_events.Empty()) + return; + + _events.Update(diff); + + if (_events.ExecuteEvent() == EVENT_SOUL_MISSILE) + { + DoCastAOE(SPELL_SOUL_MISSILE); + _events.ScheduleEvent(EVENT_SOUL_MISSILE, urand(5000, 7000)); + } + } + + private: + InstanceScript* _instance; + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + // Distance from the center of the spire + if (creature->GetExactDist2d(4357.052f, 2769.421f) < 100.0f && creature->GetHomePosition().GetPositionZ() < 315.0f) + return GetIcecrownCitadelAI(creature); + + // Default to no script + return NULL; + } +}; + class spell_icc_stoneform : public SpellScriptLoader { public: @@ -1974,6 +2030,33 @@ class spell_svalna_remove_spear : public SpellScriptLoader } }; +class spell_icc_soul_missile : public SpellScriptLoader +{ + public: + spell_icc_soul_missile() : SpellScriptLoader("spell_icc_soul_missile") { } + + class spell_icc_soul_missile_SpellScript : public SpellScript + { + PrepareSpellScript(spell_icc_soul_missile_SpellScript); + + void RelocateDest() + { + static Position const offset = {0.0f, 0.0f, 200.0f, 0.0f}; + const_cast(GetExplTargetDest())->RelocateOffset(offset); + } + + void Register() + { + OnCast += SpellCastFn(spell_icc_soul_missile_SpellScript::RelocateDest); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_icc_soul_missile_SpellScript(); + } +}; + class at_icc_saurfang_portal : public AreaTriggerScript { public: @@ -2063,6 +2146,7 @@ void AddSC_icecrown_citadel() new npc_captain_rupert(); new npc_frostwing_vrykul(); new npc_impaling_spear(); + new npc_arthas_teleport_visual(); new spell_icc_stoneform(); new spell_icc_sprit_alarm(); new spell_frost_giant_death_plague(); @@ -2070,6 +2154,7 @@ void AddSC_icecrown_citadel() new spell_trigger_spell_from_caster("spell_svalna_caress_of_death", SPELL_IMPALING_SPEAR_KILL); new spell_svalna_revive_champion(); new spell_svalna_remove_spear(); + new spell_icc_soul_missile(); new at_icc_saurfang_portal(); new at_icc_shutdown_traps(); new at_icc_start_blood_quickening(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 224777c3db7..31639a698ef 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -51,6 +51,7 @@ enum SharedSpells SPELL_GREEN_BLIGHT_RESIDUE = 72145, // The Lich King + SPELL_ARTHAS_TELEPORTER_CEREMONY = 72915, SPELL_FROSTMOURNE_TELEPORT_VISUAL = 73078, }; @@ -275,6 +276,9 @@ enum CreaturesIds NPC_WORLD_TRIGGER_INFINITE_AOI = 36171, NPC_SPIRIT_BOMB = 39189, NPC_FROSTMOURNE_TRIGGER = 38584, + + // Generic + NPC_INVISIBLE_STALKER = 30298, }; enum GameObjectsIds @@ -345,6 +349,7 @@ enum GameObjectsIds GO_SIGIL_OF_THE_FROSTWING = 202181, // The Lich King + GO_SCOURGE_TRANSPORTER_LK = 202223, GO_ARTHAS_PLATFORM = 202161, GO_ARTHAS_PRECIPICE = 202078, GO_DOODAD_ICECROWN_THRONEFROSTYWIND01 = 202188, diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 270f56674eb..650f426d29c 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -130,6 +130,7 @@ class instance_icecrown_citadel : public InstanceMapScript SindragosaGUID = 0; SpinestalkerGUID = 0; RimefangGUID = 0; + TheLichKingTeleportGUID = 0; TheLichKingGUID = 0; HighlordTirionFordringGUID = 0; TerenasMenethilGUID = 0; @@ -280,6 +281,11 @@ class instance_icecrown_citadel : public InstanceMapScript case NPC_RIMEFANG: RimefangGUID = creature->GetGUID(); break; + case NPC_INVISIBLE_STALKER: + // Teleporter visual at center + if (creature->GetExactDist2d(4357.052f, 2769.421f) < 10.0f) + creature->CastSpell(creature, SPELL_ARTHAS_TELEPORTER_CEREMONY, false); + break; case NPC_THE_LICH_KING: TheLichKingGUID = creature->GetGUID(); break; @@ -505,6 +511,11 @@ class instance_icecrown_citadel : public InstanceMapScript go->SetLootRecipient(valithria->GetLootRecipient()); go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE | GO_FLAG_NODESPAWN); break; + case GO_SCOURGE_TRANSPORTER_LK: + TheLichKingTeleportGUID = go->GetGUID(); + if (GetBossState(DATA_PROFESSOR_PUTRICIDE) == DONE && GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == DONE && GetBossState(DATA_SINDRAGOSA) == DONE) + go->SetGoState(GO_STATE_ACTIVE); + break; case GO_ARTHAS_PLATFORM: // this enables movement at The Frozen Throne, when printed this value is 0.000000f // however, when represented as integer client will accept only this value @@ -743,6 +754,8 @@ class instance_icecrown_citadel : public InstanceMapScript break; case DATA_PROFESSOR_PUTRICIDE: HandleGameObject(PlagueSigilGUID, state != DONE); + if (state == DONE) + CheckLichKingAvailability(); if (instance->IsHeroic()) { if (state == FAIL && HeroicAttempts) @@ -757,6 +770,8 @@ class instance_icecrown_citadel : public InstanceMapScript break; case DATA_BLOOD_QUEEN_LANA_THEL: HandleGameObject(BloodwingSigilGUID, state != DONE); + if (state == DONE) + CheckLichKingAvailability(); if (instance->IsHeroic()) { if (state == FAIL && HeroicAttempts) @@ -775,6 +790,8 @@ class instance_icecrown_citadel : public InstanceMapScript break; case DATA_SINDRAGOSA: HandleGameObject(FrostwingSigilGUID, state != DONE); + if (state == DONE) + CheckLichKingAvailability(); if (instance->IsHeroic()) { if (state == FAIL && HeroicAttempts) @@ -1065,6 +1082,28 @@ class instance_icecrown_citadel : public InstanceMapScript return true; } + void CheckLichKingAvailability() + { + if (GetBossState(DATA_PROFESSOR_PUTRICIDE) == DONE && GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == DONE && GetBossState(DATA_SINDRAGOSA) == DONE) + { + if (GameObject* teleporter = instance->GetGameObject(TheLichKingTeleportGUID)) + { + teleporter->SetGoState(GO_STATE_ACTIVE); + + std::list stalkers; + GetCreatureListWithEntryInGrid(stalkers, teleporter, NPC_INVISIBLE_STALKER, 100.0f); + if (stalkers.empty()) + return; + + stalkers.sort(Trinity::ObjectDistanceOrderPred(teleporter)); + stalkers.front()->CastSpell((Unit*)NULL, SPELL_ARTHAS_TELEPORTER_CEREMONY, false); + stalkers.pop_front(); + for (std::list::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr) + (*itr)->AI()->Reset(); + } + } + } + std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -1246,6 +1285,7 @@ class instance_icecrown_citadel : public InstanceMapScript uint64 SindragosaGUID; uint64 SpinestalkerGUID; uint64 RimefangGUID; + uint64 TheLichKingTeleportGUID; uint64 TheLichKingGUID; uint64 HighlordTirionFordringGUID; uint64 TerenasMenethilGUID; -- cgit v1.2.3 From 1bddb4eaf448b00a14b16dd67cc4c2f2adf5135b Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 26 Jun 2012 01:31:55 +0200 Subject: Fixed compile without PCH --- src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 9cfacebf224..46e8c1428e4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "PassiveAI.h" #include "Cell.h" #include "CellImpl.h" #include "GridNotifiers.h" -- cgit v1.2.3 From e43b50b415cc562df3b453bee8291dedfcfd09d0 Mon Sep 17 00:00:00 2001 From: Faq Date: Wed, 27 Jun 2012 00:12:07 +0300 Subject: Death Knight T10 Tank 2P Bonus. Thnx Shauren --- src/server/game/Spells/SpellMgr.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 834da088c56..235c3ccb718 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3268,6 +3268,8 @@ void SpellMgr::LoadDbcDataCorrections() break; case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE; + case 70650: // Death Knight T10 Tank 2P Bonus + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_ADD_PCT_MODIFIER; break; // ULDUAR SPELLS // -- cgit v1.2.3 From e5adb05844fe735ae66a99c3d5eb67fc9800c47a Mon Sep 17 00:00:00 2001 From: Faq Date: Wed, 27 Jun 2012 00:28:59 +0300 Subject: missed break :/ --- src/server/game/Spells/SpellMgr.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 235c3ccb718..0b1955a02ec 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3268,6 +3268,7 @@ void SpellMgr::LoadDbcDataCorrections() break; case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE; + break; case 70650: // Death Knight T10 Tank 2P Bonus spellInfo->EffectApplyAuraName[0] = SPELL_AURA_ADD_PCT_MODIFIER; break; -- cgit v1.2.3 From 551878ad96c1f4b2882f8e94c248f79576927173 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 27 Jun 2012 15:04:07 -0400 Subject: Core/Spells: correctly award kill credit for quest the focus on the beach. --- .../2012_06_27_00_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_quest.cpp | 34 +++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2012_06_27_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_06_27_00_world_spell_script_names.sql b/sql/updates/world/2012_06_27_00_world_spell_script_names.sql new file mode 100644 index 00000000000..8210225de6e --- /dev/null +++ b/sql/updates/world/2012_06_27_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (50546); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(50546,'spell_q12066_bunny_kill_credit'); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 810cc20e04b..2f6989b57c9 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -639,7 +639,7 @@ class spell_q12851_going_bearback : public SpellScriptLoader // Already in fire if (target->HasAura(SPELL_ABLAZE)) return; - + if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself()) { switch (target->GetEntry()) @@ -1162,6 +1162,38 @@ class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader } }; +enum FocusOnTheBeach +{ + SPELL_BUNNY_CREDIT_BEAM = 47390, +}; + +class spell_q12066_bunny_kill_credit : public SpellScriptLoader +{ +public: + spell_q12066_bunny_kill_credit() : SpellScriptLoader("spell_q12066_bunny_kill_credit") { } + + class spell_q12066_bunny_kill_credit_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12066_bunny_kill_credit_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* target = GetHitCreature()) + target()->CastSpell(GetCaster(), SPELL_BUNNY_CREDIT_BEAM, false); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12066_bunny_kill_credit_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12066_bunny_kill_credit_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); -- cgit v1.2.3 From 87db7b246fe1f8cdbd99f37798ff42ef022a70e3 Mon Sep 17 00:00:00 2001 From: Nay Date: Wed, 27 Jun 2012 23:17:40 +0200 Subject: Fix build --- src/server/scripts/Spells/spell_quest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 2f6989b57c9..66ff06decc3 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1179,7 +1179,7 @@ public: void HandleDummy(SpellEffIndex /*effIndex*/) { if (Creature* target = GetHitCreature()) - target()->CastSpell(GetCaster(), SPELL_BUNNY_CREDIT_BEAM, false); + target->CastSpell(GetCaster(), SPELL_BUNNY_CREDIT_BEAM, false); } void Register() @@ -1221,4 +1221,5 @@ void AddSC_quest_spell_scripts() new spell_q9452_cast_net(); new spell_q12987_read_pronouncement(); new spell_q12277_wintergarde_mine_explosion(); + new spell_q12066_bunny_kill_credit(); } -- cgit v1.2.3 From dfdbc91e908e5bbf780c7db5417b0dc170b8085d Mon Sep 17 00:00:00 2001 From: Elron103 Date: Fri, 29 Jun 2012 00:11:05 +0200 Subject: Core/Spells: Fix spell casting time reduce / increase effects for players and creatures --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d8e7e1c9717..07b2b9d2260 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13162,7 +13162,7 @@ void Unit::ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell); - if (!(spellProto->Attributes & (SPELL_ATTR0_ABILITY|SPELL_ATTR0_TRADESPELL)) && spellProto->SpellFamilyName) + if (!(spellProto->Attributes & (SPELL_ATTR0_ABILITY|SPELL_ATTR0_TRADESPELL)) && ((GetTypeId() == TYPEID_PLAYER && spellProto->SpellFamilyName) || GetTypeId() == TYPEID_UNIT)) castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED)); else if (spellProto->Attributes & SPELL_ATTR0_REQ_AMMO && !(spellProto->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG)) castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]); -- cgit v1.2.3 From 8ba234e2455e0d1fe1c624e297e5f3149e8af986 Mon Sep 17 00:00:00 2001 From: Elron103 Date: Fri, 29 Jun 2012 18:45:18 +0200 Subject: Scripts/Spells: Fix Deathknight ability Death Pact 48743 --- src/server/scripts/Spells/spell_dk.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 38901287e0d..1fbd6bd9145 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -334,6 +334,21 @@ class spell_dk_death_pact : public SpellScriptLoader { PrepareSpellScript(spell_dk_death_pact_SpellScript); + SpellCastResult CheckCast() + { + // Check if we have valid targets, otherwise skip spell casting here + if (Player* player = GetCaster()->ToPlayer()) + for (Unit::ControlList::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr) + if (Creature* undeadPet = (*itr)->ToCreature()) + if (undeadPet->isAlive() && + undeadPet->GetOwnerGUID() == player->GetGUID() && + undeadPet->GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD && + undeadPet->IsWithinDist(player, 100.0f, false)) + return SPELL_CAST_OK; + + return SPELL_FAILED_NO_PET; + } + void FilterTargets(std::list& unitList) { Unit* unit_to_add = NULL; @@ -351,17 +366,11 @@ class spell_dk_death_pact : public SpellScriptLoader unitList.clear(); if (unit_to_add) unitList.push_back(unit_to_add); - else - { - // Pet not found - remove cooldown - if (Player* modOwner = GetCaster()->GetSpellModOwner()) - modOwner->RemoveSpellCooldown(GetSpellInfo()->Id, true); - FinishCast(SPELL_FAILED_NO_PET); - } } void Register() { + OnCheckCast += SpellCheckCastFn(spell_dk_death_pact_SpellScript::CheckCast); OnUnitTargetSelect += SpellUnitTargetFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY); } }; -- cgit v1.2.3 From 6e4da3367aaea8494a903da63e5c009f752e5650 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 29 Jun 2012 13:44:30 -0400 Subject: Core/Spells: fix build and typo from previous commit --- src/server/scripts/Spells/spell_dk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 1fbd6bd9145..ae887baa413 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -342,7 +342,7 @@ class spell_dk_death_pact : public SpellScriptLoader if (Creature* undeadPet = (*itr)->ToCreature()) if (undeadPet->isAlive() && undeadPet->GetOwnerGUID() == player->GetGUID() && - undeadPet->GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD && + undeadPet->GetCreatureType() == CREATURE_TYPE_UNDEAD && undeadPet->IsWithinDist(player, 100.0f, false)) return SPELL_CAST_OK; -- cgit v1.2.3 From e0997874f5bf8d38b67ad3dee66e3d808dd1a059 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 29 Jun 2012 21:53:35 +0200 Subject: Core/SpellScripts: Changed OnUnitTargetSelect hook to OnObjectAreaTargetSelect, it will now work with WorldObject instead of only Units and call it even for empty target lists --- src/server/game/Grids/Notifiers/GridNotifiers.h | 7 ++- src/server/game/Spells/Spell.cpp | 20 ++++--- src/server/game/Spells/Spell.h | 2 +- src/server/game/Spells/SpellScript.cpp | 30 ++++++---- src/server/game/Spells/SpellScript.h | 18 +++--- src/server/scripts/Commands/cs_instance.cpp | 2 +- src/server/scripts/Commands/cs_list.cpp | 2 +- .../BattleForMountHyjal/boss_kazrogal.cpp | 13 ++--- src/server/scripts/Kalimdor/dustwallow_marsh.cpp | 12 ++-- .../RubySanctum/boss_saviana_ragefire.cpp | 12 ++-- .../TrialOfTheChampion/boss_argent_challenge.cpp | 13 +++-- .../FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp | 18 +++--- .../IcecrownCitadel/boss_blood_queen_lana_thel.cpp | 32 +++++------ .../IcecrownCitadel/boss_deathbringer_saurfang.cpp | 38 ++++++------- .../IcecrownCitadel/boss_lord_marrowgar.cpp | 4 +- .../IcecrownCitadel/boss_professor_putricide.cpp | 44 +++++++-------- .../Northrend/IcecrownCitadel/boss_rotface.cpp | 28 +++++----- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 45 +++++++-------- .../IcecrownCitadel/boss_the_lich_king.cpp | 64 ++++++++++++---------- .../IcecrownCitadel/boss_valithria_dreamwalker.cpp | 6 +- .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 46 ++++++++-------- .../scripts/Northrend/Naxxramas/boss_gothik.cpp | 6 +- .../scripts/Northrend/Naxxramas/boss_thaddius.cpp | 6 +- .../scripts/Northrend/Nexus/Oculus/boss_varos.cpp | 16 +++--- .../Ulduar/HallsOfStone/boss_krystallus.cpp | 2 +- .../Ulduar/Ulduar/boss_algalon_the_observer.cpp | 18 +++--- .../Northrend/Ulduar/Ulduar/boss_auriaya.cpp | 18 +++--- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 12 ++-- .../Northrend/Ulduar/Ulduar/boss_kologarn.cpp | 24 ++++---- .../scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp | 8 +-- .../scripts/Northrend/Ulduar/Ulduar/ulduar.h | 6 +- .../UtgardeKeep/UtgardePinnacle/boss_svala.cpp | 12 ++-- .../Outland/TempestKeep/Eye/boss_astromancer.cpp | 4 +- .../Mechanar/boss_mechano_lord_capacitus.cpp | 6 +- .../scripts/Outland/boss_doomlord_kazzak.cpp | 2 +- src/server/scripts/Spells/spell_dk.cpp | 13 ++--- src/server/scripts/Spells/spell_druid.cpp | 34 ++++++------ src/server/scripts/Spells/spell_paladin.cpp | 4 +- src/server/scripts/Spells/spell_priest.cpp | 6 +- src/server/scripts/Spells/spell_shaman.cpp | 29 +++++----- src/server/scripts/Spells/spell_warlock.cpp | 6 +- src/server/scripts/Spells/spell_warrior.cpp | 4 +- src/server/scripts/World/boss_emerald_dragons.cpp | 24 ++++---- src/server/shared/Packets/ByteBuffer.h | 3 +- 44 files changed, 368 insertions(+), 351 deletions(-) (limited to 'src') diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 7bb4492f99c..072db578220 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -1325,11 +1325,16 @@ namespace Trinity { public: UnitAuraCheck(bool present, uint32 spellId, uint64 casterGUID = 0) : _present(present), _spellId(spellId), _casterGUID(casterGUID) {} - bool operator()(Unit* unit) + bool operator()(Unit* unit) const { return unit->HasAura(_spellId, _casterGUID) == _present; } + bool operator()(WorldObject* object) const + { + return object->ToUnit() && object->ToUnit()->HasAura(_spellId, _casterGUID) == _present; + } + private: bool _present; uint32 _spellId; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index f823e45525d..6b102c25882 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1041,7 +1041,9 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge { Trinity::WorldObjectSpellConeTargetCheck check(coneAngle, radius, m_caster, m_spellInfo, selectionType, condList); Trinity::WorldObjectListSearcher searcher(m_caster, targets, check, containerTypeMask); - SearchTargets > (searcher, containerTypeMask, m_caster, m_caster, radius); + SearchTargets >(searcher, containerTypeMask, m_caster, m_caster, radius); + + CallScriptObjectAreaTargetSelectHandlers(targets, effIndex); if (!targets.empty()) { @@ -1069,8 +1071,6 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge gObjTargets.push_back(gObjTarget); } - CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex); - for (std::list::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr) AddUnitTarget(*itr, effMask, false); @@ -1217,6 +1217,8 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge gObjTargets.push_back(gObjTarget); } + CallScriptObjectAreaTargetSelectHandlers(targets, effIndex); + if (!unitTargets.empty()) { // Special target selection for smart heals and energizes @@ -1342,8 +1344,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge Trinity::Containers::RandomResizeList(unitTargets, maxTargets); } - CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex); - for (std::list::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr) AddUnitTarget(*itr, effMask, false); } @@ -1359,6 +1359,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge Trinity::Containers::RandomResizeList(gObjTargets, maxTargets); } + for (std::list::iterator itr = gObjTargets.begin(); itr != gObjTargets.end(); ++itr) AddGOTarget(*itr, effMask); } @@ -1567,7 +1568,8 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg if (Unit* unitTarget = (*itr)->ToUnit()) unitTargets.push_back(unitTarget); - CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex); + // Chain primary target is added earlier + CallScriptObjectAreaTargetSelectHandlers(targets, effIndex); for (std::list::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr) AddUnitTarget(*itr, effMask, false); @@ -7036,15 +7038,15 @@ void Spell::CallScriptAfterHitHandlers() } } -void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list& unitTargets, SpellEffIndex effIndex) +void Spell::CallScriptObjectAreaTargetSelectHandlers(std::list& targets, SpellEffIndex effIndex) { for (std::list::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT); - std::list::iterator hookItrEnd = (*scritr)->OnUnitTargetSelect.end(), hookItr = (*scritr)->OnUnitTargetSelect.begin(); + std::list::iterator hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin(); for (; hookItr != hookItrEnd; ++hookItr) if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex)) - (*hookItr).Call(*scritr, unitTargets); + (*hookItr).Call(*scritr, targets); (*scritr)->_FinishScriptCall(); } diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 8f43b9b2290..98455904cf5 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -630,7 +630,7 @@ class Spell void CallScriptBeforeHitHandlers(); void CallScriptOnHitHandlers(); void CallScriptAfterHitHandlers(); - void CallScriptAfterUnitTargetSelectHandlers(std::list& unitTargets, SpellEffIndex effIndex); + void CallScriptObjectAreaTargetSelectHandlers(std::list& targets, SpellEffIndex effIndex); std::list m_loadedScripts; struct HitTriggerSpell diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index e6ce80c20f0..eaccb8fc005 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -203,50 +203,56 @@ void SpellScript::HitHandler::Call(SpellScript* spellScript) (spellScript->*pHitHandlerScript)(); } -SpellScript::UnitTargetHandler::UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType) +SpellScript::ObjectAreaTargetSelectHandler::ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : _SpellScript::EffectHook(_effIndex), targetType(_targetType) { - pUnitTargetHandlerScript = _pUnitTargetHandlerScript; + pObjectAreaTargetSelectHandlerScript = _pObjectAreaTargetSelectHandlerScript; } -std::string SpellScript::UnitTargetHandler::ToString() +std::string SpellScript::ObjectAreaTargetSelectHandler::ToString() { std::ostringstream oss; oss << "Index: " << EffIndexToString() << " Target: " << targetType; return oss.str(); } -bool SpellScript::UnitTargetHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) +bool SpellScript::ObjectAreaTargetSelectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) { if (!targetType) return false; - return (effIndex == EFFECT_ALL) || (spellEntry->Effects[effIndex].TargetA.GetTarget() == targetType || spellEntry->Effects[effIndex].TargetB.GetTarget() == targetType); + + if (spellEntry->Effects[effIndex].TargetA.GetTarget() != targetType && + spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType) + return false; + + // TODO: Smart check if this hook will run for this targetType + return true; } -void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list& unitTargets) +void SpellScript::ObjectAreaTargetSelectHandler::Call(SpellScript* spellScript, std::list& targets) { - (spellScript->*pUnitTargetHandlerScript)(unitTargets); + (spellScript->*pObjectAreaTargetSelectHandlerScript)(targets); } bool SpellScript::_Validate(SpellInfo const* entry) { - for (std::list::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr) + for (std::list::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); - for (std::list::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr) + for (std::list::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); - for (std::list::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr) + for (std::list::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); - for (std::list::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr) + for (std::list::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); - for (std::list::iterator itr = OnUnitTargetSelect.begin(); itr != OnUnitTargetSelect.end(); ++itr) + for (std::list::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnUnitTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 7b194b7827f..a145a0b7377 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -154,7 +154,7 @@ class SpellScript : public _SpellScript typedef void(CLASSNAME::*SpellEffectFnType)(SpellEffIndex); \ typedef void(CLASSNAME::*SpellHitFnType)(); \ typedef void(CLASSNAME::*SpellCastFnType)(); \ - typedef void(CLASSNAME::*SpellUnitTargetFnType)(std::list&); \ + typedef void(CLASSNAME::*SpellObjectAreaTargetSelectFnType)(std::list&); \ SPELLSCRIPT_FUNCTION_TYPE_DEFINES(SpellScript) @@ -196,15 +196,15 @@ class SpellScript : public _SpellScript SpellHitFnType pHitHandlerScript; }; - class UnitTargetHandler : public _SpellScript::EffectHook + class ObjectAreaTargetSelectHandler : public _SpellScript::EffectHook { public: - UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType); + ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType); std::string ToString(); bool CheckEffect(SpellInfo const* spellEntry, uint8 targetType); - void Call(SpellScript* spellScript, std::list& unitTargets); + void Call(SpellScript* spellScript, std::list& targets); private: - SpellUnitTargetFnType pUnitTargetHandlerScript; + SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript; uint16 targetType; }; @@ -213,7 +213,7 @@ class SpellScript : public _SpellScript class CheckCastHandlerFunction : public SpellScript::CheckCastHandler { public: CheckCastHandlerFunction(SpellCheckCastFnType _checkCastHandlerScript) : SpellScript::CheckCastHandler((SpellScript::SpellCheckCastFnType)_checkCastHandlerScript) {} }; \ class EffectHandlerFunction : public SpellScript::EffectHandler { public: EffectHandlerFunction(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : SpellScript::EffectHandler((SpellScript::SpellEffectFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \ class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) {} }; \ - class UnitTargetHandlerFunction : public SpellScript::UnitTargetHandler { public: UnitTargetHandlerFunction(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::UnitTargetHandler((SpellScript::SpellUnitTargetFnType)_pUnitTargetHandlerScript, _effIndex, _targetType) {} }; \ + class ObjectAreaTargetSelectHandlerFunction : public SpellScript::ObjectAreaTargetSelectHandler { public: ObjectAreaTargetSelectHandlerFunction(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectAreaTargetSelectHandler((SpellScript::SpellObjectAreaTargetSelectFnType)_pObjectAreaTargetSelectHandlerScript, _effIndex, _targetType) {} }; \ #define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) public: @@ -269,8 +269,8 @@ class SpellScript : public _SpellScript // example: OnUnitTargetSelect += SpellUnitTargetFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier); // where function is void function(std::list& targetList) - HookList OnUnitTargetSelect; - #define SpellUnitTargetFn(F, I, N) UnitTargetHandlerFunction(&F, I, N) + HookList OnObjectAreaTargetSelect; + #define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandlerFunction(&F, I, N) // hooks are executed in following order, at specified event of spell: // 1. BeforeCast - executed when spell preparation is finished (when cast bar becomes full) before cast is handled @@ -302,7 +302,7 @@ class SpellScript : public _SpellScript // -shadowstep - explicit target is the unit you want to go behind of // -chain heal - explicit target is the unit to be healed first // -holy nova/arcane explosion - explicit target = NULL because target you are selecting doesn't affect how spell targets are selected - // you can determine if spell requires explicit targets by dbc columns: + // you can determine if spell requires explicit targets by dbc columns: // - Targets - mask of explicit target types // - ImplicitTargetXX set to TARGET_XXX_TARGET_YYY, _TARGET_ here means that explicit target is used by the effect, so spell needs one too diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index 127a3848ebc..f51727af2ef 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -66,7 +66,7 @@ public: return ss.str(); } - static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* args) + static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->getSelectedPlayer(); if (!player) diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 7acbc42e20e..746956581a6 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -207,7 +207,7 @@ public: } // mail case - uint32 mailCount; + uint32 mailCount = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM); stmt->setUInt32(0, itemId); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index c1ae04cf4c0..9160983b0df 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -199,11 +199,10 @@ public: class MarkTargetFilter { public: - bool operator()(Unit* target) const + bool operator()(WorldObject* target) const { - if (target->getPowerType() != POWER_MANA) - return true; - + if (Unit* unit = target->ToUnit()) + return unit->getPowerType() != POWER_MANA; return false; } }; @@ -217,14 +216,14 @@ class spell_mark_of_kazrogal : public SpellScriptLoader { PrepareSpellScript(spell_mark_of_kazrogal_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove_if(MarkTargetFilter()); + targets.remove_if(MarkTargetFilter()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_mark_of_kazrogal_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_kazrogal_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 397b0849d5e..5800a6a58a0 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -707,16 +707,16 @@ class spell_energize_aoe : public SpellScriptLoader return true; } - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - for (std::list::iterator itr = unitList.begin(); itr != unitList.end();) + for (std::list::iterator itr = targets.begin(); itr != targets.end();) { if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE) ++itr; else - unitList.erase(itr++); + targets.erase(itr++); } - unitList.push_back(GetCaster()); + targets.push_back(GetCaster()); } void HandleScript(SpellEffIndex effIndex) @@ -728,8 +728,8 @@ class spell_energize_aoe : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - OnUnitTargetSelect += SpellUnitTargetFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY); } }; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index 4e5e01cc745..5a7809dbe70 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -186,7 +186,7 @@ class ConflagrationTargetSelector public: ConflagrationTargetSelector() { } - bool operator()(Unit* unit) + bool operator()(WorldObject* unit) const { return unit->GetTypeId() != TYPEID_PLAYER; } @@ -201,12 +201,12 @@ class spell_saviana_conflagration_init : public SpellScriptLoader { PrepareSpellScript(spell_saviana_conflagration_init_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove_if (ConflagrationTargetSelector()); + targets.remove_if(ConflagrationTargetSelector()); uint8 maxSize = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 3); - if (unitList.size() > maxSize) - Trinity::Containers::RandomResizeList(unitList, maxSize); + if (targets.size() > maxSize) + Trinity::Containers::RandomResizeList(targets, maxSize); } void HandleDummy(SpellEffIndex effIndex) @@ -218,7 +218,7 @@ class spell_saviana_conflagration_init : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_saviana_conflagration_init_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_saviana_conflagration_init_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_saviana_conflagration_init_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 305266ee628..e96408acc09 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -60,9 +60,9 @@ class OrientationCheck : public std::unary_function { public: explicit OrientationCheck(Unit* _caster) : caster(_caster) { } - bool operator() (Unit* unit) + bool operator()(WorldObject* object) { - return !unit->isInFront(caster, 2.5f) || !unit->IsWithinDist(caster, 40.0f); + return !object->isInFront(caster, 2.5f) || !object->IsWithinDist(caster, 40.0f); } private: @@ -76,15 +76,16 @@ class spell_eadric_radiance : public SpellScriptLoader class spell_eadric_radiance_SpellScript : public SpellScript { PrepareSpellScript(spell_eadric_radiance_SpellScript); - void FilterTargets(std::list& unitList) + + void FilterTargets(std::list& unitList) { - unitList.remove_if (OrientationCheck(GetCaster())); + unitList.remove_if(OrientationCheck(GetCaster())); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); } }; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 4a28ebe6495..5b6bf14c29e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -359,7 +359,7 @@ class DistanceCheck public: explicit DistanceCheck(Unit* _caster) : caster(_caster) { } - bool operator() (Unit* unit) + bool operator() (WorldObject* unit) const { if (caster->GetExactDist2d(unit) <= 10.0f) return true; @@ -378,25 +378,25 @@ class spell_bronjahm_soulstorm_targeting : public SpellScriptLoader { PrepareSpellScript(spell_bronjahm_soulstorm_targeting_SpellScript); - void FilterTargetsInitial(std::list& unitList) + void FilterTargetsInitial(std::list& targets) { - unitList.remove_if (DistanceCheck(GetCaster())); - sharedUnitList = unitList; + targets.remove_if(DistanceCheck(GetCaster())); + sharedTargets = targets; } // use the same target for first and second effect - void FilterTargetsSubsequent(std::list& unitList) + void FilterTargetsSubsequent(std::list& targets) { - unitList = sharedUnitList; + targets = sharedTargets; } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsInitial, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsInitial, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY); } - std::list sharedUnitList; + std::list sharedTargets; }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index ee966256e2b..0d092ec86b2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -631,9 +631,9 @@ class BloodboltHitCheck public: explicit BloodboltHitCheck(LanaThelAI* ai) : _ai(ai) {} - bool operator()(Unit* unit) + bool operator()(WorldObject* object) const { - return _ai->WasBloodbolted(unit->GetGUID()); + return _ai->WasBloodbolted(object->GetGUID()); } private: @@ -661,13 +661,13 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader return GetCaster()->GetEntry() == NPC_BLOOD_QUEEN_LANA_THEL; } - void FilterTargets(std::list& targets) + void FilterTargets(std::list& targets) { uint32 targetCount = (targets.size() + 2) / 3; - targets.remove_if (BloodboltHitCheck(static_cast(GetCaster()->GetAI()))); + targets.remove_if(BloodboltHitCheck(static_cast(GetCaster()->GetAI()))); Trinity::Containers::RandomResizeList(targets, targetCount); // mark targets now, effect hook has missile travel time delay (might cast next in that time) - for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT); } @@ -679,7 +679,7 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_blood_queen_bloodbolt_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -699,19 +699,19 @@ class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader { PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove_if (Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN)); + targets.remove_if(Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN)); bool remove = true; - std::list::const_iterator itrEnd = unitList.end(), itr, itr2; + std::list::const_iterator itrEnd = targets.end(), itr, itr2; // we can do this, unitList is MAX 4 in size - for (itr = unitList.begin(); itr != itrEnd && remove; ++itr) + for (itr = targets.begin(); itr != itrEnd && remove; ++itr) { if (!GetCaster()->IsWithinDist(*itr, 5.0f, false)) remove = false; - for (itr2 = unitList.begin(); itr2 != itrEnd && remove; ++itr2) + for (itr2 = targets.begin(); itr2 != itrEnd && remove; ++itr2) if (itr != itr2 && !(*itr2)->IsWithinDist(*itr, 5.0f, false)) remove = false; } @@ -721,14 +721,14 @@ class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader if (InstanceScript* instance = GetCaster()->GetInstanceScript()) { instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); - unitList.clear(); + targets.clear(); } } } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; @@ -785,15 +785,15 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg_target : public SpellScriptLo { PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { - unitList.remove_if (Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN)); + unitList.remove_if(Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN)); unitList.push_back(GetCaster()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 494be259baa..5d3a6814eb2 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -1198,34 +1198,34 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader return true; } - void FilterTargetsInitial(std::list& unitList) + void FilterTargetsInitial(std::list& targets) { - if (unitList.empty()) + if (targets.empty()) return; // select one random target, with preference of ranged targets uint32 targetsAtRange = 0; uint32 const minTargets = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 10 : 4); - unitList.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false)); + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false)); // get target count at range - for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr, ++targetsAtRange) + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr, ++targetsAtRange) if ((*itr)->GetDistance(GetCaster()) < 12.0f) break; // set the upper cap if (targetsAtRange < minTargets) - targetsAtRange = std::min(unitList.size() - 1, minTargets); + targetsAtRange = std::min(targets.size() - 1, minTargets); - std::list::const_iterator itr = unitList.begin(); + std::list::const_iterator itr = targets.begin(); std::advance(itr, urand(0, targetsAtRange)); target = *itr; - unitList.clear(); - unitList.push_back(target); + targets.clear(); + targets.push_back(target); } // use the same target for first and second effect - void FilterTargetsSubsequent(std::list& unitList) + void FilterTargetsSubsequent(std::list& unitList) { if (!target) return; @@ -1241,12 +1241,12 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_nova_targeting_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); } - Unit* target; + WorldObject* target; }; SpellScript* GetSpellScript() const @@ -1269,20 +1269,20 @@ class spell_deathbringer_boiling_blood : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove(GetCaster()->getVictim()); - if (unitList.empty()) + targets.remove(GetCaster()->getVictim()); + if (targets.empty()) return; - Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList); - unitList.clear(); - unitList.push_back(target); + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_boiling_blood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_boiling_blood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 1672d8b2d87..0c5cb0aba52 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -416,7 +416,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader { PrepareSpellScript(spell_marrowgar_coldflame_SpellScript); - void SelectTarget(std::list& targets) + void SelectTarget(std::list& targets) { targets.clear(); // select any unit but not the tank (by owners threatlist) @@ -438,7 +438,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index b2662b644a7..a9ba0baa86f 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -870,26 +870,26 @@ class spell_putricide_ooze_channel : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void SelectTarget(std::list& targetList) + void SelectTarget(std::list& targets) { - if (targetList.empty()) + if (targets.empty()) { FinishCast(SPELL_FAILED_NO_VALID_TARGETS); GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update return; } - Unit* target = Trinity::Containers::SelectRandomContainerElement(targetList); - targetList.clear(); - targetList.push_back(target); + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); _target = target; } - void SetTarget(std::list& targetList) + void SetTarget(std::list& targets) { - targetList.clear(); + targets.clear(); if (_target) - targetList.push_back(_target); + targets.push_back(_target); } void StartAttack() @@ -912,14 +912,14 @@ class spell_putricide_ooze_channel : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack); OnCast += SpellCastFn(spell_putricide_ooze_channel_SpellScript::CheckTarget); } - Unit* _target; + WorldObject* _target; }; SpellScript* GetSpellScript() const @@ -933,7 +933,7 @@ class ExactDistanceCheck public: ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {} - bool operator()(Unit* unit) + bool operator()(WorldObject* unit) const { return _source->GetExactDist2d(unit) > _dist; } @@ -952,15 +952,15 @@ class spell_putricide_slime_puddle : public SpellScriptLoader { PrepareSpellScript(spell_putricide_slime_puddle_SpellScript); - void ScaleRange(std::list& targets) + void ScaleRange(std::list& targets) { targets.remove_if(ExactDistanceCheck(GetCaster(), 2.5f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X))); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); } }; @@ -1178,13 +1178,13 @@ class spell_putricide_eat_ooze : public SpellScriptLoader { PrepareSpellScript(spell_putricide_eat_ooze_SpellScript); - void SelectTarget(std::list& targets) + void SelectTarget(std::list& targets) { if (targets.empty()) return; targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); - Unit* target = targets.front(); + WorldObject* target = targets.front(); targets.clear(); targets.push_back(target); } @@ -1211,7 +1211,7 @@ class spell_putricide_eat_ooze : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_putricide_eat_ooze_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_eat_ooze_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_eat_ooze_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY); } }; @@ -1458,15 +1458,15 @@ class spell_putricide_mutated_transformation_dmg : public SpellScriptLoader { PrepareSpellScript(spell_putricide_mutated_transformation_dmg_SpellScript); - void FilterTargetsInitial(std::list& unitList) + void FilterTargetsInitial(std::list& targets) { if (Unit* owner = ObjectAccessor::GetUnit(*GetCaster(), GetCaster()->GetCreatorGUID())) - unitList.remove(owner); + targets.remove(owner); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_mutated_transformation_dmg_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_mutated_transformation_dmg_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index a4ab13f6ada..079a2ef48e1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -449,23 +449,23 @@ class spell_rotface_ooze_flood : public SpellScriptLoader GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : 0); } - void FilterTargets(std::list& targetList) + void FilterTargets(std::list& targets) { // get 2 targets except 2 nearest - targetList.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); // .resize() runs pop_back(); - if (targetList.size() > 4) - targetList.resize(4); + if (targets.size() > 4) + targets.resize(4); - while (targetList.size() > 2) - targetList.pop_front(); + while (targets.size() > 2) + targets.pop_front(); } void Register() { OnEffectHitTarget += SpellEffectFn(spell_rotface_ooze_flood_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_ooze_flood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_ooze_flood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); } }; @@ -490,7 +490,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader return true; } - void FilterTargets(std::list& targets) + void FilterTargets(std::list& targets) { // remove targets with this aura already // tank is not on this list @@ -498,13 +498,13 @@ class spell_rotface_mutated_infection : public SpellScriptLoader if (targets.empty()) return; - Unit* target = Trinity::Containers::SelectRandomContainerElement(targets); + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); targets.clear(); targets.push_back(target); _target = target; } - void ReplaceTargets(std::list& targets) + void ReplaceTargets(std::list& targets) { targets.clear(); if (_target) @@ -520,13 +520,13 @@ class spell_rotface_mutated_infection : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); AfterHit += SpellHitFn(spell_rotface_mutated_infection_SpellScript::NotifyTargets); } - Unit* _target; + WorldObject* _target; }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index fdc9a6a21d6..f6d9de9e967 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1044,9 +1044,9 @@ class spell_sindragosa_s_fury : public SpellScriptLoader return true; } - void CountTargets(std::list& unitList) + void CountTargets(std::list& targets) { - _targetCount = unitList.size(); + _targetCount = targets.size(); } void HandleDummy(SpellEffIndex effIndex) @@ -1071,7 +1071,7 @@ class spell_sindragosa_s_fury : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); } uint32 _targetCount; @@ -1088,9 +1088,11 @@ class UnchainedMagicTargetSelector public: UnchainedMagicTargetSelector() { } - bool operator()(Unit* unit) + bool operator()(WorldObject* object) const { - return unit->getPowerType() != POWER_MANA; + if (Unit* unit = object->ToUnit()) + return unit->getPowerType() != POWER_MANA; + return true; } }; @@ -1103,7 +1105,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader { PrepareSpellScript(spell_sindragosa_unchained_magic_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { unitList.remove_if(UnchainedMagicTargetSelector()); uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 2); @@ -1113,7 +1115,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_unchained_magic_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_unchained_magic_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -1296,7 +1298,7 @@ class MysticBuffetTargetFilter public: explicit MysticBuffetTargetFilter(Unit* caster) : _caster(caster) { } - bool operator()(Unit* unit) + bool operator()(WorldObject* unit) const { return !unit->IsWithinLOSInMap(_caster); } @@ -1314,14 +1316,14 @@ class spell_sindragosa_mystic_buffet : public SpellScriptLoader { PrepareSpellScript(spell_sindragosa_mystic_buffet_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove_if(MysticBuffetTargetFilter(GetCaster())); + targets.remove_if(MysticBuffetTargetFilter(GetCaster())); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -1399,22 +1401,15 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader return true; } - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - for (std::list::iterator itr = unitList.begin(); itr != unitList.end();) - { - if ((*itr)->GetTypeId() != TYPEID_PLAYER) - unitList.erase(itr++); - else - ++itr; - } - - if (unitList.empty()) + targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); + if (targets.empty()) return; - Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList); - unitList.clear(); - unitList.push_back(target); + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); } void HandleForcedCast(SpellEffIndex effIndex) @@ -1435,7 +1430,7 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_order_whelp_SpellScript::HandleForcedCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); - OnUnitTargetSelect += SpellUnitTargetFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index d2eaab361a1..a8657925131 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -391,7 +391,7 @@ class HeightDifferenceCheck { } - bool operator()(Unit* unit) const + bool operator()(WorldObject* unit) const { return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse; } @@ -2288,7 +2288,7 @@ class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader { PrepareSpellScript(spell_the_lich_king_shadow_trap_periodic_SpellScript); - void CheckTargetCount(std::list& targets) + void CheckTargetCount(std::list& targets) { if (targets.empty()) return; @@ -2298,7 +2298,7 @@ class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -2322,10 +2322,10 @@ class spell_the_lich_king_quake : public SpellScriptLoader return GetCaster()->GetInstanceScript() != NULL; } - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM))) - unitList.remove_if(HeightDifferenceCheck(platform, 5.0f, false)); + targets.remove_if(HeightDifferenceCheck(platform, 5.0f, false)); } void HandleSendEvent(SpellEffIndex /*effIndex*/) @@ -2336,7 +2336,7 @@ class spell_the_lich_king_quake : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); OnEffectHit += SpellEffectFn(spell_the_lich_king_quake_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT); } }; @@ -2363,7 +2363,7 @@ class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader return true; } - void CheckTargetCount(std::list& unitList) + void CheckTargetCount(std::list& unitList) { if (unitList.empty()) return; @@ -2371,12 +2371,16 @@ class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader // if there is at least one affected target cast the explosion GetCaster()->CastSpell(GetCaster(), SPELL_ICE_BURST, true); if (GetCaster()->GetTypeId() == TYPEID_UNIT) + { + GetCaster()->ToCreature()->SetReactState(REACT_PASSIVE); + GetCaster()->AttackStop(); GetCaster()->ToCreature()->DespawnOrUnsummon(500); + } } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -2425,7 +2429,7 @@ class ExactDistanceCheck public: ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {} - bool operator()(Unit* unit) + bool operator()(WorldObject* unit) { return _source->GetExactDist2d(unit) > _dist; } @@ -2444,7 +2448,7 @@ class spell_the_lich_king_defile : public SpellScriptLoader { PrepareSpellScript(spell_the_lich_king_defile_SpellScript); - void CorrectRange(std::list& targets) + void CorrectRange(std::list& targets) { targets.remove_if(ExactDistanceCheck(GetCaster(), 10.0f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X))); } @@ -2460,8 +2464,8 @@ class spell_the_lich_king_defile : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnHit += SpellHitFn(spell_the_lich_king_defile_SpellScript::ChangeDamageAndGrow); } }; @@ -2563,26 +2567,26 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader return true; } - void SelectTarget(std::list& unitList) + void SelectTarget(std::list& targets) { - if (unitList.empty()) + if (targets.empty()) return; - unitList.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); - if (unitList.empty()) + targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); + if (targets.empty()) return; - _target = Trinity::Containers::SelectRandomContainerElement(unitList); - unitList.clear(); - unitList.push_back(_target); + _target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(_target); GetCaster()->GetAI()->SetGUID(_target->GetGUID()); } - void ReplaceTarget(std::list& unitList) + void ReplaceTarget(std::list& targets) { - unitList.clear(); + targets.clear(); if (_target) - unitList.push_back(_target); + targets.push_back(_target); } void HandleScript(SpellEffIndex effIndex) @@ -2593,12 +2597,12 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } - Unit* _target; + WorldObject* _target; }; SpellScript* GetSpellScript() const @@ -2775,7 +2779,7 @@ class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoa return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void SelectTarget(std::list& targets) + void SelectTarget(std::list& targets) { if (targets.empty()) return; @@ -2796,11 +2800,11 @@ class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoa void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } - Unit* _target; + WorldObject* _target; }; SpellScript* GetSpellScript() const @@ -2823,7 +2827,7 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void CheckTargetCount(std::list& targets) + void CheckTargetCount(std::list& targets) { if (targets.empty()) return; @@ -2840,7 +2844,7 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } Unit* _target; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 31ed1eedf10..82946ad1f13 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -1187,13 +1187,13 @@ class spell_dreamwalker_summoner : public SpellScriptLoader return true; } - void FilterTargets(std::list& targets) + void FilterTargets(std::list& targets) { targets.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); if (targets.empty()) return; - Unit* target = Trinity::Containers::SelectRandomContainerElement(targets); + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); targets.clear(); targets.push_back(target); } @@ -1209,7 +1209,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summoner_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 46e8c1428e4..17e33912a86 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1834,15 +1834,15 @@ class DeathPlagueTargetSelector public: explicit DeathPlagueTargetSelector(Unit* caster) : _caster(caster) {} - bool operator()(Unit* unit) + bool operator()(WorldObject* object) const { - if (unit == _caster) + if (object == _caster) return true; - if (unit->GetTypeId() != TYPEID_PLAYER) + if (object->GetTypeId() != TYPEID_PLAYER) return true; - if (unit->HasAura(SPELL_RECENTLY_INFECTED) || unit->HasAura(SPELL_DEATH_PLAGUE_AURA)) + if (object->ToUnit()->HasAura(SPELL_RECENTLY_INFECTED) || object->ToUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA)) return true; return false; @@ -1868,25 +1868,25 @@ class spell_frost_giant_death_plague : public SpellScriptLoader } // First effect - void CountTargets(std::list& unitList) + void CountTargets(std::list& targets) { - unitList.remove(GetCaster()); - _failed = unitList.empty(); + targets.remove(GetCaster()); + _failed = targets.empty(); } // Second effect - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { // Select valid targets for jump - unitList.remove_if (DeathPlagueTargetSelector(GetCaster())); - if (!unitList.empty()) + targets.remove_if(DeathPlagueTargetSelector(GetCaster())); + if (!targets.empty()) { - Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList); - unitList.clear(); - unitList.push_back(target); + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); } - unitList.push_back(GetCaster()); + targets.push_back(GetCaster()); } void HandleScript(SpellEffIndex effIndex) @@ -1900,8 +1900,8 @@ class spell_frost_giant_death_plague : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_frost_giant_death_plague_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_frost_giant_death_plague_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frost_giant_death_plague_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frost_giant_death_plague_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY); OnEffectHitTarget += SpellEffectFn(spell_frost_giant_death_plague_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); } @@ -1950,9 +1950,11 @@ class spell_icc_harvest_blight_specimen : public SpellScriptLoader class AliveCheck { public: - bool operator()(Unit* unit) + bool operator()(WorldObject* object) const { - return unit->isAlive(); + if (Unit* unit = object->ToUnit()) + return unit->isAlive(); + return true; } }; @@ -1965,10 +1967,10 @@ class spell_svalna_revive_champion : public SpellScriptLoader { PrepareSpellScript(spell_svalna_revive_champion_SpellScript); - void RemoveAliveTarget(std::list& unitList) + void RemoveAliveTarget(std::list& targets) { - unitList.remove_if(AliveCheck()); - Trinity::Containers::RandomResizeList(unitList, 2); + targets.remove_if(AliveCheck()); + Trinity::Containers::RandomResizeList(targets, 2); } void Land(SpellEffIndex /*effIndex*/) @@ -1988,7 +1990,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_svalna_revive_champion_SpellScript::RemoveAliveTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_svalna_revive_champion_SpellScript::RemoveAliveTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY); OnEffectHit += SpellEffectFn(spell_svalna_revive_champion_SpellScript::Land, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 7f4915cb3f1..faaea9c4cae 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -602,14 +602,14 @@ class spell_gothik_shadow_bolt_volley : public SpellScriptLoader { PrepareSpellScript(spell_gothik_shadow_bolt_volley_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove_if(Trinity::UnitAuraCheck(false, SPELL_SHADOW_MARK)); + targets.remove_if(Trinity::UnitAuraCheck(false, SPELL_SHADOW_MARK)); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index ccc8e9a5663..e45700ebd72 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -456,10 +456,10 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void HandleTargets(std::list& targetList) + void HandleTargets(std::list& targets) { uint8 count = 0; - for (std::list::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit) + for (std::list::iterator ihit = targets.begin(); ihit != targets.end(); ++ihit) if ((*ihit)->GetGUID() != GetCaster()->GetGUID()) if (Player* target = (*ihit)->ToPlayer()) if (target->HasAura(GetTriggeringSpell()->Id)) @@ -498,7 +498,7 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - OnUnitTargetSelect += SpellUnitTargetFn(spell_thaddius_pos_neg_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 19a84fdae84..d200e8bf4bf 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -297,7 +297,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader { PrepareSpellScript(spell_varos_energize_core_area_enemySpellScript) - void FilterTargets(std::list& targetList) + void FilterTargets(std::list& targets) { Creature* varos = GetCaster()->ToCreature(); if (!varos) @@ -308,7 +308,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation(); - for (std::list::iterator itr = targetList.begin(); itr != targetList.end();) + for (std::list::iterator itr = targets.begin(); itr != targets.end();) { Position pos; (*itr)->GetPosition(&pos); @@ -317,7 +317,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader float diff = fabs(orientation - angle); if (diff > 1.0f) - itr = targetList.erase(itr); + itr = targets.erase(itr); else ++itr; } @@ -325,7 +325,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_varos_energize_core_area_enemySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_varos_energize_core_area_enemySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -344,7 +344,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader { PrepareSpellScript(spell_varos_energize_core_area_entrySpellScript) - void FilterTargets(std::list& targetList) + void FilterTargets(std::list& targets) { Creature* varos = GetCaster()->ToCreature(); if (!varos) @@ -355,7 +355,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation(); - for (std::list::iterator itr = targetList.begin(); itr != targetList.end();) + for (std::list::iterator itr = targets.begin(); itr != targets.end();) { Position pos; (*itr)->GetPosition(&pos); @@ -364,7 +364,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader float diff = fabs(orientation - angle); if (diff > 1.0f) - itr = targetList.erase(itr); + itr = targets.erase(itr); else ++itr; } @@ -372,7 +372,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_varos_energize_core_area_entrySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_varos_energize_core_area_entrySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); } }; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index e5e3daede91..93bea92503c 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -159,7 +159,7 @@ public: DoScriptText(SAY_KILL, me); } - void SpellHitTarget(Unit* target, const SpellInfo* pSpell) + void SpellHitTarget(Unit* /*target*/, const SpellInfo* pSpell) { //this part should be in the core if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER) 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 2af73389ecb..7ee67060f97 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 @@ -1080,7 +1080,7 @@ class NotVictimFilter { } - bool operator()(Unit* target) + bool operator()(WorldObject* target) { return target != _victim; } @@ -1098,14 +1098,14 @@ class spell_algalon_arcane_barrage : public SpellScriptLoader { PrepareSpellScript(spell_algalon_arcane_barrage_SpellScript); - void SelectTarget(std::list& targets) + void SelectTarget(std::list& targets) { targets.remove_if(NotVictimFilter(GetCaster())); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_arcane_barrage_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_arcane_barrage_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -1118,9 +1118,9 @@ class spell_algalon_arcane_barrage : public SpellScriptLoader class ActiveConstellationFilter { public: - bool operator()(Unit* target) const + bool operator()(WorldObject* target) const { - return target->GetAI()->GetData(0); + return target->ToUnit() && target->ToUnit()->GetAI() && target->ToUnit()->GetAI()->GetData(0); } }; @@ -1133,7 +1133,7 @@ class spell_algalon_trigger_3_adds : public SpellScriptLoader { PrepareSpellScript(spell_algalon_trigger_3_adds_SpellScript); - void SelectTarget(std::list& targets) + void SelectTarget(std::list& targets) { targets.remove_if(ActiveConstellationFilter()); } @@ -1150,7 +1150,7 @@ class spell_algalon_trigger_3_adds : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); } }; @@ -1202,7 +1202,7 @@ class spell_algalon_big_bang : public SpellScriptLoader return true; } - void CountTargets(std::list& targets) + void CountTargets(std::list& targets) { _targetCount = targets.size(); } @@ -1215,7 +1215,7 @@ class spell_algalon_big_bang : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); AfterCast += SpellCastFn(spell_algalon_big_bang_SpellScript::CheckTargets); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index 472ff153d73..ec3125f7c0a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -472,9 +472,9 @@ class npc_feral_defender : public CreatureScript class SanctumSentryCheck { public: - bool operator() (Unit* unit) + bool operator()(WorldObject* object) const { - if (unit->GetEntry() == NPC_SANCTUM_SENTRY) + if (object->GetEntry() == NPC_SANCTUM_SENTRY) return false; return true; @@ -490,14 +490,14 @@ class spell_auriaya_strenght_of_the_pack : public SpellScriptLoader { PrepareSpellScript(spell_auriaya_strenght_of_the_pack_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { - unitList.remove_if (SanctumSentryCheck()); + unitList.remove_if(SanctumSentryCheck()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_strenght_of_the_pack_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_strenght_of_the_pack_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; @@ -516,15 +516,15 @@ class spell_auriaya_sentinel_blast : public SpellScriptLoader { PrepareSpellScript(spell_auriaya_sentinel_blast_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { - unitList.remove_if (PlayerOrPetCheck()); + unitList.remove_if(PlayerOrPetCheck()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); } }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 8ff6c2e1a3a..ce0a61d1099 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1617,7 +1617,7 @@ class FlameLeviathanPursuedTargetSelector public: explicit FlameLeviathanPursuedTargetSelector(Unit* unit) : _me(unit) {}; - bool operator()(Unit* target) const + bool operator()(WorldObject* target) const { //! No players, only vehicles (todo: check if blizzlike) Creature* creatureTarget = target->ToCreature(); @@ -1665,7 +1665,7 @@ class spell_pursue : public SpellScriptLoader return true; } - void FilterTargets(std::list& targets) + void FilterTargets(std::list& targets) { targets.remove_if(FlameLeviathanPursuedTargetSelector(GetCaster())); if (targets.empty()) @@ -1681,7 +1681,7 @@ class spell_pursue : public SpellScriptLoader } } - void FilterTargetsSubsequently(std::list& targets) + void FilterTargetsSubsequently(std::list& targets) { targets.clear(); if (_target) @@ -1708,12 +1708,12 @@ class spell_pursue : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_pursue_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_pursue_SpellScript::FilterTargetsSubsequently, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pursue_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pursue_SpellScript::FilterTargetsSubsequently, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_pursue_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_APPLY_AURA); } - Unit* _target; + WorldObject* _target; }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index d89d640b083..24a9171e29f 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -354,7 +354,7 @@ class StoneGripTargetSelector : public std::unary_function public: StoneGripTargetSelector(Creature* me, Unit const* victim) : _me(me), _victim(victim) {} - bool operator() (Unit* target) + bool operator()(WorldObject* target) { if (target == _victim && _me->getThreatManager().getThreatList().size() > 1) return true; @@ -385,10 +385,10 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader return true; } - void FilterTargetsInitial(std::list& unitList) + void FilterTargetsInitial(std::list& unitList) { // Remove "main tank" and non-player targets - unitList.remove_if (StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->getVictim())); + unitList.remove_if(StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->getVictim())); // Maximum affected targets per difficulty mode uint32 maxTargets = 1; if (GetSpellInfo()->Id == 63981) @@ -397,7 +397,7 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader // Return a random amount of targets based on maxTargets while (maxTargets < unitList.size()) { - std::list::iterator itr = unitList.begin(); + std::list::iterator itr = unitList.begin(); advance(itr, urand(0, unitList.size()-1)); unitList.erase(itr); } @@ -406,20 +406,20 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader m_unitList = unitList; } - void FillTargetsSubsequential(std::list& unitList) + void FillTargetsSubsequential(std::list& unitList) { unitList = m_unitList; } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); } // Shared between effects - std::list m_unitList; + std::list m_unitList; }; SpellScript* GetSpellScript() const @@ -598,14 +598,14 @@ class spell_kologarn_stone_shout : public SpellScriptLoader { PrepareSpellScript(spell_kologarn_stone_shout_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { - unitList.remove_if (PlayerOrPetCheck()); + unitList.remove_if(PlayerOrPetCheck()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index a2044854672..7ada42144a8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -950,9 +950,9 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader { PrepareSpellScript(spell_xt002_tympanic_tantrum_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove_if(PlayerOrPetCheck()); + targets.remove_if(PlayerOrPetCheck()); } void RecalculateDamage() @@ -962,8 +962,8 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnHit += SpellHitFn(spell_xt002_tympanic_tantrum_SpellScript::RecalculateDamage); } }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index d35f0559080..858a82bbe57 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -268,10 +268,10 @@ GameObjectAI* GetUlduarAI(GameObject* go) class PlayerOrPetCheck { public: - bool operator() (Unit* unit) + bool operator()(WorldObject* object) const { - if (unit->GetTypeId() != TYPEID_PLAYER) - if (!unit->ToCreature()->isPet()) + if (object->GetTypeId() != TYPEID_PLAYER) + if (!object->ToCreature()->isPet()) return true; return false; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 44cd1184098..7969accc28c 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -522,12 +522,12 @@ public: }; }; -class checkRitualTarget +class RitualTargetCheck { public: - explicit checkRitualTarget(Unit* _caster) : caster(_caster) { } + explicit RitualTargetCheck(Unit* _caster) : caster(_caster) { } - bool operator() (Unit* unit) + bool operator() (WorldObject* unit) const { if (InstanceScript* instance = caster->GetInstanceScript()) if (instance->GetData64(DATA_SACRIFICED_PLAYER) == unit->GetGUID()) @@ -549,14 +549,14 @@ class spell_paralyze_pinnacle : public SpellScriptLoader { PrepareSpellScript(spell_paralyze_pinnacle_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { - unitList.remove_if(checkRitualTarget(GetCaster())); + unitList.remove_if(RitualTargetCheck(GetCaster())); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_paralyze_pinnacle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_paralyze_pinnacle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index d202fdd2f44..0454274401c 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -518,7 +518,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader return true; } - void CountTargets(std::list& targetList) + void CountTargets(std::list& targetList) { _targetCount = targetList.size(); } @@ -549,7 +549,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index 3579a7d697b..1cd67065af1 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -52,10 +52,10 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader return true; } - void HandleTargets(std::list& targetList) + void HandleTargets(std::list& targetList) { uint8 count = 0; - for (std::list::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit) + for (std::list::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit) if ((*ihit)->GetGUID() != GetCaster()->GetGUID()) if (Player* target = (*ihit)->ToPlayer()) if (target->HasAura(GetTriggeringSpell()->Id)) @@ -88,7 +88,7 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - OnUnitTargetSelect += SpellUnitTargetFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index ab568249027..96897ae3033 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -191,7 +191,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader return true; } - void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* owner = GetUnitOwner()) amount = CalculatePctU(owner->GetPower(POWER_MANA), 5); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index ae887baa413..6a58f3d03c5 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -349,16 +349,15 @@ class spell_dk_death_pact : public SpellScriptLoader return SPELL_FAILED_NO_PET; } - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { Unit* unit_to_add = NULL; - for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) { - if ((*itr)->GetTypeId() == TYPEID_UNIT - && (*itr)->GetOwnerGUID() == GetCaster()->GetGUID() - && (*itr)->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD) + if (Unit* unit = (*itr)->ToUnit()) + if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD) { - unit_to_add = (*itr); + unit_to_add = unit; break; } } @@ -371,7 +370,7 @@ class spell_dk_death_pact : public SpellScriptLoader void Register() { OnCheckCast += SpellCheckCastFn(spell_dk_death_pact_SpellScript::CheckCast); - OnUnitTargetSelect += SpellUnitTargetFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY); } }; diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 4c8a9db1571..f1f624fa8e9 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -232,37 +232,37 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { if (!GetCaster()->ToPlayer()->GetGroup()) { - unitList.clear(); - unitList.push_back(GetCaster()); + targets.clear(); + targets.push_back(GetCaster()); } else { - unitList.remove(GetExplTargetUnit()); + targets.remove(GetExplTargetUnit()); std::list tempTargets; - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr)) - tempTargets.push_back(*itr); + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith((*itr)->ToUnit())) + tempTargets.push_back((*itr)->ToUnit()); if (tempTargets.empty()) { - unitList.clear(); + targets.clear(); FinishCast(SPELL_FAILED_DONT_REPORT); return; } Unit* target = Trinity::Containers::SelectRandomContainerElement(tempTargets); - unitList.clear(); - unitList.push_back(target); + targets.clear(); + targets.push_back(target); } } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_t10_restoration_4p_bonus_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_t10_restoration_4p_bonus_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY); } }; @@ -281,14 +281,14 @@ class spell_dru_starfall_aoe : public SpellScriptLoader { PrepareSpellScript(spell_dru_starfall_aoe_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove(GetExplTargetUnit()); + targets.remove(GetExplTargetUnit()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_starfall_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); } }; @@ -341,9 +341,9 @@ class spell_dru_starfall_dummy : public SpellScriptLoader { PrepareSpellScript(spell_dru_starfall_dummy_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - Trinity::Containers::RandomResizeList(unitList, 2); + Trinity::Containers::RandomResizeList(targets, 2); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -366,7 +366,7 @@ class spell_dru_starfall_dummy : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 329e0d2e170..7d248b35853 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -409,7 +409,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader return true; } - void CountTargets(std::list& targetList) + void CountTargets(std::list& targetList) { _targetCount = targetList.size(); } @@ -428,7 +428,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); } }; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 6910bf47805..aab1e974e53 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -132,14 +132,14 @@ class spell_pri_mind_sear : public SpellScriptLoader { PrepareSpellScript(spell_pri_mind_sear_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { - unitList.remove_if (Trinity::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT))); + unitList.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT))); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_pri_mind_sear_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_mind_sear_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); } }; diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index fce3d0415a6..c863c2363af 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -262,9 +262,12 @@ class EarthenPowerTargetSelector public: EarthenPowerTargetSelector() { } - bool operator() (Unit* target) + bool operator() (WorldObject* target) { - if (!target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) + if (!target->ToUnit()) + return true; + + if (!target->ToUnit()->HasAuraWithMechanic(1 << MECHANIC_SNARE)) return true; return false; @@ -280,14 +283,14 @@ class spell_sha_earthen_power : public SpellScriptLoader { PrepareSpellScript(spell_sha_earthen_power_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { unitList.remove_if(EarthenPowerTargetSelector()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; @@ -313,7 +316,7 @@ class spell_sha_bloodlust : public SpellScriptLoader return true; } - void RemoveInvalidTargets(std::list& targets) + void RemoveInvalidTargets(std::list& targets) { targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); } @@ -326,9 +329,9 @@ class spell_sha_bloodlust : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); - OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID); - OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID); AfterHit += SpellHitFn(spell_sha_bloodlust_SpellScript::ApplyDebuff); } }; @@ -355,9 +358,9 @@ class spell_sha_heroism : public SpellScriptLoader return true; } - void RemoveInvalidTargets(std::list& targets) + void RemoveInvalidTargets(std::list& targets) { - targets.remove_if (Trinity::UnitAuraCheck(true, SHAMAN_SPELL_EXHAUSTION)); + targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_EXHAUSTION)); } void ApplyDebuff() @@ -368,9 +371,9 @@ class spell_sha_heroism : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); - OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID); - OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID); AfterHit += SpellHitFn(spell_sha_heroism_SpellScript::ApplyDebuff); } }; diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index e20eb07d45a..74118599b9f 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -302,15 +302,15 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader { PrepareSpellScript(spell_warl_seed_of_corruption_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { if (GetExplTargetUnit()) - unitList.remove(GetExplTargetUnit()); + targets.remove(GetExplTargetUnit()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); } }; diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 463b9b2fb97..c64101e11ea 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -77,7 +77,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader { PrepareSpellScript(spell_warr_improved_spell_reflection_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { if (GetCaster()) unitList.remove(GetCaster()); @@ -85,7 +85,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_warr_improved_spell_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_improved_spell_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY); } }; diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 045dea9c9a9..abb20130ef8 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -224,9 +224,9 @@ class DreamFogTargetSelector public: DreamFogTargetSelector() { } - bool operator()(Unit* unit) + bool operator()(WorldObject* object) const { - return unit->HasAura(SPELL_SLEEP); + return object->ToUnit() && object->ToUnit()->HasAura(SPELL_SLEEP); } }; @@ -239,14 +239,14 @@ class spell_dream_fog_sleep : public SpellScriptLoader { PrepareSpellScript(spell_dream_fog_sleep_SpellScript); - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& unitList) { - unitList.remove_if (DreamFogTargetSelector()); + unitList.remove_if(DreamFogTargetSelector()); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); } }; @@ -265,10 +265,12 @@ class MarkOfNatureTargetSelector public: MarkOfNatureTargetSelector() { } - bool operator()(Unit* unit) + bool operator()(WorldObject* object) const { - // return anyone that isn't tagged or already under the influence of Aura of Nature - return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE)); + if (Unit* unit = object->ToUnit()) + // return anyone that isn't tagged or already under the influence of Aura of Nature + return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE)); + return true; } }; @@ -290,9 +292,9 @@ class spell_mark_of_nature : public SpellScriptLoader return true; } - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - unitList.remove_if (MarkOfNatureTargetSelector()); + targets.remove_if(MarkOfNatureTargetSelector()); } void HandleEffect(SpellEffIndex effIndex) @@ -305,7 +307,7 @@ class spell_mark_of_nature : public SpellScriptLoader void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_mark_of_nature_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA); } }; diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index fb2fdf09583..4fac31a9ac6 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -185,8 +185,7 @@ class ByteBuffer ByteBuffer &operator<<(const char *str) { - size_t len = 0; - if (str && (len = strlen(str))) + if (size_t len = (str ? strlen(str) : 0)) append((uint8 const*)str, len); append((uint8)0); return *this; -- cgit v1.2.3 From 067c27d29920baaa97a242dea8d192dc848fdbd8 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 30 Jun 2012 00:06:17 +0200 Subject: Core/SpellScript: Corrected error messages and in-source documentation for OnObjectAreaTargetSelect hook and allow using that hook only for area spell targets --- src/server/game/Spells/Spell.cpp | 2 +- src/server/game/Spells/SpellScript.cpp | 49 ++++++++++++++++++++++++++++------ src/server/game/Spells/SpellScript.h | 24 +++++++++++------ 3 files changed, 58 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6b102c25882..e9ae93751b8 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -7042,7 +7042,7 @@ void Spell::CallScriptObjectAreaTargetSelectHandlers(std::list& ta { for (std::list::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { - (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT); + (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT); std::list::iterator hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin(); for (; hookItr != hookItrEnd; ++hookItr) if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex)) diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index eaccb8fc005..f033a4c043e 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -203,20 +203,19 @@ void SpellScript::HitHandler::Call(SpellScript* spellScript) (spellScript->*pHitHandlerScript)(); } -SpellScript::ObjectAreaTargetSelectHandler::ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) - : _SpellScript::EffectHook(_effIndex), targetType(_targetType) +SpellScript::TargetHook::TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area) + : _SpellScript::EffectHook(_effectIndex), targetType(_targetType), area(_area) { - pObjectAreaTargetSelectHandlerScript = _pObjectAreaTargetSelectHandlerScript; } -std::string SpellScript::ObjectAreaTargetSelectHandler::ToString() +std::string SpellScript::TargetHook::ToString() { std::ostringstream oss; oss << "Index: " << EffIndexToString() << " Target: " << targetType; return oss.str(); } -bool SpellScript::ObjectAreaTargetSelectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) +bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) { if (!targetType) return false; @@ -225,8 +224,42 @@ bool SpellScript::ObjectAreaTargetSelectHandler::CheckEffect(SpellInfo const* sp spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType) return false; - // TODO: Smart check if this hook will run for this targetType - return true; + SpellImplicitTargetInfo targetType(targetType); + switch (targetType.GetSelectionCategory()) + { + case TARGET_SELECT_CATEGORY_CHANNEL: // SINGLE + return !area; + case TARGET_SELECT_CATEGORY_NEARBY: // BOTH + return true; + case TARGET_SELECT_CATEGORY_CONE: // AREA + case TARGET_SELECT_CATEGORY_AREA: // AREA + return area; + case TARGET_SELECT_CATEGORY_DEFAULT: + switch (targetType.GetObjectType()) + { + case TARGET_OBJECT_TYPE_SRC: // EMPTY + case TARGET_OBJECT_TYPE_DEST: // EMPTY + return false; + default: + switch(targetType.GetReferenceType()) + { + case TARGET_REFERENCE_TYPE_CASTER: // SINGLE + return !area; + case TARGET_REFERENCE_TYPE_TARGET: // BOTH + return true; + } + break; + } + break; + } + + return false; +} + +SpellScript::ObjectAreaTargetSelectHandler::ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) + : TargetHook(_effIndex, _targetType, true) +{ + pObjectAreaTargetSelectHandlerScript = _pObjectAreaTargetSelectHandlerScript; } void SpellScript::ObjectAreaTargetSelectHandler::Call(SpellScript* spellScript, std::list& targets) @@ -254,7 +287,7 @@ bool SpellScript::_Validate(SpellInfo const* entry) for (std::list::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnUnitTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); return _SpellScript::_Validate(entry); } diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index a145a0b7377..9b1afd75405 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -131,7 +131,7 @@ enum SpellScriptHookType SPELL_SCRIPT_HOOK_BEFORE_HIT, SPELL_SCRIPT_HOOK_HIT, SPELL_SCRIPT_HOOK_AFTER_HIT, - SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT, + SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT, SPELL_SCRIPT_HOOK_CHECK_CAST, SPELL_SCRIPT_HOOK_BEFORE_CAST, SPELL_SCRIPT_HOOK_ON_CAST, @@ -196,16 +196,24 @@ class SpellScript : public _SpellScript SpellHitFnType pHitHandlerScript; }; - class ObjectAreaTargetSelectHandler : public _SpellScript::EffectHook + class TargetHook : public _SpellScript::EffectHook { public: - ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType); - std::string ToString(); + TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area); bool CheckEffect(SpellInfo const* spellEntry, uint8 targetType); + std::string ToString(); + protected: + uint16 targetType; + bool area; + }; + + class ObjectAreaTargetSelectHandler : public TargetHook + { + public: + ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType); void Call(SpellScript* spellScript, std::list& targets); private: SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript; - uint16 targetType; }; #define SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \ @@ -267,15 +275,15 @@ class SpellScript : public _SpellScript // where function is: void function() #define SpellHitFn(F) HitHandlerFunction(&F) - // example: OnUnitTargetSelect += SpellUnitTargetFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier); - // where function is void function(std::list& targetList) + // example: OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier); + // where function is void function(std::list& targets) HookList OnObjectAreaTargetSelect; #define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandlerFunction(&F, I, N) // hooks are executed in following order, at specified event of spell: // 1. BeforeCast - executed when spell preparation is finished (when cast bar becomes full) before cast is handled // 2. OnCheckCast - allows to override result of CheckCast function - // 3. OnUnitTargetSelect - executed just before adding selected targets to final target list + // 3a. OnObjectAreaTargetSelect - executed just before adding selected targets to final target list (for area targets) // 4. OnCast - executed just before spell is launched (creates missile) or executed // 5. AfterCast - executed after spell missile is launched and immediate spell actions are done // 6. OnEffectLaunch - executed just before specified effect handler call - when spell missile is launched -- cgit v1.2.3 From 469c7a0955b819655dbf9ed0ab4c14fcb5a4cc09 Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 30 Jun 2012 10:43:34 +0200 Subject: Core/Scripts: fix a crash from e0997874f5bf8d38b67ad3dee66e3d808dd1a059 --- src/server/game/Spells/SpellScript.cpp | 2 +- src/server/game/Spells/SpellScript.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index f033a4c043e..633e08e6fb1 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -224,7 +224,7 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType) return false; - SpellImplicitTargetInfo targetType(targetType); + SpellImplicitTargetInfo targetType(this->targetType); switch (targetType.GetSelectionCategory()) { case TARGET_SELECT_CATEGORY_CHANNEL: // SINGLE diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 9b1afd75405..51631bb8ffe 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -200,7 +200,7 @@ class SpellScript : public _SpellScript { public: TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area); - bool CheckEffect(SpellInfo const* spellEntry, uint8 targetType); + bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex); std::string ToString(); protected: uint16 targetType; -- cgit v1.2.3 From c8d20004a50d823c7acc4de97266615827af29f7 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 30 Jun 2012 16:07:09 +0200 Subject: Core: Minor code style corrections --- src/server/collision/Models/GameObjectModel.cpp | 2 +- src/server/collision/RegularGrid.h | 2 +- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/Handlers/AuctionHouseHandler.cpp | 2 +- .../game/Movement/Spline/MovementPacketBuilder.cpp | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Spells/Spell.cpp | 16 ++++----- src/server/game/Spells/SpellScript.cpp | 8 ++--- src/server/game/Warden/Warden.cpp | 2 +- src/server/game/Warden/WardenCheckMgr.cpp | 2 +- src/server/game/Warden/WardenMac.cpp | 4 +-- src/server/game/Warden/WardenWin.cpp | 4 +-- .../BlackrockSpire/boss_pyroguard_emberseer.cpp | 2 +- .../Northrend/IcecrownCitadel/boss_rotface.cpp | 2 +- .../IcecrownCitadel/boss_valithria_dreamwalker.cpp | 4 +-- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../scripts/Outland/blades_edge_mountains.cpp | 2 +- .../shared/Cryptography/WardenKeyGeneration.h | 42 ++++++++++++---------- src/server/shared/Database/PreparedStatement.cpp | 2 +- 19 files changed, 55 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 84c736c22e8..8b63620e783 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -176,7 +176,7 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto Ray modRay(p, iInvRot * ray.direction()); float distance = MaxDist * iInvScale; bool hit = iModel->IntersectRay(modRay, distance, StopAtFirstHit); - if(hit) + if (hit) { distance *= iScale; MaxDist = distance; diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h index 2867b29cfc1..00d7b0cd209 100644 --- a/src/server/collision/RegularGrid.h +++ b/src/server/collision/RegularGrid.h @@ -176,7 +176,7 @@ public: } if (cell == last_cell) break; - if(tMaxX < tMaxY) + if (tMaxX < tMaxY) { tMaxX += tDeltaX; cell.x += stepX; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 4176d9f605b..9f534ab697d 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -441,7 +441,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition() uint32 Condition::GetMaxAvailableConditionTargets() { // returns number of targets which are available for given source type - switch(SourceType) + switch (SourceType) { case CONDITION_SOURCE_TYPE_SPELL: case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index d26f275b864..3aee9ff0b00 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -161,7 +161,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) etime *= MINUTE; - switch(etime) + switch (etime) { case 1*MIN_AUCTION_TIME: case 2*MIN_AUCTION_TIME: diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index 16f06a25058..8aef671d2d1 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -49,7 +49,7 @@ namespace Movement data << move_spline.spline.getPoint(move_spline.spline.first()); data << move_spline.GetId(); - switch(splineflags & MoveSplineFlag::Mask_Final_Facing) + switch (splineflags & MoveSplineFlag::Mask_Final_Facing) { case MoveSplineFlag::Final_Target: data << uint8(MonsterMoveFacingTarget); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index ac51fff81f6..a4acff2a47c 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5083,7 +5083,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool break; case SPELLFAMILY_ROGUE: // Tricks of the trade - switch(GetId()) + switch (GetId()) { case 59628: //Tricks of the trade buff on rogue (6sec duration) target->SetReducedThreatPercent(0,0); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e9ae93751b8..33ecd66e8f6 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -827,7 +827,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar break; } - switch(targetType.GetSelectionCategory()) + switch (targetType.GetSelectionCategory()) { case TARGET_SELECT_CATEGORY_CHANNEL: SelectImplicitChannelTargets(effIndex, targetType); @@ -845,7 +845,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar switch (targetType.GetObjectType()) { case TARGET_OBJECT_TYPE_SRC: - switch(targetType.GetReferenceType()) + switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_CASTER: m_targets.SetSrc(*m_caster); @@ -856,7 +856,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar } break; case TARGET_OBJECT_TYPE_DEST: - switch(targetType.GetReferenceType()) + switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_CASTER: SelectImplicitCasterDestTargets(effIndex, targetType); @@ -873,7 +873,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar } break; default: - switch(targetType.GetReferenceType()) + switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_CASTER: SelectImplicitCasterObjectTargets(effIndex, targetType); @@ -1367,7 +1367,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { - switch(targetType.GetTarget()) + switch (targetType.GetTarget()) { case TARGET_DEST_CASTER: m_targets.SetDst(*m_caster); @@ -1432,7 +1432,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { WorldObject* target = m_targets.GetObjectTarget(); - switch(targetType.GetTarget()) + switch (targetType.GetTarget()) { case TARGET_DEST_TARGET_ENEMY: case TARGET_DEST_TARGET_ANY: @@ -1465,7 +1465,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); - switch(targetType.GetTarget()) + switch (targetType.GetTarget()) { case TARGET_DEST_DYNOBJ_ENEMY: case TARGET_DEST_DYNOBJ_ALLY: @@ -1491,7 +1491,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { - switch(targetType.GetTarget()) + switch (targetType.GetTarget()) { case TARGET_UNIT_CASTER: AddUnitTarget(m_caster, 1 << effIndex, false); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 633e08e6fb1..a19c356b9ed 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -224,8 +224,8 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType) return false; - SpellImplicitTargetInfo targetType(this->targetType); - switch (targetType.GetSelectionCategory()) + SpellImplicitTargetInfo targetInfo(targetType); + switch (targetInfo.GetSelectionCategory()) { case TARGET_SELECT_CATEGORY_CHANNEL: // SINGLE return !area; @@ -235,13 +235,13 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff case TARGET_SELECT_CATEGORY_AREA: // AREA return area; case TARGET_SELECT_CATEGORY_DEFAULT: - switch (targetType.GetObjectType()) + switch (targetInfo.GetObjectType()) { case TARGET_OBJECT_TYPE_SRC: // EMPTY case TARGET_OBJECT_TYPE_DEST: // EMPTY return false; default: - switch(targetType.GetReferenceType()) + switch (targetInfo.GetReferenceType()) { case TARGET_REFERENCE_TYPE_CASTER: // SINGLE return !area; diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 8608701e2ee..54e56174b1a 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -211,7 +211,7 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) sLog->outDebug(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size())); recvData.hexlike(); - switch(opcode) + switch (opcode) { case WARDEN_CMSG_MODULE_MISSING: _warden->SendModuleToClient(); diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index f4c7a5069cf..abd7ff8f87d 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -121,7 +121,7 @@ void WardenCheckMgr::LoadWardenChecks() if (checkType == MPQ_CHECK || checkType == MEM_CHECK) { - WardenCheckResult *wr = new WardenCheckResult(); + WardenCheckResult* wr = new WardenCheckResult(); wr->Result.SetHexStr(checkResult.c_str()); int len = checkResult.size() / 2; if (wr->Result.GetNumBytes() < len) diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 319cda304cc..3cc95b9f3f7 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -43,8 +43,8 @@ void WardenMac::Init(WorldSession *pClient, BigNumber *K) _session = pClient; // Generate Warden Key SHA1Randx WK(K->AsByteArray(), K->GetNumBytes()); - WK.generate(_inputKey, 16); - WK.generate(_outputKey, 16); + WK.Generate(_inputKey, 16); + WK.Generate(_outputKey, 16); /* Seed: 4D808D2C77D905C41A6380EC08586AFE (0x05 packet) Hash: (0x04 packet) diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index a7485d7da51..9aa439ec8c0 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -47,8 +47,8 @@ void WardenWin::Init(WorldSession* session, BigNumber *k) _session = session; // Generate Warden Key SHA1Randx WK(k->AsByteArray(), k->GetNumBytes()); - WK.generate(_inputKey, 16); - WK.generate(_outputKey, 16); + WK.Generate(_inputKey, 16); + WK.Generate(_outputKey, 16); memcpy(_seed, Module.Seed, 16); diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 0279f3e2834..015c13d1098 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -64,7 +64,7 @@ public: void Reset() { - if(instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) + if (instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) OpenDoors(false); instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED); // respawn any dead Blackhand Incarcerators diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 079a2ef48e1..5a0560293da 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -494,7 +494,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader { // remove targets with this aura already // tank is not on this list - targets.remove_if (Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); + targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); if (targets.empty()) return; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 82946ad1f13..826c62a4390 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -1189,7 +1189,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); if (targets.empty()) return; @@ -1238,7 +1238,7 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader std::list summoners; GetCreatureListWithEntryInGrid(summoners, caster, NPC_WORLD_TRIGGER, 100.0f); - summoners.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); + summoners.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); Trinity::Containers::RandomResizeList(summoners, 2); if (summoners.empty()) return; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index ce0a61d1099..9d5adf39817 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1230,7 +1230,7 @@ public: //bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) //{ // player->PlayerTalkClass->ClearMenus(); - // switch(action) + // switch (action) // { // case GOSSIP_ACTION_INFO_DEF+1: // if (player) diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index 4ec1d04b6ad..c46757a3956 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -651,7 +651,7 @@ class npc_simon_bunny : public CreatureScript { _events.Update(diff); - switch(_events.ExecuteEvent()) + switch (_events.ExecuteEvent()) { case EVENT_SIMON_PERIODIC_PLAYER_CHECK: if (!CheckPlayer()) diff --git a/src/server/shared/Cryptography/WardenKeyGeneration.h b/src/server/shared/Cryptography/WardenKeyGeneration.h index 9b44ab1832e..f0a9905b6fe 100644 --- a/src/server/shared/Cryptography/WardenKeyGeneration.h +++ b/src/server/shared/Cryptography/WardenKeyGeneration.h @@ -21,50 +21,56 @@ #ifndef _WARDEN_KEY_GENERATION_H #define _WARDEN_KEY_GENERATION_H -class SHA1Randx { +class SHA1Randx +{ public: - SHA1Randx(uint8 *buff, uint32 size) { + SHA1Randx(uint8* buff, uint32 size) + { uint32 taken = size/2; sh.Initialize(); - sh.UpdateData(buff,taken); + sh.UpdateData(buff, taken); sh.Finalize(); - memcpy(o1,sh.GetDigest(),20); + memcpy(o1, sh.GetDigest(), 20); sh.Initialize(); - sh.UpdateData(buff+taken,size-taken); + sh.UpdateData(buff + taken, size - taken); sh.Finalize(); - memcpy(o2,sh.GetDigest(),20); + memcpy(o2, sh.GetDigest(), 20); - memset(o0,0x00,20); + memset(o0, 0x00, 20); - fillUp(); + FillUp(); } - void generate(uint8 *buf, uint32 sz) { - for(uint32 i=0;ibind_result_done) + if (m_Mstmt->bind_result_done) { delete[] m_Mstmt->bind->length; delete[] m_Mstmt->bind->is_null; -- cgit v1.2.3 From 330880906612458a5edd1f4248c8001575197dc7 Mon Sep 17 00:00:00 2001 From: Faq Date: Sat, 30 Jun 2012 21:27:09 +0300 Subject: Correcting Black Ice bonus dmg for Scourge strike shadow part. Thnx Tibbi & Shauren --- src/server/scripts/Spells/spell_dk.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 6a58f3d03c5..5095092927e 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -41,6 +41,7 @@ enum DeathKnightSpells DK_SPELL_UNHOLY_PRESENCE = 48265, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622, SPELL_DK_ITEM_T8_MALEE_4P_BONUS = 64736, + DK_SPELL_BLACK_ICE_R1 = 49140, }; // 50462 - Anti-Magic Shell (on raid member) @@ -422,6 +423,10 @@ class spell_dk_scourge_strike : public SpellScriptLoader if (Unit* unitTarget = GetHitUnit()) { int32 bp = GetHitDamage() * multiplier; + + if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0)) + AddPctN(bp, aurEff->GetAmount()); + caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true); } } -- cgit v1.2.3 From ee2252163fc1dd95991a57d3714ace1f7442be28 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 30 Jun 2012 23:14:34 +0200 Subject: Scripts/Icecrown Citadel: Fixed visual and target selection of Sindragosa's Fury --- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index f6d9de9e967..bcf3229b7d2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1041,7 +1041,26 @@ class spell_sindragosa_s_fury : public SpellScriptLoader bool Load() { _targetCount = 0; - return true; + + // This script should execute only in Icecrown Citadel + if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap()) + if (instance->GetInstanceScript()) + if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName)) + return true; + + return false; + } + + void SelectDest() + { + if (Position* dest = const_cast(GetExplTargetDest())) + { + float destX = float(rand_norm()) * 75.0f + 4350.0f; + float destY = float(rand_norm()) * 75.0f + 2450.0f; + float destZ = 205.0f; // random number close to ground, get exact in next call + GetCaster()->UpdateGroundPositionZ(destX, destY, destZ); + dest->Relocate(destX, destY, destZ); + } } void CountTargets(std::list& targets) @@ -1057,10 +1076,10 @@ class spell_sindragosa_s_fury : public SpellScriptLoader return; float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask))); - uint32 minResistFactor = uint32((resistance / (resistance + 510.0f))* 10.0f) * 2; - uint32 randomResist = urand(0, (9 - minResistFactor) * 100)/100 + minResistFactor; + uint32 minResistFactor = uint32((resistance / (resistance + 510.0f)) * 10.0f) * 2; + uint32 randomResist = urand(0, (9 - minResistFactor) * 100) / 100 + minResistFactor; - uint32 damage = (uint32(GetEffectValue()/_targetCount) * randomResist) / 10; + uint32 damage = (uint32(GetEffectValue() / _targetCount) * randomResist) / 10; SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo()->Id, GetSpellInfo()->SchoolMask); damageInfo.damage = damage; @@ -1070,8 +1089,9 @@ class spell_sindragosa_s_fury : public SpellScriptLoader void Register() { - OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + BeforeCast += SpellCastFn(spell_sindragosa_s_fury_SpellScript::SelectDest); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); } uint32 _targetCount; -- cgit v1.2.3 From bd8226414d288cedf5a8ae00f0d88dcf694e384d Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 30 Jun 2012 23:22:51 +0200 Subject: Missed change for previous commit --- src/server/game/Spells/SpellMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 0b1955a02ec..d40c08f1c4c 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3441,7 +3441,7 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd break; case 70598: // Sindragosa's Fury - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; break; case 69846: // Frost Bomb spellInfo->speed = 0.0f; // This spell's summon happens instantly -- cgit v1.2.3 From f4ec8b033dd62a2a3b8e665f00ad0283a6894856 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 1 Jul 2012 01:15:13 +0200 Subject: Scripts/Icecrown Citadel: Fixed Frost Bomb ignoring line of sight checks --- src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index bcf3229b7d2..e3c0f2260df 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" +#include "GridNotifiers.h" #include "icecrown_citadel.h" enum Texts @@ -183,7 +184,7 @@ class FrostBombExplosion : public BasicEvent bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) { - _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, true, NULL, NULL, _sindragosaGUID); + _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, false, NULL, NULL, _sindragosaGUID); _owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL); return true; } -- cgit v1.2.3 From 6eadc63ade75b0ad6e3b22d2a21d22e94938d1b1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 1 Jul 2012 01:42:58 +0200 Subject: Core/VMaps: Use fabs instead of abs for float type. On some platforms abs has only int overload exists. --- src/server/collision/Models/WorldModel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index b818232fb32..b4f3f73fc98 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -42,7 +42,7 @@ namespace VMAP const Vector3 p(ray.direction().cross(e2)); const float a = e1.dot(p); - if (abs(a) < EPS) { + if (fabs(a) < EPS) { // Determinant is ill-conditioned; abort early return false; } -- cgit v1.2.3 From 86353cdde14237a2e9908b49c5785530f91dbd3a Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Sun, 1 Jul 2012 15:25:33 +0200 Subject: Core/Scripts: Use proper headers, code style, creature_texts and cleanup (Battle for Mount Hyjal) --- .../world/2012_07_01_00_world_creature_text.sql | 64 +++++++++++ .../BattleForMountHyjal/boss_anetheron.cpp | 113 +++++-------------- .../BattleForMountHyjal/boss_archimonde.cpp | 123 ++++++++++----------- .../BattleForMountHyjal/boss_azgalor.cpp | 69 ++++-------- .../BattleForMountHyjal/boss_kazrogal.cpp | 56 +++------- .../BattleForMountHyjal/boss_rage_winterchill.cpp | 85 ++++---------- .../CavernsOfTime/BattleForMountHyjal/hyjal.cpp | 4 +- .../CavernsOfTime/BattleForMountHyjal/hyjal.h | 2 +- .../CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp | 22 ++-- .../CavernsOfTime/BattleForMountHyjal/hyjalAI.h | 80 +++++++------- .../BattleForMountHyjal/hyjal_trash.cpp | 55 +++++---- .../BattleForMountHyjal/instance_hyjal.cpp | 9 +- 12 files changed, 297 insertions(+), 385 deletions(-) create mode 100644 sql/updates/world/2012_07_01_00_world_creature_text.sql (limited to 'src') diff --git a/sql/updates/world/2012_07_01_00_world_creature_text.sql b/sql/updates/world/2012_07_01_00_world_creature_text.sql new file mode 100644 index 00000000000..6f2bed8e7d6 --- /dev/null +++ b/sql/updates/world/2012_07_01_00_world_creature_text.sql @@ -0,0 +1,64 @@ +-- Anetheron +DELETE FROM `creature_text` WHERE `entry`=17808; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(17808,0,0, 'The clock... is still... ticking.',14,0,100,0,0,10982, 'Anetheron - SAY_ONDEATH'), +(17808,1,0, 'Your hopes are lost!',14,0,100,0,0,10981, 'Anetheron - SAY_ONSLAY1'), +(17808,1,1, 'Scream for me!',14,0,100,0,0,11038, 'Anetheron - SAY_ONSLAY2'), +(17808,1,2, 'Pity, no time for a slow death!',14,0,100,0,0,11039, 'Anetheron - SAY_ONSLAY3'), +(17808,2,0, 'The swarm is eager to feed!',14,0,100,0,0,10979, 'Anetheron - SAY_SWARM1'), +(17808,2,1, 'Pestilence upon you!',14,0,100,0,0,11037, 'Anetheron - SAY_SWARM2'), +(17808,3,0, 'You look tired...',14,0,100,0,0,10978, 'Anetheron - SAY_SLEEP1'), +(17808,3,1, 'Sweet dreams...',14,0,100,0,0,11545, 'Anetheron - SAY_SLEEP2'), +(17808,4,0, 'Let fire rain from above!',14,0,100,0,0,10980, 'Anetheron - SAY_INFERNO1'), +(17808,4,1, 'Earth and sky shall burn!',14,0,100,0,0,11036, 'Anetheron - SAY_INFERNO2'), +(17808,5,0, 'You are defenders of a doomed world! Flee here, and perhaps you will prolong your pathetic lives!',14,0,100,0,0,10977, 'Anetheron - SAY_ONAGGRO'); + +-- Azgalor +DELETE FROM `creature_text` WHERE `entry`=17842; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(17842,0,0, 'Your time is almost... up',14,0,100,0,0,11002, 'Azgalor - SAY_ONDEATH'), +(17842,1,0, 'Reesh, hokta!',14,0,100,0,0,11001, 'Azgalor - SAY_ONSLAY1'), +(17842,1,1, 'Don''t fight it',14,0,100,0,0,11048, 'Azgalor - SAY_ONSLAY2'), +(17842,1,2, 'No one is going to save you',14,0,100,0,0,11047, 'Azgalor - SAY_ONSLAY3'), +(17842,2,0, 'Just a taste... of what awaits you',14,0,100,0,0,11046, 'Azgalor - SAY_DOOM1'), +(17842,2,1, 'Suffer you despicable insect!',14,0,100,0,0,11000, 'Azgalor - SAY_DOOM2'), +(17842,3,0, 'Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!',14,0,100,0,0,10999, 'Azgalor - SAY_ONAGGRO'); + +-- Kazrogal +DELETE FROM `creature_text` WHERE `entry`=17888; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(17888,0,0, 'Shaza-Kiel!',14,0,100,0,0,11017, 'Kazrogal - SAY_ONSLAY1'), +(17888,0,1, 'You... are nothing!',14,0,100,0,0,11053, 'Kazrogal - SAY_ONSLAY2'), +(17888,0,2, 'Miserable nuisance!',14,0,100,0,0,11054, 'Kazrogal - SAY_ONSLAY3'), +(17888,1,0, 'Your death will be a painful one.',14,0,100,0,0,11016, 'Kazrogal - SAY_MARK1'), +(17888,1,1, 'You... are marked.',14,0,100,0,0,11052, 'Kazrogal - SAY_MARK2'), +(17888,2,0, 'Cry for mercy! Your meaningless lives will soon be forfeit.',14,0,100,0,0,11015, 'Kazrogal - SAY_ONAGGRO'); + +-- Rage Winterchill +DELETE FROM `creature_text` WHERE `entry`=17767; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(17767,0,0, 'You have won this battle, but not... the... war',14,0,100,0,0,11026, 'Rage Winterchill - SAY_ONDEATH'), +(17767,1,0, 'All life must perish!',14,0,100,0,0,11025, 'Rage Winterchill - SAY_ONSLAY1'), +(17767,1,1, 'Victory to the Legion!',14,0,100,0,0,11057, 'Rage Winterchill - SAY_ONSLAY2'), +(17767,2,0, 'Crumble and rot!',14,0,100,0,0,11023, 'Rage Winterchill - SAY_DECAY1'), +(17767,2,1, 'Ashes to ashes, dust to dust',14,0,100,0,0,11055, 'Rage Winterchill - SAY_DECAY2'), +(17767,3,0, 'Succumb to the icy chill... of death!',14,0,100,0,0,11024, 'Rage Winterchill - SAY_NOVA1'), +(17767,3,1, 'It will be much colder in your grave',14,0,100,0,0,11058, 'Rage Winterchill - SAY_NOVA2'), +(17767,4,0, 'The Legion''s final conquest has begun! Once again the subjugation of this world is within our grasp. Let none survive!',14,0,100,0,0,11022, 'Rage Winterchill - SAY_ONAGGRO'); + +-- Archimonde +DELETE FROM `creature_text` WHERE `entry`=17968; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(17968,1,0, 'Your resistance is insignificant.',14,0,100,0,0,10987, 'Archimonde - SAY_AGGRO'), +(17968,2,0, 'This world will burn!',14,0,100,0,0,10990, 'Archimonde - SAY_DOOMFIRE1'), +(17968,2,1, 'Manach sheek-thrish!',14,0,100,0,0,11041, 'Archimonde - SAY_DOOMFIRE2'), +(17968,3,0, 'A-kreesh!',14,0,100,0,0,11041, 'Archimonde - SAY_AIR_BURST1'), +(17968,3,1, 'Away vermin!',14,0,100,0,0,10989, 'Archimonde - SAY_AIR_BURST2'), +(17968,4,0, 'All creation will be devoured!',14,0,100,0,0,11044, 'Archimonde - SAY_SLAY1'), +(17968,4,1, 'Your soul will languish for eternity.',14,0,100,0,0,10991, 'Archimonde - SAY_SLAY12'), +(17968,4,2, 'I am the coming of the end!',14,0,100,0,0,11045, 'Archimonde - SAY_SLAY3'), +(17968,5,0, 'At last it is here. Mourn and lament the passing of all you have ever known and all that would have been! Akmin-kurai!',14,0,100,0,0,10993, 'Archimonde - SAY_ENRAGE'), +(17968,6,0, 'No, it cannot be! Nooo!',14,0,100,0,0,10992, 'Archimonde - SAY_DEATH'), +(17968,7,0, 'You are mine now.',14,0,100,0,0,10988, 'Archimonde - SAY_SOUL_CHARGE1'), +(17968,7,1, 'Bow to my will.',14,0,100,0,0,11042, 'Archimonde - SAY_SOUL_CHARGE2'); + diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index 85f82c62079..222626240ea 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -15,42 +15,30 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "hyjal.h" #include "hyjal_trash.h" -#define SPELL_CARRION_SWARM 31306 -#define SPELL_SLEEP 31298 -#define SPELL_VAMPIRIC_AURA 38196 -#define SPELL_INFERNO 31299 - -#define SAY_ONDEATH "The clock... is still... ticking." -#define SOUND_ONDEATH 10982 - -#define SAY_ONSLAY1 "Your hopes are lost!" -#define SAY_ONSLAY2 "Scream for me!" -#define SAY_ONSLAY3 "Pity, no time for a slow death!" -#define SOUND_ONSLAY1 10981 -#define SOUND_ONSLAY2 11038 -#define SOUND_ONSLAY3 11039 - -#define SAY_SWARM1 "The swarm is eager to feed!" -#define SAY_SWARM2 "Pestilence upon you!" -#define SOUND_SWARM1 10979 -#define SOUND_SWARM2 11037 - -#define SAY_SLEEP1 "You look tired..." -#define SAY_SLEEP2 "Sweet dreams..." -#define SOUND_SLEEP1 10978 -#define SOUND_SLEEP2 11545 - -#define SAY_INFERNO1 "Let fire rain from above!" -#define SAY_INFERNO2 "Earth and sky shall burn!" -#define SOUND_INFERNO1 10980 -#define SOUND_INFERNO2 11036 +enum Spells +{ + SPELL_CARRION_SWARM = 31306, + SPELL_SLEEP = 31298, + SPELL_VAMPIRIC_AURA = 38196, + SPELL_INFERNO = 31299, + SPELL_IMMOLATION = 31303, + SPELL_INFERNO_EFFECT = 31302, +}; -#define SAY_ONAGGRO "You are defenders of a doomed world! Flee here, and perhaps you will prolong your pathetic lives!" -#define SOUND_ONAGGRO 10977 +enum Texts +{ + SAY_ONDEATH = 0, + SAY_ONSLAY = 1, + SAY_SWARM = 2, + SAY_SLEEP = 3, + SAY_INFERNO = 4, + SAY_ONAGGRO = 5, +}; class boss_anetheron : public CreatureScript { @@ -92,27 +80,12 @@ public: { if (instance && IsEvent) instance->SetData(DATA_ANETHERONEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); + Talk(SAY_ONAGGRO); } void KilledUnit(Unit* /*victim*/) { - switch (urand(0, 2)) - { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_ONSLAY); } void WaypointReached(uint32 waypointId) @@ -130,8 +103,7 @@ public: hyjal_trashAI::JustDied(killer); if (instance && IsEvent) instance->SetData(DATA_ANETHERONEVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0); + Talk(SAY_ONDEATH); } void UpdateAI(const uint32 diff) @@ -169,17 +141,7 @@ public: DoCast(target, SPELL_CARRION_SWARM); SwarmTimer = urand(45000, 60000); - switch (urand(0, 1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_SWARM1); - me->MonsterYell(SAY_SWARM1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_SWARM2); - me->MonsterYell(SAY_SWARM2, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_SWARM); } else SwarmTimer -= diff; if (SleepTimer <= diff) @@ -190,17 +152,7 @@ public: target->CastSpell(target, SPELL_SLEEP, true); } SleepTimer = 60000; - switch (urand(0, 1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_SLEEP1); - me->MonsterYell(SAY_SLEEP1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_SLEEP2); - me->MonsterYell(SAY_SLEEP2, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_SLEEP); } else SleepTimer -= diff; if (AuraTimer <= diff) { @@ -211,17 +163,7 @@ public: { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_INFERNO); InfernoTimer = 45000; - switch (urand(0, 1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_INFERNO1); - me->MonsterYell(SAY_INFERNO1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_INFERNO2); - me->MonsterYell(SAY_INFERNO2, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_INFERNO); } else InfernoTimer -= diff; DoMeleeAttackIfReady(); @@ -230,9 +172,6 @@ public: }; -#define SPELL_IMMOLATION 31303 -#define SPELL_INFERNO_EFFECT 31302 - class mob_towering_infernal : public CreatureScript { public: diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index f07aaaa1f2a..ee988accbac 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -23,56 +23,57 @@ SDComment: Doomfires not completely offlike due to core limitations for random m SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "hyjal.h" #include "SpellAuras.h" #include "hyjal_trash.h" -//text id -1534018 are the text used when previous events complete. Not part of this script. -#define SAY_AGGRO -1534019 -#define SAY_DOOMFIRE1 -1534020 -#define SAY_DOOMFIRE2 -1534021 -#define SAY_AIR_BURST1 -1534022 -#define SAY_AIR_BURST2 -1534023 -#define SAY_SLAY1 -1534024 -#define SAY_SLAY2 -1534025 -#define SAY_SLAY3 -1534026 -#define SAY_ENRAGE -1534027 -#define SAY_DEATH -1534028 -#define SAY_SOUL_CHARGE1 -1534029 -#define SAY_SOUL_CHARGE2 -1534030 - -#define SPELL_DENOUEMENT_WISP 32124 -#define SPELL_ANCIENT_SPARK 39349 -#define SPELL_PROTECTION_OF_ELUNE 38528 - -#define SPELL_DRAIN_WORLD_TREE 39140 -#define SPELL_DRAIN_WORLD_TREE_2 39141 - -#define SPELL_FINGER_OF_DEATH 31984 -#define SPELL_HAND_OF_DEATH 35354 -#define SPELL_AIR_BURST 32014 -#define SPELL_GRIP_OF_THE_LEGION 31972 -#define SPELL_DOOMFIRE_STRIKE 31903 //summons two creatures -#define SPELL_DOOMFIRE_SPAWN 32074 -#define SPELL_DOOMFIRE 31945 -#define SPELL_SOUL_CHARGE_YELLOW 32045 -#define SPELL_SOUL_CHARGE_GREEN 32051 -#define SPELL_SOUL_CHARGE_RED 32052 -#define SPELL_UNLEASH_SOUL_YELLOW 32054 -#define SPELL_UNLEASH_SOUL_GREEN 32057 -#define SPELL_UNLEASH_SOUL_RED 32053 -#define SPELL_FEAR 31970 - -#define CREATURE_ARCHIMONDE 17968 -#define CREATURE_DOOMFIRE 18095 -#define CREATURE_DOOMFIRE_SPIRIT 18104 -#define CREATURE_ANCIENT_WISP 17946 -#define CREATURE_CHANNEL_TARGET 22418 - -#define NORDRASSIL_X 5503.713f -#define NORDRASSIL_Y -3523.436f -#define NORDRASSIL_Z 1608.781f +enum Texts +{ + SAY_AGGRO = 1, + SAY_DOOMFIRE = 2, + SAY_AIR_BURST = 3, + SAY_SLAY = 4, + SAY_ENRAGE = 5, + SAY_DEATH = 6, + SAY_SOUL_CHARGE = 7, +}; + +enum Spells +{ + SPELL_DENOUEMENT_WISP = 32124, + SPELL_ANCIENT_SPARK = 39349, + SPELL_PROTECTION_OF_ELUNE = 38528, + + SPELL_DRAIN_WORLD_TREE = 39140, + SPELL_DRAIN_WORLD_TREE_2 = 39141, + + SPELL_FINGER_OF_DEATH = 31984, + SPELL_HAND_OF_DEATH = 35354, + SPELL_AIR_BURST = 32014, + SPELL_GRIP_OF_THE_LEGION = 31972, + SPELL_DOOMFIRE_STRIKE = 31903, //summons two creatures + SPELL_DOOMFIRE_SPAWN = 32074, + SPELL_DOOMFIRE = 31945, + SPELL_SOUL_CHARGE_YELLOW = 32045, + SPELL_SOUL_CHARGE_GREEN = 32051, + SPELL_SOUL_CHARGE_RED = 32052, + SPELL_UNLEASH_SOUL_YELLOW = 32054, + SPELL_UNLEASH_SOUL_GREEN = 32057, + SPELL_UNLEASH_SOUL_RED = 32053, + SPELL_FEAR = 31970, +}; + +enum Summons +{ + CREATURE_DOOMFIRE = 18095, + CREATURE_DOOMFIRE_SPIRIT = 18104, + CREATURE_ANCIENT_WISP = 17946, + CREATURE_CHANNEL_TARGET = 22418, +}; + +Position const NordrassilLoc = {5503.713f, -3523.436f, 1608.781f, 0.0f}; class mob_ancient_wisp : public CreatureScript { @@ -258,11 +259,11 @@ public: uint32 GripOfTheLegionTimer; uint32 DoomfireTimer; uint32 SoulChargeTimer; - uint32 SoulChargeCount; + uint8 SoulChargeCount; uint32 MeleeRangeCheckTimer; uint32 HandOfDeathTimer; uint32 SummonWispTimer; - uint32 WispCount; + uint8 WispCount; uint32 EnrageTimer; uint32 CheckDistanceTimer; @@ -303,7 +304,7 @@ public: void EnterCombat(Unit* /*who*/) { me->InterruptSpell(CURRENT_CHANNELED_SPELL); - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); DoZoneInCombat(); if (instance) @@ -312,7 +313,7 @@ public: void KilledUnit(Unit* victim) { - DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); + Talk(SAY_SLAY); if (victim && (victim->GetTypeId() == TYPEID_PLAYER)) GainSoulCharge(CAST_PLR(victim)); @@ -346,7 +347,7 @@ public: void JustDied(Unit* killer) { hyjal_trashAI::JustDied(killer); - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(DATA_ARCHIMONDEEVENT, DONE); @@ -488,7 +489,7 @@ public: { if (!IsChanneling) { - Creature* temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 1200000); + Creature* temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NordrassilLoc, TEMPSUMMON_TIMED_DESPAWN, 1200000); if (temp) WorldTreeGUID = temp->GetGUID(); @@ -525,14 +526,14 @@ public: me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); Enraged = true; - DoScriptText(SAY_ENRAGE, me); + Talk(SAY_ENRAGE); } } else EnrageTimer -= diff; if (CheckDistanceTimer <= diff) { // To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature - Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000); + Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NordrassilLoc, TEMPSUMMON_TIMED_DESPAWN, 2000); if (Check) { Check->SetVisible(false); @@ -542,7 +543,7 @@ public: me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); Enraged = true; - DoScriptText(SAY_ENRAGE, me); + Talk(SAY_ENRAGE); } } CheckDistanceTimer = 5000; @@ -598,11 +599,7 @@ public: if (AirBurstTimer <= diff) { - if (urand(0, 1)) - DoScriptText(SAY_AIR_BURST1, me); - else - DoScriptText(SAY_AIR_BURST2, me); - + Talk(SAY_AIR_BURST); DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank AirBurstTimer = urand(25000, 40000); } else AirBurstTimer -= diff; @@ -615,11 +612,7 @@ public: if (DoomfireTimer <= diff) { - if (urand(0, 1)) - DoScriptText(SAY_DOOMFIRE1, me); - else - DoScriptText(SAY_DOOMFIRE2, me); - + Talk(SAY_DOOMFIRE); Unit* temp = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!temp) temp = me->getVictim(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index a9e0c866ab9..bfdaed35dd4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -15,33 +15,31 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "hyjal.h" #include "hyjal_trash.h" -#define SPELL_RAIN_OF_FIRE 31340 -#define SPELL_DOOM 31347 -#define SPELL_HOWL_OF_AZGALOR 31344 -#define SPELL_CLEAVE 31345 -#define SPELL_BERSERK 26662 - -#define SAY_ONDEATH "Your time is almost... up" -#define SOUND_ONDEATH 11002 - -#define SAY_ONSLAY1 "Reesh, hokta!" -#define SAY_ONSLAY2 "Don't fight it" -#define SAY_ONSLAY3 "No one is going to save you" -#define SOUND_ONSLAY1 11001 -#define SOUND_ONSLAY2 11048 -#define SOUND_ONSLAY3 11047 - -#define SAY_DOOM1 "Just a taste... of what awaits you" -#define SAY_DOOM2 "Suffer you despicable insect!" -#define SOUND_DOOM1 11046 -#define SOUND_DOOM2 11000 +enum Spells +{ + SPELL_RAIN_OF_FIRE = 31340, + SPELL_DOOM = 31347, + SPELL_HOWL_OF_AZGALOR = 31344, + SPELL_CLEAVE = 31345, + SPELL_BERSERK = 26662, + + SPELL_THRASH = 12787, + SPELL_CRIPPLE = 31406, + SPELL_WARSTOMP = 31408, +}; -#define SAY_ONAGGRO "Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!" -#define SOUND_ONAGGRO 10999 +enum Texts +{ + SAY_ONDEATH = 0, + SAY_ONSLAY = 1, + SAY_DOOM = 2, // Not used? + SAY_ONAGGRO = 3, +}; class boss_azgalor : public CreatureScript { @@ -88,27 +86,12 @@ public: { if (instance && IsEvent) instance->SetData(DATA_AZGALOREVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); + Talk(SAY_ONAGGRO); } void KilledUnit(Unit* /*victim*/) { - switch (urand(0, 2)) - { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_ONSLAY); } void WaypointReached(uint32 waypointId) @@ -126,7 +109,7 @@ public: hyjal_trashAI::JustDied(killer); if (instance && IsEvent) instance->SetData(DATA_AZGALOREVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); + Talk(SAY_ONDEATH); } void UpdateAI(const uint32 diff) @@ -196,10 +179,6 @@ public: }; -#define SPELL_THRASH 12787 -#define SPELL_CRIPPLE 31406 -#define SPELL_WARSTOMP 31408 - class mob_lesser_doomguard : public CreatureScript { public: diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 9160983b0df..29eff68dfbd 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -30,22 +30,17 @@ enum Spells SPELL_MARK_DAMAGE = 31463 }; -#define SOUND_ONDEATH 11018 - -#define SAY_ONSLAY1 "Shaza-Kiel!" -#define SAY_ONSLAY2 "You... are nothing!" -#define SAY_ONSLAY3 "Miserable nuisance!" -#define SOUND_ONSLAY1 11017 -#define SOUND_ONSLAY2 11053 -#define SOUND_ONSLAY3 11054 - -#define SAY_MARK1 "Your death will be a painful one." -#define SAY_MARK2 "You... are marked." -#define SOUND_MARK1 11016 -#define SOUND_MARK2 11052 +enum Texts +{ + SAY_ONSLAY = 0, + SAY_MARK = 1, + SAY_ONAGGRO = 2, +}; -#define SAY_ONAGGRO "Cry for mercy! Your meaningless lives will soon be forfeit." -#define SOUND_ONAGGRO 11015 +enum Sounds +{ + SOUND_ONDEATH = 11018, +}; class boss_kazrogal : public CreatureScript { @@ -87,27 +82,12 @@ public: { if (instance && IsEvent) instance->SetData(DATA_KAZROGALEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); + Talk(SAY_ONAGGRO); } void KilledUnit(Unit* /*victim*/) { - switch (urand(0, 2)) - { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_ONSLAY); } void WaypointReached(uint32 waypointId) @@ -177,17 +157,7 @@ public: if (MarkTimerBase < 5500) MarkTimerBase = 5500; MarkTimer = MarkTimerBase; - switch (urand(0, 2)) - { - case 0: - DoPlaySoundToSet(me, SOUND_MARK1); - me->MonsterYell(SAY_MARK1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_MARK2); - me->MonsterYell(SAY_MARK2, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_MARK); } else MarkTimer -= diff; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp index 5d7ee1fe194..09c8c1605b3 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp @@ -15,36 +15,27 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "hyjal.h" #include "hyjal_trash.h" -#define SPELL_FROST_ARMOR 31256 -#define SPELL_DEATH_AND_DECAY 31258 - -#define SPELL_FROST_NOVA 31250 -#define SPELL_ICEBOLT 31249 - -#define SAY_ONDEATH "You have won this battle, but not... the... war" -#define SOUND_ONDEATH 11026 - -#define SAY_ONSLAY1 "All life must perish!" -#define SAY_ONSLAY2 "Victory to the Legion!" -#define SOUND_ONSLAY1 11025 -#define SOUND_ONSLAY2 11057 - -#define SAY_DECAY1 "Crumble and rot!" -#define SAY_DECAY2 "Ashes to ashes, dust to dust" -#define SOUND_DECAY1 11023 -#define SOUND_DECAY2 11055 - -#define SAY_NOVA1 "Succumb to the icy chill... of death!" -#define SAY_NOVA2 "It will be much colder in your grave" -#define SOUND_NOVA1 11024 -#define SOUND_NOVA2 11058 +enum Spells +{ + SPELL_FROST_ARMOR = 31256, + SPELL_DEATH_AND_DECAY = 31258, + SPELL_FROST_NOVA = 31250, + SPELL_ICEBOLT = 31249, +}; -#define SAY_ONAGGRO "The Legion's final conquest has begun! Once again the subjugation of this world is within our grasp. Let none survive!" -#define SOUND_ONAGGRO 11022 +enum Texts +{ + SAY_ONDEATH = 0, + SAY_ONSLAY = 1, + SAY_DECAY = 2, + SAY_NOVA = 3, + SAY_ONAGGRO = 4, +}; class boss_rage_winterchill : public CreatureScript { @@ -86,23 +77,12 @@ public: { if (instance && IsEvent) instance->SetData(DATA_RAGEWINTERCHILLEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); + Talk(SAY_ONAGGRO); } void KilledUnit(Unit* /*victim*/) { - switch (urand(0, 1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_ONSLAY); } void WaypointReached(uint32 waypointId) @@ -120,8 +100,7 @@ public: hyjal_trashAI::JustDied(killer); if (instance && IsEvent) instance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0); + Talk(SAY_ONDEATH); } void UpdateAI(const uint32 diff) @@ -162,33 +141,13 @@ public: { DoCast(me->getVictim(), SPELL_DEATH_AND_DECAY); DecayTimer = 60000+rand()%20000; - switch (urand(0, 1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_DECAY1); - me->MonsterYell(SAY_DECAY1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_DECAY2); - me->MonsterYell(SAY_DECAY2, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_DECAY); } else DecayTimer -= diff; if (NovaTimer <= diff) { DoCast(me->getVictim(), SPELL_FROST_NOVA); NovaTimer = 30000+rand()%15000; - switch (urand(0, 1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_NOVA1); - me->MonsterYell(SAY_NOVA1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_NOVA2); - me->MonsterYell(SAY_NOVA2, LANG_UNIVERSAL, 0); - break; - } + Talk(SAY_NOVA); } else NovaTimer -= diff; if (IceboltTimer <= diff) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 22307468f14..1be8f8e058f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -29,7 +29,9 @@ npc_thrall npc_tyrande_whisperwind EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "hyjalAI.h" #define GOSSIP_ITEM_BEGIN_ALLY "My companions and I are with you, Lady Proudmoore." diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h index e045d3cbf05..6d62072608d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h @@ -21,7 +21,7 @@ #define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy." -enum eTypes +enum Types { WORLD_STATE_WAVES = 2842, WORLD_STATE_ENEMY = 2453, diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 2f6bbb7edb5..cdac1b18649 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -23,17 +23,21 @@ SDComment: SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedEscortAI.h" +#include "GridNotifiers.h" +#include "Cell.h" +#include "CellImpl.h" #include "hyjalAI.h" #include "hyjal_trash.h" -#include "MapManager.h" -#include "Language.h" -#include "Chat.h" -#include "Object.h" - -#define SPAWN_GARG_GATE 0 -#define SPAWN_WYRM_GATE 1 -#define SPAWN_NEAR_TOWER 2 + +enum Spawns +{ + SPAWN_GARG_GATE = 0, + SPAWN_WYRM_GATE = 1, + SPAWN_NEAR_TOWER = 2, +}; #define YELL_HURRY "Hurry, we don't have much time" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h index b32288ca43a..68efa94d98b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h @@ -24,43 +24,49 @@ #define HYJAL_AI_MAX_SPELLS 3 -// Trash Mobs summoned in waves -#define NECROMANCER 17899//done -#define ABOMINATION 17898//done -#define GHOUL 17895//done -#define BANSHEE 17905//done -#define CRYPT_FIEND 17897//done -#define GARGOYLE 17906//done -#define FROST_WYRM 17907//done -#define GIANT_INFERNAL 17908//done -#define FEL_STALKER 17916//done - -#define JAINA 17772 -#define THRALL 17852 -#define TYRANDE 17948 - -#define ANCIENT_VEIN 185557 -#define FLAMEOBJECT 182592 - -// Bosses summoned after every 8 waves -#define RAGE_WINTERCHILL 17767 -#define ANETHERON 17808 -#define KAZROGAL 17888 -#define AZGALOR 17842 -#define ARCHIMONDE 17968 - -#define SPELL_TELEPORT_VISUAL 41232 -#define SPELL_MASS_TELEPORT 16807 - -//Spells for Jaina -#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon(it should, but is removed in evade..) -#define SPELL_BLIZZARD 31266 -#define SPELL_PYROBLAST 31263 -#define SPELL_SUMMON_ELEMENTALS 31264 - -//Thrall spells -#define SPELL_CHAIN_LIGHTNING 31330 -#define SPELL_SUMMON_DIRE_WOLF 31331 +enum CreaturesIds +{ + // Trash Mobs summoned in waves + NECROMANCER = 17899, + ABOMINATION = 17898, + GHOUL = 17895, + BANSHEE = 17905, + CRYPT_FIEND = 17897, + GARGOYLE = 17906, + FROST_WYRM = 17907, + GIANT_INFERNAL = 17908, + FEL_STALKER = 17916, + + JAINA = 17772, + THRALL = 17852, + TYRANDE = 17948, + + ANCIENT_VEIN = 185557, + FLAMEOBJECT = 182592, + + // Bosses summoned after every 8 waves + RAGE_WINTERCHILL = 17767, + ANETHERON = 17808, + KAZROGAL = 17888, + AZGALOR = 17842, + ARCHIMONDE = 17968, +}; + +enum SpellIds +{ + SPELL_TELEPORT_VISUAL = 41232, + SPELL_MASS_TELEPORT = 16807, + + //Spells for Jaina + SPELL_BRILLIANCE_AURA = 31260, // The database must handle this spell via creature_addon(it should, but is removed in evade..) + SPELL_BLIZZARD = 31266, + SPELL_PYROBLAST = 31263, + SPELL_SUMMON_ELEMENTALS = 31264, + + //Thrall spells + SPELL_CHAIN_LIGHTNING = 31330, + SPELL_SUMMON_DIRE_WOLF = 31331, +}; struct Wave { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 840aa5de081..d3218e1729e 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -15,16 +15,35 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "hyjal.h" #include "hyjal_trash.h" #include "hyjalAI.h" -#define SPELL_METEOR 33814 //infernal visual -#define SPELL_IMMOLATION 37059 -#define SPELL_FLAME_BUFFET 31724 -#define NPC_TRIGGER 21987 //World Trigger (Tiny) -#define MODEL_INVIS 11686 //invisible model +enum Spells +{ + SPELL_METEOR = 33814, //infernal visual + SPELL_IMMOLATION = 37059, + SPELL_FLAME_BUFFET = 31724, + NPC_TRIGGER = 21987, //World Trigger (Tiny) + MODEL_INVIS = 11686, //invisible model + SPELL_DISEASE_CLOUD = 31607, + SPELL_KNOCKDOWN = 31610, + SPELL_FRENZY = 31540, + SPELL_RAISE_DEAD_1 = 31617, + SPELL_RAISE_DEAD_2 = 31624, + SPELL_RAISE_DEAD_3 = 31625, + SPELL_SHADOW_BOLT = 31627, + SPELL_BANSHEE_CURSE = 31651, + SPELL_BANSHEE_WAIL = 38183, + SPELL_ANTI_MAGIC_SHELL = 31662, + SPELL_WEB = 28991, + SPELL_MANA_BURN = 31729, + SPELL_FROST_BREATH = 31688, + SPELL_GARGOYLE_STRIKE = 31664, + SPELL_EXPLODING_SHOT = 7896, +}; float HordeWPs[8][3]=//basic waypoints from spawn to leader { @@ -522,9 +541,6 @@ public: } }; -#define SPELL_DISEASE_CLOUD 31607 -#define SPELL_KNOCKDOWN 31610 - class mob_abomination : public CreatureScript { public: @@ -623,8 +639,6 @@ public: }; -#define SPELL_FRENZY 31540 - class mob_ghoul : public CreatureScript { public: @@ -727,11 +741,6 @@ public: }; -#define SPELL_RAISE_DEAD_1 31617 -#define SPELL_RAISE_DEAD_2 31624 -#define SPELL_RAISE_DEAD_3 31625 -#define SPELL_SHADOW_BOLT 31627 - class mob_necromancer : public CreatureScript { public: @@ -859,10 +868,6 @@ public: }; -#define SPELL_BANSHEE_CURSE 31651 -#define SPELL_BANSHEE_WAIL 38183 -#define SPELL_ANTI_MAGIC_SHELL 31662 - class mob_banshee : public CreatureScript { public: @@ -966,8 +971,6 @@ public: }; -#define SPELL_WEB 28991 - class mob_crypt_fiend : public CreatureScript { public: @@ -1058,8 +1061,6 @@ public: }; -#define SPELL_MANA_BURN 31729 - class mob_fel_stalker : public CreatureScript { public: @@ -1150,8 +1151,6 @@ public: }; -#define SPELL_FROST_BREATH 31688 - class mob_frost_wyrm : public CreatureScript { public: @@ -1264,8 +1263,6 @@ public: }; -#define SPELL_GARGOYLE_STRIKE 31664 - class mob_gargoyle : public CreatureScript { public: @@ -1402,8 +1399,6 @@ public: }; -#define SPELL_EXPLODING_SHOT 7896 - class alliance_rifleman : public CreatureScript { public: diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index ad8ebdb370a..69bb8285404 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -23,15 +23,16 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ -#include "ScriptPCH.h" -#include "hyjal.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ScriptedCreature.h" #include "hyjal_trash.h" -enum eEnums +enum Misc { MAX_ENCOUNTER = 5, - GO_ANCIENT_GEM = 185557 + GO_ANCIENT_GEM = 185557, }; /* Battle of Mount Hyjal encounters: 0 - Rage Winterchill event -- cgit v1.2.3 From 2bee0e6e37e94faea1dba5ba0ec7348ce32842cb Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 1 Jul 2012 21:05:53 +0200 Subject: Core/SpellScript: Corrected when OnObjectAreaTargetSelect hooks are called (must be before splitting unit/go targets) --- src/server/game/Spells/Spell.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 33ecd66e8f6..2c1cff0c74a 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1205,6 +1205,9 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge default: break; } + + CallScriptObjectAreaTargetSelectHandlers(targets, effIndex); + std::list unitTargets; std::list gObjTargets; // for compability with older code - add only unit and go targets @@ -1217,8 +1220,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge gObjTargets.push_back(gObjTarget); } - CallScriptObjectAreaTargetSelectHandlers(targets, effIndex); - if (!unitTargets.empty()) { // Special target selection for smart heals and energizes @@ -1562,15 +1563,15 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg SearchChainTargets(targets, maxTargets - 1, target, targetType.GetObjectType(), targetType.GetCheckType() , m_spellInfo->Effects[effIndex].ImplicitTargetConditions, targetType.GetTarget() == TARGET_UNIT_TARGET_CHAINHEAL_ALLY); + // Chain primary target is added earlier + CallScriptObjectAreaTargetSelectHandlers(targets, effIndex); + // for backward compability std::list unitTargets; for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) if (Unit* unitTarget = (*itr)->ToUnit()) unitTargets.push_back(unitTarget); - // Chain primary target is added earlier - CallScriptObjectAreaTargetSelectHandlers(targets, effIndex); - for (std::list::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr) AddUnitTarget(*itr, effMask, false); } -- cgit v1.2.3 From 16d4cc7e0b6431efccf0bdc7973e7d3e3c8e705f Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 1 Jul 2012 16:18:11 -0500 Subject: Fixed build --- src/server/scripts/Commands/cs_reset.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index deb8f710b11..88d648773eb 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" +#include "ObjectAccessor.h" class reset_commandscript : public CommandScript { -- cgit v1.2.3 From f34bbf520ee70497af754e50330fe5057a1e0360 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 1 Jul 2012 16:36:12 -0500 Subject: Core/Scripts: More missing includes --- .../scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index cdac1b18649..a407f86ba70 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "Cell.h" #include "CellImpl.h" #include "hyjalAI.h" -- cgit v1.2.3 From 8eba4aebfb56bf86a74fc9841af75359b9cf2346 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 1 Jul 2012 18:29:59 -0500 Subject: Core/Units: Removed deprecated code --- src/server/game/Entities/Unit/Unit.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 07b2b9d2260..73d28fe2fa9 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -527,13 +527,7 @@ void Unit::DealDamageMods(Unit* victim, uint32 &damage, uint32* absorb) if (absorb) *absorb += damage; damage = 0; - return; } - - uint32 originalDamage = damage; - - if (absorb && originalDamage > damage) - *absorb += (originalDamage - damage); } uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss) -- cgit v1.2.3 From 7f960fed732f119b6776bc51a4465e8e7a1a10dd Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 2 Jul 2012 10:09:41 -0400 Subject: Core/Spells: fix damage bonus calculations for sanctified wrath talent. --- src/server/game/Entities/Unit/Unit.cpp | 50 ++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 73d28fe2fa9..157b60e2d99 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10676,6 +10676,15 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui int32 TakenTotal = 0; float TakenTotalMod = 1.0f; + float TakenTotalCasterMod = 0.0f; + + // get all auras from caster that allow the spell to ignore resistance (sanctified wrath) + AuraEffectList const& IgnoreResistAuras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) + { + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + TakenTotalCasterMod += ((*i)->GetBaseAmount()/100); + } // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) @@ -10740,7 +10749,21 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod); } - float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod; + float tmpDamage = 0.0f; + + if (TakenTotalCasterMod) + { + if (TakenTotal < 0) + if (TakenTotalMod < 1) + tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod)); + else + tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod); + else + if (TakenTotalMod < 1) + tmpDamage = ((CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod)); + } + if (!tmpDamage) + tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod; return uint32(std::max(tmpDamage, 0.0f)); } @@ -11692,6 +11715,15 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT return 0; int32 TakenFlatBenefit = 0; + float TakenTotalCasterMod = 0.0f; + + // get all auras from caster that allow the spell to ignore resistance (sanctified wrath) + AuraEffectList const& IgnoreResistAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) + { + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + TakenTotalCasterMod += ((*i)->GetBaseAmount()/100); + } // ..taken AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); @@ -11776,7 +11808,21 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT AddPctN(TakenTotalMod, (*i)->GetAmount()); } - float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod; + float tmpDamage = 0.0f; + + if (TakenTotalCasterMod) + { + if (TakenFlatBenefit < 0) + if (TakenTotalMod < 1) + tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod)); + else + tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod); + else + if (TakenTotalMod < 1) + tmpDamage = ((CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod)); + } + if (!tmpDamage) + tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod; // bonus result can be negative return uint32(std::max(tmpDamage, 0.0f)); -- cgit v1.2.3 From 93cec76cdbeac769dfd51026a3e6bfc9640303c8 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 2 Jul 2012 11:33:12 -0400 Subject: Core/Spells: small change for previous commit. fixes typos --- src/server/game/Entities/Unit/Unit.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 157b60e2d99..83d7865f34b 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10683,7 +10683,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) { if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) - TakenTotalCasterMod += ((*i)->GetBaseAmount()/100); + TakenTotalCasterMod += (float((*i)->GetAmount())/100); } // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN @@ -10754,13 +10754,14 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui if (TakenTotalCasterMod) { if (TakenTotal < 0) + { if (TakenTotalMod < 1) tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod)); else tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod); - else - if (TakenTotalMod < 1) - tmpDamage = ((CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod)); + } + else if (TakenTotalMod < 1) + tmpDamage = ((CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod)); } if (!tmpDamage) tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod; @@ -11722,7 +11723,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) { if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) - TakenTotalCasterMod += ((*i)->GetBaseAmount()/100); + TakenTotalCasterMod += (float((*i)->GetAmount())/100); } // ..taken @@ -11813,13 +11814,14 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT if (TakenTotalCasterMod) { if (TakenFlatBenefit < 0) + { if (TakenTotalMod < 1) tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod)); else tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod); - else - if (TakenTotalMod < 1) - tmpDamage = ((CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod)); + } + else if (TakenTotalMod < 1) + tmpDamage = ((CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod)); } if (!tmpDamage) tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod; -- cgit v1.2.3 From f454b6722ca0d4be7c8a35730aa325d9404f0b72 Mon Sep 17 00:00:00 2001 From: Discover- Date: Mon, 2 Jul 2012 17:33:17 +0200 Subject: Core/Battlegrounds: Don't reward killing blows if the killer is also the victim. Reason could be stuff like warlock's Hellfire spell or fall damage. --- src/server/game/Battlegrounds/Battleground.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 85bbd2f3b89..8b072bb32e4 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1769,12 +1769,16 @@ void Battleground::HandleTriggerBuff(uint64 go_guid) SpawnBGObject(index, BUFF_RESPAWN_TIME); } -void Battleground::HandleKillPlayer(Player* player, Player* killer) +void Battleground::HandleKillPlayer(Player* victim, Player* killer) { // Keep in mind that for arena this will have to be changed a bit + // Don't reward credit for killing ourselves, like fall damage of hellfire (warlock) + if (victim && killer && killer == victim) + return; + // Add +1 deaths - UpdatePlayerScore(player, SCORE_DEATHS, 1); + UpdatePlayerScore(victim, SCORE_DEATHS, 1); // Add +1 kills to group and +1 killing_blows to killer if (killer) { @@ -1787,7 +1791,7 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer) if (!creditedPlayer || creditedPlayer == killer) continue; - if (creditedPlayer->GetTeam() == killer->GetTeam() && creditedPlayer->IsAtGroupRewardDistance(player)) + if (creditedPlayer->GetTeam() == killer->GetTeam() && creditedPlayer->IsAtGroupRewardDistance(victim)) UpdatePlayerScore(creditedPlayer, SCORE_HONORABLE_KILLS, 1); } } @@ -1795,8 +1799,8 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer) if (!isArena()) { // To be able to remove insignia -- ONLY IN Battlegrounds - player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - RewardXPAtKill(killer, player); + victim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + RewardXPAtKill(killer, victim); } } -- cgit v1.2.3 From a73ad7170ea573bdc8b0cb29d33a4a0f2323dfdc Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 2 Jul 2012 11:42:11 -0400 Subject: Core/Battleground: move check from f454b6722ca0d4be7c8a35730aa325d9404f0b72 to correct location. --- src/server/game/Battlegrounds/Battleground.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 8b072bb32e4..456915d1ca4 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1773,15 +1773,15 @@ void Battleground::HandleKillPlayer(Player* victim, Player* killer) { // Keep in mind that for arena this will have to be changed a bit - // Don't reward credit for killing ourselves, like fall damage of hellfire (warlock) - if (victim && killer && killer == victim) - return; - // Add +1 deaths UpdatePlayerScore(victim, SCORE_DEATHS, 1); // Add +1 kills to group and +1 killing_blows to killer if (killer) { + // Don't reward credit for killing ourselves, like fall damage of hellfire (warlock) + if (killer == victim) + return; + UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1); UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1); -- cgit v1.2.3 From 72fd2036881db11e47f1a4ce6d071dc7f2bb9971 Mon Sep 17 00:00:00 2001 From: LordJZ Date: Mon, 2 Jul 2012 20:35:28 +0400 Subject: Fixed CHAR_SEL_PETITION_SIG_BY_GUID_TYPE. --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 33a138a5fbd..c38ceb6f57a 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -20560,7 +20560,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) else { stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_GUID_TYPE); - stmt->setUInt8(0, uint8(type)); + stmt->setUInt8(1, uint8(type)); } stmt->setUInt32(0, GUID_LOPART(guid)); -- cgit v1.2.3 From c49bc934b820c0e634f0231158ec444275f6fa3e Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 2 Jul 2012 15:00:16 -0400 Subject: Core/Spells: correctly get magnet target. (subv fixed it) Closes #6674 --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 83d7865f34b..fc1e4398e17 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10034,7 +10034,7 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo) Unit::AuraEffectList const& magnetAuras = victim->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET); for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) { - if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner()) + if (Unit* magnet = (*itr)->GetBase()->GetCaster()) if (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK && spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK && _IsValidAttackTarget(magnet, spellInfo) -- cgit v1.2.3 From f8374fac0b7c4bb963d7f4c64c200a879bc37c0f Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 2 Jul 2012 21:56:17 +0200 Subject: Core/Commands: Convert guild commands in commandscript --- src/server/game/Chat/Chat.cpp | 11 -- src/server/game/Chat/Chat.h | 6 - src/server/game/Chat/Commands/Level3.cpp | 139 -------------------- src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Commands/CMakeLists.txt | 2 +- src/server/scripts/Commands/cs_guild.cpp | 199 +++++++++++++++++++++++++++++ 6 files changed, 202 insertions(+), 157 deletions(-) create mode 100644 src/server/scripts/Commands/cs_guild.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 7a146e89505..8bc2cc34dae 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -112,16 +112,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand guildCommandTable[] = - { - { "create", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildCreateCommand>, "", NULL }, - { "delete", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildDeleteCommand>, "", NULL }, - { "invite", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildInviteCommand>, "", NULL }, - { "uninvite", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildUninviteCommand>, "", NULL }, - { "rank", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildRankCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand lookupPlayerCommandTable[] = { { "ip", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerIpCommand>, "", NULL }, @@ -215,7 +205,6 @@ ChatCommand* ChatHandler::getCommandTable() { { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, - { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index bbe138b923d..96ac593d744 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -157,12 +157,6 @@ class ChatHandler bool HandleBindSightCommand(const char* args); bool HandleUnbindSightCommand(const char* args); - bool HandleGuildCreateCommand(const char* args); - bool HandleGuildInviteCommand(const char* args); - bool HandleGuildUninviteCommand(const char* args); - bool HandleGuildRankCommand(const char* args); - bool HandleGuildDeleteCommand(const char* args); - bool HandleLookupAreaCommand(const char* args); bool HandleLookupCreatureCommand(const char* args); bool HandleLookupEventCommand(const char* args); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index e6419bf4e1e..a3701acc548 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -1300,145 +1300,6 @@ bool ChatHandler::HandleLookupMapCommand(const char *args) return true; } -/** \brief GM command level 3 - Create a guild. - * - * This command allows a GM (level 3) to create a guild. - * - * The "args" parameter contains the name of the guild leader - * and then the name of the guild. - * - */ -bool ChatHandler::HandleGuildCreateCommand(const char *args) -{ - if (!*args) - return false; - - // if not guild name only (in "") then player name - Player* target; - if (!extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target)) - return false; - - char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; - if (!tailStr) - return false; - - char* guildStr = extractQuotedArg(tailStr); - if (!guildStr) - return false; - - std::string guildname = guildStr; - - if (target->GetGuildId()) - { - SendSysMessage(LANG_PLAYER_IN_GUILD); - return true; - } - - Guild* guild = new Guild; - if (!guild->Create(target, guildname)) - { - delete guild; - SendSysMessage(LANG_GUILD_NOT_CREATED); - SetSentErrorMessage(true); - return false; - } - - sGuildMgr->AddGuild(guild); - return true; -} - -bool ChatHandler::HandleGuildInviteCommand(const char *args) -{ - if (!*args) - return false; - - // if not guild name only (in "") then player name - uint64 target_guid; - if (!extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &target_guid)) - return false; - - char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; - if (!tailStr) - return false; - - char* guildStr = extractQuotedArg(tailStr); - if (!guildStr) - return false; - - std::string glName = guildStr; - Guild* targetGuild = sGuildMgr->GetGuildByName(glName); - if (!targetGuild) - return false; - - // player's guild membership checked in AddMember before add - return targetGuild->AddMember(target_guid); -} - -bool ChatHandler::HandleGuildUninviteCommand(const char *args) -{ - Player* target; - uint64 target_guid; - if (!extractPlayerTarget((char*)args, &target, &target_guid)) - return false; - - uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(target_guid); - if (!glId) - return false; - - Guild* targetGuild = sGuildMgr->GetGuildById(glId); - if (!targetGuild) - return false; - - targetGuild->DeleteMember(target_guid, false, true); - return true; -} - -bool ChatHandler::HandleGuildRankCommand(const char *args) -{ - char* nameStr; - char* rankStr; - extractOptFirstArg((char*)args, &nameStr, &rankStr); - if (!rankStr) - return false; - - Player* target; - uint64 target_guid; - std::string target_name; - if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) - return false; - - uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(target_guid); - if (!glId) - return false; - - Guild* targetGuild = sGuildMgr->GetGuildById (glId); - if (!targetGuild) - return false; - - uint32 newrank = uint32 (atoi (rankStr)); - return targetGuild->ChangeMemberRank(target_guid, newrank); -} - -bool ChatHandler::HandleGuildDeleteCommand(const char *args) -{ - if (!*args) - return false; - - char* guildStr = extractQuotedArg((char*)args); - if (!guildStr) - return false; - - std::string gld = guildStr; - - Guild* targetGuild = sGuildMgr->GetGuildByName(gld); - if (!targetGuild) - return false; - - targetGuild->Disband(); - - return true; -} - bool ChatHandler::HandleGetDistanceCommand(const char *args) { WorldObject* obj = NULL; diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 58b9c55cdd1..df318a8ef42 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -52,6 +52,7 @@ void AddSC_event_commandscript(); void AddSC_gm_commandscript(); void AddSC_go_commandscript(); void AddSC_gobject_commandscript(); +void AddSC_guild_commandscript(); void AddSC_honor_commandscript(); void AddSC_instance_commandscript(); void AddSC_learn_commandscript(); @@ -660,6 +661,7 @@ void AddCommandScripts() AddSC_gm_commandscript(); AddSC_go_commandscript(); AddSC_gobject_commandscript(); + AddSC_guild_commandscript(); AddSC_honor_commandscript(); AddSC_instance_commandscript(); AddSC_learn_commandscript(); diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index c27b51a1ca2..b0ea8dc986d 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -19,6 +19,7 @@ set(scripts_STAT_SRCS Commands/cs_gm.cpp Commands/cs_go.cpp Commands/cs_gobject.cpp + Commands/cs_guild.cpp Commands/cs_honor.cpp Commands/cs_instance.cpp Commands/cs_learn.cpp @@ -35,7 +36,6 @@ set(scripts_STAT_SRCS Commands/cs_wp.cpp # Commands/cs_lookup.cpp # Commands/cs_pdump.cpp -# Commands/cs_guild.cpp # Commands/cs_channel.cpp # Commands/cs_pet.cpp # Commands/cs_ticket.cpp diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp new file mode 100644 index 00000000000..65e3daaaebc --- /dev/null +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: guild_commandscript +%Complete: 100 +Comment: All guild related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "Guild.h" +#include "GuildMgr.h" +#include "ObjectAccessor.h" + +class guild_commandscript : public CommandScript +{ +public: + guild_commandscript() : CommandScript("guild_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand guildCommandTable[] = + { + { "create", SEC_GAMEMASTER, true, &HandleGuildCreateCommand, "", NULL }, + { "delete", SEC_GAMEMASTER, true, &HandleGuildDeleteCommand, "", NULL }, + { "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "", NULL }, + { "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "", NULL }, + { "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + /** \brief GM command level 3 - Create a guild. + * + * This command allows a GM (level 3) to create a guild. + * + * The "args" parameter contains the name of the guild leader + * and then the name of the guild. + * + */ + static bool HandleGuildCreateCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // if not guild name only (in "") then player name + Player* target; + if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target)) + return false; + + char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; + if (!tailStr) + return false; + + char* guildStr = handler->extractQuotedArg(tailStr); + if (!guildStr) + return false; + + std::string guildName = guildStr; + + if (target->GetGuildId()) + { + handler->SendSysMessage(LANG_PLAYER_IN_GUILD); + return true; + } + + Guild* guild = new Guild; + if (!guild->Create(target, guildName)) + { + delete guild; + handler->SendSysMessage(LANG_GUILD_NOT_CREATED); + handler->SetSentErrorMessage(true); + return false; + } + + sGuildMgr->AddGuild(guild); + + return true; + } + + static bool HandleGuildDeleteCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* guildStr = handler->extractQuotedArg((char*)args); + if (!guildStr) + return false; + + std::string guildName = guildStr; + + Guild* targetGuild = sGuildMgr->GetGuildByName(guildName); + if (!targetGuild) + return false; + + targetGuild->Disband(); + + return true; + } + + static bool HandleGuildInviteCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // if not guild name only (in "") then player name + uint64 targetGuid; + if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid)) + return false; + + char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; + if (!tailStr) + return false; + + char* guildStr = handler->extractQuotedArg(tailStr); + if (!guildStr) + return false; + + std::string guildName = guildStr; + Guild* targetGuild = sGuildMgr->GetGuildByName(guildName); + if (!targetGuild) + return false; + + // player's guild membership checked in AddMember before add + return targetGuild->AddMember(targetGuid); + } + + static bool HandleGuildUninviteCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) + return false; + + uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid); + if (!guildId) + return false; + + Guild* targetGuild = sGuildMgr->GetGuildById(guildId); + if (!targetGuild) + return false; + + targetGuild->DeleteMember(targetGuid, false, true); + return true; + } + + static bool HandleGuildRankCommand(ChatHandler* handler, char const* args) + { + char* nameStr; + char* rankStr; + handler->extractOptFirstArg((char*)args, &nameStr, &rankStr); + if (!rankStr) + return false; + + Player* target; + uint64 targetGuid; + std::string target_name; + if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name)) + return false; + + uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid); + if (!guildId) + return false; + + Guild* targetGuild = sGuildMgr->GetGuildById(guildId); + if (!targetGuild) + return false; + + uint8 newRank = uint8(atoi(rankStr)); + return targetGuild->ChangeMemberRank(targetGuid, newRank); + } +}; + +void AddSC_guild_commandscript() +{ + new guild_commandscript(); +} -- cgit v1.2.3 From 1292b732f7dba2d189cf4b447d219c9bedf9448c Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 2 Jul 2012 16:41:25 -0500 Subject: Core/Spells: Fixed Evasive Maneuvers and Stop Time, spells from the Oculus drakes. Closes #6670 Closes #6675 --- .../2012_07_02_04_world_spell_script_names.sql | 3 ++ src/server/game/Entities/Unit/Unit.cpp | 8 +++++ src/server/game/Spells/SpellInfo.cpp | 1 + .../scripts/Northrend/Nexus/Oculus/oculus.cpp | 36 +++++++++++++++++++++- 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2012_07_02_04_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_07_02_04_world_spell_script_names.sql b/sql/updates/world/2012_07_02_04_world_spell_script_names.sql new file mode 100644 index 00000000000..9054ea7ba82 --- /dev/null +++ b/sql/updates/world/2012_07_02_04_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=49838; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(49838, "spell_gen_stop_time"); \ No newline at end of file diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index fc1e4398e17..2ab730d7f66 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8205,6 +8205,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg CastSpell(victim, 27526, true, castItem, triggeredByAura); return true; } + // Evasive Maneuvers + case 50240: + { + // Remove a Evasive Charge + Aura* charge = GetAura(50241); + if (charge->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL)) + RemoveAurasDueToSpell(50240); + } } break; case SPELLFAMILY_MAGE: diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 7995087f2c1..16584086245 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1736,6 +1736,7 @@ AuraStateType SpellInfo::GetAuraState() const switch (Id) { case 71465: // Divine Surge + case 50241: // Evasive Charges return AURA_STATE_UNKNOWN22; default: break; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 23f55a3033b..d15b3b566bc 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -47,7 +47,9 @@ enum Drakes NPC_VERDISA = 27657, NPC_BELGARISTRASZ = 27658, - NPC_ETERNOS = 27659 + NPC_ETERNOS = 27659, + + SPELL_SHOCK_CHARGE = 49836, }; enum Says @@ -210,8 +212,40 @@ public: } }; +class spell_gen_stop_time : public SpellScriptLoader +{ +public: + spell_gen_stop_time() : SpellScriptLoader("spell_gen_stop_time") { } + + class spell_gen_stop_time_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_stop_time_AuraScript); + + void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + Unit* target = GetTarget(); + for (uint32 i = 0; i < 5; ++i) + caster->CastSpell(target, SPELL_SHOCK_CHARGE, false); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_gen_stop_time_AuraScript::Apply, EFFECT_0); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_stop_time_AuraScript(); + } +}; + void AddSC_oculus() { new npc_oculus_drake(); new npc_image_belgaristrasz(); + new spell_gen_stop_time(); } -- cgit v1.2.3 From 94d935ea8f56102ff74aa7cfc3d5da37e83efa15 Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 2 Jul 2012 16:58:02 -0500 Subject: Fixed build --- src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index d15b3b566bc..0eafd7a7fea 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -233,7 +233,7 @@ public: void Register() { - AfterEffectApply += AuraEffectApplyFn(spell_gen_stop_time_AuraScript::Apply, EFFECT_0); + AfterEffectApply += AuraEffectApplyFn(spell_gen_stop_time_AuraScript::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); } }; -- cgit v1.2.3 From d28f348caf3b879d8f8dcc7d7ea01e5e893ffada Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 2 Jul 2012 18:53:14 -0500 Subject: Core/Spells: Removed some old code that was breaking Grounding Totem. Please report feedback --- src/server/game/Entities/Unit/Unit.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 2ab730d7f66..e17de57f797 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -804,11 +804,6 @@ void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo return; } - // TODO: this is a workaround and needs removal - if (!originalCaster && GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem() && IsControlledByPlayer()) - if (Unit* owner = GetOwner()) - originalCaster=owner->GetGUID(); - // TODO: this is a workaround - not needed anymore, but required for some scripts :( if (!originalCaster && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); -- cgit v1.2.3 From 96014a70cba0d333d7e76cc90cf36468a8b3b247 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 3 Jul 2012 11:45:19 +0200 Subject: Core/Units: Fixed crash added in 7f960fed732f119b6776bc51a4465e8e7a1a10dd --- src/server/game/Entities/Unit/Unit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e17de57f797..92f2f30b0ff 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11722,10 +11722,11 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT float TakenTotalCasterMod = 0.0f; // get all auras from caster that allow the spell to ignore resistance (sanctified wrath) + SpellSchoolMask attackSchoolMask = spellProto ? spellProto->GetSchoolMask() : SPELL_SCHOOL_MASK_NORMAL; AuraEffectList const& IgnoreResistAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) { - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + if ((*i)->GetMiscValue() & attackSchoolMask) TakenTotalCasterMod += (float((*i)->GetAmount())/100); } -- cgit v1.2.3 From 537caf33e9ee8d88b1c4f4835ee93ee0dd557d2a Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 3 Jul 2012 12:35:06 +0200 Subject: Core/SpellScript: Implemented OnObjectTargetSelect hook for use with spell target that selects a single object --- src/server/game/Spells/Spell.cpp | 115 +++++++++++++++++++++++---------- src/server/game/Spells/Spell.h | 1 + src/server/game/Spells/SpellScript.cpp | 15 +++++ src/server/game/Spells/SpellScript.h | 18 ++++++ 4 files changed, 115 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 2c1cff0c74a..590f880a931 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -914,17 +914,25 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa switch (targetType.GetTarget()) { case TARGET_UNIT_CHANNEL_TARGET: + { + WorldObject* target = ObjectAccessor::GetUnit(*m_caster, channeledSpell->m_targets.GetUnitTargetGUID()); + CallScriptObjectTargetSelectHandlers(target, effIndex); // unit target may be no longer avalible - teleported out of map for example - if (Unit* target = Unit::GetUnit(*m_caster, channeledSpell->m_targets.GetUnitTargetGUID())) - AddUnitTarget(target, 1 << effIndex); + if (target && target->ToUnit()) + AddUnitTarget(target->ToUnit(), 1 << effIndex); else sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); break; + } case TARGET_DEST_CHANNEL_TARGET: if (channeledSpell->m_targets.HasDst()) m_targets.SetDst(channeledSpell->m_targets); else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, channeledSpell->m_targets.GetObjectTargetGUID())) - m_targets.SetDst(*target); + { + CallScriptObjectTargetSelectHandlers(target, effIndex); + if (target) + m_targets.SetDst(*target); + } else sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); break; @@ -1002,6 +1010,8 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar return; } + CallScriptObjectTargetSelectHandlers(target, effIndex); + switch (targetType.GetObjectType()) { case TARGET_OBJECT_TYPE_UNIT: @@ -1492,27 +1502,27 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { + WorldObject* target = NULL; + bool checkIfValid = true; + switch (targetType.GetTarget()) { case TARGET_UNIT_CASTER: - AddUnitTarget(m_caster, 1 << effIndex, false); + target = m_caster; + checkIfValid = false; break; case TARGET_UNIT_MASTER: - if (Unit* owner = m_caster->GetCharmerOrOwner()) - AddUnitTarget(owner, 1 << effIndex); + target = m_caster->GetCharmerOrOwner(); break; case TARGET_UNIT_PET: - if (Guardian* pet = m_caster->GetGuardianPet()) - AddUnitTarget(pet, 1 << effIndex); + target = m_caster->GetGuardianPet(); break; case TARGET_UNIT_SUMMONER: if (m_caster->isSummon()) - if (Unit* unit = m_caster->ToTempSummon()->GetSummoner()) - AddUnitTarget(unit, 1 << effIndex); + target = m_caster->ToTempSummon()->GetSummoner(); break; case TARGET_UNIT_VEHICLE: - if (Unit *vehicle = m_caster->GetVehicleBase()) - AddUnitTarget(vehicle, 1 << effIndex); + target = m_caster->GetVehicleBase(); break; case TARGET_UNIT_PASSENGER_0: case TARGET_UNIT_PASSENGER_1: @@ -1523,26 +1533,38 @@ void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImpli case TARGET_UNIT_PASSENGER_6: case TARGET_UNIT_PASSENGER_7: if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle()) - if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0)) - AddUnitTarget(unit, 1 << effIndex); + target = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0); break; default: break; } + + CallScriptObjectTargetSelectHandlers(target, effIndex); + + if (target && target->ToUnit()) + AddUnitTarget(target->ToUnit(), 1 << effIndex, checkIfValid); } void Spell::SelectImplicitTargetObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { ASSERT((m_targets.GetObjectTarget() || m_targets.GetItemTarget()) && "Spell::SelectImplicitTargetObjectTargets - no explicit object or item target available!"); - if (Unit* unit = m_targets.GetUnitTarget()) - AddUnitTarget(unit, 1 << effIndex, true, false); - else if (GameObject* gobj = m_targets.GetGOTarget()) - AddGOTarget(gobj, 1 << effIndex); - else - AddItemTarget(m_targets.GetItemTarget(), 1 << effIndex); - if (WorldObject* target = m_targets.GetObjectTarget()) + WorldObject* target = m_targets.GetObjectTarget(); + + CallScriptObjectTargetSelectHandlers(target, effIndex); + + if (target) + { + if (Unit* unit = target->ToUnit()) + AddUnitTarget(unit, 1 << effIndex, true, false); + else if (GameObject* gobj = target->ToGameObject()) + AddGOTarget(gobj, 1 << effIndex); + SelectImplicitChainTargets(effIndex, targetType, target, 1 << effIndex); + } + // Script hook can remove object target and we would wrongly land here + else if (Item* item = m_targets.GetItemTarget()) + AddItemTarget(item, 1 << effIndex); } void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, WorldObject* target, uint32 effMask) @@ -1734,9 +1756,12 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex) case SPELL_EFFECT_SUMMON_PLAYER: if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection()) { - Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection()); - if (target) - AddUnitTarget(target, 1 << effIndex, false); + WorldObject* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection()); + + CallScriptObjectTargetSelectHandlers(target, SpellEffIndex(effIndex)); + + if (target && target->ToPlayer()) + AddUnitTarget(target->ToUnit(), 1 << effIndex, false); } return; default: @@ -1752,6 +1777,8 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex) if (!targetMask) return; + WorldObject* target = NULL; + switch (m_spellInfo->Effects[effIndex].GetImplicitTargetType()) { // add explicit object target or self to the target map @@ -1760,40 +1787,46 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex) if (targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK)) { if (Unit* unitTarget = m_targets.GetUnitTarget()) - AddUnitTarget(unitTarget, 1 << effIndex, false); + target = unitTarget; else if (targetMask & TARGET_FLAG_CORPSE_MASK) { if (Corpse* corpseTarget = m_targets.GetCorpseTarget()) { // TODO: this is a workaround - corpses should be added to spell target map too, but we can't do that so we add owner instead if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID())) - AddUnitTarget(owner, 1 << effIndex, false); + target = owner; } } else //if (targetMask & TARGET_FLAG_UNIT_MASK) - { - AddUnitTarget(m_caster, 1 << effIndex, false); - } + target = m_caster; } if (targetMask & TARGET_FLAG_ITEM_MASK) { if (Item* itemTarget = m_targets.GetItemTarget()) AddItemTarget(itemTarget, 1 << effIndex); + return; } if (targetMask & TARGET_FLAG_GAMEOBJECT_MASK) - { - if (GameObject* gObjTarget = m_targets.GetGOTarget()) - AddGOTarget(gObjTarget, 1 << effIndex); - } + target = m_targets.GetGOTarget(); break; // add self to the target map case EFFECT_IMPLICIT_TARGET_CASTER: if (targetMask & TARGET_FLAG_UNIT_MASK) - AddUnitTarget(m_caster, 1 << effIndex, false); + target = m_caster; break; default: break; } + + CallScriptObjectTargetSelectHandlers(target, SpellEffIndex(effIndex)); + + if (target) + { + if (target->ToUnit()) + AddUnitTarget(target->ToUnit(), 1 << effIndex, false); + else if (target->ToGameObject()) + AddGOTarget(target->ToGameObject(), 1 << effIndex); + } } uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList) @@ -7053,6 +7086,20 @@ void Spell::CallScriptObjectAreaTargetSelectHandlers(std::list& ta } } +void Spell::CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex) +{ + for (std::list::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) + { + (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT); + std::list::iterator hookItrEnd = (*scritr)->OnObjectTargetSelect.end(), hookItr = (*scritr)->OnObjectTargetSelect.begin(); + for (; hookItr != hookItrEnd; ++hookItr) + if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex)) + (*hookItr).Call(*scritr, target); + + (*scritr)->_FinishScriptCall(); + } +} + bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura) const { bool only_on_caster = (triggeredByAura && (triggeredByAura->AttributesEx4 & SPELL_ATTR4_PROC_ONLY_ON_CASTER)); diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 98455904cf5..1376b0fbd40 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -631,6 +631,7 @@ class Spell void CallScriptOnHitHandlers(); void CallScriptAfterHitHandlers(); void CallScriptObjectAreaTargetSelectHandlers(std::list& targets, SpellEffIndex effIndex); + void CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex); std::list m_loadedScripts; struct HitTriggerSpell diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index a19c356b9ed..d0ae6fe3098 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -267,6 +267,17 @@ void SpellScript::ObjectAreaTargetSelectHandler::Call(SpellScript* spellScript, (spellScript->*pObjectAreaTargetSelectHandlerScript)(targets); } +SpellScript::ObjectTargetSelectHandler::ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) + : TargetHook(_effIndex, _targetType, false) +{ + pObjectTargetSelectHandlerScript = _pObjectTargetSelectHandlerScript; +} + +void SpellScript::ObjectTargetSelectHandler::Call(SpellScript* spellScript, WorldObject*& target) +{ + (spellScript->*pObjectTargetSelectHandlerScript)(target); +} + bool SpellScript::_Validate(SpellInfo const* entry) { for (std::list::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr) @@ -289,6 +300,10 @@ bool SpellScript::_Validate(SpellInfo const* entry) if (!(*itr).GetAffectedEffectsMask(entry)) sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + for (std::list::iterator itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr) + if (!(*itr).GetAffectedEffectsMask(entry)) + sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + return _SpellScript::_Validate(entry); } diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 51631bb8ffe..376e7f18edc 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -132,6 +132,7 @@ enum SpellScriptHookType SPELL_SCRIPT_HOOK_HIT, SPELL_SCRIPT_HOOK_AFTER_HIT, SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT, + SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT, SPELL_SCRIPT_HOOK_CHECK_CAST, SPELL_SCRIPT_HOOK_BEFORE_CAST, SPELL_SCRIPT_HOOK_ON_CAST, @@ -155,6 +156,7 @@ class SpellScript : public _SpellScript typedef void(CLASSNAME::*SpellHitFnType)(); \ typedef void(CLASSNAME::*SpellCastFnType)(); \ typedef void(CLASSNAME::*SpellObjectAreaTargetSelectFnType)(std::list&); \ + typedef void(CLASSNAME::*SpellObjectTargetSelectFnType)(WorldObject*&); SPELLSCRIPT_FUNCTION_TYPE_DEFINES(SpellScript) @@ -216,12 +218,22 @@ class SpellScript : public _SpellScript SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript; }; + class ObjectTargetSelectHandler : public TargetHook + { + public: + ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType); + void Call(SpellScript* spellScript, WorldObject*& targets); + private: + SpellObjectTargetSelectFnType pObjectTargetSelectHandlerScript; + }; + #define SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \ class CastHandlerFunction : public SpellScript::CastHandler { public: CastHandlerFunction(SpellCastFnType _pCastHandlerScript) : SpellScript::CastHandler((SpellScript::SpellCastFnType)_pCastHandlerScript) {} }; \ class CheckCastHandlerFunction : public SpellScript::CheckCastHandler { public: CheckCastHandlerFunction(SpellCheckCastFnType _checkCastHandlerScript) : SpellScript::CheckCastHandler((SpellScript::SpellCheckCastFnType)_checkCastHandlerScript) {} }; \ class EffectHandlerFunction : public SpellScript::EffectHandler { public: EffectHandlerFunction(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : SpellScript::EffectHandler((SpellScript::SpellEffectFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \ class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) {} }; \ class ObjectAreaTargetSelectHandlerFunction : public SpellScript::ObjectAreaTargetSelectHandler { public: ObjectAreaTargetSelectHandlerFunction(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectAreaTargetSelectHandler((SpellScript::SpellObjectAreaTargetSelectFnType)_pObjectAreaTargetSelectHandlerScript, _effIndex, _targetType) {} }; \ + class ObjectTargetSelectHandlerFunction : public SpellScript::ObjectTargetSelectHandler { public: ObjectTargetSelectHandlerFunction(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectTargetSelectHandler((SpellScript::SpellObjectTargetSelectFnType)_pObjectTargetSelectHandlerScript, _effIndex, _targetType) {} }; #define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) public: @@ -280,10 +292,16 @@ class SpellScript : public _SpellScript HookList OnObjectAreaTargetSelect; #define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandlerFunction(&F, I, N) + // example: OnObjectTargetSelect += SpellObjectTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier); + // where function is void function(WorldObject*& target) + HookList OnObjectTargetSelect; + #define SpellObjectTargetSelectFn(F, I, N) ObjectTargetSelectHandlerFunction(&F, I, N) + // hooks are executed in following order, at specified event of spell: // 1. BeforeCast - executed when spell preparation is finished (when cast bar becomes full) before cast is handled // 2. OnCheckCast - allows to override result of CheckCast function // 3a. OnObjectAreaTargetSelect - executed just before adding selected targets to final target list (for area targets) + // 3b. OnObjectTargetSelect - executed just before adding selected target to final target list (for single unit targets) // 4. OnCast - executed just before spell is launched (creates missile) or executed // 5. AfterCast - executed after spell missile is launched and immediate spell actions are done // 6. OnEffectLaunch - executed just before specified effect handler call - when spell missile is launched -- cgit v1.2.3 From 577d5b4fd1c74dd8619ccc0183579d43969a0f92 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 3 Jul 2012 16:22:14 +0200 Subject: Core/SmartScript: Corrected size of pointId parameter for MOVE_TO_POS SAI action --- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 55e6a7fc446..cdb662edbaf 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -885,7 +885,7 @@ struct SmartAction struct { - uint8 pointId; + uint32 pointId; } MoveToPos; struct -- cgit v1.2.3 From 07e47b89eea849d0d583097c97c88c25e668a0cd Mon Sep 17 00:00:00 2001 From: AliveShiro Date: Wed, 4 Jul 2012 01:48:14 +0200 Subject: Fix Quest A Cleansing Song --- .../world/2012_07_04_world_spell_script_names.sql | 2 + src/server/scripts/Spells/spell_quest.cpp | 47 ++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 sql/updates/world/2012_07_04_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_07_04_world_spell_script_names.sql b/sql/updates/world/2012_07_04_world_spell_script_names.sql new file mode 100644 index 00000000000..9e157261409 --- /dev/null +++ b/sql/updates/world/2012_07_04_world_spell_script_names.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (52941, -52941); +INSERT INTO `spell_script_names` VALUES (52941, 'spell_q12735_song_of_cleansing'); \ No newline at end of file diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 66ff06decc3..e3714a22304 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1194,6 +1194,52 @@ public: } }; +enum ACleansingSong +{ + SPELL_SUMMON_SPIRIT_ATAH = 52954, + SPELL_SUMMON_SPIRIT_HAKHALAN = 52958, + SPELL_SUMMON_SPIRIT_KOOSU = 52959, + + AREA_BITTERTIDELAKE = 4385, + AREA_RIVERSHEART = 4290, + AREA_WINTERGRASPRIVER = 4388, +}; + +class spell_q12735_song_of_cleansing : public SpellScriptLoader +{ + public: + spell_q12735_song_of_cleansing() : SpellScriptLoader("spell_q12735_song_of_cleansing") { } + + class spell_q12735_song_of_cleansing_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12735_song_of_cleansing_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + + if (caster && caster->GetAreaId() == AREA_BITTERTIDELAKE) + caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_ATAH); + + else if (caster && caster->GetAreaId() == AREA_RIVERSHEART) + caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_HAKHALAN); + + else if (caster && caster->GetAreaId() == AREA_WINTERGRASPRIVER) + caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_KOOSU); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12735_song_of_cleansing_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12735_song_of_cleansing_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -1222,4 +1268,5 @@ void AddSC_quest_spell_scripts() new spell_q12987_read_pronouncement(); new spell_q12277_wintergarde_mine_explosion(); new spell_q12066_bunny_kill_credit(); + new spell_q12735_song_of_cleansing(); } -- cgit v1.2.3 From 6890b0a9502c5f0680787b4c9bc1a0086414a3f7 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 5 Jul 2012 09:07:06 -0400 Subject: Core/Spells: codestyle cleanup. case statements are your friend :] --- src/server/scripts/Spells/spell_quest.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index e3714a22304..5648c510413 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1217,15 +1217,20 @@ class spell_q12735_song_of_cleansing : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); - - if (caster && caster->GetAreaId() == AREA_BITTERTIDELAKE) - caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_ATAH); - - else if (caster && caster->GetAreaId() == AREA_RIVERSHEART) - caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_HAKHALAN); - - else if (caster && caster->GetAreaId() == AREA_WINTERGRASPRIVER) - caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_KOOSU); + switch (caster->GetAreaId()) + { + case AREA_BITTERTIDELAKE: + caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_ATAH); + break; + case AREA_RIVERSHEART: + caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_HAKHALAN); + break; + case AREA_WINTERGRASPRIVER: + caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_KOOSU); + break; + default: + break; + } } void Register() -- cgit v1.2.3 From 869ea349879f85f2246921569c3a02807e266479 Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 5 Jul 2012 12:59:42 -0400 Subject: Core/Loot: fix the way quest items are handled. so far ive only found 3 quest items that should be able to be masterlooted. added a new flag to item_template.flagsCustom to allow for making a quest item always follow loot rules. a bonus may be the fix of the handlelootmasteropcode crash! --- .../world/2012_07_05_00_world_item_template.sql | 1 + src/server/game/Entities/Item/ItemPrototype.h | 1 + src/server/game/Groups/Group.cpp | 118 +++++++++++++++++++++ src/server/game/Handlers/LootHandler.cpp | 6 +- src/server/game/Loot/LootMgr.cpp | 67 ++++++++---- src/server/game/Loot/LootMgr.h | 3 +- 6 files changed, 173 insertions(+), 23 deletions(-) create mode 100644 sql/updates/world/2012_07_05_00_world_item_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_07_05_00_world_item_template.sql b/sql/updates/world/2012_07_05_00_world_item_template.sql new file mode 100644 index 00000000000..be6dc1979c1 --- /dev/null +++ b/sql/updates/world/2012_07_05_00_world_item_template.sql @@ -0,0 +1 @@ +UPDATE `item_template` SET `flagsCustom` = `flagsCustom` | 3 WHERE `entry` IN (50226,50231,50274); diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h index 5dbf1cad5bb..17a9e82db7d 100755 --- a/src/server/game/Entities/Item/ItemPrototype.h +++ b/src/server/game/Entities/Item/ItemPrototype.h @@ -196,6 +196,7 @@ enum ItemFlagsCustom { ITEM_FLAGS_CU_DURATION_REAL_TIME = 0x0001, // Item duration will tick even if player is offline ITEM_FLAGS_CU_IGNORE_QUEST_STATUS = 0x0002, // No quest status will be checked when this item drops + ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0003, // Item will always follow group/master/need before greed looting rules }; enum BAG_FAMILY_MASK diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 3a6390cd83a..26faa7e6ae8 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -949,6 +949,64 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) else i->is_underthreshold = true; } + + for (i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot) + { + if (!i->follow_loot_rules) + continue; + + item = sObjectMgr->GetItemTemplate(i->itemid); + if (!item) + { + //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); + continue; + } + + uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); + Roll* r = new Roll(newitemGUID, *i); + + //a vector is filled with only near party members + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* member = itr->getSource(); + if (!member || !member->GetSession()) + continue; + + if (i->AllowedForPlayer(member)) + { + if (member->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false)) + { + r->totalPlayersRolling++; + r->playerVote[member->GetGUID()] = NOT_EMITED_YET; + } + } + } + + if (r->totalPlayersRolling > 0) + { + r->setLoot(loot); + r->itemSlot = itemSlot; + + loot->quest_items[itemSlot - loot->items.size()].is_blocked = true; + + SendLootStartRoll(60000, pLootedObject->GetMapId(), *r); + + RollId.push_back(r); + + if (Creature* creature = pLootedObject->ToCreature()) + { + creature->m_groupLootTimer = 60000; + creature->lootingGroupLowGUID = GetLowGUID(); + } + else if (GameObject* go = pLootedObject->ToGameObject()) + { + go->m_groupLootTimer = 60000; + go->lootingGroupLowGUID = GetLowGUID(); + } + } + else + delete r; + } } void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) @@ -1033,6 +1091,66 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) else i->is_underthreshold = true; } + + for (std::vector::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot) + { + if (!i->follow_loot_rules) + continue; + + item = sObjectMgr->GetItemTemplate(i->itemid); + uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); + Roll* r = new Roll(newitemGUID, *i); + + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* playerToRoll = itr->getSource(); + if (!playerToRoll || !playerToRoll->GetSession()) + continue; + + bool allowedForPlayer = i->AllowedForPlayer(playerToRoll); + if (allowedForPlayer && playerToRoll->IsWithinDistInMap(lootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false)) + { + r->totalPlayersRolling++; + r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET; + } + } + + if (r->totalPlayersRolling > 0) + { + r->setLoot(loot); + r->itemSlot = itemSlot; + + loot->quest_items[itemSlot - loot->items.size()].is_blocked = true; + + //Broadcast Pass and Send Rollstart + for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr) + { + Player* p = ObjectAccessor::FindPlayer(itr->first); + if (!p || !p->GetSession()) + continue; + + if (itr->second == PASS) + SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r); + else + SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r); + } + + RollId.push_back(r); + + if (Creature* creature = lootedObject->ToCreature()) + { + creature->m_groupLootTimer = 60000; + creature->lootingGroupLowGUID = GetLowGUID(); + } + else if (GameObject* go = lootedObject->ToGameObject()) + { + go->m_groupLootTimer = 60000; + go->lootingGroupLowGUID = GetLowGUID(); + } + } + else + delete r; + } } void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 339c7a44d9f..72e0b63f5b6 100755 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -472,16 +472,18 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (!loot) return; - if (slotid > loot->items.size()) + 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()); return; } - LootItem& item = loot->items[slotid]; + LootItem& item = slotid > loot->items.size() ? loot->quest_items[slotid - loot->items.size()] : loot->items[slotid]; ItemPosCountVec dest; InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count); + if (item.follow_loot_rules && !item.AllowedForPlayer(target)) + msg = EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM; if (msg != EQUIP_ERR_OK) { target->SendEquipError(msg, NULL, NULL, item.itemid); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index b4433906674..8d80c145026 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -322,6 +322,7 @@ LootItem::LootItem(LootStoreItem const& li) ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid); freeforall = proto && (proto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT); + follow_loot_rules = proto && (proto->FlagsCu & ITEM_FLAGS_CU_FOLLOW_LOOT_RULES); needs_quest = li.needs_quest; @@ -358,12 +359,7 @@ bool LootItem::AllowedForPlayer(Player const* player) const // check quest requirements if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid))) - if (Group const* group = player->GetGroup()) - { - if (pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT || ((pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT) == 0 && (group->GetLootMethod() != MASTER_LOOT || group->GetLooterGuid() != player->GetGUID()))) - return false; - } - else return false; + return false; return true; } @@ -517,18 +513,20 @@ QuestItemList* Loot::FillQuestLoot(Player* player) for (uint8 i = 0; i < quest_items.size(); ++i) { LootItem &item = quest_items[i]; - if (!item.is_looted && item.AllowedForPlayer(player)) + + if ((!item.is_looted && item.AllowedForPlayer(player)) || (item.follow_loot_rules && player->GetGroup() && player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID())) { ql->push_back(QuestItem(i)); - // questitems get blocked when they first appear in a + // quest items get blocked when they first appear in a // player's quest vector // // increase once if one looter only, looter-times if free for all - if (item.freeforall || !item.is_blocked) + if (item.freeforall && !item.is_blocked) + { ++unlootedCount; - - item.is_blocked = true; + item.is_blocked = true; + } if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS) break; @@ -551,7 +549,7 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool pres for (uint8 i = 0; i < items.size(); ++i) { LootItem &item = items[i]; - if (!item.is_looted && !item.freeforall && item.AllowedForPlayer(player)) + if (!item.is_looted && !item.freeforall && (item.AllowedForPlayer(player)) || (item.follow_loot_rules && player->GetGroup() && player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID())) { if (presentAtLooting) item.AddAllowedLooter(player); @@ -907,8 +905,24 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { b << uint8(l.items.size() + (qi - q_list->begin())); b << item; - if (!item.freeforall) - b << uint8(partySlotType); + if (item.follow_loot_rules) + { + switch (lv.permission) + { + case MASTER_PERMISSION: + b << uint8(LOOT_SLOT_TYPE_MASTER); + break; + case GROUP_PERMISSION: + if (!item.is_blocked) + b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT); + else + b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING); + break; + default: + b << uint8(slotType); + break; + } + } else b << uint8(slotType); ++itemsShown; @@ -928,10 +942,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { b << uint8(fi->index); b << item; - if (!item.freeforall) - b << uint8(partySlotType); - else - b << uint8(slotType); + b << uint8(slotType); ++itemsShown; } } @@ -949,8 +960,24 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { b << uint8(ci->index); b << item; - if (!item.freeforall) - b << uint8(partySlotType); + if (item.follow_loot_rules) + { + switch (lv.permission) + { + case MASTER_PERMISSION: + b << uint8(LOOT_SLOT_TYPE_MASTER); + break; + case GROUP_PERMISSION: + if (!item.is_blocked) + b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT); + else + b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING); + break; + default: + b << uint8(slotType); + break; + } + } else b << uint8(slotType); ++itemsShown; diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index 4a6becc7eff..1af5bd1ea62 100755 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -140,6 +140,7 @@ struct LootItem bool is_underthreshold : 1; bool is_counted : 1; bool needs_quest : 1; // quest drop + bool follow_loot_rules : 1; // Constructor, copies most fields from LootStoreItem, generates random count and random suffixes/properties // Should be called for non-reference LootStoreItem entries only (mincountOrRef > 0) @@ -280,6 +281,7 @@ struct Loot QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; } std::vector items; + std::vector quest_items; uint32 gold; uint8 unlootedCount; uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released. @@ -344,7 +346,6 @@ struct Loot QuestItemList* FillQuestLoot(Player* player); QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting); - std::vector quest_items; std::set PlayersLooting; QuestItemMap PlayerQuestItems; QuestItemMap PlayerFFAItems; -- cgit v1.2.3 From ad71a69efdce00af3c6942b78b62dd2f128f192f Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 5 Jul 2012 13:18:40 -0400 Subject: Core/Loot: fix a typo from previous commit. (thx joschiwald) --- sql/updates/world/2012_07_05_00_world_item_template.sql | 2 +- src/server/game/Entities/Item/ItemPrototype.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/sql/updates/world/2012_07_05_00_world_item_template.sql b/sql/updates/world/2012_07_05_00_world_item_template.sql index be6dc1979c1..d4240ca65a7 100644 --- a/sql/updates/world/2012_07_05_00_world_item_template.sql +++ b/sql/updates/world/2012_07_05_00_world_item_template.sql @@ -1 +1 @@ -UPDATE `item_template` SET `flagsCustom` = `flagsCustom` | 3 WHERE `entry` IN (50226,50231,50274); +UPDATE `item_template` SET `flagsCustom` = `flagsCustom` | 4 WHERE `entry` IN (50226,50231,50274); diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h index 17a9e82db7d..5088a30157c 100755 --- a/src/server/game/Entities/Item/ItemPrototype.h +++ b/src/server/game/Entities/Item/ItemPrototype.h @@ -196,7 +196,7 @@ enum ItemFlagsCustom { ITEM_FLAGS_CU_DURATION_REAL_TIME = 0x0001, // Item duration will tick even if player is offline ITEM_FLAGS_CU_IGNORE_QUEST_STATUS = 0x0002, // No quest status will be checked when this item drops - ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0003, // Item will always follow group/master/need before greed looting rules + ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0004, // Item will always follow group/master/need before greed looting rules }; enum BAG_FAMILY_MASK -- cgit v1.2.3 From 2bcc29136ab2b4982fae765b360b16518ca67880 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 6 Jul 2012 10:21:00 -0400 Subject: Scripts/Spells: fix wrath of the astromancer and stop the startup error. --- .../2012_07_06_00_world_spell_script_names.sql | 1 + .../Outland/TempestKeep/Eye/boss_astromancer.cpp | 47 +++++----------------- 2 files changed, 12 insertions(+), 36 deletions(-) create mode 100644 sql/updates/world/2012_07_06_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_07_06_00_world_spell_script_names.sql b/sql/updates/world/2012_07_06_00_world_spell_script_names.sql new file mode 100644 index 00000000000..676ac430a9d --- /dev/null +++ b/sql/updates/world/2012_07_06_00_world_spell_script_names.sql @@ -0,0 +1 @@ +UPDATE `spell_script_names` SET `spell_id` = 42787 WHERE `spell_id` = 42784; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 0454274401c..3975d77aa25 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -501,9 +501,9 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader public: spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { } - class spell_astromancer_wrath_of_the_astromancer_SpellScript : public SpellScript + class spell_astromancer_wrath_of_the_astromancer_AuraScript : public AuraScript { - PrepareSpellScript(spell_astromancer_wrath_of_the_astromancer_SpellScript); + PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer_AuraScript); bool Validate(SpellInfo const* /*SpellEntry*/) { @@ -512,50 +512,25 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader return true; } - bool Load() + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - _targetCount = 0; - return true; - } - - void CountTargets(std::list& targetList) - { - _targetCount = targetList.size(); - } - - void HandleDummy(SpellEffIndex /* effIndex */) - { - if (Unit* caster = GetOriginalCaster()) - if (Unit* target = GetHitUnit()) - { - if (!target->isAlive() || !_targetCount) - return; - - int32 damage = 10000 / _targetCount; - - SpellNonMeleeDamage damageInfo(caster, target, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask); - damageInfo.damage = damage; + // Final heal only on duration end + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; - caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &damageInfo.absorb, &damageInfo.resist, GetSpellInfo()); - caster->DealDamageMods(target, damageInfo.damage, &damageInfo.absorb); - caster->SendSpellNonMeleeDamageLog(&damageInfo); - caster->DealSpellDamage(&damageInfo, false); - } + Unit* target = GetUnitOwner(); + target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_1].CalcValue(),false); } - private: - int32 _targetCount; - void Register() { - OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS); + AfterEffectRemove += AuraEffectRemoveFn(spell_astromancer_wrath_of_the_astromancer_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); } }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_astromancer_wrath_of_the_astromancer_SpellScript(); + return new spell_astromancer_wrath_of_the_astromancer_AuraScript(); } }; -- cgit v1.2.3 From 5395c4f6c6f86367715a059784183f57d88ca551 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 6 Jul 2012 10:23:27 -0400 Subject: Core/Loot: fix master looting quest items with the custom flag. --- src/server/game/Handlers/LootHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 72e0b63f5b6..9601b449582 100755 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -478,7 +478,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) return; } - LootItem& item = slotid > loot->items.size() ? loot->quest_items[slotid - loot->items.size()] : loot->items[slotid]; + LootItem& item = slotid >= loot->items.size() ? loot->quest_items[slotid - loot->items.size()] : loot->items[slotid]; ItemPosCountVec dest; InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count); -- cgit v1.2.3 From 481e8748112ba4a104bbbd84007dd764285de3b4 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 6 Jul 2012 10:26:37 -0400 Subject: Core/Loot: fix possible crash from having a bad item --- src/server/game/Handlers/LootHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 9601b449582..8259d0c4e9b 100755 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -472,7 +472,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (!loot) return; - if (slotid > loot->items.size() + loot->quest_items.size()) + 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()); return; -- cgit v1.2.3 From 6862d4da25e6a4ece34320965461f90aca81f088 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 6 Jul 2012 10:47:50 -0400 Subject: fix build from r2bcc291 --- src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 3975d77aa25..1caae17cbde 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" +#include "SpellAuras.h" #include "the_eye.h" -- cgit v1.2.3 From 9eab1a23cfb3e520ed997cac26ff8cf48870b837 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 6 Jul 2012 10:52:15 -0400 Subject: fix build again --- src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 1caae17cbde..5b5c3ff2326 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -26,7 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" -#include "SpellAuras.h" +#include "SpellAuraEffects.h" #include "the_eye.h" -- cgit v1.2.3 From 91cd7109e452b0801bc5b4b62bcaeaeb29d80234 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 6 Jul 2012 18:49:56 +0200 Subject: Core/Commands: Convert lookup commands in commandscript --- src/server/game/Chat/Chat.cpp | 29 - src/server/game/Chat/Chat.h | 18 - src/server/game/Chat/Commands/Level1.cpp | 134 --- src/server/game/Chat/Commands/Level2.cpp | 260 ------ src/server/game/Chat/Commands/Level3.cpp | 915 ------------------ src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Commands/CMakeLists.txt | 2 +- src/server/scripts/Commands/cs_lookup.cpp | 1391 ++++++++++++++++++++++++++++ 8 files changed, 1394 insertions(+), 1357 deletions(-) create mode 100644 src/server/scripts/Commands/cs_lookup.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 8bc2cc34dae..562965145bf 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -112,34 +112,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand lookupPlayerCommandTable[] = - { - { "ip", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerIpCommand>, "", NULL }, - { "account", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerAccountCommand>, "", NULL }, - { "email", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerEmailCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand lookupCommandTable[] = - { - { "area", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleLookupAreaCommand>, "", NULL }, - { "creature", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupCreatureCommand>, "", NULL }, - { "event", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupEventCommand>, "", NULL }, - { "faction", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupFactionCommand>, "", NULL }, - { "item", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupItemCommand>, "", NULL }, - { "itemset", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupItemSetCommand>, "", NULL }, - { "object", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupObjectCommand>, "", NULL }, - { "quest", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupQuestCommand>, "", NULL }, - { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable }, - { "skill", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupSkillCommand>, "", NULL }, - { "spell", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupSpellCommand>, "", NULL }, - { "taxinode", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupTaxiNodeCommand>, "", NULL }, - { "tele", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleLookupTeleCommand>, "", NULL }, - { "title", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupTitleCommand>, "", NULL }, - { "map", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupMapCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand petCommandTable[] = { { "create", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleCreatePetCommand>, "", NULL }, @@ -203,7 +175,6 @@ ChatCommand* ChatHandler::getCommandTable() static ChatCommand commandTable[] = { - { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 96ac593d744..77280e7ddef 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -157,24 +157,6 @@ class ChatHandler bool HandleBindSightCommand(const char* args); bool HandleUnbindSightCommand(const char* args); - bool HandleLookupAreaCommand(const char* args); - bool HandleLookupCreatureCommand(const char* args); - bool HandleLookupEventCommand(const char* args); - bool HandleLookupFactionCommand(const char * args); - bool HandleLookupItemCommand(const char * args); - bool HandleLookupItemSetCommand(const char * args); - bool HandleLookupObjectCommand(const char* args); - bool HandleLookupPlayerIpCommand(const char* args); - bool HandleLookupPlayerAccountCommand(const char* args); - bool HandleLookupPlayerEmailCommand(const char* args); - bool HandleLookupQuestCommand(const char* args); - bool HandleLookupSkillCommand(const char* args); - bool HandleLookupSpellCommand(const char* args); - bool HandleLookupTaxiNodeCommand(const char * args); - bool HandleLookupTeleCommand(const char * args); - bool HandleLookupMapCommand(const char* args); - bool HandleLookupTitleCommand(const char * args); - bool HandlePDumpLoadCommand(const char *args); bool HandlePDumpWriteCommand(const char *args); diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp index a10a78a35ff..1cf3d5c9b4e 100755 --- a/src/server/game/Chat/Commands/Level1.cpp +++ b/src/server/game/Chat/Commands/Level1.cpp @@ -450,140 +450,6 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args) return false; } -bool ChatHandler::HandleLookupAreaCommand(const char* args) -{ - if (!*args) - return false; - - std::string namepart = args; - std::wstring wnamepart; - - if (!Utf8toWStr (namepart, wnamepart)) - return false; - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - // converting string that we try to find to lower case - wstrToLower (wnamepart); - - // Search in AreaTable.dbc - for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag) - { - AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag); - if (areaEntry) - { - int loc = GetSessionDbcLocale(); - std::string name = areaEntry->area_name[loc]; - if (name.empty()) - continue; - - if (!Utf8FitTo (name, wnamepart)) - { - loc = 0; - for (; loc < TOTAL_LOCALES; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; - - name = areaEntry->area_name[loc]; - if (name.empty()) - continue; - - if (Utf8FitTo (name, wnamepart)) - break; - } - } - - if (loc < TOTAL_LOCALES) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - // send area in "id - [name]" format - std::ostringstream ss; - if (m_session) - ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << ' ' << localeNames[loc]<< "]|h|r"; - else - ss << areaEntry->ID << " - " << name << ' ' << localeNames[loc]; - - SendSysMessage(ss.str().c_str()); - - if (!found) - found = true; - } - } - } - - if (!found) - SendSysMessage(LANG_COMMAND_NOAREAFOUND); - - return true; -} - -//Find tele in game_tele order by name -bool ChatHandler::HandleLookupTeleCommand(const char * args) -{ - if (!*args) - { - SendSysMessage(LANG_COMMAND_TELE_PARAMETER); - SetSentErrorMessage(true); - return false; - } - - char const* str = strtok((char*)args, " "); - if (!str) - return false; - - std::string namepart = str; - std::wstring wnamepart; - - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - // converting string that we try to find to lower case - wstrToLower(wnamepart); - - std::ostringstream reply; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - bool limitReached = false; - - GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap(); - for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr) - { - GameTele const* tele = &itr->second; - - if (tele->wnameLow.find(wnamepart) == std::wstring::npos) - continue; - - if (maxResults && count++ == maxResults) - { - limitReached = true; - break; - } - - if (m_session) - reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n"; - else - reply << " " << itr->first << ' ' << tele->name << "\n"; - } - - if (reply.str().empty()) - SendSysMessage(LANG_COMMAND_TELE_NOLOCATION); - else - PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str()); - - if (limitReached) - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - - return true; -} - //Enable\Dissable accept whispers (for GM) bool ChatHandler::HandleWhispersCommand(const char* args) { diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index 42a379753d5..a44ee515c02 100755 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -456,61 +456,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args) return true; } -bool ChatHandler::HandleLookupEventCommand(const char* args) -{ - if (!*args) - return false; - - std::string namepart = args; - std::wstring wnamepart; - - // converting string that we try to find to lower case - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - wstrToLower(wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); - GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList(); - - for (uint32 id = 0; id < events.size(); ++id) - { - GameEventData const& eventData = events[id]; - - std::string descr = eventData.description; - if (descr.empty()) - continue; - - if (Utf8FitTo(descr, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : ""; - - if (m_session) - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active); - else - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active); - - if (!found) - found = true; - } - } - - if (!found) - SendSysMessage(LANG_NOEVENTFOUND); - - return true; -} - bool ChatHandler::HandleCombatStopCommand(const char* args) { Player* target = NULL; @@ -539,128 +484,6 @@ bool ChatHandler::HandleCombatStopCommand(const char* args) return true; } -bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) -{ - std::string ip; - int32 limit; - char* limit_str; - - Player *chr = getSelectedPlayer(); - if (!*args) - { - // NULL only if used from console - if (!chr || chr == GetSession()->GetPlayer()) - return false; - - ip = chr->GetSession()->GetRemoteAddress(); - limit = -1; - } - else - { - ip = strtok ((char*)args, " "); - limit_str = strtok (NULL, " "); - limit = limit_str ? atoi (limit_str) : -1; - } - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP); - stmt->setString(0, ip); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - return LookupPlayerSearchCommand(result, limit); -} - -bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) -{ - if (!*args) - return false; - - std::string account = strtok ((char*)args, " "); - char* limit_str = strtok (NULL, " "); - int32 limit = limit_str ? atoi (limit_str) : -1; - - if (!AccountMgr::normalizeString (account)) - return false; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME); - stmt->setString(0, account); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - return LookupPlayerSearchCommand (result, limit); -} - -bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) -{ - if (!*args) - return false; - - std::string email = strtok ((char*)args, " "); - char* limit_str = strtok (NULL, " "); - int32 limit = limit_str ? atoi (limit_str) : -1; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL); - stmt->setString(0, email); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - return LookupPlayerSearchCommand(result, limit); -} - -bool ChatHandler::LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit) -{ - if (!result) - { - PSendSysMessage(LANG_NO_PLAYERS_FOUND); - SetSentErrorMessage(true); - return false; - } - - int i = 0; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - do - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - Field* fields = result->Fetch(); - uint32 acc_id = fields[0].GetUInt32(); - std::string acc_name = fields[1].GetString(); - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC); - stmt->setUInt32(0, acc_id); - PreparedQueryResult result2 = CharacterDatabase.Query(stmt); - - if (result2) - { - PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, acc_name.c_str(), acc_id); - - uint64 guid = 0; - std::string name; - - do - { - Field* charfields = result2->Fetch(); - guid = charfields[0].GetUInt64(); - name = charfields[1].GetString(); - - PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid); - ++i; - - } while (result2->NextRow() && (limit == -1 || i < limit)); - } - } while (result->NextRow()); - - if (i == 0) // empty accounts only - { - PSendSysMessage(LANG_NO_PLAYERS_FOUND); - SetSentErrorMessage(true); - return false; - } - - return true; -} bool ChatHandler::HandleRepairitemsCommand(const char* args) { @@ -854,86 +677,3 @@ bool ChatHandler::HandlePetUnlearnCommand(const char *args) return true; } - -bool ChatHandler::HandleLookupTitleCommand(const char* args) -{ - if (!*args) - return false; - - // can be NULL in console call - Player* target = getSelectedPlayer(); - - // title name have single string arg for player name - char const* targetName = target ? target->GetName() : "NAME"; - - std::string namepart = args; - std::wstring wnamepart; - - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - // converting string that we try to find to lower case - wstrToLower(wnamepart); - - uint32 counter = 0; // Counter for figure out that we found smth. - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - // Search in CharTitles.dbc - for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) - { - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); - if (titleInfo) - { - int loc = GetSessionDbcLocale(); - std::string name = titleInfo->name[loc]; - if (name.empty()) - continue; - - if (!Utf8FitTo(name, wnamepart)) - { - loc = 0; - for (; loc < TOTAL_LOCALES; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; - - name = titleInfo->name[loc]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - break; - } - } - - if (loc < TOTAL_LOCALES) - { - if (maxResults && counter == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - char const* knownStr = target && target->HasTitle(titleInfo) ? GetTrinityString(LANG_KNOWN) : ""; - - char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index - ? GetTrinityString(LANG_ACTIVE) - : ""; - - char titleNameStr[80]; - snprintf(titleNameStr, 80, name.c_str(), targetName); - - // send title in "id (idx:idx) - [namedlink locale]" format - if (m_session) - PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr); - else - PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr); - - ++counter; - } - } - } - if (counter == 0) // if counter == 0 then we found nth - SendSysMessage(LANG_COMMAND_NOTITLEFOUND); - return true; -} diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index a3701acc548..7f02c7a1815 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -385,921 +385,6 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args) return true; } -bool ChatHandler::HandleLookupItemCommand(const char *args) -{ - if (!*args) - return false; - - std::string namepart = args; - std::wstring wnamepart; - - // converting string that we try to find to lower case - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - wstrToLower(wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - // Search in `item_template` - ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); - for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) - { - int loc_idx = GetSessionDbLocaleIndex(); - if (loc_idx >= 0) - { - uint8 uloc_idx = uint8(loc_idx); - if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId)) - { - if (il->Name.size() > uloc_idx && !il->Name[uloc_idx].empty()) - { - std::string name = il->Name[uloc_idx]; - - if (Utf8FitTo(name, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - if (m_session) - PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str()); - else - PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str()); - - if (!found) - found = true; - - continue; - } - } - } - } - - std::string name = itr->second.Name1; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - if (m_session) - PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str()); - else - PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str()); - - if (!found) - found = true; - } - } - - if (!found) - SendSysMessage(LANG_COMMAND_NOITEMFOUND); - - return true; -} - -bool ChatHandler::HandleLookupItemSetCommand(const char *args) -{ - if (!*args) - return false; - - std::string namepart = args; - std::wstring wnamepart; - - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - // converting string that we try to find to lower case - wstrToLower(wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - // Search in ItemSet.dbc - for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++) - { - ItemSetEntry const* set = sItemSetStore.LookupEntry(id); - if (set) - { - int loc = GetSessionDbcLocale(); - std::string name = set->name[loc]; - if (name.empty()) - continue; - - if (!Utf8FitTo(name, wnamepart)) - { - loc = 0; - for (; loc < TOTAL_LOCALES; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; - - name = set->name[loc]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - break; - } - } - - if (loc < TOTAL_LOCALES) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - // send item set in "id - [namedlink locale]" format - if (m_session) - PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[loc]); - else - PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[loc]); - - if (!found) - found = true; - } - } - } - if (!found) - SendSysMessage(LANG_COMMAND_NOITEMSETFOUND); - return true; -} - -bool ChatHandler::HandleLookupSkillCommand(const char *args) -{ - if (!*args) - return false; - - // can be NULL in console call - Player* target = getSelectedPlayer(); - - std::string namepart = args; - std::wstring wnamepart; - - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - // converting string that we try to find to lower case - wstrToLower(wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - // Search in SkillLine.dbc - for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++) - { - SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id); - if (skillInfo) - { - int loc = GetSessionDbcLocale(); - std::string name = skillInfo->name[loc]; - if (name.empty()) - continue; - - if (!Utf8FitTo(name, wnamepart)) - { - loc = 0; - for (; loc < TOTAL_LOCALES; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; - - name = skillInfo->name[loc]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - break; - } - } - - if (loc < TOTAL_LOCALES) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - char valStr[50] = ""; - char const* knownStr = ""; - if (target && target->HasSkill(id)) - { - knownStr = GetTrinityString(LANG_KNOWN); - uint32 curValue = target->GetPureSkillValue(id); - uint32 maxValue = target->GetPureMaxSkillValue(id); - uint32 permValue = target->GetSkillPermBonusValue(id); - uint32 tempValue = target->GetSkillTempBonusValue(id); - - char const* valFormat = GetTrinityString(LANG_SKILL_VALUES); - snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue); - } - - // send skill in "id - [namedlink locale]" format - if (m_session) - PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[loc], knownStr, valStr); - else - PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[loc], knownStr, valStr); - - if (!found) - found = true; - } - } - } - if (!found) - SendSysMessage(LANG_COMMAND_NOSKILLFOUND); - return true; -} - -bool ChatHandler::HandleLookupSpellCommand(const char *args) -{ - if (!*args) - return false; - - // can be NULL at console call - Player* target = getSelectedPlayer(); - - std::string namepart = args; - std::wstring wnamepart; - - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - // converting string that we try to find to lower case - wstrToLower(wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - // Search in Spell.dbc - for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); - if (spellInfo) - { - int loc = GetSessionDbcLocale(); - std::string name = spellInfo->SpellName[loc]; - if (name.empty()) - continue; - - if (!Utf8FitTo(name, wnamepart)) - { - loc = 0; - for (; loc < TOTAL_LOCALES; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; - - name = spellInfo->SpellName[loc]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - break; - } - } - - if (loc < TOTAL_LOCALES) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - bool known = target && target->HasSpell(id); - bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); - - SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell); - - uint32 talentCost = GetTalentSpellCost(id); - - bool talent = (talentCost > 0); - bool passive = spellInfo->IsPassive(); - bool active = target && target->HasAura(id); - - // unit32 used to prevent interpreting uint8 as char at output - // find rank of learned spell for learning spell, or talent rank - uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank(); - - // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format - std::ostringstream ss; - if (m_session) - ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name; - else - ss << id << " - " << name; - - // include rank in link name - if (rank) - ss << GetTrinityString(LANG_SPELL_RANK) << rank; - - if (m_session) - ss << ' ' << localeNames[loc] << "]|h|r"; - else - ss << ' ' << localeNames[loc]; - - if (talent) - ss << GetTrinityString(LANG_TALENT); - if (passive) - ss << GetTrinityString(LANG_PASSIVE); - if (learn) - ss << GetTrinityString(LANG_LEARN); - if (known) - ss << GetTrinityString(LANG_KNOWN); - if (active) - ss << GetTrinityString(LANG_ACTIVE); - - SendSysMessage(ss.str().c_str()); - - if (!found) - found = true; - } - } - } - if (!found) - SendSysMessage(LANG_COMMAND_NOSPELLFOUND); - return true; -} - -bool ChatHandler::HandleLookupQuestCommand(const char *args) -{ - if (!*args) - return false; - - // can be NULL at console call - Player* target = getSelectedPlayer(); - - std::string namepart = args; - std::wstring wnamepart; - - // converting string that we try to find to lower case - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - wstrToLower(wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates(); - for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter) - { - Quest * qinfo = iter->second; - - int loc_idx = GetSessionDbLocaleIndex(); - if (loc_idx >= 0) - { - uint8 uloc_idx = uint8(loc_idx); - if (QuestLocale const* il = sObjectMgr->GetQuestLocale(qinfo->GetQuestId())) - { - if (il->Title.size() > uloc_idx && !il->Title[uloc_idx].empty()) - { - std::string title = il->Title[uloc_idx]; - - if (Utf8FitTo(title, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - char const* statusStr = ""; - - if (target) - { - QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); - - switch (status) - { - case QUEST_STATUS_COMPLETE: - statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); - break; - case QUEST_STATUS_INCOMPLETE: - statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); - break; - case QUEST_STATUS_REWARDED: - statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); - break; - default: - break; - } - } - - if (m_session) - PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr); - else - PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr); - - if (!found) - found = true; - - continue; - } - } - } - } - - std::string title = qinfo->GetTitle(); - if (title.empty()) - continue; - - if (Utf8FitTo(title, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - char const* statusStr = ""; - - if (target) - { - QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); - - switch (status) - { - case QUEST_STATUS_COMPLETE: - statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); - break; - case QUEST_STATUS_INCOMPLETE: - statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); - break; - case QUEST_STATUS_REWARDED: - statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); - break; - default: - break; - } - } - - if (m_session) - PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr); - else - PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr); - - if (!found) - found = true; - } - } - - if (!found) - SendSysMessage(LANG_COMMAND_NOQUESTFOUND); - - return true; -} - -bool ChatHandler::HandleLookupCreatureCommand(const char *args) -{ - if (!*args) - return false; - - std::string namepart = args; - std::wstring wnamepart; - - // converting string that we try to find to lower case - if (!Utf8toWStr (namepart, wnamepart)) - return false; - - wstrToLower (wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); - for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr) - { - uint32 id = itr->second.Entry; - uint8 localeIndex = GetSessionDbLocaleIndex(); - if (CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(id)) - { - if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty()) - { - std::string name = cl->Name[localeIndex]; - - if (Utf8FitTo (name, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - if (m_session) - PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str()); - else - PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str()); - - if (!found) - found = true; - - continue; - } - } - } - - std::string name = itr->second.Name; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - if (m_session) - PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str()); - else - PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str()); - - if (!found) - found = true; - } - } - - if (!found) - SendSysMessage(LANG_COMMAND_NOCREATUREFOUND); - - return true; -} - -bool ChatHandler::HandleLookupObjectCommand(const char *args) -{ - if (!*args) - return false; - - std::string namepart = args; - std::wstring wnamepart; - - // converting string that we try to find to lower case - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - wstrToLower(wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates(); - for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr) - { - uint8 localeIndex = GetSessionDbLocaleIndex(); - if (GameObjectLocale const* gl = sObjectMgr->GetGameObjectLocale(itr->second.entry)) - { - if (gl->Name.size() > localeIndex && !gl->Name[localeIndex].empty()) - { - std::string name = gl->Name[localeIndex]; - - if (Utf8FitTo(name, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - if (m_session) - PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str()); - else - PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str()); - - if (!found) - found = true; - - continue; - } - } - } - - std::string name = itr->second.name; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - if (m_session) - PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str()); - else - PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str()); - - if (!found) - found = true; - } - } - - if (!found) - SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND); - - return true; -} - -bool ChatHandler::HandleLookupFactionCommand(const char *args) -{ - if (!*args) - return false; - - // Can be NULL at console call - Player* target = getSelectedPlayer(); - - std::string namepart = args; - std::wstring wnamepart; - - if (!Utf8toWStr (namepart, wnamepart)) - return false; - - // converting string that we try to find to lower case - wstrToLower (wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id) - { - FactionEntry const* factionEntry = sFactionStore.LookupEntry (id); - if (factionEntry) - { - FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL; - - int loc = GetSessionDbcLocale(); - std::string name = factionEntry->name[loc]; - if (name.empty()) - continue; - - if (!Utf8FitTo(name, wnamepart)) - { - loc = 0; - for (; loc < TOTAL_LOCALES; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; - - name = factionEntry->name[loc]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - break; - } - } - - if (loc < TOTAL_LOCALES) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format - // or "id - [faction] [no reputation]" format - std::ostringstream ss; - if (m_session) - ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << ' ' << localeNames[loc] << "]|h|r"; - else - ss << id << " - " << name << ' ' << localeNames[loc]; - - if (repState) // and then target != NULL also - { - uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry); - std::string rankName = GetTrinityString(index); - - ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')'; - - if (repState->Flags & FACTION_FLAG_VISIBLE) - ss << GetTrinityString(LANG_FACTION_VISIBLE); - if (repState->Flags & FACTION_FLAG_AT_WAR) - ss << GetTrinityString(LANG_FACTION_ATWAR); - if (repState->Flags & FACTION_FLAG_PEACE_FORCED) - ss << GetTrinityString(LANG_FACTION_PEACE_FORCED); - if (repState->Flags & FACTION_FLAG_HIDDEN) - ss << GetTrinityString(LANG_FACTION_HIDDEN); - if (repState->Flags & FACTION_FLAG_INVISIBLE_FORCED) - ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); - if (repState->Flags & FACTION_FLAG_INACTIVE) - ss << GetTrinityString(LANG_FACTION_INACTIVE); - } - else - ss << GetTrinityString(LANG_FACTION_NOREPUTATION); - - SendSysMessage(ss.str().c_str()); - - if (!found) - found = true; - } - } - } - - if (!found) - SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND); - return true; -} - -bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args) -{ - if (!*args) - return false; - - std::string namepart = args; - std::wstring wnamepart; - - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - // converting string that we try to find to lower case - wstrToLower(wnamepart); - - bool found = false; - uint32 count = 0; - uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - - // Search in TaxiNodes.dbc - for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++) - { - TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id); - if (nodeEntry) - { - int loc = GetSessionDbcLocale(); - std::string name = nodeEntry->name[loc]; - if (name.empty()) - continue; - - if (!Utf8FitTo(name, wnamepart)) - { - loc = 0; - for (; loc < TOTAL_LOCALES; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; - - name = nodeEntry->name[loc]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - break; - } - } - - if (loc < TOTAL_LOCALES) - { - if (maxResults && count++ == maxResults) - { - PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format - if (m_session) - PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[loc], - nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); - else - PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc], - nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); - - if (!found) - found = true; - } - } - } - if (!found) - SendSysMessage(LANG_COMMAND_NOTAXINODEFOUND); - return true; -} - -bool ChatHandler::HandleLookupMapCommand(const char *args) -{ - if (!*args) - return false; - - /*std::string namepart = args; - std::wstring wnamepart; - - // converting string that we try to find to lower case - if (!Utf8toWStr(namepart, wnamepart)) - return false; - - wstrToLower(wnamepart); - - bool found = false; - - // search in Map.dbc - for (uint32 id = 0; id < sMapStore.GetNumRows(); id++) - { - MapEntry const* MapInfo = sMapStore.LookupEntry(id); - if (MapInfo) - { - uint8 loc = m_session ? m_session->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale(); - - std::string name = MapInfo->name[loc]; - if (name.empty()) - continue; - - if (!Utf8FitTo(name, wnamepart)) - { - loc = LOCALE_enUS; - for (; loc < TOTAL_LOCALES; loc++) - { - if (m_session && loc == m_session->GetSessionDbcLocale()) - continue; - - name = MapInfo->name[loc]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wnamepart)) - break; - } - } - - if (loc < TOTAL_LOCALES) - { - // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format - std::ostringstream ss; - - if (m_session) - ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << ']'; - else // console - ss << id << " - [" << name << ']'; - - if (MapInfo->IsContinent()) - ss << GetTrinityString(LANG_CONTINENT); - - switch (MapInfo->map_type) - { - case MAP_INSTANCE: ss << GetTrinityString(LANG_INSTANCE); break; - case MAP_BATTLEGROUND: ss << GetTrinityString(LANG_BATTLEGROUND); break; - case MAP_ARENA: ss << GetTrinityString(LANG_ARENA); break; - } - - if (MapInfo->IsRaid()) - ss << GetTrinityString(LANG_RAID); - - if (MapInfo->SupportsHeroicMode()) - ss << GetTrinityString(LANG_HEROIC); - - uint32 ResetTimeRaid = MapInfo->resetTimeRaid; - - std::string ResetTimeRaidStr; - if (ResetTimeRaid) - ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false); - - uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic; - std::string ResetTimeHeroicStr; - if (ResetTimeHeroic) - ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false); - - if (MapInfo->IsMountAllowed()) - ss << GetTrinityString(LANG_MOUNTABLE); - - if (ResetTimeRaid && !ResetTimeHeroic) - PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str()); - else if (!ResetTimeRaid && ResetTimeHeroic) - PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str()); - else if (ResetTimeRaid && ResetTimeHeroic) - PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str()); - else - SendSysMessage(ss.str().c_str()); - - if (!found) - found = true; - } - } - } - - if (!found) - SendSysMessage(LANG_COMMAND_NOMAPFOUND); - */ - return true; -} - bool ChatHandler::HandleGetDistanceCommand(const char *args) { WorldObject* obj = NULL; diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index df318a8ef42..2b99de9d0a2 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -57,6 +57,7 @@ void AddSC_honor_commandscript(); void AddSC_instance_commandscript(); void AddSC_learn_commandscript(); void AddSC_list_commandscript(); +void AddSC_lookup_commandscript(); void AddSC_misc_commandscript(); void AddSC_modify_commandscript(); void AddSC_npc_commandscript(); @@ -665,6 +666,7 @@ void AddCommandScripts() AddSC_honor_commandscript(); AddSC_instance_commandscript(); AddSC_learn_commandscript(); + AddSC_lookup_commandscript(); AddSC_list_commandscript(); AddSC_misc_commandscript(); AddSC_modify_commandscript(); diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index b0ea8dc986d..2d408e76cd6 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -24,6 +24,7 @@ set(scripts_STAT_SRCS Commands/cs_instance.cpp Commands/cs_learn.cpp Commands/cs_list.cpp + Commands/cs_lookup.cpp Commands/cs_misc.cpp Commands/cs_modify.cpp Commands/cs_npc.cpp @@ -34,7 +35,6 @@ set(scripts_STAT_SRCS Commands/cs_server.cpp Commands/cs_titles.cpp Commands/cs_wp.cpp -# Commands/cs_lookup.cpp # Commands/cs_pdump.cpp # Commands/cs_channel.cpp # Commands/cs_pet.cpp diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp new file mode 100644 index 00000000000..3c72b260086 --- /dev/null +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -0,0 +1,1391 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: lookup_commandscript +%Complete: 100 +Comment: All lookup related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "AccountMgr.h" +#include "GameEventMgr.h" +#include "ObjectAccessor.h" + +class lookup_commandscript : public CommandScript +{ +public: + lookup_commandscript() : CommandScript("lookup_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand lookupPlayerCommandTable[] = + { + { "ip", SEC_GAMEMASTER, true, &HandleLookupPlayerIpCommand, "", NULL }, + { "account", SEC_GAMEMASTER, true, &HandleLookupPlayerAccountCommand, "", NULL }, + { "email", SEC_GAMEMASTER, true, &HandleLookupPlayerEmailCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand lookupCommandTable[] = + { + { "area", SEC_MODERATOR, true, &HandleLookupAreaCommand, "", NULL }, + { "creature", SEC_ADMINISTRATOR, true, &HandleLookupCreatureCommand, "", NULL }, + { "event", SEC_GAMEMASTER, true, &HandleLookupEventCommand, "", NULL }, + { "faction", SEC_ADMINISTRATOR, true, &HandleLookupFactionCommand, "", NULL }, + { "item", SEC_ADMINISTRATOR, true, &HandleLookupItemCommand, "", NULL }, + { "itemset", SEC_ADMINISTRATOR, true, &HandleLookupItemSetCommand, "", NULL }, + { "object", SEC_ADMINISTRATOR, true, &HandleLookupObjectCommand, "", NULL }, + { "quest", SEC_ADMINISTRATOR, true, &HandleLookupQuestCommand, "", NULL }, + { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable }, + { "skill", SEC_ADMINISTRATOR, true, &HandleLookupSkillCommand, "", NULL }, + { "spell", SEC_ADMINISTRATOR, true, &HandleLookupSpellCommand, "", NULL }, + { "taxinode", SEC_ADMINISTRATOR, true, &HandleLookupTaxiNodeCommand, "", NULL }, + { "tele", SEC_MODERATOR, true, &HandleLookupTeleCommand, "", NULL }, + { "title", SEC_GAMEMASTER, true, &HandleLookupTitleCommand, "", NULL }, + { "map", SEC_ADMINISTRATOR, true, &HandleLookupMapCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleLookupAreaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string namePart = args; + std::wstring wNamePart; + + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + // converting string that we try to find to lower case + wstrToLower(wNamePart); + + // Search in AreaTable.dbc + for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag) + { + AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag); + if (areaEntry) + { + int locale = handler->GetSessionDbcLocale(); + std::string name = areaEntry->area_name[locale]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wNamePart)) + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = areaEntry->area_name[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + // send area in "id - [name]" format + std::ostringstream ss; + if (handler->GetSession()) + ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << ' ' << localeNames[locale]<< "]|h|r"; + else + ss << areaEntry->ID << " - " << name << ' ' << localeNames[locale]; + + handler->SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } + } + } + + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOAREAFOUND); + + return true; + } + + static bool HandleLookupCreatureCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string namePart = args; + std::wstring wNamePart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); + for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr) + { + uint32 id = itr->second.Entry; + uint8 localeIndex = handler->GetSessionDbLocaleIndex(); + if (CreatureLocale const* creatureLocale = sObjectMgr->GetCreatureLocale(id)) + { + if (creatureLocale->Name.size() > localeIndex && !creatureLocale->Name[localeIndex].empty()) + { + std::string name = creatureLocale->Name[localeIndex]; + + if (Utf8FitTo(name, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str()); + else + handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str()); + + if (!found) + found = true; + + continue; + } + } + } + + std::string name = itr->second.Name; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str()); + else + handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str()); + + if (!found) + found = true; + } + } + + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOCREATUREFOUND); + + return true; + } + + static bool HandleLookupEventCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string namePart = args; + std::wstring wNamePart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); + GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList(); + + for (uint32 id = 0; id < events.size(); ++id) + { + GameEventData const& eventData = events[id]; + + std::string descr = eventData.description; + if (descr.empty()) + continue; + + if (Utf8FitTo(descr, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + char const* active = activeEvents.find(id) != activeEvents.end() ? handler->GetTrinityString(LANG_ACTIVE) : ""; + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active); + else + handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active); + + if (!found) + found = true; + } + } + + if (!found) + handler->SendSysMessage(LANG_NOEVENTFOUND); + + return true; + } + + static bool HandleLookupFactionCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // Can be NULL at console call + Player* target = handler->getSelectedPlayer(); + + std::string namePart = args; + std::wstring wNamePart; + + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + // converting string that we try to find to lower case + wstrToLower (wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id) + { + FactionEntry const* factionEntry = sFactionStore.LookupEntry(id); + if (factionEntry) + { + FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL; + + int locale = handler->GetSessionDbcLocale(); + std::string name = factionEntry->name[locale]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wNamePart)) + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = factionEntry->name[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format + // or "id - [faction] [no reputation]" format + std::ostringstream ss; + if (handler->GetSession()) + ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << ' ' << localeNames[locale] << "]|h|r"; + else + ss << id << " - " << name << ' ' << localeNames[locale]; + + if (factionState) // and then target != NULL also + { + uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry); + std::string rankName = handler->GetTrinityString(index); + + ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')'; + + if (factionState->Flags & FACTION_FLAG_VISIBLE) + ss << handler->GetTrinityString(LANG_FACTION_VISIBLE); + if (factionState->Flags & FACTION_FLAG_AT_WAR) + ss << handler->GetTrinityString(LANG_FACTION_ATWAR); + if (factionState->Flags & FACTION_FLAG_PEACE_FORCED) + ss << handler->GetTrinityString(LANG_FACTION_PEACE_FORCED); + if (factionState->Flags & FACTION_FLAG_HIDDEN) + ss << handler->GetTrinityString(LANG_FACTION_HIDDEN); + if (factionState->Flags & FACTION_FLAG_INVISIBLE_FORCED) + ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); + if (factionState->Flags & FACTION_FLAG_INACTIVE) + ss << handler->GetTrinityString(LANG_FACTION_INACTIVE); + } + else + ss << handler->GetTrinityString(LANG_FACTION_NOREPUTATION); + + handler->SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } + } + } + + if (!found) + handler->SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND); + return true; + } + + static bool HandleLookupItemCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string namePart = args; + std::wstring wNamePart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + // Search in `item_template` + ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); + for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) + { + int localeIndex = handler->GetSessionDbLocaleIndex(); + if (localeIndex >= 0) + { + uint8 ulocaleIndex = uint8(localeIndex); + if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId)) + { + if (il->Name.size() > ulocaleIndex && !il->Name[ulocaleIndex].empty()) + { + std::string name = il->Name[ulocaleIndex]; + + if (Utf8FitTo(name, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str()); + else + handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str()); + + if (!found) + found = true; + + continue; + } + } + } + } + + std::string name = itr->second.Name1; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str()); + else + handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str()); + + if (!found) + found = true; + } + } + + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOITEMFOUND); + + return true; + } + + static bool HandleLookupItemSetCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string namePart = args; + std::wstring wNamePart; + + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + // Search in ItemSet.dbc + for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++) + { + ItemSetEntry const* set = sItemSetStore.LookupEntry(id); + if (set) + { + int locale = handler->GetSessionDbcLocale(); + std::string name = set->name[locale]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wNamePart)) + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = set->name[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + // send item set in "id - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[locale]); + else + handler->PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[locale]); + + if (!found) + found = true; + } + } + } + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOITEMSETFOUND); + + return true; + } + + static bool HandleLookupObjectCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string namePart = args; + std::wstring wNamePart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates(); + for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr) + { + uint8 localeIndex = handler->GetSessionDbLocaleIndex(); + if (GameObjectLocale const* objectLocalte = sObjectMgr->GetGameObjectLocale(itr->second.entry)) + { + if (objectLocalte->Name.size() > localeIndex && !objectLocalte->Name[localeIndex].empty()) + { + std::string name = objectLocalte->Name[localeIndex]; + + if (Utf8FitTo(name, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str()); + else + handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str()); + + if (!found) + found = true; + + continue; + } + } + } + + std::string name = itr->second.name; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str()); + else + handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str()); + + if (!found) + found = true; + } + } + + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND); + + return true; + } + + static bool HandleLookupQuestCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // can be NULL at console call + Player* target = handler->getSelectedPlayer(); + + std::string namePart = args; + std::wstring wNamePart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates(); + for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter) + { + Quest* qInfo = iter->second; + + int localeIndex = handler->GetSessionDbLocaleIndex(); + if (localeIndex >= 0) + { + uint8 ulocaleIndex = uint8(localeIndex); + if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(qInfo->GetQuestId())) + { + if (questLocale->Title.size() > ulocaleIndex && !questLocale->Title[ulocaleIndex].empty()) + { + std::string title = questLocale->Title[ulocaleIndex]; + + if (Utf8FitTo(title, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + char const* statusStr = ""; + + if (target) + { + QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId()); + + switch (status) + { + case QUEST_STATUS_COMPLETE: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); + break; + case QUEST_STATUS_INCOMPLETE: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); + break; + case QUEST_STATUS_REWARDED: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED); + break; + default: + break; + } + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, qInfo->GetQuestId(), qInfo->GetQuestId(), qInfo->GetQuestLevel(), title.c_str(), statusStr); + else + handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qInfo->GetQuestId(), title.c_str(), statusStr); + + if (!found) + found = true; + + continue; + } + } + } + } + + std::string title = qInfo->GetTitle(); + if (title.empty()) + continue; + + if (Utf8FitTo(title, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + char const* statusStr = ""; + + if (target) + { + QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId()); + + switch (status) + { + case QUEST_STATUS_COMPLETE: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); + break; + case QUEST_STATUS_INCOMPLETE: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); + break; + case QUEST_STATUS_REWARDED: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED); + break; + default: + break; + } + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, qInfo->GetQuestId(), qInfo->GetQuestId(), qInfo->GetQuestLevel(), title.c_str(), statusStr); + else + handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qInfo->GetQuestId(), title.c_str(), statusStr); + + if (!found) + found = true; + } + } + + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOQUESTFOUND); + + return true; + } + + static bool HandleLookupSkillCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // can be NULL in console call + Player* target = handler->getSelectedPlayer(); + + std::string namePart = args; + std::wstring wNamePart; + + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + // Search in SkillLine.dbc + for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++) + { + SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id); + if (skillInfo) + { + int locale = handler->GetSessionDbcLocale(); + std::string name = skillInfo->name[locale]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wNamePart)) + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = skillInfo->name[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + char valStr[50] = ""; + char const* knownStr = ""; + if (target && target->HasSkill(id)) + { + knownStr = handler->GetTrinityString(LANG_KNOWN); + uint32 curValue = target->GetPureSkillValue(id); + uint32 maxValue = target->GetPureMaxSkillValue(id); + uint32 permValue = target->GetSkillPermBonusValue(id); + uint32 tempValue = target->GetSkillTempBonusValue(id); + + char const* valFormat = handler->GetTrinityString(LANG_SKILL_VALUES); + snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue); + } + + // send skill in "id - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[locale], knownStr, valStr); + else + handler->PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[locale], knownStr, valStr); + + if (!found) + found = true; + } + } + } + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOSKILLFOUND); + + return true; + } + + static bool HandleLookupSpellCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // can be NULL at console call + Player* target = handler->getSelectedPlayer(); + + std::string namePart = args; + std::wstring wNamePart; + + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + // Search in Spell.dbc + for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); + if (spellInfo) + { + int locale = handler->GetSessionDbcLocale(); + std::string name = spellInfo->SpellName[locale]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wNamePart)) + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = spellInfo->SpellName[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + bool known = target && target->HasSpell(id); + bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); + + SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell); + + uint32 talentCost = GetTalentSpellCost(id); + + bool talent = (talentCost > 0); + bool passive = spellInfo->IsPassive(); + bool active = target && target->HasAura(id); + + // unit32 used to prevent interpreting uint8 as char at output + // find rank of learned spell for learning spell, or talent rank + uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank(); + + // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format + std::ostringstream ss; + if (handler->GetSession()) + ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name; + else + ss << id << " - " << name; + + // include rank in link name + if (rank) + ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank; + + if (handler->GetSession()) + ss << ' ' << localeNames[locale] << "]|h|r"; + else + ss << ' ' << localeNames[locale]; + + if (talent) + ss << handler->GetTrinityString(LANG_TALENT); + if (passive) + ss << handler->GetTrinityString(LANG_PASSIVE); + if (learn) + ss << handler->GetTrinityString(LANG_LEARN); + if (known) + ss << handler->GetTrinityString(LANG_KNOWN); + if (active) + ss << handler->GetTrinityString(LANG_ACTIVE); + + handler->SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } + } + } + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND); + + return true; + } + + static bool HandleLookupTaxiNodeCommand(ChatHandler* handler, const char * args) + { + if (!*args) + return false; + + std::string namePart = args; + std::wstring wNamePart; + + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wNamePart); + + bool found = false; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + // Search in TaxiNodes.dbc + for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++) + { + TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id); + if (nodeEntry) + { + int locale = handler->GetSessionDbcLocale(); + std::string name = nodeEntry->name[locale]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wNamePart)) + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = nodeEntry->name[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[locale], + nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); + else + handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[locale], + nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); + + if (!found) + found = true; + } + } + } + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOTAXINODEFOUND); + + return true; + } + + // Find tele in game_tele order by name + static bool HandleLookupTeleCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->SendSysMessage(LANG_COMMAND_TELE_PARAMETER); + handler->SetSentErrorMessage(true); + return false; + } + + char const* str = strtok((char*)args, " "); + if (!str) + return false; + + std::string namePart = str; + std::wstring wNamePart; + + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wNamePart); + + std::ostringstream reply; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + bool limitReached = false; + + GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap(); + for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr) + { + GameTele const* tele = &itr->second; + + if (tele->wnameLow.find(wNamePart) == std::wstring::npos) + continue; + + if (maxResults && count++ == maxResults) + { + limitReached = true; + break; + } + + if (handler->GetSession()) + reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n"; + else + reply << " " << itr->first << ' ' << tele->name << "\n"; + } + + if (reply.str().empty()) + handler->SendSysMessage(LANG_COMMAND_TELE_NOLOCATION); + else + handler->PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str()); + + if (limitReached) + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + + return true; + } + + static bool HandleLookupTitleCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // can be NULL in console call + Player* target = handler->getSelectedPlayer(); + + // title name have single string arg for player name + char const* targetName = target ? target->GetName() : "NAME"; + + std::string namePart = args; + std::wstring wNamePart; + + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wNamePart); + + uint32 counter = 0; // Counter for figure out that we found smth. + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + // Search in CharTitles.dbc + for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) + { + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); + if (titleInfo) + { + int locale = handler->GetSessionDbcLocale(); + std::string name = titleInfo->name[locale]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wNamePart)) + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = titleInfo->name[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + if (maxResults && counter == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : ""; + + char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index + ? handler->GetTrinityString(LANG_ACTIVE) + : ""; + + char titleNameStr[80]; + snprintf(titleNameStr, 80, name.c_str(), targetName); + + // send title in "id (idx:idx) - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[locale], knownStr, activeStr); + else + handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[locale], knownStr, activeStr); + + ++counter; + } + } + } + if (counter == 0) // if counter == 0 then we found nth + handler->SendSysMessage(LANG_COMMAND_NOTITLEFOUND); + + return true; + } + + static bool HandleLookupMapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + /* + std::string namePart = args; + std::wstring wNamePart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namePart, wNamePart)) + return false; + + wstrToLower(wNamePart); + + bool found = false; + + // search in Map.dbc + for (uint32 id = 0; id < sMapStore.GetNumRows(); id++) + { + MapEntry const* MapInfo = sMapStore.LookupEntry(id); + if (MapInfo) + { + uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale(); + + std::string name = MapInfo->name[locale]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wNamePart)) + { + locale = LOCALE_enUS; + for (; locale < TOTAL_LOCALES; locale++) + { + if (handler->GetSession() && locale == handler->GetSession()->GetSessionDbcLocale()) + continue; + + name = MapInfo->name[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format + std::ostringstream ss; + + if (handler->GetSession()) + ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << ']'; + else // console + ss << id << " - [" << name << ']'; + + if (MapInfo->IsContinent()) + ss << handler->GetTrinityString(LANG_CONTINENT); + + switch (MapInfo->map_type) + { + case MAP_INSTANCE: ss << handler->GetTrinityString(LANG_INSTANCE); break; + case MAP_BATTLEGROUND: ss << handler->GetTrinityString(LANG_BATTLEGROUND); break; + case MAP_ARENA: ss << handler->GetTrinityString(LANG_ARENA); break; + } + + if (MapInfo->IsRaid()) + ss << handler->GetTrinityString(LANG_RAID); + + if (MapInfo->SupportsHeroicMode()) + ss << handler->GetTrinityString(LANG_HEROIC); + + uint32 ResetTimeRaid = MapInfo->resetTimeRaid; + + std::string ResetTimeRaidStr; + if (ResetTimeRaid) + ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false); + + uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic; + std::string ResetTimeHeroicStr; + if (ResetTimeHeroic) + ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false); + + if (MapInfo->IsMountAllowed()) + ss << handler->GetTrinityString(LANG_MOUNTABLE); + + if (ResetTimeRaid && !ResetTimeHeroic) + handler->PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str()); + else if (!ResetTimeRaid && ResetTimeHeroic) + handler->PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str()); + else if (ResetTimeRaid && ResetTimeHeroic) + handler->PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str()); + else + handler->SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } + } + } + + if (!found) + handler->SendSysMessage(LANG_COMMAND_NOMAPFOUND); + */ + return true; + } + + static bool HandleLookupPlayerIpCommand(ChatHandler* handler, char const* args) + { + std::string ip; + int32 limit; + char* limitStr; + + Player* target = handler->getSelectedPlayer(); + if (!*args) + { + // NULL only if used from console + if (!target || target == handler->GetSession()->GetPlayer()) + return false; + + ip = target->GetSession()->GetRemoteAddress(); + limit = -1; + } + else + { + ip = strtok((char*)args, " "); + limitStr = strtok(NULL, " "); + limit = limitStr ? atoi(limitStr) : -1; + } + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP); + stmt->setString(0, ip); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + return LookupPlayerSearchCommand(result, limit, handler); + } + + static bool HandleLookupPlayerAccountCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string account = strtok((char*)args, " "); + char* limitStr = strtok(NULL, " "); + int32 limit = limitStr ? atoi(limitStr) : -1; + + if (!AccountMgr::normalizeString + (account)) + return false; + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME); + stmt->setString(0, account); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + return LookupPlayerSearchCommand(result, limit, handler); + } + + static bool HandleLookupPlayerEmailCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string email = strtok((char*)args, " "); + char* limitStr = strtok(NULL, " "); + int32 limit = limitStr ? atoi(limitStr) : -1; + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL); + stmt->setString(0, email); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + return LookupPlayerSearchCommand(result, limit, handler); + } + + static bool LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit, ChatHandler* handler) + { + if (!result) + { + handler->PSendSysMessage(LANG_NO_PLAYERS_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + int32 counter = 0; + uint32 count = 0; + uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + + do + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + Field* fields = result->Fetch(); + uint32 accountId = fields[0].GetUInt32(); + std::string accountName = fields[1].GetString(); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC); + stmt->setUInt32(0, accountId); + PreparedQueryResult result2 = CharacterDatabase.Query(stmt); + + if (result2) + { + handler->PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, accountName.c_str(), accountId); + + do + { + Field* characterFields = result2->Fetch(); + uint64 guid = characterFields[0].GetUInt64(); + std::string name = characterFields[1].GetString(); + + handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid); + ++counter; + } + while (result2->NextRow() && (limit == -1 || counter < limit)); + } + } + while (result->NextRow()); + + if (counter == 0) // empty accounts only + { + handler->PSendSysMessage(LANG_NO_PLAYERS_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } +}; + +void AddSC_lookup_commandscript() +{ + new lookup_commandscript(); +} -- cgit v1.2.3 From 27a59f3390b9af755bc36a4a951a6aaf91cd425d Mon Sep 17 00:00:00 2001 From: Exodius Date: Fri, 6 Jul 2012 22:28:03 +0200 Subject: [Script/ICC] Properly fix Dark Nucleus aggro problems and them not following you when they should. Closes #6589 Fix by @Marosa. Guidelines by @Kandera. --- .../Northrend/IcecrownCitadel/boss_blood_prince_council.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index d091a87dbfe..367240cd2df 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -1296,7 +1296,7 @@ class npc_dark_nucleus : public CreatureScript void Reset() { - me->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_DEFENSIVE); me->CastSpell(me, SPELL_SHADOW_RESONANCE_AURA, true); } @@ -1315,15 +1315,12 @@ class npc_dark_nucleus : public CreatureScript void MoveInLineOfSight(Unit* who) { - if (me->GetDistance(who) >= 15.0f) - return; - ScriptedAI::MoveInLineOfSight(who); } void DamageTaken(Unit* attacker, uint32& /*damage*/) { - if (attacker == me || attacker == me->getVictim()) + if (attacker == me) return; me->DeleteThreatList(); @@ -1345,6 +1342,8 @@ class npc_dark_nucleus : public CreatureScript DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST); me->ClearUnitState(UNIT_STATE_CASTING); } + else + MoveInLineOfSight(me->getVictim()); } else _targetAuraCheck -= diff; -- cgit v1.2.3 From 6a337bfa2369b2c08739bc3822fb62ca41dcde29 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 6 Jul 2012 16:57:13 -0400 Subject: Core/Loot: correctly fix rolling on quest loot that follows group loot rules via custom flags. --- src/server/game/Groups/Group.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 26faa7e6ae8..f9d609150ef 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -1283,7 +1283,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul); ItemPosCountVec dest; - LootItem* item = &(roll->getLoot()->items[roll->itemSlot]); + LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]); InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); if (msg == EQUIP_ERR_OK) { @@ -1332,7 +1332,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) { player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul); - LootItem* item = &(roll->getLoot()->items[roll->itemSlot]); + LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]); if (rollvote == GREED) { @@ -1369,7 +1369,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) SendLootAllPassed(*roll); // remove is_blocked so that the item is lootable by all players - LootItem* item = &(roll->getLoot()->items[roll->itemSlot]); + LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]); if (item) item->is_blocked = false; } -- cgit v1.2.3 From d4390c171ae3e6addfdbc205cbe426df34c08cc5 Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 6 Jul 2012 20:48:49 -0500 Subject: Fixed build --- src/server/scripts/Commands/cs_lookup.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 3c72b260086..2f422fd83d9 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "AccountMgr.h" #include "GameEventMgr.h" #include "ObjectAccessor.h" +#include "ObjectMgr.h" class lookup_commandscript : public CommandScript { -- cgit v1.2.3 From 26c36ba8543cae77af789276a25d4a3c3d06983d Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 6 Jul 2012 20:52:54 -0500 Subject: Miscellaneous: Unsigned expressions cant be negative --- src/server/scripts/Commands/cs_list.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 746956581a6..5c16a0963d3 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -80,7 +80,7 @@ public: char* countStr = strtok(NULL, " "); uint32 count = countStr ? atol(countStr) : 10; - if (count < 0) + if (count == 0) return false; QueryResult result; @@ -152,7 +152,7 @@ public: char* countStr = strtok(NULL, " "); uint32 count = countStr ? atol(countStr) : 10; - if (count < 0) + if (count == 0) return false; PreparedQueryResult result; @@ -369,7 +369,7 @@ public: char* countStr = strtok(NULL, " "); uint32 count = countStr ? atol(countStr) : 10; - if (count < 0) + if (count == 0) return false; QueryResult result; -- cgit v1.2.3 From 8c46681b447a0fd5d717a1706feec1d87eb7d9f0 Mon Sep 17 00:00:00 2001 From: Discover- Date: Sat, 7 Jul 2012 17:14:57 +0200 Subject: Core/LootMgr: Fix a little logging mistake on startup to prevent confusion. --- src/server/game/Loot/LootMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 8d80c145026..6df73c2ef69 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1599,9 +1599,9 @@ void LoadLootTemplates_Item() LootTemplates_Item.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 prospecting loot templates. DB table `item_loot_template` is empty"); + sLog->outErrorDb(">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); sLog->outString(); } -- cgit v1.2.3 From fc62678a45d4b9632a663858085287b875d9090d Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 9 Jul 2012 09:18:51 -0400 Subject: Core/Spells: correct sanctified wrath damage calculations. --- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 92f2f30b0ff..7f03bd3d5f9 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10686,7 +10686,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) { if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) - TakenTotalCasterMod += (float((*i)->GetAmount())/100); + TakenTotalCasterMod += (float((*i)->GetAmount())); } // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN @@ -11727,7 +11727,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) { if ((*i)->GetMiscValue() & attackSchoolMask) - TakenTotalCasterMod += (float((*i)->GetAmount())/100); + TakenTotalCasterMod += (float((*i)->GetAmount())); } // ..taken -- cgit v1.2.3 From d5836422ac821aa7fce0f49c4276a076257e76b3 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 9 Jul 2012 11:12:59 -0400 Subject: Core/Loot: couple of small changes to loot. --- src/server/game/Loot/LootMgr.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 6df73c2ef69..dea69e4622f 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -514,7 +514,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) { LootItem &item = quest_items[i]; - if ((!item.is_looted && item.AllowedForPlayer(player)) || (item.follow_loot_rules && player->GetGroup() && player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID())) + if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && (player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT ))) { ql->push_back(QuestItem(i)); @@ -522,11 +522,10 @@ QuestItemList* Loot::FillQuestLoot(Player* player) // player's quest vector // // increase once if one looter only, looter-times if free for all - if (item.freeforall && !item.is_blocked) - { + if (item.freeforall || !item.is_blocked) ++unlootedCount; + if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT || player->GetGroup()->GetLootMethod() != ROUND_ROBIN)) item.is_blocked = true; - } if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS) break; @@ -549,7 +548,7 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool pres for (uint8 i = 0; i < items.size(); ++i) { LootItem &item = items[i]; - if (!item.is_looted && !item.freeforall && (item.AllowedForPlayer(player)) || (item.follow_loot_rules && player->GetGroup() && player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID())) + if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && (player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT ))) { if (presentAtLooting) item.AddAllowedLooter(player); @@ -892,7 +891,6 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) } LootSlotType slotType = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT; - LootSlotType partySlotType = lv.permission == MASTER_PERMISSION ? LOOT_SLOT_TYPE_MASTER : (lv.permission == GROUP_PERMISSION ? LOOT_SLOT_TYPE_ROLL_ONGOING : slotType); QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems(); QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow()); if (q_itr != lootPlayerQuestItems.end()) @@ -913,8 +911,12 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) b << uint8(LOOT_SLOT_TYPE_MASTER); break; case GROUP_PERMISSION: + case ROUND_ROBIN_PERMISSION: if (!item.is_blocked) + { b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT); + item.is_blocked == true; + } else b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING); break; @@ -968,8 +970,12 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) b << uint8(LOOT_SLOT_TYPE_MASTER); break; case GROUP_PERMISSION: + case ROUND_ROBIN_PERMISSION: if (!item.is_blocked) + { b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT); + item.is_blocked == true; + } else b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING); break; -- cgit v1.2.3 From fcb4613245f837187679b2bb10ed9d22df15a3f9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 9 Jul 2012 13:00:35 -0400 Subject: Core/Loot: fix crash. --- src/server/game/Loot/LootMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index dea69e4622f..d8dc5284c9f 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -514,7 +514,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) { LootItem &item = quest_items[i]; - if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && (player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT ))) + if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT )))) { ql->push_back(QuestItem(i)); -- cgit v1.2.3 From 80664e242192d3e6f40256bb8738fc6d1cd8afce Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 9 Jul 2012 13:09:44 -0400 Subject: Core/Loot: typos! --- src/server/game/Loot/LootMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index d8dc5284c9f..e64367427e5 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -915,7 +915,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (!item.is_blocked) { b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT); - item.is_blocked == true; + item.is_blocked = true; } else b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING); @@ -974,7 +974,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (!item.is_blocked) { b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT); - item.is_blocked == true; + item.is_blocked = true; } else b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING); -- cgit v1.2.3 From 8f74498add8da89bfbb6df4ede3b517e919d229a Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 9 Jul 2012 13:36:52 -0400 Subject: Core/Loot: fix crash number 2 --- src/server/game/Loot/LootMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index e64367427e5..b7524f4d907 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -548,7 +548,7 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool pres for (uint8 i = 0; i < items.size(); ++i) { LootItem &item = items[i]; - if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && (player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT ))) + if (!item.is_looted && !item.freeforall && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT )))) { if (presentAtLooting) item.AddAllowedLooter(player); -- cgit v1.2.3 From a24b6576e2b3fbda0a1356197984aadba1bdde55 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 9 Jul 2012 13:42:38 -0400 Subject: Core/Loot: fix small error --- src/server/game/Loot/LootMgr.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index b7524f4d907..0520392461f 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -913,10 +913,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) case GROUP_PERMISSION: case ROUND_ROBIN_PERMISSION: if (!item.is_blocked) - { b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT); - item.is_blocked = true; - } else b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING); break; @@ -972,10 +969,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) case GROUP_PERMISSION: case ROUND_ROBIN_PERMISSION: if (!item.is_blocked) - { b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT); - item.is_blocked = true; - } else b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING); break; -- cgit v1.2.3 From 450f9e7d99879903bc919981668b1ac847631bc2 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 10 Jul 2012 16:19:18 -0400 Subject: Core/Escort: fix issues with escorts not attacking enemies. --- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 2243734f642..863040142be 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -462,6 +462,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false //disable npcflags me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); -- cgit v1.2.3 From 0ac9c5b0399ee6fba0e2334ceddba87b0f67b053 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 10 Jul 2012 17:27:13 -0400 Subject: Core/Escort: few modifications to add the IMMUNE_TO_NPC flag after npc does a full reset. --- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 11 +++++++++-- src/server/game/AI/ScriptedAI/ScriptedEscortAI.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 863040142be..c7751fc7383 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -32,7 +32,8 @@ npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature), m_bCanReturnToStart(false), DespawnAtEnd(true), DespawnAtFar(true), - ScriptWP(false) + ScriptWP(false), + HasImmuneToNPCFlags(false) {} void npc_escortAI::AttackStart(Unit* who) @@ -179,6 +180,8 @@ void npc_escortAI::EnterEvadeMode() else { me->GetMotionMaster()->MoveTargetedHome(); + if (HasImmuneToNPCFlags) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); Reset(); } } @@ -462,7 +465,11 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false //disable npcflags me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) + { + HasImmuneToNPCFlags = true; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + } sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 24d15f9079b..7a7fab014dc 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -120,6 +120,7 @@ struct npc_escortAI : public ScriptedAI bool DespawnAtEnd; bool DespawnAtFar; bool ScriptWP; + bool HasImmuneToNPCFlags; }; #endif -- cgit v1.2.3 From 968a8e8ee83019aa618d67ccfa6b1c458abe243b Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 10 Jul 2012 22:27:29 +0200 Subject: Core/Spells: Fix Pain and Suffering reduces damage --- .../2012_07_10_00_world_spell_script_names.sql | 3 ++ src/server/game/Spells/Auras/SpellAuraEffects.cpp | 15 --------- src/server/game/Spells/SpellEffects.cpp | 14 +------- src/server/scripts/Spells/spell_priest.cpp | 37 +++++++++++++++++++++- 4 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 sql/updates/world/2012_07_10_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_07_10_00_world_spell_script_names.sql b/sql/updates/world/2012_07_10_00_world_spell_script_names.sql new file mode 100644 index 00000000000..15ca9c43cc5 --- /dev/null +++ b/sql/updates/world/2012_07_10_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=-32379; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(-32379,'spell_pri_shadow_word_death'); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a4acff2a47c..85ec8341096 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -858,21 +858,6 @@ void AuraEffect::CalculateSpellMod() case SPELL_AURA_DUMMY: switch (GetSpellInfo()->SpellFamilyName) { - case SPELLFAMILY_PRIEST: - // Pain and Suffering - if (m_spellInfo->SpellIconID == 2874) - { - if (!m_spellmod) - { - m_spellmod = new SpellModifier(GetBase()); - m_spellmod->op = SPELLMOD_DOT; - m_spellmod->type = SPELLMOD_PCT; - m_spellmod->spellId = GetId(); - m_spellmod->mask[1] = 0x00002000; - } - m_spellmod->value = GetAmount(); - } - break; case SPELLFAMILY_DRUID: switch (GetId()) { diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index dd674672935..eec3439bb42 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -463,20 +463,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) } case SPELLFAMILY_PRIEST: { - // Shadow Word: Death - deals damage equal to damage done to caster - if (m_spellInfo->SpellFamilyFlags[1] & 0x2) - { - int32 back_damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); - back_damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, (uint32)back_damage, SPELL_DIRECT_DAMAGE); - // Pain and Suffering reduces damage - if (AuraEffect* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0)) - AddPctN(back_damage, -aurEff->GetAmount()); - - if (back_damage < int32(unitTarget->GetHealth())) - m_caster->CastCustomSpell(m_caster, 32409, &back_damage, 0, 0, true); - } // Improved Mind Blast (Mind Blast in shadow form bonus) - else if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000)) + if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000)) { Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_FLAT_MODIFIER); for (Unit::AuraEffectList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i) diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index aab1e974e53..3d8ca3e729b 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -37,6 +37,8 @@ enum PriestSpells PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL = 64085, PRIEST_SPELL_EMPOWERED_RENEW = 63544, PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT = 3021, + PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874, + PRIEST_SHADOW_WORD_DEATH = 32409, }; // Guardian Spirit @@ -311,7 +313,7 @@ public: { if (Unit* caster = GetOriginalCaster()) { - if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE,EFFECT_0)) + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE, EFFECT_0)) { int32 heal = GetHitHeal(); AddPctN(heal, aurEff->GetAmount()); @@ -415,6 +417,38 @@ class spell_priest_renew : public SpellScriptLoader } }; +class spell_pri_shadow_word_death : public SpellScriptLoader +{ + public: + spell_pri_shadow_word_death() : SpellScriptLoader("spell_pri_shadow_word_death") { } + + class spell_pri_shadow_word_death_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pri_shadow_word_death_SpellScript); + + void HandleDamage() + { + int32 damage = GetHitDamage(); + + // Pain and Suffering reduces damage + if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1)) + AddPctN(damage, aurEff->GetAmount()); + + GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true); + } + + void Register() + { + OnHit += SpellHitFn(spell_pri_shadow_word_death_SpellScript::HandleDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pri_shadow_word_death_SpellScript(); + } +}; + void AddSC_priest_spell_scripts() { new spell_pri_guardian_spirit(); @@ -426,4 +460,5 @@ void AddSC_priest_spell_scripts() new spell_pri_prayer_of_mending_heal(); new spell_pri_vampiric_touch(); new spell_priest_renew(); + new spell_pri_shadow_word_death(); } -- cgit v1.2.3 From 176a2c1080c609138b7291828c905cdb979e1f3e Mon Sep 17 00:00:00 2001 From: leak Date: Fri, 13 Jul 2012 09:11:05 +0200 Subject: Core/Warden: Workaround for an OpenSSL bug in the ARC4 stream cipher initialization that causes crashes on some OS - Skip loading warden_action overrides when warden is disabled fixes #6486 --- src/server/game/Warden/WardenCheckMgr.cpp | 8 ++++++++ src/server/shared/Cryptography/ARC4.cpp | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index abd7ff8f87d..0677758439f 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -151,6 +151,14 @@ void WardenCheckMgr::LoadWardenChecks() void WardenCheckMgr::LoadWardenOverrides() { + // Check if Warden is enabled by config before loading anything + if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) + { + sLog->outString(">> Warden disabled, loading check overrides skipped."); + sLog->outString(); + return; + } + // 0 1 QueryResult result = CharacterDatabase.Query("SELECT wardenId, action FROM warden_action"); diff --git a/src/server/shared/Cryptography/ARC4.cpp b/src/server/shared/Cryptography/ARC4.cpp index 52a60573eca..5b2cf7a0a93 100755 --- a/src/server/shared/Cryptography/ARC4.cpp +++ b/src/server/shared/Cryptography/ARC4.cpp @@ -19,14 +19,14 @@ #include "ARC4.h" #include -ARC4::ARC4(uint8 len) +ARC4::ARC4(uint8 len) : m_ctx() { EVP_CIPHER_CTX_init(&m_ctx); EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL); EVP_CIPHER_CTX_set_key_length(&m_ctx, len); } -ARC4::ARC4(uint8 *seed, uint8 len) +ARC4::ARC4(uint8 *seed, uint8 len) : m_ctx() { EVP_CIPHER_CTX_init(&m_ctx); EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL); -- cgit v1.2.3 From e757ebf6ba441358ec5b53bceef54f35fdfa929e Mon Sep 17 00:00:00 2001 From: NNN666 Date: Fri, 13 Jul 2012 15:16:37 +0200 Subject: Core/Player: Fix issues with 'ignore this slot' option on equipment manager usage --- sql/base/characters_database.sql | 39 +++++++++++----------- ...06_13_00_characters_character_equipmentsets.sql | 22 ++++++++++++ src/server/game/Entities/Player/Player.cpp | 13 ++++++-- src/server/game/Entities/Player/Player.h | 3 +- src/server/game/Handlers/CharacterHandler.cpp | 12 +++++++ .../Database/Implementation/CharacterDatabase.cpp | 6 ++-- 6 files changed, 70 insertions(+), 25 deletions(-) create mode 100644 sql/updates/characters/2012_06_13_00_characters_character_equipmentsets.sql (limited to 'src') diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index 57e5f6f6ab7..b4a3af6e8ff 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -547,25 +547,26 @@ CREATE TABLE `character_equipmentsets` ( `setindex` tinyint(3) unsigned NOT NULL DEFAULT '0', `name` varchar(31) NOT NULL, `iconname` varchar(100) NOT NULL, - `item0` int(10) unsigned NOT NULL DEFAULT '0', - `item1` int(10) unsigned NOT NULL DEFAULT '0', - `item2` int(10) unsigned NOT NULL DEFAULT '0', - `item3` int(10) unsigned NOT NULL DEFAULT '0', - `item4` int(10) unsigned NOT NULL DEFAULT '0', - `item5` int(10) unsigned NOT NULL DEFAULT '0', - `item6` int(10) unsigned NOT NULL DEFAULT '0', - `item7` int(10) unsigned NOT NULL DEFAULT '0', - `item8` int(10) unsigned NOT NULL DEFAULT '0', - `item9` int(10) unsigned NOT NULL DEFAULT '0', - `item10` int(10) unsigned NOT NULL DEFAULT '0', - `item11` int(10) unsigned NOT NULL DEFAULT '0', - `item12` int(10) unsigned NOT NULL DEFAULT '0', - `item13` int(10) unsigned NOT NULL DEFAULT '0', - `item14` int(10) unsigned NOT NULL DEFAULT '0', - `item15` int(10) unsigned NOT NULL DEFAULT '0', - `item16` int(10) unsigned NOT NULL DEFAULT '0', - `item17` int(10) unsigned NOT NULL DEFAULT '0', - `item18` int(10) unsigned NOT NULL DEFAULT '0', + `ignore_mask` int(11) unsigned NOT NULL DEFAULT '0', + `item0` int(11) unsigned NOT NULL DEFAULT '0', + `item1` int(11) unsigned NOT NULL DEFAULT '0', + `item2` int(11) unsigned NOT NULL DEFAULT '0', + `item3` int(11) unsigned NOT NULL DEFAULT '0', + `item4` int(11) unsigned NOT NULL DEFAULT '0', + `item5` int(11) unsigned NOT NULL DEFAULT '0', + `item6` int(11) unsigned NOT NULL DEFAULT '0', + `item7` int(11) unsigned NOT NULL DEFAULT '0', + `item8` int(11) unsigned NOT NULL DEFAULT '0', + `item9` int(11) unsigned NOT NULL DEFAULT '0', + `item10` int(11) unsigned NOT NULL DEFAULT '0', + `item11` int(11) unsigned NOT NULL DEFAULT '0', + `item12` int(11) unsigned NOT NULL DEFAULT '0', + `item13` int(11) unsigned NOT NULL DEFAULT '0', + `item14` int(11) unsigned NOT NULL DEFAULT '0', + `item15` int(11) unsigned NOT NULL DEFAULT '0', + `item16` int(11) unsigned NOT NULL DEFAULT '0', + `item17` int(11) unsigned NOT NULL DEFAULT '0', + `item18` int(11) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`setguid`), UNIQUE KEY `idx_set` (`guid`,`setguid`,`setindex`), KEY `Idx_setindex` (`setindex`) diff --git a/sql/updates/characters/2012_06_13_00_characters_character_equipmentsets.sql b/sql/updates/characters/2012_06_13_00_characters_character_equipmentsets.sql new file mode 100644 index 00000000000..ebf12062be3 --- /dev/null +++ b/sql/updates/characters/2012_06_13_00_characters_character_equipmentsets.sql @@ -0,0 +1,22 @@ +ALTER TABLE `character_equipmentsets` +MODIFY COLUMN `item0` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item1` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item2` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item3` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item4` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item5` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item6` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item7` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item8` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item9` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item10` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item11` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item12` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item13` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item14` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item15` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item16` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item17` int(11) unsigned NOT NULL DEFAULT 0, +MODIFY COLUMN `item18` int(11) unsigned NOT NULL DEFAULT 0; + +ALTER TABLE `character_equipmentsets` ADD COLUMN `ignore_mask` int(11) unsigned NOT NULL DEFAULT 0 AFTER `iconname`; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index c38ceb6f57a..e24882e1451 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -16677,10 +16677,11 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result) uint8 index = fields[1].GetUInt8(); eqSet.Name = fields[2].GetString(); eqSet.IconName = fields[3].GetString(); + eqSet.IgnoreMask = fields[4].GetUInt32(); eqSet.state = EQUIPMENT_SET_UNCHANGED; for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) - eqSet.Items[i] = fields[4+i].GetUInt32(); + eqSet.Items[i] = fields[5+i].GetUInt32(); m_EquipmentSets[index] = eqSet; @@ -24822,7 +24823,13 @@ void Player::SendEquipmentSetList() data << itr->second.Name; data << itr->second.IconName; for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) - data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM)); + { + // ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM + if (itr->second.IgnoreMask & (1 << i)) + data.appendPackGUID(MAKE_NEW_GUID(uint64(1))); + else + data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM)); + } ++count; // client have limit but it checked at loading and set } @@ -24888,6 +24895,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans) stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_EQUIP_SET); stmt->setString(j++, eqset.Name.c_str()); stmt->setString(j++, eqset.IconName.c_str()); + stmt->setUInt32(j++, eqset.IgnoreMask); for (uint8 i=0; isetUInt32(j++, eqset.Items[i]); stmt->setUInt32(j++, GetGUIDLow()); @@ -24904,6 +24912,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans) stmt->setUInt32(j++, index); stmt->setString(j++, eqset.Name.c_str()); stmt->setString(j++, eqset.IconName.c_str()); + stmt->setUInt32(j++, eqset.IgnoreMask); for (uint8 i=0; isetUInt32(j++, eqset.Items[i]); trans->Append(stmt); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index b0cbb5c7927..b1e4e81900d 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -640,7 +640,7 @@ enum EquipmentSetUpdateState struct EquipmentSet { - EquipmentSet() : Guid(0), state(EQUIPMENT_SET_NEW) + EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW) { for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) Items[i] = 0; @@ -649,6 +649,7 @@ struct EquipmentSet uint64 Guid; std::string Name; std::string IconName; + uint32 IgnoreMask; uint32 Items[EQUIPMENT_SLOT_END]; EquipmentSetUpdateState state; }; diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 2d70efd3305..29ee2b5cb41 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1514,6 +1514,14 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data) uint64 itemGuid; recv_data.readPackGUID(itemGuid); + // equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set) + if (itemGuid == 1) + { + // ignored slots saved as bit mask because we have no free special values for Items[i] + eqSet.IgnoreMask |= 1 << i; + continue; + } + Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!item && itemGuid) // cheating check 1 @@ -1555,6 +1563,10 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); + // check if item slot is set to "ignored" (raw value == 1), must not be unequipped then + if (itemGuid == 1) + continue; + Item* item = _player->GetItemByGuid(itemGuid); uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 89cc6ab25e5..3bb6783f8cf 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -94,7 +94,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_GUILD_MEMBER, "SELECT guildid, rank FROM guild_member WHERE guid = ?", CONNECTION_BOTH) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_CRITERIAPROGRESS, "SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = ?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_SEL_CHARACTER_EQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, " + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_EQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, " "item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = ? ORDER BY setindex", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_BGDATA, "SELECT instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell FROM character_battleground_data WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_GLYPHS, "SELECT spec, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 FROM character_glyphs WHERE guid = ?", CONNECTION_ASYNC) @@ -235,8 +235,8 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_OLD_CHANNELS, "DELETE FROM channels WHERE ownership = 1 AND lastUsed + ? < UNIX_TIMESTAMP()", CONNECTION_ASYNC) // Equipmentsets - PREPARE_STATEMENT(CHAR_UPD_EQUIP_SET, "UPDATE character_equipmentsets SET name=?, iconname=?, item0=?, item1=?, item2=?, item3=?, item4=?, item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_INS_EQUIP_SET, "INSERT INTO character_equipmentsets (guid, setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_UPD_EQUIP_SET, "UPDATE character_equipmentsets SET name=?, iconname=?, ignore_mask=?, item0=?, item1=?, item2=?, item3=?, item4=?, item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_INS_EQUIP_SET, "INSERT INTO character_equipmentsets (guid, setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_EQUIP_SET, "DELETE FROM character_equipmentsets WHERE setguid=?", CONNECTION_ASYNC) // Auras -- cgit v1.2.3 From 1036b0863b349c61bf65d48e7b2750d296a1ae5f Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 13 Jul 2012 10:48:06 -0400 Subject: Core/Spells: fix proc for king of the jungle talent. closes #5983 --- sql/updates/world/2012_07_13_00_world_spell_proc_event.sql | 1 + src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 sql/updates/world/2012_07_13_00_world_spell_proc_event.sql (limited to 'src') diff --git a/sql/updates/world/2012_07_13_00_world_spell_proc_event.sql b/sql/updates/world/2012_07_13_00_world_spell_proc_event.sql new file mode 100644 index 00000000000..952a4502b30 --- /dev/null +++ b/sql/updates/world/2012_07_13_00_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE `spell_proc_event` SET `procFlags` = 16384 WHERE `entry` in (48492,48494,48495); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7f03bd3d5f9..fe67a36c163 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6423,7 +6423,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Effect 0 - mod damage while having Enrage if (effIndex == 0) { - if (!(procSpell->SpellFamilyFlags[0] & 0x00080000)) + if (!(procSpell->SpellFamilyFlags[0] & 0x00080000) || procSpell->SpellIconID != 916) return false; triggered_spell_id = 51185; basepoints0 = triggerAmount; @@ -6433,7 +6433,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Effect 1 - Tiger's Fury restore energy else if (effIndex == 1) { - if (!(procSpell->SpellFamilyFlags[2] & 0x00000800)) + if (!(procSpell->SpellFamilyFlags[2] & 0x00000800) || procSpell->SpellIconID != 1181) return false; triggered_spell_id = 51178; basepoints0 = triggerAmount; -- cgit v1.2.3 From 8ffafdc859a1d591bc5d29674b4576c2d32bf29c Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 13 Jul 2012 16:56:58 +0200 Subject: Core: Fix build --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index e24882e1451..5e227e43a42 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -24826,7 +24826,7 @@ void Player::SendEquipmentSetList() { // ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM if (itr->second.IgnoreMask & (1 << i)) - data.appendPackGUID(MAKE_NEW_GUID(uint64(1))); + data.appendPackGUID(uint64(1)); else data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM)); } -- cgit v1.2.3 From 1fa0177bb06d53969a457c4eb71ec6b495213f5a Mon Sep 17 00:00:00 2001 From: Faq Date: Fri, 13 Jul 2012 18:42:28 +0300 Subject: Core/Spells - Idol of the Crying Wind; + Fixing typo; --- .../2012_07_13_00_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_dk.cpp | 4 +-- src/server/scripts/Spells/spell_druid.cpp | 32 +++++++++++++++++++++- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/2012_07_13_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_07_13_00_world_spell_script_names.sql b/sql/updates/world/2012_07_13_00_world_spell_script_names.sql new file mode 100644 index 00000000000..64500418871 --- /dev/null +++ b/sql/updates/world/2012_07_13_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE (`spell_id`='-5570'); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(-5570, 'spell_dru_insect_swarm'); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 5095092927e..a1c48878507 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -40,7 +40,7 @@ enum DeathKnightSpells DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, DK_SPELL_UNHOLY_PRESENCE = 48265, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622, - SPELL_DK_ITEM_T8_MALEE_4P_BONUS = 64736, + SPELL_DK_ITEM_T8_MELEE_4P_BONUS = 64736, DK_SPELL_BLACK_ICE_R1 = 49140, }; @@ -412,7 +412,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader { multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f); // Death Knight T8 Melee 4P Bonus - if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MALEE_4P_BONUS, EFFECT_0)) + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0)) AddPctF(multiplier, aurEff->GetAmount()); } } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index f1f624fa8e9..4dd115f22ca 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -32,7 +32,8 @@ enum DruidSpells DRUID_LIFEBLOOM_FINAL_HEAL = 33778, DRUID_LIFEBLOOM_ENERGIZE = 64372, DRUID_SURVIVAL_INSTINCTS = 50322, - DRUID_SAVAGE_ROAR = 62071 + DRUID_SAVAGE_ROAR = 62071, + SPELL_DRUID_ITEM_T8_BALANCE_RELIC = 64950, }; // 54846 Glyph of Starfire @@ -615,6 +616,34 @@ class spell_dru_survival_instincts : public SpellScriptLoader } }; +class spell_dru_insect_swarm : public SpellScriptLoader +{ + public: + spell_dru_insect_swarm() : SpellScriptLoader("spell_dru_insect_swarm") { } + + class spell_dru_insect_swarm_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_insect_swarm_AuraScript); + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + if (Unit* caster = GetCaster()) + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DRUID_ITEM_T8_BALANCE_RELIC, EFFECT_0)) + amount += aurEff->GetAmount(); + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_insect_swarm_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dru_insect_swarm_AuraScript(); + } +}; + void AddSC_druid_spell_scripts() { new spell_dru_glyph_of_starfire(); @@ -629,4 +658,5 @@ void AddSC_druid_spell_scripts() new spell_dru_predatory_strikes(); new spell_dru_savage_roar(); new spell_dru_survival_instincts(); + new spell_dru_insect_swarm(); } -- cgit v1.2.3 From b57a87cafa3989a1817bc8e2e10377f96cd0a206 Mon Sep 17 00:00:00 2001 From: Faq Date: Fri, 13 Jul 2012 18:52:37 +0300 Subject: Core/Spellaura: Fix Idol of Worship --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a4acff2a47c..025ebb7275f 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -627,7 +627,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster) uint8 cp = caster->ToPlayer()->GetComboPoints(); // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs - if (AuraEffect const* aurEff = caster->GetAuraEffect(34241, 0)) + if (AuraEffect const* aurEff = caster->GetAuraEffect(34241, EFFECT_0)) + amount += cp * aurEff->GetAmount(); + // Idol of Worship. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs + else if (AuraEffect const* aurEff = caster->GetAuraEffect(60774, EFFECT_0)) amount += cp * aurEff->GetAmount(); amount += uint32(CalculatePctU(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp)); -- cgit v1.2.3 From 2c6c74f21cd2b42e1dc78166c451e5d9fa20e957 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 13 Jul 2012 12:36:44 -0400 Subject: Core/Instance: fix attumen/midnight encounter (thx zwerg) closes #6188 --- src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 2bba875ad1f..d8be6ffc0ca 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -79,6 +79,12 @@ public: void Reset() { + ResetTimer = 0; + } + + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); ResetTimer = 2000; } -- cgit v1.2.3 From 6b843ca86b4854c75f26ded160f0930ea6a77803 Mon Sep 17 00:00:00 2001 From: LordJZ Date: Sat, 14 Jul 2012 07:14:39 +0400 Subject: Allow for GM ticket response text up to 15999 characters. --- src/server/game/Tickets/TicketMgr.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index f82c01adf31..68786ad0cec 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -144,11 +144,24 @@ void GmTicket::SendResponse(WorldSession* session) const data << uint32(1); // responseID data << uint32(_id); // ticketID data << _message.c_str(); - data << _response.c_str(); - // 3 null strings (unused) - data << uint8(0); - data << uint8(0); - data << uint8(0); + + size_t len = _response.size(); + char const* s = _response.c_str(); + + for (int i = 0; i < 4; i++) + { + if (len) + { + size_t writeLen = std::min(len, 3999); + data.append(s, writeLen); + + len -= writeLen; + s += writeLen; + } + + data << uint8(0); + } + session->SendPacket(&data); } -- cgit v1.2.3 From 513550aedfc91e9cc86767f1b0c2637f23f3a6e2 Mon Sep 17 00:00:00 2001 From: LordJZ Date: Sat, 14 Jul 2012 07:15:39 +0400 Subject: Drop obsolete check. --- src/server/game/Tickets/TicketMgr.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 68786ad0cec..e43d6ca5443 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -384,17 +384,7 @@ void TicketMgr::SendTicket(WorldSession* session, GmTicket* ticket) const // we've got the easy stuff done by now. // Now we need to go through the client logic for displaying various levels of ticket load - if (ticket) - ticket->WritePacket(data); - else - { - // we can't actually get any numbers here... - data << float(0); - data << float(0); - data << float(1); - data << uint8(0); - data << uint8(0); - } + ticket->WritePacket(data); } session->SendPacket(&data); } -- cgit v1.2.3 From 9e8494291791f38e5267a3a2603852f7a6bb1482 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 7 Jul 2012 14:04:57 +0200 Subject: Core/Commands: Convert ban / unban / baninfo / banlist commands in commandscript --- src/server/game/Chat/Chat.cpp | 38 -- src/server/game/Chat/Chat.h | 21 - src/server/game/Chat/Commands/Level3.cpp | 632 ------------------------- src/server/game/Scripting/ScriptLoader.cpp | 10 +- src/server/scripts/Commands/CMakeLists.txt | 5 +- src/server/scripts/Commands/cs_ban.cpp | 718 +++++++++++++++++++++++++++++ src/server/scripts/Commands/cs_lookup.cpp | 2 +- 7 files changed, 726 insertions(+), 700 deletions(-) create mode 100644 src/server/scripts/Commands/cs_ban.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 562965145bf..110be872b9a 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -67,31 +67,6 @@ static size_t appendCommandTable(ChatCommand* target, const ChatCommand* source) ChatCommand* ChatHandler::getCommandTable() { - static ChatCommand banCommandTable[] = - { - { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanAccountCommand>, "", NULL }, - { "character", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanCharacterCommand>, "", NULL }, - { "playeraccount", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanAccountByCharCommand>, "", NULL }, - { "ip", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanIPCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand baninfoCommandTable[] = - { - { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanInfoAccountCommand>, "", NULL }, - { "character", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanInfoCharacterCommand>, "", NULL }, - { "ip", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanInfoIPCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand banlistCommandTable[] = - { - { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanListAccountCommand>, "", NULL }, - { "character", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanListCharacterCommand>, "", NULL }, - { "ip", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanListIPCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand channelSetCommandTable[] = { { "ownership", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleChannelSetOwnership>, "", NULL }, @@ -136,15 +111,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand unbanCommandTable[] = - { - { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanAccountCommand>, "", NULL }, - { "character", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanCharacterCommand>, "", NULL }, - { "playeraccount", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanAccountByCharCommand>, "", NULL }, - { "ip", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanIPCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand ticketResponseCommandTable[] = { { "append", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketResponseAppendCommand>, "", NULL }, @@ -208,10 +174,6 @@ ChatCommand* ChatHandler::getCommandTable() { "save", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleSaveCommand>, "", NULL }, { "saveall", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleSaveAllCommand>, "", NULL }, { "kick", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleKickPlayerCommand>, "", NULL }, - { "ban", SEC_ADMINISTRATOR, true, NULL, "", banCommandTable }, - { "unban", SEC_ADMINISTRATOR, true, NULL, "", unbanCommandTable }, - { "baninfo", SEC_ADMINISTRATOR, false, NULL, "", baninfoCommandTable }, - { "banlist", SEC_ADMINISTRATOR, true, NULL, "", banlistCommandTable }, { "start", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleStartCommand>, "", NULL }, { "taxicheat", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleTaxiCheatCommand>, "", NULL }, { "linkgrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLinkGraveCommand>, "", NULL }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 77280e7ddef..47734036071 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -139,17 +139,6 @@ class ChatHandler bool HandleGMAnnounceCommand(const char* args); bool HandleGMNotifyCommand(const char* args); - bool HandleBanAccountCommand(const char* args); - bool HandleBanAccountByCharCommand(const char* args); - bool HandleBanCharacterCommand(const char* args); - bool HandleBanIPCommand(const char* args); - bool HandleBanInfoAccountCommand(const char* args); - bool HandleBanInfoCharacterCommand(const char* args); - bool HandleBanInfoIPCommand(const char* args); - bool HandleBanListAccountCommand(const char* args); - bool HandleBanListCharacterCommand(const char* args); - bool HandleBanListIPCommand(const char* args); - bool HandleChannelSetOwnership(const char *args); bool HandlePossessCommand(const char* args); @@ -165,11 +154,6 @@ class ChatHandler bool HandleSendMessageCommand(const char * args); bool HandleSendMoneyCommand(const char* args); - bool HandleUnBanAccountCommand(const char* args); - bool HandleUnBanAccountByCharCommand(const char* args); - bool HandleUnBanCharacterCommand(const char* args); - bool HandleUnBanIPCommand(const char* args); - bool HandleHelpCommand(const char* args); bool HandleCommandsCommand(const char* args); bool HandleStartCommand(const char* args); @@ -272,11 +256,6 @@ class ChatHandler bool HandleSaveAllCommand(const char* args); // Utility methods for commands - bool LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit); - bool HandleBanListHelper(PreparedQueryResult result); - bool HandleBanHelper(BanMode mode, char const* args); - bool HandleBanInfoHelper(uint32 accountid, char const* accountname); - bool HandleUnBanHelper(BanMode mode, char const* args); void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id); private: diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 7f02c7a1815..5b93b899898 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -936,638 +936,6 @@ bool ChatHandler::HandleChangeWeather(const char *args) return true; } - -bool ChatHandler::HandleBanAccountCommand(const char *args) -{ - return HandleBanHelper(BAN_ACCOUNT, args); -} - -bool ChatHandler::HandleBanAccountByCharCommand(const char *args) -{ - return HandleBanHelper(BAN_CHARACTER, args); -} - -bool ChatHandler::HandleBanCharacterCommand(const char *args) -{ - if (!*args) - return false; - - char* cname = strtok((char*)args, " "); - if (!cname) - return false; - - std::string name = cname; - - char* duration = strtok(NULL, " "); - if (!duration || !atoi(duration)) - return false; - - char* reason = strtok(NULL, ""); - if (!reason) - return false; - - if (!normalizePlayerName(name)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - switch (sWorld->BanCharacter(name, duration, reason, m_session ? m_session->GetPlayerName() : "")) - { - case BAN_SUCCESS: - { - if (atoi(duration) > 0) - PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(duration), true).c_str(), reason); - else - PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reason); - break; - } - case BAN_NOTFOUND: - { - PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str()); - SetSentErrorMessage(true); - return false; - } - default: - break; - } - - return true; -} - -bool ChatHandler::HandleBanIPCommand(const char *args) -{ - return HandleBanHelper(BAN_IP, args); -} - -bool ChatHandler::HandleBanHelper(BanMode mode, const char *args) -{ - if (!*args) - return false; - - char* cnameOrIP = strtok ((char*)args, " "); - if (!cnameOrIP) - return false; - - std::string nameOrIP = cnameOrIP; - - char* duration = strtok (NULL, " "); - if (!duration || !atoi(duration)) - return false; - - char* reason = strtok (NULL, ""); - if (!reason) - return false; - - switch (mode) - { - case BAN_ACCOUNT: - if (!AccountMgr::normalizeString(nameOrIP)) - { - PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str()); - SetSentErrorMessage(true); - return false; - } - break; - case BAN_CHARACTER: - if (!normalizePlayerName(nameOrIP)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - break; - case BAN_IP: - if (!IsIPAddress(nameOrIP.c_str())) - return false; - break; - } - - switch (sWorld->BanAccount(mode, nameOrIP, duration, reason, m_session ? m_session->GetPlayerName() : "")) - { - case BAN_SUCCESS: - if (atoi(duration)>0) - PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(duration), true).c_str(), reason); - else - PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reason); - break; - case BAN_SYNTAX_ERROR: - return false; - case BAN_NOTFOUND: - switch (mode) - { - default: - PSendSysMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str()); - break; - case BAN_CHARACTER: - PSendSysMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str()); - break; - case BAN_IP: - PSendSysMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str()); - break; - } - SetSentErrorMessage(true); - return false; - } - - return true; -} - -bool ChatHandler::HandleUnBanAccountCommand(const char *args) -{ - return HandleUnBanHelper(BAN_ACCOUNT, args); -} - -bool ChatHandler::HandleUnBanAccountByCharCommand(const char *args) -{ - return HandleUnBanHelper(BAN_CHARACTER, args); -} - -bool ChatHandler::HandleUnBanCharacterCommand(const char *args) -{ - if (!*args) - return false; - - char* cname = strtok((char*)args, " "); - if (!cname) - return false; - - std::string name = cname; - - if (!normalizePlayerName(name)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - if (!sWorld->RemoveBanCharacter(name)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - return true; -} - -bool ChatHandler::HandleUnBanIPCommand(const char *args) -{ - return HandleUnBanHelper(BAN_IP, args); -} - -bool ChatHandler::HandleUnBanHelper(BanMode mode, const char *args) -{ - if (!*args) - return false; - - char* cnameOrIP = strtok ((char*)args, " "); - if (!cnameOrIP) - return false; - - std::string nameOrIP = cnameOrIP; - - switch (mode) - { - case BAN_ACCOUNT: - if (!AccountMgr::normalizeString(nameOrIP)) - { - PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str()); - SetSentErrorMessage(true); - return false; - } - break; - case BAN_CHARACTER: - if (!normalizePlayerName(nameOrIP)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - break; - case BAN_IP: - if (!IsIPAddress(nameOrIP.c_str())) - return false; - break; - } - - if (sWorld->RemoveBanAccount(mode, nameOrIP)) - PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str()); - else - PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str()); - - return true; -} - -bool ChatHandler::HandleBanInfoAccountCommand(const char *args) -{ - if (!*args) - return false; - - char* cname = strtok((char*)args, ""); - if (!cname) - return false; - - std::string account_name = cname; - if (!AccountMgr::normalizeString(account_name)) - { - PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); - SetSentErrorMessage(true); - return false; - } - - uint32 accountid = AccountMgr::GetId(account_name); - if (!accountid) - { - PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); - return true; - } - - return HandleBanInfoHelper(accountid, account_name.c_str()); -} - -bool ChatHandler::HandleBanInfoCharacterCommand(const char *args) -{ - if (!*args) - return false; - - Player* target = sObjectAccessor->FindPlayerByName(args); - uint32 target_guid = 0; - std::string name(args); - - if (!target) - { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME); - stmt->setString(0, name); - PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt); - - if (!resultCharacter) - { - PSendSysMessage(LANG_BANINFO_NOCHARACTER); - return false; - } - - target_guid = (*resultCharacter)[0].GetUInt32(); - } - else - target_guid = target->GetGUIDLow(); - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO); - stmt->setUInt32(0, target_guid); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - if (!result) - { - PSendSysMessage(LANG_CHAR_NOT_BANNED, name.c_str()); - return true; - } - - PSendSysMessage(LANG_BANINFO_BANHISTORY, name.c_str()); - do - { - Field* fields = result->Fetch(); - time_t unbandate = time_t(fields[3].GetUInt32()); - bool active = false; - if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbandate >= time(NULL))) - active = true; - bool permanent = (fields[1].GetUInt32() == uint32(0)); - std::string bantime = permanent ? GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true); - PSendSysMessage(LANG_BANINFO_HISTORYENTRY, - fields[0].GetCString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES) : GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString()); - } - while (result->NextRow()); - - return true; -} - -bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname) -{ - QueryResult result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC", accountid); - if (!result) - { - PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountname); - return true; - } - - PSendSysMessage(LANG_BANINFO_BANHISTORY, accountname); - do - { - Field* fields = result->Fetch(); - - time_t unbandate = time_t(fields[3].GetUInt64()); - bool active = false; - if (fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL))) - active = true; - bool permanent = (fields[1].GetUInt64() == (uint64)0); - std::string bantime = permanent ? GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true); - PSendSysMessage(LANG_BANINFO_HISTORYENTRY, - fields[0].GetCString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES) : GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString()); - } while (result->NextRow()); - - return true; -} - -bool ChatHandler::HandleBanInfoIPCommand(const char *args) -{ - if (!*args) - return false; - - char* cIP = strtok ((char*)args, ""); - if (!cIP) - return false; - - if (!IsIPAddress(cIP)) - return false; - - std::string IP = cIP; - - LoginDatabase.EscapeString(IP); - QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '%s'", IP.c_str()); - if (!result) - { - PSendSysMessage(LANG_BANINFO_NOIP); - return true; - } - - Field* fields = result->Fetch(); - bool permanent = !fields[6].GetUInt64(); - PSendSysMessage(LANG_BANINFO_IPENTRY, - fields[0].GetCString(), fields[1].GetCString(), permanent ? GetTrinityString(LANG_BANINFO_NEVER) : fields[2].GetCString(), - permanent ? GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetCString(), fields[5].GetCString()); - - return true; -} - -bool ChatHandler::HandleBanListCharacterCommand(const char *args) -{ - if (!*args) - return false; - - char* cFilter = strtok((char*)args, " "); - if (!cFilter) - return false; - - std::string filter(cFilter); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER); - stmt->setString(0, filter); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - if (!result) - { - PSendSysMessage(LANG_BANLIST_NOCHARACTER); - return true; - } - - PSendSysMessage(LANG_BANLIST_MATCHINGCHARACTER); - - // Chat short output - if (m_session) - { - do - { - Field* fields = result->Fetch(); - PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME); - stmt2->setUInt32(0, fields[0].GetUInt32()); - PreparedQueryResult banresult = CharacterDatabase.Query(stmt2); - if (banresult) - PSendSysMessage("%s", (*banresult)[0].GetCString()); - } - while (result->NextRow()); - } - // Console wide output - else - { - SendSysMessage(LANG_BANLIST_CHARACTERS); - SendSysMessage(" =============================================================================== "); - SendSysMessage(LANG_BANLIST_CHARACTERS_HEADER); - do - { - SendSysMessage("-------------------------------------------------------------------------------"); - - Field* fields = result->Fetch(); - - std::string char_name = fields[1].GetString(); - - PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST); - stmt2->setUInt32(0, fields[0].GetUInt32()); - PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2); - if (banInfo) - { - Field* banFields = banInfo->Fetch(); - do - { - time_t t_ban = time_t(banFields[0].GetUInt32()); - tm* aTm_ban = localtime(&t_ban); - - if (banFields[0].GetUInt32() == banFields[1].GetUInt32()) - { - PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", - char_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, - banFields[2].GetCString(), banFields[3].GetCString()); - } - else - { - time_t t_unban = time_t(banFields[1].GetUInt32()); - tm* aTm_unban = localtime(&t_unban); - PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", - char_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, - aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, - banFields[2].GetCString(), banFields[3].GetCString()); - } - } - while (banInfo->NextRow()); - } - } - while (result->NextRow()); - SendSysMessage(" =============================================================================== "); - } - - return true; -} - -bool ChatHandler::HandleBanListAccountCommand(const char *args) -{ - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); - LoginDatabase.Execute(stmt); - - char* cFilter = strtok((char*)args, " "); - std::string filter = cFilter ? cFilter : ""; - - PreparedQueryResult result; - - if (filter.empty()) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL); - - result = LoginDatabase.Query(stmt); - } - else - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME); - - stmt->setString(0, filter); - - result = LoginDatabase.Query(stmt); - } - - if (!result) - { - PSendSysMessage(LANG_BANLIST_NOACCOUNT); - return true; - } - - return HandleBanListHelper(result); -} - -bool ChatHandler::HandleBanListHelper(PreparedQueryResult result) -{ - PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT); - - // Chat short output - if (m_session) - { - do - { - Field* fields = result->Fetch(); - uint32 accountid = fields[0].GetUInt32(); - - QueryResult banresult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id", accountid); - if (banresult) - { - Field* fields2 = banresult->Fetch(); - PSendSysMessage("%s", fields2[0].GetCString()); - } - } while (result->NextRow()); - } - // Console wide output - else - { - SendSysMessage(LANG_BANLIST_ACCOUNTS); - SendSysMessage(" ==============================================================================="); - SendSysMessage(LANG_BANLIST_ACCOUNTS_HEADER); - do - { - SendSysMessage("-------------------------------------------------------------------------------"); - Field* fields = result->Fetch(); - uint32 account_id = fields[0].GetUInt32(); - - std::string account_name; - - // "account" case, name can be get in same query - if (result->GetFieldCount() > 1) - account_name = fields[1].GetString(); - // "character" case, name need extract from another DB - else - AccountMgr::GetName (account_id, account_name); - - // No SQL injection. id is uint32. - QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id); - if (banInfo) - { - Field* fields2 = banInfo->Fetch(); - do - { - time_t t_ban = fields2[0].GetUInt64(); - tm* aTm_ban = localtime(&t_ban); - - if (fields2[0].GetUInt64() == fields2[1].GetUInt64()) - { - PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", - account_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, - fields2[2].GetCString(), fields2[3].GetCString()); - } - else - { - time_t t_unban = fields2[1].GetUInt64(); - tm* aTm_unban = localtime(&t_unban); - PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", - account_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, - aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, - fields2[2].GetCString(), fields2[3].GetCString()); - } - } while (banInfo->NextRow()); - } - }while (result->NextRow()); - SendSysMessage(" ==============================================================================="); - } - return true; -} - -bool ChatHandler::HandleBanListIPCommand(const char *args) -{ - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); - LoginDatabase.Execute(stmt); - - char* cFilter = strtok((char*)args, " "); - std::string filter = cFilter ? cFilter : ""; - LoginDatabase.EscapeString(filter); - - PreparedQueryResult result; - - if (filter.empty()) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL); - - result = LoginDatabase.Query(stmt); - } - else - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP); - - stmt->setString(0, filter); - - result = LoginDatabase.Query(stmt); - } - - if (!result) - { - PSendSysMessage(LANG_BANLIST_NOIP); - return true; - } - - PSendSysMessage(LANG_BANLIST_MATCHINGIP); - // Chat short output - if (m_session) - { - do - { - Field* fields = result->Fetch(); - PSendSysMessage("%s", fields[0].GetCString()); - } while (result->NextRow()); - } - // Console wide output - else - { - SendSysMessage(LANG_BANLIST_IPS); - SendSysMessage(" ==============================================================================="); - SendSysMessage(LANG_BANLIST_IPS_HEADER); - do - { - SendSysMessage("-------------------------------------------------------------------------------"); - Field* fields = result->Fetch(); - time_t t_ban = fields[1].GetUInt64(); - tm* aTm_ban = localtime(&t_ban); - if (fields[1].GetUInt64() == fields[2].GetUInt64()) - { - PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", - fields[0].GetCString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, - fields[3].GetCString(), fields[4].GetCString()); - } - else - { - time_t t_unban = fields[2].GetUInt64(); - tm* aTm_unban = localtime(&t_unban); - PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", - fields[0].GetCString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, - aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, - fields[3].GetCString(), fields[4].GetCString()); - } - }while (result->NextRow()); - SendSysMessage(" ==============================================================================="); - } - - return true; -} - bool ChatHandler::HandleRespawnCommand(const char* /*args*/) { Player* player = m_session->GetPlayer(); diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 2b99de9d0a2..c95a1aa60d1 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -46,7 +46,9 @@ void AddSC_SmartSCripts(); //Commands void AddSC_account_commandscript(); void AddSC_achievement_commandscript(); +void AddSC_ban_commandscript(); void AddSC_cast_commandscript(); +void AddSC_character_commandscript(); void AddSC_debug_commandscript(); void AddSC_event_commandscript(); void AddSC_gm_commandscript(); @@ -64,11 +66,10 @@ void AddSC_npc_commandscript(); void AddSC_quest_commandscript(); void AddSC_reload_commandscript(); void AddSC_reset_commandscript(); -void AddSC_tele_commandscript(); void AddSC_server_commandscript(); +void AddSC_tele_commandscript(); void AddSC_titles_commandscript(); void AddSC_wp_commandscript(); -void AddSC_character_commandscript(); #ifdef SCRIPTS //world @@ -656,7 +657,9 @@ void AddCommandScripts() { AddSC_account_commandscript(); AddSC_achievement_commandscript(); + AddSC_ban_commandscript(); AddSC_cast_commandscript(); + AddSC_character_commandscript(); AddSC_debug_commandscript(); AddSC_event_commandscript(); AddSC_gm_commandscript(); @@ -674,11 +677,10 @@ void AddCommandScripts() AddSC_quest_commandscript(); AddSC_reload_commandscript(); AddSC_reset_commandscript(); - AddSC_tele_commandscript(); AddSC_server_commandscript(); + AddSC_tele_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); - AddSC_character_commandscript(); } void AddWorldScripts() diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 2d408e76cd6..915d94c420c 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -12,6 +12,7 @@ set(scripts_STAT_SRCS ${scripts_STAT_SRCS} Commands/cs_account.cpp Commands/cs_achievement.cpp + Commands/cs_ban.cpp Commands/cs_cast.cpp Commands/cs_character.cpp Commands/cs_debug.cpp @@ -65,10 +66,6 @@ set(scripts_STAT_SRCS # Commands/cs_save.cpp # Commands/cs_saveall.cpp # Commands/cs_kick.cpp -# Commands/cs_ban.cpp -# Commands/cs_unban.cpp -# Commands/cs_baninfo.cpp -# Commands/cs_banlist.cpp # Commands/cs_start.cpp # Commands/cs_taxicheat.cpp # Commands/cs_linkgrave.cpp diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp new file mode 100644 index 00000000000..b84a7e5544a --- /dev/null +++ b/src/server/scripts/Commands/cs_ban.cpp @@ -0,0 +1,718 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: ban_commandscript +%Complete: 100 +Comment: All ban related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "AccountMgr.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" + +class ban_commandscript : public CommandScript +{ +public: + ban_commandscript() : CommandScript("ban_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand unbanCommandTable[] = + { + { "account", SEC_ADMINISTRATOR, true, &HandleUnBanAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &HandleUnBanCharacterCommand, "", NULL }, + { "playeraccount", SEC_ADMINISTRATOR, true, &HandleUnBanAccountByCharCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand banlistCommandTable[] = + { + { "account", SEC_ADMINISTRATOR, true, &HandleBanListAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &HandleBanListCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &HandleBanListIPCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand baninfoCommandTable[] = + { + { "account", SEC_ADMINISTRATOR, true, &HandleBanInfoAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &HandleBanInfoCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &HandleBanInfoIPCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand banCommandTable[] = + { + { "account", SEC_ADMINISTRATOR, true, &HandleBanAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &HandleBanCharacterCommand, "", NULL }, + { "playeraccount", SEC_ADMINISTRATOR, true, &HandleBanAccountByCharCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &HandleBanIPCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "ban", SEC_ADMINISTRATOR, true, NULL, "", banCommandTable }, + { "baninfo", SEC_ADMINISTRATOR, true, NULL, "", baninfoCommandTable }, + { "banlist", SEC_ADMINISTRATOR, true, NULL, "", banlistCommandTable }, + { "unban", SEC_ADMINISTRATOR, true, NULL, "", unbanCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleBanAccountCommand(ChatHandler* handler, char const* args) + { + return HandleBanHelper(BAN_ACCOUNT, args, handler); + } + + static bool HandleBanCharacterCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* nameStr = strtok((char*)args, " "); + if (!nameStr) + return false; + + std::string name = nameStr; + + char* durationStr = strtok(NULL, " "); + if (!durationStr || !atoi(durationStr)) + return false; + + char* reasonStr = strtok(NULL, ""); + if (!reasonStr) + return false; + + if (!normalizePlayerName(name)) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "")) + { + case BAN_SUCCESS: + { + if (atoi(durationStr) > 0) + handler->PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr); + else + handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reasonStr); + break; + } + case BAN_NOTFOUND: + { + handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + default: + break; + } + + return true; + } + + static bool HandleBanAccountByCharCommand(ChatHandler* handler, char const* args) + { + return HandleBanHelper(BAN_CHARACTER, args, handler); + } + + static bool HandleBanIPCommand(ChatHandler* handler, char const* args) + { + return HandleBanHelper(BAN_IP, args, handler); + } + + static bool HandleBanHelper(BanMode mode, char const* args, ChatHandler* handler) + { + if (!*args) + return false; + + char* cnameOrIP = strtok((char*)args, " "); + if (!cnameOrIP) + return false; + + std::string nameOrIP = cnameOrIP; + + char* durationStr = strtok(NULL, " "); + if (!durationStr || !atoi(durationStr)) + return false; + + char* reasonStr = strtok(NULL, ""); + if (!reasonStr) + return false; + + switch (mode) + { + case BAN_ACCOUNT: + if (!AccountMgr::normalizeString(nameOrIP)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + break; + case BAN_CHARACTER: + if (!normalizePlayerName(nameOrIP)) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + break; + case BAN_IP: + if (!IsIPAddress(nameOrIP.c_str())) + return false; + break; + } + + switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "")) + { + case BAN_SUCCESS: + if (atoi(durationStr) > 0) + handler->PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr); + else + handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reasonStr); + break; + case BAN_SYNTAX_ERROR: + return false; + case BAN_NOTFOUND: + switch (mode) + { + default: + handler->PSendSysMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str()); + break; + case BAN_CHARACTER: + handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str()); + break; + case BAN_IP: + handler->PSendSysMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str()); + break; + } + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + static bool HandleBanInfoAccountCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* nameStr = strtok((char*)args, ""); + if (!nameStr) + return false; + + std::string accountName = nameStr; + if (!AccountMgr::normalizeString(accountName)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 accountId = AccountMgr::GetId(accountName); + if (!accountId) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + return true; + } + + return HandleBanInfoHelper(accountId, accountName.c_str(), handler); + } + + static bool HandleBanInfoHelper(uint32 accountId, char const* accountName, ChatHandler* handler) + { + QueryResult result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC", accountId); + if (!result) + { + handler->PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountName); + return true; + } + + handler->PSendSysMessage(LANG_BANINFO_BANHISTORY, accountName); + do + { + Field* fields = result->Fetch(); + + time_t unbanDate = time_t(fields[3].GetUInt32()); + bool active = false; + if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(NULL))) + active = true; + bool permanent = (fields[1].GetUInt64() == uint64(0)); + std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true); + handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY, + fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_BANINFO_YES) : handler->GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString()); + } + while (result->NextRow()); + + return true; + } + + static bool HandleBanInfoCharacterCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* target = sObjectAccessor->FindPlayerByName(args); + uint32 targetGuid = 0; + std::string name(args); + + if (!target) + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME); + stmt->setString(0, name); + PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt); + + if (!resultCharacter) + { + handler->PSendSysMessage(LANG_BANINFO_NOCHARACTER); + return false; + } + + targetGuid = (*resultCharacter)[0].GetUInt32(); + } + else + targetGuid = target->GetGUIDLow(); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO); + stmt->setUInt32(0, targetGuid); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) + { + handler->PSendSysMessage(LANG_CHAR_NOT_BANNED, name.c_str()); + return true; + } + + handler->PSendSysMessage(LANG_BANINFO_BANHISTORY, name.c_str()); + do + { + Field* fields = result->Fetch(); + time_t unbanDate = time_t(fields[3].GetUInt32()); + bool active = false; + if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(NULL))) + active = true; + bool permanent = (fields[1].GetUInt32() == uint32(0)); + std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true); + handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY, + fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_BANINFO_YES) : handler->GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString()); + } + while (result->NextRow()); + + return true; + } + + static bool HandleBanInfoIPCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* ipStr = strtok((char*)args, ""); + if (!ipStr) + return false; + + if (!IsIPAddress(ipStr)) + return false; + + std::string IP = ipStr; + + LoginDatabase.EscapeString(IP); + QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '%s'", IP.c_str()); + if (!result) + { + handler->PSendSysMessage(LANG_BANINFO_NOIP); + return true; + } + + Field* fields = result->Fetch(); + bool permanent = !fields[6].GetUInt64(); + handler->PSendSysMessage(LANG_BANINFO_IPENTRY, + fields[0].GetCString(), fields[1].GetCString(), permanent ? handler->GetTrinityString(LANG_BANINFO_NEVER) : fields[2].GetCString(), + permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetCString(), fields[5].GetCString()); + + + return true; + } + + static bool HandleBanListAccountCommand(ChatHandler* handler, char const* args) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); + LoginDatabase.Execute(stmt); + + char* filterStr = strtok((char*)args, " "); + std::string filter = filterStr ? filterStr : ""; + + PreparedQueryResult result; + + if (filter.empty()) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL); + result = LoginDatabase.Query(stmt); + } + else + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME); + stmt->setString(0, filter); + result = LoginDatabase.Query(stmt); + } + + if (!result) + { + handler->PSendSysMessage(LANG_BANLIST_NOACCOUNT); + return true; + } + + return HandleBanListHelper(result, handler); + } + + static bool HandleBanListHelper(PreparedQueryResult result, ChatHandler* handler) + { + handler->PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT); + + // Chat short output + if (handler->GetSession()) + { + do + { + Field* fields = result->Fetch(); + uint32 accountid = fields[0].GetUInt32(); + + QueryResult banResult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id", accountid); + if (banResult) + { + Field* fields2 = banResult->Fetch(); + handler->PSendSysMessage("%s", fields2[0].GetCString()); + } + } + while (result->NextRow()); + } + // Console wide output + else + { + handler->SendSysMessage(LANG_BANLIST_ACCOUNTS); + handler->SendSysMessage(" ==============================================================================="); + handler->SendSysMessage(LANG_BANLIST_ACCOUNTS_HEADER); + do + { + handler->SendSysMessage("-------------------------------------------------------------------------------"); + Field* fields = result->Fetch(); + uint32 accountId = fields[0].GetUInt32(); + + std::string accountName; + + // "account" case, name can be get in same query + if (result->GetFieldCount() > 1) + accountName = fields[1].GetString(); + // "character" case, name need extract from another DB + else + AccountMgr::GetName(accountId, accountName); + + // No SQL injection. id is uint32. + QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = %u ORDER BY unbandate", accountId); + if (banInfo) + { + Field* fields2 = banInfo->Fetch(); + do + { + time_t timeBan = time_t(fields2[0].GetUInt32()); + tm* tmBan = localtime(&timeBan); + + if (fields2[0].GetUInt32() == fields2[1].GetUInt32()) + { + handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", + accountName.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min, + fields2[2].GetCString(), fields2[3].GetCString()); + } + else + { + time_t timeUnban = time_t(fields2[1].GetUInt32()); + tm* tmUnban = localtime(&timeUnban); + handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", + accountName.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min, + tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min, + fields2[2].GetCString(), fields2[3].GetCString()); + } + } + while (banInfo->NextRow()); + } + } + while (result->NextRow()); + + handler->SendSysMessage(" ==============================================================================="); + } + + return true; + } + + static bool HandleBanListCharacterCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* filterStr = strtok((char*)args, " "); + if (!filterStr) + return false; + + std::string filter(filterStr); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER); + stmt->setString(0, filter); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) + { + handler->PSendSysMessage(LANG_BANLIST_NOCHARACTER); + return true; + } + + handler->PSendSysMessage(LANG_BANLIST_MATCHINGCHARACTER); + + // Chat short output + if (handler->GetSession()) + { + do + { + Field* fields = result->Fetch(); + PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME); + stmt2->setUInt32(0, fields[0].GetUInt32()); + PreparedQueryResult banResult = CharacterDatabase.Query(stmt2); + if (banResult) + handler->PSendSysMessage("%s", (*banResult)[0].GetCString()); + } + while (result->NextRow()); + } + // Console wide output + else + { + handler->SendSysMessage(LANG_BANLIST_CHARACTERS); + handler->SendSysMessage(" =============================================================================== "); + handler->SendSysMessage(LANG_BANLIST_CHARACTERS_HEADER); + do + { + handler->SendSysMessage("-------------------------------------------------------------------------------"); + + Field* fields = result->Fetch(); + + std::string char_name = fields[1].GetString(); + + PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST); + stmt2->setUInt32(0, fields[0].GetUInt32()); + PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2); + if (banInfo) + { + Field* banFields = banInfo->Fetch(); + do + { + time_t timeBan = time_t(banFields[0].GetUInt32()); + tm* tmBan = localtime(&timeBan); + + if (banFields[0].GetUInt32() == banFields[1].GetUInt32()) + { + handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", + char_name.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min, + banFields[2].GetCString(), banFields[3].GetCString()); + } + else + { + time_t timeUnban = time_t(banFields[1].GetUInt32()); + tm* tmUnban = localtime(&timeUnban); + handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", + char_name.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min, + tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min, + banFields[2].GetCString(), banFields[3].GetCString()); + } + } + while (banInfo->NextRow()); + } + } + while (result->NextRow()); + handler->SendSysMessage(" =============================================================================== "); + } + + return true; + } + + static bool HandleBanListIPCommand(ChatHandler* handler, char const* args) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); + LoginDatabase.Execute(stmt); + + char* filterStr = strtok((char*)args, " "); + std::string filter = filterStr ? filterStr : ""; + LoginDatabase.EscapeString(filter); + + PreparedQueryResult result; + + if (filter.empty()) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL); + result = LoginDatabase.Query(stmt); + } + else + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP); + stmt->setString(0, filter); + result = LoginDatabase.Query(stmt); + } + + if (!result) + { + handler->PSendSysMessage(LANG_BANLIST_NOIP); + return true; + } + + handler->PSendSysMessage(LANG_BANLIST_MATCHINGIP); + // Chat short output + if (handler->GetSession()) + { + do + { + Field* fields = result->Fetch(); + handler->PSendSysMessage("%s", fields[0].GetCString()); + } + while (result->NextRow()); + } + // Console wide output + else + { + handler->SendSysMessage(LANG_BANLIST_IPS); + handler->SendSysMessage(" ==============================================================================="); + handler->SendSysMessage(LANG_BANLIST_IPS_HEADER); + do + { + handler->SendSysMessage("-------------------------------------------------------------------------------"); + Field* fields = result->Fetch(); + time_t timeBan = time_t(fields[1].GetUInt32()); + tm* tmBan = localtime(&timeBan); + if (fields[1].GetUInt32() == fields[2].GetUInt32()) + { + handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", + fields[0].GetCString(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min, + fields[3].GetCString(), fields[4].GetCString()); + } + else + { + time_t timeUnban = time_t(fields[2].GetUInt32()); + tm* tmUnban = localtime(&timeUnban); + handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", + fields[0].GetCString(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min, + tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min, + fields[3].GetCString(), fields[4].GetCString()); + } + } + while (result->NextRow()); + + handler->SendSysMessage(" ==============================================================================="); + } + + return true; + } + + static bool HandleUnBanAccountCommand(ChatHandler* handler, char const* args) + { + return HandleUnBanHelper(BAN_ACCOUNT, args, handler); + } + + static bool HandleUnBanCharacterCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* nameStr = strtok((char*)args, " "); + if (!nameStr) + return false; + + std::string name = nameStr; + + if (!normalizePlayerName(name)) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + if (!sWorld->RemoveBanCharacter(name)) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + static bool HandleUnBanAccountByCharCommand(ChatHandler* handler, char const* args) + { + return HandleUnBanHelper(BAN_CHARACTER, args, handler); + } + + static bool HandleUnBanIPCommand(ChatHandler* handler, char const* args) + { + return HandleUnBanHelper(BAN_IP, args, handler); + } + + static bool HandleUnBanHelper(BanMode mode, char const* args, ChatHandler* handler) + { + if (!*args) + return false; + + char* nameOrIPStr = strtok((char*)args, " "); + if (!nameOrIPStr) + return false; + + std::string nameOrIP = nameOrIPStr; + + switch (mode) + { + case BAN_ACCOUNT: + if (!AccountMgr::normalizeString(nameOrIP)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + break; + case BAN_CHARACTER: + if (!normalizePlayerName(nameOrIP)) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + break; + case BAN_IP: + if (!IsIPAddress(nameOrIP.c_str())) + return false; + break; + } + + if (sWorld->RemoveBanAccount(mode, nameOrIP)) + handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str()); + else + handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str()); + + return true; + } +}; + +void AddSC_ban_commandscript() +{ + new ban_commandscript(); +} diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 2f422fd83d9..0e814034434 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1364,7 +1364,7 @@ public: do { Field* characterFields = result2->Fetch(); - uint64 guid = characterFields[0].GetUInt64(); + uint32 guid = characterFields[0].GetUInt32(); std::string name = characterFields[1].GetString(); handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid); -- cgit v1.2.3 From c32c83ed67420a90e95f433a9d71febaefd2ecfd Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 15 Jul 2012 14:46:04 +0100 Subject: Scripts/Commands: When GM is invisible use a transparency visual aura (to make it obvious that invisibility is active) Thanks to Kretol for the idea and Aokromes for the spell id --- src/server/scripts/Commands/cs_gm.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index d449b3617f7..3dfc6f9c7e8 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -196,11 +196,16 @@ public: return true; } + const uint32 VISUAL_AURA = 37800; std::string param = (char*)args; + Player* player = handler->GetSession()->GetPlayer(); if (param == "on") { - handler->GetSession()->GetPlayer()->SetGMVisible(true); + if (player->HasAura(VISUAL_AURA, 0)) + player->RemoveAurasDueToSpell(VISUAL_AURA); + + player->SetGMVisible(true); handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE); return true; } @@ -208,7 +213,10 @@ public: if (param == "off") { handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE); - handler->GetSession()->GetPlayer()->SetGMVisible(false); + player->SetGMVisible(false); + + player->AddAura(VISUAL_AURA, player); + return true; } -- cgit v1.2.3 From a9812a086016244395f957e7e32772793d54c92e Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 15 Jul 2012 19:13:11 +0200 Subject: Core/Commands: Convert ticket commands in commandscript --- src/server/game/Chat/Chat.cpp | 29 -- src/server/game/Chat/Chat.h | 22 - src/server/game/Chat/Commands/TicketCommands.cpp | 457 -------------------- src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Commands/CMakeLists.txt | 2 +- src/server/scripts/Commands/cs_ticket.cpp | 509 +++++++++++++++++++++++ 6 files changed, 512 insertions(+), 509 deletions(-) delete mode 100755 src/server/game/Chat/Commands/TicketCommands.cpp create mode 100644 src/server/scripts/Commands/cs_ticket.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 110be872b9a..65cdca70aba 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -111,34 +111,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand ticketResponseCommandTable[] = - { - { "append", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketResponseAppendCommand>, "", NULL }, - { "appendln", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketResponseAppendLnCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand ticketCommandTable[] = - { - { "list", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListCommand>, "", NULL }, - { "onlinelist", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListOnlineCommand>, "", NULL }, - { "viewname", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketGetByNameCommand>, "", NULL }, - { "viewid", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketGetByIdCommand>, "", NULL }, - { "close", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCloseByIdCommand>, "", NULL }, - { "closedlist", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListClosedCommand>, "", NULL }, - { "escalatedlist", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketListEscalatedCommand>, "", NULL }, - { "delete", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleGMTicketDeleteByIdCommand>, "", NULL }, - { "reset", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleGMTicketResetCommand>, "", NULL }, - { "assign", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketAssignToCommand>, "", NULL }, - { "unassign", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketUnAssignCommand>, "", NULL }, - { "comment", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCommentCommand>, "", NULL }, - { "togglesystem", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleToggleGMTicketSystem>, "", NULL }, - { "escalate", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketEscalateCommand>, "", NULL }, - { "response", SEC_MODERATOR, true, NULL, "", ticketResponseCommandTable }, - { "complete", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCompleteCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand commandTable[] = { { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, @@ -147,7 +119,6 @@ ChatCommand* ChatHandler::getCommandTable() { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable }, { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, - { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable }, { "aura", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAuraCommand>, "", NULL }, { "unaura", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnAuraCommand>, "", NULL }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 47734036071..af06b4f760a 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -211,26 +211,6 @@ class ChatHandler bool HandleChangeWeather(const char* args); bool HandleKickPlayerCommand(const char * args); - // GM ticket command handlers - bool HandleGMTicketListCommand(const char* args); - bool HandleGMTicketListOnlineCommand(const char* args); - bool HandleGMTicketListClosedCommand(const char* args); - bool HandleGMTicketListEscalatedCommand(const char* args); - bool HandleGMTicketGetByIdCommand(const char* args); - bool HandleGMTicketGetByNameCommand(const char* args); - bool HandleGMTicketCloseByIdCommand(const char* args); - bool HandleGMTicketAssignToCommand(const char* args); - bool HandleGMTicketUnAssignCommand(const char* args); - bool HandleGMTicketCommentCommand(const char* args); - bool HandleGMTicketDeleteByIdCommand(const char* args); - bool HandleGMTicketResetCommand(const char* /* args */); - bool HandleGMTicketReloadCommand(const char*); - bool HandleToggleGMTicketSystem(const char* args); - bool HandleGMTicketEscalateCommand(const char* args); - bool HandleGMTicketCompleteCommand(const char* args); - bool HandleGMTicketResponseAppendCommand(const char* args); - bool HandleGMTicketResponseAppendLnCommand(const char* args); - bool HandleMaxSkillCommand(const char* args); bool HandleSetSkillCommand(const char* args); bool HandleRespawnCommand(const char* args); @@ -259,8 +239,6 @@ class ChatHandler void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id); private: - bool _HandleGMTicketResponseAppendCommand(const char* args, bool newLine); - WorldSession* m_session; // != NULL for chat command call and NULL for CLI command // common global flag diff --git a/src/server/game/Chat/Commands/TicketCommands.cpp b/src/server/game/Chat/Commands/TicketCommands.cpp deleted file mode 100755 index 177899efbf0..00000000000 --- a/src/server/game/Chat/Commands/TicketCommands.cpp +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * - * 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 . - */ - -#include "Common.h" -#include "DatabaseEnv.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "ObjectMgr.h" -#include "TicketMgr.h" -#include "AccountMgr.h" -#include "Chat.h" -#include "Player.h" - -bool ChatHandler::HandleGMTicketListCommand(const char* /*args*/) -{ - sTicketMgr->ShowList(*this, false); - return true; -} - -bool ChatHandler::HandleGMTicketListOnlineCommand(const char* /*args*/) -{ - sTicketMgr->ShowList(*this, true); - return true; -} - -bool ChatHandler::HandleGMTicketListClosedCommand(const char* /*args*/) -{ - sTicketMgr->ShowClosedList(*this); - return true; -} - -bool ChatHandler::HandleGMTicketListEscalatedCommand(const char* /*args*/) -{ - sTicketMgr->ShowEscalatedList(*this); - return true; -} - -bool ChatHandler::HandleGMTicketGetByIdCommand(const char* args) -{ - if (!*args) - return false; - - uint32 ticketId = atoi(args); - GmTicket *ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket || ticket->IsClosed() || ticket->IsCompleted()) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - SQLTransaction trans = SQLTransaction(NULL); - ticket->SetViewed(); - ticket->SaveToDB(trans); - - SendSysMessage(ticket->FormatMessageString(*this, true).c_str()); - return true; -} - -bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args) -{ - if (!*args) - return false; - - std::string name(args); - if (!normalizePlayerName(name)) - return false; - - // Detect target's GUID - uint64 guid = 0; - if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str())) - guid = player->GetGUID(); - else - guid = sObjectMgr->GetPlayerGUIDByName(name); - - // Target must exist - if (!guid) - { - SendSysMessage(LANG_NO_PLAYERS_FOUND); - return true; - } - - // Ticket must exist - GmTicket *ticket = sTicketMgr->GetTicketByPlayer(guid); - if (!ticket) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - SQLTransaction trans = SQLTransaction(NULL); - ticket->SetViewed(); - ticket->SaveToDB(trans); - - SendSysMessage(ticket->FormatMessageString(*this, true).c_str()); - return true; -} - -bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args) -{ - if (!*args) - return false; - - uint32 ticketId = atoi(args); - GmTicket* ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket || ticket->IsClosed() || ticket->IsCompleted()) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - // Ticket should be assigned to the player who tries to close it. - // Console can override though - Player* player = m_session ? m_session->GetPlayer() : NULL; - if (player && ticket->IsAssignedNotTo(player->GetGUID())) - { - PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId()); - return true; - } - - sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1); - sTicketMgr->UpdateLastChange(); - - std::string msg = ticket->FormatMessageString(*this, player ? player->GetName() : "Console", NULL, NULL, NULL); - SendGlobalGMSysMessage(msg.c_str()); - - // Inform player, who submitted this ticket, that it is closed - if (Player* submitter = ticket->GetPlayer()) - { - if (submitter->IsInWorld()) - { - WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); - data << uint32(GMTICKET_RESPONSE_TICKET_DELETED); - submitter->GetSession()->SendPacket(&data); - } - } - return true; -} - -bool ChatHandler::HandleGMTicketAssignToCommand(const char* args) -{ - if (!*args) - return false; - - char* sTicketId = strtok((char*)args, " "); - uint32 ticketId = atoi(sTicketId); - - char* sTarget = strtok(NULL, " "); - if (!sTarget) - return false; - - std::string target(sTarget); - if (!normalizePlayerName(target)) - return false; - - GmTicket* ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket || ticket->IsClosed()) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - // Get target information - uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str()); - uint64 targetAccId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); - uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccId, realmID); - - // Target must exist and have administrative rights - if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel)) - { - SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A); - return true; - } - - // If already assigned, leave - if (ticket->IsAssignedTo(targetGuid)) - { - PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId()); - return true; - } - - // If assigned to different player other than current, leave - //! Console can override though - Player* player = m_session ? m_session->GetPlayer() : NULL; - if (player && ticket->IsAssignedNotTo(player->GetGUID())) - { - PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str()); - return true; - } - - // Assign ticket - SQLTransaction trans = SQLTransaction(NULL); - ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel)); - ticket->SaveToDB(trans); - sTicketMgr->UpdateLastChange(); - - std::string msg = ticket->FormatMessageString(*this, NULL, target.c_str(), NULL, NULL); - SendGlobalGMSysMessage(msg.c_str()); - return true; -} - -bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args) -{ - if (!*args) - return false; - - uint32 ticketId = atoi(args); - GmTicket *ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket || ticket->IsClosed()) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - // Ticket must be assigned - if (!ticket->IsAssigned()) - { - PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->GetId()); - return true; - } - - // Get security level of player, whom this ticket is assigned to - uint32 security = SEC_PLAYER; - Player* assignedPlayer = ticket->GetAssignedPlayer(); - if (assignedPlayer && assignedPlayer->IsInWorld()) - security = assignedPlayer->GetSession()->GetSecurity(); - else - { - uint64 guid = ticket->GetAssignedToGUID(); - uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid); - security = AccountMgr::GetSecurity(accountId, realmID); - } - - // Check security - //! If no m_session present it means we're issuing this command from the console - uint32 mySecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE; - if (security > mySecurity) - { - SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY); - return true; - } - - SQLTransaction trans = SQLTransaction(NULL); - ticket->SetUnassigned(); - ticket->SaveToDB(trans); - sTicketMgr->UpdateLastChange(); - - std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), - m_session ? m_session->GetPlayer()->GetName() : "Console", NULL); - SendGlobalGMSysMessage(msg.c_str()); - return true; -} - -bool ChatHandler::HandleGMTicketCommentCommand(const char* args) -{ - if (!*args) - return false; - - char* tguid = strtok((char*)args, " "); - uint32 ticketId = atoi(tguid); - - char* comment = strtok(NULL, "\n"); - if (!comment) - return false; - - GmTicket *ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket || ticket->IsClosed()) - { - PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - // Cannot comment ticket assigned to someone else - //! Console excluded - Player* player = m_session ? m_session->GetPlayer() : NULL; - if (player && ticket->IsAssignedNotTo(player->GetGUID())) - { - PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); - return true; - } - - SQLTransaction trans = SQLTransaction(NULL); - ticket->SetComment(comment); - ticket->SaveToDB(trans); - sTicketMgr->UpdateLastChange(); - - std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL); - msg += PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName() : "Console", comment); - SendGlobalGMSysMessage(msg.c_str()); - - return true; -} - -bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args) -{ - if (!*args) - return false; - - uint32 ticketId = atoi(args); - GmTicket* ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - if (!ticket->IsClosed()) - { - SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST); - return true; - } - - std::string msg = ticket->FormatMessageString(*this, NULL, NULL, NULL, m_session ? m_session->GetPlayer()->GetName() : "Console"); - SendGlobalGMSysMessage(msg.c_str()); - - sTicketMgr->RemoveTicket(ticket->GetId()); - sTicketMgr->UpdateLastChange(); - - if (Player* player = ticket->GetPlayer()) - { - if (player->IsInWorld()) - { - // Force abandon ticket - WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); - data << uint32(GMTICKET_RESPONSE_TICKET_DELETED); - player->GetSession()->SendPacket(&data); - } - } - return true; -} - -bool ChatHandler::HandleGMTicketResetCommand(const char* /* args */) -{ - if (sTicketMgr->GetOpenTicketCount() > 0) - { - SendSysMessage(LANG_COMMAND_TICKETPENDING); - return true; - } - else - { - sTicketMgr->ResetTickets(); - SendSysMessage(LANG_COMMAND_TICKETRESET); - } - - return true; -} - -bool ChatHandler::HandleToggleGMTicketSystem(const char* /* args */) -{ - bool status = !sTicketMgr->GetStatus(); - sTicketMgr->SetStatus(status); - PSendSysMessage(status ? LANG_ALLOW_TICKETS : LANG_DISALLOW_TICKETS); - return true; -} - -bool ChatHandler::HandleGMTicketEscalateCommand(const char *args) -{ - if (!*args) - return false; - - uint32 ticketId = atoi(args); - GmTicket* ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket || !ticket->IsClosed() || ticket->IsCompleted() || ticket->GetEscalatedStatus() != TICKET_UNASSIGNED) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - ticket->SetEscalatedStatus(TICKET_IN_ESCALATION_QUEUE); - - if (Player* player = ticket->GetPlayer()) - if (player->IsInWorld()) - sTicketMgr->SendTicket(player->GetSession(), ticket); - - sTicketMgr->UpdateLastChange(); - return true; -} - -bool ChatHandler::HandleGMTicketCompleteCommand(const char* args) -{ - if (!*args) - return false; - - uint32 ticketId = atoi(args); - GmTicket* ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket || !ticket->IsClosed() || ticket->IsCompleted()) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - if (Player* player = ticket->GetPlayer()) - if (player->IsInWorld()) - ticket->SendResponse(player->GetSession()); - - sTicketMgr->UpdateLastChange(); - return true; -} - -inline bool ChatHandler::_HandleGMTicketResponseAppendCommand(const char* args, bool newLine) -{ - if (!*args) - return false; - - char* sTicketId = strtok((char*)args, " "); - uint32 ticketId = atoi(sTicketId); - - char* response = strtok(NULL, "\n"); - if (!response) - return false; - - GmTicket* ticket = sTicketMgr->GetTicket(ticketId); - if (!ticket || !ticket->IsClosed()) - { - PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - - // Cannot add response to ticket, assigned to someone else - //! Console excluded - Player* player = m_session ? m_session->GetPlayer() : NULL; - if (player && ticket->IsAssignedNotTo(player->GetGUID())) - { - PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); - return true; - } - - SQLTransaction trans = SQLTransaction(NULL); - ticket->AppendResponse(response); - if (newLine) - ticket->AppendResponse("\n"); - ticket->SaveToDB(trans); - - return true; -} - -bool ChatHandler::HandleGMTicketResponseAppendCommand(const char* args) -{ - return _HandleGMTicketResponseAppendCommand(args, false); -} - -bool ChatHandler::HandleGMTicketResponseAppendLnCommand(const char* args) -{ - return _HandleGMTicketResponseAppendCommand(args, true); -} diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index c95a1aa60d1..72af70f5c26 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -68,6 +68,7 @@ void AddSC_reload_commandscript(); void AddSC_reset_commandscript(); void AddSC_server_commandscript(); void AddSC_tele_commandscript(); +void AddSC_ticket_commandscript(); void AddSC_titles_commandscript(); void AddSC_wp_commandscript(); @@ -679,6 +680,7 @@ void AddCommandScripts() AddSC_reset_commandscript(); AddSC_server_commandscript(); AddSC_tele_commandscript(); + AddSC_ticket_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); } diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 915d94c420c..bb7d27d7dce 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -33,13 +33,13 @@ set(scripts_STAT_SRCS Commands/cs_reload.cpp Commands/cs_reset.cpp Commands/cs_tele.cpp + Commands/cs_ticket.cpp Commands/cs_server.cpp Commands/cs_titles.cpp Commands/cs_wp.cpp # Commands/cs_pdump.cpp # Commands/cs_channel.cpp # Commands/cs_pet.cpp -# Commands/cs_ticket.cpp # Commands/cs_aura.cpp # Commands/cs_unaura.cpp # Commands/cs_nameannounce.cpp diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp new file mode 100644 index 00000000000..baaa5d2bd43 --- /dev/null +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -0,0 +1,509 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: ticket_commandscript +%Complete: 100 +Comment: All ticket related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "AccountMgr.h" +#include "ObjectMgr.h" +#include "TicketMgr.h" + +class ticket_commandscript : public CommandScript +{ +public: + ticket_commandscript() : CommandScript("ticket_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand ticketResponseCommandTable[] = + { + { "append", SEC_MODERATOR, true, &HandleGMTicketResponseAppendCommand, "", NULL }, + { "appendln", SEC_MODERATOR, true, &HandleGMTicketResponseAppendLnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand ticketCommandTable[] = + { + { "assign", SEC_GAMEMASTER, true, &HandleGMTicketAssignToCommand, "", NULL }, + { "close", SEC_MODERATOR, true, &HandleGMTicketCloseByIdCommand, "", NULL }, + { "closedlist", SEC_MODERATOR, true, &HandleGMTicketListClosedCommand, "", NULL }, + { "comment", SEC_MODERATOR, true, &HandleGMTicketCommentCommand, "", NULL }, + { "complete", SEC_MODERATOR, true, &HandleGMTicketCompleteCommand, "", NULL }, + { "delete", SEC_ADMINISTRATOR, true, &HandleGMTicketDeleteByIdCommand, "", NULL }, + { "escalate", SEC_MODERATOR, true, &HandleGMTicketEscalateCommand, "", NULL }, + { "escalatedlist", SEC_GAMEMASTER, true, &HandleGMTicketListEscalatedCommand, "", NULL }, + { "list", SEC_MODERATOR, true, &HandleGMTicketListCommand, "", NULL }, + { "onlinelist", SEC_MODERATOR, true, &HandleGMTicketListOnlineCommand, "", NULL }, + { "reset", SEC_ADMINISTRATOR, true, &HandleGMTicketResetCommand, "", NULL }, + { "response", SEC_MODERATOR, true, NULL, "", ticketResponseCommandTable }, + { "togglesystem", SEC_ADMINISTRATOR, true, &HandleToggleGMTicketSystem, "", NULL }, + { "unassign", SEC_GAMEMASTER, true, &HandleGMTicketUnAssignCommand, "", NULL }, + { "viewid", SEC_MODERATOR, true, &HandleGMTicketGetByIdCommand, "", NULL }, + { "viewname", SEC_MODERATOR, true, &HandleGMTicketGetByNameCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleGMTicketAssignToCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* ticketIdStr = strtok((char*)args, " "); + uint32 ticketId = atoi(ticketIdStr); + + char* targetStr = strtok(NULL, " "); + if (!targetStr) + return false; + + std::string target(targetStr); + if (!normalizePlayerName(target)) + return false; + + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket || ticket->IsClosed()) + { + handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + // Get target information + uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str()); + uint64 targetAccountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); + uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccountId, realmID); + + // Target must exist and have administrative rights + if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel)) + { + handler->SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A); + return true; + } + + // If already assigned, leave + if (ticket->IsAssignedTo(targetGuid)) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId()); + return true; + } + + // If assigned to different player other than current, leave + //! Console can override though + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + if (player && ticket->IsAssignedNotTo(player->GetGUID())) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str()); + return true; + } + + // Assign ticket + SQLTransaction trans = SQLTransaction(NULL); + ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel)); + ticket->SaveToDB(trans); + sTicketMgr->UpdateLastChange(); + + std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL); + handler->SendGlobalGMSysMessage(msg.c_str()); + return true; + } + + static bool HandleGMTicketCloseByIdCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 ticketId = atoi(args); + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket || ticket->IsClosed() || ticket->IsCompleted()) + { + handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + // Ticket should be assigned to the player who tries to close it. + // Console can override though + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + if (player && ticket->IsAssignedNotTo(player->GetGUID())) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId()); + return true; + } + + sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1); + sTicketMgr->UpdateLastChange(); + + std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName() : "Console", NULL, NULL, NULL); + handler->SendGlobalGMSysMessage(msg.c_str()); + + // Inform player, who submitted this ticket, that it is closed + if (Player* submitter = ticket->GetPlayer()) + { + if (submitter->IsInWorld()) + { + WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); + data << uint32(GMTICKET_RESPONSE_TICKET_DELETED); + submitter->GetSession()->SendPacket(&data); + } + } + return true; + } + + static bool HandleGMTicketCommentCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* ticketIdStr = strtok((char*)args, " "); + uint32 ticketId = atoi(ticketIdStr); + + char* comment = strtok(NULL, "\n"); + if (!comment) + return false; + + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket || ticket->IsClosed()) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + // Cannot comment ticket assigned to someone else + //! Console excluded + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + if (player && ticket->IsAssignedNotTo(player->GetGUID())) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); + return true; + } + + SQLTransaction trans = SQLTransaction(NULL); + ticket->SetComment(comment); + ticket->SaveToDB(trans); + 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); + handler->SendGlobalGMSysMessage(msg.c_str()); + + return true; + } + + static bool HandleGMTicketListClosedCommand(ChatHandler* handler, char const* /*args*/) + { + sTicketMgr->ShowClosedList(*handler); + return true; + } + + static bool HandleGMTicketCompleteCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 ticketId = atoi(args); + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket || ticket->IsClosed() || ticket->IsCompleted()) + { + handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + if (Player* player = ticket->GetPlayer()) + if (player->IsInWorld()) + ticket->SendResponse(player->GetSession()); + + sTicketMgr->UpdateLastChange(); + return true; + } + + static bool HandleGMTicketDeleteByIdCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 ticketId = atoi(args); + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket) + { + handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + if (!ticket->IsClosed()) + { + handler->SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST); + return true; + } + + std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console"); + handler->SendGlobalGMSysMessage(msg.c_str()); + + sTicketMgr->RemoveTicket(ticket->GetId()); + sTicketMgr->UpdateLastChange(); + + if (Player* player = ticket->GetPlayer()) + { + if (player->IsInWorld()) + { + // Force abandon ticket + WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); + data << uint32(GMTICKET_RESPONSE_TICKET_DELETED); + player->GetSession()->SendPacket(&data); + } + } + + return true; + } + + static bool HandleGMTicketEscalateCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 ticketId = atoi(args); + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket || ticket->IsClosed() || ticket->IsCompleted() || ticket->GetEscalatedStatus() != TICKET_UNASSIGNED) + { + handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + ticket->SetEscalatedStatus(TICKET_IN_ESCALATION_QUEUE); + + if (Player* player = ticket->GetPlayer()) + if (player->IsInWorld()) + sTicketMgr->SendTicket(player->GetSession(), ticket); + + sTicketMgr->UpdateLastChange(); + return true; + } + + static bool HandleGMTicketListEscalatedCommand(ChatHandler* handler, char const* /*args*/) + { + sTicketMgr->ShowEscalatedList(*handler); + return true; + } + + static bool HandleGMTicketListCommand(ChatHandler* handler, char const* /*args*/) + { + sTicketMgr->ShowList(*handler, false); + return true; + } + + static bool HandleGMTicketListOnlineCommand(ChatHandler* handler, char const* /*args*/) + { + sTicketMgr->ShowList(*handler, true); + return true; + } + + static bool HandleGMTicketResetCommand(ChatHandler* handler, char const* /*args*/) + { + if (sTicketMgr->GetOpenTicketCount()) + { + handler->SendSysMessage(LANG_COMMAND_TICKETPENDING); + return true; + } + else + { + sTicketMgr->ResetTickets(); + handler->SendSysMessage(LANG_COMMAND_TICKETRESET); + } + + return true; + } + + static bool HandleToggleGMTicketSystem(ChatHandler* handler, char const* /*args*/) + { + bool status = !sTicketMgr->GetStatus(); + sTicketMgr->SetStatus(status); + handler->PSendSysMessage(status ? LANG_ALLOW_TICKETS : LANG_DISALLOW_TICKETS); + return true; + } + + static bool HandleGMTicketUnAssignCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 ticketId = atoi(args); + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket || ticket->IsClosed()) + { + handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + // Ticket must be assigned + if (!ticket->IsAssigned()) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->GetId()); + return true; + } + + // Get security level of player, whom this ticket is assigned to + uint32 security = SEC_PLAYER; + Player* assignedPlayer = ticket->GetAssignedPlayer(); + if (assignedPlayer && assignedPlayer->IsInWorld()) + security = assignedPlayer->GetSession()->GetSecurity(); + else + { + uint64 guid = ticket->GetAssignedToGUID(); + uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid); + security = AccountMgr::GetSecurity(accountId, realmID); + } + + // Check security + //! If no m_session present it means we're issuing this command from the console + uint32 mySecurity = handler->GetSession() ? handler->GetSession()->GetSecurity() : SEC_CONSOLE; + if (security > mySecurity) + { + handler->SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY); + return true; + } + + SQLTransaction trans = SQLTransaction(NULL); + ticket->SetUnassigned(); + ticket->SaveToDB(trans); + sTicketMgr->UpdateLastChange(); + + std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), + handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console", NULL); + handler->SendGlobalGMSysMessage(msg.c_str()); + + return true; + } + + static bool HandleGMTicketGetByIdCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 ticketId = atoi(args); + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket || ticket->IsClosed() || ticket->IsCompleted()) + { + handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + SQLTransaction trans = SQLTransaction(NULL); + ticket->SetViewed(); + ticket->SaveToDB(trans); + + handler->SendSysMessage(ticket->FormatMessageString(*handler, true).c_str()); + return true; + } + + static bool HandleGMTicketGetByNameCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string name(args); + if (!normalizePlayerName(name)) + return false; + + // Detect target's GUID + uint64 guid = 0; + if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str())) + guid = player->GetGUID(); + else + guid = sObjectMgr->GetPlayerGUIDByName(name); + + // Target must exist + if (!guid) + { + handler->SendSysMessage(LANG_NO_PLAYERS_FOUND); + return true; + } + + // Ticket must exist + GmTicket* ticket = sTicketMgr->GetTicketByPlayer(guid); + if (!ticket) + { + handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + SQLTransaction trans = SQLTransaction(NULL); + ticket->SetViewed(); + ticket->SaveToDB(trans); + + handler->SendSysMessage(ticket->FormatMessageString(*handler, true).c_str()); + return true; + } + + static bool _HandleGMTicketResponseAppendCommand(char const* args, bool newLine, ChatHandler* handler) + { + if (!*args) + return false; + + char* ticketIdStr = strtok((char*)args, " "); + uint32 ticketId = atoi(ticketIdStr); + + char* response = strtok(NULL, "\n"); + if (!response) + return false; + + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); + if (!ticket || ticket->IsClosed()) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + // Cannot add response to ticket, assigned to someone else + //! Console excluded + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + if (player && ticket->IsAssignedNotTo(player->GetGUID())) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); + return true; + } + + SQLTransaction trans = SQLTransaction(NULL); + ticket->AppendResponse(response); + if (newLine) + ticket->AppendResponse("\n"); + ticket->SaveToDB(trans); + + return true; + } + + static bool HandleGMTicketResponseAppendCommand(ChatHandler* handler, char const* args) + { + return _HandleGMTicketResponseAppendCommand(args, false, handler); + } + + static bool HandleGMTicketResponseAppendLnCommand(ChatHandler* handler, char const* args) + { + return _HandleGMTicketResponseAppendCommand(args, true, handler); + } +}; + +void AddSC_ticket_commandscript() +{ + new ticket_commandscript(); +} -- cgit v1.2.3 From 7c6c488908e6c1c86fb510cb9d7b4b7733155d35 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 17 Jul 2012 00:08:17 +0200 Subject: Core/Spell: Fix Idol of the Crying Wind calculation --- src/server/scripts/Spells/spell_druid.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 4dd115f22ca..b213f3df624 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -625,11 +625,11 @@ class spell_dru_insect_swarm : public SpellScriptLoader { PrepareAuraScript(spell_dru_insect_swarm_AuraScript); - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { if (Unit* caster = GetCaster()) - if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DRUID_ITEM_T8_BALANCE_RELIC, EFFECT_0)) - amount += aurEff->GetAmount(); + if (AuraEffect const* relicAurEff = caster->GetAuraEffect(SPELL_DRUID_ITEM_T8_BALANCE_RELIC, EFFECT_0)) + amount += relicAurEff->GetAmount() / aurEff->GetTotalTicks(); } void Register() -- cgit v1.2.3 From 8f6619ff9c826ec988e61d93550877faca9a0ca3 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 17 Jul 2012 12:49:06 +0200 Subject: Core/Spells: Fix Bauble of True Blood crit heal --- src/server/game/Entities/Unit/Unit.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index fe67a36c163..c68f55c87af 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10844,6 +10844,8 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas case 379: // Earth Shield case 33778: // Lifebloom Final Bloom case 64844: // Divine Hymn + case 71607: // Item - Bauble of True Blood 10m + case 71646: // Item - Bauble of True Blood 25m break; default: return false; -- cgit v1.2.3 From 061439d1125475c7314741fe6c3b7d12e39db967 Mon Sep 17 00:00:00 2001 From: kandera Date: Tue, 17 Jul 2012 13:55:50 -0300 Subject: Core/Spells: fix typo from king of the jungle --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index fe67a36c163..83ed3917235 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6423,7 +6423,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Effect 0 - mod damage while having Enrage if (effIndex == 0) { - if (!(procSpell->SpellFamilyFlags[0] & 0x00080000) || procSpell->SpellIconID != 916) + if (!(procSpell->SpellFamilyFlags[0] & 0x00080000) || procSpell->SpellIconID != 961) return false; triggered_spell_id = 51185; basepoints0 = triggerAmount; -- cgit v1.2.3 From 4df39dae95dc4ad89572e0cff601a70feccf6da6 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 Jul 2012 15:33:14 +0200 Subject: Core/AuctionHouse: Refactored and corrected building auction mail messages --- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 113 ++++++++------------- src/server/game/AuctionHouse/AuctionHouseMgr.h | 3 + src/server/game/Handlers/AuctionHouseHandler.cpp | 7 +- .../Database/Implementation/CharacterDatabase.cpp | 4 +- 4 files changed, 49 insertions(+), 78 deletions(-) (limited to 'src') diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 683a269f508..55315ca9dfe 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -134,15 +134,6 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& // receiver exist if (bidder || bidder_accId) { - std::ostringstream msgAuctionWonSubject; - msgAuctionWonSubject << auction->item_template << ":0:" << AUCTION_WON; - - std::ostringstream msgAuctionWonBody; - msgAuctionWonBody.width(16); - msgAuctionWonBody << std::right << std::hex << auction->owner; - msgAuctionWonBody << std::dec << ':' << auction->bid << ':' << auction->buyout; - sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionWon body string : %s", msgAuctionWonBody.str().c_str()); - // set owner to bidder (to prevent delete item with sender char deleting) // owner in `data` will set at mail receive and item extracting PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER); @@ -157,7 +148,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& bidder->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1); } - MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str()) + MailDraft(auction->BuildAuctionMailSubject(AUCTION_WON), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, 0, 0)) .AddItem(pItem) .SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED); } @@ -170,26 +161,8 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTrans uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid); // owner exist (online or offline) if (owner || owner_accId) - { - std::ostringstream msgAuctionSalePendingSubject; - msgAuctionSalePendingSubject << auction->item_template << ":0:" << AUCTION_SALE_PENDING; - - std::ostringstream msgAuctionSalePendingBody; - uint32 auctionCut = auction->GetAuctionCut(); - - time_t distrTime = time(NULL) + sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY); - - msgAuctionSalePendingBody.width(16); - msgAuctionSalePendingBody << std::right << std::hex << auction->bidder; - msgAuctionSalePendingBody << std::dec << ':' << auction->bid << ':' << auction->buyout; - msgAuctionSalePendingBody << ':' << auction->deposit << ':' << auctionCut << ":0:"; - msgAuctionSalePendingBody << secsToTimeBitFields(distrTime); - - sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); - - MailDraft(msgAuctionSalePendingSubject.str(), msgAuctionSalePendingBody.str()) + MailDraft(auction->BuildAuctionMailSubject(AUCTION_SALE_PENDING), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut())) .SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED); - } } //call this method to send mail to auction owner, when auction is successful, it does not clear ram @@ -201,20 +174,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa // owner exist if (owner || owner_accId) { - std::ostringstream msgAuctionSuccessfulSubject; - msgAuctionSuccessfulSubject << auction->item_template << ":0:" << AUCTION_SUCCESSFUL; - - std::ostringstream auctionSuccessfulBody; - uint32 auctionCut = auction->GetAuctionCut(); - - auctionSuccessfulBody.width(16); - auctionSuccessfulBody << std::right << std::hex << auction->bidder; - auctionSuccessfulBody << std::dec << ':' << auction->bid << ':' << auction->buyout; - auctionSuccessfulBody << ':' << auction->deposit << ':' << auctionCut; - - sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str()); - - uint32 profit = auction->bid + auction->deposit - auctionCut; + uint32 profit = auction->bid + auction->deposit - auction->GetAuctionCut(); //FIXME: what do if owner offline if (owner) @@ -224,7 +184,8 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa //send auction owner notification, bidder must be current! owner->GetSession()->SendAuctionOwnerNotification(auction); } - MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str()) + + MailDraft(auction->BuildAuctionMailSubject(AUCTION_SUCCESSFUL), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut())) .AddMoney(profit) .SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY)); } @@ -244,13 +205,10 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti // owner exist if (owner || owner_accId) { - std::ostringstream subject; - subject << auction->item_template << ":0:" << AUCTION_EXPIRED << ":0:0"; - if (owner) owner->GetSession()->SendAuctionOwnerNotification(auction); - MailDraft(subject.str(), "") // TODO: fix body + MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0)) .AddItem(pItem) .SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0); } @@ -269,13 +227,10 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new // old bidder exist if (oldBidder || oldBidder_accId) { - std::ostringstream msgAuctionOutbiddedSubject; - msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED << ":0:0"; - if (oldBidder && newBidder) oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template); - MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body + MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(0, auction->bid, 0, 0, 0)) .AddMoney(auction->bid) .SendMailTo(trans, MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED); } @@ -293,14 +248,9 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ // bidder exist if (bidder || bidder_accId) - { - std::ostringstream msgAuctionCancelledSubject; - msgAuctionCancelledSubject << auction->item_template << ":0:" << AUCTION_CANCELLED_TO_BIDDER << ":0:0"; - - MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body + MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), AuctionEntry::BuildAuctionMailBody(0, auction->bid, 0, 0, 0)) .AddMoney(auction->bid) .SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED); - } } void AuctionHouseMgr::LoadAuctionItems() @@ -726,13 +676,14 @@ bool AuctionEntry::LoadFromDB(Field* fields) auctioneer = fields[1].GetUInt32(); item_guidlow = fields[2].GetUInt32(); item_template = fields[3].GetUInt32(); - owner = fields[4].GetUInt32(); - buyout = fields[5].GetUInt32(); - expire_time = fields[6].GetUInt32(); - bidder = fields[7].GetUInt32(); - bid = fields[8].GetUInt32(); - startbid = fields[9].GetUInt32(); - deposit = fields[10].GetUInt32(); + itemCount = fields[4].GetUInt32(); + owner = fields[5].GetUInt32(); + buyout = fields[6].GetUInt32(); + expire_time = fields[7].GetUInt32(); + bidder = fields[8].GetUInt32(); + bid = fields[9].GetUInt32(); + startbid = fields[10].GetUInt32(); + deposit = fields[11].GetUInt32(); CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer); if (!auctioneerData) @@ -847,13 +798,14 @@ bool AuctionEntry::LoadFromFieldList(Field* fields) auctioneer = fields[1].GetUInt32(); item_guidlow = fields[2].GetUInt32(); item_template = fields[3].GetUInt32(); - owner = fields[4].GetUInt32(); - buyout = fields[5].GetUInt32(); - expire_time = fields[6].GetUInt32(); - bidder = fields[7].GetUInt32(); - bid = fields[8].GetUInt32(); - startbid = fields[9].GetUInt32(); - deposit = fields[10].GetUInt32(); + itemCount = fields[4].GetUInt32(); + owner = fields[5].GetUInt32(); + buyout = fields[6].GetUInt32(); + expire_time = fields[7].GetUInt32(); + bidder = fields[8].GetUInt32(); + bid = fields[9].GetUInt32(); + startbid = fields[10].GetUInt32(); + deposit = fields[11].GetUInt32(); CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer); if (!auctioneerData) @@ -880,3 +832,20 @@ bool AuctionEntry::LoadFromFieldList(Field* fields) return true; } + +std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const +{ + std::ostringstream strm; + strm << item_template << ":0:" << response << ':' << Id << ':' << itemCount; + return strm.str(); +} + +std::string AuctionEntry::BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut) +{ + std::ostringstream strm; + strm.width(16); + strm << std::right << std::hex << MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); // HIGHGUID_PLAYER always present, even for empty guids + strm << std::dec << ':' << bid << ':' << buyout; + strm << ':' << deposit << ':' << cut; + return strm.str(); +} diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index 190fbcc5107..10e49b493f1 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -54,6 +54,7 @@ struct AuctionEntry uint32 auctioneer; // creature low guid uint32 item_guidlow; uint32 item_template; + uint32 itemCount; uint32 owner; uint32 startbid; //maybe useless uint32 bid; @@ -74,6 +75,8 @@ struct AuctionEntry void SaveToDB(SQLTransaction& trans) const; bool LoadFromDB(Field* fields); bool LoadFromFieldList(Field* fields); + std::string BuildAuctionMailSubject(MailAuctionAnswers response) const; + static std::string BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut); }; diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 3aee9ff0b00..7585af7eb60 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -252,6 +252,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) AH->item_guidlow = item->GetGUIDLow(); AH->item_template = item->GetEntry(); + AH->itemCount = item->GetCount(); AH->owner = _player->GetGUIDLow(); AH->startbid = bid; AH->bidder = 0; @@ -297,6 +298,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) AH->item_guidlow = newItem->GetGUIDLow(); AH->item_template = newItem->GetEntry(); + AH->itemCount = newItem->GetCount(); AH->owner = _player->GetGUIDLow(); AH->startbid = bid; AH->bidder = 0; @@ -520,12 +522,9 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans); player->ModifyMoney(-int32(auctionCut)); } - // Return the item by mail - std::ostringstream msgAuctionCanceledOwner; - msgAuctionCanceledOwner << auction->item_template << ":0:" << AUCTION_CANCELED << ":0:0"; // item will deleted or added to received mail list - MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body + MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0)) .AddItem(pItem) .SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 3bb6783f8cf..c7a283c94d7 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -109,7 +109,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ACTIONS_SPEC, "SELECT button, action, type FROM character_action WHERE guid = ? AND spec = ? ORDER BY button", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_MAILITEMS, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, item_guid, itemEntry, owner_guid FROM mail_items mi JOIN item_instance ii ON mi.item_guid = ii.guid WHERE mail_id = ?", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_AUCTION_ITEMS, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, itemguid, itemEntry FROM auctionhouse ah JOIN item_instance ii ON ah.itemguid = ii.guid", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH) + PREPARE_STATEMENT(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_INS_AUCTION, "INSERT INTO auctionhouse (id, auctioneerguid, itemguid, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_AUCTION, "DELETE FROM auctionhouse WHERE id = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_AUCTION_BY_TIME, "SELECT id FROM auctionhouse WHERE time <= ? ORDER BY TIME ASC", CONNECTION_SYNCH); @@ -338,7 +338,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_INS_LAG_REPORT, "INSERT INTO lag_reports (guid, lagType, mapId, posX, posY, posZ, latency, createTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) // For loading and deleting expired auctions at startup - PREPARE_STATEMENT(CHAR_SEL_EXPIRED_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ah.time <= ?", CONNECTION_SYNCH) + PREPARE_STATEMENT(CHAR_SEL_EXPIRED_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ah.time <= ?", CONNECTION_SYNCH) // LFG Data PREPARE_STATEMENT(CHAR_INS_LFG_DATA, "INSERT INTO lfg_data (guid, dungeon, state) VALUES (?, ?, ?)", CONNECTION_ASYNC) -- cgit v1.2.3 From 8d18bae5c8173b924d6df5b5b222af5345abcf69 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 Jul 2012 15:34:21 +0200 Subject: Core/MailSystem: Fixed building unread mail notifications, will now display properly for non-player senders (achievement rewards/auctions) --- src/server/game/Handlers/MailHandler.cpp | 46 ++++++++++++++------------------ 1 file changed, 20 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 4fb0ab2e9c1..69a84892e76 100755 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -573,8 +573,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr) { - // packet send mail count as uint8, prevent overflow - if (mailsCount >= 254) + // Only first 50 mails are displayed + if (mailsCount >= 50) { realCount += 1; continue; @@ -586,7 +586,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) uint8 item_count = (*itr)->items.size(); // max count is MAX_MAIL_ITEMS (12) - size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+7*3*4+4+4+4+4+4+4+1); + size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+MAX_INSPECTED_ENCHANTMENT_SLOT*3*4+4+4+4+4+4+4+1); if (data.wpos()+next_mail_size > maxPacketSize) { @@ -655,8 +655,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) data << uint8(0); } - realCount += 1; - mailsCount += 1; + ++realCount; + ++mailsCount; } data.put(0, realCount); // this will display warning about undelivered mail to player if realCount > mailsCount @@ -743,11 +743,12 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/) if (_player->unReadMails > 0) { - data << uint32(0); // float + data << float(0); // float data << uint32(0); // count uint32 count = 0; time_t now = time(NULL); + std::set sentSenders; for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr) { Mail* m = (*itr); @@ -759,36 +760,29 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/) if (now < m->deliver_time) continue; - if (m->messageType) - data << uint64(m->sender); // player guid - else - data << uint32(m->sender); // creature entry + // only send each mail sender once + if (sentSenders.count(m->sender)) + continue; - switch (m->messageType) - { - case MAIL_AUCTION: - data << uint32(2); - data << uint32(2); - data << uint32(m->stationery); - break; - default: - data << uint32(0); - data << uint32(0); - data << uint32(m->stationery); - break; - } - data << uint32(0xC6000000); // float unk, time or something + data << uint64(m->messageType == MAIL_NORMAL ? m->sender : 0); // player guid + data << uint32(m->messageType != MAIL_NORMAL ? m->sender : 0); // non-player entries + data << uint32(m->messageType); + data << uint32(m->stationery); + data << float(m->deliver_time - now); + sentSenders.insert(m->sender); ++count; if (count == 2) // do not display more than 2 mails break; } + data.put(4, count); } else { - data << uint32(0xC7A8C000); - data << uint32(0x00000000); + data << float(-DAY); + data << uint32(0); } + SendPacket(&data); } -- cgit v1.2.3 From 2cdb37de613d4b0d20b9e3e6af7f2e26b339acdc Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 Jul 2012 15:51:08 +0200 Subject: Compile fix --- src/server/game/AuctionHouse/AuctionHouseMgr.h | 11 +++++++++++ src/server/game/Mails/Mail.h | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index 10e49b493f1..049440f99d0 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -48,6 +48,17 @@ enum AuctionAction AUCTION_PLACE_BID = 2 }; +enum MailAuctionAnswers +{ + AUCTION_OUTBIDDED = 0, + AUCTION_WON = 1, + AUCTION_SUCCESSFUL = 2, + AUCTION_EXPIRED = 3, + AUCTION_CANCELLED_TO_BIDDER = 4, + AUCTION_CANCELED = 5, + AUCTION_SALE_PENDING = 6 +}; + struct AuctionEntry { uint32 Id; diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h index dbd03bd96ee..ea319c731d0 100755 --- a/src/server/game/Mails/Mail.h +++ b/src/server/game/Mails/Mail.h @@ -67,17 +67,6 @@ enum MailState MAIL_STATE_DELETED = 3 }; -enum MailAuctionAnswers -{ - AUCTION_OUTBIDDED = 0, - AUCTION_WON = 1, - AUCTION_SUCCESSFUL = 2, - AUCTION_EXPIRED = 3, - AUCTION_CANCELLED_TO_BIDDER = 4, - AUCTION_CANCELED = 5, - AUCTION_SALE_PENDING = 6 -}; - enum MailShowFlags { MAIL_SHOW_UNK0 = 0x0001, -- cgit v1.2.3 From 9d4a5e2a6ca6a5b0676db842de3e7ce48b68d369 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 20 Jul 2012 16:13:50 +0200 Subject: Core/AuctionHouse: Corrected mail body for auction outbid and cancelled mails (sent to bidder) --- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 55315ca9dfe..889f9d6fb75 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -230,7 +230,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new if (oldBidder && newBidder) oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template); - MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(0, auction->bid, 0, 0, 0)) + MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut())) .AddMoney(auction->bid) .SendMailTo(trans, MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED); } @@ -248,7 +248,7 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ // bidder exist if (bidder || bidder_accId) - MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), AuctionEntry::BuildAuctionMailBody(0, auction->bid, 0, 0, 0)) + MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, 0)) .AddMoney(auction->bid) .SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED); } -- cgit v1.2.3 From c7a0378a826b11c6f15cf523ca639b97ccdf7c65 Mon Sep 17 00:00:00 2001 From: Santiago Date: Sat, 21 Jul 2012 01:29:15 -0300 Subject: Core/SAI: Added new parameter to actions 90 and 91 Allows to set and remove all possible bytes1 based on `type` parameter You can see them listed in Unit.h for reference --- src/server/game/AI/SmartScripts/SmartScript.cpp | 4 ++-- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 103cde80f43..82d0945874c 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1782,7 +1782,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, 0, e.action.setunitByte.byte1); + (*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, e.action.setunitByte.type, e.action.setunitByte.byte1); delete targets; break; @@ -1795,7 +1795,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 0, e.action.delunitByte.byte1); + (*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, e.action.delunitByte.type, e.action.delunitByte.byte1); delete targets; break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index cdb662edbaf..bc390441e04 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -827,11 +827,13 @@ struct SmartAction struct { uint32 byte1; + uint32 type; } setunitByte; struct { uint32 byte1; + uint32 type; } delunitByte; struct -- cgit v1.2.3 From 395994c707f2cb1cc5a6022d9f9fc729df64b1dc Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 22 Jul 2012 13:46:00 +0200 Subject: Core/Groups: Send player invalid notification when attempting to invite GM to group when that is disabled --- src/server/game/Handlers/GroupHandler.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 18435263b2e..e6473d0e7d9 100755 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -84,7 +84,10 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data) // restrict invite to GMs if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->isGameMaster() && player->isGameMaster()) + { + SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S); return; + } // can't group with if (!GetPlayer()->isGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam()) -- cgit v1.2.3 From 1fd37ac61b606a8db29e3ff04c3c0dba5f45228e Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 22 Jul 2012 14:20:26 +0200 Subject: Core/Object: Use updatefield flags extracted from client to determine whether to send or not a field value instead of sending all data to client for non-player objects --- src/server/game/Entities/Object/Object.cpp | 100 +- src/server/game/Entities/Object/Object.h | 14 +- .../Entities/Object/Updates/UpdateFieldFlags.cpp | 1568 ++++++++++++++++++++ .../Entities/Object/Updates/UpdateFieldFlags.h | 43 + .../game/Entities/Object/Updates/UpdateMask.h | 26 +- src/server/game/Entities/Player/Player.cpp | 117 +- src/server/game/Entities/Player/Player.h | 6 - src/server/game/Entities/Unit/Unit.cpp | 30 +- src/server/game/Entities/Unit/Unit.h | 19 +- src/server/game/Groups/Group.cpp | 42 + src/server/game/Spells/SpellEffects.cpp | 2 +- src/server/game/World/World.cpp | 1 - 12 files changed, 1791 insertions(+), 177 deletions(-) create mode 100644 src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp create mode 100644 src/server/game/Entities/Object/Updates/UpdateFieldFlags.h (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index fc1b56c4b8c..7a4c42027dc 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -41,12 +41,13 @@ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "SpellAuraEffects.h" - +#include "UpdateFieldFlags.h" #include "TemporarySummon.h" #include "Totem.h" #include "OutdoorPvPMgr.h" #include "MovementPacketBuilder.h" #include "DynamicTree.h" +#include "Group.h" uint32 GuidHigh2TypeId(uint32 guid_hi) { @@ -74,6 +75,7 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1) m_uint32Values = NULL; _changedFields = NULL; m_valuesCount = 0; + _fieldNotifyFlags = UF_FLAG_DYNAMIC; m_inWorld = false; m_objectUpdated = false; @@ -463,17 +465,13 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) IsActivateToQuest = true; - updateMask->SetBit(GAMEOBJECT_DYNAMIC); - if (((GameObject*)this)->GetGoArtKit()) updateMask->SetBit(GAMEOBJECT_BYTES_1); } else if (isType(TYPEMASK_UNIT)) { if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) - { updateMask->SetBit(UNIT_FIELD_AURASTATE); - } } } else // case UPDATETYPE_VALUES @@ -481,10 +479,8 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport()) { if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) - { IsActivateToQuest = true; - } - updateMask->SetBit(GAMEOBJECT_DYNAMIC); + updateMask->SetBit(GAMEOBJECT_BYTES_1); if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST && ToGameObject()->GetGOInfo()->chest.groupLootRules && @@ -494,9 +490,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* else if (isType(TYPEMASK_UNIT)) { if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) - { updateMask->SetBit(UNIT_FIELD_AURASTATE); - } } } @@ -788,26 +782,96 @@ void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 cou } } -void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const +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 + switch (GetTypeId()) + { + case TYPEID_ITEM: + case TYPEID_CONTAINER: + flags = ItemUpdateFieldFlags; + isOwner = isItemOwner = ((Item*)this)->GetOwnerGUID() == target->GetGUID(); + break; + case TYPEID_UNIT: + case TYPEID_PLAYER: + { + Player* plr = ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself(); + flags = UnitUpdateFieldFlags; + isOwner = ToUnit()->GetOwnerGUID() == target->GetGUID(); + hasSpecialInfo = ToUnit()->HasAuraTypeWithCaster(SPELL_AURA_EMPATHY, target->GetGUID()); + isPartyMember = plr && plr->IsInSameGroupWith(target); + break; + } + case TYPEID_GAMEOBJECT: + flags = GameObjectUpdateFieldFlags; + isOwner = ToGameObject()->GetOwnerGUID() == target->GetGUID(); + break; + case TYPEID_DYNAMICOBJECT: + flags = DynamicObjectUpdateFieldFlags; + isOwner = ((DynamicObject*)this)->GetCasterGUID() == target->GetGUID(); + break; + case TYPEID_CORPSE: + flags = CorpseUpdateFieldFlags; + isOwner = ToCorpse()->GetOwnerGUID() == target->GetGUID(); + break; + } +} + +bool Object::IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool isItemOwner, bool isPartyMember) const +{ + if (flags == UF_FLAG_NONE) + return false; + + if (flags & UF_FLAG_PUBLIC) + return true; + + if (flags & UF_FLAG_PRIVATE && isSelf) + return true; + + if (flags & UF_FLAG_OWNER && isOwner) + return true; + + if (flags & UF_FLAG_ITEM_OWNER && isItemOwner) + return true; + + if (flags & UF_FLAG_PARTY_MEMBER && isPartyMember) + return true; + + return false; +} + +void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const { bool* indexes = _changedFields; + uint32* flags = NULL; + bool isSelf = target == this; + bool isOwner = false; + bool isItemOwner = false; + bool hasSpecialInfo = false; + bool isPartyMember = false; + + GetUpdateFieldData(target, flags, isOwner, isItemOwner, hasSpecialInfo, isPartyMember); for (uint16 index = 0; index < m_valuesCount; ++index, ++indexes) - { - if (*indexes) + if (_fieldNotifyFlags & flags[index] || (flags[index] & UF_FLAG_SPECIAL_INFO && hasSpecialInfo) || (*indexes && IsUpdateFieldVisible(flags[index], isSelf, isOwner, isItemOwner, isPartyMember))) updateMask->SetBit(index); - } } -void Object::_SetCreateBits(UpdateMask* updateMask, Player* /*target*/) const +void Object::_SetCreateBits(UpdateMask* updateMask, Player* target) const { uint32* value = m_uint32Values; + uint32* flags = NULL; + bool isSelf = target == this; + bool isOwner = false; + bool isItemOwner = false; + bool hasSpecialInfo = false; + bool isPartyMember = false; + + GetUpdateFieldData(target, flags, isOwner, isItemOwner, hasSpecialInfo, isPartyMember); for (uint16 index = 0; index < m_valuesCount; ++index, ++value) - { - if (*value) + if (_fieldNotifyFlags & flags[index] || (flags[index] & UF_FLAG_SPECIAL_INFO && hasSpecialInfo) || (*value && IsUpdateFieldVisible(flags[index], isSelf, isOwner, isItemOwner, isPartyMember))) updateMask->SetBit(index); - } } void Object::SetInt32Value(uint16 index, int32 value) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 7a91289a95d..ab9ea2daea9 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -300,6 +300,9 @@ class Object virtual void BuildUpdate(UpdateDataMapType&) {} void BuildFieldsUpdate(Player*, UpdateDataMapType &) const; + void SetFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags |= flag; } + void RemoveFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags &= ~flag; } + // FG: some hacky helpers void ForceValuesUpdateAtIndex(uint32); @@ -320,13 +323,16 @@ class Object Object(); void _InitValues(); - void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh); + 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); - virtual void _SetUpdateBits(UpdateMask* updateMask, Player* target) const; + void GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const; + + bool IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool isItemOwner, bool isPartyMember) const; - virtual void _SetCreateBits(UpdateMask* updateMask, Player* target) const; + void _SetUpdateBits(UpdateMask* updateMask, Player* target) const; + void _SetCreateBits(UpdateMask* updateMask, Player* target) const; void _BuildMovementUpdate(ByteBuffer * data, uint16 flags) const; void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask* updateMask, Player* target) const; @@ -346,6 +352,8 @@ class Object uint16 m_valuesCount; + uint16 _fieldNotifyFlags; + bool m_objectUpdated; private: diff --git a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp new file mode 100644 index 00000000000..95bdaef221b --- /dev/null +++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp @@ -0,0 +1,1568 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +#include "UpdateFieldFlags.h" + +uint32 ItemUpdateFieldFlags[CONTAINER_END] = +{ + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1 + UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE + UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY + UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X + UF_FLAG_NONE, // OBJECT_FIELD_PADDING + UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER + UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_CONTAINED + UF_FLAG_PUBLIC, // ITEM_FIELD_CONTAINED+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR + UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_GIFTCREATOR + UF_FLAG_PUBLIC, // ITEM_FIELD_GIFTCREATOR+1 + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_STACK_COUNT + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_DURATION + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+1 + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+2 + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+3 + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+4 + UF_FLAG_PUBLIC, // ITEM_FIELD_FLAGS + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_1+1 + UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_3 + UF_FLAG_PUBLIC, // ITEM_FIELD_PROPERTY_SEED + UF_FLAG_PUBLIC, // ITEM_FIELD_RANDOM_PROPERTIES_ID + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_DURABILITY + UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_MAXDURABILITY + UF_FLAG_PUBLIC, // ITEM_FIELD_CREATE_PLAYED_TIME + UF_FLAG_NONE, // ITEM_FIELD_PAD + UF_FLAG_PUBLIC, // CONTAINER_FIELD_NUM_SLOTS + UF_FLAG_NONE, // CONTAINER_ALIGN_PAD + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+1 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+2 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+3 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+4 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+5 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+6 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+7 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+8 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+9 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+10 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+11 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+12 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+13 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+14 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+15 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+16 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+17 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+18 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+19 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+20 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+21 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+22 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+23 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+24 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+25 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+26 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+27 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+28 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+29 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+30 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+31 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+32 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+33 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+34 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+35 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+36 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+37 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+38 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+39 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+40 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+41 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+42 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+43 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+44 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+45 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+46 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+47 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+48 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+49 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+50 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+51 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+52 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+53 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+54 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+55 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+56 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+57 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+58 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+59 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+60 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+61 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+62 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+63 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+64 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+65 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+66 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+67 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+68 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+69 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+70 + UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+71 +}; + +uint32 UnitUpdateFieldFlags[PLAYER_END] = +{ + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1 + UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE + UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY + UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X + UF_FLAG_NONE, // OBJECT_FIELD_PADDING + UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM + UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM+1 + UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON + UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON+1 + UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER + UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER+1 + UF_FLAG_PUBLIC, // UNIT_FIELD_CHARMEDBY + UF_FLAG_PUBLIC, // UNIT_FIELD_CHARMEDBY+1 + UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMONEDBY + UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMONEDBY+1 + UF_FLAG_PUBLIC, // UNIT_FIELD_CREATEDBY + UF_FLAG_PUBLIC, // UNIT_FIELD_CREATEDBY+1 + UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET + UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET+1 + UF_FLAG_PUBLIC, // UNIT_FIELD_CHANNEL_OBJECT + UF_FLAG_PUBLIC, // UNIT_FIELD_CHANNEL_OBJECT+1 + UF_FLAG_PUBLIC, // UNIT_CHANNEL_SPELL + UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_0 + UF_FLAG_PUBLIC, // UNIT_FIELD_HEALTH + UF_FLAG_PUBLIC, // UNIT_FIELD_POWER1 + UF_FLAG_PUBLIC, // UNIT_FIELD_POWER2 + UF_FLAG_PUBLIC, // UNIT_FIELD_POWER3 + UF_FLAG_PUBLIC, // UNIT_FIELD_POWER4 + UF_FLAG_PUBLIC, // UNIT_FIELD_POWER5 + UF_FLAG_PUBLIC, // UNIT_FIELD_POWER6 + UF_FLAG_PUBLIC, // UNIT_FIELD_POWER7 + UF_FLAG_PUBLIC, // UNIT_FIELD_MAXHEALTH + UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER1 + UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER2 + UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER3 + UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER4 + UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER5 + UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER6 + UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER7 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+5 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+6 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+5 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+6 + UF_FLAG_PUBLIC, // UNIT_FIELD_LEVEL + UF_FLAG_PUBLIC, // UNIT_FIELD_FACTIONTEMPLATE + UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID + UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID+1 + UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID+2 + UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS + UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS_2 + UF_FLAG_PUBLIC, // UNIT_FIELD_AURASTATE + UF_FLAG_PUBLIC, // UNIT_FIELD_BASEATTACKTIME + UF_FLAG_PUBLIC, // UNIT_FIELD_BASEATTACKTIME+1 + UF_FLAG_PRIVATE, // UNIT_FIELD_RANGEDATTACKTIME + UF_FLAG_PUBLIC, // UNIT_FIELD_BOUNDINGRADIUS + UF_FLAG_PUBLIC, // UNIT_FIELD_COMBATREACH + UF_FLAG_PUBLIC, // UNIT_FIELD_DISPLAYID + UF_FLAG_PUBLIC, // UNIT_FIELD_NATIVEDISPLAYID + UF_FLAG_PUBLIC, // UNIT_FIELD_MOUNTDISPLAYID + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MINDAMAGE + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MAXDAMAGE + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MINOFFHANDDAMAGE + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MAXOFFHANDDAMAGE + UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_1 + UF_FLAG_PUBLIC, // UNIT_FIELD_PETNUMBER + UF_FLAG_PUBLIC, // UNIT_FIELD_PET_NAME_TIMESTAMP + UF_FLAG_OWNER, // UNIT_FIELD_PETEXPERIENCE + UF_FLAG_OWNER, // UNIT_FIELD_PETNEXTLEVELEXP + UF_FLAG_DYNAMIC, // UNIT_DYNAMIC_FLAGS + UF_FLAG_PUBLIC, // UNIT_MOD_CAST_SPEED + UF_FLAG_PUBLIC, // UNIT_CREATED_BY_SPELL + UF_FLAG_DYNAMIC, // UNIT_NPC_FLAGS + UF_FLAG_PUBLIC, // UNIT_NPC_EMOTESTATE + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT0 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT0 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT0 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+5 + UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+6 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+5 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+6 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+5 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+6 + UF_FLAG_PUBLIC, // UNIT_FIELD_BASE_MANA + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_BASE_HEALTH + UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER_MODS + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER_MULTIPLIER + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER_MODS + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MINRANGEDDAMAGE + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MAXRANGEDDAMAGE + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+5 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+6 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+1 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+2 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+3 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+4 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+5 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+6 + UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MAXHEALTHMODIFIER + UF_FLAG_PUBLIC, // UNIT_FIELD_HOVERHEIGHT + UF_FLAG_NONE, // UNIT_FIELD_PADDING + UF_FLAG_PUBLIC, // PLAYER_DUEL_ARBITER + UF_FLAG_PUBLIC, // PLAYER_DUEL_ARBITER+1 + UF_FLAG_PUBLIC, // PLAYER_FLAGS + UF_FLAG_PUBLIC, // PLAYER_GUILDID + UF_FLAG_PUBLIC, // PLAYER_GUILDRANK + UF_FLAG_PUBLIC, // PLAYER_BYTES + UF_FLAG_PUBLIC, // PLAYER_BYTES_2 + UF_FLAG_PUBLIC, // PLAYER_BYTES_3 + UF_FLAG_PUBLIC, // PLAYER_DUEL_TEAM + UF_FLAG_PUBLIC, // PLAYER_GUILD_TIMESTAMP + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_1_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_4 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_2_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_3_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_4_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_5_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_6_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_7_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_8_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_9_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_10_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_11_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_12_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_13_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_14_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_15_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_16_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_17_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_18_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_19_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_20_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_21_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_22_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_23_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_24_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_5 + UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_25_1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_2 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_3 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_3+1 + UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_5 + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_1_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_2_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_2_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_3_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_3_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_4_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_4_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_5_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_5_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_6_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_6_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_7_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_7_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_8_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_8_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_9_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_9_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_10_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_10_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_11_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_11_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_12_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_12_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_13_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_13_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_14_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_14_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_15_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_15_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_16_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_16_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_17_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_17_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_18_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_18_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_19_ENTRYID + UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_19_ENCHANTMENT + UF_FLAG_PUBLIC, // PLAYER_CHOSEN_TITLE + UF_FLAG_PUBLIC, // PLAYER_FAKE_INEBRIATION + UF_FLAG_NONE, // PLAYER_FIELD_PAD_0 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+21 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+22 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+23 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+24 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+25 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+26 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+27 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+28 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+29 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+30 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+31 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+32 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+33 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+34 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+35 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+36 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+37 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+38 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+39 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+40 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+41 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+42 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+43 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+44 + UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+45 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+21 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+22 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+23 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+24 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+25 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+26 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+27 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+28 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+29 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+30 + UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+31 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+21 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+22 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+23 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+24 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+25 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+26 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+27 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+28 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+29 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+30 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+31 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+32 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+33 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+34 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+35 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+36 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+37 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+38 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+39 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+40 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+41 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+42 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+43 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+44 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+45 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+46 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+47 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+48 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+49 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+50 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+51 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+52 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+53 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+54 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+55 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+21 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+22 + UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+23 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+21 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+22 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+23 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+24 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+25 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+26 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+27 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+28 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+29 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+30 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+31 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+32 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+33 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+34 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+35 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+36 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+37 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+38 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+39 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+40 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+41 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+42 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+43 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+44 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+45 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+46 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+47 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+48 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+49 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+50 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+51 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+52 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+53 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+54 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+55 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+56 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+57 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+58 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+59 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+60 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+61 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+62 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+63 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+21 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+22 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+23 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+24 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+25 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+26 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+27 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+28 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+29 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+30 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+31 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+32 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+33 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+34 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+35 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+36 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+37 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+38 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+39 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+40 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+41 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+42 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+43 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+44 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+45 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+46 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+47 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+48 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+49 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+50 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+51 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+52 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+53 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+54 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+55 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+56 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+57 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+58 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+59 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+60 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+61 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+62 + UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+63 + UF_FLAG_PRIVATE, // PLAYER_FARSIGHT + UF_FLAG_PRIVATE, // PLAYER_FARSIGHT+1 + UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES + UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES+1 + UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES1 + UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES1+1 + UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES2 + UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES2+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KNOWN_CURRENCIES + UF_FLAG_PRIVATE, // PLAYER_FIELD_KNOWN_CURRENCIES+1 + UF_FLAG_PRIVATE, // PLAYER_XP + UF_FLAG_PRIVATE, // PLAYER_NEXT_LEVEL_XP + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+1 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+2 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+3 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+4 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+5 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+6 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+7 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+8 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+9 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+10 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+11 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+12 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+13 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+14 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+15 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+16 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+17 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+18 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+19 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+20 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+21 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+22 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+23 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+24 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+25 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+26 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+27 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+28 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+29 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+30 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+31 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+32 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+33 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+34 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+35 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+36 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+37 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+38 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+39 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+40 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+41 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+42 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+43 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+44 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+45 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+46 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+47 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+48 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+49 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+50 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+51 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+52 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+53 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+54 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+55 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+56 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+57 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+58 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+59 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+60 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+61 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+62 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+63 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+64 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+65 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+66 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+67 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+68 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+69 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+70 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+71 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+72 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+73 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+74 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+75 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+76 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+77 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+78 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+79 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+80 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+81 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+82 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+83 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+84 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+85 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+86 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+87 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+88 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+89 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+90 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+91 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+92 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+93 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+94 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+95 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+96 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+97 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+98 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+99 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+100 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+101 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+102 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+103 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+104 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+105 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+106 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+107 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+108 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+109 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+110 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+111 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+112 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+113 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+114 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+115 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+116 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+117 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+118 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+119 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+120 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+121 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+122 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+123 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+124 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+125 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+126 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+127 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+128 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+129 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+130 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+131 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+132 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+133 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+134 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+135 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+136 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+137 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+138 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+139 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+140 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+141 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+142 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+143 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+144 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+145 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+146 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+147 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+148 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+149 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+150 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+151 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+152 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+153 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+154 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+155 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+156 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+157 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+158 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+159 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+160 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+161 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+162 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+163 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+164 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+165 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+166 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+167 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+168 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+169 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+170 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+171 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+172 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+173 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+174 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+175 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+176 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+177 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+178 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+179 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+180 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+181 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+182 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+183 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+184 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+185 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+186 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+187 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+188 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+189 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+190 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+191 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+192 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+193 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+194 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+195 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+196 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+197 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+198 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+199 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+200 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+201 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+202 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+203 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+204 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+205 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+206 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+207 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+208 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+209 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+210 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+211 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+212 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+213 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+214 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+215 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+216 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+217 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+218 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+219 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+220 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+221 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+222 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+223 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+224 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+225 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+226 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+227 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+228 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+229 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+230 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+231 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+232 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+233 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+234 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+235 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+236 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+237 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+238 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+239 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+240 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+241 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+242 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+243 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+244 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+245 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+246 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+247 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+248 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+249 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+250 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+251 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+252 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+253 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+254 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+255 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+256 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+257 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+258 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+259 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+260 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+261 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+262 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+263 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+264 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+265 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+266 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+267 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+268 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+269 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+270 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+271 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+272 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+273 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+274 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+275 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+276 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+277 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+278 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+279 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+280 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+281 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+282 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+283 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+284 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+285 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+286 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+287 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+288 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+289 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+290 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+291 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+292 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+293 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+294 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+295 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+296 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+297 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+298 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+299 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+300 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+301 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+302 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+303 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+304 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+305 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+306 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+307 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+308 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+309 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+310 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+311 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+312 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+313 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+314 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+315 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+316 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+317 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+318 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+319 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+320 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+321 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+322 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+323 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+324 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+325 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+326 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+327 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+328 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+329 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+330 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+331 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+332 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+333 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+334 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+335 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+336 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+337 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+338 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+339 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+340 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+341 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+342 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+343 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+344 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+345 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+346 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+347 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+348 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+349 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+350 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+351 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+352 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+353 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+354 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+355 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+356 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+357 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+358 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+359 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+360 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+361 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+362 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+363 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+364 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+365 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+366 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+367 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+368 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+369 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+370 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+371 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+372 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+373 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+374 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+375 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+376 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+377 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+378 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+379 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+380 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+381 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+382 + UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+383 + UF_FLAG_PRIVATE, // PLAYER_CHARACTER_POINTS1 + UF_FLAG_PRIVATE, // PLAYER_CHARACTER_POINTS2 + UF_FLAG_PRIVATE, // PLAYER_TRACK_CREATURES + UF_FLAG_PRIVATE, // PLAYER_TRACK_RESOURCES + UF_FLAG_PRIVATE, // PLAYER_BLOCK_PERCENTAGE + UF_FLAG_PRIVATE, // PLAYER_DODGE_PERCENTAGE + UF_FLAG_PRIVATE, // PLAYER_PARRY_PERCENTAGE + UF_FLAG_PRIVATE, // PLAYER_EXPERTISE + UF_FLAG_PRIVATE, // PLAYER_OFFHAND_EXPERTISE + UF_FLAG_PRIVATE, // PLAYER_CRIT_PERCENTAGE + UF_FLAG_PRIVATE, // PLAYER_RANGED_CRIT_PERCENTAGE + UF_FLAG_PRIVATE, // PLAYER_OFFHAND_CRIT_PERCENTAGE + UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1 + UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+1 + UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+2 + UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+3 + UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+4 + UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+5 + UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+6 + UF_FLAG_PRIVATE, // PLAYER_SHIELD_BLOCK + UF_FLAG_PRIVATE, // PLAYER_SHIELD_BLOCK_CRIT_PERCENTAGE + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+1 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+2 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+3 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+4 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+5 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+6 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+7 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+8 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+9 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+10 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+11 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+12 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+13 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+14 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+15 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+16 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+17 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+18 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+19 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+20 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+21 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+22 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+23 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+24 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+25 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+26 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+27 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+28 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+29 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+30 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+31 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+32 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+33 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+34 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+35 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+36 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+37 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+38 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+39 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+40 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+41 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+42 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+43 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+44 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+45 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+46 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+47 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+48 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+49 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+50 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+51 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+52 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+53 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+54 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+55 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+56 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+57 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+58 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+59 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+60 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+61 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+62 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+63 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+64 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+65 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+66 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+67 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+68 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+69 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+70 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+71 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+72 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+73 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+74 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+75 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+76 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+77 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+78 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+79 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+80 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+81 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+82 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+83 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+84 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+85 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+86 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+87 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+88 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+89 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+90 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+91 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+92 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+93 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+94 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+95 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+96 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+97 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+98 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+99 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+100 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+101 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+102 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+103 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+104 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+105 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+106 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+107 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+108 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+109 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+110 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+111 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+112 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+113 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+114 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+115 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+116 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+117 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+118 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+119 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+120 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+121 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+122 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+123 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+124 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+125 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+126 + UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+127 + UF_FLAG_PRIVATE, // PLAYER_REST_STATE_EXPERIENCE + UF_FLAG_PRIVATE, // PLAYER_FIELD_COINAGE + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_DONE_POS + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_PCT + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_DONE_PCT + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_TARGET_RESISTANCE + UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE + UF_FLAG_PRIVATE, // PLAYER_FIELD_BYTES + UF_FLAG_PRIVATE, // PLAYER_AMMO_ID + UF_FLAG_PRIVATE, // PLAYER_SELF_RES_SPELL + UF_FLAG_PRIVATE, // PLAYER_FIELD_PVP_MEDALS + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_KILLS + UF_FLAG_PRIVATE, // PLAYER_FIELD_TODAY_CONTRIBUTION + UF_FLAG_PRIVATE, // PLAYER_FIELD_YESTERDAY_CONTRIBUTION + UF_FLAG_PRIVATE, // PLAYER_FIELD_LIFETIME_HONORBALE_KILLS + UF_FLAG_PRIVATE, // PLAYER_FIELD_BYTES2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_WATCHED_FACTION_INDEX + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+21 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+22 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+23 + UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+24 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_HONOR_CURRENCY + UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_CURRENCY + UF_FLAG_PRIVATE, // PLAYER_FIELD_MAX_LEVEL + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+6 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+7 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+8 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+9 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+10 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+11 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+12 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+13 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+14 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+15 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+16 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+17 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+18 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+19 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+20 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+21 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+22 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+23 + UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+24 + UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1 + UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+1 + UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+2 + UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+3 + UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1 + UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1+1 + UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+5 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+1 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+2 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+3 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+4 + UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+5 + UF_FLAG_PRIVATE, // PLAYER_GLYPHS_ENABLED + UF_FLAG_PRIVATE, // PLAYER_PET_SPELL_POWER +}; + +uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END] = +{ + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1 + UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE + UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY + UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X + UF_FLAG_NONE, // OBJECT_FIELD_PADDING + UF_FLAG_PUBLIC, // OBJECT_FIELD_CREATED_BY + UF_FLAG_PUBLIC, // OBJECT_FIELD_CREATED_BY+1 + UF_FLAG_PUBLIC, // GAMEOBJECT_DISPLAYID + UF_FLAG_PUBLIC, // GAMEOBJECT_FLAGS + UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION + UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+1 + UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+2 + UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+3 + UF_FLAG_DYNAMIC, // GAMEOBJECT_DYNAMIC + UF_FLAG_PUBLIC, // GAMEOBJECT_FACTION + UF_FLAG_PUBLIC, // GAMEOBJECT_LEVEL + UF_FLAG_PUBLIC, // GAMEOBJECT_BYTES_1 +}; + +uint32 DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END] = +{ + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1 + UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE + UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY + UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X + UF_FLAG_NONE, // OBJECT_FIELD_PADDING + UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTER + UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTER+1 + UF_FLAG_PUBLIC, // DYNAMICOBJECT_BYTES + UF_FLAG_PUBLIC, // DYNAMICOBJECT_SPELLID + UF_FLAG_PUBLIC, // DYNAMICOBJECT_RADIUS + UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTTIME +}; + +uint32 CorpseUpdateFieldFlags[CORPSE_END] = +{ + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID + UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1 + UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE + UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY + UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X + UF_FLAG_NONE, // OBJECT_FIELD_PADDING + UF_FLAG_PUBLIC, // CORPSE_FIELD_OWNER + UF_FLAG_PUBLIC, // CORPSE_FIELD_OWNER+1 + UF_FLAG_PUBLIC, // CORPSE_FIELD_PARTY + UF_FLAG_PUBLIC, // CORPSE_FIELD_PARTY+1 + UF_FLAG_PUBLIC, // CORPSE_FIELD_DISPLAY_ID + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+1 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+2 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+3 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+4 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+5 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+6 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+7 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+8 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+9 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+10 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+11 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+12 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+13 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+14 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+15 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+16 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+17 + UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+18 + UF_FLAG_PUBLIC, // CORPSE_FIELD_BYTES_1 + UF_FLAG_PUBLIC, // CORPSE_FIELD_BYTES_2 + UF_FLAG_PUBLIC, // CORPSE_FIELD_GUILD + UF_FLAG_PUBLIC, // CORPSE_FIELD_FLAGS + UF_FLAG_DYNAMIC, // CORPSE_FIELD_DYNAMIC_FLAGS + UF_FLAG_NONE, // CORPSE_FIELD_PAD +}; diff --git a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h new file mode 100644 index 00000000000..573c1952e62 --- /dev/null +++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +#ifndef _UPDATEFIELDFLAGS_H +#define _UPDATEFIELDFLAGS_H + +#include "UpdateFields.h" + +enum UpdatefieldFlags +{ + UF_FLAG_NONE = 0x000, + UF_FLAG_PUBLIC = 0x001, + UF_FLAG_PRIVATE = 0x002, + UF_FLAG_OWNER = 0x004, + UF_FLAG_UNUSED1 = 0x008, + UF_FLAG_ITEM_OWNER = 0x010, + UF_FLAG_SPECIAL_INFO = 0x020, + UF_FLAG_PARTY_MEMBER = 0x040, + UF_FLAG_UNUSED2 = 0x080, + UF_FLAG_DYNAMIC = 0x100, +}; + +extern uint32 ItemUpdateFieldFlags[CONTAINER_END]; +extern uint32 UnitUpdateFieldFlags[PLAYER_END]; +extern uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END]; +extern uint32 DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END]; +extern uint32 CorpseUpdateFieldFlags[CORPSE_END]; + +#endif // _UPDATEFIELDFLAGS_H diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h index d4ecd42819c..ad70936b81d 100755 --- a/src/server/game/Entities/Object/Updates/UpdateMask.h +++ b/src/server/game/Entities/Object/Updates/UpdateMask.h @@ -26,26 +26,26 @@ class UpdateMask { public: UpdateMask() : mCount(0), mBlocks(0), mUpdateMask(0) { } - UpdateMask(const UpdateMask& mask) : mUpdateMask(0) { *this = mask; } + UpdateMask(UpdateMask const& mask) : mUpdateMask(0) { *this = mask; } ~UpdateMask() { - delete [] mUpdateMask; + delete[] mUpdateMask; } - void SetBit (uint32 index) + void SetBit(uint32 index) { - ((uint8 *)mUpdateMask)[ index >> 3 ] |= 1 << (index & 0x7); + ((uint8*)mUpdateMask)[index >> 3] |= 1 << (index & 0x7); } - void UnsetBit (uint32 index) + void UnsetBit(uint32 index) { - ((uint8 *)mUpdateMask)[ index >> 3 ] &= (0xff ^ (1 << (index & 0x7))); + ((uint8*)mUpdateMask)[index >> 3] &= (0xff ^ (1 << (index & 0x7))); } - bool GetBit (uint32 index) const + bool GetBit(uint32 index) const { - return (((uint8 *)mUpdateMask)[ index >> 3 ] & (1 << (index & 0x7))) != 0; + return (((uint8*)mUpdateMask)[index >> 3] & (1 << (index & 0x7))) != 0; } uint32 GetBlockCount() const { return mBlocks; } @@ -70,7 +70,7 @@ class UpdateMask memset(mUpdateMask, 0, mBlocks << 2); } - UpdateMask& operator = (const UpdateMask& mask) + UpdateMask& operator=(UpdateMask const& mask) { if (this == &mask) return *this; @@ -81,21 +81,21 @@ class UpdateMask return *this; } - void operator &= (const UpdateMask& mask) + void operator&=(UpdateMask const& mask) { ASSERT(mask.mCount <= mCount); for (uint32 i = 0; i < mBlocks; ++i) mUpdateMask[i] &= mask.mUpdateMask[i]; } - void operator |= (const UpdateMask& mask) + void operator|=(UpdateMask const& mask) { ASSERT(mask.mCount <= mCount); for (uint32 i = 0; i < mBlocks; ++i) mUpdateMask[i] |= mask.mUpdateMask[i]; } - UpdateMask operator & (const UpdateMask& mask) const + UpdateMask operator&(UpdateMask const& mask) const { ASSERT(mask.mCount <= mCount); @@ -106,7 +106,7 @@ class UpdateMask return newmask; } - UpdateMask operator | (const UpdateMask& mask) const + UpdateMask operator|(UpdateMask const& mask) const { ASSERT(mask.mCount <= mCount); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 5e227e43a42..46f8f215456 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -630,8 +630,6 @@ void KillRewarder::Reward() // == Player ==================================================== -UpdateMask Player::updateVisualBits; - // we can disable this warning for this since it only // causes undefined behavior when passed to the base class constructor #ifdef _MSC_VER @@ -4492,119 +4490,6 @@ Mail* Player::GetMail(uint32 id) return NULL; } -void Player::_SetCreateBits(UpdateMask* updateMask, Player* target) const -{ - if (target == this) - Object::_SetCreateBits(updateMask, target); - else - { - for (uint16 index = 0; index < m_valuesCount; index++) - if (GetUInt32Value(index) != 0 && updateVisualBits.GetBit(index)) - updateMask->SetBit(index); - } -} - -void Player::_SetUpdateBits(UpdateMask* updateMask, Player* target) const -{ - if (target == this) - Object::_SetUpdateBits(updateMask, target); - else - { - Object::_SetUpdateBits(updateMask, target); - *updateMask &= updateVisualBits; - } -} - -void Player::InitVisibleBits() -{ - updateVisualBits.SetCount(PLAYER_END); - - updateVisualBits.SetBit(OBJECT_FIELD_GUID); - updateVisualBits.SetBit(OBJECT_FIELD_TYPE); - updateVisualBits.SetBit(OBJECT_FIELD_ENTRY); - updateVisualBits.SetBit(OBJECT_FIELD_SCALE_X); - updateVisualBits.SetBit(UNIT_FIELD_CHARM + 0); - updateVisualBits.SetBit(UNIT_FIELD_CHARM + 1); - updateVisualBits.SetBit(UNIT_FIELD_SUMMON + 0); - updateVisualBits.SetBit(UNIT_FIELD_SUMMON + 1); - updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY + 0); - updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY + 1); - updateVisualBits.SetBit(UNIT_FIELD_TARGET + 0); - updateVisualBits.SetBit(UNIT_FIELD_TARGET + 1); - updateVisualBits.SetBit(UNIT_FIELD_CHANNEL_OBJECT + 0); - updateVisualBits.SetBit(UNIT_FIELD_CHANNEL_OBJECT + 1); - updateVisualBits.SetBit(UNIT_FIELD_BYTES_0); - updateVisualBits.SetBit(UNIT_FIELD_HEALTH); - updateVisualBits.SetBit(UNIT_FIELD_POWER1); - updateVisualBits.SetBit(UNIT_FIELD_POWER2); - updateVisualBits.SetBit(UNIT_FIELD_POWER3); - updateVisualBits.SetBit(UNIT_FIELD_POWER4); - updateVisualBits.SetBit(UNIT_FIELD_POWER5); - updateVisualBits.SetBit(UNIT_FIELD_POWER6); - updateVisualBits.SetBit(UNIT_FIELD_POWER7); - updateVisualBits.SetBit(UNIT_FIELD_MAXHEALTH); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER1); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER2); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER3); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER4); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER5); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER6); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER7); - updateVisualBits.SetBit(UNIT_FIELD_LEVEL); - updateVisualBits.SetBit(UNIT_FIELD_FACTIONTEMPLATE); - updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 0); - updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 1); - updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 2); - updateVisualBits.SetBit(UNIT_FIELD_FLAGS); - updateVisualBits.SetBit(UNIT_FIELD_FLAGS_2); - updateVisualBits.SetBit(UNIT_FIELD_AURASTATE); - updateVisualBits.SetBit(UNIT_FIELD_BASEATTACKTIME + 0); - updateVisualBits.SetBit(UNIT_FIELD_BASEATTACKTIME + 1); - updateVisualBits.SetBit(UNIT_FIELD_BOUNDINGRADIUS); - updateVisualBits.SetBit(UNIT_FIELD_COMBATREACH); - updateVisualBits.SetBit(UNIT_FIELD_DISPLAYID); - updateVisualBits.SetBit(UNIT_FIELD_NATIVEDISPLAYID); - updateVisualBits.SetBit(UNIT_FIELD_MOUNTDISPLAYID); - updateVisualBits.SetBit(UNIT_FIELD_BYTES_1); - updateVisualBits.SetBit(UNIT_FIELD_PETNUMBER); - updateVisualBits.SetBit(UNIT_FIELD_PET_NAME_TIMESTAMP); - updateVisualBits.SetBit(UNIT_DYNAMIC_FLAGS); - updateVisualBits.SetBit(UNIT_CHANNEL_SPELL); - updateVisualBits.SetBit(UNIT_MOD_CAST_SPEED); - updateVisualBits.SetBit(UNIT_FIELD_BASE_MANA); - updateVisualBits.SetBit(UNIT_FIELD_BYTES_2); - updateVisualBits.SetBit(UNIT_FIELD_HOVERHEIGHT); - - updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 0); - updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 1); - updateVisualBits.SetBit(PLAYER_FLAGS); - updateVisualBits.SetBit(PLAYER_GUILDID); - updateVisualBits.SetBit(PLAYER_GUILDRANK); - updateVisualBits.SetBit(PLAYER_BYTES); - updateVisualBits.SetBit(PLAYER_BYTES_2); - updateVisualBits.SetBit(PLAYER_BYTES_3); - updateVisualBits.SetBit(PLAYER_DUEL_TEAM); - updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP); - updateVisualBits.SetBit(UNIT_NPC_FLAGS); - - // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)... - for (uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET) - updateVisualBits.SetBit(i); - - // Players visible items are not inventory stuff - for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) - { - uint16 offset = i * 2; - - // item entry - updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENTRYID + offset); - // enchant - updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + offset); - } - - updateVisualBits.SetBit(PLAYER_CHOSEN_TITLE); -} - void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const { for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) @@ -17217,7 +17102,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetUInt32Value(UNIT_CHANNEL_SPELL, 0); // clear charm/summon related fields - SetUInt64Value(UNIT_FIELD_SUMMONEDBY, 0); + SetOwnerGUID(0); SetUInt64Value(UNIT_FIELD_CHARMEDBY, 0); SetUInt64Value(UNIT_FIELD_CHARM, 0); SetUInt64Value(UNIT_FIELD_SUMMON, 0); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index b1e4e81900d..774e75104b1 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1069,9 +1069,6 @@ class Player : public Unit, public GridObject void CleanupsBeforeDelete(bool finalCleanup = true); - static UpdateMask updateVisualBits; - static void InitVisibleBits(); - void AddToWorld(); void RemoveFromWorld(); @@ -2620,9 +2617,6 @@ class Player : public Unit, public GridObject void _SaveStats(SQLTransaction& trans); void _SaveInstanceTimeRestrictions(SQLTransaction& trans); - void _SetCreateBits(UpdateMask* updateMask, Player* target) const; - void _SetUpdateBits(UpdateMask* updateMask, Player* target) const; - /*********************************************************/ /*** ENVIRONMENTAL SYSTEM ***/ /*********************************************************/ diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 83ed3917235..65857030e80 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -56,6 +56,7 @@ #include "MoveSplineInit.h" #include "MoveSpline.h" #include "ConditionMgr.h" +#include "UpdateFieldFlags.h" #include @@ -9658,6 +9659,31 @@ bool Unit::HasAuraState(AuraStateType flag, SpellInfo const* spellProto, Unit co return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1)); } +void Unit::SetOwnerGUID(uint64 owner) +{ + if (GetOwnerGUID() == owner) + return; + + SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner); + if (!owner) + return; + + // Update owner dependent fields + Player* player = ObjectAccessor::GetPlayer(*this, owner); + if (!player || !player->HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object + return; + + SetFieldNotifyFlag(UF_FLAG_OWNER); + + UpdateData udata; + WorldPacket packet; + BuildValuesUpdateBlockForPlayer(&udata, player); + udata.BuildPacket(&packet); + player->SendDirectMessage(&packet); + + RemoveFieldNotifyFlag(UF_FLAG_OWNER); +} + Unit* Unit::GetOwner() const { if (uint64 ownerid = GetOwnerGUID()) @@ -9743,12 +9769,14 @@ void Unit::SetMinion(Minion *minion, bool apply) if (apply) { - if (!minion->AddUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID())) + if (minion->GetOwnerGUID()) { sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); return; } + minion->SetOwnerGUID(GetGUID()); + m_Controlled.insert(minion); if (GetTypeId() == TYPEID_PLAYER) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 2855b93b0d7..46dbf4829a6 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -963,24 +963,6 @@ struct SpellPeriodicAuraLogInfo uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missCondition); -enum UnitAnimationState -{ - ANIMATION_ON_GROUND = 0, - ANIMATION_SWIMMING = 1, - ANIMATION_HOVER = 2, - ANIMATION_FLYING = 3, -}; - -struct MonsterMoveData -{ - MonsterMoveData() : SplineFlag(0), AnimationState(ANIMATION_ON_GROUND), Time(0), SpeedZ(0.0f) {} - Position DestLocation; - uint32 SplineFlag; - UnitAnimationState AnimationState; // Only used with SPLINEFLAG_ANIMATIONTIER - uint32 Time; - float SpeedZ; // Only used with SPLINEFLAG_TRAJECTORY -}; - #define MAX_DECLINED_NAME_CASES 5 struct DeclinedName @@ -1656,6 +1638,7 @@ class Unit : public WorldObject virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } + void SetOwnerGUID(uint64 owner); uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); } void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); } uint64 GetMinionGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); } diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index f9d609150ef..428f0d25a8b 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -34,6 +34,7 @@ #include "MapInstanced.h" #include "Util.h" #include "LFGMgr.h" +#include "UpdateFieldFlags.h" Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count), @@ -437,6 +438,47 @@ bool Group::AddMember(Player* player) if (isRaidGroup()) player->UpdateForQuestWorldObjects(); + { + // Broadcast new player group member fields to rest of the group + player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); + + UpdateData groupData; + WorldPacket groupDataPacket; + + // Broadcast group members' fields to player + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + { + if (itr->getSource() == player) + continue; + + if (Player* member = itr->getSource()) + { + if (player->HaveAtClient(member)) + { + member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); + member->BuildValuesUpdateBlockForPlayer(&groupData, player); + member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); + } + + if (member->HaveAtClient(player)) + { + UpdateData newData; + WorldPacket newDataPacket; + player->BuildValuesUpdateBlockForPlayer(&newData, member); + member->SendDirectMessage(&newDataPacket); + } + } + } + + if (groupData.HasData()) + { + groupData.BuildPacket(&groupDataPacket); + player->SendDirectMessage(&groupDataPacket); + } + + player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); + } + if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING)) m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index dd674672935..c2d031a3a01 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2405,7 +2405,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) if (properties->Category == SUMMON_CATEGORY_ALLY) { - summon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_originalCaster->GetGUID()); + summon->SetOwnerGUID(m_originalCaster->GetGUID()); summon->setFaction(m_originalCaster->getFaction()); summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 3aee1dc429e..94e42f26dbd 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1693,7 +1693,6 @@ void World::SetInitialWorldSettings() ///- Initilize static helper structures AIRegistry::Initialize(); - Player::InitVisibleBits(); ///- Initialize MapManager sLog->outString("Starting Map System"); -- cgit v1.2.3 From 47054e6bc1b58ea1a553c550bd302e74016a2467 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 22 Jul 2012 14:40:41 +0200 Subject: Build fix without pch --- src/server/game/Entities/Object/Updates/UpdateFieldFlags.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h index 573c1952e62..71b3f0cd4aa 100644 --- a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h +++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h @@ -19,6 +19,7 @@ #define _UPDATEFIELDFLAGS_H #include "UpdateFields.h" +#include "Define.h" enum UpdatefieldFlags { -- cgit v1.2.3 From d5dea1ca4e0f9f14c6d433ca1d97e193c39dd85a Mon Sep 17 00:00:00 2001 From: David KlepáÄek Date: Tue, 24 Jul 2012 03:28:36 +0300 Subject: [Core\Quest] Fix Quest "The Aspirant's Challenge" Credits goes to Valcorb --- src/server/scripts/Northrend/icecrown.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp index fb2e0f6c389..85b34523893 100644 --- a/src/server/scripts/Northrend/icecrown.cpp +++ b/src/server/scripts/Northrend/icecrown.cpp @@ -169,8 +169,7 @@ enum eArgentValiant { SPELL_CHARGE = 63010, SPELL_SHIELD_BREAKER = 65147, - - NPC_ARGENT_VALIANT_CREDIT = 24108 + SPELL_KILL_CREDIT = 63049 }; class npc_argent_valiant : public CreatureScript @@ -208,7 +207,7 @@ public: if (uiDamage > me->GetHealth() && pDoneBy->GetTypeId() == TYPEID_PLAYER) { uiDamage = 0; - CAST_PLR(pDoneBy)->KilledMonsterCredit(NPC_ARGENT_VALIANT_CREDIT, 0); + pDoneBy->CastSpell(pDoneBy, SPELL_KILL_CREDIT, true); me->setFaction(35); me->DespawnOrUnsummon(5000); me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); -- cgit v1.2.3 From 4fb89bde83a7ac3d3102936ea92930fff9832967 Mon Sep 17 00:00:00 2001 From: kandera Date: Tue, 24 Jul 2012 09:54:06 -0300 Subject: Core/Spells: fix bladestorm and possibly other spells from causing dbw to be removed. closes #7121 --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 025ebb7275f..ed8c0324aac 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3374,7 +3374,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); - aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); @@ -3406,7 +3405,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); - aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); @@ -3444,7 +3442,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); - aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); @@ -3488,7 +3485,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply); aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); - aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); @@ -3523,7 +3519,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply); target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, apply); aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); - aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); -- cgit v1.2.3 From bb9b98098ef3c2532c1f3b6261a24c966a02dc9e Mon Sep 17 00:00:00 2001 From: stfx Date: Wed, 25 Jul 2012 11:50:34 +0300 Subject: Fix sending wrong world states in Shattrath --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 46f8f215456..3b51411b168 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -9144,6 +9144,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) case 1519: // Stormwind City case 1537: // Ironforge case 2257: // Deeprun Tram + case 3703: // Shattrath City break; case 139: // Eastern Plaguelands if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP) @@ -9550,7 +9551,6 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(3610) << uint32(0x0); // 9 show } break; - case 3703: // Shattrath City case 4384: // Strand of the Ancients if (bg && bg->GetTypeID(true) == BATTLEGROUND_SA) bg->FillInitialWorldStates(data); -- cgit v1.2.3 From 2f6583094d6df569176c676bd631cb5e6231e966 Mon Sep 17 00:00:00 2001 From: Pesthuf Date: Fri, 20 Jul 2012 17:32:35 +0200 Subject: Core/Spells: Haunt should heal the Warlock when the target dies or the aura is reapplied. --- src/server/scripts/Spells/spell_warlock.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 74118599b9f..9701418e02e 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -561,9 +561,6 @@ class spell_warl_haunt : public SpellScriptLoader void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) - return; - if (Unit* caster = GetCaster()) { int32 amount = aurEff->GetAmount(); -- cgit v1.2.3 From f5edf4034d93ffbd649032593d61ffd69bac4dd0 Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Wed, 25 Jul 2012 18:49:06 +0300 Subject: Core/Scripts: Fix Forgemaster Garfrost phases and equipment change. --- .../FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index a3b8c5df4e7..114bc69741c 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -157,15 +157,19 @@ class boss_garfrost : public CreatureScript void MovementInform(uint32 type, uint32 id) { - if (type != POINT_MOTION_TYPE || id != POINT_FORGE) + if (type != EFFECT_MOTION_TYPE || id != POINT_FORGE) return; if (events.GetPhaseMask() & PHASE_TWO_MASK) + { DoCast(me, SPELL_FORGE_BLADE); + SetEquipmentSlots(false, EQUIP_ID_SWORD); + } if (events.GetPhaseMask() & PHASE_THREE_MASK) { me->RemoveAurasDueToSpell(SPELL_FORGE_BLADE_HELPER); DoCast(me, SPELL_FORGE_MACE); + SetEquipmentSlots(false, EQUIP_ID_MACE); } events.ScheduleEvent(EVENT_RESUME_ATTACK, 5000); } @@ -177,10 +181,6 @@ class boss_garfrost : public CreatureScript if (Aura* aura = target->GetAura(SPELL_PERMAFROST_HELPER)) _permafrostStack = std::max(_permafrostStack, aura->GetStackAmount()); } - else if (spell->Id == SPELL_FORGE_BLADE) - SetEquipmentSlots(false, EQUIP_ID_SWORD); - else if (spell->Id == SPELL_FORGE_MACE) - SetEquipmentSlots(false, EQUIP_ID_MACE); } uint32 GetData(uint32 /*type*/) @@ -205,7 +205,7 @@ class boss_garfrost : public CreatureScript case EVENT_THROW_SARONITE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - Talk(SAY_THROW_SARONITE); + Talk(SAY_THROW_SARONITE, target->GetGUID()); DoCast(target, SPELL_THROW_SARONITE); } events.ScheduleEvent(EVENT_THROW_SARONITE, urand(12500, 20000)); @@ -217,7 +217,7 @@ class boss_garfrost : public CreatureScript case EVENT_DEEP_FREEZE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - Talk(SAY_CAST_DEEP_FREEZE); + Talk(SAY_CAST_DEEP_FREEZE, target->GetGUID()); DoCast(target, SPELL_DEEP_FREEZE); } events.ScheduleEvent(EVENT_DEEP_FREEZE, 35000, 0, PHASE_THREE); -- cgit v1.2.3 From 41f0923f1bc7563bfb176721df367a38499f5c4b Mon Sep 17 00:00:00 2001 From: Chipsi Date: Sat, 28 Jul 2012 15:37:24 +0200 Subject: Core/Spells: Spells with SPELL_EFFECT_KNOCK_BACK(like Thunderstorm) can't knoback target if target has ROOT/STUN Signed-off-by: Chipsi --- src/server/game/Spells/SpellEffects.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c2d031a3a01..f936ae4172c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5204,6 +5204,10 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex) if (creatureTarget->isWorldBoss() || creatureTarget->IsDungeonBoss()) return; + // Spells with SPELL_EFFECT_KNOCK_BACK(like Thunderstorm) can't knoback target if target has ROOT/STUN + if (unitTarget->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) + return; + // Typhoon if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x01000000) { -- cgit v1.2.3 From 5acae3253053ea91bb0327adf6eddd864669f80d Mon Sep 17 00:00:00 2001 From: Pesthuf Date: Sat, 28 Jul 2012 17:07:05 +0200 Subject: Core/Movement: When an NPC is knocked back, the splineflag OrientationFixed should be used, so the NPC keeps his facing and doesn't play the jump start animation. Also corrects the NPCs serverside orientation. --- src/server/game/Movement/MotionMaster.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index bc0570bb73b..cde176443f0 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -335,9 +335,17 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa float x, y, z; float moveTimeHalf = speedZ / Movement::gravity; float dist = 2 * moveTimeHalf * speedXY; + float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ); _owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + M_PI); - MoveJump(x, y, z, speedXY, speedZ); + + Movement::MoveSplineInit init(*_owner); + init.MoveTo(x,y,z); + init.SetParabolic(max_height,0); + init.SetOrientationFixed(true); + init.SetVelocity(speedXY); + init.Launch(); + Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED); } void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) -- cgit v1.2.3 From a7ca7db413d215549e7fa3dc4234a63714cc34d1 Mon Sep 17 00:00:00 2001 From: Chipsi Date: Sat, 28 Jul 2012 23:19:45 +0200 Subject: Fix a typo --- src/server/game/Spells/SpellEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index f936ae4172c..3aa5396a096 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5205,7 +5205,7 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex) return; // Spells with SPELL_EFFECT_KNOCK_BACK(like Thunderstorm) can't knoback target if target has ROOT/STUN - if (unitTarget->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) + if (unitTarget->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) return; // Typhoon -- cgit v1.2.3 From 6f69a3326dd77547b66b6097da7d4c9fe96ac54e Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 21 Jul 2012 22:29:14 +0200 Subject: Convert misc commands in commandscript --- src/server/game/Chat/Chat.cpp | 89 - src/server/game/Chat/Chat.h | 96 +- src/server/game/Chat/Commands/Level0.cpp | 129 -- src/server/game/Chat/Commands/Level1.cpp | 629 ------- src/server/game/Chat/Commands/Level2.cpp | 679 ------- src/server/game/Chat/Commands/Level3.cpp | 1421 -------------- src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Commands/CMakeLists.txt | 1 + src/server/scripts/Commands/cs_character.cpp | 71 +- src/server/scripts/Commands/cs_learn.cpp | 72 +- src/server/scripts/Commands/cs_message.cpp | 215 +++ src/server/scripts/Commands/cs_misc.cpp | 2606 +++++++++++++++++++++++++- 12 files changed, 2944 insertions(+), 3066 deletions(-) delete mode 100755 src/server/game/Chat/Commands/Level0.cpp delete mode 100755 src/server/game/Chat/Commands/Level1.cpp delete mode 100755 src/server/game/Chat/Commands/Level2.cpp create mode 100644 src/server/scripts/Commands/cs_message.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 65cdca70aba..5211e4686ac 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -67,17 +67,6 @@ static size_t appendCommandTable(ChatCommand* target, const ChatCommand* source) ChatCommand* ChatHandler::getCommandTable() { - static ChatCommand channelSetCommandTable[] = - { - { "ownership", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleChannelSetOwnership>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand channelCommandTable[] = - { - { "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable }, - { NULL, 0, false, NULL, "", NULL } - }; static ChatCommand groupCommandTable[] = { @@ -87,14 +76,6 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand petCommandTable[] = - { - { "create", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleCreatePetCommand>, "", NULL }, - { "learn", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePetLearnCommand>, "", NULL }, - { "unlearn", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePetUnlearnCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand pdumpCommandTable[] = { { "load", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandlePDumpLoadCommand>, "", NULL }, @@ -102,81 +83,11 @@ ChatCommand* ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand sendCommandTable[] = - { - { "items", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendItemsCommand>, "", NULL }, - { "mail", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleSendMailCommand>, "", NULL }, - { "message", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendMessageCommand>, "", NULL }, - { "money", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendMoneyCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand commandTable[] = { { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, - { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable }, - - { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, - - { "aura", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAuraCommand>, "", NULL }, - { "unaura", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnAuraCommand>, "", NULL }, - { "nameannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleNameAnnounceCommand>, "", NULL }, - { "gmnameannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMNameAnnounceCommand>, "", NULL }, - { "announce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleAnnounceCommand>, "", NULL }, - { "gmannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMAnnounceCommand>, "", NULL }, - { "notify", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleNotifyCommand>, "", NULL }, - { "gmnotify", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMNotifyCommand>, "", NULL }, - { "appear", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleAppearCommand>, "", NULL }, - { "summon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleSummonCommand>, "", NULL }, - { "groupsummon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleGroupSummonCommand>, "", NULL }, - { "commands", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleCommandsCommand>, "", NULL }, - { "die", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDieCommand>, "", NULL }, - { "revive", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleReviveCommand>, "", NULL }, - { "dismount", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleDismountCommand>, "", NULL }, - { "guid", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleGUIDCommand>, "", NULL }, - { "help", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleHelpCommand>, "", NULL }, - { "itemmove", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleItemMoveCommand>, "", NULL }, - { "cooldown", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCooldownCommand>, "", NULL }, - { "unlearn", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnLearnCommand>, "", NULL }, - { "distance", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGetDistanceCommand>, "", NULL }, - { "recall", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleRecallCommand>, "", NULL }, - { "save", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleSaveCommand>, "", NULL }, - { "saveall", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleSaveAllCommand>, "", NULL }, - { "kick", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleKickPlayerCommand>, "", NULL }, - { "start", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleStartCommand>, "", NULL }, - { "taxicheat", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleTaxiCheatCommand>, "", NULL }, - { "linkgrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLinkGraveCommand>, "", NULL }, - { "neargrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleNearGraveCommand>, "", NULL }, - { "explorecheat", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleExploreCheatCommand>, "", NULL }, - { "levelup", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLevelUpCommand>, "", NULL }, - { "showarea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleShowAreaCommand>, "", NULL }, - { "hidearea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleHideAreaCommand>, "", NULL }, - { "additem", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAddItemCommand>, "", NULL }, - { "additemset", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAddItemSetCommand>, "", NULL }, - { "bank", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleBankCommand>, "", NULL }, - { "wchange", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleChangeWeather>, "", NULL }, - { "maxskill", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleMaxSkillCommand>, "", NULL }, - { "setskill", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleSetSkillCommand>, "", NULL }, - { "whispers", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleWhispersCommand>, "", NULL }, - { "pinfo", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandlePInfoCommand>, "", NULL }, - { "respawn", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleRespawnCommand>, "", NULL }, - { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable }, - { "mute", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleMuteCommand>, "", NULL }, - { "unmute", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleUnmuteCommand>, "", NULL }, - { "movegens", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleMovegensCommand>, "", NULL }, - { "cometome", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleComeToMeCommand>, "", NULL }, - { "damage", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDamageCommand>, "", NULL }, - { "combatstop", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCombatStopCommand>, "", NULL }, - { "flusharenapoints", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleFlushArenaPointsCommand>, "", NULL }, - { "repairitems", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleRepairitemsCommand>, "", NULL }, - { "waterwalk", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleWaterwalkCommand>, "", NULL }, - - { "freeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleFreezeCommand>, "", NULL }, - { "unfreeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleUnFreezeCommand>, "", NULL }, - { "listfreeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleListFreezeCommand>, "", NULL }, - { "possess", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandlePossessCommand>, "", NULL }, { "unpossess", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnPossessCommand>, "", NULL }, { "bindsight", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleBindSightCommand>, "", NULL }, diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index af06b4f760a..5a20f312ae1 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -123,24 +123,14 @@ class ChatHandler void SetSentErrorMessage(bool val){ sentErrorMessage = val; } static bool LoadCommandTable() { return load_command_table; } static void SetLoadCommandTable(bool val) { load_command_table = val; } - - // cs_character - void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel); + bool ShowHelpForCommand(ChatCommand* table, const char* cmd); protected: explicit ChatHandler() : m_session(NULL) {} // 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 ShowHelpForCommand(ChatCommand* table, const char* cmd); bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd); - bool HandleNameAnnounceCommand(const char* args); - bool HandleGMNameAnnounceCommand(const char* args); - bool HandleGMAnnounceCommand(const char* args); - bool HandleGMNotifyCommand(const char* args); - - bool HandleChannelSetOwnership(const char *args); - bool HandlePossessCommand(const char* args); bool HandleUnPossessCommand(const char* args); bool HandleBindSightCommand(const char* args); @@ -149,95 +139,11 @@ class ChatHandler bool HandlePDumpLoadCommand(const char *args); bool HandlePDumpWriteCommand(const char *args); - bool HandleSendItemsCommand(const char* args); - bool HandleSendMailCommand(const char* args); - bool HandleSendMessageCommand(const char * args); - bool HandleSendMoneyCommand(const char* args); - - bool HandleHelpCommand(const char* args); - bool HandleCommandsCommand(const char* args); - bool HandleStartCommand(const char* args); - bool HandleDismountCommand(const char* args); - bool HandleSaveCommand(const char* args); - - bool HandleSummonCommand(const char* args); - bool HandleAppearCommand(const char* args); - bool HandleGroupSummonCommand(const char* args); - bool HandleRecallCommand(const char* args); - bool HandleAnnounceCommand(const char* args); - bool HandleNotifyCommand(const char* args); - bool HandleTaxiCheatCommand(const char* args); - bool HandleWhispersCommand(const char* args); - - bool HandleGUIDCommand(const char* args); - bool HandleItemMoveCommand(const char* args); - bool HandleDeMorphCommand(const char* args); - bool HandlePInfoCommand(const char* args); - bool HandleMuteCommand(const char* args); - bool HandleUnmuteCommand(const char* args); - bool HandleMovegensCommand(const char* args); - bool HandleFreezeCommand(const char *args); - bool HandleUnFreezeCommand(const char *args); - bool HandleListFreezeCommand(const char* args); - - bool HandleCooldownCommand(const char* args); - bool HandleUnLearnCommand(const char* args); - bool HandleGetDistanceCommand(const char* args); - bool HandleDieCommand(const char* args); - bool HandleDamageCommand(const char *args); - bool HandleReviveCommand(const char* args); - bool HandleAuraCommand(const char* args); - bool HandleUnAuraCommand(const char* args); - bool HandleLinkGraveCommand(const char* args); - bool HandleNearGraveCommand(const char* args); - bool HandleActivateObjectCommand(const char* args); - bool HandleSpawnTransportCommand(const char* args); - bool HandleExploreCheatCommand(const char* args); - bool HandleWaterwalkCommand(const char* args); - bool HandleLevelUpCommand(const char* args); - bool HandleShowAreaCommand(const char* args); - bool HandleHideAreaCommand(const char* args); - bool HandleAddItemCommand(const char* args); - bool HandleAddItemSetCommand(const char* args); - bool HandlePetUnlearnCommand(const char* args); - bool HandlePetLearnCommand(const char* args); - bool HandleCreatePetCommand(const char* args); - bool HandleGroupLeaderCommand(const char* args); bool HandleGroupDisbandCommand(const char* args); bool HandleGroupRemoveCommand(const char* args); - bool HandleBankCommand(const char* args); - bool HandleChangeWeather(const char* args); - bool HandleKickPlayerCommand(const char * args); - - bool HandleMaxSkillCommand(const char* args); - bool HandleSetSkillCommand(const char* args); - bool HandleRespawnCommand(const char* args); - bool HandleComeToMeCommand(const char *args); - bool HandleCombatStopCommand(const char *args); - - /*bool HandleCharDeleteCommand(const char *args); - bool HandleSendMessageCommand(const char * args);*/ - - bool HandleFlushArenaPointsCommand(const char *args); bool HandlePlayAllCommand(const char* args); - bool HandleRepairitemsCommand(const char* args); - - bool HandleTempGameObjectCommand(const char* args); - - //! Development Commands - - /*bool HandleQuestAdd(const char * args); - bool HandleQuestRemove(const char * args); - bool HandleQuestComplete(const char * args);*/ - - //bool HandleSet32Bit(const char* args); - bool HandleSaveAllCommand(const char* args); - - // Utility methods for commands - void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id); - private: WorldSession* m_session; // != NULL for chat command call and NULL for CLI command diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp deleted file mode 100755 index b05ba9b4194..00000000000 --- a/src/server/game/Chat/Commands/Level0.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * 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 . - */ - -#include "Common.h" -#include "World.h" -#include "Player.h" -#include "Chat.h" -#include "ObjectAccessor.h" -#include "Language.h" -#include "AccountMgr.h" -#include "SystemConfig.h" -#include "revision.h" -#include "Util.h" - -bool ChatHandler::HandleHelpCommand(const char* args) -{ - char* cmd = strtok((char*)args, " "); - if (!cmd) - { - ShowHelpForCommand(getCommandTable(), "help"); - ShowHelpForCommand(getCommandTable(), ""); - } - else - { - if (!ShowHelpForCommand(getCommandTable(), cmd)) - SendSysMessage(LANG_NO_HELP_CMD); - } - - return true; -} - -bool ChatHandler::HandleCommandsCommand(const char* /*args*/) -{ - ShowHelpForCommand(getCommandTable(), ""); - return true; -} - -bool ChatHandler::HandleStartCommand(const char* /*args*/) -{ - Player* player = m_session->GetPlayer(); - - if (player->isInFlight()) - { - SendSysMessage(LANG_YOU_IN_FLIGHT); - SetSentErrorMessage(true); - return false; - } - - if (player->isInCombat()) - { - SendSysMessage(LANG_YOU_IN_COMBAT); - SetSentErrorMessage(true); - return false; - } - - if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - { - // if player is dead and stuck, send ghost to graveyard - player->RepopAtGraveyard(); - return true; - } - - // cast spell Stuck - player->CastSpell(player, 7355, false); - return true; -} - -bool ChatHandler::HandleDismountCommand(const char* /*args*/) -{ - Player* player = m_session->GetPlayer(); - - //If player is not mounted, so go out :) - if (!player->IsMounted()) - { - SendSysMessage(LANG_CHAR_NON_MOUNTED); - SetSentErrorMessage(true); - return false; - } - - if (player->isInFlight()) - { - SendSysMessage(LANG_YOU_IN_FLIGHT); - SetSentErrorMessage(true); - return false; - } - - player->Dismount(); - player->RemoveAurasByType(SPELL_AURA_MOUNTED); - return true; -} - -bool ChatHandler::HandleSaveCommand(const char* /*args*/) -{ - Player* player = m_session->GetPlayer(); - - // save GM account without delay and output message - if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity())) - { - if (Player* target = getSelectedPlayer()) - target->SaveToDB(); - else - player->SaveToDB(); - SendSysMessage(LANG_PLAYER_SAVED); - return true; - } - - // save if the player has last been saved over 20 seconds ago - uint32 save_interval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); - if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS)) - player->SaveToDB(); - - return true; -} - diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp deleted file mode 100755 index 1cf3d5c9b4e..00000000000 --- a/src/server/game/Chat/Commands/Level1.cpp +++ /dev/null @@ -1,629 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * 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 . - */ - -#include "Common.h" -#include "DatabaseEnv.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "World.h" -#include "ObjectMgr.h" -#include "TicketMgr.h" -#include "Player.h" -#include "AccountMgr.h" -#include "Opcodes.h" -#include "Chat.h" -#include "Log.h" -#include "MapManager.h" -#include "ObjectAccessor.h" -#include "Language.h" -#include "CellImpl.h" -#include "InstanceSaveMgr.h" -#include "Util.h" -#include "Group.h" - -#ifdef _DEBUG_VMAPS -#include "VMapFactory.h" -#endif - -bool ChatHandler::HandleNameAnnounceCommand(const char* args) -{ - if (!*args) - return false; - - std::string name("Console"); - if (WorldSession* session = GetSession()) - name = session->GetPlayer()->GetName(); - - sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args); - return true; -} - -bool ChatHandler::HandleGMNameAnnounceCommand(const char* args) -{ - if (!*args) - return false; - - std::string name("Console"); - if (WorldSession* session = GetSession()) - name = session->GetPlayer()->GetName(); - - sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args); - return true; -} - -// global announce -bool ChatHandler::HandleAnnounceCommand(const char* args) -{ - if (!*args) - return false; - - char buff[2048]; - sprintf(buff, GetTrinityString(LANG_SYSTEMMESSAGE), args); - sWorld->SendServerMessage(SERVER_MSG_STRING, buff); - return true; -} - -// announce to logged in GMs -bool ChatHandler::HandleGMAnnounceCommand(const char* args) -{ - if (!*args) - return false; - - sWorld->SendGMText(LANG_GM_BROADCAST, args); - return true; -} - -//notification player at the screen -bool ChatHandler::HandleNotifyCommand(const char* args) -{ - if (!*args) - return false; - - std::string str = GetTrinityString(LANG_GLOBAL_NOTIFY); - str += args; - - WorldPacket data(SMSG_NOTIFICATION, (str.size()+1)); - data << str; - sWorld->SendGlobalMessage(&data); - - return true; -} - -//notification GM at the screen -bool ChatHandler::HandleGMNotifyCommand(const char* args) -{ - if (!*args) - return false; - - std::string str = GetTrinityString(LANG_GM_NOTIFY); - str += args; - - WorldPacket data(SMSG_NOTIFICATION, (str.size()+1)); - data << str; - sWorld->SendGlobalGMMessage(&data); - - return true; -} - -//Summon Player -bool ChatHandler::HandleSummonCommand(const char* args) -{ - Player* target; - uint64 target_guid; - std::string target_name; - if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name)) - return false; - - Player* _player = m_session->GetPlayer(); - if (target == _player || target_guid == _player->GetGUID()) - { - PSendSysMessage(LANG_CANT_TELEPORT_SELF); - SetSentErrorMessage(true); - return false; - } - - if (target) - { - std::string nameLink = playerLink(target_name); - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - if (target->IsBeingTeleported()) - { - PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - - Map* map = m_session->GetPlayer()->GetMap(); - - if (map->IsBattlegroundOrArena()) - { - // only allow if gm mode is on - if (!_player->isGameMaster()) - { - PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - // if both players are in different bgs - else if (target->GetBattlegroundId() && m_session->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId()) - target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff - - // all's well, set bg id - // when porting out from the bg, it will be reset to 0 - target->SetBattlegroundId(m_session->GetPlayer()->GetBattlegroundId(), m_session->GetPlayer()->GetBattlegroundTypeId()); - // remember current position as entry point for return at bg end teleportation - if (!target->GetMap()->IsBattlegroundOrArena()) - target->SetBattlegroundEntryPoint(); - } - else if (map->IsDungeon()) - { - Map* cMap = target->GetMap(); - - if (cMap->Instanceable() && cMap->GetInstanceId() != map->GetInstanceId()) - target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true); - - // we are in instance, and can summon only player in our group with us as lead - if (!m_session->GetPlayer()->GetGroup() || !target->GetGroup() || - (target->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) || - (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID())) - // the last check is a bit excessive, but let it be, just in case - { - PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - } - - PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), ""); - if (needReportToTarget(target)) - ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, playerLink(_player->GetName()).c_str()); - - // stop flight if need - if (target->isInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - target->SaveRecallPosition(); - - // before GM - float x, y, z; - m_session->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize()); - target->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation()); - target->SetPhaseMask(m_session->GetPlayer()->GetPhaseMask(), true); - } - else - { - // check offline security - if (HasLowerSecurity(NULL, target_guid)) - return false; - - std::string nameLink = playerLink(target_name); - - PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), GetTrinityString(LANG_OFFLINE)); - - // in point where GM stay - Player::SavePositionInDB(m_session->GetPlayer()->GetMapId(), - m_session->GetPlayer()->GetPositionX(), - m_session->GetPlayer()->GetPositionY(), - m_session->GetPlayer()->GetPositionZ(), - m_session->GetPlayer()->GetOrientation(), - m_session->GetPlayer()->GetZoneId(), - target_guid); - } - - return true; -} - -//Teleport to Player -bool ChatHandler::HandleAppearCommand(const char* args) -{ - Player* target; - uint64 target_guid; - std::string target_name; - if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name)) - return false; - - Player* _player = m_session->GetPlayer(); - if (target == _player || target_guid == _player->GetGUID()) - { - SendSysMessage(LANG_CANT_TELEPORT_SELF); - SetSentErrorMessage(true); - return false; - } - - if (target) - { - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - std::string chrNameLink = playerLink(target_name); - - Map* cMap = target->GetMap(); - if (cMap->IsBattlegroundOrArena()) - { - // only allow if gm mode is on - if (!_player->isGameMaster()) - { - PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - // if both players are in different bgs - else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) - _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff - - // all's well, set bg id - // when porting out from the bg, it will be reset to 0 - _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId()); - // remember current position as entry point for return at bg end teleportation - if (!_player->GetMap()->IsBattlegroundOrArena()) - _player->SetBattlegroundEntryPoint(); - } - else if (cMap->IsDungeon()) - { - // we have to go to instance, and can go to player only if: - // 1) we are in his group (either as leader or as member) - // 2) we are not bound to any group and have GM mode on - if (_player->GetGroup()) - { - // we are in group, we can go only if we are in the player group - if (_player->GetGroup() != target->GetGroup()) - { - PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - } - else - { - // we are not in group, let's verify our GM mode - if (!_player->isGameMaster()) - { - PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - } - - // if the player or the player's group is bound to another instance - // the player will not be bound to another one - InstancePlayerBind* pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid())); - if (!pBind) - { - Group* group = _player->GetGroup(); - // if no bind exists, create a solo bind - InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind - if (!gBind) - if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) - _player->BindToInstance(save, !save->CanReset()); - } - - if (cMap->IsRaid()) - _player->SetRaidDifficulty(target->GetRaidDifficulty()); - else - _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); - } - - PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); - - // stop flight if need - if (_player->isInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - _player->SaveRecallPosition(); - - // to point to see at target with same orientation - float x, y, z; - target->GetContactPoint(_player, x, y, z); - - _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); - _player->SetPhaseMask(target->GetPhaseMask(), true); - } - else - { - // check offline security - if (HasLowerSecurity(NULL, target_guid)) - return false; - - std::string nameLink = playerLink(target_name); - - PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str()); - - // to point where player stay (if loaded) - float x, y, z, o; - uint32 map; - bool in_flight; - if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, target_guid)) - return false; - - // stop flight if need - if (_player->isInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - _player->SaveRecallPosition(); - - _player->TeleportTo(map, x, y, z, _player->GetOrientation()); - } - - return true; -} - -// Teleport player to last position -bool ChatHandler::HandleRecallCommand(const char* args) -{ - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - if (target->IsBeingTeleported()) - { - PSendSysMessage(LANG_IS_TELEPORTED, GetNameLink(target).c_str()); - SetSentErrorMessage(true); - return false; - } - - // stop flight if need - if (target->isInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } - - target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO); - return true; -} - -//Enable On\OFF all taxi paths -bool ChatHandler::HandleTaxiCheatCommand(const char* args) -{ - if (!*args) - { - SendSysMessage(LANG_USE_BOL); - SetSentErrorMessage(true); - return false; - } - - std::string argstr = (char*)args; - - Player* chr = getSelectedPlayer(); - - if (!chr) - chr = m_session->GetPlayer(); - else if (HasLowerSecurity(chr, 0)) // check online security - return false; - - if (argstr == "on") - { - chr->SetTaxiCheater(true); - PSendSysMessage(LANG_YOU_GIVE_TAXIS, GetNameLink(chr).c_str()); - if (needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, GetNameLink().c_str()); - return true; - } - - if (argstr == "off") - { - chr->SetTaxiCheater(false); - PSendSysMessage(LANG_YOU_REMOVE_TAXIS, GetNameLink(chr).c_str()); - if (needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, GetNameLink().c_str()); - - return true; - } - - SendSysMessage(LANG_USE_BOL); - SetSentErrorMessage(true); - return false; -} - -//Enable\Dissable accept whispers (for GM) -bool ChatHandler::HandleWhispersCommand(const char* args) -{ - if (!*args) - { - PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, m_session->GetPlayer()->isAcceptWhispers() ? GetTrinityString(LANG_ON) : GetTrinityString(LANG_OFF)); - return true; - } - - std::string argstr = (char*)args; - // whisper on - if (argstr == "on") - { - m_session->GetPlayer()->SetAcceptWhispers(true); - SendSysMessage(LANG_COMMAND_WHISPERON); - return true; - } - - // whisper off - if (argstr == "off") - { - // Remove all players from the Gamemaster's whisper whitelist - m_session->GetPlayer()->ClearWhisperWhiteList(); - m_session->GetPlayer()->SetAcceptWhispers(false); - SendSysMessage(LANG_COMMAND_WHISPEROFF); - return true; - } - - SendSysMessage(LANG_USE_BOL); - SetSentErrorMessage(true); - return false; -} - -//Save all players in the world -bool ChatHandler::HandleSaveAllCommand(const char* /*args*/) -{ - sObjectAccessor->SaveAllPlayers(); - SendSysMessage(LANG_PLAYERS_SAVED); - return true; -} - -//Send mail by command -bool ChatHandler::HandleSendMailCommand(const char* args) -{ - // format: name "subject text" "mail text" - Player* target; - uint64 target_guid; - std::string target_name; - if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char* msgSubject = extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char* msgText = extractQuotedArg(tail2); - if (!msgText) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - //- TODO: Fix poor design - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - MailDraft(subject, text) - .SendMailTo(trans, MailReceiver(target, GUID_LOPART(target_guid)), sender); - - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = playerLink(target_name); - PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; -} - -//Summon group of player -bool ChatHandler::HandleGroupSummonCommand(const char* args) -{ - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - Group* grp = target->GetGroup(); - - std::string nameLink = GetNameLink(target); - - if (!grp) - { - PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - - Map* gmMap = m_session->GetPlayer()->GetMap(); - bool to_instance = gmMap->Instanceable(); - - // we are in instance, and can summon only player in our group with us as lead - if (to_instance && ( - !m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) || - (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()))) - // the last check is a bit excessive, but let it be, just in case - { - SendSysMessage(LANG_CANNOT_SUMMON_TO_INST); - SetSentErrorMessage(true); - return false; - } - - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* player = itr->getSource(); - - if (!player || player == m_session->GetPlayer() || !player->GetSession()) - continue; - - // check online security - if (HasLowerSecurity(player, 0)) - return false; - - std::string plNameLink = GetNameLink(player); - - if (player->IsBeingTeleported() == true) - { - PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - - if (to_instance) - { - Map* plMap = player->GetMap(); - - if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId()) - { - // cannot summon from instance to instance - PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - } - - PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), ""); - if (needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str()); - - // stop flight if need - if (player->isInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - player->SaveRecallPosition(); - - // before GM - float x, y, z; - m_session->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize()); - player->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation()); - } - - return true; -} diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp deleted file mode 100755 index a44ee515c02..00000000000 --- a/src/server/game/Chat/Commands/Level2.cpp +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * 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 . - */ - -#include "Common.h" -#include "DatabaseEnv.h" -#include "DBCStores.h" -#include "ObjectMgr.h" -#include "Player.h" -#include "Item.h" -#include "GameObject.h" -#include "Opcodes.h" -#include "Chat.h" -#include "MapManager.h" -#include "Language.h" -#include "World.h" -#include "GameEventMgr.h" -#include "SpellMgr.h" -#include "PoolMgr.h" -#include "AccountMgr.h" -#include "WaypointManager.h" -#include "Util.h" -#include -#include -#include -#include -#include "OutdoorPvPMgr.h" -#include "Transport.h" -#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand -#include "CreatureGroups.h" -#include "ace/INET_Addr.h" - -//mute player for some times -bool ChatHandler::HandleMuteCommand(const char* args) -{ - char* nameStr; - char* delayStr; - extractOptFirstArg((char*)args, &nameStr, &delayStr); - if (!delayStr) - return false; - - char *mutereason = strtok(NULL, "\r"); - std::string mutereasonstr = "No reason"; - if (mutereason != NULL) - mutereasonstr = mutereason; - - Player* target; - uint64 target_guid; - std::string target_name; - if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) - return false; - - uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(target_guid); - - // find only player from same account if any - if (!target) - if (WorldSession* session = sWorld->FindSession(accountId)) - target = session->GetPlayer(); - - uint32 notspeaktime = (uint32) atoi(delayStr); - - // must have strong lesser security level - if (HasLowerSecurity (target, target_guid, true)) - return false; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); - - if (target) - { - // Target is online, mute will be in effect right away. - int64 muteTime = time(NULL) + notspeaktime * MINUTE; - target->GetSession()->m_muteTime = muteTime; - - stmt->setInt64(0, muteTime); - - ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime, mutereasonstr.c_str()); - } - else - { - // Target is offline, mute will be in effect starting from the next login. - int32 muteTime = -int32(notspeaktime * MINUTE); - - stmt->setInt64(0, muteTime); - } - - stmt->setUInt32(1, accountId); - - LoginDatabase.Execute(stmt); - - std::string nameLink = playerLink(target_name); - - PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notspeaktime, mutereasonstr.c_str()); - - return true; -} - -//unmute player -bool ChatHandler::HandleUnmuteCommand(const char* args) -{ - Player* target; - uint64 target_guid; - std::string target_name; - if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name)) - return false; - - uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(target_guid); - - // find only player from same account if any - if (!target) - if (WorldSession* session = sWorld->FindSession(accountId)) - target = session->GetPlayer(); - - // must have strong lesser security level - if (HasLowerSecurity (target, target_guid, true)) - return false; - - if (target) - { - if (target->CanSpeak()) - { - SendSysMessage(LANG_CHAT_ALREADY_ENABLED); - SetSentErrorMessage(true); - return false; - } - - target->GetSession()->m_muteTime = 0; - } - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); - - stmt->setInt64(0, 0); - stmt->setUInt32(1, accountId); - - LoginDatabase.Execute(stmt); - - if (target) - ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); - - std::string nameLink = playerLink(target_name); - - PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str()); - return true; -} - -bool ChatHandler::HandleGUIDCommand(const char* /*args*/) -{ - uint64 guid = m_session->GetPlayer()->GetSelection(); - - if (guid == 0) - { - SendSysMessage(LANG_NO_SELECTION); - SetSentErrorMessage(true); - return false; - } - - PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); - return true; -} - - //move item to other slot -bool ChatHandler::HandleItemMoveCommand(const char* args) -{ - if (!*args) - return false; - - char* pParam1 = strtok((char*)args, " "); - if (!pParam1) - return false; - - char* pParam2 = strtok(NULL, " "); - if (!pParam2) - return false; - - uint8 srcslot = (uint8)atoi(pParam1); - uint8 dstslot = (uint8)atoi(pParam2); - - if (srcslot == dstslot) - return true; - - if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcslot, true)) - return false; - - if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstslot, false)) - return false; - - uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot); - uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot); - - m_session->GetPlayer()->SwapItem(src, dst); - - return true; -} - -//kick player -bool ChatHandler::HandleKickPlayerCommand(const char *args) -{ - Player* target = NULL; - std::string playerName; - if (!extractPlayerTarget((char*)args, &target, NULL, &playerName)) - return false; - - if (m_session && target == m_session->GetPlayer()) - { - SendSysMessage(LANG_COMMAND_KICKSELF); - SetSentErrorMessage(true); - return false; - } - - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD)) - sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); - else - PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); - - target->GetSession()->KickPlayer(); - return true; -} - -//show info of player -bool ChatHandler::HandlePInfoCommand(const char* args) -{ - Player* target; - uint64 target_guid; - std::string target_name; - - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); - - if (sObjectMgr->GetPlayerNameByGUID(parseGUID, target_name)) - { - target = sObjectMgr->GetPlayerByLowGUID(parseGUID); - target_guid = parseGUID; - } - else if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name)) - return false; - - uint32 accId = 0; - uint32 money = 0; - uint32 total_player_time = 0; - uint8 level = 0; - uint32 latency = 0; - uint8 race; - uint8 Class; - int64 muteTime = 0; - int64 banTime = -1; - uint32 mapId; - uint32 areaId; - uint32 phase = 0; - - // get additional information from Player object - if (target) - { - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - accId = target->GetSession()->GetAccountId(); - money = target->GetMoney(); - total_player_time = target->GetTotalPlayedTime(); - level = target->getLevel(); - latency = target->GetSession()->GetLatency(); - race = target->getRace(); - Class = target->getClass(); - muteTime = target->GetSession()->m_muteTime; - mapId = target->GetMapId(); - areaId = target->GetAreaId(); - phase = target->GetPhaseMask(); - } - // get additional information from DB - else - { - // check offline security - if (HasLowerSecurity(NULL, target_guid)) - return false; - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); - stmt->setUInt32(0, GUID_LOPART(target_guid)); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (!result) - return false; - - Field* fields = result->Fetch(); - total_player_time = fields[0].GetUInt32(); - level = fields[1].GetUInt8(); - money = fields[2].GetUInt32(); - accId = fields[3].GetUInt32(); - race = fields[4].GetUInt8(); - Class = fields[5].GetUInt8(); - mapId = fields[6].GetUInt16(); - areaId = fields[7].GetUInt16(); - } - - std::string username = GetTrinityString(LANG_ERROR); - std::string email = GetTrinityString(LANG_ERROR); - std::string last_ip = GetTrinityString(LANG_ERROR); - uint32 security = 0; - std::string last_login = GetTrinityString(LANG_ERROR); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO); - stmt->setInt32(0, int32(realmID)); - stmt->setUInt32(1, accId); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - if (result) - { - Field* fields = result->Fetch(); - username = fields[0].GetString(); - security = fields[1].GetUInt8(); - email = fields[2].GetString(); - muteTime = fields[5].GetUInt64(); - - if (email.empty()) - email = "-"; - - if (!m_session || m_session->GetSecurity() >= AccountTypes(security)) - { - last_ip = fields[3].GetString(); - last_login = fields[4].GetString(); - - uint32 ip = inet_addr(last_ip.c_str()); -#if TRINITY_ENDIAN == BIGENDIAN - EndianConvertReverse(ip); -#endif - - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY); - - stmt->setUInt32(0, ip); - - PreparedQueryResult result2 = WorldDatabase.Query(stmt); - - if (result2) - { - Field* fields2 = result2->Fetch(); - last_ip.append(" ("); - last_ip.append(fields2[0].GetString()); - last_ip.append(")"); - } - } - else - { - last_ip = "-"; - last_login = "-"; - } - } - - std::string nameLink = playerLink(target_name); - - PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.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); - if (!result2) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); - stmt->setUInt32(0, GUID_LOPART(target_guid)); - result2 = CharacterDatabase.Query(stmt); - } - - if (result2) - { - Field* fields = result2->Fetch(); - banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32()); - bannedby = fields[2].GetString(); - banreason = fields[3].GetString(); - } - - if (muteTime > 0) - PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str()); - - if (banTime >= 0) - PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str()); - - std::string race_s, Class_s; - switch (race) - { - case RACE_HUMAN: race_s = "Human"; break; - case RACE_ORC: race_s = "Orc"; break; - case RACE_DWARF: race_s = "Dwarf"; break; - case RACE_NIGHTELF: race_s = "Night Elf"; break; - case RACE_UNDEAD_PLAYER: race_s = "Undead"; break; - case RACE_TAUREN: race_s = "Tauren"; break; - case RACE_GNOME: race_s = "Gnome"; break; - case RACE_TROLL: race_s = "Troll"; break; - case RACE_BLOODELF: race_s = "Blood Elf"; break; - case RACE_DRAENEI: race_s = "Draenei"; break; - } - switch (Class) - { - case CLASS_WARRIOR: Class_s = "Warrior"; break; - case CLASS_PALADIN: Class_s = "Paladin"; break; - case CLASS_HUNTER: Class_s = "Hunter"; break; - case CLASS_ROGUE: Class_s = "Rogue"; break; - case CLASS_PRIEST: Class_s = "Priest"; break; - case CLASS_DEATH_KNIGHT: Class_s = "Death Knight"; break; - case CLASS_SHAMAN: Class_s = "Shaman"; break; - case CLASS_MAGE: Class_s = "Mage"; break; - case CLASS_WARLOCK: Class_s = "Warlock"; break; - case CLASS_DRUID: Class_s = "Druid"; break; - } - - std::string timeStr = secsToTimeString(total_player_time, true, true); - uint32 gold = money /GOLD; - uint32 silv = (money % GOLD) / SILVER; - uint32 copp = (money % GOLD) % SILVER; - PSendSysMessage(LANG_PINFO_LEVEL, race_s.c_str(), Class_s.c_str(), timeStr.c_str(), level, gold, silv, copp); - - // Add map, zone, subzone and phase to output - int locale = GetSessionDbcLocale(); - std::string areaName = ""; - std::string zoneName = ""; - - MapEntry const* map = sMapStore.LookupEntry(mapId); - - AreaTableEntry const* area = GetAreaEntryByAreaID(areaId); - if (area) - { - areaName = area->area_name[locale]; - - AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); - - if (zone) - zoneName = zone->area_name[locale]; - } - - if (target) - { - if (!zoneName.empty()) - PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase); - else - PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "", phase); - } - else - PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); - - return true; -} - -bool ChatHandler::HandleCombatStopCommand(const char* args) -{ - Player* target = NULL; - - if (args && strlen(args) > 0) - { - target = sObjectAccessor->FindPlayerByName(args); - if (!target) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - } - - if (!target) - if (!extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - target->CombatStop(); - target->getHostileRefManager().deleteReferences(); - return true; -} - - -bool ChatHandler::HandleRepairitemsCommand(const char* args) -{ - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (HasLowerSecurity(target, 0)) - return false; - - // Repair items - target->DurabilityRepairAll(false, 0, false); - - PSendSysMessage(LANG_YOU_REPAIR_ITEMS, GetNameLink(target).c_str()); - if (needReportToTarget(target)) - ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetNameLink().c_str()); - return true; -} - -bool ChatHandler::HandleWaterwalkCommand(const char* args) -{ - if (!*args) - return false; - - Player* player = getSelectedPlayer(); - - if (!player) - { - PSendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - // check online security - if (HasLowerSecurity(player, 0)) - return false; - - if (strncmp(args, "on", 3) == 0) - player->SetMovement(MOVE_WATER_WALK); // ON - else if (strncmp(args, "off", 4) == 0) - player->SetMovement(MOVE_LAND_WALK); // OFF - else - { - SendSysMessage(LANG_USE_BOL); - return false; - } - - PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str()); - if (needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, GetNameLink().c_str()); - return true; -} - -bool ChatHandler::HandleCreatePetCommand(const char* /*args*/) -{ - Player* player = m_session->GetPlayer(); - Creature* creatureTarget = getSelectedCreature(); - - if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) - { - PSendSysMessage(LANG_SELECT_CREATURE); - SetSentErrorMessage(true); - return false; - } - - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry()); - // Creatures with family 0 crashes the server - if (cInfo->family == 0) - { - PSendSysMessage("This creature cannot be tamed. (family id: 0)."); - SetSentErrorMessage(true); - return false; - } - - if (player->GetPetGUID()) - { - PSendSysMessage("You already have a pet"); - SetSentErrorMessage(true); - return false; - } - - // Everything looks OK, create new pet - Pet* pet = new Pet(player, HUNTER_PET); - if (!pet->CreateBaseAtCreature(creatureTarget)) - { - delete pet; - PSendSysMessage("Error 1"); - return false; - } - - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view - - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); - - if (!pet->InitStatsForLevel(creatureTarget->getLevel())) - { - sLog->outError("InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); - PSendSysMessage("Error 2"); - delete pet; - return false; - } - - // prepare visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1); - - pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true); - // this enables pet details window (Shift+P) - pet->InitPetCreateSpells(); - pet->SetFullHealth(); - - pet->GetMap()->AddToMap(pet->ToCreature()); - - // visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()); - - player->SetMinion(pet, true); - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - player->PetSpellInitialize(); - - return true; -} - -bool ChatHandler::HandlePetLearnCommand(const char* args) -{ - if (!*args) - return false; - - Player* player = m_session->GetPlayer(); - Pet* pet = player->GetPet(); - - if (!pet) - { - PSendSysMessage("You have no pet"); - SetSentErrorMessage(true); - return false; - } - - uint32 spellId = extractSpellIdFromLink((char*)args); - - if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) - return false; - - // Check if pet already has it - if (pet->HasSpell(spellId)) - { - PSendSysMessage("Pet already has spell: %u", spellId); - SetSentErrorMessage(true); - return false; - } - - // Check if spell is valid - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) - { - PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); - SetSentErrorMessage(true); - return false; - } - - pet->learnSpell(spellId); - - PSendSysMessage("Pet has learned spell %u", spellId); - return true; -} - -bool ChatHandler::HandlePetUnlearnCommand(const char *args) -{ - if (!*args) - return false; - - Player* player = m_session->GetPlayer(); - Pet* pet = player->GetPet(); - - if (!pet) - { - PSendSysMessage("You have no pet"); - SetSentErrorMessage(true); - return false; - } - - uint32 spellId = extractSpellIdFromLink((char*)args); - - if (pet->HasSpell(spellId)) - pet->removeSpell(spellId, false); - else - PSendSysMessage("Pet doesn't have that spell"); - - return true; -} diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 5b93b899898..41c92f36997 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -64,911 +64,6 @@ #include "Group.h" #include "ChannelMgr.h" -bool ChatHandler::HandleMaxSkillCommand(const char* /*args*/) -{ - Player* SelectedPlayer = getSelectedPlayer(); - if (!SelectedPlayer) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - // each skills that have max skill value dependent from level seted to current level max skill value - SelectedPlayer->UpdateSkillsToMaxSkillsForLevel(); - return true; -} - -bool ChatHandler::HandleSetSkillCommand(const char *args) -{ - // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r - char* skill_p = extractKeyFromLink((char*)args, "Hskill"); - if (!skill_p) - return false; - - char *level_p = strtok (NULL, " "); - if (!level_p) - return false; - - char *max_p = strtok (NULL, " "); - - int32 skill = atoi(skill_p); - if (skill <= 0) - { - PSendSysMessage(LANG_INVALID_SKILL_ID, skill); - SetSentErrorMessage(true); - return false; - } - - int32 level = atol(level_p); - - Player* target = getSelectedPlayer(); - if (!target) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - SkillLineEntry const* sl = sSkillLineStore.LookupEntry(skill); - if (!sl) - { - PSendSysMessage(LANG_INVALID_SKILL_ID, skill); - SetSentErrorMessage(true); - return false; - } - - std::string tNameLink = GetNameLink(target); - - if (!target->GetSkillValue(skill)) - { - PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, sl->name[GetSessionDbcLocale()]); - SetSentErrorMessage(true); - return false; - } - - int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill); - - if (level <= 0 || level > max || max <= 0) - return false; - - target->SetSkill(skill, target->GetSkillStep(skill), level, max); - PSendSysMessage(LANG_SET_SKILL, skill, sl->name[GetSessionDbcLocale()], tNameLink.c_str(), level, max); - - return true; -} - -bool ChatHandler::HandleUnLearnCommand(const char *args) -{ - if (!*args) - return false; - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r - uint32 spell_id = extractSpellIdFromLink((char*)args); - if (!spell_id) - return false; - - char const* allStr = strtok(NULL, " "); - bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false; - - Player* target = getSelectedPlayer(); - if (!target) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - if (allRanks) - spell_id = sSpellMgr->GetFirstSpellInChain (spell_id); - - if (target->HasSpell(spell_id)) - target->removeSpell(spell_id, false, !allRanks); - else - SendSysMessage(LANG_FORGET_SPELL); - - if (GetTalentSpellCost(spell_id)) - target->SendTalentsInfoData(false); - - return true; -} - -bool ChatHandler::HandleCooldownCommand(const char *args) -{ - Player* target = getSelectedPlayer(); - if (!target) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - std::string tNameLink = GetNameLink(target); - - if (!*args) - { - target->RemoveAllSpellCooldown(); - PSendSysMessage(LANG_REMOVEALL_COOLDOWN, tNameLink.c_str()); - } - else - { - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spell_id = extractSpellIdFromLink((char*)args); - if (!spell_id) - return false; - - if (!sSpellMgr->GetSpellInfo(spell_id)) - { - PSendSysMessage(LANG_UNKNOWN_SPELL, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str()); - SetSentErrorMessage(true); - return false; - } - - target->RemoveSpellCooldown(spell_id, true); - PSendSysMessage(LANG_REMOVE_COOLDOWN, spell_id, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str()); - } - return true; -} - -bool ChatHandler::HandleAddItemCommand(const char *args) -{ - if (!*args) - return false; - - uint32 itemId = 0; - - if (args[0] == '[') // [name] manual form - { - char* citemName = strtok((char*)args, "]"); - - if (citemName && citemName[0]) - { - std::string itemName = citemName+1; - WorldDatabase.EscapeString(itemName); - - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME); - stmt->setString(0, itemName); - PreparedQueryResult result = WorldDatabase.Query(stmt); - - if (!result) - { - PSendSysMessage(LANG_COMMAND_COULDNOTFIND, citemName+1); - SetSentErrorMessage(true); - return false; - } - itemId = result->Fetch()->GetUInt16(); - } - else - return false; - } - else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r - { - char* cId = extractKeyFromLink((char*)args, "Hitem"); - if (!cId) - return false; - itemId = atol(cId); - } - - char* ccount = strtok(NULL, " "); - - int32 count = 1; - - if (ccount) - count = strtol(ccount, NULL, 10); - - if (count == 0) - count = 1; - - Player* player = m_session->GetPlayer(); - Player* plTarget = getSelectedPlayer(); - if (!plTarget) - plTarget = player; - - sLog->outDetail(GetTrinityString(LANG_ADDITEM), itemId, count); - - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemId); - if (!pProto) - { - PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); - SetSentErrorMessage(true); - return false; - } - - //Subtract - if (count < 0) - { - plTarget->DestroyItemCount(itemId, -count, true, false); - PSendSysMessage(LANG_REMOVEITEM, itemId, -count, GetNameLink(plTarget).c_str()); - return true; - } - - //Adding items - uint32 noSpaceForCount = 0; - - // check space and find places - ItemPosCountVec dest; - InventoryResult msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); - if (msg != EQUIP_ERR_OK) // convert to possible store amount - count -= noSpaceForCount; - - if (count == 0 || dest.empty()) // can't add any - { - PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); - SetSentErrorMessage(true); - return false; - } - - Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); - - // remove binding (let GM give it to another player later) - if (player == plTarget) - for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) - if (Item* item1 = player->GetItemByPos(itr->pos)) - item1->SetBinding(false); - - if (count > 0 && item) - { - player->SendNewItem(item, count, false, true); - if (player != plTarget) - plTarget->SendNewItem(item, count, true, false); - } - - if (noSpaceForCount > 0) - PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); - - return true; -} - -bool ChatHandler::HandleAddItemSetCommand(const char *args) -{ - if (!*args) - return false; - - char* cId = extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r - if (!cId) - return false; - - uint32 itemsetId = atol(cId); - - // prevent generation all items with itemset field value '0' - if (itemsetId == 0) - { - PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemsetId); - SetSentErrorMessage(true); - return false; - } - - Player* player = m_session->GetPlayer(); - Player* playerTarget = getSelectedPlayer(); - if (!playerTarget) - playerTarget = player; - - sLog->outDetail(GetTrinityString(LANG_ADDITEMSET), itemsetId); - - bool found = false; - ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); - for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) - { - if (itr->second.ItemSet == itemsetId) - { - found = true; - ItemPosCountVec dest; - InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1); - if (msg == EQUIP_ERR_OK) - { - Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true); - - // remove binding (let GM give it to another player later) - if (player == playerTarget) - item->SetBinding(false); - - player->SendNewItem(item, 1, false, true); - if (player != playerTarget) - playerTarget->SendNewItem(item, 1, true, false); - } - else - { - player->SendEquipError(msg, NULL, NULL, itr->second.ItemId); - PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1); - } - } - } - - if (!found) - { - PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemsetId); - - SetSentErrorMessage(true); - return false; - } - - return true; -} - -bool ChatHandler::HandleGetDistanceCommand(const char *args) -{ - WorldObject* obj = NULL; - - if (*args) - { - uint64 guid = extractGuidFromLink((char*)args); - if (guid) - obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); - - if (!obj) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - } - else - { - obj = getSelectedUnit(); - - if (!obj) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - } - - PSendSysMessage(LANG_DISTANCE, m_session->GetPlayer()->GetDistance(obj), m_session->GetPlayer()->GetDistance2d(obj), m_session->GetPlayer()->GetExactDist(obj), m_session->GetPlayer()->GetExactDist2d(obj)); - return true; -} - -bool ChatHandler::HandleDieCommand(const char* /*args*/) -{ - Unit* target = getSelectedUnit(); - - if (!target || !m_session->GetPlayer()->GetSelection()) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - if (target->GetTypeId() == TYPEID_PLAYER) - { - if (HasLowerSecurity((Player*)target, 0, false)) - return false; - } - - if (target->isAlive()) - { - if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE)) - m_session->GetPlayer()->Kill(target); - else - m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - - return true; -} - -bool ChatHandler::HandleDamageCommand(const char * args) -{ - if (!*args) - return false; - - Unit* target = getSelectedUnit(); - - if (!target || !m_session->GetPlayer()->GetSelection()) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - if (target->GetTypeId() == TYPEID_PLAYER) - { - if (HasLowerSecurity((Player*)target, 0, false)) - return false; - } - - if (!target->isAlive()) - return true; - - char* damageStr = strtok((char*)args, " "); - if (!damageStr) - return false; - - int32 damage_int = atoi((char*)damageStr); - if (damage_int <= 0) - return true; - - uint32 damage = damage_int; - - char* schoolStr = strtok((char*)NULL, " "); - - // flat melee damage without resistence/etc reduction - if (!schoolStr) - { - m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - if (target != m_session->GetPlayer()) - m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); - return true; - } - - uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; - if (school >= MAX_SPELL_SCHOOL) - return false; - - SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); - - if (Unit::IsDamageReducedByArmor(schoolmask)) - damage = m_session->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); - - char* spellStr = strtok((char*)NULL, " "); - - // melee damage by specific school - if (!spellStr) - { - uint32 absorb = 0; - uint32 resist = 0; - - m_session->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); - - if (damage <= absorb + resist) - return true; - - damage -= absorb + resist; - - m_session->GetPlayer()->DealDamageMods(target, damage, &absorb); - m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); - m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); - return true; - } - - // non-melee damage - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellid = extractSpellIdFromLink((char*)args); - if (!spellid || !sSpellMgr->GetSpellInfo(spellid)) - return false; - - m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage); - return true; -} - -bool ChatHandler::HandleReviveCommand(const char *args) -{ - Player* target; - uint64 target_guid; - if (!extractPlayerTarget((char*)args, &target, &target_guid)) - return false; - - if (target) - { - target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); - target->SpawnCorpseBones(); - target->SaveToDB(); - } - else - // will resurrected at login without corpse - sObjectAccessor->ConvertCorpseForPlayer(target_guid); - - return true; -} - -bool ChatHandler::HandleAuraCommand(const char *args) -{ - Unit* target = getSelectedUnit(); - if (!target) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellID = extractSpellIdFromLink((char*)args); - - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID)) - Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target); - - return true; -} - -bool ChatHandler::HandleUnAuraCommand(const char *args) -{ - Unit* target = getSelectedUnit(); - if (!target) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - std::string argstr = args; - if (argstr == "all") - { - target->RemoveAllAuras(); - return true; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellID = extractSpellIdFromLink((char*)args); - if (!spellID) - return false; - - target->RemoveAurasDueToSpell(spellID); - - return true; -} - -bool ChatHandler::HandleLinkGraveCommand(const char *args) -{ - if (!*args) - return false; - - char* px = strtok((char*)args, " "); - if (!px) - return false; - - uint32 g_id = (uint32)atoi(px); - - uint32 g_team; - - char* px2 = strtok(NULL, " "); - - if (!px2) - g_team = 0; - else if (strncmp(px2, "horde", 6) == 0) - g_team = HORDE; - else if (strncmp(px2, "alliance", 9) == 0) - g_team = ALLIANCE; - else - return false; - - WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id); - - if (!graveyard) - { - PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, g_id); - SetSentErrorMessage(true); - return false; - } - - Player* player = m_session->GetPlayer(); - - uint32 zoneId = player->GetZoneId(); - - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); - if (!areaEntry || areaEntry->zone !=0) - { - PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, g_id, zoneId); - SetSentErrorMessage(true); - return false; - } - - if (sObjectMgr->AddGraveYardLink(g_id, zoneId, g_team)) - PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id, zoneId); - else - PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id, zoneId); - - return true; -} - -bool ChatHandler::HandleNearGraveCommand(const char *args) -{ - uint32 g_team; - - size_t argslen = strlen(args); - - if (!*args) - g_team = 0; - else if (strncmp((char*)args, "horde", argslen) == 0) - g_team = HORDE; - else if (strncmp((char*)args, "alliance", argslen) == 0) - g_team = ALLIANCE; - else - return false; - - Player* player = m_session->GetPlayer(); - uint32 zone_id = player->GetZoneId(); - - WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard( - player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), g_team); - - if (graveyard) - { - uint32 g_id = graveyard->ID; - - GraveYardData const* data = sObjectMgr->FindGraveYardData(g_id, zone_id); - if (!data) - { - PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, g_id); - SetSentErrorMessage(true); - return false; - } - - g_team = data->team; - - std::string team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); - - if (g_team == 0) - team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (g_team == HORDE) - team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); - else if (g_team == ALLIANCE) - team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); - - PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id, team_name.c_str(), zone_id); - } - else - { - std::string team_name; - - if (g_team == 0) - team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (g_team == HORDE) - team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); - else if (g_team == ALLIANCE) - team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); - - if (g_team == ~uint32(0)) - PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); - else - PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); - } - - return true; -} - -bool ChatHandler::HandleExploreCheatCommand(const char *args) -{ - if (!*args) - return false; - - int flag = atoi((char*)args); - - Player* chr = getSelectedPlayer(); - if (chr == NULL) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - if (flag != 0) - { - PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, GetNameLink(chr).c_str()); - if (needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, GetNameLink().c_str()); - } - else - { - PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, GetNameLink(chr).c_str()); - if (needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, GetNameLink().c_str()); - } - - for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) - { - if (flag != 0) - m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); - else - m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); - } - - return true; -} - -void ChatHandler::HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel) -{ - if (player) - { - player->GiveLevel(newLevel); - player->InitTalentForLevel(); - player->SetUInt32Value(PLAYER_XP, 0); - - if (needReportToTarget(player)) - { - if (oldLevel == newLevel) - ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, GetNameLink().c_str()); - else if (oldLevel < newLevel) - ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newLevel); - else // if (oldlevel > newlevel) - ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newLevel); - } - } - else - { - // Update level and reset XP, everything else will be updated at login - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL); - - stmt->setUInt8(0, uint8(newLevel)); - stmt->setUInt32(1, GUID_LOPART(playerGuid)); - - CharacterDatabase.Execute(stmt); - } -} - -bool ChatHandler::HandleLevelUpCommand(const char *args) -{ - char* nameStr; - char* levelStr; - extractOptFirstArg((char*)args, &nameStr, &levelStr); - - // exception opt second arg: .character level $name - if (levelStr && isalpha(levelStr[0])) - { - nameStr = levelStr; - levelStr = NULL; // current level will used - } - - Player* target; - uint64 target_guid; - std::string target_name; - if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) - return false; - - int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid); - int32 addlevel = levelStr ? atoi(levelStr) : 1; - int32 newlevel = oldlevel + addlevel; - - if (newlevel < 1) - newlevel = 1; - - if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level - newlevel = STRONG_MAX_LEVEL; - - HandleCharacterLevel(target, target_guid, oldlevel, newlevel); - - if (!m_session || m_session->GetPlayer() != target) // including chr == NULL - { - std::string nameLink = playerLink(target_name); - PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); - } - - return true; -} - -bool ChatHandler::HandleShowAreaCommand(const char *args) -{ - if (!*args) - return false; - - Player* chr = getSelectedPlayer(); - if (chr == NULL) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - int area = GetAreaFlagByAreaID(atoi((char*)args)); - int offset = area / 32; - uint32 val = (uint32)(1 << (area % 32)); - - if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) - { - SendSysMessage(LANG_BAD_VALUE); - SetSentErrorMessage(true); - return false; - } - - uint32 currFields = chr->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); - chr->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val)); - - SendSysMessage(LANG_EXPLORE_AREA); - return true; -} - -bool ChatHandler::HandleHideAreaCommand(const char *args) -{ - if (!*args) - return false; - - Player* chr = getSelectedPlayer(); - if (chr == NULL) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - int area = GetAreaFlagByAreaID(atoi((char*)args)); - int offset = area / 32; - uint32 val = (uint32)(1 << (area % 32)); - - if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) - { - SendSysMessage(LANG_BAD_VALUE); - SetSentErrorMessage(true); - return false; - } - - uint32 currFields = chr->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); - chr->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields ^ val)); - - SendSysMessage(LANG_UNEXPLORE_AREA); - return true; -} - -bool ChatHandler::HandleBankCommand(const char* /*args*/) -{ - m_session->SendShowBank(m_session->GetPlayer()->GetGUID()); - - return true; -} - -bool ChatHandler::HandleChangeWeather(const char *args) -{ - if (!*args) - return false; - - //Weather is OFF - if (!sWorld->getBoolConfig(CONFIG_WEATHER)) - { - SendSysMessage(LANG_WEATHER_DISABLED); - SetSentErrorMessage(true); - return false; - } - - // *Change the weather of a cell - char* px = strtok((char*)args, " "); - char* py = strtok(NULL, " "); - - if (!px || !py) - return false; - - uint32 type = (uint32)atoi(px); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand - float grade = (float)atof(py); //0 to 1, sending -1 is instand good weather - - Player* player = m_session->GetPlayer(); - uint32 zoneid = player->GetZoneId(); - - Weather* wth = WeatherMgr::FindWeather(zoneid); - - if (!wth) - wth = WeatherMgr::AddWeather(zoneid); - if (!wth) - { - SendSysMessage(LANG_NO_WEATHER); - SetSentErrorMessage(true); - return false; - } - - wth->SetWeather(WeatherType(type), grade); - - return true; -} - -bool ChatHandler::HandleRespawnCommand(const char* /*args*/) -{ - Player* player = m_session->GetPlayer(); - - // accept only explicitly selected target (not implicitly self targeting case) - Unit* target = getSelectedUnit(); - if (player->GetSelection() && target) - { - if (target->GetTypeId() != TYPEID_UNIT || target->isPet()) - { - SendSysMessage(LANG_SELECT_CREATURE); - SetSentErrorMessage(true); - return false; - } - - if (target->isDead()) - target->ToCreature()->Respawn(); - return true; - } - - CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY())); - Cell cell(p); - cell.SetNoCreate(); - - Trinity::RespawnDo u_do; - Trinity::WorldObjectWorker worker(player, u_do); - - TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); - cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange()); - - return true; -} - bool ChatHandler::HandlePDumpLoadCommand(const char *args) { if (!*args) @@ -1137,360 +232,6 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args) return true; } -bool ChatHandler::HandleMovegensCommand(const char* /*args*/) -{ - Unit* unit = getSelectedUnit(); - if (!unit) - { - SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - SetSentErrorMessage(true); - return false; - } - - PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow()); - - MotionMaster* mm = unit->GetMotionMaster(); - float x,y,z; - mm->GetDestination(x,y,z); - - for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) - { - MovementGenerator* mg = mm->GetMotionSlot(i); - if (!mg) - { - SendSysMessage("Empty"); - continue; - } - switch (mg->GetMovementGeneratorType()) - { - case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break; - case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break; - case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break; - case ANIMAL_RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); break; - case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break; - case CHASE_MOTION_TYPE: - { - Unit* target = NULL; - if (unit->GetTypeId() == TYPEID_PLAYER) - target = static_cast const*>(mg)->GetTarget(); - else - target = static_cast const*>(mg)->GetTarget(); - - if (!target) - SendSysMessage(LANG_MOVEGENS_CHASE_NULL); - else if (target->GetTypeId() == TYPEID_PLAYER) - PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); - else - PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); - break; - } - case FOLLOW_MOTION_TYPE: - { - Unit* target = NULL; - if (unit->GetTypeId() == TYPEID_PLAYER) - target = static_cast const*>(mg)->GetTarget(); - else - target = static_cast const*>(mg)->GetTarget(); - - if (!target) - SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); - else if (target->GetTypeId() == TYPEID_PLAYER) - PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); - else - PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); - break; - } - case HOME_MOTION_TYPE: - { - if (unit->GetTypeId() == TYPEID_UNIT) - PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z); - else - SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); - break; - } - case FLIGHT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FLIGHT); break; - case POINT_MOTION_TYPE: - { - PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z); - break; - } - case FLEEING_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FEAR); break; - case DISTRACT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_DISTRACT); break; - case EFFECT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_EFFECT); break; - default: - PSendSysMessage(LANG_MOVEGENS_UNKNOWN, mg->GetMovementGeneratorType()); - break; - } - } - return true; -} - -/* -ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator -Without this function 3rd party scripting library will get linking errors (unresolved external) -when attempting to use the PointMovementGenerator -*/ -bool ChatHandler::HandleComeToMeCommand(const char *args) -{ - char* newFlagStr = strtok((char*)args, " "); - - if (!newFlagStr) - return false; - - Creature* caster = getSelectedCreature(); - if (!caster) - { - SendSysMessage(LANG_SELECT_CREATURE); - SetSentErrorMessage(true); - return false; - } - - Player* player = m_session->GetPlayer(); - - caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); - return true; -} - -//Send items by mail -bool ChatHandler::HandleSendItemsCommand(const char *args) -{ - // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] - Player* receiver; - uint64 receiver_guid; - std::string receiver_name; - if (!extractPlayerTarget((char*)args, &receiver, &receiver_guid, &receiver_name)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char* msgSubject = extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char* msgText = extractQuotedArg(tail2); - if (!msgText) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // extract items - typedef std::pair ItemPair; - typedef std::list< ItemPair > ItemPairs; - ItemPairs items; - - // get all tail string - char* tail = strtok(NULL, ""); - - // get from tail next item str - while (char* itemStr = strtok(tail, " ")) - { - // and get new tail - tail = strtok(NULL, ""); - - // parse item str - char* itemIdStr = strtok(itemStr, ":"); - char* itemCountStr = strtok(NULL, " "); - - uint32 item_id = atoi(itemIdStr); - if (!item_id) - return false; - - ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(item_id); - if (!item_proto) - { - PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); - SetSentErrorMessage(true); - return false; - } - - uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1; - if (item_count < 1 || (item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount))) - { - PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count, item_id); - SetSentErrorMessage(true); - return false; - } - - while (item_count > item_proto->GetMaxStackSize()) - { - items.push_back(ItemPair(item_id, item_proto->GetMaxStackSize())); - item_count -= item_proto->GetMaxStackSize(); - } - - items.push_back(ItemPair(item_id, item_count)); - - if (items.size() > MAX_MAIL_ITEMS) - { - PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS); - SetSentErrorMessage(true); - return false; - } - } - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - // fill mail - MailDraft draft(subject, text); - - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr) - { - if (Item* item = Item::CreateItem(itr->first, itr->second, m_session ? m_session->GetPlayer() : 0)) - { - item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted - draft.AddItem(item); - } - } - - draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiver_guid)), sender); - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = playerLink(receiver_name); - PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; -} - -///Send money by mail -bool ChatHandler::HandleSendMoneyCommand(const char *args) -{ - /// format: name "subject text" "mail text" money - - Player* receiver; - uint64 receiver_guid; - std::string receiver_name; - if (!extractPlayerTarget((char*)args, &receiver, &receiver_guid, &receiver_name)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char* msgSubject = extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char* msgText = extractQuotedArg(tail2); - if (!msgText) - return false; - - char* money_str = strtok(NULL, ""); - int32 money = money_str ? atoi(money_str) : 0; - if (money <= 0) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - MailDraft(subject, text) - .AddMoney(money) - .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiver_guid)), sender); - - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = playerLink(receiver_name); - PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; -} - -/// Send a message to a player in game -bool ChatHandler::HandleSendMessageCommand(const char *args) -{ - ///- Find the player - Player* rPlayer; - if (!extractPlayerTarget((char*)args, &rPlayer)) - return false; - - char* msg_str = strtok(NULL, ""); - if (!msg_str) - return false; - - ///- Check that he is not logging out. - if (rPlayer->GetSession()->isLogingOut()) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - ///- Send the message - //Use SendAreaTriggerMessage for fastest delivery. - rPlayer->GetSession()->SendAreaTriggerMessage("%s", msg_str); - rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); - - //Confirmation message - std::string nameLink = GetNameLink(rPlayer); - PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msg_str); - return true; -} - -bool ChatHandler::HandleFlushArenaPointsCommand(const char * /*args*/) -{ - sArenaTeamMgr->DistributeArenaPoints(); - return true; -} - -bool ChatHandler::HandleChannelSetOwnership(const char *args) -{ - if (!*args) - return false; - char *channel = strtok((char*)args, " "); - char *argstr = strtok(NULL, ""); - - if (!channel || !argstr) - return false; - - Player* player = m_session->GetPlayer(); - Channel* chn = NULL; - - if (ChannelMgr* cMgr = channelMgr(player->GetTeam())) - chn = cMgr->GetChannel(channel, player); - - if (strcmp(argstr, "on") == 0) - { - if (chn) - chn->SetOwnership(true); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP); - stmt->setUInt8 (0, 1); - stmt->setString(1, channel); - CharacterDatabase.Execute(stmt); - PSendSysMessage(LANG_CHANNEL_ENABLE_OWNERSHIP, channel); - } - else if (strcmp(argstr, "off") == 0) - { - if (chn) - chn->SetOwnership(false); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP); - stmt->setUInt8 (0, 0); - stmt->setString(1, channel); - CharacterDatabase.Execute(stmt); - PSendSysMessage(LANG_CHANNEL_DISABLE_OWNERSHIP, channel); - } - else - return false; - - return true; -} - bool ChatHandler::HandlePlayAllCommand(const char *args) { if (!*args) @@ -1513,168 +254,6 @@ bool ChatHandler::HandlePlayAllCommand(const char *args) return true; } -bool ChatHandler::HandleFreezeCommand(const char *args) -{ - std::string name; - Player* player; - char *TargetName = strtok((char*)args, " "); //get entered name - if (!TargetName) //if no name entered use target - { - player = getSelectedPlayer(); - if (player) //prevent crash with creature as target - { - name = player->GetName(); - normalizePlayerName(name); - } - } - else // if name entered - { - name = TargetName; - normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name.c_str()); - } - - if (!player) - { - SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - - if (player == m_session->GetPlayer()) - { - SendSysMessage(LANG_COMMAND_FREEZE_ERROR); - return true; - } - - //effect - if (player && player != m_session->GetPlayer()) - { - PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str()); - - //stop combat + make player unattackable + duel stop + stop some spells - player->setFaction(35); - player->CombatStop(); - if (player->IsNonMeleeSpellCasted(true)) - player->InterruptNonMeleeSpells(true); - player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - //if player class = hunter || warlock remove pet if alive - if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) - { - if (Pet* pet = player->GetPet()) - { - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - // not let dismiss dead pet - if (pet && pet->isAlive()) - player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); - } - } - - //m_session->GetPlayer()->CastSpell(player, spellID, false); - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454)) - Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player); - - //save player - player->SaveToDB(); - } - return true; -} - -bool ChatHandler::HandleUnFreezeCommand(const char *args) -{ - std::string name; - Player* player; - char* targetName = strtok((char*)args, " "); // Get entered name - - if (targetName) - { - name = targetName; - normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name.c_str()); - } - else // If no name was entered - use target - { - player = getSelectedPlayer(); - if (player) - name = player->GetName(); - } - - if (player) - { - PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - - // Reset player faction + allow combat + allow duels - player->setFactionForRace(player->getRace()); - player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - // Remove Freeze spell (allowing movement and spells) - player->RemoveAurasDueToSpell(9454); - - // Save player - player->SaveToDB(); - } - else - { - if (targetName) - { - // Check for offline players - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME); - stmt->setString(0, name); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (!result) - { - SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - - // If player found: delete his freeze aura - Field* fields = result->Fetch(); - uint32 lowGuid = fields[0].GetUInt32(); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); - stmt->setUInt32(0, lowGuid); - CharacterDatabase.Execute(stmt); - - PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - return true; - } - else - { - SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - } - - return true; -} - -bool ChatHandler::HandleListFreezeCommand(const char * /*args*/) -{ - // Get names from DB - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN); - - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (!result) - { - SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); - return true; - } - //Header of the names - PSendSysMessage(LANG_COMMAND_LIST_FREEZE); - - //Output of the results - do - { - Field* fields = result->Fetch(); - std::string fplayers = fields[0].GetString(); - PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, fplayers.c_str()); - } while (result->NextRow()); - - return true; -} - bool ChatHandler::HandleGroupLeaderCommand(const char *args) { Player* player = NULL; diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 72af70f5c26..ed5b5638b4d 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -60,6 +60,7 @@ void AddSC_instance_commandscript(); void AddSC_learn_commandscript(); void AddSC_list_commandscript(); void AddSC_lookup_commandscript(); +void AddSC_message_commandscript(); void AddSC_misc_commandscript(); void AddSC_modify_commandscript(); void AddSC_npc_commandscript(); @@ -672,6 +673,7 @@ void AddCommandScripts() AddSC_learn_commandscript(); AddSC_lookup_commandscript(); AddSC_list_commandscript(); + AddSC_message_commandscript(); AddSC_misc_commandscript(); AddSC_modify_commandscript(); AddSC_npc_commandscript(); diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index bb7d27d7dce..ca4a964ffb3 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -26,6 +26,7 @@ set(scripts_STAT_SRCS Commands/cs_learn.cpp Commands/cs_list.cpp Commands/cs_lookup.cpp + Commands/cs_message.cpp Commands/cs_misc.cpp Commands/cs_modify.cpp Commands/cs_npc.cpp diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index a40b586f8c8..a54ac96b5e2 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -60,6 +60,7 @@ public: static ChatCommand commandTable[] = { { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable}, + { "levelup", SEC_ADMINISTRATOR, false, &HandleLevelUpCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; return commandTable; @@ -218,6 +219,34 @@ public: sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8()); } + static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler) + { + if (player) + { + player->GiveLevel(newLevel); + player->InitTalentForLevel(); + player->SetUInt32Value(PLAYER_XP, 0); + + if (handler->needReportToTarget(player)) + { + if (oldLevel == newLevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, handler->GetNameLink().c_str()); + else if (oldLevel < newLevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, handler->GetNameLink().c_str(), newLevel); + else // if (oldlevel > newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, handler->GetNameLink().c_str(), newLevel); + } + } + else + { + // Update level and reset XP, everything else will be updated at login + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL); + stmt->setUInt8(0, uint8(newLevel)); + stmt->setUInt32(1, GUID_LOPART(playerGuid)); + CharacterDatabase.Execute(stmt); + } + } + static bool HandleCharacterTitlesCommand(ChatHandler* handler, char const* args) { if (!*args) @@ -326,7 +355,7 @@ public: if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level newlevel = STRONG_MAX_LEVEL; - handler->HandleCharacterLevel(target, targetGuid, oldlevel, newlevel); + HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler); if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == NULL { std::string nameLink = handler->playerLink(targetName); @@ -671,6 +700,46 @@ public: return true; } + + static bool HandleLevelUpCommand(ChatHandler* handler, char const* args) + { + char* nameStr; + char* levelStr; + handler->extractOptFirstArg((char*)args, &nameStr, &levelStr); + + // exception opt second arg: .character level $name + if (levelStr && isalpha(levelStr[0])) + { + nameStr = levelStr; + levelStr = NULL; // current level will used + } + + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) + return false; + + int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(targetGuid); + int32 addlevel = levelStr ? atoi(levelStr) : 1; + int32 newlevel = oldlevel + addlevel; + + if (newlevel < 1) + newlevel = 1; + + if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level + newlevel = STRONG_MAX_LEVEL; + + HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler); + + if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including chr == NULL + { + std::string nameLink = handler->playerLink(targetName); + handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); + } + + return true; + } }; void AddSC_character_commandscript() diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index ae573577d7e..cfdfc66f991 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -22,10 +22,10 @@ Comment: All learn related commands Category: commandscripts EndScriptData */ +#include "Chat.h" #include "ScriptMgr.h" #include "ObjectMgr.h" #include "SpellMgr.h" -#include "Chat.h" #include "SpellInfo.h" class learn_commandscript : public CommandScript @@ -37,35 +37,36 @@ public: { static ChatCommand learnAllMyCommandTable[] = { - { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL }, - { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL }, - { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL }, - { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL }, + { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL }, + { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL }, + { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand learnAllCommandTable[] = { - { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable }, - { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL }, - { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL }, - { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL }, - { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL }, - { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable }, + { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL }, + { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL }, + { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL }, + { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL }, + { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand learnCommandTable[] = { - { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable }, - { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable }, + { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { - { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable }, + { "unlearn", SEC_ADMINISTRATOR, false, &HandleUnLearnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; return commandTable; } @@ -466,6 +467,41 @@ public: player->learnSpell(skillLine->spellId, false); } } + + static bool HandleUnLearnCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId) + return false; + + char const* allStr = strtok(NULL, " "); + bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false; + + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + if (allRanks) + spellId = sSpellMgr->GetFirstSpellInChain (spellId); + + if (target->HasSpell(spellId)) + target->removeSpell(spellId, false, !allRanks); + else + handler->SendSysMessage(LANG_FORGET_SPELL); + + if (GetTalentSpellCost(spellId)) + target->SendTalentsInfoData(false); + + return true; + } }; void AddSC_learn_commandscript() diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp new file mode 100644 index 00000000000..d61abf34e2f --- /dev/null +++ b/src/server/scripts/Commands/cs_message.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: message_commandscript +%Complete: 100 +Comment: All message related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "ChannelMgr.h" + +class message_commandscript : public CommandScript +{ +public: + message_commandscript() : CommandScript("message_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand channelSetCommandTable[] = + { + { "ownership", SEC_ADMINISTRATOR, false, &HandleChannelSetOwnership, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand channelCommandTable[] = + { + { "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable }, + { "nameannounce", SEC_MODERATOR, true, &HandleNameAnnounceCommand, "", NULL }, + { "gmnameannounce", SEC_MODERATOR, true, &HandleGMNameAnnounceCommand, "", NULL }, + { "announce", SEC_MODERATOR, true, &HandleAnnounceCommand, "", NULL }, + { "gmannounce", SEC_MODERATOR, true, &HandleGMAnnounceCommand, "", NULL }, + { "notify", SEC_MODERATOR, true, &HandleNotifyCommand, "", NULL }, + { "gmnotify", SEC_MODERATOR, true, &HandleGMNotifyCommand, "", NULL }, + { "whispers", SEC_MODERATOR, false, &HandleWhispersCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleChannelSetOwnership(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + char const* channelStr = strtok((char*)args, " "); + char const* argStr = strtok(NULL, ""); + + if (!channelStr || !argStr) + return false; + + Player* player = handler->GetSession()->GetPlayer(); + Channel* channcel = NULL; + + if (ChannelMgr* cMgr = channelMgr(player->GetTeam())) + channcel = cMgr->GetChannel(channelStr, player); + + if (strcmp(argStr, "on") == 0) + { + if (channcel) + channcel->SetOwnership(true); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP); + stmt->setUInt8 (0, 1); + stmt->setString(1, channelStr); + CharacterDatabase.Execute(stmt); + handler->PSendSysMessage(LANG_CHANNEL_ENABLE_OWNERSHIP, channelStr); + } + else if (strcmp(argStr, "off") == 0) + { + if (channcel) + channcel->SetOwnership(false); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP); + stmt->setUInt8 (0, 0); + stmt->setString(1, channelStr); + CharacterDatabase.Execute(stmt); + handler->PSendSysMessage(LANG_CHANNEL_DISABLE_OWNERSHIP, channelStr); + } + else + return false; + + return true; + } + + static bool HandleNameAnnounceCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string name("Console"); + if (WorldSession* session = handler->GetSession()) + name = session->GetPlayer()->GetName(); + + sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args); + return true; + } + + static bool HandleGMNameAnnounceCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string name("Console"); + if (WorldSession* session = handler->GetSession()) + name = session->GetPlayer()->GetName(); + + sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args); + return true; + } + // global announce + static bool HandleAnnounceCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char buff[2048]; + sprintf(buff, handler->GetTrinityString(LANG_SYSTEMMESSAGE), args); + sWorld->SendServerMessage(SERVER_MSG_STRING, buff); + return true; + } + // announce to logged in GMs + static bool HandleGMAnnounceCommand(ChatHandler* /*handler*/, char const* args) + { + if (!*args) + return false; + + sWorld->SendGMText(LANG_GM_BROADCAST, args); + return true; + } + // notification player at the screen + static bool HandleNotifyCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string str = handler->GetTrinityString(LANG_GLOBAL_NOTIFY); + str += args; + + WorldPacket data(SMSG_NOTIFICATION, (str.size()+1)); + data << str; + sWorld->SendGlobalMessage(&data); + + return true; + } + // notification GM at the screen + static bool HandleGMNotifyCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string str = handler->GetTrinityString(LANG_GM_NOTIFY); + str += args; + + WorldPacket data(SMSG_NOTIFICATION, (str.size()+1)); + data << str; + sWorld->SendGlobalGMMessage(&data); + + return true; + } + // Enable\Dissable accept whispers (for GM) + static bool HandleWhispersCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, handler->GetSession()->GetPlayer()->isAcceptWhispers() ? handler->GetTrinityString(LANG_ON) : handler->GetTrinityString(LANG_OFF)); + return true; + } + + std::string argStr = (char*)args; + // whisper on + if (argStr == "on") + { + handler->GetSession()->GetPlayer()->SetAcceptWhispers(true); + handler->SendSysMessage(LANG_COMMAND_WHISPERON); + return true; + } + + // whisper off + if (argStr == "off") + { + // Remove all players from the Gamemaster's whisper whitelist + handler->GetSession()->GetPlayer()->ClearWhisperWhiteList(); + handler->GetSession()->GetPlayer()->SetAcceptWhispers(false); + handler->SendSysMessage(LANG_COMMAND_WHISPEROFF); + return true; + } + + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } +}; + +void AddSC_message_commandscript() +{ + new message_commandscript(); +} diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 7c431566f52..47b82fe302d 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -15,11 +15,20 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" #include "Chat.h" -#include "ObjectAccessor.h" #include "ScriptMgr.h" +#include "AccountMgr.h" +#include "ArenaTeamMgr.h" #include "CellImpl.h" +#include "GridNotifiers.h" +#include "Group.h" +#include "InstanceSaveMgr.h" +#include "MovementGenerator.h" +#include "ObjectAccessor.h" +#include "SpellAuras.h" +#include "TargetedMovementGenerator.h" +#include "WeatherMgr.h" +#include "ace/INET_Addr.h" class misc_commandscript : public CommandScript { @@ -28,11 +37,72 @@ public: ChatCommand* GetCommands() const { + static ChatCommand petCommandTable[] = + { + { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL }, + { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL }, + { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand sendCommandTable[] = + { + { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL }, + { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL }, + { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL }, + { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand commandTable[] = { - { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL }, - { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL }, + { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, + { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL }, + { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL }, + { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL }, + { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL }, + { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL }, + { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL }, + { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL }, + { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL }, + { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL }, + { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL }, + { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL }, + { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL }, + { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL }, + { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL }, + { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL }, + { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL }, + { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL }, + { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL }, + { "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL }, + { "taxicheat", SEC_MODERATOR, false, &HandleTaxiCheatCommand, "", NULL }, + { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL }, + { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL }, + { "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "", NULL }, + { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL }, + { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL }, + { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL }, + { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL }, + { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL }, + { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL }, + { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL }, + { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL }, + { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL }, + { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL }, + { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable }, + { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL }, + { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL }, + { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL }, + { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL }, + { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL }, + { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL }, + { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL }, + { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL }, + { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "", NULL }, + { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL }, + { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL }, + { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; return commandTable; } @@ -152,6 +222,2532 @@ public: return true; } + + static bool HandleAuraCommand(ChatHandler* handler, char const* args) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) + Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target); + + return true; + } + + static bool HandleUnAuraCommand(ChatHandler* handler, char const* args) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + std::string argstr = args; + if (argstr == "all") + { + target->RemoveAllAuras(); + return true; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId) + return false; + + target->RemoveAurasDueToSpell(spellId); + + return true; + } + // Teleport to Player + static bool HandleAppearCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + Player* _player = handler->GetSession()->GetPlayer(); + if (target == _player || targetGuid == _player->GetGUID()) + { + handler->SendSysMessage(LANG_CANT_TELEPORT_SELF); + handler->SetSentErrorMessage(true); + return false; + } + + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + std::string chrNameLink = handler->playerLink(targetName); + + Map* map = target->GetMap(); + if (map->IsBattlegroundOrArena()) + { + // only allow if gm mode is on + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + // if both players are in different bgs + else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) + _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff + + // all's well, set bg id + // when porting out from the bg, it will be reset to 0 + _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId()); + // remember current position as entry point for return at bg end teleportation + if (!_player->GetMap()->IsBattlegroundOrArena()) + _player->SetBattlegroundEntryPoint(); + } + else if (map->IsDungeon()) + { + // we have to go to instance, and can go to player only if: + // 1) we are in his group (either as leader or as member) + // 2) we are not bound to any group and have GM mode on + if (_player->GetGroup()) + { + // we are in group, we can go only if we are in the player group + if (_player->GetGroup() != target->GetGroup()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + // we are not in group, let's verify our GM mode + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + // if the player or the player's group is bound to another instance + // the player will not be bound to another one + InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid())); + if (!bind) + { + Group* group = _player->GetGroup(); + // if no bind exists, create a solo bind + InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind + if (!gBind) + if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) + _player->BindToInstance(save, !save->CanReset()); + } + + if (map->IsRaid()) + _player->SetRaidDifficulty(target->GetRaidDifficulty()); + else + _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); + } + + handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + // to point to see at target with same orientation + float x, y, z; + target->GetContactPoint(_player, x, y, z); + + _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); + _player->SetPhaseMask(target->GetPhaseMask(), true); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str()); + + // to point where player stay (if loaded) + float x, y, z, o; + uint32 map; + bool in_flight; + if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid)) + return false; + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(map, x, y, z, _player->GetOrientation()); + } + + return true; + } + // Summon Player + static bool HandleSummonCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + Player* _player = handler->GetSession()->GetPlayer(); + if (target == _player || targetGuid == _player->GetGUID()) + { + handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF); + handler->SetSentErrorMessage(true); + return false; + } + + if (target) + { + std::string nameLink = handler->playerLink(targetName); + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (target->IsBeingTeleported()) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + Map* map = handler->GetSession()->GetPlayer()->GetMap(); + + if (map->IsBattlegroundOrArena()) + { + // only allow if gm mode is on + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + // if both players are in different bgs + else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId()) + target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff + + // all's well, set bg id + // when porting out from the bg, it will be reset to 0 + target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId()); + // remember current position as entry point for return at bg end teleportation + if (!target->GetMap()->IsBattlegroundOrArena()) + target->SetBattlegroundEntryPoint(); + } + else if (map->IsDungeon()) + { + Map* map = target->GetMap(); + + if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId()) + target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true); + + // we are in instance, and can summon only player in our group with us as lead + if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() || + (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || + (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())) + // the last check is a bit excessive, but let it be, just in case + { + handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), ""); + if (handler->needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + target->SaveRecallPosition(); + + // before GM + float x, y, z; + handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize()); + target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation()); + target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE)); + + // in point where GM stay + Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(), + handler->GetSession()->GetPlayer()->GetPositionX(), + handler->GetSession()->GetPlayer()->GetPositionY(), + handler->GetSession()->GetPlayer()->GetPositionZ(), + handler->GetSession()->GetPlayer()->GetOrientation(), + handler->GetSession()->GetPlayer()->GetZoneId(), + targetGuid); + } + + return true; + } + // Summon group of player + static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + Group* group = target->GetGroup(); + + std::string nameLink = handler->GetNameLink(target); + + if (!group) + { + handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + Map* gmMap = handler->GetSession()->GetPlayer()->GetMap(); + bool toInstance = gmMap->Instanceable(); + + // we are in instance, and can summon only player in our group with us as lead + if (toInstance && ( + !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || + (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))) + // the last check is a bit excessive, but let it be, just in case + { + handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST); + handler->SetSentErrorMessage(true); + return false; + } + + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* player = itr->getSource(); + + if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession()) + continue; + + // check online security + if (handler->HasLowerSecurity(player, 0)) + return false; + + std::string plNameLink = handler->GetNameLink(player); + + if (player->IsBeingTeleported() == true) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + if (toInstance) + { + Map* playerMap = player->GetMap(); + + if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId()) + { + // cannot summon from instance to instance + handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), ""); + if (handler->needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str()); + + // stop flight if need + if (player->isInFlight()) + { + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + player->SaveRecallPosition(); + + // before GM + float x, y, z; + handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize()); + player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation()); + } + + return true; + } + + static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/) + { + handler->ShowHelpForCommand(handler->getCommandTable(), ""); + return true; + } + + static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* target = handler->getSelectedUnit(); + + if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (handler->HasLowerSecurity((Player*)target, 0, false)) + return false; + } + + if (target->isAlive()) + { + if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE)) + handler->GetSession()->GetPlayer()->Kill(target); + else + handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + + return true; + } + + static bool HandleReviveCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) + return false; + + if (target) + { + target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); + target->SpawnCorpseBones(); + target->SaveToDB(); + } + else + // will resurrected at login without corpse + sObjectAccessor->ConvertCorpseForPlayer(targetGuid); + + return true; + } + + static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // If player is not mounted, so go out :) + if (!player->IsMounted()) + { + handler->SendSysMessage(LANG_CHAR_NON_MOUNTED); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isInFlight()) + { + handler->SendSysMessage(LANG_YOU_IN_FLIGHT); + handler->SetSentErrorMessage(true); + return false; + } + + player->Dismount(); + player->RemoveAurasByType(SPELL_AURA_MOUNTED); + return true; + } + + static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/) + { + uint64 guid = handler->GetSession()->GetPlayer()->GetSelection(); + + if (guid == 0) + { + handler->SendSysMessage(LANG_NO_SELECTION); + handler->SetSentErrorMessage(true); + return false; + } + + handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); + return true; + } + + static bool HandleHelpCommand(ChatHandler* handler, char const* args) + { + char const* cmd = strtok((char*)args, " "); + if (!cmd) + { + handler->ShowHelpForCommand(handler->getCommandTable(), "help"); + handler->ShowHelpForCommand(handler->getCommandTable(), ""); + } + else + { + if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd)) + handler->SendSysMessage(LANG_NO_HELP_CMD); + } + + return true; + } + // move item to other slot + static bool HandleItemMoveCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char const* param1 = strtok((char*)args, " "); + if (!param1) + return false; + + char const* param2 = strtok(NULL, " "); + if (!param2) + return false; + + uint8 srcSlot = uint8(atoi(param1)); + uint8 dstSlot = uint8(atoi(param2)); + + if (srcSlot == dstSlot) + return true; + + if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true)) + return false; + + if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false)) + return false; + + uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot); + uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot); + + handler->GetSession()->GetPlayer()->SwapItem(src, dst); + + return true; + } + + static bool HandleCooldownCommand(ChatHandler* handler, char const* args) + { + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + std::string nameLink = handler->GetNameLink(target); + + if (!*args) + { + target->RemoveAllSpellCooldown(); + handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str()); + } + else + { + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellIid = handler->extractSpellIdFromLink((char*)args); + if (!spellIid) + return false; + + if (!sSpellMgr->GetSpellInfo(spellIid)) + { + handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + target->RemoveSpellCooldown(spellIid, true); + handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); + } + return true; + } + + static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args) + { + WorldObject* obj = NULL; + + if (*args) + { + uint64 guid = handler->extractGuidFromLink((char*)args); + if (guid) + obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); + + if (!obj) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + obj = handler->getSelectedUnit(); + + if (!obj) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj)); + return true; + } + // Teleport player to last position + static bool HandleRecallCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (target->IsBeingTeleported()) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + + target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO); + return true; + } + + static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // save GM account without delay and output message + if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity())) + { + if (Player* target = handler->getSelectedPlayer()) + target->SaveToDB(); + else + player->SaveToDB(); + handler->SendSysMessage(LANG_PLAYER_SAVED); + return true; + } + + // save if the player has last been saved over 20 seconds ago + uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); + if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS)) + player->SaveToDB(); + + return true; + } + + // Save all players in the world + static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/) + { + sObjectAccessor->SaveAllPlayers(); + handler->SendSysMessage(LANG_PLAYERS_SAVED); + return true; + } + + // kick player + static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args) + { + Player* target = NULL; + std::string playerName; + if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + return false; + + if (handler->GetSession() && target == handler->GetSession()->GetPlayer()) + { + handler->SendSysMessage(LANG_COMMAND_KICKSELF); + handler->SetSentErrorMessage(true); + return false; + } + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD)) + sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); + else + handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); + + target->GetSession()->KickPlayer(); + + return true; + } + + static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + if (player->isInFlight()) + { + handler->SendSysMessage(LANG_YOU_IN_FLIGHT); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isInCombat()) + { + handler->SendSysMessage(LANG_YOU_IN_COMBAT); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + { + // if player is dead and stuck, send ghost to graveyard + player->RepopAtGraveyard(); + return true; + } + + // cast spell Stuck + player->CastSpell(player, 7355, false); + return true; + } + // Enable on\off all taxi paths + static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + std::string argStr = (char*)args; + + Player* chr = handler->getSelectedPlayer(); + + if (!chr) + chr = handler->GetSession()->GetPlayer(); + else if (handler->HasLowerSecurity(chr, 0)) // check online security + return false; + + if (argStr == "on") + { + chr->SetTaxiCheater(true); + handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str()); + if (handler->needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str()); + return true; + } + + if (argStr == "off") + { + chr->SetTaxiCheater(false); + handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str()); + if (handler->needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str()); + + return true; + } + + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + + return false; + } + + static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* px = strtok((char*)args, " "); + if (!px) + return false; + + uint32 graveyardId = uint32(atoi(px)); + + uint32 team; + + char* px2 = strtok(NULL, " "); + + if (!px2) + team = 0; + else if (strncmp(px2, "horde", 6) == 0) + team = HORDE; + else if (strncmp(px2, "alliance", 9) == 0) + team = ALLIANCE; + else + return false; + + WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId); + + if (!graveyard) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + + uint32 zoneId = player->GetZoneId(); + + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); + if (!areaEntry || areaEntry->zone !=0) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId); + handler->SetSentErrorMessage(true); + return false; + } + + if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team)) + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId); + else + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId); + + return true; + } + + static bool HandleNearGraveCommand(ChatHandler* handler, char const* args) + { + uint32 team; + + size_t argStr = strlen(args); + + if (!*args) + team = 0; + else if (strncmp((char*)args, "horde", argStr) == 0) + team = HORDE; + else if (strncmp((char*)args, "alliance", argStr) == 0) + team = ALLIANCE; + else + return false; + + Player* player = handler->GetSession()->GetPlayer(); + uint32 zone_id = player->GetZoneId(); + + WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard( + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); + + if (graveyard) + { + uint32 graveyardId = graveyard->ID; + + GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id); + if (!data) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId); + handler->SetSentErrorMessage(true); + return false; + } + + team = data->team; + + std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); + + if (team == 0) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); + else if (team == HORDE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); + else if (team == ALLIANCE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id); + } + else + { + std::string team_name; + + if (team == 0) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); + else if (team == HORDE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); + else if (team == ALLIANCE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + + if (team == ~uint32(0)) + handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); + else + handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); + } + + return true; + } + + static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + int32 flag = int32(atoi((char*)args)); + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + if (flag != 0) + { + handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str()); + if (handler->needReportToTarget(playerTarget)) + ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str()); + } + else + { + handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str()); + if (handler->needReportToTarget(playerTarget)) + ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str()); + } + + for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) + { + if (flag != 0) + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); + else + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); + } + + return true; + } + + static bool HandleShowAreaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + int32 area = GetAreaFlagByAreaID(atoi((char*)args)); + int32 offset = area / 32; + uint32 val = uint32((1 << (area % 32))); + + if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); + playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val))); + + handler->SendSysMessage(LANG_EXPLORE_AREA); + return true; + } + + static bool HandleHideAreaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + int32 area = GetAreaFlagByAreaID(atoi((char*)args)); + int32 offset = area / 32; + uint32 val = uint32((1 << (area % 32))); + + if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); + playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val))); + + handler->SendSysMessage(LANG_UNEXPLORE_AREA); + return true; + } + + static bool HandleAddItemCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 itemId = 0; + + if (args[0] == '[') // [name] manual form + { + char const* itemNameStr = strtok((char*)args, "]"); + + if (itemNameStr && itemNameStr[0]) + { + std::string itemName = itemNameStr+1; + WorldDatabase.EscapeString(itemName); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME); + stmt->setString(0, itemName); + PreparedQueryResult result = WorldDatabase.Query(stmt); + + if (!result) + { + handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1); + handler->SetSentErrorMessage(true); + return false; + } + itemId = result->Fetch()->GetUInt32(); + } + else + return false; + } + else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r + { + char const* id = handler->extractKeyFromLink((char*)args, "Hitem"); + if (!id) + return false; + itemId = uint32(atol(id)); + } + + char const* ccount = strtok(NULL, " "); + + int32 count = 1; + + if (ccount) + count = strtol(ccount, NULL, 10); + + if (count == 0) + count = 1; + + Player* player = handler->GetSession()->GetPlayer(); + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + playerTarget = player; + + sLog->outDetail(handler->GetTrinityString(LANG_ADDITEM), itemId, count); + + ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); + if (!itemTemplate) + { + handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + // Subtract + if (count < 0) + { + playerTarget->DestroyItemCount(itemId, -count, true, false); + handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str()); + return true; + } + + // Adding items + uint32 noSpaceForCount = 0; + + // check space and find places + ItemPosCountVec dest; + InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) // convert to possible store amount + count -= noSpaceForCount; + + if (count == 0 || dest.empty()) // can't add any + { + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); + handler->SetSentErrorMessage(true); + return false; + } + + Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + + // remove binding (let GM give it to another player later) + if (player == playerTarget) + for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) + if (Item* item1 = player->GetItemByPos(itr->pos)) + item1->SetBinding(false); + + if (count > 0 && item) + { + player->SendNewItem(item, count, false, true); + if (player != playerTarget) + playerTarget->SendNewItem(item, count, true, false); + } + + if (noSpaceForCount > 0) + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); + + return true; + } + + static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r + if (!id) + return false; + + uint32 itemSetId = atol(id); + + // prevent generation all items with itemset field value '0' + if (itemSetId == 0) + { + handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + playerTarget = player; + + sLog->outDetail(handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); + + bool found = false; + ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); + for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) + { + if (itr->second.ItemSet == itemSetId) + { + found = true; + ItemPosCountVec dest; + InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1); + if (msg == EQUIP_ERR_OK) + { + Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true); + + // remove binding (let GM give it to another player later) + if (player == playerTarget) + item->SetBinding(false); + + player->SendNewItem(item, 1, false, true); + if (player != playerTarget) + playerTarget->SendNewItem(item, 1, true, false); + } + else + { + player->SendEquipError(msg, NULL, NULL, itr->second.ItemId); + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1); + } + } + } + + if (!found) + { + handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/) + { + handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID()); + return true; + } + + static bool HandleChangeWeather(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // Weather is OFF + if (!sWorld->getBoolConfig(CONFIG_WEATHER)) + { + handler->SendSysMessage(LANG_WEATHER_DISABLED); + handler->SetSentErrorMessage(true); + return false; + } + + // *Change the weather of a cell + char const* px = strtok((char*)args, " "); + char const* py = strtok(NULL, " "); + + if (!px || !py) + return false; + + uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand + float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather + + Player* player = handler->GetSession()->GetPlayer(); + uint32 zoneid = player->GetZoneId(); + + Weather* weather = WeatherMgr::FindWeather(zoneid); + + if (!weather) + weather = WeatherMgr::AddWeather(zoneid); + if (!weather) + { + handler->SendSysMessage(LANG_NO_WEATHER); + handler->SetSentErrorMessage(true); + return false; + } + + weather->SetWeather(WeatherType(type), grade); + + return true; + } + + + static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/) + { + Player* SelectedPlayer = handler->getSelectedPlayer(); + if (!SelectedPlayer) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + // each skills that have max skill value dependent from level seted to current level max skill value + SelectedPlayer->UpdateSkillsToMaxSkillsForLevel(); + return true; + } + + static bool HandleSetSkillCommand(ChatHandler* handler, char const* args) + { + // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r + char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill"); + if (!skillStr) + return false; + + char const* levelStr = strtok(NULL, " "); + if (!levelStr) + return false; + + char const* maxPureSkill = strtok(NULL, " "); + + int32 skill = atoi(skillStr); + if (skill <= 0) + { + handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); + handler->SetSentErrorMessage(true); + return false; + } + + int32 level = uint32(atol(levelStr)); + + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill); + if (!skillLine) + { + handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); + handler->SetSentErrorMessage(true); + return false; + } + + std::string tNameLink = handler->GetNameLink(target); + + if (!target->GetSkillValue(skill)) + { + handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]); + handler->SetSentErrorMessage(true); + return false; + } + + uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill); + + if (level <= 0 || level > max || max <= 0) + return false; + + target->SetSkill(skill, target->GetSkillStep(skill), level, max); + handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max); + + return true; + } + // show info of player + static bool HandlePInfoCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + + uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + + if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) + { + target = sObjectMgr->GetPlayerByLowGUID(parseGUID); + targetGuid = parseGUID; + } + 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; + uint32 mapId; + uint32 areaId; + uint32 phase = 0; + + // get additional information from Player object + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + accId = target->GetSession()->GetAccountId(); + money = target->GetMoney(); + totalPlayerTime = target->GetTotalPlayedTime(); + level = target->getLevel(); + latency = target->GetSession()->GetLatency(); + race = target->getRace(); + Class = target->getClass(); + muteTime = target->GetSession()->m_muteTime; + mapId = target->GetMapId(); + areaId = target->GetAreaId(); + phase = target->GetPhaseMask(); + } + // get additional information from DB + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); + stmt->setUInt32(0, GUID_LOPART(targetGuid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) + return false; + + Field* fields = result->Fetch(); + totalPlayerTime = fields[0].GetUInt32(); + level = fields[1].GetUInt8(); + money = fields[2].GetUInt32(); + accId = fields[3].GetUInt32(); + race = fields[4].GetUInt8(); + Class = fields[5].GetUInt8(); + mapId = fields[6].GetUInt16(); + areaId = fields[7].GetUInt16(); + } + + std::string userName = handler->GetTrinityString(LANG_ERROR); + std::string eMail = handler->GetTrinityString(LANG_ERROR); + std::string lastIp = handler->GetTrinityString(LANG_ERROR); + uint32 security = 0; + std::string lastLogin = handler->GetTrinityString(LANG_ERROR); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO); + stmt->setInt32(0, int32(realmID)); + stmt->setUInt32(1, accId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + if (result) + { + Field* fields = result->Fetch(); + userName = fields[0].GetString(); + security = fields[1].GetUInt8(); + eMail = fields[2].GetString(); + muteTime = fields[5].GetUInt64(); + + if (eMail.empty()) + eMail = "-"; + + if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)) + { + lastIp = fields[3].GetString(); + lastLogin = fields[4].GetString(); + + uint32 ip = inet_addr(lastIp.c_str()); +#if TRINITY_ENDIAN == BIGENDIAN + EndianConvertReverse(ip); +#endif + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY); + + stmt->setUInt32(0, ip); + + PreparedQueryResult result2 = WorldDatabase.Query(stmt); + + if (result2) + { + Field* fields2 = result2->Fetch(); + lastIp.append(" ("); + lastIp.append(fields2[0].GetString()); + lastIp.append(")"); + } + } + else + { + lastIp = "-"; + lastLogin = "-"; + } + } + + 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); + if (!result2) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); + stmt->setUInt32(0, GUID_LOPART(targetGuid)); + result2 = CharacterDatabase.Query(stmt); + } + + if (result2) + { + Field* fields = result2->Fetch(); + banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32()); + bannedby = fields[2].GetString(); + banreason = fields[3].GetString(); + } + + if (muteTime > 0) + handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str()); + + 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 = ""; + std::string zoneName = ""; + + MapEntry const* map = sMapStore.LookupEntry(mapId); + + AreaTableEntry const* area = GetAreaEntryByAreaID(areaId); + if (area) + { + areaName = area->area_name[locale]; + + AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); + if (zone) + zoneName = zone->area_name[locale]; + } + + 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(), "", phase); + } + else + handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); + + return true; + } + + static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // accept only explicitly selected target (not implicitly self targeting case) + Unit* target = handler->getSelectedUnit(); + if (player->GetSelection() && target) + { + if (target->GetTypeId() != TYPEID_UNIT || target->isPet()) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->isDead()) + target->ToCreature()->Respawn(); + return true; + } + + CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY())); + Cell cell(p); + cell.SetNoCreate(); + + Trinity::RespawnDo u_do; + Trinity::WorldObjectWorker worker(player, u_do); + + TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); + cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange()); + + return true; + } + // mute player for some times + static bool HandleMuteCommand(ChatHandler* handler, char const* args) + { + char* nameStr; + char* delayStr; + handler->extractOptFirstArg((char*)args, &nameStr, &delayStr); + if (!delayStr) + return false; + + char const* muteReason = strtok(NULL, "\r"); + std::string muteReasonStr = "No reason"; + if (muteReason != NULL) + muteReasonStr = muteReason; + + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) + return false; + + uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); + + // find only player from same account if any + if (!target) + if (WorldSession* session = sWorld->FindSession(accountId)) + target = session->GetPlayer(); + + uint32 notSpeakTime = uint32(atoi(delayStr)); + + // must have strong lesser security level + if (handler->HasLowerSecurity (target, targetGuid, true)) + return false; + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); + + if (target) + { + // Target is online, mute will be in effect right away. + int64 muteTime = time(NULL) + notSpeakTime * MINUTE; + target->GetSession()->m_muteTime = muteTime; + stmt->setInt64(0, muteTime); + ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str()); + } + else + { + // Target is offline, mute will be in effect starting from the next login. + int32 muteTime = -int32(notSpeakTime * MINUTE); + stmt->setInt64(0, muteTime); + } + + stmt->setUInt32(1, accountId); + LoginDatabase.Execute(stmt); + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str()); + + return true; + } + + // unmute player + static bool HandleUnmuteCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); + + // find only player from same account if any + if (!target) + if (WorldSession* session = sWorld->FindSession(accountId)) + target = session->GetPlayer(); + + // must have strong lesser security level + if (handler->HasLowerSecurity (target, targetGuid, true)) + return false; + + if (target) + { + if (target->CanSpeak()) + { + handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED); + handler->SetSentErrorMessage(true); + return false; + } + + target->GetSession()->m_muteTime = 0; + } + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); + stmt->setInt64(0, 0); + stmt->setUInt32(1, accountId); + LoginDatabase.Execute(stmt); + + if (target) + ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str()); + + return true; + } + + + static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow()); + + MotionMaster* motionMaster = unit->GetMotionMaster(); + float x, y, z; + motionMaster->GetDestination(x, y, z); + + for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) + { + MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i); + if (!movementGenerator) + { + handler->SendSysMessage("Empty"); + continue; + } + + switch (movementGenerator->GetMovementGeneratorType()) + { + case IDLE_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_IDLE); + break; + case RANDOM_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_RANDOM); + break; + case WAYPOINT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT); + break; + case ANIMAL_RANDOM_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); + break; + case CONFUSED_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_CONFUSED); + break; + case CHASE_MOTION_TYPE: + { + Unit* target = NULL; + if (unit->GetTypeId() == TYPEID_PLAYER) + target = static_cast const*>(movementGenerator)->GetTarget(); + else + target = static_cast const*>(movementGenerator)->GetTarget(); + + if (!target) + handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); + else if (target->GetTypeId() == TYPEID_PLAYER) + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); + else + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); + break; + } + case FOLLOW_MOTION_TYPE: + { + Unit* target = NULL; + if (unit->GetTypeId() == TYPEID_PLAYER) + target = static_cast const*>(movementGenerator)->GetTarget(); + else + target = static_cast const*>(movementGenerator)->GetTarget(); + + if (!target) + handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); + else if (target->GetTypeId() == TYPEID_PLAYER) + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); + else + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); + break; + } + case HOME_MOTION_TYPE: + { + if (unit->GetTypeId() == TYPEID_UNIT) + handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z); + else + handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); + break; + } + case FLIGHT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_FLIGHT); + break; + case POINT_MOTION_TYPE: + { + handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z); + break; + } + case FLEEING_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_FEAR); + break; + case DISTRACT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_DISTRACT); + break; + case EFFECT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_EFFECT); + break; + default: + handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType()); + break; + } + } + return true; + } + /* + ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator + Without this function 3rd party scripting library will get linking errors (unresolved external) + when attempting to use the PointMovementGenerator + */ + static bool HandleComeToMeCommand(ChatHandler* handler, char const* args) + { + char const* newFlagStr = strtok((char*)args, " "); + if (!newFlagStr) + return false; + + Creature* caster = handler->getSelectedCreature(); + if (!caster) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + + caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + + return true; + } + + static bool HandleDamageCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Unit* target = handler->getSelectedUnit(); + if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (handler->HasLowerSecurity((Player*)target, 0, false)) + return false; + } + + if (!target->isAlive()) + return true; + + char* damageStr = strtok((char*)args, " "); + if (!damageStr) + return false; + + int32 damage_int = atoi((char*)damageStr); + if (damage_int <= 0) + return true; + + uint32 damage = damage_int; + + char* schoolStr = strtok((char*)NULL, " "); + + // flat melee damage without resistence/etc reduction + if (!schoolStr) + { + handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (target != handler->GetSession()->GetPlayer()) + handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); + return true; + } + + uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; + if (school >= MAX_SPELL_SCHOOL) + return false; + + SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); + + if (Unit::IsDamageReducedByArmor(schoolmask)) + damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); + + char* spellStr = strtok((char*)NULL, " "); + + // melee damage by specific school + if (!spellStr) + { + uint32 absorb = 0; + uint32 resist = 0; + + handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); + + if (damage <= absorb + resist) + return true; + + damage -= absorb + resist; + + handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb); + handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); + handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); + return true; + } + + // non-melee damage + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellid = handler->extractSpellIdFromLink((char*)args); + if (!spellid || !sSpellMgr->GetSpellInfo(spellid)) + return false; + + handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage); + return true; + } + + static bool HandleCombatStopCommand(ChatHandler* handler, char const* args) + { + Player* target = NULL; + + if (args && strlen(args) > 0) + { + target = sObjectAccessor->FindPlayerByName(args); + if (!target) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + + if (!target) + { + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + } + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + target->CombatStop(); + target->getHostileRefManager().deleteReferences(); + return true; + } + + static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/) + { + sArenaTeamMgr->DistributeArenaPoints(); + return true; + } + + static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + // Repair items + target->DurabilityRepairAll(false, 0, false); + + handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str()); + if (handler->needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str()); + + return true; + } + + static bool HandleWaterwalkCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->getSelectedPlayer(); + if (!player) + { + handler->PSendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + // check online security + if (handler->HasLowerSecurity(player, 0)) + return false; + + if (strncmp(args, "on", 3) == 0) + player->SetMovement(MOVE_WATER_WALK); // ON + else if (strncmp(args, "off", 4) == 0) + player->SetMovement(MOVE_LAND_WALK); // OFF + else + { + handler->SendSysMessage(LANG_USE_BOL); + return false; + } + + handler->PSendSysMessage(LANG_YOU_SET_WATERWALK, args, handler->GetNameLink(player).c_str()); + if (handler->needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, handler->GetNameLink().c_str()); + return true; + } + + // Send mail by command + static bool HandleSendMailCommand(ChatHandler* handler, char const* args) + { + // format: name "subject text" "mail text" + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char const* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char const* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + //- TODO: Fix poor design + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + MailDraft(subject, text) + .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender); + + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(targetName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + // Send items by mail + static bool HandleSendItemsCommand(ChatHandler* handler, char const* args) + { + // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] + Player* receiver; + uint64 receiverGuid; + std::string receiverName; + if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char const* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char const* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // extract items + typedef std::pair ItemPair; + typedef std::list< ItemPair > ItemPairs; + ItemPairs items; + + // get all tail string + char* tail = strtok(NULL, ""); + + // get from tail next item str + while (char* itemStr = strtok(tail, " ")) + { + // and get new tail + tail = strtok(NULL, ""); + + // parse item str + char const* itemIdStr = strtok(itemStr, ":"); + char const* itemCountStr = strtok(NULL, " "); + + uint32 itemId = atoi(itemIdStr); + if (!itemId) + return false; + + ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId); + if (!item_proto) + { + handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1; + if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount))) + { + handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + while (itemCount > item_proto->GetMaxStackSize()) + { + items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize())); + itemCount -= item_proto->GetMaxStackSize(); + } + + items.push_back(ItemPair(itemId, itemCount)); + + if (items.size() > MAX_MAIL_ITEMS) + { + handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS); + handler->SetSentErrorMessage(true); + return false; + } + } + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + // fill mail + MailDraft draft(subject, text); + + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + + for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr) + { + if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0)) + { + item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted + draft.AddItem(item); + } + } + + draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(receiverName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + /// Send money by mail + static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args) + { + /// format: name "subject text" "mail text" money + + Player* receiver; + uint64 receiverGuid; + std::string receiverName; + if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + char* moneyStr = strtok(NULL, ""); + int32 money = moneyStr ? atoi(moneyStr) : 0; + if (money <= 0) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + + MailDraft(subject, text) + .AddMoney(money) + .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(receiverName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + /// Send a message to a player in game + static bool HandleSendMessageCommand(ChatHandler* handler, char const* args) + { + /// - Find the player + Player* player; + if (!handler->extractPlayerTarget((char*)args, &player)) + return false; + + char* msgStr = strtok(NULL, ""); + if (!msgStr) + return false; + + ///- Check that he is not logging out. + if (player->GetSession()->isLogingOut()) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + /// - Send the message + // Use SendAreaTriggerMessage for fastest delivery. + player->GetSession()->SendAreaTriggerMessage("%s", msgStr); + player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); + + // Confirmation message + std::string nameLink = handler->GetNameLink(player); + handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr); + + return true; + } + + static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + Creature* creatureTarget = handler->getSelectedCreature(); + + if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) + { + handler->PSendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry()); + // Creatures with family 0 crashes the server + if (!creatrueTemplate->family) + { + handler->PSendSysMessage("This creature cannot be tamed. (family id: 0)."); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->GetPetGUID()) + { + handler->PSendSysMessage("You already have a pet"); + handler->SetSentErrorMessage(true); + return false; + } + + // Everything looks OK, create new pet + Pet* pet = new Pet(player, HUNTER_PET); + if (!pet->CreateBaseAtCreature(creatureTarget)) + { + delete pet; + handler->PSendSysMessage("Error 1"); + return false; + } + + creatureTarget->setDeathState(JUST_DIED); + creatureTarget->RemoveCorpse(); + creatureTarget->SetHealth(0); // just for nice GM-mode view + + pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); + + if (!pet->InitStatsForLevel(creatureTarget->getLevel())) + { + sLog->outError("InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + handler->PSendSysMessage("Error 2"); + delete pet; + return false; + } + + // prepare visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1); + + pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true); + // this enables pet details window (Shift+P) + pet->InitPetCreateSpells(); + pet->SetFullHealth(); + + pet->GetMap()->AddToMap(pet->ToCreature()); + + // visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()); + + player->SetMinion(pet, true); + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + player->PetSpellInitialize(); + + return true; + } + + static bool HandlePetLearnCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->GetSession()->GetPlayer(); + Pet* pet = player->GetPet(); + + if (!pet) + { + handler->PSendSysMessage("You have no pet"); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) + return false; + + // Check if pet already has it + if (pet->HasSpell(spellId)) + { + handler->PSendSysMessage("Pet already has spell: %u", spellId); + handler->SetSentErrorMessage(true); + return false; + } + + // Check if spell is valid + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) + { + handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); + handler->SetSentErrorMessage(true); + return false; + } + + pet->learnSpell(spellId); + + handler->PSendSysMessage("Pet has learned spell %u", spellId); + return true; + } + + static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->GetSession()->GetPlayer(); + Pet* pet = player->GetPet(); + if (!pet) + { + handler->PSendSysMessage("You have no pet"); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (pet->HasSpell(spellId)) + pet->removeSpell(spellId, false); + else + handler->PSendSysMessage("Pet doesn't have that spell"); + + return true; + } + + static bool HandleFreezeCommand(ChatHandler* handler, char const* args) + { + std::string name; + Player* player; + char const* TargetName = strtok((char*)args, " "); // get entered name + if (!TargetName) // if no name entered use target + { + player = handler->getSelectedPlayer(); + if (player) //prevent crash with creature as target + { + name = player->GetName(); + normalizePlayerName(name); + } + } + else // if name entered + { + name = TargetName; + normalizePlayerName(name); + player = sObjectAccessor->FindPlayerByName(name.c_str()); + } + + if (!player) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + + if (player == handler->GetSession()->GetPlayer()) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR); + return true; + } + + // effect + if (player && (player != handler->GetSession()->GetPlayer())) + { + handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str()); + + // stop combat + make player unattackable + duel stop + stop some spells + player->setFaction(35); + player->CombatStop(); + if (player->IsNonMeleeSpellCasted(true)) + player->InterruptNonMeleeSpells(true); + player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + // if player class = hunter || warlock remove pet if alive + if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) + { + if (Pet* pet = player->GetPet()) + { + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + // not let dismiss dead pet + if (pet && pet->isAlive()) + player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); + } + } + + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454)) + Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player); + + // save player + player->SaveToDB(); + } + + return true; + } + + static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args) + { + std::string name; + Player* player; + char* targetName = strtok((char*)args, " "); // Get entered name + + if (targetName) + { + name = targetName; + normalizePlayerName(name); + player = sObjectAccessor->FindPlayerByName(name.c_str()); + } + else // If no name was entered - use target + { + player = handler->getSelectedPlayer(); + if (player) + name = player->GetName(); + } + + if (player) + { + handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); + + // Reset player faction + allow combat + allow duels + player->setFactionForRace(player->getRace()); + player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + // Remove Freeze spell (allowing movement and spells) + player->RemoveAurasDueToSpell(9454); + + // Save player + player->SaveToDB(); + } + else + { + if (targetName) + { + // Check for offline players + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME); + stmt->setString(0, name); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + + // If player found: delete his freeze aura + Field* fields = result->Fetch(); + uint32 lowGuid = fields[0].GetUInt32(); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); + stmt->setUInt32(0, lowGuid); + CharacterDatabase.Execute(stmt); + + handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); + return true; + } + else + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + } + + return true; + } + + static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/) + { + // Get names from DB + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) + { + handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); + return true; + } + + // Header of the names + handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE); + + // Output of the results + do + { + Field* fields = result->Fetch(); + std::string player = fields[0].GetString(); + handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str()); + } + while (result->NextRow()); + + return true; + } }; void AddSC_misc_commandscript() -- cgit v1.2.3 From d02a3966ea353c9c204c7d16ec0446c8ab1ec9fb Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 29 Jul 2012 13:36:28 +0200 Subject: Core/Command: Add missing part for pet command --- src/server/scripts/Commands/cs_misc.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 47b82fe302d..19688757836 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -90,6 +90,7 @@ public: { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL }, { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL }, { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable }, + { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL }, { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL }, { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL }, -- cgit v1.2.3 From 4a3df36bd9a72bdc519e2a366672a3ef638c5c0e Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 29 Jul 2012 12:29:36 +0200 Subject: Core/Commands: Convert more misc commands in commandscript --- src/server/game/Chat/Chat.cpp | 45 +--- src/server/game/Chat/Chat.h | 13 - src/server/game/Chat/Commands/Level3.cpp | 342 --------------------------- src/server/scripts/Commands/cs_character.cpp | 180 +++++++++++++- src/server/scripts/Commands/cs_lookup.cpp | 2 +- src/server/scripts/Commands/cs_misc.cpp | 128 +++++++++- 6 files changed, 308 insertions(+), 402 deletions(-) delete mode 100755 src/server/game/Chat/Commands/Level3.cpp (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 5211e4686ac..32a6273abd4 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -38,13 +38,6 @@ bool ChatHandler::load_command_table = true; -// wrapper for old-style handlers -template -bool OldHandler(ChatHandler* chatHandler, const char* args) -{ - return (chatHandler->*F)(args); -} - // get number of commands in table static size_t getCommandTableSize(const ChatCommand* commands) { @@ -67,35 +60,6 @@ static size_t appendCommandTable(ChatCommand* target, const ChatCommand* source) ChatCommand* ChatHandler::getCommandTable() { - - static ChatCommand groupCommandTable[] = - { - { "leader", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupLeaderCommand>, "", NULL }, - { "disband", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupDisbandCommand>, "", NULL }, - { "remove", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupRemoveCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand pdumpCommandTable[] = - { - { "load", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandlePDumpLoadCommand>, "", NULL }, - { "write", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandlePDumpWriteCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand commandTable[] = - { - { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, - { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, - - { "possess", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandlePossessCommand>, "", NULL }, - { "unpossess", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnPossessCommand>, "", NULL }, - { "bindsight", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleBindSightCommand>, "", NULL }, - { "unbindsight", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnbindSightCommand>, "", NULL }, - { "playall", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePlayAllCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - // cache for commands, needed because some commands are loaded dynamically through ScriptMgr // cache is never freed and will show as a memory leak in diagnostic tools // can't use vector as vector storage is implementation-dependent, eg, there can be alignment gaps between elements @@ -107,25 +71,23 @@ ChatCommand* ChatHandler::getCommandTable() { // count total number of top-level commands - size_t total = getCommandTableSize(commandTable); + size_t total = 0; std::vector const& dynamic = sScriptMgr->GetChatCommands(); for (std::vector::const_iterator it = dynamic.begin(); it != dynamic.end(); ++it) total += getCommandTableSize(*it); total += 1; // ending zero // cache top-level commands + size_t added = 0; commandTableCache = (ChatCommand*)malloc(sizeof(ChatCommand) * total); memset(commandTableCache, 0, sizeof(ChatCommand) * total); ACE_ASSERT(commandTableCache); - size_t added = appendCommandTable(commandTableCache, commandTable); for (std::vector::const_iterator it = dynamic.begin(); it != dynamic.end(); ++it) added += appendCommandTable(commandTableCache + added, *it); } PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_COMMANDS); - PreparedQueryResult result = WorldDatabase.Query(stmt); - if (result) { do @@ -135,7 +97,8 @@ ChatCommand* ChatHandler::getCommandTable() SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt8(), fields[2].GetString(), name); - } while (result->NextRow()); + } + while (result->NextRow()); } } diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 5a20f312ae1..269ebdd1d2f 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -131,19 +131,6 @@ class ChatHandler bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd); bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd); - bool HandlePossessCommand(const char* args); - bool HandleUnPossessCommand(const char* args); - bool HandleBindSightCommand(const char* args); - bool HandleUnbindSightCommand(const char* args); - - bool HandlePDumpLoadCommand(const char *args); - bool HandlePDumpWriteCommand(const char *args); - - bool HandleGroupLeaderCommand(const char* args); - bool HandleGroupDisbandCommand(const char* args); - bool HandleGroupRemoveCommand(const char* args); - - bool HandlePlayAllCommand(const char* args); private: WorldSession* m_session; // != NULL for chat command call and NULL for CLI command diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp deleted file mode 100755 index 41c92f36997..00000000000 --- a/src/server/game/Chat/Commands/Level3.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * 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 . - */ - -#include "Common.h" -#include "DatabaseEnv.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "World.h" -#include "ObjectMgr.h" -#include "ArenaTeamMgr.h" -#include "GuildMgr.h" -#include "AuctionHouseMgr.h" -#include "AccountMgr.h" -#include "PlayerDump.h" -#include "SpellMgr.h" -#include "Player.h" -#include "Opcodes.h" -#include "GameObject.h" -#include "Chat.h" -#include "Log.h" -#include "Guild.h" -#include "ObjectAccessor.h" -#include "MapManager.h" -#include "Language.h" -#include "GridNotifiersImpl.h" -#include "CellImpl.h" -#include "Weather.h" -#include "PointMovementGenerator.h" -#include "TargetedMovementGenerator.h" -#include "SkillDiscovery.h" -#include "SkillExtraItems.h" -#include "SystemConfig.h" -#include "Config.h" -#include "Util.h" -#include "ItemEnchantmentMgr.h" -#include "BattlegroundMgr.h" -#include "InstanceSaveMgr.h" -#include "InstanceScript.h" -#include "CreatureEventAIMgr.h" -#include "SpellAuraEffects.h" -#include "DBCEnums.h" -#include "ConditionMgr.h" -#include "DisableMgr.h" -#include "Transport.h" -#include "WeatherMgr.h" -#include "ScriptMgr.h" -#include "CreatureTextMgr.h" -#include "SmartAI.h" -#include "Group.h" -#include "ChannelMgr.h" - -bool ChatHandler::HandlePDumpLoadCommand(const char *args) -{ - if (!*args) - return false; - - char * file = strtok((char*)args, " "); - if (!file) - return false; - - char * account = strtok(NULL, " "); - if (!account) - return false; - - std::string account_name = account; - if (!AccountMgr::normalizeString(account_name)) - { - PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); - SetSentErrorMessage(true); - return false; - } - - uint32 account_id = AccountMgr::GetId(account_name); - if (!account_id) - { - account_id = atoi(account); // use original string - if (!account_id) - { - PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); - SetSentErrorMessage(true); - return false; - } - } - - if (!AccountMgr::GetName(account_id, account_name)) - { - PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); - SetSentErrorMessage(true); - return false; - } - - char* guid_str = NULL; - char* name_str = strtok(NULL, " "); - - std::string name; - if (name_str) - { - name = name_str; - // normalize the name if specified and check if it exists - if (!normalizePlayerName(name)) - { - PSendSysMessage(LANG_INVALID_CHARACTER_NAME); - SetSentErrorMessage(true); - return false; - } - - if (ObjectMgr::CheckPlayerName(name, true) != CHAR_NAME_SUCCESS) - { - PSendSysMessage(LANG_INVALID_CHARACTER_NAME); - SetSentErrorMessage(true); - return false; - } - - guid_str = strtok(NULL, " "); - } - - uint32 guid = 0; - - if (guid_str) - { - guid = atoi(guid_str); - if (!guid) - { - PSendSysMessage(LANG_INVALID_CHARACTER_GUID); - SetSentErrorMessage(true); - return false; - } - - if (sObjectMgr->GetPlayerAccountIdByGUID(guid)) - { - PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid); - SetSentErrorMessage(true); - return false; - } - } - - switch (PlayerDumpReader().LoadDump(file, account_id, name, guid)) - { - case DUMP_SUCCESS: - PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS); - break; - case DUMP_FILE_OPEN_ERROR: - PSendSysMessage(LANG_FILE_OPEN_FAIL, file); - SetSentErrorMessage(true); - return false; - case DUMP_FILE_BROKEN: - PSendSysMessage(LANG_DUMP_BROKEN, file); - SetSentErrorMessage(true); - return false; - case DUMP_TOO_MANY_CHARS: - PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account_name.c_str(), account_id); - SetSentErrorMessage(true); - return false; - default: - PSendSysMessage(LANG_COMMAND_IMPORT_FAILED); - SetSentErrorMessage(true); - return false; - } - - return true; -} - -bool ChatHandler::HandlePDumpWriteCommand(const char *args) -{ - if (!*args) - return false; - - char* file = strtok((char*)args, " "); - char* p2 = strtok(NULL, " "); - - if (!file || !p2) - return false; - - uint64 guid; - // character name can't start from number - if (isNumeric(p2)) - guid = MAKE_NEW_GUID(atoi(p2), 0, HIGHGUID_PLAYER); - else - { - std::string name = extractPlayerNameFromLink(p2); - if (name.empty()) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - guid = sObjectMgr->GetPlayerGUIDByName(name); - } - - if (!sObjectMgr->GetPlayerAccountIdByGUID(guid)) - { - PSendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - switch (PlayerDumpWriter().WriteDump(file, uint32(guid))) - { - case DUMP_SUCCESS: - PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS); - break; - case DUMP_FILE_OPEN_ERROR: - PSendSysMessage(LANG_FILE_OPEN_FAIL, file); - SetSentErrorMessage(true); - return false; - case DUMP_CHARACTER_DELETED: - PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR); - SetSentErrorMessage(true); - return false; - default: - PSendSysMessage(LANG_COMMAND_EXPORT_FAILED); - SetSentErrorMessage(true); - return false; - } - - return true; -} - -bool ChatHandler::HandlePlayAllCommand(const char *args) -{ - if (!*args) - return false; - - uint32 soundId = atoi((char*)args); - - if (!sSoundEntriesStore.LookupEntry(soundId)) - { - PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); - SetSentErrorMessage(true); - return false; - } - - WorldPacket data(SMSG_PLAY_SOUND, 4); - data << uint32(soundId) << m_session->GetPlayer()->GetGUID(); - sWorld->SendGlobalMessage(&data); - - PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); - return true; -} - -bool ChatHandler::HandleGroupLeaderCommand(const char *args) -{ - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* cname = strtok((char*)args, " "); - - if (GetPlayerGroupAndGUIDByName(cname, player, group, guid)) - if (group && group->GetLeaderGUID() != guid) - { - group->ChangeLeader(guid); - group->SendUpdate(); - } - - return true; -} - -bool ChatHandler::HandleGroupDisbandCommand(const char *args) -{ - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* cname = strtok((char*)args, " "); - - if (GetPlayerGroupAndGUIDByName(cname, player, group, guid)) - if (group) - group->Disband(); - - return true; -} - -bool ChatHandler::HandleGroupRemoveCommand(const char *args) -{ - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* cname = strtok((char*)args, " "); - - if (GetPlayerGroupAndGUIDByName(cname, player, group, guid, true)) - if (group) - group->RemoveMember(guid); - - return true; -} - -bool ChatHandler::HandlePossessCommand(const char * /*args*/) -{ - Unit* unit = getSelectedUnit(); - if (!unit) - return false; - - m_session->GetPlayer()->CastSpell(unit, 530, true); - return true; -} - -bool ChatHandler::HandleUnPossessCommand(const char * /*args*/) -{ - Unit* unit = getSelectedUnit(); - if (!unit) - unit = m_session->GetPlayer(); - - unit->RemoveCharmAuras(); - - return true; -} - -bool ChatHandler::HandleBindSightCommand(const char * /*args*/) -{ - Unit* unit = getSelectedUnit(); - if (!unit) - return false; - - m_session->GetPlayer()->CastSpell(unit, 6277, true); - return true; -} - -bool ChatHandler::HandleUnbindSightCommand(const char * /*args*/) -{ - Player* player = m_session->GetPlayer(); - - if (player->isPossessing()) - return false; - - player->StopCastingBindSight(); - return true; -} diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index a54ac96b5e2..0aeee8f96fc 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "Chat.h" #include "AccountMgr.h" #include "ObjectMgr.h" +#include "PlayerDump.h" class character_commandscript : public CommandScript { @@ -34,6 +35,12 @@ public: ChatCommand* GetCommands() const { + static ChatCommand pdumpCommandTable[] = + { + { "load", SEC_ADMINISTRATOR, true, &HandlePDumpLoadCommand, "", NULL }, + { "write", SEC_ADMINISTRATOR, true, &HandlePDumpWriteCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand characterDeletedCommandTable[] = { { "delete", SEC_CONSOLE, true, &HandleCharacterDeletedDeleteCommand, "", NULL }, @@ -48,7 +55,7 @@ public: { "customize", SEC_GAMEMASTER, true, &HandleCharacterCustomizeCommand, "", NULL }, { "changefaction", SEC_GAMEMASTER, true, &HandleCharacterChangeFactionCommand, "", NULL }, { "changerace", SEC_GAMEMASTER, true, &HandleCharacterChangeRaceCommand, "", NULL }, - { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable}, + { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable }, { "erase", SEC_CONSOLE, true, &HandleCharacterEraseCommand, "", NULL }, { "level", SEC_ADMINISTRATOR, true, &HandleCharacterLevelCommand, "", NULL }, { "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "", NULL }, @@ -59,8 +66,9 @@ public: static ChatCommand commandTable[] = { - { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable}, + { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable }, { "levelup", SEC_ADMINISTRATOR, false, &HandleLevelUpCommand, "", NULL }, + { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { NULL, 0, false, NULL, "", NULL } }; return commandTable; @@ -740,6 +748,174 @@ public: return true; } + + static bool HandlePDumpLoadCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* fileStr = strtok((char*)args, " "); + if (!fileStr) + return false; + + char* accountStr = strtok(NULL, " "); + if (!accountStr) + return false; + + std::string accountName = accountStr; + if (!AccountMgr::normalizeString(accountName)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 accountId = AccountMgr::GetId(accountName); + if (!accountId) + { + accountId = atoi(accountStr); // use original string + if (!accountId) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + if (!AccountMgr::GetName(accountId, accountName)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + char* guidStr = NULL; + char* nameStr = strtok(NULL, " "); + + std::string name; + if (nameStr) + { + name = nameStr; + // normalize the name if specified and check if it exists + if (!normalizePlayerName(name)) + { + handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME); + handler->SetSentErrorMessage(true); + return false; + } + + if (ObjectMgr::CheckPlayerName(name, true) != CHAR_NAME_SUCCESS) + { + handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME); + handler->SetSentErrorMessage(true); + return false; + } + + guidStr = strtok(NULL, " "); + } + + uint32 guid = 0; + + if (guidStr) + { + guid = uint32(atoi(guidStr)); + if (!guid) + { + handler->PSendSysMessage(LANG_INVALID_CHARACTER_GUID); + handler->SetSentErrorMessage(true); + return false; + } + + if (sObjectMgr->GetPlayerAccountIdByGUID(guid)) + { + handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid); + handler->SetSentErrorMessage(true); + return false; + } + } + + switch (PlayerDumpReader().LoadDump(fileStr, accountId, name, guid)) + { + case DUMP_SUCCESS: + handler->PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS); + break; + case DUMP_FILE_OPEN_ERROR: + handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileStr); + handler->SetSentErrorMessage(true); + return false; + case DUMP_FILE_BROKEN: + handler->PSendSysMessage(LANG_DUMP_BROKEN, fileStr); + handler->SetSentErrorMessage(true); + return false; + case DUMP_TOO_MANY_CHARS: + handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName.c_str(), accountId); + handler->SetSentErrorMessage(true); + return false; + default: + handler->PSendSysMessage(LANG_COMMAND_IMPORT_FAILED); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + static bool HandlePDumpWriteCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* fileStr = strtok((char*)args, " "); + char* playerStr = strtok(NULL, " "); + + if (!fileStr || !playerStr) + return false; + + uint64 guid; + // character name can't start from number + if (isNumeric(playerStr)) + guid = MAKE_NEW_GUID(atoi(playerStr), 0, HIGHGUID_PLAYER); + else + { + std::string name = handler->extractPlayerNameFromLink(playerStr); + if (name.empty()) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + guid = sObjectMgr->GetPlayerGUIDByName(name); + } + + if (!sObjectMgr->GetPlayerAccountIdByGUID(guid)) + { + handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + switch (PlayerDumpWriter().WriteDump(fileStr, uint32(guid))) + { + case DUMP_SUCCESS: + handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS); + break; + case DUMP_FILE_OPEN_ERROR: + handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileStr); + handler->SetSentErrorMessage(true); + return false; + case DUMP_CHARACTER_DELETED: + handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR); + handler->SetSentErrorMessage(true); + return false; + default: + handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } }; void AddSC_character_commandscript() diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 0e814034434..e7dba97ac45 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1156,7 +1156,7 @@ public: return true; } - static bool HandleLookupMapCommand(ChatHandler* handler, char const* args) + static bool HandleLookupMapCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) return false; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 19688757836..f8ad3f7c37e 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -37,11 +37,18 @@ public: ChatCommand* GetCommands() const { + static ChatCommand groupCommandTable[] = + { + { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL }, + { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL }, + { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand petCommandTable[] = { - { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL }, - { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL }, - { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL }, + { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL }, + { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL }, + { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand sendCommandTable[] = @@ -103,6 +110,12 @@ public: { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL }, { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL }, { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL }, + { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, + { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL }, + { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL }, + { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL }, + { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL }, + { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; return commandTable; @@ -2749,6 +2762,115 @@ public: return true; } + + static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) + if (group && group->GetLeaderGUID() != guid) + { + group->ChangeLeader(guid); + group->SendUpdate(); + } + + return true; + } + + static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) + if (group) + group->Disband(); + + return true; + } + + static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true)) + if (group) + group->RemoveMember(guid); + + return true; + } + + static bool HandlePlayAllCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 soundId = atoi((char*)args); + + if (!sSoundEntriesStore.LookupEntry(soundId)) + { + handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); + handler->SetSentErrorMessage(true); + return false; + } + + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID(); + sWorld->SendGlobalMessage(&data); + + handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); + return true; + } + + static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + return false; + + handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true); + return true; + } + + static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + unit = handler->GetSession()->GetPlayer(); + + unit->RemoveCharmAuras(); + + return true; + } + + static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + return false; + + handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true); + return true; + } + + static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + if (player->isPossessing()) + return false; + + player->StopCastingBindSight(); + return true; + } }; void AddSC_misc_commandscript() -- cgit v1.2.3 From 634b3645d5f2a0752bc389adfd98f56f84cfd838 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 29 Jul 2012 21:40:10 +0200 Subject: Core/Misc: Use proper headers to optimize compile --- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 6 +++++- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 2 +- src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 2 +- src/server/game/AI/SmartScripts/SmartAI.cpp | 3 +-- src/server/game/DungeonFinding/LFGScripts.cpp | 3 ++- src/server/game/DungeonFinding/LFGScripts.h | 2 +- src/server/game/Scripting/ScriptMgr.cpp | 5 ++++- src/server/game/Scripting/ScriptSystem.cpp | 2 +- src/server/game/Scripting/ScriptSystem.h | 1 + .../scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp | 3 ++- .../scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp | 3 ++- .../scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp | 3 ++- .../scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp | 3 ++- .../scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp | 3 ++- .../EasternKingdoms/BlackrockDepths/blackrock_depths.cpp | 4 +++- .../BlackrockDepths/boss_ambassador_flamelash.cpp | 3 ++- .../EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp | 3 ++- .../BlackrockDepths/boss_emperor_dagran_thaurissan.cpp | 3 ++- .../BlackrockDepths/boss_general_angerforge.cpp | 3 ++- .../BlackrockDepths/boss_gorosh_the_dervish.cpp | 3 ++- .../scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp | 3 ++- .../BlackrockDepths/boss_high_interrogator_gerstahn.cpp | 3 ++- .../scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp | 3 ++- .../BlackrockDepths/boss_moira_bronzebeard.cpp | 3 ++- .../EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp | 4 +++- .../BlackrockDepths/instance_blackrock_depths.cpp | 4 +++- .../BlackwingLair/boss_broodlord_lashlayer.cpp | 4 +++- .../EasternKingdoms/BlackwingLair/boss_chromaggus.cpp | 3 ++- .../scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp | 3 ++- .../scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp | 3 ++- .../scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp | 3 ++- .../scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp | 3 ++- .../scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp | 3 ++- .../EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp | 4 +++- .../EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp | 4 +++- .../BlackwingLair/instance_blackwing_lair.cpp | 3 ++- .../scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp | 3 ++- src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp | 3 ++- .../scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp | 3 ++- src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp | 4 +++- .../EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp | 3 ++- src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp | 3 ++- .../EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp | 3 ++- .../scripts/EasternKingdoms/Karazhan/boss_midnight.cpp | 3 ++- src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp | 3 ++- .../scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp | 3 ++- .../scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp | 3 ++- .../EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp | 3 ++- .../scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp | 3 ++- .../EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp | 4 +++- src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp | 4 +++- .../scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp | 3 ++- src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp | 4 +++- .../MagistersTerrace/boss_felblood_kaelthas.cpp | 3 ++- .../MagistersTerrace/boss_priestess_delrissa.cpp | 3 ++- .../MagistersTerrace/boss_selin_fireheart.cpp | 3 ++- .../EasternKingdoms/MagistersTerrace/boss_vexallus.cpp | 3 ++- .../MagistersTerrace/instance_magisters_terrace.cpp | 3 ++- .../EasternKingdoms/MagistersTerrace/magisters_terrace.cpp | 4 +++- .../scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp | 3 ++- .../scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp | 6 +++++- .../scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp | 3 ++- .../scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp | 4 +++- .../EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp | 4 +++- .../EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp | 3 ++- .../ScarletMonastery/boss_azshir_the_sleepless.cpp | 3 ++- .../ScarletMonastery/boss_bloodmage_thalnos.cpp | 3 ++- .../ScarletMonastery/boss_headless_horseman.cpp | 3 ++- .../scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp | 3 ++- .../ScarletMonastery/boss_high_inquisitor_fairbanks.cpp | 3 ++- .../ScarletMonastery/boss_houndmaster_loksey.cpp | 3 ++- .../ScarletMonastery/boss_interrogator_vishas.cpp | 3 ++- .../ScarletMonastery/boss_mograine_and_whitemane.cpp | 3 ++- .../scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp | 3 ++- .../ScarletMonastery/instance_scarlet_monastery.cpp | 3 ++- .../EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp | 3 ++- .../Scholomance/boss_death_knight_darkreaver.cpp | 3 ++- .../Scholomance/boss_doctor_theolen_krastinov.cpp | 3 ++- .../EasternKingdoms/Scholomance/boss_illucia_barov.cpp | 3 ++- .../EasternKingdoms/Scholomance/boss_instructor_malicia.cpp | 3 ++- .../EasternKingdoms/Scholomance/boss_jandice_barov.cpp | 3 ++- .../scripts/EasternKingdoms/Scholomance/boss_kormok.cpp | 3 ++- .../EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp | 3 ++- .../EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp | 3 ++- .../EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp | 3 ++- .../EasternKingdoms/Scholomance/boss_the_ravenian.cpp | 3 ++- .../scripts/EasternKingdoms/Scholomance/boss_vectus.cpp | 3 ++- .../EasternKingdoms/Scholomance/instance_scholomance.cpp | 3 ++- .../ShadowfangKeep/instance_shadowfang_keep.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_baron_rivendare.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_baroness_anastari.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp | 3 ++- .../scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_postmaster_malown.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp | 3 ++- .../EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp | 3 ++- .../EasternKingdoms/Stratholme/instance_stratholme.cpp | 4 +++- src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp | 3 ++- .../EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp | 3 ++- .../scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp | 3 ++- .../EasternKingdoms/SunwellPlateau/boss_brutallus.cpp | 3 ++- .../EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp | 3 ++- .../scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp | 7 ++++++- .../scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp | 3 ++- .../EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp | 3 ++- .../scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp | 3 ++- .../SunwellPlateau/instance_sunwell_plateau.cpp | 3 ++- .../EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp | 3 ++- .../scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp | 3 ++- src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp | 3 ++- .../scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp | 3 ++- src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp | 7 ++++++- src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp | 3 ++- .../scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp | 4 +++- src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp | 3 ++- .../scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp | 3 ++- .../scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp | 3 ++- .../scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp | 3 ++- .../scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp | 3 ++- src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp | 3 ++- .../scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp | 3 ++- .../scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp | 3 ++- src/server/scripts/EasternKingdoms/alterac_mountains.cpp | 3 ++- src/server/scripts/EasternKingdoms/arathi_highlands.cpp | 3 ++- src/server/scripts/EasternKingdoms/blasted_lands.cpp | 4 +++- src/server/scripts/EasternKingdoms/boss_kruul.cpp | 3 ++- src/server/scripts/EasternKingdoms/burning_steppes.cpp | 4 +++- src/server/scripts/EasternKingdoms/duskwood.cpp | 3 ++- src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp | 4 +++- src/server/scripts/EasternKingdoms/eversong_woods.cpp | 4 +++- src/server/scripts/EasternKingdoms/ghostlands.cpp | 4 +++- src/server/scripts/EasternKingdoms/hinterlands.cpp | 3 ++- src/server/scripts/EasternKingdoms/ironforge.cpp | 4 +++- src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp | 3 ++- src/server/scripts/EasternKingdoms/loch_modan.cpp | 4 +++- src/server/scripts/EasternKingdoms/redridge_mountains.cpp | 3 ++- src/server/scripts/EasternKingdoms/silvermoon_city.cpp | 3 ++- src/server/scripts/EasternKingdoms/silverpine_forest.cpp | 3 ++- src/server/scripts/EasternKingdoms/stormwind_city.cpp | 4 +++- src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp | 3 ++- src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp | 3 ++- src/server/scripts/EasternKingdoms/tirisfal_glades.cpp | 3 ++- src/server/scripts/EasternKingdoms/undercity.cpp | 4 +++- src/server/scripts/EasternKingdoms/western_plaguelands.cpp | 4 +++- src/server/scripts/EasternKingdoms/westfall.cpp | 3 ++- src/server/scripts/EasternKingdoms/wetlands.cpp | 3 ++- src/server/scripts/Examples/example_commandscript.cpp | 2 +- src/server/scripts/Examples/example_creature.cpp | 4 +++- src/server/scripts/Examples/example_escort.cpp | 4 +++- src/server/scripts/Examples/example_gossip_codebox.cpp | 4 +++- src/server/scripts/Examples/example_misc.cpp | 1 - src/server/scripts/Examples/example_spell.cpp | 3 ++- .../CavernsOfTime/CullingOfStratholme/boss_epoch.cpp | 3 ++- .../CavernsOfTime/CullingOfStratholme/boss_infinite.cpp | 3 ++- .../CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp | 3 ++- .../CavernsOfTime/CullingOfStratholme/boss_meathook.cpp | 3 ++- .../CavernsOfTime/CullingOfStratholme/boss_salramm.cpp | 3 ++- .../CullingOfStratholme/culling_of_stratholme.cpp | 5 ++++- .../CullingOfStratholme/instance_culling_of_stratholme.cpp | 3 ++- .../Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp | 3 ++- .../CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp | 3 ++- .../Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp | 3 ++- .../Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp | 4 +++- .../CavernsOfTime/DarkPortal/instance_dark_portal.cpp | 3 ++- .../EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp | 3 ++- .../EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp | 3 ++- .../EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp | 3 ++- .../EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp | 4 +++- .../CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp | 4 +++- .../scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp | 1 + .../Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp | 3 ++- .../Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp | 3 ++- src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp | 4 +++- .../Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp | 3 ++- src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp | 3 ++- src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp | 3 ++- src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp | 3 ++- .../scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp | 3 ++- .../Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp | 3 ++- .../scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp | 3 ++- src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp | 3 ++- .../scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp | 3 ++- .../scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp | 3 ++- src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp | 3 ++- .../scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp | 3 ++- src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp | 3 ++- .../scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp | 3 ++- .../scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp | 3 ++- .../TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp | 3 ++- .../Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp | 3 ++- .../Kalimdor/WailingCaverns/instance_wailing_caverns.cpp | 3 ++- .../scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp | 4 +++- src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp | 3 ++- src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp | 4 +++- .../scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp | 3 ++- .../Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp | 3 ++- .../Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp | 3 ++- .../AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp | 3 ++- .../Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp | 3 ++- .../Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp | 4 +++- .../Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp | 3 ++- .../Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp | 3 ++- .../AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp | 3 ++- .../Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp | 3 ++- .../ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp | 7 ++++++- .../ObsidianSanctum/instance_obsidian_sanctum.cpp | 3 ++- .../ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp | 3 ++- .../ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp | 3 ++- .../ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp | 3 ++- .../Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp | 4 +++- .../TrialOfTheChampion/boss_argent_challenge.cpp | 4 +++- .../TrialOfTheChampion/boss_black_knight.cpp | 3 ++- .../TrialOfTheChampion/boss_grand_champions.cpp | 3 ++- .../TrialOfTheChampion/instance_trial_of_the_champion.cpp | 4 +++- .../TrialOfTheChampion/trial_of_the_champion.cpp | 4 +++- .../TrialOfTheCrusader/boss_anubarak_trial.cpp | 3 ++- .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 3 ++- .../TrialOfTheCrusader/boss_northrend_beasts.cpp | 3 ++- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 10 +++++++++- .../TrialOfTheCrusader/instance_trial_of_the_crusader.cpp | 3 ++- .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 4 +++- src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp | 3 ++- src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp | 3 ++- .../scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp | 3 ++- .../scripts/Northrend/DraktharonKeep/boss_trollgore.cpp | 4 +++- .../Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp | 3 ++- .../Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp | 4 +++- .../FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp | 3 ++- .../Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp | 4 +++- .../FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp | 3 ++- .../Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp | 3 ++- .../Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp | 3 ++- .../FrozenHalls/HallsOfReflection/halls_of_reflection.cpp | 4 +++- .../HallsOfReflection/instance_halls_of_reflection.cpp | 4 +++- .../FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp | 5 ++++- .../Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp | 5 ++++- .../FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp | 5 ++++- .../FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp | 3 ++- .../Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp | 5 ++++- .../scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp | 3 ++- src/server/scripts/Northrend/Gundrak/boss_eck.cpp | 3 ++- src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp | 3 ++- src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp | 3 ++- src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp | 4 +++- src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp | 3 ++- src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp | 3 ++- src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp | 3 ++- src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp | 3 ++- src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp | 3 ++- src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp | 4 +++- src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp | 5 ++++- src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp | 5 ++++- src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp | 4 +++- src/server/scripts/Northrend/Naxxramas/boss_noth.cpp | 3 ++- src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp | 3 ++- src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp | 3 ++- src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp | 3 ++- .../scripts/Northrend/Naxxramas/instance_naxxramas.cpp | 4 +++- .../scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp | 6 +++++- .../Nexus/EyeOfEternity/instance_eye_of_eternity.cpp | 4 +++- src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp | 3 ++- .../scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp | 5 ++++- .../scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp | 3 ++- src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp | 3 ++- .../scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp | 3 ++- .../scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp | 3 ++- src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp | 3 ++- src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp | 3 ++- src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp | 5 ++++- src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp | 3 ++- src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp | 5 ++++- .../scripts/Northrend/Nexus/Oculus/instance_oculus.cpp | 4 +++- src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp | 6 +++++- .../Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp | 3 ++- .../scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp | 3 ++- .../Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp | 3 ++- .../Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp | 3 ++- .../Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp | 3 ++- .../scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp | 3 ++- .../scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp | 4 +++- .../Ulduar/HallsOfStone/instance_halls_of_stone.cpp | 3 ++- .../UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp | 3 ++- .../Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp | 5 ++++- .../UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp | 3 ++- .../UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp | 3 ++- .../Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp | 3 ++- .../Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp | 3 ++- .../Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp | 3 ++- .../Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp | 5 ++++- .../Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp | 3 ++- .../UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp | 3 ++- .../scripts/Northrend/VaultOfArchavon/boss_archavon.cpp | 3 ++- src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp | 4 +++- .../scripts/Northrend/VaultOfArchavon/boss_koralon.cpp | 3 ++- .../scripts/Northrend/VaultOfArchavon/boss_toravon.cpp | 3 ++- .../Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp | 3 ++- src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp | 3 ++- src/server/scripts/Northrend/VioletHold/boss_erekem.cpp | 3 ++- src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp | 3 ++- src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp | 3 ++- src/server/scripts/Northrend/VioletHold/boss_moragg.cpp | 3 ++- src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp | 3 ++- src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp | 3 ++- .../scripts/Northrend/VioletHold/instance_violet_hold.cpp | 3 ++- src/server/scripts/Northrend/VioletHold/violet_hold.cpp | 4 +++- src/server/scripts/Northrend/borean_tundra.cpp | 4 +++- src/server/scripts/Northrend/crystalsong_forest.cpp | 3 ++- src/server/scripts/Northrend/dalaran.cpp | 4 +++- src/server/scripts/Northrend/dragonblight.cpp | 6 +++++- src/server/scripts/Northrend/grizzly_hills.cpp | 3 ++- src/server/scripts/Northrend/howling_fjord.cpp | 4 +++- src/server/scripts/Northrend/icecrown.cpp | 5 ++++- src/server/scripts/Northrend/isle_of_conquest.cpp | 4 +++- src/server/scripts/Northrend/sholazar_basin.cpp | 5 ++++- src/server/scripts/Northrend/storm_peaks.cpp | 4 +++- src/server/scripts/Northrend/zuldrak.cpp | 4 +++- src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp | 2 +- src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp | 2 +- src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp | 2 +- src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp | 2 +- src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp | 2 +- src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp | 2 +- .../Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp | 3 ++- .../AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp | 3 ++- .../Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp | 3 ++- .../Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp | 3 ++- .../Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp | 3 ++- .../Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp | 3 ++- .../Auchindoun/SethekkHalls/instance_sethekk_halls.cpp | 3 ++- .../Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp | 3 ++- .../ShadowLabyrinth/boss_blackheart_the_inciter.cpp | 3 ++- .../Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp | 3 ++- .../Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp | 3 ++- .../Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp | 3 ++- src/server/scripts/Outland/BlackTemple/black_temple.cpp | 4 +++- src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp | 3 ++- src/server/scripts/Outland/BlackTemple/boss_illidan.cpp | 5 ++++- .../scripts/Outland/BlackTemple/boss_mother_shahraz.cpp | 3 ++- .../scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp | 3 ++- .../scripts/Outland/BlackTemple/boss_shade_of_akama.cpp | 4 +++- src/server/scripts/Outland/BlackTemple/boss_supremus.cpp | 4 +++- .../scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp | 3 ++- .../scripts/Outland/BlackTemple/boss_warlord_najentus.cpp | 3 ++- src/server/scripts/Outland/BlackTemple/illidari_council.cpp | 5 ++++- .../scripts/Outland/BlackTemple/instance_black_temple.cpp | 3 ++- .../SerpentShrine/boss_fathomlord_karathress.cpp | 3 ++- .../SerpentShrine/boss_hydross_the_unstable.cpp | 3 ++- .../CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp | 3 ++- .../SerpentShrine/boss_leotheras_the_blind.cpp | 3 ++- .../CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp | 3 ++- .../SerpentShrine/boss_morogrim_tidewalker.cpp | 3 ++- .../SerpentShrine/instance_serpent_shrine.cpp | 3 ++- .../SteamVault/boss_hydromancer_thespia.cpp | 3 ++- .../SteamVault/boss_mekgineer_steamrigger.cpp | 3 ++- .../CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp | 3 ++- .../CoilfangReservoir/SteamVault/instance_steam_vault.cpp | 3 ++- .../Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp | 3 ++- .../CoilfangReservoir/underbog/boss_the_black_stalker.cpp | 3 ++- .../scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp | 3 ++- .../scripts/Outland/GruulsLair/instance_gruuls_lair.cpp | 3 ++- .../Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp | 3 ++- .../BloodFurnace/boss_kelidan_the_breaker.cpp | 4 +++- .../Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp | 3 ++- .../HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp | 3 ++- .../HellfireRamparts/boss_omor_the_unscarred.cpp | 3 ++- .../HellfireRamparts/boss_vazruden_the_herald.cpp | 3 ++- .../HellfireRamparts/boss_watchkeeper_gargolmar.cpp | 3 ++- .../HellfireRamparts/instance_hellfire_ramparts.cpp | 3 ++- .../HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp | 3 ++- .../MagtheridonsLair/instance_magtheridons_lair.cpp | 4 +++- .../HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp | 3 ++- .../ShatteredHalls/boss_warbringer_omrogg.cpp | 3 ++- .../ShatteredHalls/boss_warchief_kargath_bladefist.cpp | 3 ++- .../ShatteredHalls/instance_shattered_halls.cpp | 3 ++- src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp | 3 ++- src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp | 3 ++- .../scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp | 3 ++- .../scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp | 3 ++- src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp | 3 ++- .../TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp | 3 ++- .../TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp | 3 ++- .../TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp | 1 + .../TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp | 3 ++- .../TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp | 3 ++- .../Outland/TempestKeep/Mechanar/instance_mechanar.cpp | 3 ++- src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp | 3 ++- .../Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp | 3 ++- .../Outland/TempestKeep/arcatraz/instance_arcatraz.cpp | 3 ++- .../TempestKeep/botanica/boss_high_botanist_freywinn.cpp | 3 ++- src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp | 3 ++- .../Outland/TempestKeep/botanica/boss_warp_splinter.cpp | 3 ++- src/server/scripts/Outland/blades_edge_mountains.cpp | 8 +++++++- src/server/scripts/Outland/boss_doomwalker.cpp | 3 ++- src/server/scripts/Outland/hellfire_peninsula.cpp | 4 +++- src/server/scripts/Outland/nagrand.cpp | 5 +++-- src/server/scripts/Outland/netherstorm.cpp | 4 +++- src/server/scripts/Outland/shadowmoon_valley.cpp | 4 +++- src/server/scripts/Outland/shattrath_city.cpp | 4 +++- src/server/scripts/Outland/terokkar_forest.cpp | 4 +++- src/server/scripts/Outland/zangarmarsh.cpp | 4 +++- src/server/scripts/Spells/spell_holiday.cpp | 6 +++++- src/server/scripts/World/areatrigger_scripts.cpp | 3 ++- src/server/scripts/World/chat_log.cpp | 2 +- src/server/scripts/World/go_scripts.cpp | 4 +++- src/server/scripts/World/guards.cpp | 3 ++- src/server/scripts/World/item_scripts.cpp | 3 ++- src/server/scripts/World/mob_generic_creature.cpp | 4 +++- src/server/scripts/World/npc_innkeeper.cpp | 5 ++++- src/server/scripts/World/npc_professions.cpp | 4 +++- src/server/scripts/World/npc_taxi.cpp | 4 +++- src/server/scripts/World/npcs_special.cpp | 12 +++++++++++- 425 files changed, 995 insertions(+), 424 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 6d27d251579..a5f957c352c 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -5,9 +5,13 @@ * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ -#include "ScriptPCH.h" +#include "ScriptedCreature.h" #include "Item.h" #include "Spell.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" #include "ObjectMgr.h" #include "TemporarySummon.h" diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index c7751fc7383..d6da6a91bf1 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -9,7 +9,7 @@ SDComment: SDCategory: Npc EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "Group.h" diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 987af82e496..4a71184442d 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -9,7 +9,7 @@ SDComment: This AI is under development SDCategory: Npc EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptedCreature.h" #include "ScriptedFollowerAI.h" #include "Group.h" diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 96fc43e0572..629998e3579 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -27,9 +27,8 @@ #include "InstanceScript.h" #include "ScriptedCreature.h" #include "Group.h" - #include "SmartAI.h" -#include "ScriptPCH.h" +#include "ScriptMgr.h" SmartAI::SmartAI(Creature* c) : CreatureAI(c) { diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 1fa7fe0ca9f..e4b67e22221 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -23,9 +23,10 @@ #include "SharedDefines.h" #include "Player.h" #include "Group.h" -#include "ScriptPCH.h" #include "LFGScripts.h" #include "LFGMgr.h" +#include "ScriptMgr.h" +#include "ObjectAccessor.h" LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript") { diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h index 4b332c7d731..ac1f66abbda 100644 --- a/src/server/game/DungeonFinding/LFGScripts.h +++ b/src/server/game/DungeonFinding/LFGScripts.h @@ -21,7 +21,7 @@ #include "Common.h" #include "SharedDefines.h" -#include "ScriptPCH.h" +#include "ScriptMgr.h" class Player; class Group; diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 23d18e12097..b6381594145 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" #include "ScriptMgr.h" #include "Config.h" #include "DatabaseEnv.h" @@ -27,6 +26,10 @@ #include "ScriptSystem.h" #include "Transport.h" #include "Vehicle.h" +#include "SpellInfo.h" +#include "SpellScript.h" +#include "GossipDef.h" +#include "CreatureAI.h" // This is the global static registry of scripts. template diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index c38d559372f..fb954662525 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -16,10 +16,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" #include "ScriptSystem.h" #include "ObjectMgr.h" #include "DatabaseEnv.h" +#include "ScriptMgr.h" ScriptPointVector const SystemMgr::_empty; diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index cf6332b22f2..4211a63b043 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -5,6 +5,7 @@ #ifndef SC_SYSTEM_H #define SC_SYSTEM_H +#include "ScriptMgr.h" #include #define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp index 75dd99eef97..b2b4083f9c6 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 93de16fc80b..e776194652d 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp index 8b2a95be977..47091c162d9 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp index da53cffc99d..0c1eb6e6d30 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp index 3960351d395..fdb6a5da320 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Yells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 9375cc33f27..27c90d3b45c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -15,8 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" #include "blackrock_depths.h" //go_shadowforge_brazier diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp index ff0f1a4cedd..b2031ef0658 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp index 2585796e28e..a07e9059b70 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp index 073c4fde82a..204fa3177e7 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blackrock_depths.h" enum Yells diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp index 703f684cc9f..15882b30ed2 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp index b2c93d949c2..055f1eebbac 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp index 63d945ade90..40f8b2507e3 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp index f4f245be4be..b6be72d71e0 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp index 3d2cc627145..c1e00796433 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp index e6f65ab4252..6f665e9efc7 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp index 211930e4f1a..347aff2ce0b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp @@ -16,7 +16,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "blackrock_depths.h" enum Spells diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp index 03cb077936b..91cd5d2b9a5 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp @@ -16,7 +16,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "blackrock_depths.h" #define TIMER_TOMBOFTHESEVEN 15000 diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index af0dfd38ae8..ceca6330152 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -23,7 +23,9 @@ SDComment: SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" + enum Say { SAY_AGGRO = -1469000, diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp index a3eb0cea5ad..204fbe5223b 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp @@ -23,7 +23,8 @@ SDComment: Chromatic Mutation disabled due to lack of core support SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Emotes { diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp index c91e0fb3303..962e65fb8b0 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp @@ -23,7 +23,8 @@ SDComment: Shadow of Ebonroc needs core support SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 18500 diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp index c2a2350c0e8..4d5f9b214db 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 23339 diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp index 41bcb6c5427..e84ccd0e160 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Emotes { diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp index 5d4cc442a49..787fbe5312b 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp @@ -23,7 +23,8 @@ SDComment: Some issues with class calls effecting more than one class SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Say { diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp index 24fc74cc7cb..04eca3586cc 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp @@ -23,7 +23,8 @@ SDComment: Needs additional review. Phase 1 NYI (Grethok the Controller) SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" //Razorgore Phase 2 Script diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp index eaa8c118f19..8cc42baff8e 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp @@ -23,7 +23,9 @@ SDComment: Burning Adrenaline not correctly implemented in core SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" enum Says { diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp index 668b84d38dd..c7e8a5ea771 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -23,7 +23,9 @@ SDComment: Missing some text, Vael beginning event, and spawns Nef in wrong plac SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" enum Says { diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp index 8a9b930aa09..ae518b7c703 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp @@ -23,4 +23,5 @@ SDComment: SDCategory: Blackwing Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index 4885d8620b0..f107fd7c5ec 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -21,7 +21,8 @@ SD%Complete: SDComment: Timers and say taken from acid script EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "deadmines.h" enum eSpels diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp index 6c6b0647c5f..888171c5415 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp @@ -23,7 +23,8 @@ SDComment: Placeholder SDCategory: Deadmines EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "deadmines.h" #include "Spell.h" diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index a75eda93d1d..8e0fb9ff411 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Deadmines EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "deadmines.h" enum Sounds diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index b5a7984d945..f1aa3d68bce 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -22,7 +22,9 @@ SD%Complete: 90% SDComment: Some visual effects are not implemented. Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "gnomeregan.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp index 0bbe787827b..931c0bb90fc 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "gnomeregan.h" #define MAX_ENCOUNTER 1 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 96bda019f6a..bf27cad44ef 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_AGGRO -1532057 #define SAY_SUMMON1 -1532058 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index e19efc7c4e5..8921867be21 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_AGGRO -1532018 #define SAY_SLAY1 -1532019 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index d8be6ffc0ca..08aad90f588 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_MIDNIGHT_KILL -1532000 #define SAY_APPEAR1 -1532001 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index f69cecdb4c3..bc29a6f1f3c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "karazhan.h" #define SAY_AGGRO -1532011 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index f89abca76cf..60e1a5ebc4c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -23,7 +23,8 @@ SDComment: Not sure about timing and portals placing SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "karazhan.h" #define EMOTE_PHASE_PORTAL -1532089 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index ded5e6903a5..e2420749a4c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -23,7 +23,8 @@ SDComment: SDComment: Timers may incorrect SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "karazhan.h" //phase 1 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 4700ad71fab..1ed4da1f25e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "karazhan.h" #define SAY_AGGRO -1532091 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index d95b4aa3ae1..7dd4e731a18 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -23,7 +23,8 @@ SDComment: Flame wreath missing cast animation, mods won't triggere. SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "karazhan.h" #include "GameObject.h" diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 2f19d2c7fc1..44cd7e0faea 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -23,8 +23,10 @@ SDComment: Complete! Needs adjustments to use spell though. SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "karazhan.h" +#include "PassiveAI.h" #define SAY_SLAY1 -1532065 #define SAY_SLAY2 -1532066 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 6f8121ef5b6..959f1ac8f41 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -23,7 +23,9 @@ SDComment: Oz, Hood, and RAJ event implemented. RAJ event requires more testing. SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "karazhan.h" /***********************************/ diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 8e86024f4d8..05d6ecf1478 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -23,7 +23,8 @@ SDComment: Instance Script for Karazhan to help in various encounters. TODO: Gam SDCategory: Karazhan EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "karazhan.h" #define MAX_ENCOUNTER 12 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index b37f6913b8d..7e0a11da03a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -29,7 +29,9 @@ npc_berthold npc_image_of_medivh EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "karazhan.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 4a75370f0e8..bd79cbba628 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -23,7 +23,8 @@ SDComment: Normal and Heroic Support. Issues: Arcane Spheres do not initially fo SDCategory: Magisters' Terrace EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "magisters_terrace.h" #include "WorldPacket.h" diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 883932fdb9b..7ce9b08845f 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -23,7 +23,8 @@ SDComment: No Heroic support yet. Needs further testing. Several scripts for pet SDCategory: Magister's Terrace EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "magisters_terrace.h" struct Speech diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index af7deda4545..8bdfeb26ca2 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -23,7 +23,8 @@ SDComment: Heroic and Normal Support. Needs further testing. SDCategory: Magister's Terrace EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "magisters_terrace.h" #define SAY_AGGRO -1585000 diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index 327c611b2d6..b5cf443c5a5 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -23,7 +23,8 @@ SDComment: Heroic and Normal support. Needs further testing. SDCategory: Magister's Terrace EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "magisters_terrace.h" enum eEnums diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index aa43cb3702f..33635cefa0a 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -23,7 +23,8 @@ SDComment: Designed only for Selin Fireheart SDCategory: Magister's Terrace EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "magisters_terrace.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index ccaaa0ec68d..69e0e5bff40 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -27,7 +27,9 @@ EndScriptData */ npc_kalecgos EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_kalecgos diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp index 0160f35f143..9d48d04cf07 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp @@ -23,7 +23,8 @@ SDComment: some spells doesnt work correctly SDCategory: Molten Core EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "molten_core.h" enum Texts diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index bf887bec164..cc11d727dc2 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -15,10 +15,14 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "Vehicle.h" #include "ObjectMgr.h" #include "ScriptedEscortAI.h" +#include "CombatAI.h" +#include "PassiveAI.h" /*###### ##Quest 12848 diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 1c17e6afa9b..b4c6268a43e 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" //How to win friends and influence enemies diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 8cee23fab1c..4d1552b932e 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #define LESS_MOB // if you do not have a good server and do not want it to be laggy as hell diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp index 0ef2dddda8d..81211f36df3 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "PassiveAI.h" /*#### ## npc_valkyr_battle_maiden diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp index e5886cc39d4..c39a647d5e1 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eEnums { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp index 30105cc7315..a2cc0172969 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp index 466f940621d..ff1a0867de0 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eEnums { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 813c43288d0..028cf640d21 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "SpellMgr.h" #include "scarlet_monastery.h" diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp index 58c21d86a2f..59244585ecf 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp @@ -23,7 +23,8 @@ SDComment: Should in addition spawn Myrmidons in the hallway outside SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" enum Says diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp index 1989c318c84..847a14f54d8 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp @@ -23,7 +23,8 @@ SDComment: TODO: if this guy not involved in some special event, remove (and let SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSpells { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp index f311da401d4..9a66c9ba728 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eEnums { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index fd978136339..07b5ec5d584 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scarlet_monastery.h" enum Says diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 8d813bfe502..46fb62eae7f 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scarlet_monastery.h" enum Says diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp index 8035adfc33f..6eb27327438 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index ba0b854754e..3d3d9ae52ae 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scarlet Monastery EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scarlet_monastery.h" enum Entry diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 2bc0320b81d..c2ccde645ca 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -23,7 +23,8 @@ SDComment: Doors missing in instance script. SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scholomance.h" #define SPELL_ARCANEMISSILES 22272 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp index 967f771fe7a..b4c4332aa45 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" class boss_death_knight_darkreaver : public CreatureScript { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp index 82f4dc85060..197ee9a5bfe 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scholomance.h" enum eEnums diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp index e438ae56a2b..b6b5cc0acbd 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scholomance.h" #define SPELL_CURSEOFAGONY 18671 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp index 498e6596b06..406b1a6b10d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scholomance.h" #define SPELL_CALLOFGRAVES 17831 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp index 064faa5643d..3eb78662578 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_CURSEOFBLOOD 24673 //#define SPELL_ILLUSION 17773 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp index 5fd5a96d605..10736464ef3 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_SHADOWBOLTVOLLEY 20741 #define SPELL_BONESHIELD 27688 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp index 327c1df921d..438c3c88bb4 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp @@ -23,7 +23,8 @@ SDComment: aura applied/defined in database SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scholomance.h" #define SPELL_IMMOLATE 20294 // Old ID was 15570 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp index 1919a1ba099..64bbbbe9514 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scholomance.h" #define SPELL_VOLATILEINFECTION 24928 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp index fd10c6374a6..808dc97dc86 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_FROSTBOLT 21369 #define SPELL_ICEARMOR 18100 //This is actually a buff he gives himself diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp index a28cecf3772..381a039d609 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "scholomance.h" #define SPELL_TRAMPLE 15550 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp index f5f453c30bd..3c7771612e2 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eEnums { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index 86023d21eca..c3b3724ec3d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Scholomance EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "scholomance.h" #define GO_GATE_KIRTONOS 175570 diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 57b902ac6d4..d4c037d45c3 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Shadowfang Keep EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "shadowfang_keep.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp index 85faa14900b..cd3fbd09223 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp @@ -23,7 +23,8 @@ SDComment: aura applied/defined in database SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "stratholme.h" #define SAY_0 "Intruders! More pawns of the Argent Dawn, no doubt. I already count one of their number among my prisoners. Withdraw from my domain before she is executed!" diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp index 106719d654f..7dafcc2b647 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp @@ -23,7 +23,8 @@ SDComment: MC disabled SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "stratholme.h" #define SPELL_BANSHEEWAIL 16565 diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp index 01299ae06b6..4c2aa395e3c 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" //front, left #define ADD_1X 3553.851807f diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp index 21e3e19d890..04380da3051 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp @@ -23,7 +23,8 @@ SDComment: Possibly need to fix/improve summons after death SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eEnums { diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp index 37e0bd5757f..5e67f35af8b 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "stratholme.h" #define SPELL_DRAININGBLOW 16793 diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index f8a10f06155..522e43c0824 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "stratholme.h" #define SPELL_FROSTBOLT 17503 diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp index c9a43edb66d..d6742e63167 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "stratholme.h" #define SPELL_ENCASINGWEBS 4962 diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index ebeda248331..47c6b66f4bb 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -23,7 +23,8 @@ SDComment: Basic script to have support for Horde paladin epic mount (quest 9737 SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "stratholme.h" /*##### diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp index cf8b10a2ee5..f650029a439 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" //Spell ID to summon this guy is 24627 "Summon Postmaster Malown" //He should be spawned along with three other elites once the third postbox has been opened diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp index 3bb1ce7959d..4f82367924d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "stratholme.h" #define SPELL_TRAMPLE 5568 diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp index a281c1b59c6..356023bce77 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_SPAWN "TIMMY!" diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 387b6d7b13c..338d88e71f0 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -23,7 +23,9 @@ SDComment: In progress. Undead side 75% implemented. Save/load not implemented. SDCategory: Stratholme EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "stratholme.h" #define GO_SERVICE_ENTRANCE 175368 diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 7e167093e07..9b4591bc633 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -30,7 +30,8 @@ mob_restless_soul mobs_spectral_ghostly_citizen EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "stratholme.h" #include "Group.h" diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp index e804fff44f5..e0987961f7e 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp @@ -23,7 +23,8 @@ SDComment:Place Holder SDCategory: Sunken Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "sunken_temple.h" #define GO_ATALAI_STATUE1 148830 diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp index 35d6766872f..83ff86f5b88 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp @@ -27,7 +27,8 @@ EndScriptData */ at_malfurion_Stormrage_trigger EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "sunken_temple.h" /*##### diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index 43c94f8a57d..542f8168e0f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -22,7 +22,8 @@ SD%Complete: 80 SDComment: Find a way to start the intro, best code for the intro EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "sunwell_plateau.h" enum Quotes diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 03486a644a2..e7b0e86285e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -21,7 +21,8 @@ SD%Complete: 100 SDComment: EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "sunwell_plateau.h" enum Quotes diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 72ad1100752..7267c4e1bdb 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -21,7 +21,12 @@ SD%Complete: 0 SDComment: EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" #include "sunwell_plateau.h" enum Yells diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index f783fcc1eb5..f336a7ecfe7 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Sunwell_Plateau EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "sunwell_plateau.h" enum Yells diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 8a64d45abcb..13201449a6e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -24,7 +24,8 @@ EndScriptData */ //TODO rewrite Armageddon -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "sunwell_plateau.h" #include diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 66030a1c78c..c00ab84b567 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -21,7 +21,8 @@ SD%Complete: 80 SDComment: all sounds, black hole effect triggers to often (46228) */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "sunwell_plateau.h" // Muru & Entropius's spells diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 645026c343d..24e4b0d9aa1 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -23,7 +23,8 @@ SDComment: VERIFY SCRIPT SDCategory: Sunwell_Plateau EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "sunwell_plateau.h" #define MAX_ENCOUNTER 6 diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp index e6349e3497e..25bc85f47b6 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp @@ -26,7 +26,8 @@ npc_prophet_velen npc_captain_selana EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "sunwell_plateau.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 7a946e9d5bf..3ffb873e4d2 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -26,7 +26,8 @@ At 33%, he will awaken the Vault Walkers On his death the vault door opens. EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "uldaman.h" #define SAY_AGGRO "Who dares awaken Archaedas? Who dares the wrath of the makers!" diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp index 8a845dbb7f6..c05a36f93a7 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Uldaman EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_AGGRO -1070000 diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index fea64c55377..ade07039a23 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -23,7 +23,8 @@ SDComment: Need some cosmetics updates when archeadas door are closing (Guardian SDCategory: Uldaman EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "uldaman.h" enum eSpells diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp index 1c6cad7278a..2b8d4e37b65 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp @@ -30,7 +30,8 @@ go_keystone_chamber at_map_chamber EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "uldaman.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index a715dbfce9d..c7d6e2fb6e4 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -25,7 +25,12 @@ SQLUpdate: EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" #include "zulaman.h" #include "Weather.h" diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 3baa6ebdf62..ecf173b02e5 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Zul'Aman EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulaman.h" //#include "spell.h" diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index a2125c45689..d4886bc3795 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Zul'Aman EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulaman.h" #include "GridNotifiers.h" diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 48a406f22a4..b5646a16692 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Zul'Aman EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulaman.h" #include "GridNotifiers.h" diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index 2df202af088..1009d3e0a0a 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -22,7 +22,8 @@ SD%Complete: 85% SDComment: EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulaman.h" //Speech diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 884fe109785..f5d5a11084c 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Zul'Aman EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "zulaman.h" #define MAX_ENCOUNTER 6 diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index bfb22483b09..f0bea065eb6 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -27,7 +27,9 @@ EndScriptData */ npc_forest_frog EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "zulaman.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 4ba0c187973..1dc841d3518 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -23,7 +23,8 @@ SDComment: Wrong cleave and red aura is missing. SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" enum eYells diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp index ce2fd0848f9..5e553c7396f 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp @@ -23,7 +23,8 @@ SDComment: Massive Geyser with knockback not working. Spell buggy. SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_FROSTBREATH 16099 #define SPELL_MASSIVEGEYSER 22421 //Not working. Cause its a summon... diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp index cdd45a3fa0d..8c71ea6d48d 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SPELL_AVARTAR 24646 //The Enrage Spell diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 9edd82c39b0..6cb657f4cff 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -23,7 +23,8 @@ SDComment: Blood siphon spell buggy cause of Core Issue. SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SAY_AGGRO -1309020 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp index 27c46b8e0f2..bb3e0b14e0e 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SPELL_MANABURN 26046 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 7d2215f8311..156ccab5eae 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -23,7 +23,8 @@ SDComment: Problem in finding the right flying batriders for spawning and making SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SAY_AGGRO -1309002 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index f4a17da56fb..f8d23947e9c 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -23,7 +23,8 @@ SDComment: Mind Control not working because of core bug. Shades visible for all. SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SAY_AGGRO -1309014 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index cbe1178e6c4..83cd0b46fb8 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -23,7 +23,8 @@ SDComment: Ohgan function needs improvements. SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SAY_AGGRO -1309015 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index 44ab5d851f5..8e0deda1d0b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -23,7 +23,8 @@ SDComment: Charging healers and casters not working. Perhaps wrong Spell Timers. SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SAY_AGGRO -1309005 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp index 81260c28d73..32a8f209917 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SPELL_AMBUSH 24337 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index 3da74d16dc3..29495f77f2a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -23,7 +23,8 @@ SDComment: Almost finished. SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SAY_AGGRO -1309009 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp index b22630f51bb..6cdb00236df 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "zulgurub.h" #define SPELL_LIGHTNINGCLOUD 25033 diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index e3dd5d5933b..104d479383b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -23,7 +23,8 @@ SDComment: Missing reset function after killing a boss for Ohgan, Thekal. SDCategory: Zul'Gurub EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "zulgurub.h" class instance_zulgurub : public InstanceMapScript diff --git a/src/server/scripts/EasternKingdoms/alterac_mountains.cpp b/src/server/scripts/EasternKingdoms/alterac_mountains.cpp index e4b24dc00ee..b56727b18e1 100644 --- a/src/server/scripts/EasternKingdoms/alterac_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/alterac_mountains.cpp @@ -26,7 +26,8 @@ EndScriptData */ /* ContentData EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" /*void AddSC_alterac_mountains() { diff --git a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp index d4d35b107b2..b0d59fe8b5a 100644 --- a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp +++ b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp @@ -27,7 +27,8 @@ EndScriptData */ npc_professor_phizzlethorpe EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/blasted_lands.cpp b/src/server/scripts/EasternKingdoms/blasted_lands.cpp index 2042e5313c3..3d8e68dfbf8 100644 --- a/src/server/scripts/EasternKingdoms/blasted_lands.cpp +++ b/src/server/scripts/EasternKingdoms/blasted_lands.cpp @@ -27,7 +27,9 @@ EndScriptData */ npc_deathly_usher EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_deathly_usher diff --git a/src/server/scripts/EasternKingdoms/boss_kruul.cpp b/src/server/scripts/EasternKingdoms/boss_kruul.cpp index 8749c943a6f..6a1ba633660 100644 --- a/src/server/scripts/EasternKingdoms/boss_kruul.cpp +++ b/src/server/scripts/EasternKingdoms/boss_kruul.cpp @@ -23,7 +23,8 @@ SDComment: Highlord Kruul are presumably no longer in-game on regular bases, how SDCategory: Bosses EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_SHADOWVOLLEY 21341 #define SPELL_CLEAVE 20677 diff --git a/src/server/scripts/EasternKingdoms/burning_steppes.cpp b/src/server/scripts/EasternKingdoms/burning_steppes.cpp index b526246f670..eec747d6d73 100644 --- a/src/server/scripts/EasternKingdoms/burning_steppes.cpp +++ b/src/server/scripts/EasternKingdoms/burning_steppes.cpp @@ -27,7 +27,9 @@ EndScriptData */ npc_ragged_john EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_ragged_john diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp index 10cb5987ce5..e5af5344dc1 100644 --- a/src/server/scripts/EasternKingdoms/duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/duskwood.cpp @@ -23,7 +23,8 @@ SDComment: Quest Support:8735 SDCategory: Duskwood EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Yells { diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp index 0519ce94b32..7ca76e38fce 100644 --- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp @@ -30,7 +30,9 @@ npc_darrowshire_spirit npc_tirion_fordring EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" class mobs_ghoul_flayer : public CreatureScript { diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index 8ae72e142c8..d69ae3454b4 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -31,7 +31,9 @@ npc_kelerun_bloodmourn go_harbinger_second_trial EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp index e40a2f785e6..9793c6fd31c 100644 --- a/src/server/scripts/EasternKingdoms/ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp @@ -30,7 +30,9 @@ npc_rathis_tomber npc_ranger_lilatha EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp index 8de895cb51f..a6d01f0ca93 100644 --- a/src/server/scripts/EasternKingdoms/hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp @@ -28,7 +28,8 @@ npc_00x09hl npc_rinji EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/ironforge.cpp b/src/server/scripts/EasternKingdoms/ironforge.cpp index 93a8d7423c9..2915ee1f3cb 100644 --- a/src/server/scripts/EasternKingdoms/ironforge.cpp +++ b/src/server/scripts/EasternKingdoms/ironforge.cpp @@ -27,7 +27,9 @@ EndScriptData */ npc_royal_historian_archesonus EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_royal_historian_archesonus diff --git a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp index 27d8ea3e51c..e448ccda14c 100644 --- a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp @@ -28,7 +28,8 @@ npc_converted_sentry npc_greengill_slave EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" /*###### ## npc_converted_sentry diff --git a/src/server/scripts/EasternKingdoms/loch_modan.cpp b/src/server/scripts/EasternKingdoms/loch_modan.cpp index 7ea8a62a5bd..4e3aaae71a1 100644 --- a/src/server/scripts/EasternKingdoms/loch_modan.cpp +++ b/src/server/scripts/EasternKingdoms/loch_modan.cpp @@ -27,7 +27,9 @@ EndScriptData */ npc_mountaineer_pebblebitty EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_mountaineer_pebblebitty diff --git a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp index 3ade1da4a19..2473fec899a 100644 --- a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp @@ -21,7 +21,8 @@ SD%Complete: 100% SDComment: Support for quest 219. Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" enum eCorporalKeeshan diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp index e6595a83b66..954f21f73f5 100644 --- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp +++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp @@ -27,7 +27,8 @@ EndScriptData */ npc_blood_knight_stillblade EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" /*####### # npc_blood_knight_stillblade diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp index bc3110878de..339e202fce1 100644 --- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp @@ -28,7 +28,8 @@ npc_deathstalker_erland pyrewood_ambush EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp index 96ad1da725d..560214d4085 100644 --- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp @@ -33,7 +33,9 @@ npc_marzon_silent_blade npc_lord_gregor_lescovar EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp index 03f92ce6d61..40f046a5075 100644 --- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp +++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp @@ -27,7 +27,8 @@ EndScriptData */ mob_yenniku EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" /*###### ## mob_yenniku diff --git a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp index 6507ec911c0..4c81380fb60 100644 --- a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp +++ b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp index 4687fa3630f..70f9f93c7a7 100644 --- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp @@ -29,7 +29,8 @@ go_mausoleum_door go_mausoleum_trigger EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" /*###### ## npc_calvin_montague diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index a9b627ded34..f04e8c4e772 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -29,7 +29,9 @@ npc_highborne_lamenter npc_parqual_fintallas EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_lady_sylvanas_windrunner diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp index 0057c01b882..31dea10453a 100644 --- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp @@ -30,7 +30,9 @@ npc_the_scourge_cauldron npc_andorhal_tower EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp index 46f1526c5bf..478c5f6c0d6 100644 --- a/src/server/scripts/EasternKingdoms/westfall.cpp +++ b/src/server/scripts/EasternKingdoms/westfall.cpp @@ -28,7 +28,8 @@ npc_daphne_stilwell npc_defias_traitor EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp index bf28d9838a4..fac8fb51c2d 100644 --- a/src/server/scripts/EasternKingdoms/wetlands.cpp +++ b/src/server/scripts/EasternKingdoms/wetlands.cpp @@ -28,7 +28,8 @@ npc_mikhail npc_tapoke_slim_jahn EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/Examples/example_commandscript.cpp b/src/server/scripts/Examples/example_commandscript.cpp index 6b7a3d8def7..28ef021d599 100644 --- a/src/server/scripts/Examples/example_commandscript.cpp +++ b/src/server/scripts/Examples/example_commandscript.cpp @@ -23,7 +23,7 @@ Comment: Short custom scripting example Category: Script Examples EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" #include "Chat.h" // **** This script is designed as an example for others to build on **** diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp index 7f75a0fb481..17b9aae732b 100644 --- a/src/server/scripts/Examples/example_creature.cpp +++ b/src/server/scripts/Examples/example_creature.cpp @@ -23,7 +23,9 @@ SDComment: Short custom scripting example SDCategory: Script Examples EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" // **** This script is designed as an example for others to build on **** // **** Please modify whatever you'd like to as this script is only for developement **** diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp index 851a32538e9..20e4c5614e9 100644 --- a/src/server/scripts/Examples/example_escort.cpp +++ b/src/server/scripts/Examples/example_escort.cpp @@ -23,7 +23,9 @@ SDComment: Script used for testing escortAI SDCategory: Script Examples EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" enum eEnums diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp index 6d57f1ac798..a5627c68ff6 100644 --- a/src/server/scripts/Examples/example_gossip_codebox.cpp +++ b/src/server/scripts/Examples/example_gossip_codebox.cpp @@ -23,7 +23,9 @@ SDComment: Show a codebox in gossip option SDCategory: Script Examples EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include enum eEnums diff --git a/src/server/scripts/Examples/example_misc.cpp b/src/server/scripts/Examples/example_misc.cpp index d83a00ed82f..3aa4bac3f1e 100644 --- a/src/server/scripts/Examples/example_misc.cpp +++ b/src/server/scripts/Examples/example_misc.cpp @@ -23,7 +23,6 @@ SDComment: Item, Areatrigger and other small code examples SDCategory: Script Examples EndScriptData */ -#include "ScriptPCH.h" #include "ScriptMgr.h" enum eSay diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 70d7f43135c..737d1eec8f8 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -22,9 +22,10 @@ * and `ScriptName` is the name of a script assigned on registration */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" #include "SpellAuras.h" #include "SpellAuraEffects.h" +#include "SpellScript.h" enum Spells { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp index b2853f25a33..7b468cb7fe5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp @@ -23,7 +23,8 @@ SDComment: TODO: Intro, consecutive attacks to a random target durin time wrap, SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "culling_of_stratholme.h" enum Spells diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp index ccf60f9bd0b..56d07a49dc4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "culling_of_stratholme.h" enum Spells diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index a038a06f815..d4359a100b4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -23,7 +23,8 @@ SDComment: TODO: Intro & outro SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "culling_of_stratholme.h" enum Spells diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp index d5dd597960f..8e80af66379 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp @@ -23,7 +23,8 @@ SDComment: It may need timer adjustment SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "culling_of_stratholme.h" enum Spells diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp index 7828d172e1e..d23957ddf81 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp @@ -23,7 +23,8 @@ SDComment: TODO: Intro SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "culling_of_stratholme.h" enum Spells diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 6454083e424..e74ba833908 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -15,9 +15,12 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "culling_of_stratholme.h" #include "ScriptedEscortAI.h" +#include "PassiveAI.h" enum Says { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index b232cae4657..ea02e8f50b5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "CreatureTextMgr.h" #include "culling_of_stratholme.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp index 5b47c2ee07d..161ea4ba8b7 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp @@ -23,7 +23,8 @@ SDComment: Some spells not implemented SDCategory: Caverns of Time, The Dark Portal EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "dark_portal.h" enum eEnums diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp index a4e805b3b75..8fc7f31e766 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp @@ -23,7 +23,8 @@ SDComment: All abilities not implemented SDCategory: Caverns of Time, The Dark Portal EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "dark_portal.h" enum eEnums diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp index f59c9f0ef4c..0256a099580 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp @@ -23,7 +23,8 @@ SDComment: More abilities need to be implemented SDCategory: Caverns of Time, The Dark Portal EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "dark_portal.h" enum eEnums diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp index c2a41cb29d1..f7c4a21634c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -29,7 +29,9 @@ npc_time_rift npc_saat EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "dark_portal.h" #define SAY_ENTER -1269020 //where does this belong? diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index 2c8cd096644..fbbe750626b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -23,7 +23,8 @@ SDComment: Quest support: 9836, 10297. Currently in progress. SDCategory: Caverns of Time, The Dark Portal EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "dark_portal.h" #define MAX_ENCOUNTER 2 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp index c27507cdcec..96cfba0007b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp @@ -23,7 +23,8 @@ SDComment: Missing adds, missing waypoints to move up to Thrall once spawned + s SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "old_hillsbrad.h" #define SAY_ENTER -1560000 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp index 82bd0a9e9be..ab0f10bdfe0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp @@ -23,7 +23,8 @@ SDComment: Missing spawns pre-event, missing speech to be coordinated with rest SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "old_hillsbrad.h" #define SAY_ENTER1 -1560013 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp index 45825a81eb2..534c831814e 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp @@ -23,7 +23,8 @@ SDComment: Missing proper code for patrolling area after being spawned. Script f SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "old_hillsbrad.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index b179a15e878..ea8aab5d46a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -23,7 +23,9 @@ SDComment: If thrall escort fail, all parts will reset. In future, save sub-part SDCategory: Caverns of Time, Old Hillsbrad Foothills EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "old_hillsbrad.h" #define MAX_ENCOUNTER 6 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 7d9da6771dc..3690e87354d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -29,7 +29,9 @@ npc_thrall_old_hillsbrad npc_taretha EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "old_hillsbrad.h" diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp index 1f887d7ce64..26e1f77bf48 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp index bda5267713d..44f9aa1184a 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Razorfen Downs EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_AGGRO -1129000 #define SAY_SUMMON60 -1129001 diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index 8b138468f4c..a0a8bb02d90 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "razorfen_downs.h" #define MAX_ENCOUNTER 1 diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index b84ecea4de3..3a147007fce 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -27,7 +27,9 @@ EndScriptData */ npc_henry_stern EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "razorfen_downs.h" /*### diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index 98395305d57..374c2ae4257 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Razorfen Kraul EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "razorfen_kraul.h" #define WARD_KEEPERS_NR 2 diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index 43e3fe6efdd..374059c46ac 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -27,7 +27,8 @@ EndScriptData */ npc_willix EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "razorfen_kraul.h" diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index 459dc87a9b8..40d4d5d54b4 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -23,7 +23,8 @@ SDComment: Place Holder SDCategory: Ruins of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ruins_of_ahnqiraj.h" enum Yells diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index 18a77519ba2..c05613d387f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ruins_of_ahnqiraj.h" enum Texts diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index 91c0110abd5..e9bb8be67b7 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -23,7 +23,8 @@ SDComment: Place holder SDCategory: Ruins of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ruins_of_ahnqiraj.h" enum Yells diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp index d4549242a4c..2dbd52f7e42 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "ruins_of_ahnqiraj.h" class instance_ruins_of_ahnqiraj : public InstanceMapScript diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index 36b1871c96e..0b78b5f9ab2 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" #define SPELL_CLEAVE 26350 diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 11efccd14b7..92fd27a5680 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -23,7 +23,8 @@ SDComment: Darkglare tracking issue SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" /* diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp index 613bc91182b..5ebce2f04e2 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp @@ -23,7 +23,8 @@ SDComment: sound not implemented SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SOUND_SENTENCE_YOU 8588 #define SOUND_SERVE_TO 8589 diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp index 53fac3ee3ec..83af40c57f2 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define EMOTE_GENERIC_FRENZY_KILL -1000001 #define EMOTE_GENERIC_BERSERK -1000004 diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index 81205780e7d..f7acf28dba3 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -23,7 +23,8 @@ SDComment: No model for submerging. Currently just invisible. SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" #define SPELL_SWEEP 26103 diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp index 8c6c0fa0ad0..02554bbe6b3 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_AGGRO -1531008 #define SAY_SLAY -1531009 diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 4df4bf73330..36388cfbe9c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -23,7 +23,8 @@ SDComment: Mind Control buggy. SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" #include "Group.h" diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index abaab9d830e..b85999042dd 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" #include "WorldPacket.h" diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index 7b30200b0b3..d0e97bc36c8 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -23,7 +23,8 @@ SDComment: place holder SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_POISON_SHOCK 25993 #define SPELL_POISONBOLT_VOLLEY 25991 diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index f1cc0b401c3..887ca4f3ad5 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "temple_of_ahnqiraj.h" class instance_temple_of_ahnqiraj : public InstanceMapScript diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index 556247d85af..5bb65454e0a 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -23,7 +23,8 @@ SDComment: Shadow storm is not properly implemented in core it should only targe SDCategory: Temple of Ahn'Qiraj EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "WorldPacket.h" #include "Item.h" diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index e61e20c35bc..1bb5c1180bd 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -23,7 +23,8 @@ SDComment: Everything seems to work, still need some checking SDCategory: Wailing Caverns EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "wailing_caverns.h" #define MAX_ENCOUNTER 9 diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 7e93cc7e4c7..0d4efac4321 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -26,7 +26,9 @@ EndScriptData */ /* ContentData EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "wailing_caverns.h" diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index b6c69584358..6c0d43b053e 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "zulfarrak.h" #define NPC_GAHZRILLA 7273 diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index 9e3d9240321..03e3756f964 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -28,7 +28,9 @@ npc_sergeant_bly npc_weegli_blastfuse EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "zulfarrak.h" /*###### diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp index 8f34fa56525..89064a5d18c 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp @@ -19,7 +19,8 @@ * Comment: Find correct mushrooms spell to make them visible - buffs of the mushrooms not ever applied to the users... */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ahnkahet.h" enum Spells diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp index ea757e86f4d..7f4da5666ff 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ahnkahet.h" //not in db diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index f1eaa0c87c5..e81d58b4ef3 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -19,7 +19,8 @@ * Comment: Missing AI for Twisted Visages */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ahnkahet.h" enum Spells diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index d6e50097765..7c167fb9c27 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -19,7 +19,8 @@ * Comment: Complete - BUT THE TRIGGER NEEDS DATA WHETHER THE PRISON OF TALDARAM IS OFFLINE ! */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ahnkahet.h" enum Yells diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index cf3c4274e48..f8e2fc0f99f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ahnkahet.h" enum Spells diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp index 74643e58e30..f870c61dd5f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "ahnkahet.h" /* Ahn'kahet encounters: diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index ca71d8c313e..dcf1338bc74 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "azjol_nerub.h" enum Spells diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index 6587631f249..2690ea13ab1 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -28,7 +28,8 @@ * Hadronox to make his way to you. When Hadronox enters the main room, she will web the doors, and no more non-elites will spawn. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "azjol_nerub.h" enum Spells diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 4d83be53c93..1acc3b77a61 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -19,7 +19,8 @@ * Comment: Find in the future best timers and the event is not implemented. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "azjol_nerub.h" enum Spells diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index 12622174e29..4e06ac0ba3a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "azjol_nerub.h" #define MAX_ENCOUNTER 3 diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index b115a4ee827..a9d6d9d91ba 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -15,7 +15,12 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" #include "obsidian_sanctum.h" enum eEnums diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp index 91d67697ebb..7d4438ed7c7 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "obsidian_sanctum.h" #define MAX_ENCOUNTER 1 diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp index b2cf755c7af..41eb31d815d 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "ruby_sanctum.h" diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index 5a7809dbe70..c4008564029 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ruby_sanctum.h" enum Texts 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 f9e302d7634..5678bbbeb83 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "ruby_sanctum.h" diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp index 19ae66b6a60..273c860a2ad 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ruby_sanctum.h" enum Texts diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index e96408acc09..76d5949eb44 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -22,7 +22,9 @@ SDComment: AI for Argent Soldiers are not implemented. AI from bosses need more SDCategory: Trial of the Champion EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "trial_of_the_champion.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index 9768b50b214..c56d44ceb08 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -22,7 +22,8 @@ SDComment: missing yells. not sure about timers. SDCategory: Trial of the Champion EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "trial_of_the_champion.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 18c972b966c..f3b6078d536 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -23,7 +23,8 @@ SDComment: Is missing the ai to make the npcs look for a new mount and use it. SDCategory: Trial Of the Champion EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "Vehicle.h" #include "trial_of_the_champion.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index 9ccd136731a..310dd1003c3 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -21,7 +21,9 @@ SDComment: SDCategory: Trial Of the Champion EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "trial_of_the_champion.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index c8236ace88c..a2488513d63 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -26,7 +26,9 @@ EndScriptData */ npc_announcer_toc5 EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "trial_of_the_champion.h" #include "Vehicle.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index e4dcf978574..b3b9801fd00 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -31,7 +31,8 @@ EndScriptData */ // Scarab - Kill credit isn't crediting? // FrostSph - often they are casting Permafrost a little above the ground -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "trial_of_the_crusader.h" enum Yells diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index a7328b43826..4e791dfc22f 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -30,7 +30,8 @@ EndScriptData */ // Redone summon's scripts in SAI // Add immunities to the boss and summons -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "trial_of_the_crusader.h" enum Yells diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 5bda32941c2..6c69ccbc72d 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -29,7 +29,8 @@ EndScriptData */ // Snakes - miss the 1-hitkill from emerging // - visual changes between mobile and stationary models seems not to work sometimes -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "trial_of_the_crusader.h" enum Yells diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index cf84abb482f..4cfe4f61dbb 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -27,7 +27,15 @@ EndScriptData */ // - They should be floating but they aren't respecting the floor =( // - Hardcoded bullets spawner -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" #include "trial_of_the_crusader.h" enum Yells diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 1966e26b128..1fd1fdf094d 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -23,7 +23,8 @@ SDComment: by /dev/rsa SDCategory: Trial of the Crusader EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "trial_of_the_crusader.h" class instance_trial_of_the_crusader : public InstanceMapScript 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 2643b8d60c7..4ad93c0afe1 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -27,7 +27,9 @@ EndScriptData */ // - Need better implementation of Gossip and correct gossip text and option // - Misses Dalaran Teleport at the end. -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "trial_of_the_crusader.h" enum eYells diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp index 95acc79231d..8b39fc51766 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp @@ -19,7 +19,8 @@ * Comment: MAYBE need more improve the "Raptor Call". */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "drak_tharon_keep.h" enum Spells diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 9ff8ee9c9ed..5d9acf4fca7 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "drak_tharon_keep.h" enum Spells diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index b1d588a0d0d..969ccf4a059 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "drak_tharon_keep.h" enum Spells diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 26e4e9db99e..b6a4c40abdd 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -19,7 +19,9 @@ * Comment: TODO: spawn troll waves */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuras.h" #include "drak_tharon_keep.h" enum Spells diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index aff3f1b8e36..7778a79a816 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "drak_tharon_keep.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 5b6bf14c29e..b790ed518d5 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "SpellAuraEffects.h" #include "forge_of_souls.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index ad49f6cbce8..4fdcf96192b 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "forge_of_souls.h" /* diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index 1469e26fd20..c23479eea22 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "forge_of_souls.h" enum Events diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index bad4b8e38b2..618b2b6a9a6 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "forge_of_souls.h" #define MAX_ENCOUNTER 2 diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp index 9cfcb78f6f1..4df13d32bf8 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "halls_of_reflection.h" enum Yells diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp index a9bfb603794..8334a199791 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "halls_of_reflection.h" enum Yells diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 2abb60d5de2..26ec9e53213 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "halls_of_reflection.h" enum Yells diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 3c4d05854bb..e3604890e39 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "halls_of_reflection.h" #define MAX_ENCOUNTER 3 diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 114bc69741c..a12bd96f6df 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuras.h" #include "pit_of_saron.h" enum Yells diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index fa260cb298d..57d99908bfb 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "pit_of_saron.h" #include "Vehicle.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 8d015adf4a4..ef4d9182f82 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "pit_of_saron.h" #include "Vehicle.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 1301acf4c99..a6537c45d6f 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "pit_of_saron.h" // positions for Martin Victus (37591) and Gorkun Ironskull (37592) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index b6c821ef66a..eba19403517 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "pit_of_saron.h" #include "Vehicle.h" diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index b66c3d795f3..fd1aba79e83 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -19,7 +19,8 @@ * Comment: The event with the Living Mojos is not implemented, just is done that when one of the mojos around the boss take damage will make the boss enter in combat! */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "gundrak.h" enum Spells diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp index 3e803c24d61..b75c5cbc2a9 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "gundrak.h" enum Spells diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index be9b09a1263..0d89c402054 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "gundrak.h" //Spells diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp index 1085e993322..c1301dbd2d0 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "gundrak.h" enum eSpells diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index b827f43dc99..251c9ec2b83 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuras.h" #include "gundrak.h" //Spells diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index c22a0e17cd5..15315c721d7 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "gundrak.h" #define MAX_ENCOUNTER 5 diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp index 1671eab0b32..8901a61e79d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "naxxramas.h" #define SAY_GREET RAND(-1533000, -1533004, -1533005, -1533006, -1533007) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index 058c5b35e3a..636f2318712 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "naxxramas.h" enum Yells diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 47dfaa7f772..69443b2824e 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "naxxramas.h" #define SPELL_MORTAL_WOUND 25646 diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index 039b9b1e007..5a55a4f1c4b 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "naxxramas.h" #define SPELL_BOMBARD_SLIME 28280 diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index d84cfb8949e..93eab5df237 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "naxxramas.h" #define SAY_AGGRO RAND(-1533109, -1533110, -1533111) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 38c22a93ac4..10b40b490c4 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -23,7 +23,10 @@ SDComment: VERIFY SCRIPT SDCategory: Naxxramas EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "naxxramas.h" enum Yells diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp index 58d3a4240b2..71623cb1959 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "naxxramas.h" enum Spells diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index 3c258f08030..8ec9bac7e86 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "PassiveAI.h" #include "naxxramas.h" enum Spells diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index 75be596fd77..d106b99ace0 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "naxxramas.h" #define SAY_AGGRO RAND(-1533075, -1533076, -1533077) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index b826a530719..b1b57836a89 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "naxxramas.h" enum Spells diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp index e06aa6b03c5..d733cac001c 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "naxxramas.h" //Razuvious - NO TEXT sound only diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 37fb5f3f4a9..a2acf8a64da 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "naxxramas.h" #define EMOTE_BREATH -1533082 diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 50eb52cc4c2..e806b60c848 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "naxxramas.h" const DoorData doorData[] = diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index ac5520b025a..9f5eb8d879a 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -27,7 +27,11 @@ Script Data End */ // Remove hack that re-adds targets to the aggro list after they enter to a vehicle when it works as expected // Improve whatever can be improved :) -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" +#include "PassiveAI.h" #include "eye_of_eternity.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index fcb54985357..f6a12eee519 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "eye_of_eternity.h" class instance_eye_of_eternity : public InstanceMapScript diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp index 7552ba4f389..5e6dcbcd66e 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "nexus.h" enum Spells diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index 5c1dee1d4e4..9e6930118f7 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -16,7 +16,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "nexus.h" enum Spells diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index ad188738c12..9602d1bc876 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "nexus.h" enum Spells diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index c70db7d4ebc..9f9223f0161 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "nexus.h" enum Spells diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp index 5ea3eb32c1d..5463f6c9045 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp @@ -23,7 +23,8 @@ SDComment: Only Alliance Heroic SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_BATTLE_SHOUT 31403 #define SPELL_CHARGE 60067 diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp index da4b49740c1..38808bc718d 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp @@ -23,7 +23,8 @@ SDComment: Only Horde Heroic SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_BATTLE_SHOUT 31403 #define SPELL_CHARGE 60067 diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index 5af982bb694..152f0b2d647 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "nexus.h" #define NUMBER_OF_ENCOUNTERS 4 diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index bb75b789fff..035e1a9a6df 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "oculus.h" enum Spells diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index ab814a2ca22..708ed600933 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "oculus.h" //Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer) diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index b96d7c4aa84..791bc0180e5 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -22,7 +22,8 @@ SDComment: Is not working SPELL_ARCANE_SHIELD. SPELL_FROSTBOMB has some issues, SDCategory: Instance Script EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "oculus.h" enum Spells diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index d200e8bf4bf..6d9450daf21 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "oculus.h" #include "MapManager.h" diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index 46498a69c6f..ca4ae883747 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "oculus.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 0eafd7a7fea..1d8b5b986f6 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -15,7 +15,11 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "oculus.h" #define GOSSIP_ITEM_DRAKES "So where do we go from here?" diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp index 9f39cecbb23..72ab5259693 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp @@ -23,7 +23,8 @@ SDComment: Waypoint needed, we expect boss to always have 2x Stormforged Lieuten SDCategory: Halls of Lightning EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "halls_of_lightning.h" enum eEnums diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index abdf5ecb1e1..d964f619a6e 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -20,7 +20,8 @@ * Comment: Timer check pending */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "halls_of_lightning.h" enum Spells diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 5c7bf0d1c1e..fe41e7a12dc 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -23,7 +23,8 @@ SDComment: Event should be pretty close minus a few visual flaws SDCategory: Halls of Lightning EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "halls_of_lightning.h" enum eEnums diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp index f25be6dae0d..93b246e9ddc 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp @@ -23,7 +23,8 @@ SDComment: All ready. SDCategory: Halls of Lightning EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "halls_of_lightning.h" /* Halls of Lightning encounters: diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp index 65711643827..8d113bce226 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "halls_of_stone.h" enum Spells diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index c2a8e905950..28052a57576 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "halls_of_stone.h" enum Spells diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index a608de5fcf3..a90c346e470 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "halls_of_stone.h" diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp index ee5cb87dd85..869cf46e74d 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "halls_of_stone.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index a7853a07e22..191f4530e65 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -22,7 +22,8 @@ SDComment: Some Problems with Annhylde Movement, Blizzlike Timers (just shadow a SDCategory: Udgarde Keep EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "utgarde_keep.h" enum Yells diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 93cc94923db..f53020a72c4 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -22,7 +22,10 @@ SDComment: SDCategory: Utgarde Keep EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "utgarde_keep.h" enum KelsethEncounter diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp index 915d1c71bb2..be8d60fbeb9 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp @@ -22,7 +22,8 @@ SDComment: Needs adjustments to blizzlike timers, Yell Text + Sound to DB SDCategory: Utgarde Keep EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "utgarde_keep.h" enum eEnums diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index fda4767e16b..cf3bc2d8607 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -22,7 +22,8 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter SDCategory: Utgarde Keep EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "utgarde_keep.h" #define MAX_ENCOUNTER 3 diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index 95d2cb1709e..2d53e7062eb 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "utgarde_keep.h" uint32 entry_search[3] = diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index e2943f491f6..8cbfe4bafb4 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "utgarde_pinnacle.h" enum Spells diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index 5132dd0f046..f0d64bb8344 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -25,7 +25,8 @@ SDComment: SDCategory: Utgarde Pinnacle Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "utgarde_pinnacle.h" //Yell diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 7969accc28c..f2f03ff602b 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -15,7 +15,10 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "utgarde_pinnacle.h" enum Spells diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index f9251c637ba..5dacaff2d6b 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "utgarde_pinnacle.h" enum Spells diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp index 26fbbf4d717..c5d50d4e7fd 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "utgarde_pinnacle.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp index bffc6af2a3a..96e0bc66bd1 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "vault_of_archavon.h" #define EMOTE_BERSERK -1590002 diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index 4980ed36ec3..903280d317a 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuras.h" #include "vault_of_archavon.h" //Emalon spells diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp index dd9db1c0a99..31003addf1f 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "vault_of_archavon.h" enum Events diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp index 100f1fccac8..9c60673522c 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "vault_of_archavon.h" enum Spells diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index ec0de41ed6d..d1209b40a19 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "vault_of_archavon.h" /* Vault of Archavon encounters: diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp index 37ef8bf2788..b4ce402e7de 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "violet_hold.h" enum Spells diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index 31902acfc46..bd59b731c3c 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "violet_hold.h" enum Spells diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index a191d9349f2..f6d918e0493 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "violet_hold.h" enum Spells diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp index 7a8254ad2b6..510e9874dd7 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "violet_hold.h" enum Spells diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index 1a70846e1b6..f368b07077a 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "violet_hold.h" //Spells diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index ac165ac39ef..a01b41bfbcf 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "violet_hold.h" enum Spells diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index 4569741e459..d1c65259738 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "violet_hold.h" enum Spells diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 37a13388b5f..4b6fed181e4 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -15,7 +15,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "violet_hold.h" #define MAX_ENCOUNTER 3 diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index e9d2c85e13e..122d051f1dd 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "violet_hold.h" diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index 8b51618eedd..9b207c257fc 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -37,7 +37,9 @@ npc_lurgglbr npc_nexus_drake_hatchling EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" diff --git a/src/server/scripts/Northrend/crystalsong_forest.cpp b/src/server/scripts/Northrend/crystalsong_forest.cpp index d48903696ec..7b8eb331702 100644 --- a/src/server/scripts/Northrend/crystalsong_forest.cpp +++ b/src/server/scripts/Northrend/crystalsong_forest.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: CrystalsongForest Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" /******************************************************* * npc_warmage_violetstand diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index e7b92732066..c19effbab1b 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -23,7 +23,9 @@ SDComment: For what is 63990+63991? Same function but don't work correct... SDCategory: Dalaran Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /******************************************************* * npc_mageguard_dalaran diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp index 1b339b24549..ecc012eb25d 100644 --- a/src/server/scripts/Northrend/dragonblight.cpp +++ b/src/server/scripts/Northrend/dragonblight.cpp @@ -27,7 +27,11 @@ EndScriptData */ npc_alexstrasza_wr_gate EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "ScriptedEscortAI.h" enum eEnums diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 2da84dd3fdb..1a0f6b57375 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp index 88cc297868b..ffe38d6aade 100644 --- a/src/server/scripts/Northrend/howling_fjord.cpp +++ b/src/server/scripts/Northrend/howling_fjord.cpp @@ -27,7 +27,9 @@ npc_plaguehound_tracker npc_apothecary_hanes EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp index 85b34523893..5989b5bad2e 100644 --- a/src/server/scripts/Northrend/icecrown.cpp +++ b/src/server/scripts/Northrend/icecrown.cpp @@ -27,7 +27,10 @@ EndScriptData */ npc_arete EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "SpellAuras.h" /*###### ## npc_arete diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp index 6d76e348980..1cf8f54b4fe 100644 --- a/src/server/scripts/Northrend/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/isle_of_conquest.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "PassiveAI.h" #include "BattlegroundIC.h" // TO-DO: This should be done with SmartAI, but yet it does not correctly support vehicles's AIs. diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index afab9b90a4a..56ef25c5753 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -28,8 +28,11 @@ npc_vekjik avatar_of_freya EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "SpellScript.h" /*###### ## npc_injured_rainspeaker_oracle diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 15239e9f836..6bf342e4643 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "Vehicle.h" diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index 369f47cfb1c..6af96f3fdfd 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -15,7 +15,9 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*#### diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 1db4fb4dfc9..2a94ddb3134 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -15,6 +15,7 @@ * with this program. If not, see . */ +#include "ScriptMgr.h" #include "OutdoorPvPEP.h" #include "WorldPacket.h" #include "Player.h" @@ -26,7 +27,6 @@ #include "Language.h" #include "World.h" #include "GossipDef.h" -#include "ScriptPCH.h" OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index 06c1813d1dc..a4b506e9271 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -15,6 +15,7 @@ * with this program. If not, see . */ +#include "ScriptMgr.h" #include "OutdoorPvPHP.h" #include "OutdoorPvP.h" #include "OutdoorPvPMgr.h" @@ -23,7 +24,6 @@ #include "World.h" #include "ObjectMgr.h" #include "Language.h" -#include "ScriptPCH.h" const uint32 HP_LANG_LOSE_A[HP_TOWER_NUM] = {LANG_OPVP_HP_LOSE_BROKENHILL_A, LANG_OPVP_HP_LOSE_OVERLOOK_A, LANG_OPVP_HP_LOSE_STADIUM_A}; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index f912f25d87f..abf807327e3 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -15,6 +15,7 @@ * with this program. If not, see . */ +#include "ScriptMgr.h" #include "OutdoorPvPNA.h" #include "Player.h" #include "ObjectMgr.h" @@ -22,7 +23,6 @@ #include "WorldPacket.h" #include "Language.h" #include "World.h" -#include "ScriptPCH.h" OutdoorPvPNA::OutdoorPvPNA() { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index a69dd3ed874..c70e4168826 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -15,6 +15,7 @@ * with this program. If not, see . */ +#include "ScriptMgr.h" #include "OutdoorPvPSI.h" #include "WorldPacket.h" #include "Player.h" @@ -24,7 +25,6 @@ #include "OutdoorPvPMgr.h" #include "Language.h" #include "World.h" -#include "ScriptPCH.h" OutdoorPvPSI::OutdoorPvPSI() { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index ec0c10f4afe..9572125a4bd 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -15,6 +15,7 @@ * with this program. If not, see . */ +#include "ScriptMgr.h" #include "OutdoorPvPTF.h" #include "OutdoorPvPMgr.h" #include "OutdoorPvP.h" @@ -23,7 +24,6 @@ #include "ObjectMgr.h" #include "Language.h" #include "World.h" -#include "ScriptPCH.h" OutdoorPvPTF::OutdoorPvPTF() { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index 38fed30f542..6644dd3f47f 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -15,6 +15,7 @@ * with this program. If not, see . */ +#include "ScriptMgr.h" #include "OutdoorPvPZM.h" #include "ObjectMgr.h" #include "OutdoorPvPMgr.h" @@ -24,7 +25,6 @@ #include "WorldPacket.h" #include "GossipDef.h" #include "World.h" -#include "ScriptPCH.h" OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index ae1a7296de6..a8b4b1797cb 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -29,7 +29,8 @@ boss_exarch_maladaar mob_avatar_of_martyred EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_MOONFIRE 37328 #define SPELL_FIREBALL 37329 diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index 5fc912f2a01..f678cf9c198 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -23,7 +23,8 @@ Comment: InhibitMagic should stack slower far from the boss, proper Visual for F Category: Auchindoun, Auchenai Crypts EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_INHIBITMAGIC 32264 #define SPELL_ATTRACTMAGIC 32265 diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index a4bba5f28fb..351f30c926f 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -28,7 +28,8 @@ boss_nexusprince_shaffar mob_ethereal_beacon EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum ePrince { diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp index 487a1dd41ea..459ba3a8f86 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp @@ -23,7 +23,8 @@ SDComment: Not known how void blast is done (amount of rapid cast seems to be re SDCategory: Auchindoun, Mana Tombs EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_AGGRO_1 -1557008 #define SAY_AGGRO_2 -1557009 diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp index 37544f9377b..0a85cf1dc5b 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp @@ -23,7 +23,8 @@ SDComment: Shock spells/times need more work. Heroic partly implemented. SDCategory: Auchindoun, Sethekk Halls EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SAY_SUMMON -1556000 diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp index 768c4bf12d3..ec35d6c80b3 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp @@ -23,7 +23,8 @@ SDComment: Heroic supported. Some details missing, but most are spell related. SDCategory: Auchindoun, Sethekk Halls EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "sethekk_halls.h" #define SAY_INTRO -1556007 diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp index 02c5a035375..f57bed1207b 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp @@ -23,7 +23,8 @@ SDComment: Instance Data for Sethekk Halls instance SDCategory: Auchindoun, Sethekk Halls EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "sethekk_halls.h" enum eEnums diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp index d92e76685d1..a109e3738b1 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp @@ -23,7 +23,8 @@ SDComment: Enrage spell missing/not known SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "shadow_labyrinth.h" diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp index 6eac36f71c8..e7063e479ee 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp @@ -23,7 +23,8 @@ SDComment: Incite Chaos not functional since core lacks Mind Control support SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "shadow_labyrinth.h" #define SPELL_INCITE_CHAOS 33676 diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 8d971c37559..c1850ee821c 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "shadow_labyrinth.h" #define SAY_INTRO -1555028 diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index 99661d8818c..4f8fc917424 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -23,7 +23,8 @@ SDComment: Timers may be incorrect SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "shadow_labyrinth.h" #define EMOTE_SONIC_BOOM -1555036 diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index 846669552ba..326d214e886 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -23,7 +23,8 @@ SDComment: Some cleanup left along with save SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "shadow_labyrinth.h" #define MAX_ENCOUNTER 5 diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index 546f9ee1e7d..5fe5b8aab0c 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -27,7 +27,9 @@ EndScriptData */ npc_spirit_of_olum EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" + #include "ScriptedGossip.h" #include "black_temple.h" /*### diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp index caac89da765..fd775df3392 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp @@ -23,7 +23,8 @@ SDComment: Bloodboil not working correctly, missing enrage SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "black_temple.h" //Speech'n'Sound diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 1926929c97c..52704cb8f49 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -23,7 +23,10 @@ SDComment: Somewhat of a workaround for Parasitic Shadowfiend, unable to summon SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "PassiveAI.h" #include "black_temple.h" #define GETGO(obj, guid) GameObject* obj = instance->instance->GetGameObject(guid) diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index 4e4607a7d44..1b2fe61e87c 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -23,7 +23,8 @@ SDComment: Saber Lash missing, Fatal Attraction slightly incorrect; need to dama SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "black_temple.h" //Speech'n'Sounds diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index c5e78f2fa7b..44c37fc9753 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "black_temple.h" #include "Spell.h" diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 630e44429fa..81be46a197c 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -23,7 +23,9 @@ SDComment: Seems to be complete. SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "black_temple.h" #define SAY_DEATH -1564013 diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index ce1732433c8..e34a229eea5 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -23,7 +23,9 @@ SDComment: Need to implement molten punch SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "PassiveAI.h" #include "black_temple.h" #define EMOTE_NEW_TARGET -1564010 diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index bc12a6c1c6c..524992b3c44 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -23,7 +23,8 @@ SDComment: Requires Mind Control support for Ghosts. SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "black_temple.h" //Speech'n'sound diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 5b2bb8e7bf5..e8bee95865f 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "black_temple.h" enum eEnums diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index 0742f174ccf..9197492fbf1 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -23,7 +23,10 @@ SDComment: Circle of Healing not working properly. SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "black_temple.h" //Speech'n'Sounds diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index 49bce6d82c0..310bb6da651 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -23,7 +23,8 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter SDCategory: Black Temple EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "black_temple.h" #define MAX_ENCOUNTER 9 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 3937b213e7e..a5737714e71 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -23,7 +23,8 @@ SDComment: Cyclone workaround SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "serpent_shrine.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp index 7abd2bbc8a8..bad10752db3 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp @@ -23,7 +23,8 @@ SDComment: Some details and adjustments left to do, probably nothing major. Spaw SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "serpent_shrine.h" #define SAY_AGGRO -1548000 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 18d8b2b5a1e..539974a0a91 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -23,7 +23,8 @@ SDComment: Missing blizzlike Shield Generators coords SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "serpent_shrine.h" #include "Spell.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 4876410890c..81e03a19c1f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -23,7 +23,8 @@ SDComment: Possesion Support SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "serpent_shrine.h" // --- Spells used by Leotheras The Blind diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 00de1802bc9..b9e530996af 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -23,7 +23,8 @@ SDComment: Coilfang Frenzy, find out how could we fishing in the strangepool SDCategory: The Lurker Below EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "serpent_shrine.h" #include "Spell.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp index 865fb143800..32f03d4d1f9 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp @@ -23,7 +23,8 @@ SDComment: Water globules don't explode properly, remove hacks SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "serpent_shrine.h" enum eEnums diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 3ed3d1a82de..87053d1de1c 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -23,7 +23,8 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "serpent_shrine.h" #define MAX_ENCOUNTER 6 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp index 48c5a360619..038300213a4 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp @@ -28,7 +28,8 @@ boss_hydromancer_thespia mob_coilfang_waterelemental EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "steam_vault.h" #define SAY_SUMMON -1545000 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp index 739168863f4..50cc913c669 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp @@ -28,7 +28,8 @@ boss_mekgineer_steamrigger mob_steamrigger_mechanic EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "steam_vault.h" #define SAY_MECHANICS -1545007 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index cae1117805a..d81a021c4bc 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -23,7 +23,8 @@ SDComment: Contains workarounds regarding warlord's rage spells not acting as ex SDCategory: Coilfang Resevoir, The Steamvault EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "steam_vault.h" #define SAY_INTRO -1545016 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index 51032fd70ed..63fd935751d 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -23,7 +23,8 @@ SDComment: Instance script and access panel GO SDCategory: Coilfang Resevoir, The Steamvault EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "steam_vault.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp index 42d617992ed..54823687e5e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp @@ -23,7 +23,8 @@ SDComment: Need confirmation if spell data are same in both modes. Summons shoul SDCategory: Coilfang Resevoir, Underbog EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_FOUL_SPORES 31673 #define SPELL_ACID_GEYSER 38739 diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp index f7079e5c664..4006e756ca2 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp @@ -23,7 +23,8 @@ SDComment: Timers may be incorrect SDCategory: Coilfang Resevoir, Underbog EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #define SPELL_LEVITATE 31704 #define SPELL_SUSPENSION 31719 diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index 0f42b1b7e53..03089d646f9 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -23,7 +23,8 @@ SDComment: Correct timers, after whirlwind melee attack bug, prayer of healing SDCategory: Gruul's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "gruuls_lair.h" #define SAY_AGGRO -1565000 diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index 3514732b53a..fdb386372d4 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Gruul's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "gruuls_lair.h" #define MAX_ENCOUNTER 2 diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index f6b7518661e..3a2e0834fed 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -23,7 +23,8 @@ SDComment: pre-event not made SDCategory: Hellfire Citadel, Blood Furnace EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blood_furnace.h" enum eEnums diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index 01873afeaa9..a0bcc396fdb 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -28,7 +28,9 @@ boss_kelidan_the_breaker mob_shadowmoon_channeler EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuras.h" #include "blood_furnace.h" enum eKelidan diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp index dc9f83b073d..df9aefabe15 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp @@ -23,7 +23,8 @@ SDComment: Mind control no support SDCategory: Hellfire Citadel, Blood Furnace EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blood_furnace.h" enum eEnums diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index d9f6b7e303e..4c434feb4ec 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Hellfire Citadel, Blood Furnace EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "blood_furnace.h" #define ENTRY_SEWER1 181823 diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp index 2ab2b2b5b2e..714ea275471 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp @@ -23,7 +23,8 @@ SDComment: Temporary solution for orbital/shadow whip-ability. Needs more core s SDCategory: Hellfire Citadel, Hellfire Ramparts EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSays { diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index a5cdebea754..3bb0858d2be 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -23,7 +23,8 @@ Comment: Category: Hellfire Citadel, Hellfire Ramparts EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSpells { diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp index 2c00a68321a..1d2ecccf3c7 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp @@ -23,7 +23,8 @@ SDComment: Missing adds to heal him. Surge should be used on target furthest awa SDCategory: Hellfire Citadel, Hellfire Ramparts EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSays { diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index 3dab24eab1b..c100fa204e2 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Hellfire Ramparts EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "hellfire_ramparts.h" class instance_ramparts : public InstanceMapScript diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 1b29abf1afc..bbf03e39f9b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -23,7 +23,8 @@ SDComment: In Development SDCategory: Hellfire Citadel, Magtheridon's lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "magtheridons_lair.h" struct Yell diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index cb55d627f7d..640e4439593 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -23,7 +23,9 @@ SDComment: SDCategory: Hellfire Citadel, Magtheridon's lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "magtheridons_lair.h" enum eSpells diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp index 7dfdc40a787..c6434d9a989 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp @@ -29,7 +29,8 @@ mob_fel_orc_convert mob_lesser_shadow_fissure EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "shattered_halls.h" struct Say diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index 5371473e21e..3d2d39e9817 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -28,7 +28,8 @@ mob_omrogg_heads boss_warbringer_omrogg EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "shattered_halls.h" enum eEnums diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index c1489671292..99f7c69aff2 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -27,7 +27,8 @@ EndScriptData */ boss_warchief_kargath_bladefist EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSays { diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp index cc36bf9a385..4105a7d5821 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp @@ -23,7 +23,8 @@ SDComment: currently missing info about door. instance not complete SDCategory: Hellfire Citadel, Shattered Halls EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "shattered_halls.h" #define MAX_ENCOUNTER 2 diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 25207073708..3770ac3ba09 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Tempest Keep, The Eye EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "the_eye.h" enum eSpells diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 1d8c7e71bef..e5dd1c923d9 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -23,7 +23,8 @@ SDComment: SQL, weapon scripts, mind control, need correct spells(interruptible/ SDCategory: Tempest Keep, The Eye EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "the_eye.h" #include "WorldPacket.h" diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp index 275a72e75ac..2c778485131 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp @@ -23,7 +23,8 @@ SDComment: Should reset if raid are out of room. SDCategory: Tempest Keep, The Eye EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "the_eye.h" enum eEnums diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index f25b6749055..78ffddca4d8 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Tempest Keep, The Eye EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "the_eye.h" #define MAX_ENCOUNTER 5 diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp index 421f9f2f545..a38ad1d734e 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp @@ -27,7 +27,8 @@ EndScriptData */ mob_crystalcore_devastator EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "the_eye.h" enum eSpells diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp index 4d579ac8c16..1d816f1eee3 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp @@ -23,7 +23,8 @@ SDComment: Place Holder SDCategory: Tempest Keep, The Mechanar EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" //not used #define SAY_AGGRO -1554000 diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp index a1287a57402..83acc1258be 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Tempest Keep, The Mechanar EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSays { diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index 1cd67065af1..d2b0475fa77 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -18,6 +18,7 @@ //! TODO - Boss not scripted, just ported required spellscript from core #include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "SpellScript.h" enum Spells diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp index 59837fdbed1..02be844711d 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp @@ -23,7 +23,8 @@ SDComment: Need adjustments to initial summons SDCategory: Tempest Keep, The Mechanar EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "mechanar.h" enum eSays diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp index 3a4d449707d..622e6e6d7e6 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp @@ -23,7 +23,8 @@ SDComment: Event missing. Script for himself 99% blizzlike. SDCategory: Tempest Keep, The Mechanar EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSays { diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index ad3c899237f..a96666705d1 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Mechanar EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "mechanar.h" #define MAX_ENCOUNTER 1 diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index d675b438968..f45ece47220 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -29,7 +29,8 @@ npc_warden_mellichar mob_zerekethvoidzone EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "arcatraz.h" /*##### diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index c2eeaf9fe7a..730bab7e626 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -28,7 +28,8 @@ boss_harbinger_skyriss boss_harbinger_skyriss_illusion EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "arcatraz.h" enum eSays diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index ffe96fb7bd1..d5b61b87fc2 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -23,7 +23,8 @@ SDComment: Mainly Harbringer Skyriss event SDCategory: Tempest Keep, The Arcatraz EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "arcatraz.h" #define MAX_ENCOUNTER 9 diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp index ba61a1bfb12..a53f62c96f4 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp @@ -23,7 +23,8 @@ SDComment: some strange visual related to tree form(if aura lost before normal d SDCategory: Tempest Keep, The Botanica EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSays { diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp index e8188f892b3..ed04c42edc7 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp @@ -23,7 +23,8 @@ SDComment: Immunities are wrong, must be adjusted to use resistance from creatur SDCategory: Tempest Keep, The Botanica EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSpells { diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index 3acde2455db..e3b1a7e94e1 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -23,7 +23,8 @@ SDComment: Includes Sapling (need some better control with these). SDCategory: Tempest Keep, The Botanica EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum eSays { diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index c46757a3956..c263ac85ef5 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -33,7 +33,13 @@ go_legion_obelisk go_thunderspike EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" //Support for quest: You're Fired! (10821) bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five; diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp index 67834601d6f..ae3bd283db4 100644 --- a/src/server/scripts/Outland/boss_doomwalker.cpp +++ b/src/server/scripts/Outland/boss_doomwalker.cpp @@ -16,7 +16,8 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Texts { diff --git a/src/server/scripts/Outland/hellfire_peninsula.cpp b/src/server/scripts/Outland/hellfire_peninsula.cpp index b0e19f0e322..6825d859332 100644 --- a/src/server/scripts/Outland/hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/hellfire_peninsula.cpp @@ -33,7 +33,9 @@ npc_trollbane npc_wounded_blood_elf EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index 871a2f200bb..977ec57e2df 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -28,8 +28,9 @@ npc_greatmother_geyah npc_maghar_captive npc_creditmarker_visit_with_ancestors EndContentData */ - -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 16dac13d1a9..e5795383ede 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -32,7 +32,9 @@ npc_maxx_a_million go_captain_tyralius_prison EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index 340049ba4fa..c79bf74aab6 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -40,7 +40,9 @@ go_crystal_prison npc_enraged_spirit EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "Group.h" diff --git a/src/server/scripts/Outland/shattrath_city.cpp b/src/server/scripts/Outland/shattrath_city.cpp index 79cce47e16c..8ad2c311fc5 100644 --- a/src/server/scripts/Outland/shattrath_city.cpp +++ b/src/server/scripts/Outland/shattrath_city.cpp @@ -34,7 +34,9 @@ npc_ishanah npc_khadgar EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp index 6c2214cde37..707cabfcf0c 100644 --- a/src/server/scripts/Outland/terokkar_forest.cpp +++ b/src/server/scripts/Outland/terokkar_forest.cpp @@ -33,7 +33,9 @@ npc_isla_starmane npc_slim EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "Group.h" diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp index 90ce070ecc7..aa51b532c27 100644 --- a/src/server/scripts/Outland/zangarmarsh.cpp +++ b/src/server/scripts/Outland/zangarmarsh.cpp @@ -32,7 +32,9 @@ npc_kayra_longmane npc_timothy_daniels EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index dabe978b58c..c147a548eda 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -20,7 +20,11 @@ * Scriptnames in this file should be prefixed with "spell_#holidayname_". */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" +#include "GridNotifiers.h" // 45102 Romantic Picnic enum SpellsPicnic diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index daf0ef213d9..f302009a4f3 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -35,7 +35,8 @@ at_brewfest at_area_52_entrance EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" /*###### ## at_coilfang_waterfall diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp index 2a5d814bfde..aaeb8a13acd 100755 --- a/src/server/scripts/World/chat_log.cpp +++ b/src/server/scripts/World/chat_log.cpp @@ -15,7 +15,7 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" #include "Channel.h" #include "Guild.h" #include "Group.h" diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 21a852ae9ed..ad870b155f3 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -50,7 +50,9 @@ go_large_gjalerbron_cage go_veil_skith_cage EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## go_cat_figurine diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index e3100522fbe..4b0433fe0c7 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -29,7 +29,8 @@ guard_shattrath_aldor guard_shattrath_scryer EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "GuardAI.h" enum GuardGeneric diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index ae69744ea2b..d888e6cb56b 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -30,7 +30,8 @@ item_gor_dreks_ointment(i30175) Protecting Our Own(q10488) item_only_for_flight Items which should only useable while flying EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "Spell.h" /*##### diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp index 208effee61b..be409670f5d 100644 --- a/src/server/scripts/World/mob_generic_creature.cpp +++ b/src/server/scripts/World/mob_generic_creature.cpp @@ -23,7 +23,9 @@ SDComment: Should be replaced with core based AI SDCategory: Creatures EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "PassiveAI.h" #define GENERIC_CREATURE_COOLDOWN 5000 diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp index fb7c0833d22..f57af517db2 100644 --- a/src/server/scripts/World/npc_innkeeper.cpp +++ b/src/server/scripts/World/npc_innkeeper.cpp @@ -23,7 +23,10 @@ SDComment: Complete SDCategory: NPCs EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "GameEventMgr.h" #define HALLOWEEN_EVENTID 12 #define SPELL_TRICK_OR_TREATED 24755 diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 2afa80dd42c..9126e268260 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -23,7 +23,9 @@ SDComment: Provides learn/unlearn/relearn-options for professions. Not supported SDCategory: NPCs EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /* A few notes for future developement: diff --git a/src/server/scripts/World/npc_taxi.cpp b/src/server/scripts/World/npc_taxi.cpp index ceda8e0f6ac..6241978fbd2 100644 --- a/src/server/scripts/World/npc_taxi.cpp +++ b/src/server/scripts/World/npc_taxi.cpp @@ -24,7 +24,9 @@ SDCategory: NPCs EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #define GOSSIP_SUSURRUS "I am ready." #define GOSSIP_NETHER_DRAKE "I'm ready to fly! Take me up, dragon!" diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 57a65423b6f..4eea4999b0b 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -42,12 +42,22 @@ npc_locksmith 75% list of keys needs to be confirmed npc_firework 100% NPC's summoned by rockets and rocket clusters, for making them cast visual EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ObjectMgr.h" #include "ScriptMgr.h" #include "World.h" #include "PetAI.h" +#include "PassiveAI.h" +#include "CombatAI.h" +#include "GameEventMgr.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" +#include "SpellAuras.h" /*######## # npc_air_force_bots -- cgit v1.2.3 From 5a99dfad149245c685c088e9e08aa445428b9e53 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 30 Jul 2012 10:07:26 +0200 Subject: Warning fixes + compile fix after the merge --- src/server/game/Entities/Object/Object.cpp | 2 ++ src/server/game/Spells/Spell.cpp | 3 +++ src/server/game/Spells/SpellScript.cpp | 4 ++++ src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp | 1 + src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp | 1 + .../scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp | 2 ++ src/server/scripts/Spells/spell_holiday.cpp | 1 + 7 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 7a4c42027dc..fdc09bba8b9 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -814,6 +814,8 @@ void Object::GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOw flags = CorpseUpdateFieldFlags; isOwner = ToCorpse()->GetOwnerGUID() == target->GetGUID(); break; + case TYPEID_OBJECT: + break; } } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 590f880a931..eef11ab25a9 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2576,6 +2576,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) { if (effectMask & (1 << effectNumber)) + { if (unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber)) effectMask &= ~(1 << effectNumber); else if (m_spellInfo->Effects[effectNumber].IsAura() && !m_spellInfo->IsPositiveEffect(effectNumber)) @@ -2590,7 +2591,9 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA returnVal = SPELL_MISS_RESIST; } } + } } + if (!effectMask) return returnVal; diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index d0ae6fe3098..3430c1b12e3 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -247,10 +247,14 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff return !area; case TARGET_REFERENCE_TYPE_TARGET: // BOTH return true; + default: + break; } break; } break; + default: + break; } return false; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index d4886bc3795..c0023b006d7 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "zulaman.h" #include "GridNotifiers.h" +#include "CellImpl.h" enum eEnums { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index b5646a16692..e4360c1c8ad 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "zulaman.h" #include "GridNotifiers.h" +#include "CellImpl.h" //Trash Waves float NalorakkWay[8][3] = diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 367240cd2df..6e7e3c49ef8 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -1336,6 +1336,7 @@ class npc_dark_nucleus : public CreatureScript { _targetAuraCheck = 1000; if (Unit* victim = me->getVictim()) + { if (me->GetDistance(victim) < 15.0f && !victim->HasAura(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID())) { @@ -1344,6 +1345,7 @@ class npc_dark_nucleus : public CreatureScript } else MoveInLineOfSight(me->getVictim()); + } } else _targetAuraCheck -= diff; diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index c147a548eda..a1ecac6256a 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -25,6 +25,7 @@ #include "SpellScript.h" #include "SpellAuraEffects.h" #include "GridNotifiers.h" +#include "CellImpl.h" // 45102 Romantic Picnic enum SpellsPicnic -- cgit v1.2.3 From 3f97ca1fabd1309cd200406c6ce4bbe436f8710f Mon Sep 17 00:00:00 2001 From: Venugh Date: Tue, 31 Jul 2012 16:02:54 +0200 Subject: Core/Misc: Removed useless include from commands. --- src/server/game/CMakeLists.txt | 1 - src/server/worldserver/CMakeLists.txt | 1 - 2 files changed, 2 deletions(-) (limited to 'src') diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index 8b81a48c33b..a83e77e6632 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -141,7 +141,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Calendar ${CMAKE_CURRENT_SOURCE_DIR}/Chat ${CMAKE_CURRENT_SOURCE_DIR}/Chat/Channels - ${CMAKE_CURRENT_SOURCE_DIR}/Chat/Commands ${CMAKE_CURRENT_SOURCE_DIR}/Combat ${CMAKE_CURRENT_SOURCE_DIR}/Conditions ${CMAKE_CURRENT_SOURCE_DIR}/DataStores diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 0d51f30449e..eb5bb04d766 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -80,7 +80,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/Calendar ${CMAKE_SOURCE_DIR}/src/server/game/Chat ${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels - ${CMAKE_SOURCE_DIR}/src/server/game/Chat/Commands ${CMAKE_SOURCE_DIR}/src/server/game/Combat ${CMAKE_SOURCE_DIR}/src/server/game/Conditions ${CMAKE_SOURCE_DIR}/src/server/game/DataStores -- cgit v1.2.3 From f5231929e04748d25cadf234be4c12843b7c1909 Mon Sep 17 00:00:00 2001 From: Nay Date: Wed, 1 Aug 2012 23:57:36 +0200 Subject: Scripts/Build: Fix non PCH build --- src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index e4360c1c8ad..eb3057a74d3 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "zulaman.h" #include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "CellImpl.h" //Trash Waves -- cgit v1.2.3 From e72f01650c1974603ff1fe7941698e9bed44418a Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 2 Aug 2012 08:04:12 +0200 Subject: Core/Misc: Minor update to SMSG_GUILD_QUERY_RESPONSE, added a value to enum MailStationery, some comments to a few dbcs. DB: Renamed merged sql files --- sql/updates/world/2012_02_02_01_world_spell_script_names.sql | 3 +++ sql/updates/world/2012_06_14_09_world_spell_script_names.sql | 3 --- sql/updates/world/2012_07_10_00_world_spell_script_names.sql | 3 --- sql/updates/world/2012_08_02_00_world_spell_script_names.sql | 3 +++ src/server/game/DataStores/DBCStructure.h | 6 +++--- src/server/game/Guilds/Guild.cpp | 7 +++---- src/server/game/Handlers/MailHandler.cpp | 2 +- src/server/game/Mails/Mail.h | 5 +++-- 8 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 sql/updates/world/2012_02_02_01_world_spell_script_names.sql delete mode 100644 sql/updates/world/2012_06_14_09_world_spell_script_names.sql delete mode 100644 sql/updates/world/2012_07_10_00_world_spell_script_names.sql create mode 100644 sql/updates/world/2012_08_02_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_02_02_01_world_spell_script_names.sql b/sql/updates/world/2012_02_02_01_world_spell_script_names.sql new file mode 100644 index 00000000000..15ca9c43cc5 --- /dev/null +++ b/sql/updates/world/2012_02_02_01_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=-32379; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(-32379,'spell_pri_shadow_word_death'); diff --git a/sql/updates/world/2012_06_14_09_world_spell_script_names.sql b/sql/updates/world/2012_06_14_09_world_spell_script_names.sql deleted file mode 100644 index f14e44e35ff..00000000000 --- a/sql/updates/world/2012_06_14_09_world_spell_script_names.sql +++ /dev/null @@ -1,3 +0,0 @@ -DELETE FROM `spell_script_names` WHERE `spell_id`=-603; -INSERT INTO `spell_script_names` (`spell_id` ,`ScriptName`) VALUES -(-603,'spell_warl_curse_of_doom'); diff --git a/sql/updates/world/2012_07_10_00_world_spell_script_names.sql b/sql/updates/world/2012_07_10_00_world_spell_script_names.sql deleted file mode 100644 index 15ca9c43cc5..00000000000 --- a/sql/updates/world/2012_07_10_00_world_spell_script_names.sql +++ /dev/null @@ -1,3 +0,0 @@ -DELETE FROM `spell_script_names` WHERE `spell_id`=-32379; -INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES -(-32379,'spell_pri_shadow_word_death'); diff --git a/sql/updates/world/2012_08_02_00_world_spell_script_names.sql b/sql/updates/world/2012_08_02_00_world_spell_script_names.sql new file mode 100644 index 00000000000..f14e44e35ff --- /dev/null +++ b/sql/updates/world/2012_08_02_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=-603; +INSERT INTO `spell_script_names` (`spell_id` ,`ScriptName`) VALUES +(-603,'spell_warl_curse_of_doom'); diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 15792fd57da..fdec06f6f48 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1052,7 +1052,7 @@ struct GtRegenMPPerSptEntry /* no used struct HolidayDescriptionsEntry { - uint32 ID; // 0, this is NOT holiday id + uint32 ID; // 0, m_holidayDescriptionID //char* name[16] // 1-16 m_name_lang // 17 name flags }; @@ -1061,7 +1061,7 @@ struct HolidayDescriptionsEntry /* no used struct HolidayNamesEntry { - uint32 ID; // 0, this is NOT holiday id + uint32 ID; // 0, m_holidayNameID //char* name[16] // 1-16 m_name_lang // 17 name flags }; @@ -1203,7 +1203,7 @@ struct LFGDungeonEntry uint32 recmaxlevel; // 22 int32 map; // 23 uint32 difficulty; // 24 - //uint32 flags; // 25 + //uint32 flags; // 25 (flags & 4) = IsHoliday uint32 type; // 26 //uint32 unk; // 27 //char* iconname; // 28 diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 889174420c6..0811ba06137 100755 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -1226,11 +1226,10 @@ void Guild::HandleRoster(WorldSession* session /*= NULL*/) void Guild::HandleQuery(WorldSession* session) { WorldPacket data(SMSG_GUILD_QUERY_RESPONSE, 8 * 32 + 200); // Guess size - data << uint32(m_id); data << m_name; - for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i) // Alwayse show 10 ranks + for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i) // Always show 10 ranks { if (i < _GetRanksSize()) data << m_ranks[i].GetName(); @@ -1239,9 +1238,9 @@ void Guild::HandleQuery(WorldSession* session) } m_emblemInfo.WritePacket(data); - data << uint32(0); // Something new in WotLK - + data << uint32(_GetRanksSize()); // Amount of ranks session->SendPacket(&data); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)"); } diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 69a84892e76..a98453e45c3 100755 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -614,7 +614,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) } data << uint32((*itr)->COD); // COD - data << uint32(0); // probably changed in 3.3.3 + data << uint32(0); // package (Package.dbc) data << uint32((*itr)->stationery); // stationery (Stationery.dbc) data << uint32((*itr)->money); // Gold data << uint32((*itr)->checked); // flags diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h index ea319c731d0..8efb33bda9a 100755 --- a/src/server/game/Mails/Mail.h +++ b/src/server/game/Mails/Mail.h @@ -56,8 +56,9 @@ enum MailStationery MAIL_STATIONERY_DEFAULT = 41, MAIL_STATIONERY_GM = 61, MAIL_STATIONERY_AUCTION = 62, - MAIL_STATIONERY_VAL = 64, - MAIL_STATIONERY_CHR = 65, + MAIL_STATIONERY_VAL = 64, // Valentine + MAIL_STATIONERY_CHR = 65, // Christmas + MAIL_STATIONERY_ORP = 67, // Orphan }; enum MailState -- cgit v1.2.3 From f303782de4ec739bb175b7a503fb3a74a1d8a1f9 Mon Sep 17 00:00:00 2001 From: Alternative Date: Thu, 2 Aug 2012 16:33:35 -0400 Subject: Added disable commands. --- src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Commands/CMakeLists.txt | 1 + src/server/scripts/Commands/cs_disable.cpp | 195 +++++++++++++++++++++ .../Database/Implementation/WorldDatabase.cpp | 2 + .../shared/Database/Implementation/WorldDatabase.h | 2 + 5 files changed, 202 insertions(+) create mode 100644 src/server/scripts/Commands/cs_disable.cpp (limited to 'src') diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index ed5b5638b4d..319fd1eb702 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -50,6 +50,7 @@ void AddSC_ban_commandscript(); void AddSC_cast_commandscript(); void AddSC_character_commandscript(); void AddSC_debug_commandscript(); +void AddSC_disable_commandscript(); void AddSC_event_commandscript(); void AddSC_gm_commandscript(); void AddSC_go_commandscript(); @@ -663,6 +664,7 @@ void AddCommandScripts() AddSC_cast_commandscript(); AddSC_character_commandscript(); AddSC_debug_commandscript(); + AddSC_disable_commandscript(); AddSC_event_commandscript(); AddSC_gm_commandscript(); AddSC_go_commandscript(); diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index ca4a964ffb3..bd439c2c473 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -16,6 +16,7 @@ set(scripts_STAT_SRCS Commands/cs_cast.cpp Commands/cs_character.cpp Commands/cs_debug.cpp + Commands/cs_disable.cpp Commands/cs_event.cpp Commands/cs_gm.cpp Commands/cs_go.cpp diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp new file mode 100644 index 00000000000..d748db56a1a --- /dev/null +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -0,0 +1,195 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: disable_commandscript +%Complete: 100 +Comment: All disable related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "ObjectMgr.h" +#include "Chat.h" +#include "DisableMgr.h" + +class disable_commandscript : public CommandScript +{ +public: + disable_commandscript() : CommandScript("disable_commandscript") { } + + ChatCommand* GetCommands() const + { + + static ChatCommand disableCommandTable[] = + { + { "spell", SEC_GAMEMASTER, false, &HandleDisableSpellCommand, "", NULL }, + { "map", SEC_GAMEMASTER, false, &HandleDisableMapCommand, "", NULL }, + { "battleground", SEC_GAMEMASTER, false, &HandleDisableBattlegroundCommand, "", NULL }, + { "achievement_criteria", SEC_GAMEMASTER, false, &HandleDisableAchievementCriteriaCommand, "", NULL }, + { "outdoorpvp", SEC_GAMEMASTER, false, &HandleDisableOutdoorPvPCommand, "", NULL }, + { "vmap", SEC_GAMEMASTER, false, &HandleDisableVmapCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand commandTable[] = + { + { "disable", SEC_GAMEMASTER, false, NULL, "", disableCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + + static void HandleDisables(ChatHandler* handler, char const* args, uint8 disableType) + { + char* cEntry = strtok((char*)args, " "); + if (!cEntry || !atoi(cEntry)) + { + handler->SendSysMessage("No entry specified."); + return; + } + + char* cFlags = strtok(NULL, " "); + if (!cFlags || !atoi(cFlags)) + { + handler->SendSysMessage("No flags specified."); + return; + } + + char* cComment = strtok(NULL, ""); + if (!cComment) + { + handler->SendSysMessage("No comment specified."); + return; + } + + std::string entryStr = cEntry; + std::string disableComment = cComment; + uint32 entry = (uint32)atoi(cEntry); + uint8 flags = atoi(cFlags); + + + + std::string disableTypeStr = ""; + + switch(disableType) + { + case DISABLE_TYPE_SPELL: + disableTypeStr = "spell"; + break; + case DISABLE_TYPE_MAP: + disableTypeStr = "map"; + break; + case DISABLE_TYPE_BATTLEGROUND: + disableTypeStr = "battleground"; + break; + case DISABLE_TYPE_ACHIEVEMENT_CRITERIA: + disableTypeStr = "achievement criteria"; + break; + case DISABLE_TYPE_OUTDOORPVP: + disableTypeStr = "outdoorpvp"; + break; + case DISABLE_TYPE_VMAP: + disableTypeStr = "vmap"; + break; + } + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); + stmt->setUInt32(0, entry); + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); + + + if (result) + { + handler->PSendSysMessage("This %s (id %u) is already disabled.", disableTypeStr.c_str(), entry); + return; + } + + PreparedStatement* stmt2 = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES); + stmt2->setUInt32(0, entry); + stmt2->setUInt8(1, disableType); + stmt->setUInt16(2, flags); + stmt2->setString(3, disableComment); + WorldDatabase.Execute(stmt2); + + handler->PSendSysMessage("Disabled %s %u for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str()); + return; + + } + + static bool HandleDisableSpellCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + HandleDisables(handler, args, DISABLE_TYPE_SPELL); + return true; + } + + static bool HandleDisableMapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + HandleDisables(handler, args, DISABLE_TYPE_MAP); + return true; + } + + static bool HandleDisableBattlegroundCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + HandleDisables(handler, args, DISABLE_TYPE_BATTLEGROUND); + return true; + } + + static bool HandleDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + HandleDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA); + return true; + } + + static bool HandleDisableOutdoorPvPCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + HandleDisables(handler, args, DISABLE_TYPE_OUTDOORPVP); + return true; + } + + static bool HandleDisableVmapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + HandleDisables(handler, args, DISABLE_TYPE_VMAP); + return true; + } + +}; + +void AddSC_disable_commandscript() +{ + new disable_commandscript(); +} \ No newline at end of file diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index e3455891909..dfee1e2f11f 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -88,4 +88,6 @@ void WorldDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT * FROM disables WHERE entry = ? AND sourceType = ? AND flags > 0", CONNECTION_SYNCH); } diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index 0580cecec7e..10163d33c83 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -109,6 +109,8 @@ enum WorldDatabaseStatements WORLD_DEL_GAME_EVENT_CREATURE, WORLD_DEL_GAME_EVENT_MODEL_EQUIP, WORLD_INS_GAMEOBJECT, + WORLD_SEL_DISABLES, + WORLD_INS_DISABLES, MAX_WORLDDATABASE_STATEMENTS, }; -- cgit v1.2.3 From dc7030ced686aca85893cdd80376e705e6bfb513 Mon Sep 17 00:00:00 2001 From: Alternative Date: Thu, 2 Aug 2012 16:47:28 -0400 Subject: Some codestyle changes. --- src/server/scripts/Commands/cs_disable.cpp | 2 +- src/server/shared/Database/Implementation/WorldDatabase.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index d748db56a1a..d3475ac10ae 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -87,7 +87,7 @@ public: std::string disableTypeStr = ""; - switch(disableType) + switch (disableType) { case DISABLE_TYPE_SPELL: disableTypeStr = "spell"; diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index dfee1e2f11f..3b59f283ddb 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -89,5 +89,5 @@ void WorldDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); - PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT * FROM disables WHERE entry = ? AND sourceType = ? AND flags > 0", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ? AND flags > 0", CONNECTION_SYNCH); } -- cgit v1.2.3 From bf6e334c5fd92933e66f099cec371129557ec2b1 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 2 Aug 2012 18:38:55 +0200 Subject: Core/Spells: Fix some summon vehicle spells with basepoint 1 ty zwerg --- src/server/game/Spells/SpellEffects.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 58c24aa895c..886541922c8 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2420,12 +2420,13 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) return; // The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE - uint32 spell = VEHICLE_SPELL_RIDE_HARDCODED; - if (SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue())) - spell = spellProto->Id; + uint32 spellId = VEHICLE_SPELL_RIDE_HARDCODED; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue()); + if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) + spellId = spellInfo->Id; // Hard coded enter vehicle spell - m_originalCaster->CastSpell(summon, spell, true); + m_originalCaster->CastSpell(summon, spellId, true); uint32 faction = properties->Faction; if (!faction) -- cgit v1.2.3 From 02a4501034fc2155002287c9ac06b24cf76fb26f Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 3 Aug 2012 01:24:22 +0300 Subject: Fix Improved concentration aura Fix Improved concentration aura 30% reduce of silence/interrupt --- src/server/game/Spells/Auras/SpellAuras.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index a1ac69826c4..15108b17f84 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1593,6 +1593,11 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b switch (GetId()) { case 19746: + // Improved concentration aura - linked aura + if (caster->HasAura(20254) || caster->HasAura(20255) || caster->HasAura(20256)) + if (apply) + target->CastSpell(target, 63510, true); + else target->RemoveAura(63510); case 31821: // Aura Mastery Triggered Spell Handler // If apply Concentration Aura -> trigger -> apply Aura Mastery Immunity @@ -1619,6 +1624,20 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b target->RemoveAurasDueToSpell(71166); } break; + } + if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_AURA) + { + // Improved devotion aura + if (caster->HasAura(20140) || caster->HasAura(20138) || caster->HasAura(20139)) + if (apply) + caster->CastSpell(target, 63514, true); + else target->RemoveAura(63514); + // 63531 - linked aura for both Sanctified Retribution and Swift Retribution talents + // Not allow for Retribution Aura (prevent stacking) + if ((GetSpellInfo()->SpellIconID != 555) && (caster->HasAura(53648) || caster->HasAura(53484) || caster->HasAura(53379) || caster->HasAura(31869))) + if (apply) + caster->CastSpell(target, 63531, true); + else target->RemoveAura(63531); } break; case SPELLFAMILY_DEATHKNIGHT: -- cgit v1.2.3 From 8e35762b35a07ca3ad096b6430962104d0b97dd4 Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 3 Aug 2012 01:27:39 +0300 Subject: Add missing change in SpellEffects.cpp --- src/server/game/Spells/SpellEffects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 58c24aa895c..e43c64cd388 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3572,8 +3572,8 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex) { if (m_originalCaster) { - int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false, 1 << effIndex); - unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), duration/*GetSpellDuration(m_spellInfo)*/); + int32 duration = m_spellInfo->GetDuration(); + unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), unitTarget->ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1 << effIndex)); } ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo->Id); unitTarget->InterruptSpell(CurrentSpellTypes(i), false); -- cgit v1.2.3 From f85908869986eab0b645f0a697028bcceba7778c Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 3 Aug 2012 00:20:44 +0100 Subject: Core/Misc: Fix code style and a typo for recently merged in PRs --- src/server/game/Spells/Auras/SpellAuras.cpp | 22 ++++++++++++++++------ src/server/scripts/Commands/cs_disable.cpp | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 15108b17f84..8a320ae35e7 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1594,10 +1594,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b { case 19746: // Improved concentration aura - linked aura - if (caster->HasAura(20254) || caster->HasAura(20255) || caster->HasAura(20256)) + if (caster->HasAura(20254) || caster->HasAura(20255) || caster->HasAura(20256)) + { if (apply) target->CastSpell(target, 63510, true); - else target->RemoveAura(63510); + else + target->RemoveAura(63510); + } case 31821: // Aura Mastery Triggered Spell Handler // If apply Concentration Aura -> trigger -> apply Aura Mastery Immunity @@ -1606,6 +1609,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b // Do effects only on aura owner if (GetCasterGUID() != target->GetGUID()) break; + if (apply) { if ((GetSpellInfo()->Id == 31821 && target->HasAura(19746, GetCasterGUID())) || (GetSpellInfo()->Id == 19746 && target->HasAura(31821))) @@ -1625,19 +1629,25 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b } break; } - if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_AURA) - { + if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_AURA) + { // Improved devotion aura if (caster->HasAura(20140) || caster->HasAura(20138) || caster->HasAura(20139)) + { if (apply) caster->CastSpell(target, 63514, true); - else target->RemoveAura(63514); + else + target->RemoveAura(63514); + } // 63531 - linked aura for both Sanctified Retribution and Swift Retribution talents // Not allow for Retribution Aura (prevent stacking) if ((GetSpellInfo()->SpellIconID != 555) && (caster->HasAura(53648) || caster->HasAura(53484) || caster->HasAura(53379) || caster->HasAura(31869))) + { if (apply) caster->CastSpell(target, 63531, true); - else target->RemoveAura(63531); + else + target->RemoveAura(63531); + } } break; case SPELLFAMILY_DEATHKNIGHT: diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index d3475ac10ae..c537f9a972b 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -124,7 +124,7 @@ public: PreparedStatement* stmt2 = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES); stmt2->setUInt32(0, entry); stmt2->setUInt8(1, disableType); - stmt->setUInt16(2, flags); + stmt2->setUInt16(2, flags); stmt2->setString(3, disableComment); WorldDatabase.Execute(stmt2); -- cgit v1.2.3 From 55ce180f2867700b28921d99f9a0cb9c83330c91 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 3 Aug 2012 14:20:18 +0200 Subject: Core/Logging: Add Asyncronous logging with Loggers ("What to log") and Appenders ("Where to log") system. Will allow to select to full log some parts of core while others are not even logged. - Logging System is asyncronous to improve performance. - Each msg and Logger has a Log Type and Log Level assigned. Each msg is assigned the Logger of same Log Type or "root" Logger is selected if there is no Logger configured for the given Log Type - Loggers have a list of Appenders to send the msg to. The Msg in the Logger is not sent to Appenders if the msg LogLevel is lower than Logger LogLevel. - There are three (at the moment) types of Appenders: Console, File or DB (this is WIP, not working ATM). Msg is not written to the resource if msg LogLevel is lower than Appender LogLevel. - Appender and Console Log levels can be changed while server is active with command '.set loglevel (a/l) name level' Explanation of use with Sample config: Appender.Console.Type=1 (1 = Console) Appender.Console.Level=2 (2 = Debug) Appender.Server.Type=2 (2 = File) Appender.Server.Level=3 (3 = Info) Appender.Server.File=Server.log Appender.SQL.Type=2 (2 = File) Appender.SQL.Level=1 (1 = Trace) Appender.SQL.File=sql.log Appenders=Console Server (NOTE: SQL has not been included here... that will make core ignore the config for "SQL" as it's not in this list) Logger.root.Type=0 (0 = Default - if it's not created by config, server will create it with LogLevel = DISABLED) Logger.root.Level=5 (5 = Error) Logger.root.Appenders=Console Logger.SQL.Type=26 (26 = SQL) Logger.SQL.Level=3 (2 = Debug) Logger.SQL.Appenders=Console Server SQL Logger.SomeRandomName.Type=24 (24 = Guild) Logger.SomeRandomName.Level=5 (5 = Error) Loggers=root SQL SomeRandomName * At loading Appender SQL will be ignored, as it's not present on "Appenders" * sLog->outDebug(LOG_FILTER_GUILD, "Some log msg related to Guilds") - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomName is found but it's LogLevel = 5 and Msg LogLevel=2... Msg is not logged * sLog->outError(LOG_FILTER_GUILD, "Some error log msg related to Guilds") - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomeName is found with proper LogLevel but Logger does not have any Appenders assigned to that logger... Msg is not logged * sLog->outDebug(LOG_FILTER_SQL, "Some msg related to SQLs") - Msg is sent to Logger SQL (matches type), as it matches LogLevel the msg is sent to Appenders Console, Server and SQL - Appender Console has lower Log Level: Msg is logged to Console - Appender Server has higher Log Level: Msg is not logged to file - Appender SQL has lower Log Level: Msg is logged to file sql.log * sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Some msg related to Battelgrounds") - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). As Logger has higher LogLevel msg is not sent to any appender * sLog->outError(LOG_FILTER_BATTLEGROUND, "Some error msg related to Battelgrounds") - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). Msg has lower LogLevel and is sent to Appender Console - Appender Console has lower LogLevel: Msg is logged to Console --- src/server/authserver/Main.cpp | 71 +- src/server/authserver/Realms/RealmList.cpp | 4 +- src/server/authserver/Server/AuthSocket.cpp | 76 +- src/server/authserver/Server/RealmAcceptor.h | 4 +- src/server/authserver/Server/RealmSocket.cpp | 2 +- src/server/authserver/authserver.conf.dist | 222 ++-- src/server/collision/Management/VMapManager2.cpp | 4 +- src/server/collision/Maps/MapTree.cpp | 10 +- src/server/collision/Models/GameObjectModel.cpp | 10 +- src/server/game/AI/CoreAI/CombatAI.cpp | 4 +- src/server/game/AI/CoreAI/PassiveAI.h | 1 - src/server/game/AI/CoreAI/PetAI.cpp | 5 +- src/server/game/AI/CoreAI/UnitAI.cpp | 2 +- src/server/game/AI/CreatureAI.cpp | 4 +- src/server/game/AI/CreatureAIRegistry.cpp | 1 - src/server/game/AI/CreatureAISelector.cpp | 1 - src/server/game/AI/EventAI/CreatureEventAI.cpp | 61 +- src/server/game/AI/EventAI/CreatureEventAI.h | 1 - src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 248 ++-- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 8 +- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 36 +- src/server/game/AI/ScriptedAI/ScriptedEscortAI.h | 1 - .../game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 20 +- src/server/game/AI/SmartScripts/SmartAI.cpp | 23 +- src/server/game/AI/SmartScripts/SmartScript.cpp | 36 +- src/server/game/AI/SmartScripts/SmartScript.h | 6 +- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 112 +- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 28 +- src/server/game/Achievements/AchievementMgr.cpp | 138 +- src/server/game/Addons/AddonMgr.cpp | 8 +- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 43 +- src/server/game/Battlegrounds/ArenaTeam.cpp | 18 +- src/server/game/Battlegrounds/ArenaTeamMgr.cpp | 10 +- src/server/game/Battlegrounds/Battleground.cpp | 48 +- src/server/game/Battlegrounds/BattlegroundMgr.cpp | 42 +- .../game/Battlegrounds/BattlegroundQueue.cpp | 14 +- .../game/Battlegrounds/Zones/BattlegroundAB.cpp | 10 +- .../game/Battlegrounds/Zones/BattlegroundAV.cpp | 50 +- .../game/Battlegrounds/Zones/BattlegroundBE.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundDS.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundEY.cpp | 24 +- .../game/Battlegrounds/Zones/BattlegroundIC.cpp | 20 +- .../game/Battlegrounds/Zones/BattlegroundNA.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundRL.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundSA.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundWS.cpp | 14 +- src/server/game/Calendar/CalendarMgr.cpp | 18 +- src/server/game/Chat/Channels/Channel.cpp | 6 +- src/server/game/Chat/Channels/ChannelMgr.h | 1 - src/server/game/Chat/Chat.cpp | 8 +- src/server/game/Combat/HostileRefManager.h | 1 - src/server/game/Combat/ThreatManager.cpp | 1 - src/server/game/Combat/UnitEvents.h | 2 - src/server/game/Conditions/ConditionMgr.cpp | 294 ++--- src/server/game/Conditions/DisableMgr.cpp | 62 +- src/server/game/DataStores/DBCStores.cpp | 14 +- src/server/game/DungeonFinding/LFGMgr.cpp | 28 +- src/server/game/Entities/Corpse/Corpse.cpp | 6 +- src/server/game/Entities/Creature/Creature.cpp | 44 +- .../game/Entities/Creature/CreatureGroups.cpp | 12 +- src/server/game/Entities/Creature/GossipDef.cpp | 2 +- .../game/Entities/Creature/TemporarySummon.cpp | 4 +- .../game/Entities/DynamicObject/DynamicObject.cpp | 2 +- src/server/game/Entities/GameObject/GameObject.cpp | 22 +- src/server/game/Entities/Item/Container/Bag.cpp | 2 +- src/server/game/Entities/Item/Item.cpp | 12 +- .../game/Entities/Item/ItemEnchantmentMgr.cpp | 10 +- src/server/game/Entities/Object/Object.cpp | 64 +- .../game/Entities/Object/Updates/UpdateData.cpp | 10 +- src/server/game/Entities/Pet/Pet.cpp | 22 +- src/server/game/Entities/Player/Player.cpp | 266 ++-- src/server/game/Entities/Transport/Transport.cpp | 46 +- src/server/game/Entities/Unit/Unit.cpp | 217 +-- src/server/game/Events/GameEventMgr.cpp | 236 ++-- src/server/game/Globals/ObjectAccessor.cpp | 2 +- src/server/game/Globals/ObjectAccessor.h | 4 +- src/server/game/Globals/ObjectMgr.cpp | 1394 ++++++++++---------- src/server/game/Globals/ObjectMgr.h | 8 +- src/server/game/Grids/GridStates.h | 2 +- src/server/game/Grids/ObjectGridLoader.cpp | 2 +- src/server/game/Groups/Group.cpp | 4 +- src/server/game/Groups/GroupMgr.cpp | 38 +- src/server/game/Guilds/Guild.cpp | 49 +- src/server/game/Guilds/GuildMgr.cpp | 88 +- src/server/game/Handlers/AddonHandler.cpp | 2 +- src/server/game/Handlers/AuctionHouseHandler.cpp | 12 +- src/server/game/Handlers/BattleGroundHandler.cpp | 16 +- src/server/game/Handlers/CalendarHandler.cpp | 8 +- src/server/game/Handlers/CharacterHandler.cpp | 54 +- src/server/game/Handlers/ChatHandler.cpp | 6 +- src/server/game/Handlers/CombatHandler.cpp | 2 +- src/server/game/Handlers/DuelHandler.cpp | 4 +- src/server/game/Handlers/GroupHandler.cpp | 8 +- src/server/game/Handlers/ItemHandler.cpp | 14 +- src/server/game/Handlers/MailHandler.cpp | 6 +- src/server/game/Handlers/MiscHandler.cpp | 36 +- src/server/game/Handlers/MovementHandler.cpp | 18 +- src/server/game/Handlers/PetHandler.cpp | 46 +- src/server/game/Handlers/PetitionsHandler.cpp | 4 +- src/server/game/Handlers/QueryHandler.cpp | 2 +- src/server/game/Handlers/QuestHandler.cpp | 14 +- src/server/game/Handlers/SpellHandler.cpp | 16 +- src/server/game/Handlers/TradeHandler.cpp | 12 +- src/server/game/Handlers/VehicleHandler.cpp | 20 +- src/server/game/Instances/InstanceSaveMgr.cpp | 16 +- src/server/game/Instances/InstanceScript.cpp | 10 +- src/server/game/Instances/InstanceScript.h | 11 +- src/server/game/Loot/LootMgr.cpp | 124 +- src/server/game/Mails/Mail.cpp | 2 +- src/server/game/Maps/Map.cpp | 92 +- src/server/game/Maps/MapInstanced.cpp | 4 +- src/server/game/Maps/MapManager.cpp | 4 +- src/server/game/Miscellaneous/Formulas.h | 2 +- src/server/game/Movement/MotionMaster.cpp | 64 +- .../WaypointMovementGenerator.cpp | 6 +- src/server/game/Movement/Spline/MoveSpline.cpp | 6 +- .../game/Movement/Waypoints/WaypointManager.cpp | 8 +- src/server/game/OutdoorPvP/OutdoorPvP.cpp | 4 +- src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp | 16 +- src/server/game/Pools/PoolMgr.cpp | 85 +- src/server/game/Reputation/ReputationMgr.cpp | 4 +- src/server/game/Scripting/MapScripts.cpp | 102 +- src/server/game/Scripting/ScriptMgr.cpp | 34 +- src/server/game/Scripting/ScriptMgr.h | 2 +- src/server/game/Scripting/ScriptSystem.cpp | 58 +- src/server/game/Server/Protocol/PacketLog.cpp | 62 - src/server/game/Server/Protocol/PacketLog.h | 50 - src/server/game/Server/WorldSession.cpp | 63 +- src/server/game/Server/WorldSocket.cpp | 126 +- src/server/game/Server/WorldSocketAcceptor.h | 4 +- src/server/game/Server/WorldSocketMgr.cpp | 18 +- src/server/game/Skills/SkillDiscovery.cpp | 20 +- src/server/game/Skills/SkillExtraItems.cpp | 16 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 28 +- src/server/game/Spells/Auras/SpellAuras.cpp | 10 +- src/server/game/Spells/Spell.cpp | 44 +- src/server/game/Spells/SpellEffects.cpp | 50 +- src/server/game/Spells/SpellInfo.cpp | 6 +- src/server/game/Spells/SpellMgr.cpp | 290 ++-- src/server/game/Spells/SpellScript.cpp | 82 +- src/server/game/Texts/CreatureTextMgr.cpp | 26 +- src/server/game/Tickets/TicketMgr.cpp | 12 +- src/server/game/Tools/CharacterDatabaseCleaner.cpp | 8 +- src/server/game/Tools/PlayerDump.cpp | 8 +- src/server/game/Warden/Warden.cpp | 2 +- src/server/game/Warden/WardenCheckMgr.cpp | 28 +- src/server/game/Warden/WardenMac.cpp | 2 +- src/server/game/Warden/WardenWin.cpp | 8 +- src/server/game/Weather/Weather.cpp | 6 +- src/server/game/Weather/WeatherMgr.cpp | 14 +- src/server/game/World/World.cpp | 486 ++++--- src/server/scripts/Commands/cs_account.cpp | 22 +- src/server/scripts/Commands/cs_debug.cpp | 4 +- src/server/scripts/Commands/cs_gobject.cpp | 2 +- src/server/scripts/Commands/cs_misc.cpp | 6 +- src/server/scripts/Commands/cs_modify.cpp | 6 +- src/server/scripts/Commands/cs_npc.cpp | 8 +- src/server/scripts/Commands/cs_reload.cpp | 192 +-- src/server/scripts/Commands/cs_reset.cpp | 2 +- src/server/scripts/Commands/cs_server.cpp | 37 +- .../BlackrockDepths/blackrock_depths.cpp | 2 +- .../BlackrockDepths/instance_blackrock_depths.cpp | 4 +- .../BlackwingLair/boss_victor_nefarius.cpp | 2 +- .../EasternKingdoms/Karazhan/bosses_opera.cpp | 6 +- .../scripts/EasternKingdoms/Karazhan/karazhan.cpp | 8 +- .../scripts/EasternKingdoms/Karazhan/karazhan.h | 2 +- .../MagistersTerrace/boss_selin_fireheart.cpp | 8 +- .../instance_magisters_terrace.cpp | 2 +- .../EasternKingdoms/ScarletEnclave/chapter1.cpp | 10 +- .../Stratholme/instance_stratholme.cpp | 14 +- .../SunwellPlateau/boss_brutallus.cpp | 2 +- .../SunwellPlateau/boss_kalecgos.cpp | 2 +- .../SunwellPlateau/boss_kiljaeden.cpp | 2 +- .../SunwellPlateau/instance_sunwell_plateau.cpp | 2 +- .../EasternKingdoms/ZulAman/boss_janalai.cpp | 4 +- .../EasternKingdoms/ZulAman/instance_zulaman.cpp | 8 +- .../EasternKingdoms/ZulGurub/boss_arlokk.cpp | 2 +- .../scripts/EasternKingdoms/silverpine_forest.cpp | 2 +- src/server/scripts/Examples/example_spell.cpp | 46 +- .../CavernsOfTime/BattleForMountHyjal/hyjal.cpp | 4 +- .../CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp | 8 +- .../BattleForMountHyjal/instance_hyjal.cpp | 2 +- .../CavernsOfTime/DarkPortal/dark_portal.cpp | 4 +- .../DarkPortal/instance_dark_portal.cpp | 10 +- .../instance_old_hillsbrad.cpp | 20 +- .../RazorfenKraul/instance_razorfen_kraul.cpp | 2 +- .../Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp | 4 +- src/server/scripts/Kalimdor/azuremyst_isle.cpp | 2 +- .../instance_trial_of_the_crusader.cpp | 2 +- .../scripts/Northrend/Naxxramas/boss_gothik.cpp | 2 +- .../UtgardeKeep/instance_utgarde_keep.cpp | 2 +- .../ShadowLabyrinth/instance_shadow_labyrinth.cpp | 8 +- .../scripts/Outland/BlackTemple/boss_illidan.cpp | 2 +- .../Outland/BlackTemple/boss_shade_of_akama.cpp | 16 +- .../Outland/BlackTemple/illidari_council.cpp | 6 +- .../Outland/BlackTemple/instance_black_temple.cpp | 2 +- .../SteamVault/instance_steam_vault.cpp | 4 +- .../instance_hellfire_ramparts.cpp | 2 +- .../Outland/TempestKeep/Eye/boss_kaelthas.cpp | 4 +- src/server/scripts/Outland/hellfire_peninsula.cpp | 2 +- src/server/scripts/Outland/netherstorm.cpp | 2 +- src/server/scripts/Spells/spell_rogue.cpp | 2 +- src/server/scripts/Spells/spell_warlock.cpp | 2 +- src/server/scripts/World/chat_log.cpp | 42 +- src/server/scripts/World/go_scripts.cpp | 2 +- src/server/scripts/World/npc_professions.cpp | 2 +- src/server/scripts/World/npcs_special.cpp | 8 +- src/server/shared/Configuration/Config.cpp | 8 +- src/server/shared/Configuration/Config.h | 1 - .../shared/Cryptography/Authentication/AuthCrypt.h | 1 - src/server/shared/DataStores/DBCStore.h | 10 +- src/server/shared/Database/DatabaseWorkerPool.h | 16 +- src/server/shared/Database/Field.h | 24 +- src/server/shared/Database/MySQLConnection.cpp | 108 +- src/server/shared/Database/MySQLThreading.h | 4 +- src/server/shared/Database/PreparedStatement.cpp | 4 +- src/server/shared/Database/QueryHolder.cpp | 8 +- src/server/shared/Database/QueryResult.cpp | 4 +- src/server/shared/Debugging/Errors.h | 8 +- src/server/shared/Logging/Appender.cpp | 153 +++ src/server/shared/Logging/Appender.h | 115 ++ src/server/shared/Logging/AppenderConsole.cpp | 174 +++ src/server/shared/Logging/AppenderConsole.h | 42 + src/server/shared/Logging/AppenderDB.cpp | 30 + src/server/shared/Logging/AppenderDB.h | 19 + src/server/shared/Logging/AppenderFile.cpp | 54 + src/server/shared/Logging/AppenderFile.h | 22 + src/server/shared/Logging/Log.cpp | 1135 ++++------------ src/server/shared/Logging/Log.h | 209 +-- src/server/shared/Logging/LogOperation.cpp | 14 + src/server/shared/Logging/LogOperation.h | 24 + src/server/shared/Logging/LogWorker.cpp | 33 + src/server/shared/Logging/LogWorker.h | 30 + src/server/shared/Logging/Logger.cpp | 67 + src/server/shared/Logging/Logger.h | 29 + src/server/shared/Packets/ByteBuffer.h | 80 +- src/server/shared/Utilities/ServiceWin32.cpp | 2 +- src/server/worldserver/CommandLine/CliRunnable.cpp | 2 +- src/server/worldserver/Main.cpp | 22 +- src/server/worldserver/Master.cpp | 86 +- src/server/worldserver/RemoteAccess/RARunnable.cpp | 6 +- src/server/worldserver/RemoteAccess/RASocket.cpp | 30 +- src/server/worldserver/TCSoap/TCSoap.cpp | 6 +- src/server/worldserver/worldserver.conf.dist | 478 +++---- 245 files changed, 5127 insertions(+), 5408 deletions(-) delete mode 100644 src/server/game/Server/Protocol/PacketLog.cpp delete mode 100644 src/server/game/Server/Protocol/PacketLog.h create mode 100644 src/server/shared/Logging/Appender.cpp create mode 100644 src/server/shared/Logging/Appender.h create mode 100644 src/server/shared/Logging/AppenderConsole.cpp create mode 100644 src/server/shared/Logging/AppenderConsole.h create mode 100644 src/server/shared/Logging/AppenderDB.cpp create mode 100644 src/server/shared/Logging/AppenderDB.h create mode 100644 src/server/shared/Logging/AppenderFile.cpp create mode 100644 src/server/shared/Logging/AppenderFile.h create mode 100644 src/server/shared/Logging/LogOperation.cpp create mode 100644 src/server/shared/Logging/LogOperation.h create mode 100644 src/server/shared/Logging/LogWorker.cpp create mode 100644 src/server/shared/Logging/LogWorker.h create mode 100644 src/server/shared/Logging/Logger.cpp create mode 100644 src/server/shared/Logging/Logger.h (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 01a33d836d6..b2828b3ffac 100755 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -63,7 +63,7 @@ public: /// Print out the usage string for this program on the console. void usage(const char *prog) { - sLog->outString("Usage: \n %s []\n" + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Usage: \n %s []\n" " -c config_file use config_file as configuration file\n\r", prog); } @@ -71,7 +71,6 @@ void usage(const char *prog) // Launch the auth server extern int main(int argc, char **argv) { - sLog->SetLogDB(false); // Command line parsing to get the configuration file name char const* cfg_file = _TRINITY_REALM_CONFIG; int c = 1; @@ -81,7 +80,7 @@ extern int main(int argc, char **argv) { if (++c >= argc) { - sLog->outError("Runtime-Error: -c option requires an input argument"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Runtime-Error: -c option requires an input argument"); usage(argv[0]); return 1; } @@ -93,17 +92,16 @@ extern int main(int argc, char **argv) if (!ConfigMgr::Load(cfg_file)) { - sLog->outError("Invalid or missing configuration file : %s", cfg_file); - sLog->outError("Verify that the file exists and has \'[authserver]\' written in the top of the file!"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Invalid or missing configuration file : %s", cfg_file); + sLog->outError(LOG_FILTER_AUTHSERVER, "Verify that the file exists and has \'[authserver]\' written in the top of the file!"); return 1; } - sLog->Initialize(); - sLog->outString("%s (authserver)", _FULLVERSION); - sLog->outString(" to stop.\n"); - sLog->outString("Using configuration file %s.", cfg_file); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION); + sLog->outInfo(LOG_FILTER_AUTHSERVER, " to stop.\n"); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", cfg_file); - sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + sLog->outWarn(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true); @@ -111,7 +109,7 @@ extern int main(int argc, char **argv) ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true); #endif - sLog->outBasic("Max allowed open files is %d", ACE::max_handles()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles()); // authserver PID file creation std::string pidfile = ConfigMgr::GetStringDefault("PidFile", ""); @@ -120,27 +118,23 @@ extern int main(int argc, char **argv) uint32 pid = CreatePIDFile(pidfile); if (!pid) { - sLog->outError("Cannot create PID file %s.\n", pidfile.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidfile.c_str()); return 1; } - - sLog->outString("Daemon PID: %u\n", pid); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid); } // Initialize the database connection if (!StartDB()) return 1; - // Initialize the log database - sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished. - sLog->SetLogDB(false); sLog->SetRealmID(0); // ensure we've set realm to 0 (authserver realmid) // Get the list of realms for the server sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20)); if (sRealmList->size() == 0) { - sLog->outError("No valid realms specified."); + sLog->outError(LOG_FILTER_AUTHSERVER, "No valid realms specified."); return 1; } @@ -154,7 +148,7 @@ extern int main(int argc, char **argv) if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) { - sLog->outError("Auth server can not bind to %s:%d", bind_ip.c_str(), rmport); + sLog->outError(LOG_FILTER_AUTHSERVER, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport); return 1; } @@ -182,13 +176,13 @@ extern int main(int argc, char **argv) ULONG_PTR curAff = Aff & appAff; // remove non accessible processors if (!curAff) - sLog->outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff); + sLog->outError(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff); else if (SetProcessAffinityMask(hProcess, curAff)) - sLog->outString("Using processors (bitmask, hex): %x", curAff); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", curAff); else - sLog->outError("Can't set used processors (hex): %x", curAff); + sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", curAff); } - sLog->outString(); + } bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false); @@ -196,10 +190,10 @@ extern int main(int argc, char **argv) if (Prio) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - sLog->outString("The auth server process priority class has been set to HIGH"); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "The auth server process priority class has been set to HIGH"); else - sLog->outError("Can't set auth server process priority class."); - sLog->outString(); + sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set auth server process priority class."); + } } #endif @@ -208,17 +202,6 @@ extern int main(int argc, char **argv) uint32 numLoops = (ConfigMgr::GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000)); uint32 loopCounter = 0; - // possibly enable db logging; avoid massive startup spam by doing it here. - if (sLog->GetLogDBLater()) - { - sLog->outString("Enabling database logging..."); - sLog->SetLogDBLater(false); - // login db needs thread for logging - sLog->SetLogDB(true); - } - else - sLog->SetLogDB(false); - // Wait for termination signal while (!stopEvent) { @@ -231,7 +214,7 @@ extern int main(int argc, char **argv) if ((++loopCounter) == numLoops) { loopCounter = 0; - sLog->outDetail("Ping MySQL to keep connection alive"); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Ping MySQL to keep connection alive"); LoginDatabase.KeepAlive(); } } @@ -239,7 +222,7 @@ extern int main(int argc, char **argv) // Close the Database Pool and library StopDB(); - sLog->outString("Halting process..."); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Halting process..."); return 0; } @@ -251,31 +234,33 @@ bool StartDB() std::string dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", ""); if (dbstring.empty()) { - sLog->outError("Database not specified"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Database not specified"); return false; } uint8 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1); if (worker_threads < 1 || worker_threads > 32) { - sLog->outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); + sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); worker_threads = 1; } uint8 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1); if (synch_threads < 1 || synch_threads > 32) { - sLog->outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); + sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); synch_threads = 1; } // NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever. if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads)) { - sLog->outError("Cannot connect to database"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot connect to database"); return false; } + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Started auth database connection pool."); + sLog->EnableDBAppenders(); return true; } diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index d988b940809..453efd5bf72 100755 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -68,7 +68,7 @@ void RealmList::UpdateIfNeed() void RealmList::UpdateRealms(bool init) { - sLog->outDetail("Updating Realm List..."); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Updating Realm List..."); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); PreparedQueryResult result = LoginDatabase.Query(stmt); @@ -93,7 +93,7 @@ void RealmList::UpdateRealms(bool init) UpdateRealm(realmId, name, address, port, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); if (init) - sLog->outString("Added realm \"%s\".", fields[1].GetCString()); + sLog->outInfo(LOG_FILTER_AUTHSERVER, "Added realm \"%s\".", fields[1].GetCString()); } while (result->NextRow()); } diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 15555e4d607..0794d9a802a 100755 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -210,12 +210,12 @@ AuthSocket::~AuthSocket(void) {} // Accept the connection and set the s random value for SRP6 void AuthSocket::OnAccept(void) { - sLog->outBasic("'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort()); } void AuthSocket::OnClose(void) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "AuthSocket::OnClose"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "AuthSocket::OnClose"); } // Read the packet from the client @@ -234,11 +234,11 @@ void AuthSocket::OnRead() { if ((uint8)table[i].cmd == _cmd && (table[i].status == STATUS_CONNECTED || (_authed && table[i].status == STATUS_AUTHED))) { - sLog->outStaticDebug("[Auth] got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); if (!(*this.*table[i].handler)()) { - sLog->outStaticDebug("Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); return; } break; @@ -248,7 +248,7 @@ void AuthSocket::OnRead() // Report unknown packets in the error log if (i == AUTH_TOTAL_COMMANDS) { - sLog->outError("[Auth] got unknown packet from '%s'", socket().getRemoteAddress().c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "Got unknown packet from '%s'", socket().getRemoteAddress().c_str()); socket().shutdown(); return; } @@ -297,7 +297,7 @@ void AuthSocket::_SetVSFields(const std::string& rI) // Logon Challenge command handler bool AuthSocket::_HandleLogonChallenge() { - sLog->outStaticDebug("Entering _HandleLogonChallenge"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonChallenge"); if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) return false; @@ -312,7 +312,7 @@ bool AuthSocket::_HandleLogonChallenge() #endif uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; - sLog->outStaticDebug("[AuthChallenge] got header, body is %#04x bytes", remaining); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got header, body is %#04x bytes", remaining); if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) return false; @@ -324,8 +324,8 @@ bool AuthSocket::_HandleLogonChallenge() // Read the remaining of the packet socket().recv((char *)&buf[4], remaining); - sLog->outStaticDebug("[AuthChallenge] got full packet, %#04x bytes", ch->size); - sLog->outStaticDebug("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got full packet, %#04x bytes", ch->size); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); // BigEndian code, nop in little endian case // size already converted @@ -365,7 +365,7 @@ bool AuthSocket::_HandleLogonChallenge() if (result) { pkt << (uint8)WOW_FAIL_BANNED; - sLog->outBasic("'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort()); } else { @@ -383,20 +383,20 @@ bool AuthSocket::_HandleLogonChallenge() bool locked = false; if (fields[2].GetUInt8() == 1) // if ip is locked { - sLog->outStaticDebug("[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString()); - sLog->outStaticDebug("[AuthChallenge] Player address is '%s'", ip_address.c_str()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Player address is '%s'", ip_address.c_str()); if (strcmp(fields[3].GetCString(), ip_address.c_str())) { - sLog->outStaticDebug("[AuthChallenge] Account IP differs"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP differs"); pkt << (uint8) WOW_FAIL_SUSPENDED; locked = true; } else - sLog->outStaticDebug("[AuthChallenge] Account IP matches"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP matches"); } else - sLog->outStaticDebug("[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); if (!locked) { @@ -412,12 +412,12 @@ bool AuthSocket::_HandleLogonChallenge() if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64()) { pkt << (uint8)WOW_FAIL_BANNED; - sLog->outBasic("'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); } else { pkt << (uint8)WOW_FAIL_SUSPENDED; - sLog->outBasic("'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); } } else @@ -488,7 +488,7 @@ bool AuthSocket::_HandleLogonChallenge() for (int i = 0; i < 4; ++i) _localizationName[i] = ch->country[4-i-1]; - sLog->outBasic("'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName) ); } @@ -505,7 +505,7 @@ bool AuthSocket::_HandleLogonChallenge() // Logon Proof command handler bool AuthSocket::_HandleLogonProof() { - sLog->outStaticDebug("Entering _HandleLogonProof"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonProof"); // Read the packet sAuthLogonProof_C lp; @@ -600,7 +600,7 @@ bool AuthSocket::_HandleLogonProof() // Check if SRP6 results match (password is correct), else send an error if (!memcmp(M.AsByteArray(), lp.M1, 20)) { - sLog->outBasic("'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account // No SQL injection (escaped user name) and IP address as received by socket @@ -649,7 +649,7 @@ bool AuthSocket::_HandleLogonProof() char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; socket().send(data, sizeof(data)); - sLog->outBasic("'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); uint32 MaxWrongPassCount = ConfigMgr::GetIntDefault("WrongPass.MaxCount", 0); if (MaxWrongPassCount > 0) @@ -679,7 +679,7 @@ bool AuthSocket::_HandleLogonProof() stmt->setUInt32(1, WrongPassBanTime); LoginDatabase.Execute(stmt); - sLog->outBasic("'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins); } else @@ -689,7 +689,7 @@ bool AuthSocket::_HandleLogonProof() stmt->setUInt32(1, WrongPassBanTime); LoginDatabase.Execute(stmt); - sLog->outBasic("'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", + sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", socket().getRemoteAddress().c_str(), socket().getRemotePort(), socket().getRemoteAddress().c_str(), WrongPassBanTime, _login.c_str(), failed_logins); } } @@ -703,7 +703,7 @@ bool AuthSocket::_HandleLogonProof() // Reconnect Challenge command handler bool AuthSocket::_HandleReconnectChallenge() { - sLog->outStaticDebug("Entering _HandleReconnectChallenge"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectChallenge"); if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) return false; @@ -718,7 +718,7 @@ bool AuthSocket::_HandleReconnectChallenge() #endif uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; - sLog->outStaticDebug("[ReconnectChallenge] got header, body is %#04x bytes", remaining); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got header, body is %#04x bytes", remaining); if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) return false; @@ -730,8 +730,8 @@ bool AuthSocket::_HandleReconnectChallenge() // Read the remaining of the packet socket().recv((char *)&buf[4], remaining); - sLog->outStaticDebug("[ReconnectChallenge] got full packet, %#04x bytes", ch->size); - sLog->outStaticDebug("[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got full packet, %#04x bytes", ch->size); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); _login = (const char*)ch->I; @@ -742,7 +742,7 @@ bool AuthSocket::_HandleReconnectChallenge() // Stop if the account is not found if (!result) { - sLog->outError("'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -778,7 +778,7 @@ bool AuthSocket::_HandleReconnectChallenge() // Reconnect Proof command handler bool AuthSocket::_HandleReconnectProof() { - sLog->outStaticDebug("Entering _HandleReconnectProof"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectProof"); // Read the packet sAuthReconnectProof_C lp; if (!socket().recv((char *)&lp, sizeof(sAuthReconnectProof_C))) @@ -809,7 +809,7 @@ bool AuthSocket::_HandleReconnectProof() } else { - sLog->outError("'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -818,7 +818,7 @@ bool AuthSocket::_HandleReconnectProof() // Realm List command handler bool AuthSocket::_HandleRealmList() { - sLog->outStaticDebug("Entering _HandleRealmList"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleRealmList"); if (socket().recv_len() < 5) return false; @@ -831,7 +831,7 @@ bool AuthSocket::_HandleRealmList() PreparedQueryResult result = LoginDatabase.Query(stmt); if (!result) { - sLog->outError("'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -927,11 +927,11 @@ bool AuthSocket::_HandleRealmList() // Resume patch transfer bool AuthSocket::_HandleXferResume() { - sLog->outStaticDebug("Entering _HandleXferResume"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferResume"); // Check packet length and patch existence if (socket().recv_len() < 9 || !pPatch) { - sLog->outError("Error while resuming patch transfer (wrong packet)"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Error while resuming patch transfer (wrong packet)"); return false; } @@ -948,7 +948,7 @@ bool AuthSocket::_HandleXferResume() // Cancel patch transfer bool AuthSocket::_HandleXferCancel() { - sLog->outStaticDebug("Entering _HandleXferCancel"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferCancel"); // Close and delete the socket socket().recv_skip(1); //clear input buffer @@ -960,12 +960,12 @@ bool AuthSocket::_HandleXferCancel() // Accept patch transfer bool AuthSocket::_HandleXferAccept() { - sLog->outStaticDebug("Entering _HandleXferAccept"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferAccept"); // Check packet length and patch existence if (!pPatch) { - sLog->outError("Error while accepting patch transfer (wrong packet)"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Error while accepting patch transfer (wrong packet)"); return false; } @@ -1050,7 +1050,7 @@ void Patcher::LoadPatchMD5(char *szFileName) if (!pPatch) { - sLog->outError("Error loading patch %s\n", path.c_str()); + sLog->outError(LOG_FILTER_AUTHSERVER, "Error loading patch %s\n", path.c_str()); return; } diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h index 32f4f3e4122..b764e4d2494 100755 --- a/src/server/authserver/Server/RealmAcceptor.h +++ b/src/server/authserver/Server/RealmAcceptor.h @@ -48,7 +48,7 @@ protected: virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/) { - sLog->outBasic("Resuming acceptor"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "Resuming acceptor"); reactor()->cancel_timer(this, 1); return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK); } @@ -58,7 +58,7 @@ protected: #if defined(ENFILE) && defined(EMFILE) if (errno == ENFILE || errno == EMFILE) { - sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds"); + sLog->outError(LOG_FILTER_AUTHSERVER, "Out of file descriptors, suspending incoming connections for 10 seconds"); reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); reactor()->schedule_timer(this, NULL, ACE_Time_Value(10)); } diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp index e839457d1c9..c868bb43777 100755 --- a/src/server/authserver/Server/RealmSocket.cpp +++ b/src/server/authserver/Server/RealmSocket.cpp @@ -59,7 +59,7 @@ int RealmSocket::open(void * arg) if (peer().get_remote_addr(addr) == -1) { - sLog->outError("Error %s while opening realm socket!", ACE_OS::strerror(errno)); + sLog->outError(LOG_FILTER_AUTHSERVER, "Error %s while opening realm socket!", ACE_OS::strerror(errno)); return -1; } diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index e9ed4bd752d..875d952b14c 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -69,114 +69,124 @@ BindIP = "0.0.0.0" PidFile = "" # -# LogLevel -# Description: Server console level of logging -# Default: 0 - (Minimum) -# 1 - (Basic) -# 2 - (Detail) -# 3 - (Full/Debug) - -LogLevel = 0 - -# -# LogFile -# Description: Log file for main server log. -# Default: "Auth.log" - (Enabled) -# "" - (Disabled) - -LogFile = "Auth.log" - -# -# Debug Log Mask -# Description: Bitmask that determines which debug log output (level 3) -# will be logged. -# Possible flags: -# -# 64 - Anything related to network input/output, -# such as packet handlers and netcode logs -# -# Simply add the values together to create a bitmask. -# For more info see enum DebugLogFilters in Log.h -# -# Default: 0 (nothing) - -DebugLogMask = 64 - -# -# SQLDriverLogFile -# Description: Log file for SQL driver events. -# Example: "SQLDriver.log" - (Enabled) -# Default: "" - (Disabled) - -SQLDriverLogFile = "" - -# -# SQLDriverQueryLogging -# Description: Log SQL queries to the SQLDriverLogFile and console. -# Default: 0 - (Disabled, Query errors only) -# 1 - (Enabled, Full query logging - may have performance impact) - -SQLDriverQueryLogging = 0 - -# -# LogTimestamp -# Description: Append timestamp to the server log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext +# Appender config values: Given a appender "name" the following options +# can be read: +# +# Appender.name.Type +# Description: Type of appender. Extra appender config options +# will be read depending on this value +# Default: 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# Appender.name.Level +# Description: Appender level of logging # Default: 0 - (Disabled) -# 1 - (Enabled) - -LogTimestamp = 0 - -# -# LogFileLevel -# Description: Server file level of logging -# Default: 0 - (Minimum) -# 1 - (Basic) -# 2 - (Detail) -# 3 - (Full/Debug) - -LogFileLevel = 0 - -# -# LogColors -# Description: Colors for log messages (Format: "normal basic detail debug"). -# Colors: 0 - Black -# 1 - Red -# 2 - Green -# 3 - Brown -# 4 - Blue -# 5 - Magenta -# 6 - Cyan -# 7 - Grey -# 8 - Yellow -# 9 - Lred -# 10 - Lgreen -# 11 - Lblue -# 12 - Lmagenta -# 13 - Lcyan -# 14 - White -# Example: "13 11 9 5" - (Enabled) -# Default: "" - (Disabled) - -LogColors = "" - -# -# EnableLogDB -# Description: Write log messages to database (LogDatabaseInfo). +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Appender.name.Colors +# Description: Colors for log messages +# (Format: "fatal error warn info debug trace"). +# (Only used with Type = 1) +# Default: "" - no colors +# Colors: 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# Appender.name.File +# Description: Name of the file +# Allows to use one "%u" to create dynamic files +# (Only used with Type = 2) +# +# Appender.name.Mode +# Description: Mode to open the file +# (Only used with Type = 2) +# Default: a - (Append) +# w - (Overwrite) +# +# Appender.name.Backup +# Description: Make a backup of existing file before overwrite +# (Only used with Mode = w) +# Default: 0 - false +# 1 - true +# +# Appender.name.Timestamp +# Description: Append timestamp to the log file name. +# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext +# (Only used with Type = 2) +# +# Logger config values: Given a logger "name" the following options +# can be read: +# +# Logger.name.Type +# Description: Type of logger. Logs anything related to... +# If no logger with type = 0 exists core will create +# it but disabled. Logger with type = 0 is the +# default one, used when there is no other specific +# logger configured for other logger types +# Default: 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 7 - Network input/output, +# 30 - Authserver +# +# Logger.name.Level +# Description: Logger level of logging # Default: 0 - (Disabled) -# 1 - (Enabled) - -EnableLogDB = 0 - -# -# DBLogLevel -# Description: Log level of databases logging. -# Default: 1 - (Basic) -# 0 - (Minimum) -# 2 - (Detail) -# 3 - (Full/Debug) - -DBLogLevel = 1 +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Logger.name.Appenders +# Description: List of appenders linked to logger +# (Using spaces as separator). +# +# Appenders +# Description: List of Appenders to read from config +# (Using spaces as separator). +# Default: "Console Auth" +# +# Loggers +# Description: List of Loggers to read from config +# (Using spaces as separator). +# Default: "root" + +Loggers=root +Appenders=Console Auth + +Appender.Console.Type=1 +Appender.Console.Level=2 + +Appender.Auth.Type=2 +Appender.Auth.Level=2 +Appender.Auth.File=Auth.log +Appender.Auth.Mode=w + +Logger.root.Type=0 +Logger.root.Level=3 +Logger.root.Appenders=Console Auth # # UseProcessors diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index b9f0f25c2f9..81328d31d7b 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -257,7 +257,7 @@ namespace VMAP WorldModel* worldmodel = new WorldModel(); if (!worldmodel->readFile(basepath + filename + ".vmo")) { - sLog->outError("VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str()); delete worldmodel; return NULL; } @@ -277,7 +277,7 @@ namespace VMAP ModelFileMap::iterator model = iLoadedModelFiles.find(filename); if (model == iLoadedModelFiles.end()) { - sLog->outError("VMapManager2: trying to unload non-loaded file '%s'", filename.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str()); return; } if (model->second.decRefCount() == 0) diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp index f4a3f1c7b30..6489ddd7a4f 100644 --- a/src/server/collision/Maps/MapTree.cpp +++ b/src/server/collision/Maps/MapTree.cpp @@ -320,7 +320,7 @@ namespace VMAP else { success = false; - sLog->outError("StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str()); } } @@ -356,7 +356,7 @@ namespace VMAP } if (!iTreeValues) { - sLog->outError("StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY); + sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY); return false; } bool result = true; @@ -382,7 +382,7 @@ namespace VMAP // acquire model instance WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); if (!model) - sLog->outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY); + sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY); // update tree uint32 referencedVal; @@ -432,7 +432,7 @@ namespace VMAP loadedTileMap::iterator tile = iLoadedTiles.find(tileID); if (tile == iLoadedTiles.end()) { - sLog->outError("StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY); + sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY); return; } if (tile->second) // file associated with tile @@ -466,7 +466,7 @@ namespace VMAP else { if (!iLoadedSpawns.count(referencedNode)) - sLog->outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID); + sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID); else if (--iLoadedSpawns[referencedNode] == 0) { iTreeValues[referencedNode].setUnloaded(); diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 8b63620e783..63c42e25035 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -53,7 +53,7 @@ void LoadGameObjectModelList() FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb"); if (!model_list_file) { - sLog->outError("Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS); + sLog->outError(LOG_FILTER_GENERAL, "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS); return; } @@ -72,7 +72,7 @@ void LoadGameObjectModelList() || fread(&v1, sizeof(Vector3), 1, model_list_file) != 1 || fread(&v2, sizeof(Vector3), 1, model_list_file) != 1) { - sLog->outError("File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS); + sLog->outError(LOG_FILTER_GENERAL, "File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS); break; } @@ -83,8 +83,8 @@ void LoadGameObjectModelList() } fclose(model_list_file); - sLog->outString(">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); + } GameObjectModel::~GameObjectModel() @@ -103,7 +103,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn // ignore models with no bounds if (mdl_box == G3D::AABox::zero()) { - sLog->outError("GameObject model %s has zero bounds, loading skipped", it->second.name.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str()); return false; } diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index 86f2c6a28b7..7d7a27fce13 100755 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -182,7 +182,7 @@ void CasterAI::UpdateAI(const uint32 diff) ArcherAI::ArcherAI(Creature* c) : CreatureAI(c) { if (!me->m_spells[0]) - sLog->outError("ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]); m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0; @@ -231,7 +231,7 @@ void ArcherAI::UpdateAI(const uint32 /*diff*/) TurretAI::TurretAI(Creature* c) : CreatureAI(c) { if (!me->m_spells[0]) - sLog->outError("TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]); m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0; diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h index d7bf8656f23..b4fd579d693 100755 --- a/src/server/game/AI/CoreAI/PassiveAI.h +++ b/src/server/game/AI/CoreAI/PassiveAI.h @@ -20,7 +20,6 @@ #define TRINITY_PASSIVEAI_H #include "CreatureAI.h" -//#include "CreatureAIImpl.h" class PassiveAI : public CreatureAI { diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 97ae0581a18..99cf1cda4fc 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -61,7 +61,7 @@ void PetAI::_stopAttack() { if (!me->isAlive()) { - sLog->outStaticDebug("Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_GENERAL, "Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow()); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->CombatStop(); @@ -100,7 +100,7 @@ void PetAI::UpdateAI(const uint32 diff) if (_needToStop()) { - sLog->outStaticDebug("Pet AI stopped attacking [guid=%u]", me->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_GENERAL, "Pet AI stopped attacking [guid=%u]", me->GetGUIDLow()); _stopAttack(); return; } @@ -430,7 +430,6 @@ void PetAI::HandleReturnMovement() } } } - } void PetAI::DoAttack(Unit* target, bool chase) diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index bf50909eeee..e159c1a7d9b 100755 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -130,7 +130,7 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered) void UnitAI::DoCast(uint32 spellId) { Unit* target = NULL; - //sLog->outError("aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target); + //sLog->outError(LOG_FILTER_GENERAL, "aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target); switch (AISpellInfo[spellId].target) { default: diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 9c236cbd039..17cef3ec1a1 100755 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -54,7 +54,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN Map* map = creature->GetMap(); if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated { - sLog->outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0); + sLog->outError(LOG_FILTER_GENERAL, "DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0); return; } @@ -77,7 +77,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim()) { - sLog->outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry()); return; } diff --git a/src/server/game/AI/CreatureAIRegistry.cpp b/src/server/game/AI/CreatureAIRegistry.cpp index e4cb62c56de..e5c689da339 100755 --- a/src/server/game/AI/CreatureAIRegistry.cpp +++ b/src/server/game/AI/CreatureAIRegistry.cpp @@ -30,7 +30,6 @@ #include "CreatureAIFactory.h" #include "SmartAI.h" -//#include "CreatureAIImpl.h" namespace AIRegistry { void Initialize() diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 1a0c6652e74..2d69f1e0243 100755 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -125,7 +125,6 @@ namespace FactorySelector }*/ return (mv_factory == NULL ? NULL : mv_factory->Create(creature)); - } GameObjectAI* SelectGameObjectAI(GameObject* go) diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index 835705a0d7c..aa14bc1b56e 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -40,7 +40,7 @@ bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatM Time = urand(repeatMin, repeatMax); else { - sLog->outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type); Enabled = false; return false; } @@ -64,7 +64,6 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c) std::vector::const_iterator i; for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i) { - //Debug check #ifndef TRINITY_DEBUG if ((*i).event_flags & EFLAG_DEBUG_ONLY) @@ -83,10 +82,10 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c) } //EventMap had events but they were not added because they must be for instance if (m_CreatureEventAIList.empty()) - sLog->outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry()); } else - sLog->outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry()); m_bEmptyList = m_CreatureEventAIList.empty(); m_Phase = 0; @@ -319,7 +318,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& holder, Unit* actionIn break; } default: - sLog->outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), holder.Event.event_id, holder.Event.event_type); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), holder.Event.event_id, holder.Event.event_type); break; } @@ -492,10 +491,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED)); } - } else - sLog->outErrorDb("CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", eventId, me->GetEntry(), action.cast.spellId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", eventId, me->GetEntry(), action.cast.spellId); } break; } @@ -511,7 +509,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 creature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); if (!creature) - sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, eventId, me->GetEntry()); else if (action.summon.target != TARGET_T_SELF && target) creature->AI()->AttackStart(target); break; @@ -607,12 +605,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 int32 new_phase = int32(m_Phase)+action.set_inc_phase.step; if (new_phase < 0) { - sLog->outErrorDb("CreatureEventAI: Event %d decrease m_Phase under 0. CreatureEntry = %d", eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d decrease m_Phase under 0. CreatureEntry = %d", eventId, me->GetEntry()); m_Phase = 0; } else if (new_phase >= MAX_PHASE) { - sLog->outErrorDb("CreatureEventAI: Event %d incremented m_Phase above %u. m_Phase mask cannot be used with phases past %u. CreatureEntry = %d", eventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d incremented m_Phase above %u. m_Phase mask cannot be used with phases past %u. CreatureEntry = %d", eventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry()); m_Phase = MAX_PHASE-1; } else @@ -663,7 +661,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (action.random_phase_range.phaseMin <= action.random_phase_range.phaseMax) m_Phase = urand(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax); else - sLog->outErrorDb("CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", eventId, me->GetEntry()); break; case ACTION_T_SUMMON_ID: { @@ -672,7 +670,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr->GetCreatureEventAISummonMap().find(action.summon_id.spawnId); if (i == sEventAIMgr->GetCreatureEventAISummonMap().end()) { - sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, eventId, me->GetEntry()); return; } @@ -683,7 +681,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 creature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); if (!creature) - sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, eventId, me->GetEntry()); else if (action.summon_id.target != TARGET_T_SELF && target) creature->AI()->AttackStart(target); @@ -703,10 +701,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; case ACTION_T_SET_INST_DATA: { - InstanceScript* instance = (InstanceScript*)me->GetInstanceScript(); + InstanceScript* instance = me->GetInstanceScript(); if (!instance) { - sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", eventId, me->GetEntry()); return; } @@ -718,14 +716,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 Unit* target = GetTargetByType(action.set_inst_data64.target, actionInvoker); if (!target) { - sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", eventId, me->GetEntry()); return; } - InstanceScript* instance = (InstanceScript*)me->GetInstanceScript(); + InstanceScript* instance = me->GetInstanceScript(); if (!instance) { - sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", eventId, me->GetEntry()); return; } @@ -735,8 +733,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_UPDATE_TEMPLATE: if (me->GetEntry() == action.update_template.creatureId) { - - sLog->outErrorDb("CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", eventId, me->GetEntry()); return; } @@ -745,8 +742,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_DIE: if (me->isDead()) { - - sLog->outErrorDb("CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", eventId, me->GetEntry()); return; } me->Kill(me); @@ -798,7 +794,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 object = me->SummonGameObject(action.raw.param1, x, y, z, 0, 0, 0, 0, 0, action.raw.param2); if (!object) { - sLog->outErrorDb("TSCR: EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, eventId, me->GetEntry()); + sLog->outError(LOG_FILTER_TSCR, "EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, eventId, me->GetEntry()); } break; } @@ -843,6 +839,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; } + default: + break; } } @@ -1048,7 +1046,6 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who) void CreatureEventAI::SpellHit(Unit* unit, const SpellInfo* spell) { - if (m_bEmptyList) return; @@ -1111,6 +1108,8 @@ void CreatureEventAI::UpdateAI(const uint32 diff) if (me->IsInRange(me->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist)) ProcessEvent(*i); break; + default: + break; } } @@ -1230,13 +1229,13 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t { if (!source) { - sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i, invalid Source pointer.", textEntry); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i, invalid Source pointer.", textEntry); return; } if (textEntry >= 0) { - sLog->outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry); return; } @@ -1244,7 +1243,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t if (i == sEventAIMgr->GetCreatureEventAITextMap().end()) { - sLog->outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry); return; } @@ -1255,7 +1254,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t if (sSoundEntriesStore.LookupEntry((*i).second.SoundId)) source->PlayDirectSound((*i).second.SoundId); else - sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId); } if ((*i).second.Emote) @@ -1265,7 +1264,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t ((Unit*)source)->HandleEmoteCommand((*i).second.Emote); } else - sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", textEntry, source->GetTypeId()); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", textEntry, source->GetTypeId()); } switch ((*i).second.Type) @@ -1286,13 +1285,13 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t { if (target && target->GetTypeId() == TYPEID_PLAYER) source->MonsterWhisper(textEntry, target->GetGUID()); - else sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); + else sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); }break; case CHAT_TYPE_BOSS_WHISPER: { if (target && target->GetTypeId() == TYPEID_PLAYER) source->MonsterWhisper(textEntry, target->GetGUID(), true); - else sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); + else sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); }break; case CHAT_TYPE_ZONE_YELL: source->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h index 3d2bcf888c8..b9e1ae32be4 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.h +++ b/src/server/game/AI/EventAI/CreatureEventAI.h @@ -589,7 +589,6 @@ struct CreatureEventAIHolder class CreatureEventAI : public CreatureAI { - public: explicit CreatureEventAI(Creature* c); ~CreatureEventAI() diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index a863f2f89cf..2d7c64bf5df 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -38,13 +38,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() // Load EventAI Text sObjectMgr->LoadTrinityStrings("creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID); - // Gather Additional data from EventAI Texts 0 1 2 3 4 + // Gather Additional data from EventAI Texts 0 1 2 3 4 QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts"); if (!result) { - sLog->outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); + return; } @@ -64,33 +64,33 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() // range negative if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID) { - sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)", i, MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)", i, MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID); continue; } // range negative (must not happen, loaded from same table) if (!sObjectMgr->GetTrinityStringLocale(i)) { - sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found", i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` not found", i); continue; } if (temp.SoundId) { if (!sSoundEntriesStore.LookupEntry(temp.SoundId)) - sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.", i, temp.SoundId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.", i, temp.SoundId); } if (!GetLanguageDescByID(temp.Language)) - sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.", i, temp.Language); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.", i, temp.Language); if (temp.Type > CHAT_TYPE_ZONE_YELL) - sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.", i, temp.Type); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.", i, temp.Type); if (temp.Emote) { if (!sEmotesStore.LookupEntry(temp.Emote)) - sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.", i, temp.Emote); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.", i, temp.Emote); } m_CreatureEventAI_TextMap[i] = temp; @@ -98,11 +98,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() } while (result->NextRow()); - sLog->outString(">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } -// ------------------- void CreatureEventAIMgr::LoadCreatureEventAI_Summons() { uint32 oldMSTime = getMSTime(); @@ -115,8 +114,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons() if (!result) { - sLog->outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); + return; } @@ -137,7 +136,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons() if (!Trinity::IsValidMapCoord(temp.position_x, temp.position_y, temp.position_z, temp.orientation)) { - sLog->outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f, %f, %f, %f), skipping.", i, temp.position_x, temp.position_y, temp.position_z, temp.orientation); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Summon id %u have wrong coordinates (%f, %f, %f, %f), skipping.", i, temp.position_x, temp.position_y, temp.position_z, temp.orientation); continue; } @@ -147,11 +146,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons() } while (result->NextRow()); - sLog->outString(">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } -// ------------------- void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { uint32 oldMSTime = getMSTime(); @@ -169,8 +167,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() if (!result) { - sLog->outString(">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); + return; } @@ -191,7 +189,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() //Report any errors in event if (e_type >= EVENT_T_END) { - sLog->outErrorDb("CreatureEventAI: Event %u have wrong type (%u), skipping.", i, e_type); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u have wrong type (%u), skipping.", i, e_type); continue; } temp.event_type = EventAI_Type(e_type); @@ -208,21 +206,21 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() //Creature does not exist in database if (!cInfo) { - sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id); continue; } // Only on the first script if (cInfo->AIName != "EventAI" && m_CreatureEventAI_Event_Map[creature_id].empty()) - sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id); + sLog->outError(LOG_FILTER_SQL, "Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id); //No chance of this event occuring if (temp.event_chance == 0) - sLog->outErrorDb("CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i); //Chance above 100, force it to be 100 else if (temp.event_chance > 100) { - sLog->outErrorDb("CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i); temp.event_chance = 100; } @@ -232,23 +230,23 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_TIMER: case EVENT_T_TIMER_OOC: if (temp.timer.initialMax < temp.timer.initialMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); if (temp.timer.repeatMax < temp.timer.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_HP: case EVENT_T_MANA: case EVENT_T_TARGET_HP: case EVENT_T_TARGET_MANA: if (temp.percent_range.percentMax > 100) - sLog->outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); if (temp.percent_range.percentMax <= temp.percent_range.percentMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax) { - sLog->outErrorDb("CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); temp.event_flags &= ~EFLAG_REPEATABLE; } break; @@ -258,29 +256,29 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId); if (!spell) { - sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); continue; } if ((temp.spell_hit.schoolMask & spell->SchoolMask) != spell->SchoolMask) - sLog->outErrorDb("CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i); } if (!temp.spell_hit.schoolMask) - sLog->outErrorDb("CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i); if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_RANGE: if (temp.range.maxDist < temp.range.minDist) - sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i); if (temp.range.repeatMax < temp.range.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_OOC_LOS: if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_SPAWNED: switch (temp.spawned.condition) @@ -289,55 +287,55 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case SPAWNED_EVENT_MAP: if (!sMapStore.LookupEntry(temp.spawned.conditionValue1)) - sLog->outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); break; case SPAWNED_EVENT_ZONE: if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1)) - sLog->outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); default: - sLog->outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition); break; } break; case EVENT_T_FRIENDLY_HP: if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_FRIENDLY_IS_CC: if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_FRIENDLY_MISSING_BUFF: { SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId); if (!spell) { - sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); continue; } if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; } case EVENT_T_KILL: if (temp.kill.repeatMax < temp.kill.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_TARGET_CASTING: if (temp.target_casting.repeatMax < temp.target_casting.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_SUMMONED_UNIT: if (!sObjectMgr->GetCreatureTemplate(temp.summon_unit.creatureId)) - sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId); if (temp.summon_unit.repeatMax < temp.summon_unit.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_QUEST_ACCEPT: case EVENT_T_QUEST_COMPLETE: if (!sObjectMgr->GetQuestTemplate(temp.quest.questId)) - sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); - sLog->outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i); continue; case EVENT_T_AGGRO: @@ -347,7 +345,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (temp.event_flags & EFLAG_REPEATABLE) { - sLog->outErrorDb("CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i); temp.event_flags &= ~EFLAG_REPEATABLE; } @@ -358,7 +356,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId)) { - sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId); continue; } if (temp.receive_emote.condition) @@ -369,14 +367,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() cond.ConditionValue2 = temp.receive_emote.conditionValue2; if (!sConditionMgr->isConditionTypeValid(&cond)) { - sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition); continue; } } if (!(temp.event_flags & EFLAG_REPEATABLE)) { - sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i); temp.event_flags |= EFLAG_REPEATABLE; } @@ -389,16 +387,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.buffed.spellId); if (!spell) { - sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); continue; } if (temp.buffed.repeatMax < temp.buffed.repeatMin) - sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; } default: - sLog->outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i); break; } @@ -407,7 +405,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() uint16 action_type = fields[10+(j*4)].GetUInt8(); if (action_type >= ACTION_T_END) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type); temp.action[j].type = ACTION_T_NONE; continue; } @@ -429,30 +427,30 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() if (action.text.TextId1 < 0) { if (m_CreatureEventAI_TextMap.find(action.text.TextId1) == m_CreatureEventAI_TextMap.end()) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1); } if (action.text.TextId2 < 0) { if (m_CreatureEventAI_TextMap.find(action.text.TextId2) == m_CreatureEventAI_TextMap.end()) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1); if (!action.text.TextId1) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1); } if (action.text.TextId3 < 0) { if (m_CreatureEventAI_TextMap.find(action.text.TextId3) == m_CreatureEventAI_TextMap.end()) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1); if (!action.text.TextId1 || !action.text.TextId2) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1); } break; } case ACTION_T_SET_FACTION: if (action.set_faction.factionId !=0 && !sFactionStore.LookupEntry(action.set_faction.factionId)) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId); action.set_faction.factionId = 0; } break; @@ -461,7 +459,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (action.morph.creatureId && !sObjectMgr->GetCreatureTemplate(action.morph.creatureId)) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId); action.morph.creatureId = 0; } @@ -469,12 +467,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (action.morph.creatureId) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId, action.morph.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId, action.morph.creatureId); action.morph.modelId = 0; } else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId)) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId); action.morph.modelId = 0; } } @@ -482,33 +480,33 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case ACTION_T_SOUND: if (!sSoundEntriesStore.LookupEntry(action.sound.soundId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId); break; case ACTION_T_EMOTE: if (!sEmotesStore.LookupEntry(action.emote.emoteId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId); break; case ACTION_T_RANDOM_SOUND: if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1); if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2); if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3); break; case ACTION_T_RANDOM_EMOTE: if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1); if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2); if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3); break; case ACTION_T_CAST: { const SpellInfo* spell = sSpellMgr->GetSpellInfo(action.cast.spellId); if (!spell) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId); /* FIXME: temp.raw.param3 not have event tipes with recovery time in it.... else { @@ -526,143 +524,143 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() action.cast.castFlags |= CAST_TRIGGERED; if (action.cast.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; } case ACTION_T_SUMMON: if (!sObjectMgr->GetCreatureTemplate(action.summon.creatureId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId); if (action.summon.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_THREAT_SINGLE_PCT: if (std::abs(action.threat_single_pct.percent) > 100) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent); if (action.threat_single_pct.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_THREAT_ALL_PCT: if (std::abs(action.threat_all_pct.percent) > 100) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent); break; case ACTION_T_QUEST_EVENT: if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event.questId)) { if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId); } else - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId); if (action.quest_event.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_CAST_EVENT: if (!sObjectMgr->GetCreatureTemplate(action.cast_event.creatureId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId); if (!sSpellMgr->GetSpellInfo(action.cast_event.spellId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId); if (action.cast_event.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_SET_UNIT_FIELD: if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1); if (action.set_unit_field.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_SET_UNIT_FLAG: case ACTION_T_REMOVE_UNIT_FLAG: if (action.unit_flag.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_SET_PHASE: if (action.set_phase.phase >= MAX_PHASE) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); break; case ACTION_T_INC_PHASE: if (action.set_inc_phase.step == 0) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1); else if (std::abs(action.set_inc_phase.step) > MAX_PHASE-1) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step); break; case ACTION_T_QUEST_EVENT_ALL: if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event_all.questId)) { if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId); } else - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId); break; case ACTION_T_CAST_EVENT_ALL: if (!sObjectMgr->GetCreatureTemplate(action.cast_event_all.creatureId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId); if (!sSpellMgr->GetSpellInfo(action.cast_event_all.spellId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId); break; case ACTION_T_REMOVEAURASFROMSPELL: if (!sSpellMgr->GetSpellInfo(action.remove_aura.spellId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId); if (action.remove_aura.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_RANDOM_PHASE: //PhaseId1, PhaseId2, PhaseId3 if (action.random_phase.phase1 >= MAX_PHASE) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); if (action.random_phase.phase2 >= MAX_PHASE) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); if (action.random_phase.phase3 >= MAX_PHASE) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); break; case ACTION_T_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax if (action.random_phase_range.phaseMin >= MAX_PHASE) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); if (action.random_phase_range.phaseMin >= MAX_PHASE) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1); std::swap(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax); // equal case processed at call } break; case ACTION_T_SUMMON_ID: if (!sObjectMgr->GetCreatureTemplate(action.summon_id.creatureId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId); if (action.summon_id.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end()) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId); break; case ACTION_T_KILLED_MONSTER: if (!sObjectMgr->GetCreatureTemplate(action.killed_monster.creatureId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId); if (action.killed_monster.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_SET_INST_DATA: if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1); if (action.set_inst_data.value > 4/*SPECIAL*/) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1); break; case ACTION_T_SET_INST_DATA64: if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1); if (action.set_inst_data64.target >= TARGET_T_END) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); break; case ACTION_T_UPDATE_TEMPLATE: if (!sObjectMgr->GetCreatureTemplate(action.update_template.creatureId)) - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId); break; case ACTION_T_SET_SHEATH: if (action.set_sheath.sheath >= MAX_SHEATH_STATE) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath); action.set_sheath.sheath = SHEATH_STATE_UNARMED; } break; @@ -671,7 +669,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (action.invincibility_hp_level.hp_level > 100) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level); action.invincibility_hp_level.hp_level = 100; } } @@ -681,7 +679,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (action.mount.creatureId && !sObjectMgr->GetCreatureTemplate(action.mount.creatureId)) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId); action.morph.creatureId = 0; } @@ -689,12 +687,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { if (action.mount.creatureId) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId); action.mount.modelId = 0; } else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId)) { - sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId); action.mount.modelId = 0; } } @@ -714,7 +712,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case ACTION_T_RANDOM_SAY: case ACTION_T_RANDOM_YELL: case ACTION_T_RANDOM_TEXTEMOTE: - sLog->outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1); break; case ACTION_T_MOVE_RANDOM_POINT: @@ -728,7 +726,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; default: - sLog->outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, action.type); + sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, action.type); break; } } @@ -740,6 +738,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } while (result->NextRow()); - sLog->outString(">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index a5f957c352c..76bb3aaa76a 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -157,7 +157,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId) if (!sSoundEntriesStore.LookupEntry(soundId)) { - sLog->outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow()); + sLog->outError(LOG_FILTER_TSCR, "Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow()); return; } @@ -250,7 +250,7 @@ void ScriptedAI::DoResetThreat() { if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty()) { - sLog->outError("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry()); + sLog->outError(LOG_FILTER_TSCR, "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry()); return; } @@ -299,7 +299,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o if (Player* player = unit->ToPlayer()) player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); else - sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o); + sLog->outError(LOG_FILTER_TSCR, "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o); } void ScriptedAI::DoTeleportAll(float x, float y, float z, float o) @@ -431,7 +431,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff) return false; break; default: // For most of creatures that certain area is their home area. - sLog->outDetail("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry()); + sLog->outInfo(LOG_FILTER_GENERAL, "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry()); uint32 homeAreaId = me->GetMap()->GetAreaId(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ()); if (me->GetAreaId() == homeAreaId) return false; diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index d6da6a91bf1..003c9ac9d1c 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -175,7 +175,7 @@ void npc_escortAI::EnterEvadeMode() { AddEscortState(STATE_ESCORT_RETURNING); ReturnToLastPoint(); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has left combat and is now returning to last point"); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has left combat and is now returning to last point"); } else { @@ -216,7 +216,7 @@ void npc_escortAI::UpdateAI(uint32 const diff) { if (DespawnAtEnd) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI reached end of waypoints"); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI reached end of waypoints"); if (m_bCanReturnToStart) { @@ -227,7 +227,7 @@ void npc_escortAI::UpdateAI(uint32 const diff) m_uiWPWaitTimer = 0; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ); return; } @@ -243,7 +243,7 @@ void npc_escortAI::UpdateAI(uint32 const diff) } else { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI reached end of waypoints with Despawn off"); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI reached end of waypoints with Despawn off"); return; } @@ -252,7 +252,7 @@ void npc_escortAI::UpdateAI(uint32 const diff) if (!HasEscortState(STATE_ESCORT_PAUSED)) { me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); WaypointStart(CurrentWP->id); @@ -270,7 +270,7 @@ void npc_escortAI::UpdateAI(uint32 const diff) { if (DespawnAtFar && !IsPlayerOrGroupInRange()) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI failed because player/group was to far away or not found"); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI failed because player/group was to far away or not found"); if (m_bCanInstantRespawn) { @@ -308,7 +308,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) //Combat start position reached, continue waypoint movement if (pointId == POINT_LAST_POINT) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat"); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has returned to original position before combat"); me->SetWalk(!m_bIsRunning); RemoveEscortState(STATE_ESCORT_RETURNING); @@ -318,7 +318,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) } else if (pointId == POINT_HOME) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list."); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has returned to original home location and will continue from beginning of waypoint list."); CurrentWP = WaypointList.begin(); m_uiWPWaitTimer = 1; @@ -328,11 +328,11 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) //Make sure that we are still on the right waypoint if (CurrentWP->id != pointId) { - sLog->outError("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry()); return; } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI Waypoint %u reached", CurrentWP->id); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI Waypoint %u reached", CurrentWP->id); //Call WP function WaypointReached(CurrentWP->id); @@ -401,14 +401,14 @@ void npc_escortAI::SetRun(bool on) if (!m_bIsRunning) me->SetWalk(false); else - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set run mode, but is already running."); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI attempt to set run mode, but is already running."); } else { if (m_bIsRunning) me->SetWalk(true); else - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set walk mode, but is already walking."); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI attempt to set walk mode, but is already walking."); } m_bIsRunning = on; @@ -419,13 +419,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false { if (me->getVictim()) { - sLog->outError("TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry()); return; } if (HasEscortState(STATE_ESCORT_ESCORTING)) { - sLog->outError("TSCR: EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry()); + sLog->outError(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry()); return; } @@ -438,7 +438,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false if (WaypointList.empty()) { - sLog->outErrorDb("TSCR: EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", + sLog->outError(LOG_FILTER_SQL, "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; } @@ -454,13 +454,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false m_bCanReturnToStart = canLoopPath; if (m_bCanReturnToStart && m_bCanInstantRespawn) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn."); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn."); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) { me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveIdle(); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle."); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle."); } //disable npcflags @@ -471,7 +471,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); + sLog->outDebug(LOG_FILTER_TSCR, "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); CurrentWP = WaypointList.begin(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 7a7fab014dc..4b4f3656a8d 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -123,4 +123,3 @@ struct npc_escortAI : public ScriptedAI bool HasImmuneToNPCFlags; }; #endif - diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 4a71184442d..1e83c203553 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -165,7 +165,7 @@ void FollowerAI::EnterEvadeMode() if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI left combat, returning to CombatStartPosition."); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI left combat, returning to CombatStartPosition."); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) { @@ -191,7 +191,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff) { if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT)) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is set completed, despawns."); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI is set completed, despawns."); me->DespawnOrUnsummon(); return; } @@ -202,7 +202,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff) { if (HasFollowState(STATE_FOLLOW_RETURNING)) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is returning to leader."); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI is returning to leader."); RemoveFollowState(STATE_FOLLOW_RETURNING); me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); @@ -231,7 +231,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff) if (bIsMaxRangeExceeded) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI failed because player/group was to far away or not found"); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI failed because player/group was to far away or not found"); me->DespawnOrUnsummon(); return; } @@ -274,13 +274,13 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu { if (me->getVictim()) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI attempt to StartFollow while in combat."); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while in combat."); return; } if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - sLog->outError("TSCR: FollowerAI attempt to StartFollow while already following."); + sLog->outError(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while already following."); return; } @@ -296,7 +296,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle."); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle."); } me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); @@ -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, "TSCR: FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName(), m_uiLeaderGUID); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName(), m_uiLeaderGUID); } Player* FollowerAI::GetLeaderForFollower() @@ -324,7 +324,7 @@ Player* FollowerAI::GetLeaderForFollower() if (member && member->isAlive() && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE)) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader changed and returned new leader."); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI GetLeader changed and returned new leader."); m_uiLeaderGUID = member->GetGUID(); return member; } @@ -333,7 +333,7 @@ Player* FollowerAI::GetLeaderForFollower() } } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader can not find suitable leader."); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI GetLeader can not find suitable leader."); return NULL; } diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 629998e3579..0b8236908a0 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -107,7 +107,7 @@ WayPoint* SmartAI::GetNextWayPoint() mLastWP = (*itr).second; if (mLastWP->id != mCurrentWPID) { - sLog->outError("SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID); + sLog->outError(LOG_FILTER_GENERAL, "SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID); } return (*itr).second; } @@ -118,7 +118,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/) { if (me->isInCombat())// no wp movement in combat { - sLog->outError("SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry()); return; } if (HasEscortState(SMART_ESCORT_ESCORTING)) @@ -134,8 +134,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/) SetRun(run); - WayPoint* wp = GetNextWayPoint(); - if (wp) + if (WayPoint* wp = GetNextWayPoint()) { me->GetPosition(&mLastOOCPos); me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z); @@ -163,7 +162,7 @@ void SmartAI::PausePath(uint32 delay, bool forced) return; if (HasEscortState(SMART_ESCORT_PAUSED)) { - sLog->outError("SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry()); return; } mForcedPaused = forced; @@ -301,7 +300,6 @@ void SmartAI::UpdatePath(const uint32 diff) mWPPauseTimer = 0; } else { mWPPauseTimer -= diff; - } } if (HasEscortState(SMART_ESCORT_RETURNING)) @@ -323,15 +321,12 @@ void SmartAI::UpdatePath(const uint32 diff) if (mCurrentWPID == GetWPCount()) { EndPath(); - } else { - WayPoint* wp = GetNextWayPoint(); - if (wp) - { - SetRun(mRun); - me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z); - } } - + else if (WayPoint* wp = GetNextWayPoint()) + { + SetRun(mRun); + me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z); + } } } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 82d0945874c..6e5a34e8c33 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -910,7 +910,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u InstanceScript* instance = obj->GetInstanceScript(); if (!instance) { - sLog->outErrorDb("SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid); break; } @@ -931,7 +931,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u InstanceScript* instance = obj->GetInstanceScript(); if (!instance) { - sLog->outErrorDb("SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid); break; } @@ -1438,7 +1438,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.action.equip.entry); if (!einfo) { - sLog->outErrorDb("SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry); + sLog->outError(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry); return; } npc->SetCurrentEquipmentId(e.action.equip.entry); @@ -1563,7 +1563,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (e.GetTargetType() == SMART_TARGET_NONE) { - sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1687,7 +1687,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 id = temp[urand(0, count)]; if (e.GetTargetType() == SMART_TARGET_NONE) { - sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1717,7 +1717,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2); if (e.GetTargetType() == SMART_TARGET_NONE) { - sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1909,14 +1909,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI())) ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list else - sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping"); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping"); } else if (IsGameObject(*itr)) { if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI())) ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list else - sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping"); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping"); } } @@ -1950,7 +1950,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; } default: - sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; } @@ -1960,7 +1960,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (linked.GetActionType() && linked.GetEventType() == SMART_EVENT_LINK) ProcessEvent(linked, unit, var0, var1, bvar, spell, gob); else - sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link); + sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link); } } @@ -1970,7 +1970,7 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e) return; if (mTemplate) { - sLog->outErrorDb("SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType()); + sLog->outError(LOG_FILTER_SQL, "SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType()); return; } mTemplate = (SMARTAI_TEMPLATE)e.action.installTtemplate.id; @@ -2227,7 +2227,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* { if (!trigger && !GetBaseObject()) { - sLog->outErrorDb("SMART_TARGET_CREATURE_GUID can not be used without invoker and without entry"); + sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_CREATURE_GUID can not be used without invoker and without entry"); break; } @@ -2250,7 +2250,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* { if (!trigger && !GetBaseObject()) { - sLog->outErrorDb("SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker and without entry"); + sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker and without entry"); break; } @@ -2787,7 +2787,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui break; } default: - sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); + sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); break; } } @@ -2984,9 +2984,9 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn mEvents.push_back((*i));//NOTE: 'world(0)' events still get processed in ANY instance mode } if (mEvents.empty() && obj) - sLog->outErrorDb("SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry()); if (mEvents.empty() && at) - sLog->outErrorDb("SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id); + sLog->outError(LOG_FILTER_SQL, "SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id); } void SmartScript::GetScript() @@ -3030,7 +3030,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at) sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is GameObject %u", go->GetEntry()); break; default: - sLog->outError("SmartScript::OnInitialize: Unhandled TypeID !WARNING!"); + sLog->outError(LOG_FILTER_GENERAL, "SmartScript::OnInitialize: Unhandled TypeID !WARNING!"); return; } } else if (at) @@ -3041,7 +3041,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at) } else { - sLog->outError("SmartScript::OnInitialize: !WARNING! Initialized objects are NULL."); + sLog->outError(LOG_FILTER_GENERAL, "SmartScript::OnInitialize: !WARNING! Initialized objects are NULL."); return; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 03d533e69e5..2a0eceb574a 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -117,7 +117,7 @@ class SmartScript smart = false; if (!smart) - sLog->outErrorDb("SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0)); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0)); return smart; } @@ -131,7 +131,7 @@ class SmartScript if (!go || go->GetAIName() != "SmartGameObjectAI") smart = false; if (!smart) - sLog->outErrorDb("SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0)); + sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0)); return smart; } @@ -254,7 +254,6 @@ class SmartScript mStoredEvents.erase(i); return; } - } } } @@ -268,7 +267,6 @@ class SmartScript { return (*i); } - } } SmartScriptHolder s; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index de766d2a7e1..1723e96a08a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -50,8 +50,8 @@ void SmartWaypointMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); + return; } @@ -78,7 +78,7 @@ void SmartWaypointMgr::LoadFromDB() } if (last_id != id) - sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id); + sLog->outError(LOG_FILTER_SQL, "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id); last_id++; (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z); @@ -88,8 +88,8 @@ void SmartWaypointMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); + } SmartWaypointMgr::~SmartWaypointMgr() @@ -117,8 +117,8 @@ void SmartAIMgr::LoadSmartAIFromDB() if (!result) { - sLog->outString(">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); + return; } @@ -134,7 +134,7 @@ void SmartAIMgr::LoadSmartAIFromDB() SmartScriptType source_type = (SmartScriptType)fields[1].GetUInt8(); if (source_type >= SMART_SCRIPT_TYPE_MAX) { - sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type)); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type)); continue; } if (temp.entryOrGuid >= 0) @@ -145,7 +145,7 @@ void SmartAIMgr::LoadSmartAIFromDB() { if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid)) { - sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); continue; } break; @@ -154,7 +154,7 @@ void SmartAIMgr::LoadSmartAIFromDB() { if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid)) { - sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); continue; } break; @@ -163,7 +163,7 @@ void SmartAIMgr::LoadSmartAIFromDB() { if (!sAreaTriggerStore.LookupEntry((uint32)temp.entryOrGuid)) { - sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); continue; } break; @@ -171,7 +171,7 @@ void SmartAIMgr::LoadSmartAIFromDB() case SMART_SCRIPT_TYPE_TIMED_ACTIONLIST: break;//nothing to check, really default: - sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type); continue; } } @@ -179,7 +179,7 @@ void SmartAIMgr::LoadSmartAIFromDB() { if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid)))) { - sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid))); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid))); continue; } } @@ -234,8 +234,8 @@ void SmartAIMgr::LoadSmartAIFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) @@ -249,7 +249,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) { if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature); return false; } break; @@ -259,7 +259,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) { if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry); return false; } break; @@ -281,7 +281,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) { if (e.target.playerDistance.dist == 0) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } break; @@ -305,7 +305,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) case SMART_TARGET_STORED: break; default: - sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } return true; @@ -315,28 +315,28 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.event.type >= SMART_EVENT_END) { - sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType()); return false; } // in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && !(SmartAIEventMask[e.event.type][1] & SmartAITypeMask[e.GetScriptType()][1])) { - sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType()); return false; } if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END) { - sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType()); return false; } if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL) { - sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask); return false; } if (e.event.event_flags > SMART_EVENT_FLAGS_ALL) { - sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags); return false; } if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST) @@ -377,12 +377,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell); if (!spellInfo) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); return false; } if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); return false; } } @@ -397,12 +397,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_RESPAWN: if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map); return false; } if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !GetAreaEntryByAreaID(e.event.respawn.area)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area); return false; } break; @@ -484,7 +484,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.event.movementInform.type > NULL_MOTION_TYPE) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type); return false; } break; @@ -508,7 +508,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.link && e.link == e.event_id) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); return false; } break; @@ -540,7 +540,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.event.doAction.eventId > EVENT_CHARGE) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId); return false; } break; @@ -580,7 +580,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_ON_SPELLCLICK: break; default: - sLog->outErrorDb("SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } } @@ -590,7 +590,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_SET_FACTION: if (e.action.faction.factionID && !sFactionTemplateStore.LookupEntry(e.action.faction.factionID)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID); return false; } break; @@ -600,7 +600,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature); return false; } @@ -608,12 +608,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.action.morphOrMount.creature) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } else if (!sCreatureDisplayInfoStore.LookupEntry(e.action.morphOrMount.model)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model); return false; } } @@ -624,7 +624,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; if (e.action.sound.range > TEXT_RANGE_WORLD) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Text Range %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.sound.range); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Text Range %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.sound.range); return false; } break; @@ -642,7 +642,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (!sTaxiPathStore.LookupEntry(e.action.taxi.id)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id); return false; } break; @@ -678,13 +678,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest); return false; } } else { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest); return false; } break; @@ -695,24 +695,22 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) if (!IsSpellValid(e, e.action.castCreatureOrGO.spell)) return false; break; - - case SMART_ACTION_SET_EVENT_PHASE: if (e.action.setEventPhase.phase >= SMART_EVENT_PHASE_MAX) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1); return false; } break; case SMART_ACTION_INC_EVENT_PHASE: if (!e.action.incEventPhase.inc && !e.action.incEventPhase.dec) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } break; @@ -736,7 +734,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } } @@ -746,7 +744,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) if (e.action.randomPhaseRange.phaseMin >= SMART_EVENT_PHASE_MAX || e.action.randomPhaseRange.phaseMax >= SMART_EVENT_PHASE_MAX) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax)) @@ -758,7 +756,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type); return false; } break; @@ -773,7 +771,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_SET_SHEATH: if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath); return false; } break; @@ -781,7 +779,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.action.react.state > REACT_AGGRESSIVE) { - sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state); return false; } break; @@ -801,14 +799,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_TELEPORT: if (!sMapStore.LookupEntry(e.action.teleport.mapID)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID); return false; } break; case SMART_ACTION_INSTALL_AI_TEMPLATE: if (e.action.installTtemplate.id >= SMARTAI_TEMPLATE_END) { - sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id); return false; } break; @@ -820,14 +818,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID)) { - sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID); return false; } if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest)) return false; if (e.action.wpStart.reactState > REACT_AGGRESSIVE) { - sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState); return false; } break; @@ -908,7 +906,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_SEND_TARGET_TO_TARGET: break; default: - sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); return false; } @@ -926,7 +924,7 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) CreatureData const* data = sObjectMgr->GetCreatureData(entry); if (!data) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } else @@ -936,7 +934,7 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) error = true; if (error) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id); return false; } return true; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index bc390441e04..05965d8ffa0 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -534,7 +534,6 @@ struct SmartAction struct { - uint32 emote1; uint32 emote2; uint32 emote3; @@ -1245,7 +1244,6 @@ struct SmartScriptHolder bool active; bool runOnce; bool enableTimed; - }; typedef UNORDERED_MAP WPPath; @@ -1312,7 +1310,7 @@ class SmartAIMgr { if (target < SMART_TARGET_NONE || target >= SMART_TARGET_END) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target); return false; } return true; @@ -1322,7 +1320,7 @@ class SmartAIMgr { if (max < min) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max); return false; } return true; @@ -1332,7 +1330,7 @@ class SmartAIMgr { if (pct < -100 || pct > 100) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct); return false; } return true; @@ -1342,7 +1340,7 @@ class SmartAIMgr { if (!data) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } return true; @@ -1352,7 +1350,7 @@ class SmartAIMgr { if (!sObjectMgr->GetCreatureTemplate(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1362,7 +1360,7 @@ class SmartAIMgr { if (!sObjectMgr->GetQuestTemplate(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1372,7 +1370,7 @@ class SmartAIMgr { if (!sObjectMgr->GetGameObjectTemplate(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1382,7 +1380,7 @@ class SmartAIMgr { if (!sSpellMgr->GetSpellInfo(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1392,7 +1390,7 @@ class SmartAIMgr { if (!sItemStore.LookupEntry(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1402,7 +1400,7 @@ class SmartAIMgr { if (!sEmotesTextStore.LookupEntry(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1412,7 +1410,7 @@ class SmartAIMgr { if (!sEmotesStore.LookupEntry(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1422,7 +1420,7 @@ class SmartAIMgr { if (!sAreaTriggerStore.LookupEntry(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1432,7 +1430,7 @@ class SmartAIMgr { if (!sSoundEntriesStore.LookupEntry(entry)) { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 450c05329b4..be4ce974f70 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -75,7 +75,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) { if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE) { - sLog->outErrorDb("Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType); return false; } @@ -107,7 +107,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) default: if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT) { - sLog->outErrorDb("Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType); return false; } break; @@ -122,7 +122,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE: if (!creature.id || !sObjectMgr->GetCreatureTemplate(creature.id)) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, creature.id); return false; } @@ -130,19 +130,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE: if (!classRace.class_id && !classRace.race_id) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.", criteria->ID, criteria->requiredType, dataType); return false; } if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, classRace.class_id); return false; } if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, classRace.race_id); return false; } @@ -150,7 +150,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH: if (health.percent < 1 || health.percent > 100) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, health.percent); return false; } @@ -158,7 +158,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD: if (player_dead.own_team_flag > 1) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).", criteria->ID, criteria->requiredType, dataType, player_dead.own_team_flag); return false; } @@ -169,19 +169,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(aura.spell_id); if (!spellEntry) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.", criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id); return false; } if (aura.effect_idx >= 3) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.", criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.effect_idx); return false; } if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.", criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id, aura.effect_idx); return false; } @@ -190,7 +190,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA: if (!GetAreaEntryByAreaID(area.id)) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, area.id); return false; } @@ -198,7 +198,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL: if (level.minlevel > STRONG_MAX_LEVEL) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, level.minlevel); return false; } @@ -206,7 +206,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER: if (gender.gender > GENDER_NONE) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, gender.gender); return false; } @@ -214,7 +214,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT: if (!ScriptId) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.", criteria->ID, criteria->requiredType, dataType); return false; } @@ -222,7 +222,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY: if (difficulty.difficulty >= MAX_DIFFICULTY) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, difficulty.difficulty); return false; } @@ -230,7 +230,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT: if (map_players.maxcount <= 0) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, map_players.maxcount); return false; } @@ -238,7 +238,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM: if (team.team != ALLIANCE && team.team != HORDE) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, team.team); return false; } @@ -246,7 +246,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK: if (drunk.state >= MAX_DRUNKEN) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, drunk.state); return false; } @@ -254,7 +254,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY: if (!sHolidaysStore.LookupEntry(holiday.id)) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, holiday.id); return false; } @@ -264,7 +264,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM: if (equipped_item.item_quality >= MAX_ITEM_QUALITY) { - sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, equipped_item.item_quality); return false; } @@ -272,7 +272,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID: if (!sMapStore.LookupEntry(map_id.mapId)) { - sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, map_id.mapId); return false; } @@ -280,25 +280,25 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE: if (!classRace.class_id && !classRace.race_id) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.", criteria->ID, criteria->requiredType, dataType); return false; } if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, classRace.class_id); return false; } if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0) { - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.", + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, classRace.race_id); return false; } return true; default: - sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType); return false; } } @@ -391,14 +391,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un Map* map = source->GetMap(); if (!map->IsDungeon()) { - sLog->outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u", + sLog->outError(LOG_FILTER_SQL, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u", ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); return false; } InstanceScript* instance = ((InstanceMap*)map)->GetInstanceScript(); if (!instance) { - sLog->outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script", + sLog->outError(LOG_FILTER_SQL, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script", ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); return false; } @@ -653,7 +653,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ if (!criteria) { // we will remove not existed criteria for all characters - sLog->outError("Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id); + sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEV_PROGRESS_CRITERIA); @@ -2029,7 +2029,7 @@ void AchievementMgr::RemoveTimedAchievement(AchievementCriteriaTimedTypes type, void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) { - sLog->outDetail("AchievementMgr::CompletedAchievement(%u)", achievement->ID); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::CompletedAchievement(%u)", achievement->ID); // disable for gamemasters with GM-mode enabled if (m_player->isGameMaster()) @@ -2201,8 +2201,8 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() if (sAchievementCriteriaStore.GetNumRows() == 0) { - sLog->outErrorDb(">> Loaded 0 achievement criteria."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement criteria."); + return; } @@ -2219,8 +2219,8 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria); } - sLog->outString(">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime)); + } void AchievementGlobalMgr::LoadAchievementReferenceList() @@ -2229,8 +2229,8 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (sAchievementStore.GetNumRows() == 0) { - sLog->outString(">> Loaded 0 achievement references."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement references."); + return; } @@ -2250,8 +2250,8 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539)) const_cast(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar) - sLog->outString(">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void AchievementGlobalMgr::LoadAchievementCriteriaData() @@ -2264,8 +2264,8 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!result) { - sLog->outString(">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); + return; } @@ -2280,7 +2280,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!criteria) { - sLog->outErrorDb("Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id); continue; } @@ -2290,7 +2290,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (strcmp(scriptName, "")) // not empty { if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT) - sLog->outErrorDb("Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType); else scriptId = sObjectMgr->GetScriptId(scriptName); } @@ -2393,11 +2393,11 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() } if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL)) - sLog->outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } - sLog->outString(">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void AchievementGlobalMgr::LoadCompletedAchievements() @@ -2408,8 +2408,8 @@ void AchievementGlobalMgr::LoadCompletedAchievements() if (!result) { - sLog->outString(">> Loaded 0 completed achievements. DB table `character_achievement` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty."); + return; } @@ -2422,7 +2422,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() if (!achievement) { // Remove non existent achievements from all characters - sLog->outError("Non-existing achievement %u data removed from table `character_achievement`.", achievementId); + sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement %u data removed from table `character_achievement`.", achievementId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEVMENT); @@ -2436,8 +2436,8 @@ void AchievementGlobalMgr::LoadCompletedAchievements() m_allCompletedAchievements.insert(achievementId); } while (result->NextRow()); - sLog->outString(">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); + } void AchievementGlobalMgr::LoadRewards() @@ -2451,8 +2451,8 @@ void AchievementGlobalMgr::LoadRewards() if (!result) { - sLog->outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); + return; } @@ -2465,7 +2465,7 @@ void AchievementGlobalMgr::LoadRewards() const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry); if (!pAchievement) { - sLog->outErrorDb("Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry); continue; } @@ -2480,19 +2480,19 @@ void AchievementGlobalMgr::LoadRewards() // must be title or mail at least if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender) { - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry); continue; } if (pAchievement->requiredFaction == ACHIEVEMENT_FACTION_ANY && ((reward.titleId[0] == 0) != (reward.titleId[1] == 0))) - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]); if (reward.titleId[0]) { CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]); if (!titleEntry) { - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]); reward.titleId[0] = 0; } } @@ -2502,7 +2502,7 @@ void AchievementGlobalMgr::LoadRewards() CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]); if (!titleEntry) { - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]); reward.titleId[1] = 0; } } @@ -2512,27 +2512,27 @@ void AchievementGlobalMgr::LoadRewards() { if (!sObjectMgr->GetCreatureTemplate(reward.sender)) { - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); reward.sender = 0; } } else { if (reward.itemId) - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry); if (!reward.subject.empty()) - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry); if (!reward.text.empty()) - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry); } if (reward.itemId) { if (!sObjectMgr->GetItemTemplate(reward.itemId)) { - sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId); + sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId); reward.itemId = 0; } } @@ -2543,8 +2543,8 @@ void AchievementGlobalMgr::LoadRewards() } while (result->NextRow()); - sLog->outString(">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void AchievementGlobalMgr::LoadRewardLocales() @@ -2559,8 +2559,8 @@ void AchievementGlobalMgr::LoadRewardLocales() if (!result) { - sLog->outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); + return; } @@ -2572,7 +2572,7 @@ void AchievementGlobalMgr::LoadRewardLocales() if (m_achievementRewards.find(entry) == m_achievementRewards.end()) { - sLog->outErrorDb("Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry); + sLog->outError(LOG_FILTER_SQL, "Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry); continue; } @@ -2586,6 +2586,6 @@ void AchievementGlobalMgr::LoadRewardLocales() } } while (result->NextRow()); - sLog->outString(">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); + } diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 528e682e8d4..2d1d02cf5d1 100755 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -43,8 +43,8 @@ void LoadFromDB() QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons"); if (!result) { - sLog->outString(">> Loaded 0 known addons. DB table `addons` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 known addons. DB table `addons` is empty!"); + return; } @@ -63,8 +63,8 @@ void LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SaveAddon(AddonInfo const& addon) diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 889f9d6fb75..57ab63cdd16 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -263,8 +263,8 @@ void AuctionHouseMgr::LoadAuctionItems() if (!result) { - sLog->outString(">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); + return; } @@ -272,7 +272,6 @@ void AuctionHouseMgr::LoadAuctionItems() do { - Field* fields = result->Fetch(); uint32 item_guid = fields[11].GetUInt32(); @@ -281,7 +280,7 @@ void AuctionHouseMgr::LoadAuctionItems() ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template); if (!proto) { - sLog->outError("AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template); + sLog->outError(LOG_FILTER_GENERAL, "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template); continue; } @@ -297,8 +296,8 @@ void AuctionHouseMgr::LoadAuctionItems() } while (result->NextRow()); - sLog->outString(">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void AuctionHouseMgr::LoadAuctions() @@ -310,8 +309,8 @@ void AuctionHouseMgr::LoadAuctions() if (!result) { - sLog->outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); + return; } @@ -336,8 +335,8 @@ void AuctionHouseMgr::LoadAuctions() CharacterDatabase.CommitTransaction(trans); - sLog->outString(">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void AuctionHouseMgr::AddAItem(Item* it) @@ -605,7 +604,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const Item* item = sAuctionMgr->GetAItem(item_guidlow); if (!item) { - sLog->outError("AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow); + sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow); return false; } data << uint32(Id); @@ -688,14 +687,14 @@ bool AuctionEntry::LoadFromDB(Field* fields) CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer); if (!auctioneerData) { - sLog->outError("Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); + sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); return false; } CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id); if (!auctioneerInfo) { - sLog->outError("Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); + sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); return false; } @@ -703,7 +702,7 @@ bool AuctionEntry::LoadFromDB(Field* fields) auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId); if (!auctionHouseEntry) { - sLog->outError("Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); + sLog->outError(LOG_FILTER_GENERAL, "Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); return false; } @@ -711,7 +710,7 @@ bool AuctionEntry::LoadFromDB(Field* fields) // and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems) if (!sAuctionMgr->GetAItem(item_guidlow)) { - sLog->outError("Auction %u has not a existing item : %u", Id, item_guidlow); + sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing item : %u", Id, item_guidlow); return false; } return true; @@ -735,8 +734,8 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() if (!expAuctions) { - sLog->outString(">> No expired auctions to delete"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired auctions to delete"); + return; } @@ -783,8 +782,8 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() } while (expAuctions->NextRow()); - sLog->outString(">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); + } @@ -810,14 +809,14 @@ bool AuctionEntry::LoadFromFieldList(Field* fields) CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer); if (!auctioneerData) { - sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); + sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); return false; } CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id); if (!auctioneerInfo) { - sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); + sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); return false; } @@ -826,7 +825,7 @@ bool AuctionEntry::LoadFromFieldList(Field* fields) if (!auctionHouseEntry) { - sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); + sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); return false; } diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 89151b6395c..7c6cabe37ba 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -87,7 +87,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uin // Add captain as member AddMember(CaptainGuid); - sLog->outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); return true; } @@ -125,7 +125,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // Check if player is already in a similar arena team if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0) { - sLog->outError("Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); return false; } @@ -184,7 +184,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); } - sLog->outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId()); return true; } @@ -250,7 +250,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) // Delete member if character information is missing if (newMember.Name.empty()) { - sLog->outErrorDb("ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid)); + sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid)); this->DelMember(newMember.Guid, true); continue; } @@ -297,7 +297,7 @@ void ArenaTeam::SetCaptain(uint64 guid) newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : ""; uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0; - sLog->outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "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()); } } @@ -321,7 +321,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->outArena("Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } // Only used for single member deletion, for arena team disband we use a single query for more efficiency @@ -346,7 +346,7 @@ void ArenaTeam::Disband(WorldSession* session) BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); if (Player* player = session->GetPlayer()) - sLog->outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } // Update database @@ -507,7 +507,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun data << str1 << str2 << str3; break; default: - sLog->outError("Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); return; } @@ -529,7 +529,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type) default: break; } - sLog->outError("FATAL: Unknown arena team type %u for some arena team", type); + sLog->outError(LOG_FILTER_BATTLEGROUND, "FATAL: Unknown arena team type %u for some arena team", type); return 0xFF; } diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index 1c24dfc061d..a36be0e7749 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -81,7 +81,7 @@ uint32 ArenaTeamMgr::GenerateArenaTeamId() { if (NextArenaTeamId >= 0xFFFFFFFE) { - sLog->outError("Arena team ids overflow!! Can't continue, shutting down server. "); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena team ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return NextArenaTeamId++; @@ -101,8 +101,8 @@ void ArenaTeamMgr::LoadArenaTeams() if (!result) { - sLog->outString(">> Loaded 0 arena teams. DB table `arena_team` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); + return; } @@ -132,8 +132,8 @@ void ArenaTeamMgr::LoadArenaTeams() } while (result->NextRow()); - sLog->outString(">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ArenaTeamMgr::DistributeArenaPoints() diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 456915d1ca4..cfb4aec8525 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -440,7 +440,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) if (!FindBgMap()) { - sLog->outError("Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID); EndNow(); return; } @@ -550,7 +550,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) if (dist >= maxDist) { - sLog->outError("BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", plr->GetName(), GetMapId()); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", plr->GetName(), GetMapId()); plr->TeleportTo(GetMapId(), x, y, z, o); } } @@ -588,7 +588,7 @@ inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, const c { player = ObjectAccessor::FindPlayer(guid); if (!player) - sLog->outError("Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!", context, GUID_LOPART(guid), m_MapId, m_InstanceID); } return player; @@ -771,17 +771,17 @@ void Battleground::EndBattleground(uint32 winner) winner_matchmaker_rating = GetArenaMatchmakerRating(winner); winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change); loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change); - sLog->outArena("match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change); SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change); SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change); SetArenaTeamRatingChangeForTeam(winner, winner_change); SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change); - sLog->outArena("Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); 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->outArena("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_BATTLEGROUND, "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); } // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes else @@ -1055,7 +1055,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if (Transport) player->TeleportToBGEntryPoint(); - sLog->outDetail("BATTLEGROUND: Removed player %s from Battleground.", player->GetName()); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Removed player %s from Battleground.", player->GetName()); } //battleground object will be deleted next Battleground::Update() call @@ -1075,7 +1075,7 @@ void Battleground::Reset() m_Events = 0; if (m_InvitedAlliance > 0 || m_InvitedHorde > 0) - sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_InvitedAlliance, m_InvitedHorde, m_MapId, m_InstanceID); m_InvitedAlliance = 0; @@ -1103,7 +1103,7 @@ void Battleground::StartBattleground() // and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this); if (m_IsRated) - sLog->outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); } void Battleground::AddPlayer(Player* player) @@ -1194,7 +1194,7 @@ void Battleground::AddPlayer(Player* player) AddOrSetPlayerToCorrectBgGroup(player, team); // Log - sLog->outDetail("BATTLEGROUND: Player %s joined the battle.", player->GetName()); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Player %s joined the battle.", player->GetName()); } // this method adds player to his team's bg group, or sets his correct group if player is already in bg group @@ -1392,7 +1392,7 @@ void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, itr->second->HealingDone += value; break; default: - sLog->outError("Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!", type, m_MapId, m_InstanceID); break; } @@ -1441,9 +1441,9 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(), PHASEMASK_NORMAL, x, y, z, o, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY)) { - sLog->outErrorDb("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_SQL, "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); - sLog->outError("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); delete go; return false; @@ -1494,7 +1494,7 @@ void Battleground::DoorClose(uint32 type) } } else - sLog->outError("Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); } @@ -1506,7 +1506,7 @@ void Battleground::DoorOpen(uint32 type) obj->SetGoState(GO_STATE_ACTIVE); } else - sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); } @@ -1514,7 +1514,7 @@ GameObject* Battleground::GetBGObject(uint32 type) { GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]); if (!obj) - sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); return obj; } @@ -1523,7 +1523,7 @@ Creature* Battleground::GetBGCreature(uint32 type) { Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]); if (!creature) - sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); return creature; } @@ -1556,7 +1556,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f Creature* creature = new Creature; if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o)) { - sLog->outError("Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); delete creature; return NULL; @@ -1567,7 +1567,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); delete creature; return NULL; @@ -1602,7 +1602,7 @@ bool Battleground::DelCreature(uint32 type) return true; } - sLog->outError("Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); BgCreatures[type] = 0; return false; @@ -1620,7 +1620,7 @@ bool Battleground::DelObject(uint32 type) BgObjects[type] = 0; return true; } - sLog->outError("Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); BgObjects[type] = 0; return false; @@ -1646,7 +1646,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float //creature->CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true); return true; } - sLog->outError("Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!", type, entry, m_MapId, m_InstanceID); EndNow(); return false; @@ -1745,7 +1745,7 @@ void Battleground::HandleTriggerBuff(uint64 go_guid) index--; if (index < 0) { - sLog->outError("Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!", GUID_LOPART(go_guid), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID); return; } @@ -1869,7 +1869,7 @@ int32 Battleground::GetObjectType(uint64 guid) for (uint32 i = 0; i < BgObjects.size(); ++i) if (BgObjects[i] == guid) return i; - sLog->outError("Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?", + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?", GUID_LOPART(guid), m_MapId, m_InstanceID); return -1; } diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 2b2265dad84..b2615d3e54c 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -226,7 +226,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro *data << uint8(uiFrame); break; default: - sLog->outError("Unknown BG status!"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Unknown BG status!"); break; } } @@ -281,7 +281,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) itr2 = itr++; if (!bg->IsPlayerInBattleground(itr2->first)) { - sLog->outError("Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true)); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true)); continue; } @@ -391,7 +391,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) // should never happen if (++scoreCount >= bg->GetMaxPlayers() && itr != bg->GetPlayerScoresEnd()) { - sLog->outError("Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetTypeID(true), bg->GetPlayerScoresSize(), bg->GetMaxPlayers()); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetTypeID(true), bg->GetPlayerScoresSize(), bg->GetMaxPlayers()); break; } } @@ -508,7 +508,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId if (!bg_template) { - sLog->outError("Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId); return NULL; } bool isRandom = false; @@ -550,7 +550,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId bg_template = GetBattlegroundTemplate(bgTypeId); if (!bg_template) { - sLog->outError("Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId); return NULL; } } @@ -683,8 +683,8 @@ void BattlegroundMgr::CreateInitialBattlegrounds() if (!result) { - sLog->outErrorDb(">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); + return; } @@ -702,7 +702,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() bl = sBattlemasterListStore.LookupEntry(bgTypeID_); if (!bl) { - sLog->outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_); continue; } @@ -717,14 +717,14 @@ void BattlegroundMgr::CreateInitialBattlegrounds() // check values from DB if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam) { - sLog->outErrorDb("Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)", + sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)", data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam); continue; } if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax) { - sLog->outErrorDb("Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)", + sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)", data.bgTypeId, data.LevelMin, data.LevelMax); continue; } @@ -746,7 +746,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } else { - sLog->outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId); + sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId); continue; } @@ -767,7 +767,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } else { - sLog->outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId); + sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId); continue; } @@ -792,8 +792,8 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } while (result->NextRow()); - sLog->outString(">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void BattlegroundMgr::InitAutomaticArenaPointDistribution() @@ -890,12 +890,12 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt team = player->GetTeam(); bg->GetTeamStartLoc(team, x, y, z, O); - sLog->outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", player->GetName(), mapid, x, y, z, O); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", player->GetName(), mapid, x, y, z, O); player->TeleportTo(mapid, x, y, z, O); } else { - sLog->outError("player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId); + sLog->outError(LOG_FILTER_BATTLEGROUND, "player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId); } } @@ -1077,8 +1077,8 @@ void BattlegroundMgr::LoadBattleMastersEntry() if (!result) { - sLog->outString(">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); + return; } @@ -1094,7 +1094,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() uint32 bgTypeId = fields[1].GetUInt32(); if (!sBattlemasterListStore.LookupEntry(bgTypeId)) { - sLog->outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId); + sLog->outError(LOG_FILTER_SQL, "Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId); continue; } @@ -1102,8 +1102,8 @@ void BattlegroundMgr::LoadBattleMastersEntry() } while (result->NextRow()); - sLog->outString(">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId) diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 6f4264c0faf..85d41977d13 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -294,7 +294,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) itr = m_QueuedPlayers.find(guid); if (itr == m_QueuedPlayers.end()) { - sLog->outError("BattlegroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid)); return; } @@ -328,7 +328,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) //player can't be in queue without group, but just in case if (bracket_id == -1) { - sLog->outError("BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid)); return; } sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id); @@ -780,14 +780,14 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp Battleground* bg_template = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); if (!bg_template) { - sLog->outError("Battleground: Update: bg template not found for %u", bgTypeId); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: Update: bg template not found for %u", bgTypeId); return; } PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bg_template->GetMapId(), bracket_id); if (!bracketEntry) { - sLog->outError("Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id); return; } @@ -838,7 +838,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, 0, false); if (!bg2) { - sLog->outError("BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); return; } //invite those selection pools @@ -864,7 +864,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, false); if (!bg2) { - sLog->outError("BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); return; } @@ -962,7 +962,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp Battleground* arena = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, true); if (!arena) { - sLog->outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update couldn't create arena instance for rated arena match!"); return; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index d28f5ddfe6a..8b2543f20ff 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -238,7 +238,7 @@ void BattlegroundAB::HandleAreaTrigger(Player* Source, uint32 Trigger) case 4021: // Unk2 //break; default: - //sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + //sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); //Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } @@ -356,7 +356,7 @@ void BattlegroundAB::_SendNodeUpdate(uint8 node) void BattlegroundAB::_NodeOccupied(uint8 node, Team team) { if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team)) - sLog->outError("Failed to spawn spirit guide! point: %u, team: %u, ", node, team); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Failed to spawn spirit guide! point: %u, team: %u, ", node, team); uint8 capturedNodes = 0; for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) @@ -561,7 +561,7 @@ bool BattlegroundAB::SetupBattleground() || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) ) { - sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn some object Battleground not created!"); return false; } } @@ -569,7 +569,7 @@ bool BattlegroundAB::SetupBattleground() || !AddObject(BG_AB_OBJECT_GATE_H, BG_AB_OBJECTID_GATE_H, BG_AB_DoorPositions[1][0], BG_AB_DoorPositions[1][1], BG_AB_DoorPositions[1][2], BG_AB_DoorPositions[1][3], BG_AB_DoorPositions[1][4], BG_AB_DoorPositions[1][5], BG_AB_DoorPositions[1][6], BG_AB_DoorPositions[1][7], RESPAWN_IMMEDIATELY) ) { - sLog->outErrorDb("BatteGroundAB: Failed to spawn door object Battleground not created!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn door object Battleground not created!"); return false; } //buffs @@ -579,7 +579,7 @@ bool BattlegroundAB::SetupBattleground() || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) ) - sLog->outErrorDb("BatteGroundAB: Failed to spawn buff object!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn buff object!"); } return true; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index d2cbab2be54..96fa899a746 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -93,7 +93,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) { if (!m_CaptainAlive[0]) { - sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); return; } m_CaptainAlive[0]=false; @@ -112,7 +112,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) { if (!m_CaptainAlive[1]) { - sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); return; } m_CaptainAlive[1]=false; @@ -480,7 +480,7 @@ void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team { if (!player) { - sLog->outError("bg_AV no player at remove"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "bg_AV no player at remove"); return; } //TODO search more buffs @@ -588,7 +588,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp]) DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp); else - sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp); //spawn destroyed aura for (uint8 i=0; i <= 9; i++) SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY); @@ -753,7 +753,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) if (BgCreatures[node]) DelCreature(node); if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) - sLog->outError("AV: couldn't spawn spiritguide at node %i", node); + sLog->outError(LOG_FILTER_BATTLEGROUND, "AV: couldn't spawn spiritguide at node %i", node); } for (uint8 i=0; i<4; i++) @@ -811,7 +811,7 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object) return BG_AV_Nodes(object - 29); if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) return BG_AV_NODES_SNOWFALL_GRAVE; - sLog->outError("BattlegroundAV: ERROR! GetPlace got a wrong object :("); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundAV: ERROR! GetPlace got a wrong object :("); ASSERT(false); return BG_AV_Nodes(0); } @@ -849,7 +849,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node) } else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM) return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; - sLog->outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node); ASSERT(false); return 0; } @@ -903,7 +903,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) sLog->outDebug(LOG_FILTER_BATTLEGROUND, "player defends point object: %i node: %i", object, node); if (m_Nodes[node].PrevOwner != team) { - sLog->outError("BG_AV: player defends point which doesn't belong to his team %i", node); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: player defends point which doesn't belong to his team %i", node); return; } @@ -1124,7 +1124,7 @@ uint8 BattlegroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used if (state == POINT_ASSAULTED) return 3; } - sLog->outError("BG_AV: should update a strange worldstate state:%i team:%i", state, team); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: should update a strange worldstate state:%i team:%i", state, team); return 5; //this will crash the game, but i want to know if something is wrong here } @@ -1203,7 +1203,7 @@ bool BattlegroundAV::SetupBattleground() // horde gates || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3]/2), cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY)) { - sLog->outErrorDb("BatteGroundAV: Failed to spawn some object Battleground not created!1"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1"); return false; } @@ -1221,7 +1221,7 @@ bool BattlegroundAV::SetupBattleground() || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!2"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2"); return false; } } @@ -1236,7 +1236,7 @@ bool BattlegroundAV::SetupBattleground() || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!3"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3"); return false; } } @@ -1249,7 +1249,7 @@ bool BattlegroundAV::SetupBattleground() || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!4"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4"); return false; } } @@ -1257,7 +1257,7 @@ bool BattlegroundAV::SetupBattleground() { if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i); return false; } } @@ -1271,7 +1271,7 @@ bool BattlegroundAV::SetupBattleground() { if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i); return false; } } @@ -1279,7 +1279,7 @@ bool BattlegroundAV::SetupBattleground() { if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i); return false; } } @@ -1289,7 +1289,7 @@ bool BattlegroundAV::SetupBattleground() { if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i); return false; } } @@ -1297,14 +1297,14 @@ bool BattlegroundAV::SetupBattleground() { if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i); return false; } } if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!8"); return false; } for (uint8 i = 0; i < 4; i++) @@ -1314,7 +1314,7 @@ bool BattlegroundAV::SetupBattleground() || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)) { - sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i); return false; } } @@ -1402,7 +1402,7 @@ const char* BattlegroundAV::GetNodeName(BG_AV_Nodes node) case BG_AV_NODES_FROSTWOLF_WTOWER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_FROST_W); case BG_AV_NODES_FROSTWOLF_HUT: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_FROST_HUT); default: - sLog->outError("tried to get name for node %u", node); + sLog->outError(LOG_FILTER_BATTLEGROUND, "tried to get name for node %u", node); break; } @@ -1413,22 +1413,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, uint16 team) { if (m_Nodes[node].TotalOwner == team) { - sLog->outCrash("Assaulting team is TotalOwner of node"); + sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is TotalOwner of node"); ASSERT (false); } if (m_Nodes[node].Owner == team) { - sLog->outCrash("Assaulting team is owner of node"); + sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is owner of node"); ASSERT (false); } if (m_Nodes[node].State == POINT_DESTROYED) { - sLog->outCrash("Destroyed node is being assaulted"); + sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Destroyed node is being assaulted"); ASSERT (false); } if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists { - sLog->outCrash("Assault on an not assaulted node with total owner"); + sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assault on an not assaulted node with total owner"); ASSERT (false); } //the timer gets another time, if the previous owner was 0 == Neutral diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index c7eddbb67a9..78cf6b9863f 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -89,7 +89,7 @@ void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - sLog->outError("Killer player not found"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Killer player not found"); return; } @@ -122,7 +122,7 @@ void BattlegroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger) //buff_guid = BgObjects[BG_BE_OBJECT_BUFF_2]; break; default: - sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } @@ -154,7 +154,7 @@ bool BattlegroundBE::SetupBattleground() || !AddObject(BG_BE_OBJECT_BUFF_1, BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120) || !AddObject(BG_BE_OBJECT_BUFF_2, BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)) { - sLog->outErrorDb("BatteGroundBE: Failed to spawn some object!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundBE: Failed to spawn some object!"); return false; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index ccc6a2305b4..20eba2a7f67 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -171,7 +171,7 @@ void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - sLog->outError("BattlegroundDS: Killer player not found"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundDS: Killer player not found"); return; } @@ -200,7 +200,7 @@ void BattlegroundDS::HandleAreaTrigger(Player* Source, uint32 Trigger) setPipeKnockBackCount(0); break; default: - sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } @@ -240,7 +240,7 @@ bool BattlegroundDS::SetupBattleground() || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 0, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY) || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 0, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY)) { - sLog->outErrorDb("BatteGroundDS: Failed to spawn some object!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundDS: Failed to spawn some object!"); return false; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 8269a04a383..9bab15d9b5e 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -153,7 +153,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint() Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]); if (!player) { - sLog->outError("BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); ++j; continue; } @@ -193,7 +193,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint() Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]); if (!player) { - sLog->outError("BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); //move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); @@ -411,7 +411,7 @@ void BattlegroundEY::HandleAreaTrigger(Player* Source, uint32 Trigger) case 5866: break; default: - sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } @@ -474,7 +474,7 @@ bool BattlegroundEY::SetupBattleground() || !AddObject(BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER, BG_OBJECT_HU_TOWER_CAP_EY_ENTRY, 2282.121582f, 1760.006958f, 1189.707153f, 1.919862f, 0, 0, 0.819152f, 0.573576f, RESPAWN_ONE_DAY) ) { - sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn some object Battleground not created!"); return false; } @@ -484,28 +484,28 @@ bool BattlegroundEY::SetupBattleground() AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]); if (!at) { - sLog->outError("BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]); continue; } if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) ) - sLog->outError("BattlegroundEY: Cannot spawn buff"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Cannot spawn buff"); } WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE); if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) { - sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); return false; } sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE); if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) { - sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); return false; } @@ -570,7 +570,7 @@ void BattlegroundEY::RespawnFlagAfterDrop() if (obj) obj->Delete(); else - sLog->outError("BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID())); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID())); SetDroppedFlagGUID(0); } @@ -742,7 +742,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point) WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId); if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team)) - sLog->outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", + sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", Point, Team, m_CapturingPointTypes[Point].GraveYardId); // SpawnBGCreature(Point, RESPAWN_IMMEDIATELY); @@ -894,7 +894,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player) if (!entry) { - sLog->outError("BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!"); return NULL; } @@ -911,7 +911,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player) { entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId); if (!entry) - sLog->outError("BattlegroundEY: Not found graveyard: %u", m_CapturingPointTypes[i].GraveYardId); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Not found graveyard: %u", m_CapturingPointTypes[i].GraveYardId); else { distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index ccc9493e234..202869567d8 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -275,7 +275,7 @@ void BattlegroundIC::StartingEventOpenDoors() BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y, BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY)) - sLog->outError("Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry); } } @@ -372,7 +372,7 @@ bool BattlegroundIC::SetupBattleground() BG_IC_ObjSpawnlocs[i].z, BG_IC_ObjSpawnlocs[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY)) { - sLog->outError("Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry); return false; } } @@ -384,7 +384,7 @@ bool BattlegroundIC::SetupBattleground() BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o, RESPAWN_ONE_DAY)) { - sLog->outError("Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry); return false; } } @@ -394,7 +394,7 @@ bool BattlegroundIC::SetupBattleground() || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], ALLIANCE) || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], HORDE)) { - sLog->outError("Isle of Conquest: Failed to spawn initial spirit guide!"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: Failed to spawn initial spirit guide!"); return false; } @@ -403,7 +403,7 @@ bool BattlegroundIC::SetupBattleground() if (!gunshipAlliance || !gunshipHorde) { - sLog->outError("Isle of Conquest: There was an error creating gunships!"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error creating gunships!"); return false; } @@ -615,7 +615,7 @@ uint32 BattlegroundIC::GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool r return nodePoint->last_entry; // we should never be here... - sLog->outError("Isle Of Conquest: Unexpected return in GetNextBanner function"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle Of Conquest: Unexpected return in GetNextBanner function"); return 0; } @@ -639,7 +639,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1], BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3], (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE))) - sLog->outError("Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction); } switch (nodePoint->gameobject_type) @@ -658,7 +658,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) 0, 0, 0, 0, RESPAWN_ONE_DAY); } - //sLog->outError("BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction); + //sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction); (nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->BuildStartMovePacket(GetBgMap()); (nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap()); @@ -908,7 +908,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period) if (!goinfo) { - sLog->outErrorDb("Transport ID: %u will not be loaded, gameobject_template missing", goEntry); + sLog->outError(LOG_FILTER_SQL, "Transport ID: %u will not be loaded, gameobject_template missing", goEntry); delete t; return NULL; } @@ -918,7 +918,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period) if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed)) // skip transports with empty waypoints list { - sLog->outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId); + sLog->outError(LOG_FILTER_SQL, "Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId); delete t; return NULL; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index 0974c96a991..f39b1ba5540 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -86,7 +86,7 @@ void BattlegroundNA::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - sLog->outError("BattlegroundNA: Killer player not found"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundNA: Killer player not found"); return; } @@ -115,7 +115,7 @@ void BattlegroundNA::HandleAreaTrigger(Player* Source, uint32 Trigger) case 4537: // buff trigger? break; default: - sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } @@ -147,7 +147,7 @@ bool BattlegroundNA::SetupBattleground() || !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120) || !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)) { - sLog->outErrorDb("BatteGroundNA: Failed to spawn some object!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundNA: Failed to spawn some object!"); return false; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index 6a626217a4e..7fa9980a77c 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -86,7 +86,7 @@ void BattlegroundRL::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - sLog->outError("Killer player not found"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "Killer player not found"); return; } @@ -116,7 +116,7 @@ void BattlegroundRL::HandleAreaTrigger(Player* Source, uint32 Trigger) case 4697: // buff trigger? break; default: - sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } @@ -146,7 +146,7 @@ bool BattlegroundRL::SetupBattleground() || !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971f, 1632.719971f, 36.730400f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120) || !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049f, 1699.170044f, 34.872601f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)) { - sLog->outErrorDb("BatteGroundRL: Failed to spawn some object!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundRL: Failed to spawn some object!"); return false; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 6869a899305..561cac54025 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -130,7 +130,7 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - sLog->outError("BattlegroundRV: Killer player not found"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundRV: Killer player not found"); return; } @@ -162,7 +162,7 @@ void BattlegroundRV::HandleAreaTrigger(Player* Source, uint32 Trigger) case 5474: break; default: - sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } @@ -214,7 +214,7 @@ bool BattlegroundRV::SetupBattleground() ) { - sLog->outErrorDb("BatteGroundRV: Failed to spawn some object!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundRV: Failed to spawn some object!"); return false; } return true; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index d15c7943bab..58f7cabc72d 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -162,7 +162,7 @@ bool BattlegroundSA::ResetObjs() if (!sg) { - sLog->outError("SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]); + sLog->outError(LOG_FILTER_BATTLEGROUND, "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]); return false; } @@ -175,7 +175,7 @@ bool BattlegroundSA::ResetObjs() { GraveyardStatus[i] = ((Attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE); if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((Attackers == TEAM_HORDE)? ALLIANCE : HORDE))) - sLog->outError("SOTA: couldn't spawn GY: %u", i); + sLog->outError(LOG_FILTER_BATTLEGROUND, "SOTA: couldn't spawn GY: %u", i); } } @@ -725,7 +725,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); if (!sg) { - sLog->outError("BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]); return; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index d100dc645a2..483e8ffdaf6 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -251,7 +251,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team))) obj->Delete(); else - sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); + sLog->outError(LOG_FILTER_BATTLEGROUND, "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); SetDroppedFlagGUID(0, team); _bothFlagsKept = false; @@ -557,7 +557,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) { if (!player) { - sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!"); this->SetAllianceFlagPicker(0); this->RespawnFlag(ALLIANCE, false); } @@ -568,7 +568,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) { if (!player) { - sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!"); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!"); this->SetHordeFlagPicker(0); this->RespawnFlag(HORDE, false); } @@ -637,7 +637,7 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger) case 4629: // unk4 break; default: - sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); break; } @@ -672,21 +672,21 @@ bool BattlegroundWS::SetupBattleground() || !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY) ) { - sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn some object Battleground not created!"); return false; } WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) { - sLog->outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!"); return false; } sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) { - sLog->outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!"); + sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!"); return false; } diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index 62bc0ab3205..80de42c0ce2 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -99,7 +99,7 @@ CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) if (itr != _invites.end()) return &(itr->second); - sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId); + sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId); return NULL; } @@ -109,7 +109,7 @@ CalendarEvent* CalendarMgr::GetEvent(uint64 eventId) if (itr != _events.end()) return &(itr->second); - sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId); + sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId); return NULL; } @@ -149,7 +149,7 @@ void CalendarMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u calendar events", count); + sLog->outInfo(LOG_FILTER_CALENDAR, ">> Loaded %u calendar events", count); count = 0; // 0 1 2 3 4 5 6 7 @@ -176,7 +176,7 @@ void CalendarMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u calendar Invites", count); + sLog->outInfo(LOG_FILTER_CALENDAR, ">> Loaded %u calendar Invites", count); */ } @@ -442,7 +442,7 @@ bool CalendarMgr::AddEvent(CalendarEvent const& newEvent) uint64 eventId = newEvent.GetEventId(); if (_events.find(eventId) != _events.end()) { - sLog->outError("CalendarMgr::AddEvent: Event [" UI64FMTD "] exists", eventId); + sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::AddEvent: Event [" UI64FMTD "] exists", eventId); return false; } @@ -455,7 +455,7 @@ bool CalendarMgr::RemoveEvent(uint64 eventId) CalendarEventMap::iterator itr = _events.find(eventId); if (itr == _events.end()) { - sLog->outError("CalendarMgr::RemoveEvent: Event [" UI64FMTD "] does not exist", eventId); + sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::RemoveEvent: Event [" UI64FMTD "] does not exist", eventId); return false; } @@ -494,13 +494,13 @@ bool CalendarMgr::AddInvite(CalendarInvite const& newInvite) uint64 inviteId = newInvite.GetInviteId(); if (!inviteId) { - sLog->outError("CalendarMgr::AddInvite: Cant add Invite 0"); + sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::AddInvite: Cant add Invite 0"); return false; } if (_invites.find(inviteId) != _invites.end()) { - sLog->outError("CalendarMgr::AddInvite: Invite [" UI64FMTD "] exists", inviteId); + sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::AddInvite: Invite [" UI64FMTD "] exists", inviteId); return false; } @@ -516,7 +516,7 @@ uint64 CalendarMgr::RemoveInvite(uint64 inviteId) CalendarInviteMap::iterator itr = _invites.find(inviteId); if (itr == _invites.end()) { - sLog->outError("CalendarMgr::RemoveInvite: Invite [" UI64FMTD "] does not exist", inviteId); + sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::RemoveInvite: Invite [" UI64FMTD "] does not exist", inviteId); return 0; } diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 0e89601e987..c3845f16826 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -36,13 +36,13 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels - if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel + if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel m_flags |= CHANNEL_FLAG_TRADE; - if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels + if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels m_flags |= CHANNEL_FLAG_CITY; - if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel + if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel m_flags |= CHANNEL_FLAG_LFG; else // for all other channels m_flags |= CHANNEL_FLAG_NOT_LFG; diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index ac030ffb73f..887e53f49a5 100755 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -49,4 +49,3 @@ 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 32a6273abd4..b5bad419c98 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -401,12 +401,12 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text, // expected subcommand by full name DB content else if (*text) { - sLog->outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str()); + sLog->outError(LOG_FILTER_SQL, "Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str()); return false; } if (table[i].SecurityLevel != security) - sLog->outDetail("Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security); + sLog->outInfo(LOG_FILTER_GENERAL, "Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security); table[i].SecurityLevel = security; table[i].Help = help; @@ -417,9 +417,9 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text, if (!cmd.empty()) { if (table == getCommandTable()) - sLog->outErrorDb("Table `command` have not existed command '%s', skip.", cmd.c_str()); + sLog->outError(LOG_FILTER_SQL, "Table `command` have not existed command '%s', skip.", cmd.c_str()); else - sLog->outErrorDb("Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str()); + sLog->outError(LOG_FILTER_SQL, "Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str()); } return false; diff --git a/src/server/game/Combat/HostileRefManager.h b/src/server/game/Combat/HostileRefManager.h index 8a49d230161..b8991d8faf8 100755 --- a/src/server/game/Combat/HostileRefManager.h +++ b/src/server/game/Combat/HostileRefManager.h @@ -71,4 +71,3 @@ class HostileRefManager : public RefManager }; //================================================= #endif - diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 0c43c9ece0e..87853a53b6c 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -194,7 +194,6 @@ void HostileReference::updateOnlineStatus() } else accessible = true; - } setAccessibleState(accessible); setOnlineOfflineState(online); diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h index 39c79b8273a..de60491de89 100755 --- a/src/server/game/Combat/UnitEvents.h +++ b/src/server/game/Combat/UnitEvents.h @@ -77,7 +77,6 @@ class UnitBaseEvent bool matchesTypeMask(uint32 pMask) const { return iType & pMask; } void setType(uint32 pType) { iType = pType; } - }; //============================================================== @@ -134,4 +133,3 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent //============================================================== #endif - diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 9f534ab697d..e6acefcce48 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ - #include "Player.h" #include "SpellAuras.h" #include "SpellMgr.h" @@ -686,7 +685,7 @@ void ConditionMgr::LoadConditions(bool isReload) //must clear all custom handled cases (groupped types) before reload if (isReload) { - sLog->outString("Reseting Loot Conditions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Reseting Loot Conditions..."); LootTemplates_Creature.ResetConditions(); LootTemplates_Fishing.ResetConditions(); LootTemplates_Gameobject.ResetConditions(); @@ -700,10 +699,10 @@ void ConditionMgr::LoadConditions(bool isReload) LootTemplates_Prospecting.ResetConditions(); LootTemplates_Spell.ResetConditions(); - sLog->outString("Re-Loading `gossip_menu` Table for Conditions!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table for Conditions!"); sObjectMgr->LoadGossipMenu(); - sLog->outString("Re-Loading `gossip_menu_option` Table for Conditions!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table for Conditions!"); sObjectMgr->LoadGossipMenuItems(); sSpellMgr->UnloadSpellInfoImplicitTargetConditionLists(); } @@ -713,8 +712,8 @@ void ConditionMgr::LoadConditions(bool isReload) if (!result) { - sLog->outErrorDb(">> Loaded 0 conditions. DB table `conditions` is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!"); + return; } @@ -722,7 +721,6 @@ void ConditionMgr::LoadConditions(bool isReload) do { - Field* fields = result->Fetch(); Condition* cond = new Condition(); @@ -750,7 +748,7 @@ void ConditionMgr::LoadConditions(bool isReload) { if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skip { - sLog->outErrorDb("Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId); + sLog->outError(LOG_FILTER_SQL, "Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId); delete cond; continue; } @@ -761,19 +759,19 @@ void ConditionMgr::LoadConditions(bool isReload) rowType = "reference"; //check for useless data if (cond->ConditionTarget) - sLog->outErrorDb("Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget); + sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget); if (cond->ConditionValue1) - sLog->outErrorDb("Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1); if (cond->ConditionValue2) - sLog->outErrorDb("Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3); if (cond->NegativeCondition) - sLog->outErrorDb("Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition); + sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition); if (cond->SourceGroup && iSourceTypeOrReferenceId < 0) - sLog->outErrorDb("Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup); if (cond->SourceEntry && iSourceTypeOrReferenceId < 0) - sLog->outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry); } else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType { @@ -804,13 +802,13 @@ void ConditionMgr::LoadConditions(bool isReload) //Grouping is only allowed for some types (loot templates, gossip menus, gossip items) if (cond->SourceGroup && !CanHaveSourceGroupSet(cond->SourceType)) { - sLog->outErrorDb("Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup); delete cond; continue; } if (cond->SourceId && !CanHaveSourceIdSet(cond->SourceType)) { - sLog->outErrorDb("Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId); + sLog->outError(LOG_FILTER_SQL, "Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId); delete cond; continue; } @@ -896,7 +894,7 @@ void ConditionMgr::LoadConditions(bool isReload) if (!valid) { - sLog->outErrorDb("Not handled grouped condition, SourceGroup %u", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "Not handled grouped condition, SourceGroup %u", cond->SourceGroup); delete cond; } else @@ -928,22 +926,22 @@ void ConditionMgr::LoadConditions(bool isReload) } while (result->NextRow()); - sLog->outString(">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot) { if (!loot) { - sLog->outErrorDb("ConditionMgr: LootTemplate %u not found", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "ConditionMgr: LootTemplate %u not found", cond->SourceGroup); return false; } if (loot->addConditionItem(cond)) return true; - sLog->outErrorDb("ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup); return false; } @@ -963,7 +961,7 @@ bool ConditionMgr::addToGossipMenus(Condition* cond) } } - sLog->outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "addToGossipMenus: GossipMenu %u not found", cond->SourceGroup); return false; } @@ -982,7 +980,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond) } } - sLog->outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry); return false; } @@ -1037,7 +1035,7 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond) // we have overlapping masks in db if (conditionEffMask != *itr) { - sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - " + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - " "effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1062,7 +1060,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX) { - sLog->outErrorDb("Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType)); + sLog->outError(LOG_FILTER_SQL, "Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType)); return false; } @@ -1072,7 +1070,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Creature.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1080,7 +1078,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1089,7 +1087,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Disenchant.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1097,7 +1095,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1106,7 +1104,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Fishing.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1114,7 +1112,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1123,7 +1121,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Gameobject.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1131,7 +1129,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1140,7 +1138,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Item.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1148,7 +1146,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1157,7 +1155,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Mail.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1165,7 +1163,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1174,7 +1172,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Milling.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1182,7 +1180,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1191,7 +1189,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Pickpocketing.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1199,7 +1197,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1208,7 +1206,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Prospecting.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1216,7 +1214,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1225,7 +1223,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Reference.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1233,7 +1231,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1242,7 +1240,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Skinning.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1250,7 +1248,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1259,7 +1257,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Spell.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1267,7 +1265,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1277,13 +1275,13 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cond->SourceEntry); if (!spellInfo) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } if ((cond->SourceGroup > MAX_EFFECT_MASK) || !cond->SourceGroup) { - sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1314,7 +1312,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) break; } - sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i)); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i)); cond->SourceGroup &= ~(1<GetCreatureTemplate(cond->SourceEntry)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry); return false; } break; @@ -1336,7 +1334,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry); if (!spellProto) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; @@ -1344,40 +1342,40 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) case CONDITION_SOURCE_TYPE_QUEST_ACCEPT: if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry)) { - sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK: if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry)) { - sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); return false; } if (!sSpellMgr->GetSpellInfo(cond->SourceEntry)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); return false; } if (!sSpellMgr->GetSpellInfo(cond->SourceEntry)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; @@ -1395,13 +1393,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionType == CONDITION_NONE || cond->ConditionType >= CONDITION_MAX) { - sLog->outErrorDb("Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry); return false; } if (cond->ConditionTarget >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry); + sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry); return false; } @@ -1411,17 +1409,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1)) { - sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 > EFFECT_2) { - sLog->outErrorDb("Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("Aura condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Aura condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ITEM: @@ -1429,13 +1427,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1); if (!proto) { - sLog->outErrorDb("Item condition has non existing item (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Item condition has non existing item (%u), skipped", cond->ConditionValue1); return false; } if (!cond->ConditionValue2) { - sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2); return false; } break; @@ -1445,14 +1443,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1); if (!proto) { - sLog->outErrorDb("ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ZONEID: @@ -1460,20 +1458,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->ConditionValue1); if (!areaEntry) { - sLog->outErrorDb("ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1); return false; } if (areaEntry->zone != 0) { - sLog->outErrorDb("ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_REPUTATION_RANK: @@ -1481,25 +1479,25 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) FactionEntry const* factionEntry = sFactionStore.LookupEntry(cond->ConditionValue1); if (!factionEntry) { - sLog->outErrorDb("Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TEAM: { if (cond->ConditionValue1 != ALLIANCE && cond->ConditionValue1 != HORDE) { - sLog->outErrorDb("Team condition specifies unknown team (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Team condition specifies unknown team (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Team condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Team condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Team condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Team condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SKILL: @@ -1507,17 +1505,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(cond->ConditionValue1); if (!pSkill) { - sLog->outErrorDb("Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 < 1 || cond->ConditionValue2 > sWorld->GetConfigMaxSkillValue()) { - sLog->outErrorDb("Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("Skill condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Skill condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_QUESTREWARDED: @@ -1527,14 +1525,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sObjectMgr->GetQuestTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 > 1) - sLog->outErrorDb("Quest condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Quest condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Quest condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Quest condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ACTIVE_EVENT: @@ -1542,14 +1540,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); if (cond->ConditionValue1 >=events.size() || !events[cond->ConditionValue1].isValid()) { - sLog->outErrorDb("ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ACHIEVEMENT: @@ -1557,42 +1555,42 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AchievementEntry const* achievement = sAchievementStore.LookupEntry(cond->ConditionValue1); if (!achievement) { - sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_CLASS: { if (!(cond->ConditionValue1 & CLASSMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE); + sLog->outError(LOG_FILTER_SQL, "Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Class condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Class condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Class condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Class condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_RACE: { if (!(cond->ConditionValue1 & RACEMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE); + sLog->outError(LOG_FILTER_SQL, "Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Race condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Race condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Race condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_MAPID: @@ -1600,77 +1598,77 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1); if (!me) { - sLog->outErrorDb("Map condition has non existing map (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Map condition has non existing map (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Map condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Map condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Map condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Map condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SPELL: { if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1)) { - sLog->outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Spell condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Spell condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Spell condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Spell condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_LEVEL: { if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("Level condition has invalid option (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Level condition has invalid option (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("Level condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Level condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_DRUNKENSTATE: { if (cond->ConditionValue1 > DRUNKEN_SMASHED) { - sLog->outErrorDb("DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) { - sLog->outErrorDb("DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_NEAR_CREATURE: { if (!sObjectMgr->GetCreatureTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_NEAR_GAMEOBJECT: { if (!sObjectMgr->GetGameObjectTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_OBJECT_ENTRY: @@ -1680,79 +1678,79 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case TYPEID_UNIT: if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2); return false; } break; case TYPEID_GAMEOBJECT: if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2); return false; } break; case TYPEID_PLAYER: case TYPEID_CORPSE: if (cond->ConditionValue2) - sLog->outErrorDb("ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2); break; default: - sLog->outErrorDb("ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TYPE_MASK: { if (!cond->ConditionValue1 || (cond->ConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE))) { - sLog->outErrorDb("TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_RELATION_TO: { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 >= RELATION_MAX) { - sLog->outErrorDb("RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_REACTION_TO: { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (!cond->ConditionValue2) { - sLog->outErrorDb("mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2); return false; } break; @@ -1761,17 +1759,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3 >= COMP_TYPE_MAX) { - sLog->outErrorDb("DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3); return false; } break; @@ -1779,38 +1777,38 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case CONDITION_ALIVE: { if (cond->ConditionValue1) - sLog->outErrorDb("Alive condition has useless data in value1 (%u)!", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value1 (%u)!", cond->ConditionValue1); if (cond->ConditionValue2) - sLog->outErrorDb("Alive condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Alive condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_HP_VAL: { if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_HP_PCT: { if (cond->ConditionValue1 > 100) { - sLog->outErrorDb("HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_AREAID: @@ -1820,19 +1818,19 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sWorld->getWorldState(cond->ConditionValue1)) { - sLog->outErrorDb("World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("World state condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "World state condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_PHASEMASK: { if (cond->ConditionValue2) - sLog->outErrorDb("Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2); + sLog->outError(LOG_FILTER_SQL, "Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outError(LOG_FILTER_SQL, "Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TITLE: @@ -1840,22 +1838,22 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(cond->ConditionValue1); if (!titleEntry) { - sLog->outErrorDb("Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1); return false; } break; } case CONDITION_UNUSED_19: - sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring"); + sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring"); return false; case CONDITION_UNUSED_20: - sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_20 in `conditions` table - ignoring"); + sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_20 in `conditions` table - ignoring"); return false; case CONDITION_UNUSED_21: - sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_21 in `conditions` table - ignoring"); + sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_21 in `conditions` table - ignoring"); return false; case CONDITION_UNUSED_24: - sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_24 in `conditions` table - ignoring"); + sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_24 in `conditions` table - ignoring"); return false; default: break; diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index d7a769d3f5c..99a492a224e 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -59,8 +59,8 @@ void LoadDisables() if (!result) { - sLog->outString(">> Loaded 0 disables. DB table `disables` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 disables. DB table `disables` is empty!"); + return; } @@ -71,7 +71,7 @@ void LoadDisables() DisableType type = DisableType(fields[0].GetUInt32()); if (type >= MAX_DISABLE_TYPES) { - sLog->outErrorDb("Invalid type %u specified in `disables` table, skipped.", type); + sLog->outError(LOG_FILTER_SQL, "Invalid type %u specified in `disables` table, skipped.", type); continue; } @@ -88,13 +88,13 @@ void LoadDisables() case DISABLE_TYPE_SPELL: if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL)) { - sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (!flags || flags > MAX_SPELL_DISABLE_TYPE) { - sLog->outErrorDb("Disable flags for spell %u are invalid, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags for spell %u are invalid, skipped.", entry); continue; } @@ -121,7 +121,7 @@ void LoadDisables() MapEntry const* mapEntry = sMapStore.LookupEntry(entry); if (!mapEntry) { - sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } bool isFlagInvalid = false; @@ -142,12 +142,12 @@ void LoadDisables() break; case MAP_BATTLEGROUND: case MAP_ARENA: - sLog->outErrorDb("Battleground map %u specified to be disabled in map case, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Battleground map %u specified to be disabled in map case, skipped.", entry); continue; } if (isFlagInvalid) { - sLog->outErrorDb("Disable flags for map %u are invalid, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags for map %u are invalid, skipped.", entry); continue; } break; @@ -155,64 +155,64 @@ void LoadDisables() case DISABLE_TYPE_BATTLEGROUND: if (!sBattlemasterListStore.LookupEntry(entry)) { - sLog->outErrorDb("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (flags) - sLog->outErrorDb("Disable flags specified for battleground %u, useless data.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags specified for battleground %u, useless data.", entry); break; case DISABLE_TYPE_OUTDOORPVP: if (entry > MAX_OUTDOORPVP_TYPES) { - sLog->outErrorDb("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry); continue; } if (flags) - sLog->outErrorDb("Disable flags specified for outdoor PvP %u, useless data.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags specified for outdoor PvP %u, useless data.", entry); break; case DISABLE_TYPE_ACHIEVEMENT_CRITERIA: if (!sAchievementCriteriaStore.LookupEntry(entry)) { - sLog->outErrorDb("Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (flags) - sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags specified for Achievement Criteria %u, useless data.", entry); break; case DISABLE_TYPE_VMAP: { MapEntry const* mapEntry = sMapStore.LookupEntry(entry); if (!mapEntry) { - sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } switch (mapEntry->map_type) { case MAP_COMMON: if (flags & VMAP_DISABLE_AREAFLAG) - sLog->outString("Areaflag disabled for world map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Areaflag disabled for world map %u.", entry); if (flags & VMAP_DISABLE_LIQUIDSTATUS) - sLog->outString("Liquid status disabled for world map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Liquid status disabled for world map %u.", entry); break; case MAP_INSTANCE: case MAP_RAID: if (flags & VMAP_DISABLE_HEIGHT) - sLog->outString("Height disabled for instance map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for instance map %u.", entry); if (flags & VMAP_DISABLE_LOS) - sLog->outString("LoS disabled for instance map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for instance map %u.", entry); break; case MAP_BATTLEGROUND: if (flags & VMAP_DISABLE_HEIGHT) - sLog->outString("Height disabled for battleground map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for battleground map %u.", entry); if (flags & VMAP_DISABLE_LOS) - sLog->outString("LoS disabled for battleground map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for battleground map %u.", entry); break; case MAP_ARENA: if (flags & VMAP_DISABLE_HEIGHT) - sLog->outString("Height disabled for arena map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for arena map %u.", entry); if (flags & VMAP_DISABLE_LOS) - sLog->outString("LoS disabled for arena map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for arena map %u.", entry); break; default: break; @@ -228,8 +228,8 @@ void LoadDisables() } while (result->NextRow()); - sLog->outString(">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); + } void CheckQuestDisables() @@ -239,8 +239,8 @@ void CheckQuestDisables() uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size(); if (!count) { - sLog->outString(">> Checked 0 quest disables."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked 0 quest disables."); + return; } @@ -250,17 +250,17 @@ void CheckQuestDisables() const uint32 entry = itr->first; if (!sObjectMgr->GetQuestTemplate(entry)) { - sLog->outErrorDb("Quest entry %u from `disables` doesn't exist, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Quest entry %u from `disables` doesn't exist, skipped.", entry); m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++); continue; } if (itr->second.flags) - sLog->outErrorDb("Disable flags specified for quest %u, useless data.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags specified for quest %u, useless data.", entry); ++itr; } - sLog->outString(">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> 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 4be6c33db79..abf385b1463 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -200,7 +200,7 @@ uint32 DBCFileCount = 0; static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename) { - sLog->outError("Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize); + sLog->outError(LOG_FILTER_GENERAL, "Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize); // ASSERT must fail after function call return false; @@ -457,7 +457,7 @@ void LoadDBCStores(const std::string& dataPath) if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x])) { if (spellDiff->SpellID[x] > 0)//don't show error if spell is <= 0, not all modes have spells and there are unknown negative values - sLog->outErrorDb("spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x); + sLog->outError(LOG_FILTER_SQL, "spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x); newEntry.SpellID[x] = 0;//spell was <= 0 or invalid, set to 0 } else @@ -610,7 +610,7 @@ void LoadDBCStores(const std::string& dataPath) // error checks if (bad_dbc_files.size() >= DBCFileCount) { - sLog->outError("Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str()); exit(1); } else if (!bad_dbc_files.empty()) @@ -619,7 +619,7 @@ void LoadDBCStores(const std::string& dataPath) for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i) str += *i + "\n"; - sLog->outError("Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str()); exit(1); } @@ -632,12 +632,12 @@ void LoadDBCStores(const std::string& dataPath) !sMapStore.LookupEntry(724) || // last map added in 3.3.5a !sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a { - sLog->outError("You have _outdated_ DBC files. Please extract correct versions from current using client."); + sLog->outError(LOG_FILTER_GENERAL, "You have _outdated_ DBC files. Please extract correct versions from current using client."); exit(1); } - sLog->outString(">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); + } SimpleFactionsList const* GetFactionTeamList(uint32 faction) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 91f9104b0b1..05385361e1b 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -135,8 +135,8 @@ void LFGMgr::LoadRewards() if (!result) { - sLog->outErrorDb(">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); + return; } @@ -157,25 +157,25 @@ void LFGMgr::LoadRewards() if (!sLFGDungeonStore.LookupEntry(dungeonId)) { - sLog->outErrorDb("Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId); + sLog->outError(LOG_FILTER_SQL, "Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId); continue; } if (!maxLevel || maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { - sLog->outErrorDb("Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId); + sLog->outError(LOG_FILTER_SQL, "Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId); maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); } if (firstQuestId && !sObjectMgr->GetQuestTemplate(firstQuestId)) { - sLog->outErrorDb("First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId); + sLog->outError(LOG_FILTER_SQL, "First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId); firstQuestId = 0; } if (otherQuestId && !sObjectMgr->GetQuestTemplate(otherQuestId)) { - sLog->outErrorDb("Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId); + sLog->outError(LOG_FILTER_SQL, "Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId); otherQuestId = 0; } @@ -183,8 +183,8 @@ void LFGMgr::LoadRewards() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_LFG, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void LFGMgr::Update(uint32 diff) @@ -310,7 +310,7 @@ void LFGMgr::Update(uint32 diff) LfgQueueInfo* queue = itQueue->second; if (!queue) { - sLog->outError("LFGMgr::Update: [" UI64FMTD "] queued with null queue info!", itQueue->first); + sLog->outError(LOG_FILTER_LFG, "LFGMgr::Update: [" UI64FMTD "] queued with null queue info!", itQueue->first); continue; } uint32 dungeonId = (*queue->dungeons.begin()); @@ -863,7 +863,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal) LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid); if (itQueue == m_QueueInfoMap.end() || GetState(guid) != LFG_STATE_QUEUED) { - sLog->outError("LFGMgr::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", (*it)); + sLog->outError(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", (*it)); RemoveFromQueue(guid); return false; } @@ -1404,13 +1404,13 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) LfgProposalPlayer* player = pProposal->players[(*it)->GetGUID()]; uint32 lowgroupguid = (*it)->GetGroup() ? (*it)->GetGroup()->GetLowGUID() : 0; if (player->groupLowGuid != lowgroupguid) - sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid); + sLog->outError(LOG_FILTER_LFG, "LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid); uint64 guid2 = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID(); LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid2); if (itQueue == m_QueueInfoMap.end()) { - sLog->outError("LFGMgr::UpdateProposal: Queue info for guid [" UI64FMTD "] not found!", guid); + sLog->outError(LOG_FILTER_LFG, "LFGMgr::UpdateProposal: Queue info for guid [" UI64FMTD "] not found!", guid); waitTimesMap[(*it)->GetGUID()] = -1; } else @@ -1813,7 +1813,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(dungeon->map); if (!at) { - sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "]: No areatrigger found for map: %u difficulty: %u", player->GetGUID(), dungeon->map, dungeon->difficulty); + sLog->outError(LOG_FILTER_LFG, "LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "]: No areatrigger found for map: %u difficulty: %u", player->GetGUID(), dungeon->map, dungeon->difficulty); error = LFG_TELEPORTERROR_INVALID_LOCATION; } else @@ -1843,7 +1843,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* else { error = LFG_TELEPORTERROR_INVALID_LOCATION; - sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", player->GetGUID(), mapid); + sLog->outError(LOG_FILTER_LFG, "LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", player->GetGUID(), mapid); } } } diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 4613a3554db..60c0b7ad394 100755 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -78,7 +78,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner) if (!IsPositionValid()) { - sLog->outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + 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()); return false; } @@ -134,7 +134,7 @@ void Corpse::DeleteBonesFromWorld() if (!corpse) { - sLog->outError("Bones %u not found in world.", GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Bones %u not found in world.", GetGUIDLow()); return; } @@ -194,7 +194,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields) if (!IsPositionValid()) { - sLog->outError("Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)", + sLog->outError(LOG_FILTER_PLAYER, "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)", GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ); return false; } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 4d54d1599a8..866437d828c 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -173,7 +173,7 @@ Creature::~Creature() i_AI = NULL; //if (m_uint32Values) - // sLog->outError("Deconstruct Creature Entry = %u", GetEntry()); + // sLog->outError(LOG_FILTER_UNITS, "Deconstruct Creature Entry = %u", GetEntry()); } void Creature::AddToWorld() @@ -261,7 +261,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry); if (!normalInfo) { - sLog->outErrorDb("Creature::InitEntry creature entry %u does not exist.", Entry); + sLog->outError(LOG_FILTER_SQL, "Creature::InitEntry creature entry %u does not exist.", Entry); return false; } @@ -299,7 +299,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data // Cancel load if no model defined if (!(cinfo->GetFirstValidModelId())) { - sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry); return false; } @@ -307,7 +307,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (!minfo) // Cancel load if no model defined { - sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry); return false; } @@ -470,11 +470,11 @@ void Creature::Update(uint32 diff) { case JUST_RESPAWNED: // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting. - sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry()); + sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry()); break; case JUST_DIED: // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. - sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry()); + sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry()); break; case DEAD: { @@ -523,7 +523,7 @@ void Creature::Update(uint32 diff) else if (m_corpseRemoveTime <= time(NULL)) { RemoveCorpse(false); - sLog->outStaticDebug("Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY)); + sLog->outDebug(LOG_FILTER_UNITS, "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY)); } break; } @@ -755,7 +755,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); if (!cinfo) { - sLog->outErrorDb("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); + sLog->outError(LOG_FILTER_SQL, "Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); return false; } @@ -769,7 +769,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, if (!IsPositionValid()) { - sLog->outError("Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang); + sLog->outError(LOG_FILTER_UNITS, "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang); return false; } @@ -836,7 +836,7 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const if ((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS) { - sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.", + sLog->outError(LOG_FILTER_SQL, "Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.", GetGUIDLow(), GetEntry()); return false; } @@ -1038,7 +1038,7 @@ void Creature::SaveToDB() CreatureData const* data = sObjectMgr->GetCreatureData(m_DBTableGuid); if (!data) { - sLog->outError("Creature::SaveToDB failed, cannot get creature data!"); + sLog->outError(LOG_FILTER_UNITS, "Creature::SaveToDB failed, cannot get creature data!"); return; } @@ -1252,7 +1252,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); if (!cinfo) { - sLog->outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); + sLog->outError(LOG_FILTER_SQL, "Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); return false; } @@ -1278,7 +1278,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) if (!data) { - sLog->outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ", guid); + sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) not found in table `creature`, can't load. ", guid); return false; } @@ -1394,7 +1394,7 @@ void Creature::DeleteFromDB() { if (!m_DBTableGuid) { - sLog->outError("Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry()); + sLog->outError(LOG_FILTER_UNITS, "Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry()); return; } @@ -1600,7 +1600,7 @@ void Creature::Respawn(bool force) if (m_DBTableGuid) GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid); - sLog->outStaticDebug("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(), GetGUIDLow(), GetGUID(), GetEntry()); m_respawnTime = 0; lootForPickPocketed = false; lootForBody = false; @@ -1714,7 +1714,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]); if (!spellInfo) { - sLog->outError("WORLD: unknown spell id %i", m_spells[i]); + sLog->outError(LOG_FILTER_UNITS, "WORLD: unknown spell id %i", m_spells[i]); continue; } @@ -1762,7 +1762,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]); if (!spellInfo) { - sLog->outError("WORLD: unknown spell id %i", m_spells[i]); + sLog->outError(LOG_FILTER_UNITS, "WORLD: unknown spell id %i", m_spells[i]); continue; } @@ -1834,7 +1834,7 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const if (dist > MAX_VISIBILITY_DISTANCE) { - sLog->outError("Creature (GUID: %u Entry: %u) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUIDLow(), GetEntry()); + sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUIDLow(), GetEntry()); dist = ATTACK_DISTANCE; } @@ -2118,7 +2118,7 @@ bool Creature::LoadCreaturesAddon(bool reload) SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr); if (!AdditionalSpellInfo) { - sLog->outErrorDb("Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr); + sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr); continue; } @@ -2126,7 +2126,7 @@ bool Creature::LoadCreaturesAddon(bool reload) if (HasAura(*itr)) { if (!reload) - sLog->outErrorDb("Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr); + sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr); continue; } @@ -2153,7 +2153,7 @@ void Creature::SetInCombatWithZone() { if (!CanHaveThreatList()) { - sLog->outError("Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry()); + sLog->outError(LOG_FILTER_UNITS, "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry()); return; } @@ -2161,7 +2161,7 @@ void Creature::SetInCombatWithZone() if (!map->IsDungeon()) { - sLog->outError("Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId()); + sLog->outError(LOG_FILTER_UNITS, "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId()); return; } diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 54953ef5420..6468e611b13 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -84,8 +84,8 @@ void FormationMgr::LoadCreatureFormations() if (!result) { - sLog->outErrorDb(">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); + return; } @@ -118,14 +118,14 @@ void FormationMgr::LoadCreatureFormations() { if (!sObjectMgr->GetCreatureData(group_member->leaderGUID)) { - sLog->outErrorDb("creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID); + sLog->outError(LOG_FILTER_SQL, "creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID); delete group_member; continue; } if (!sObjectMgr->GetCreatureData(memberGUID)) { - sLog->outErrorDb("creature_formations table member guid %u incorrect (not exist)", memberGUID); + sLog->outError(LOG_FILTER_SQL, "creature_formations table member guid %u incorrect (not exist)", memberGUID); delete group_member; continue; } @@ -136,8 +136,8 @@ void FormationMgr::LoadCreatureFormations() } while (result->NextRow()); - sLog->outString(">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_UNITS, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void CreatureGroup::AddMember(Creature* member) diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 836fbe8c7bf..63e186ffc42 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -177,7 +177,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poiId); if (!poi) { - sLog->outErrorDb("Request to send non-existing POI (Id: %u), ignored.", poiId); + sLog->outError(LOG_FILTER_SQL, "Request to send non-existing POI (Id: %u), ignored.", poiId); return; } diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 2af6b4c04fd..43b29c600d6 100755 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -159,7 +159,7 @@ void TempSummon::Update(uint32 diff) } default: UnSummon(); - sLog->outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); + sLog->outError(LOG_FILTER_UNITS, "Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); break; } } @@ -267,7 +267,7 @@ void TempSummon::RemoveFromWorld() owner->m_SummonSlot[slot] = 0; //if (GetOwnerGUID()) - // sLog->outError("Unit %u has owner guid when removed from world", GetEntry()); + // sLog->outError(LOG_FILTER_UNITS, "Unit %u has owner guid when removed from world", GetEntry()); Creature::RemoveFromWorld(); } diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index 76d4cb6624b..cd4a9443867 100755 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -85,7 +85,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe Relocate(pos); if (!IsPositionValid()) { - sLog->outError("DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY()); + sLog->outError(LOG_FILTER_GENERAL, "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY()); return false; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 1d9958a6524..7375ed9f886 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -119,7 +119,7 @@ void GameObject::RemoveFromOwner() else if (IS_PET_GUID(ownerGUID)) ownerType = "pet"; - sLog->outCrash("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.", + sLog->outFatal(LOG_FILTER_GENERAL, "Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.", GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType); SetOwnerGUID(0); } @@ -170,7 +170,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa Relocate(x, y, z, ang); if (!IsPositionValid()) { - sLog->outError("Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y); + sLog->outError(LOG_FILTER_GENERAL, "Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y); return false; } @@ -187,7 +187,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id); if (!goinfo) { - sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z); + sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z); return false; } @@ -197,7 +197,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa if (goinfo->type >= MAX_GAMEOBJECT_TYPE) { - sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type); + sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type); return false; } @@ -268,7 +268,7 @@ void GameObject::Update(uint32 diff) if (!AI()) { if (!AIM_Initialize()) - sLog->outError("Could not initialize GameObjectAI"); + sLog->outError(LOG_FILTER_GENERAL, "Could not initialize GameObjectAI"); } else AI()->UpdateAI(diff); @@ -647,7 +647,7 @@ void GameObject::SaveToDB() GameObjectData const* data = sObjectMgr->GetGOData(m_DBTableGuid); if (!data) { - sLog->outError("GameObject::SaveToDB failed, cannot get gameobject data!"); + sLog->outError(LOG_FILTER_GENERAL, "GameObject::SaveToDB failed, cannot get gameobject data!"); return; } @@ -721,7 +721,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap) if (!data) { - sLog->outErrorDb("Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid); + sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid); return false; } @@ -1302,7 +1302,7 @@ void GameObject::Use(Unit* user) //provide error, no fishable zone or area should be 0 if (!zone_skill) - sLog->outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone); + sLog->outError(LOG_FILTER_SQL, "Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone); int32 skill = player->GetSkillValue(SKILL_FISHING); @@ -1318,7 +1318,7 @@ void GameObject::Use(Unit* user) int32 roll = irand(1, 100); - sLog->outStaticDebug("Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll); + sLog->outDebug(LOG_FILTER_GENERAL, "Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll); // but you will likely cause junk in areas that require a high fishing skill (not yet implemented) if (chance >= roll) @@ -1612,7 +1612,7 @@ void GameObject::Use(Unit* user) } default: if (GetGoType() >= MAX_GAMEOBJECT_TYPE) - sLog->outError("GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)", + 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()); break; } @@ -1624,7 +1624,7 @@ void GameObject::Use(Unit* user) if (!spellInfo) { if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this)) - sLog->outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType()); + sLog->outError(LOG_FILTER_GENERAL, "WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType()); else sLog->outDebug(LOG_FILTER_OUTDOORPVP, "WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId); return; diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index c4d4adeb6f2..db563c712cd 100755 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -41,7 +41,7 @@ Bag::~Bag() { if (item->IsInWorld()) { - sLog->outCrash("Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.", + sLog->outFatal(LOG_FILTER_PLAYER_ITEMS, "Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.", item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(), GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i); item->RemoveFromWorld(); diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 209fdae8ce6..c032647d924 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -36,7 +36,7 @@ void AddItemsSetItem(Player* player, Item* item) if (!set) { - sLog->outErrorDb("Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId); + sLog->outError(LOG_FILTER_SQL, "Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId); return; } @@ -96,7 +96,7 @@ void AddItemsSetItem(Player* player, Item* item) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(set->spells[x]); if (!spellInfo) { - sLog->outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid); break; } @@ -117,7 +117,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto) if (!set) { - sLog->outErrorDb("Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId); + sLog->outError(LOG_FILTER_SQL, "Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId); return; } @@ -597,7 +597,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) // item can have not null only one from field values if ((itemProto->RandomProperty) && (itemProto->RandomSuffix)) { - sLog->outErrorDb("Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix); + sLog->outError(LOG_FILTER_SQL, "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix); return 0; } @@ -608,7 +608,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); if (!random_id) { - sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); + sLog->outError(LOG_FILTER_SQL, "Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); return 0; } @@ -621,7 +621,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); if (!random_id) { - sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); + sLog->outError(LOG_FILTER_SQL, "Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); return 0; } diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index f3d7d7fd56c..c6ed8a2925a 100755 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -70,13 +70,13 @@ void LoadRandomEnchantmentsTable() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } else { - sLog->outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); + } } @@ -91,7 +91,7 @@ uint32 GetItemEnchantMod(int32 entry) EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry); if (tab == RandomItemEnch.end()) { - sLog->outErrorDb("Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry); + sLog->outError(LOG_FILTER_SQL, "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry); return 0; } diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index fdc09bba8b9..b910fee951b 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -90,7 +90,7 @@ WorldObject::~WorldObject() { if (GetTypeId() == TYPEID_CORPSE) { - sLog->outCrash("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(); @@ -101,16 +101,16 @@ Object::~Object() { if (IsInWorld()) { - sLog->outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); + sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); if (isType(TYPEMASK_ITEM)) - sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot()); + sLog->outFatal(LOG_FILTER_GENERAL, "Item slot %u", ((Item*)this)->GetSlot()); ASSERT(false); RemoveFromWorld(); } if (m_objectUpdated) { - sLog->outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); + sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); ASSERT(false); sObjectAccessor->RemoveUpdateObject(this); } @@ -1003,7 +1003,7 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value) if (offset > 4) { - sLog->outError("Object::SetByteValue: wrong offset %u", offset); + sLog->outError(LOG_FILTER_GENERAL, "Object::SetByteValue: wrong offset %u", offset); return; } @@ -1027,7 +1027,7 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value) if (offset > 2) { - sLog->outError("Object::SetUInt16Value: wrong offset %u", offset); + sLog->outError(LOG_FILTER_GENERAL, "Object::SetUInt16Value: wrong offset %u", offset); return; } @@ -1139,7 +1139,7 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag) if (offset > 4) { - sLog->outError("Object::SetByteFlag: wrong offset %u", offset); + sLog->outError(LOG_FILTER_GENERAL, "Object::SetByteFlag: wrong offset %u", offset); return; } @@ -1162,7 +1162,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag) if (offset > 4) { - sLog->outError("Object::RemoveByteFlag: wrong offset %u", offset); + sLog->outError(LOG_FILTER_GENERAL, "Object::RemoveByteFlag: wrong offset %u", offset); return; } @@ -1181,7 +1181,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag) bool Object::PrintIndexError(uint32 index, bool set) const { - sLog->outError("Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType); + sLog->outError(LOG_FILTER_GENERAL, "Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType); // ASSERT must fail after function call return false; @@ -1236,32 +1236,32 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st void MovementInfo::OutDebug() { - sLog->outString("MOVEMENT INFO"); - sLog->outString("guid " UI64FMTD, guid); - sLog->outString("flags %u", flags); - sLog->outString("flags2 %u", flags2); - sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::time(NULL))); - sLog->outString("position: `%s`", pos.ToString().c_str()); + sLog->outInfo(LOG_FILTER_GENERAL, "MOVEMENT INFO"); + sLog->outInfo(LOG_FILTER_GENERAL, "guid " UI64FMTD, guid); + sLog->outInfo(LOG_FILTER_GENERAL, "flags %u", flags); + sLog->outInfo(LOG_FILTER_GENERAL, "flags2 %u", flags2); + sLog->outInfo(LOG_FILTER_GENERAL, "time %u current time " UI64FMTD "", flags2, uint64(::time(NULL))); + sLog->outInfo(LOG_FILTER_GENERAL, "position: `%s`", pos.ToString().c_str()); if (flags & MOVEMENTFLAG_ONTRANSPORT) { - sLog->outString("TRANSPORT:"); - sLog->outString("guid: " UI64FMTD, t_guid); - sLog->outString("position: `%s`", t_pos.ToString().c_str()); - sLog->outString("seat: %i", t_seat); - sLog->outString("time: %u", t_time); + sLog->outInfo(LOG_FILTER_GENERAL, "TRANSPORT:"); + sLog->outInfo(LOG_FILTER_GENERAL, "guid: " UI64FMTD, t_guid); + sLog->outInfo(LOG_FILTER_GENERAL, "position: `%s`", t_pos.ToString().c_str()); + sLog->outInfo(LOG_FILTER_GENERAL, "seat: %i", t_seat); + sLog->outInfo(LOG_FILTER_GENERAL, "time: %u", t_time); if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT) - sLog->outString("time2: %u", t_time2); + sLog->outInfo(LOG_FILTER_GENERAL, "time2: %u", t_time2); } if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING)) - sLog->outString("pitch: %f", pitch); + sLog->outInfo(LOG_FILTER_GENERAL, "pitch: %f", pitch); - sLog->outString("fallTime: %u", fallTime); + sLog->outInfo(LOG_FILTER_GENERAL, "fallTime: %u", fallTime); if (flags & MOVEMENTFLAG_FALLING) - sLog->outString("j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed); + sLog->outInfo(LOG_FILTER_GENERAL, "j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed); if (flags & MOVEMENTFLAG_SPLINE_ELEVATION) - sLog->outString("splineElevation: %f", splineElevation); + sLog->outInfo(LOG_FILTER_GENERAL, "splineElevation: %f", splineElevation); } WorldObject::WorldObject(bool isWorldObject): WorldLocation(), @@ -2181,7 +2181,7 @@ void WorldObject::SetMap(Map* map) return; if (m_currMap) { - sLog->outCrash("WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId()); + sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId()); ASSERT(false); } m_currMap = map; @@ -2216,7 +2216,7 @@ void WorldObject::AddObjectToRemoveList() Map* map = FindMap(); if (!map) { - sLog->outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId()); + sLog->outError(LOG_FILTER_GENERAL, "Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId()); return; } @@ -2382,7 +2382,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy pet->Relocate(x, y, z, ang); if (!pet->IsPositionValid()) { - sLog->outError("Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); + sLog->outError(LOG_FILTER_GENERAL, "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); delete pet; return NULL; } @@ -2391,7 +2391,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy uint32 pet_number = sObjectMgr->GeneratePetNumber(); if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number)) { - sLog->outError("no such creature entry %u", entry); + sLog->outError(LOG_FILTER_GENERAL, "no such creature entry %u", entry); delete pet; return NULL; } @@ -2468,7 +2468,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { - sLog->outErrorDb("Gameobject template %u not found in database!", entry); + sLog->outError(LOG_FILTER_SQL, "Gameobject template %u not found in database!", entry); return NULL; } Map* map = GetMap(); @@ -2770,7 +2770,7 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle) // Prevent invalid coordinates here, position is unchanged if (!Trinity::IsValidMapCoord(destx, desty)) { - sLog->outCrash("WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty); + sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty); return; } @@ -2816,7 +2816,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float // Prevent invalid coordinates here, position is unchanged if (!Trinity::IsValidMapCoord(destx, desty)) { - sLog->outCrash("WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty); + sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty); return; } diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp index 8f480ab3235..45464f19083 100755 --- a/src/server/game/Entities/Object/Updates/UpdateData.cpp +++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp @@ -57,7 +57,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) int z_res = deflateInit(&c_stream, sWorld->getIntConfig(CONFIG_COMPRESSION)); if (z_res != Z_OK) { - sLog->outError("Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res)); + sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } @@ -70,14 +70,14 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) z_res = deflate(&c_stream, Z_NO_FLUSH); if (z_res != Z_OK) { - sLog->outError("Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res)); + sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } if (c_stream.avail_in != 0) { - sLog->outError("Can't compress update packet (zlib: deflate not greedy)"); + sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate not greedy)"); *dst_size = 0; return; } @@ -85,7 +85,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) z_res = deflate(&c_stream, Z_FINISH); if (z_res != Z_STREAM_END) { - sLog->outError("Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res)); + sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } @@ -93,7 +93,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) z_res = deflateEnd(&c_stream); if (z_res != Z_OK) { - sLog->outError("Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res)); + sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 75deb8b4216..17b214857db 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -183,7 +183,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c if (!IsPositionValid()) { - sLog->outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", + sLog->outError(LOG_FILTER_PETS, "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); return false; } @@ -229,7 +229,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c break; default: if (!IsPetGhoul()) - sLog->outError("Pet have incorrect type (%u) for pet loading.", getPetType()); + sLog->outError(LOG_FILTER_PETS, "Pet have incorrect type (%u) for pet loading.", getPetType()); break; } @@ -562,7 +562,7 @@ void Pet::Update(uint32 diff) { if (owner->GetPetGUID() != GetGUID()) { - sLog->outError("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()); Remove(getPetType() == HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT); return; } @@ -760,7 +760,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) if (!IsPositionValid()) { - sLog->outError("Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", + sLog->outError(LOG_FILTER_PETS, "Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); return false; } @@ -768,7 +768,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) CreatureTemplate const* cinfo = GetCreatureTemplate(); if (!cinfo) { - sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!"); + sLog->outError(LOG_FILTER_PETS, "CreateBaseAtCreature() failed, creatureInfo is missing!"); return false; } @@ -843,7 +843,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) m_unitTypeMask |= UNIT_MASK_HUNTER_PET; } else - sLog->outError("Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass()); + sLog->outError(LOG_FILTER_PETS, "Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass()); } uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry; @@ -1120,7 +1120,7 @@ void Pet::_LoadSpellCooldowns() if (!sSpellMgr->GetSpellInfo(spell_id)) { - sLog->outError("Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id); + sLog->outError(LOG_FILTER_PETS, "Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id); continue; } @@ -1271,7 +1271,7 @@ void Pet::_LoadAuras(uint32 timediff) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - sLog->outError("Unknown aura (spellid %u), ignore.", spellid); + sLog->outError(LOG_FILTER_PETS, "Unknown aura (spellid %u), ignore.", spellid); continue; } @@ -1302,7 +1302,7 @@ void Pet::_LoadAuras(uint32 timediff) } aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]); aura->ApplyForTargets(); - sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); + sLog->outInfo(LOG_FILTER_PETS, "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); } } while (result->NextRow()); @@ -1378,7 +1378,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel // do pet spell book cleanup if (state == PETSPELL_UNCHANGED) // spell load case { - sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId); + sLog->outError(LOG_FILTER_PETS, "Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_PET_SPELL); @@ -1387,7 +1387,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel CharacterDatabase.Execute(stmt); } else - sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_PETS, "Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3b51411b168..85b807880c2 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -929,7 +929,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class); if (!info) { - sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", + sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Race, createInfo->Class); return false; } @@ -942,7 +942,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class); if (!cEntry) { - sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", + sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Class); return false; } @@ -958,7 +958,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (!IsValidGender(createInfo->Gender)) { - sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so", + sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender); return false; } @@ -1228,7 +1228,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - sLog->outError("STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); + sLog->outError(LOG_FILTER_PLAYER, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); return false; } @@ -1295,7 +1295,7 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) { if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage { - sLog->outStaticDebug("We are fall to death, loosing 10 percents durability"); + sLog->outDebug(LOG_FILTER_PLAYER, "We are fall to death, loosing 10 percents durability"); DurabilityLossAll(0.10f, false); // durability lost message WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0); @@ -1532,9 +1532,9 @@ void Player::Update(uint32 p_time) //ASSERT (!m_spellModTakingSpell); if (m_spellModTakingSpell) { - //sLog->outCrash("Player has m_pad %u during update!", m_pad); + //sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad); //if (m_spellModTakingSpell) - sLog->outCrash("Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); + sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); m_spellModTakingSpell = NULL; } @@ -1731,7 +1731,7 @@ void Player::Update(uint32 p_time) { // m_nextSave reseted in SaveToDB call SaveToDB(); - sLog->outDetail("Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); } else m_nextSave -= p_time; @@ -1821,7 +1821,7 @@ void Player::setDeathState(DeathState s) { if (!cur) { - sLog->outError("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(), GetGUIDLow()); return; } @@ -1879,12 +1879,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass); if (!info) { - sLog->outError("Player %u has incorrect race/class pair. Don't build enum.", guid); + sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Don't build enum.", guid); return false; } else if (!IsValidGender(gender)) { - sLog->outError("Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); + sLog->outError(LOG_FILTER_PLAYER, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); return false; } @@ -2066,14 +2066,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati { if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation)) { - sLog->outError("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).", + sLog->outError(LOG_FILTER_PLAYER, "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()); return false; } if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { - sLog->outError("Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); + sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); return false; } @@ -2426,7 +2426,7 @@ void Player::RemoveFromWorld() { if (WorldObject* viewpoint = GetViewpoint()) { - sLog->outCrash("Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId()); + sLog->outFatal(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId()); SetViewpoint(viewpoint, false); } } @@ -3355,7 +3355,7 @@ void Player::SendInitialSpells() GetSession()->SendPacket(&data); - sLog->outDetail("CHARACTER: Sent Initial Spells"); + sLog->outInfo(LOG_FILTER_PLAYER, "CHARACTER: Sent Initial Spells"); } void Player::RemoveMail(uint32 id) @@ -3436,7 +3436,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3445,7 +3445,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) CharacterDatabase.Execute(stmt); } else - sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3455,7 +3455,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError("Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3464,7 +3464,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) CharacterDatabase.Execute(stmt); } else - sLog->outError("Player::addTalent: Broken spell #%u learning not allowed.", spellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); return false; } @@ -3509,7 +3509,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3518,7 +3518,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent CharacterDatabase.Execute(stmt); } else - sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3528,7 +3528,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError("Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3537,7 +3537,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent CharacterDatabase.Execute(stmt); } else - sLog->outError("Player::addSpell: Broken spell #%u learning not allowed.", spellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); return false; } @@ -4291,7 +4291,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) if (!sSpellMgr->GetSpellInfo(spell_id)) { - sLog->outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); + sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); continue; } @@ -4965,7 +4965,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC break; } default: - sLog->outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); + sLog->outError(LOG_FILTER_PLAYER, "Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); } if (updateRealmChars) @@ -4995,7 +4995,7 @@ void Player::DeleteOldCharacters() */ void Player::DeleteOldCharacters(uint32 keepDays) { - sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays); + sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS); stmt->setUInt32(0, uint32(time(NULL) - time_t(keepDays * DAY))); @@ -5003,7 +5003,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) if (result) { - sLog->outString("Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); + sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); do { Field* fields = result->Fetch(); @@ -5023,7 +5023,7 @@ void Player::SetMovement(PlayerMovementType pType) case MOVE_WATER_WALK: data.Initialize(SMSG_MOVE_WATER_WALK, GetPackGUID().size()+4); break; case MOVE_LAND_WALK: data.Initialize(SMSG_MOVE_LAND_WALK, GetPackGUID().size()+4); break; default: - sLog->outError("Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType); + sLog->outError(LOG_FILTER_PLAYER, "Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType); return; } data.append(GetPackGUID()); @@ -5052,7 +5052,7 @@ void Player::BuildPlayerRepop() // the player cannot have a corpse already, only bones which are not returned by GetCorpse if (GetCorpse()) { - sLog->outError("BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow()); return; } @@ -5061,7 +5061,7 @@ void Player::BuildPlayerRepop() Corpse* corpse = GetCorpse(); if (!corpse) { - sLog->outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow()); return; } GetMap()->AddToMap(corpse); @@ -5418,7 +5418,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { - sLog->outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); + sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); return TotalCost; } @@ -5426,7 +5426,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { - sLog->outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); + sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); return TotalCost; } @@ -5442,7 +5442,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g { if (GetGuildId() == 0) { - sLog->outStaticDebug("You are not member of a guild"); + sLog->outDebug(LOG_FILTER_PLAYER, "You are not member of a guild"); return TotalCost; } @@ -5457,7 +5457,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g } else if (!HasEnoughMoney(costs)) { - sLog->outStaticDebug("You do not have enough money"); + sLog->outDebug(LOG_FILTER_PLAYER, "You do not have enough money"); return TotalCost; } else @@ -5665,7 +5665,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa { if (modGroup >= BASEMOD_END || modType >= MOD_END) { - sLog->outError("ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); + sLog->outError(LOG_FILTER_PLAYER, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); return; } @@ -5696,7 +5696,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { if (modGroup >= BASEMOD_END || modType > MOD_END) { - sLog->outError("trial to access non existed BaseModGroup or wrong BaseModType!"); + sLog->outError(LOG_FILTER_PLAYER, "trial to access non existed BaseModGroup or wrong BaseModType!"); return 0.0f; } @@ -5710,7 +5710,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const { if (modGroup >= BASEMOD_END) { - sLog->outError("wrong BaseModGroup in GetTotalBaseModValue()!"); + sLog->outError(LOG_FILTER_PLAYER, "wrong BaseModGroup in GetTotalBaseModValue()!"); return 0.0f; } @@ -6432,7 +6432,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id); if (!pSkill) { - sLog->outError("Skill not found in SkillLineStore: skill #%u", id); + sLog->outError(LOG_FILTER_PLAYER, "Skill not found in SkillLineStore: skill #%u", id); return; } @@ -6592,7 +6592,7 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const void Player::SendActionButtons(uint32 state) const { - sLog->outDetail("Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); + sLog->outInfo(LOG_FILTER_PLAYER, "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4)); data << uint8(state); @@ -6615,20 +6615,20 @@ void Player::SendActionButtons(uint32 state) const } GetSession()->SendPacket(&data); - sLog->outDetail("Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); + sLog->outInfo(LOG_FILTER_PLAYER, "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); } bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - sLog->outError("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(), MAX_ACTION_BUTTONS); return false; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - sLog->outError("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(), MAX_ACTION_BUTTON_ACTION_VALUE); return false; } @@ -6637,7 +6637,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - sLog->outError("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()); return false; } @@ -6650,7 +6650,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - sLog->outError("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()); return false; } break; @@ -6672,7 +6672,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->outDetail("Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); + sLog->outInfo(LOG_FILTER_PLAYER, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); return &ab; } @@ -6687,7 +6687,7 @@ void Player::removeActionButton(uint8 button) else buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save - sLog->outDetail("Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); } ActionButton const* Player::GetActionButton(uint8 button) @@ -6799,7 +6799,7 @@ void Player::CheckAreaExploreAndOutdoor() if (offset >= PLAYER_EXPLORED_ZONES_SIZE) { - sLog->outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE); + sLog->outError(LOG_FILTER_PLAYER, "Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE); return; } @@ -6815,7 +6815,7 @@ void Player::CheckAreaExploreAndOutdoor() AreaTableEntry const* areaEntry = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); if (!areaEntry) { - sLog->outError("Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId()); + sLog->outError(LOG_FILTER_PLAYER, "Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId()); return; } @@ -6852,7 +6852,7 @@ void Player::CheckAreaExploreAndOutdoor() GiveXP(XP, NULL); SendExplorationExperience(area, XP); } - sLog->outDetail("Player %u discovered a new area: %u", GetGUIDLow(), area); + sLog->outInfo(LOG_FILTER_PLAYER, "Player %u discovered a new area: %u", GetGUIDLow(), area); } } } @@ -6866,10 +6866,10 @@ uint32 Player::TeamForRace(uint8 race) case 1: return HORDE; case 7: return ALLIANCE; } - sLog->outError("Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID); + sLog->outError(LOG_FILTER_PLAYER, "Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID); } else - sLog->outError("Race (%u) not found in DBC: wrong DBC files?", uint32(race)); + sLog->outError(LOG_FILTER_PLAYER, "Race (%u) not found in DBC: wrong DBC files?", uint32(race)); return ALLIANCE; } @@ -7698,7 +7698,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) if (item->IsBroken()) return; - sLog->outDetail("applying mods for item %u ", item->GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER, "applying mods for item %u ", item->GetGUIDLow()); uint8 attacktype = Player::GetAttackBySlot(slot); @@ -8184,7 +8184,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, return; } - sLog->outStaticDebug("WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id); + sLog->outDebug(LOG_FILTER_PLAYER, "WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id); CastSpell(this, spellInfo, true, item); } @@ -8290,7 +8290,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - sLog->outError("WORLD: unknown Item spellid %i", spellData.SpellId); + sLog->outError(LOG_FILTER_PLAYER, "WORLD: unknown Item spellid %i", spellData.SpellId); continue; } @@ -8359,7 +8359,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", + sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]); continue; } @@ -8404,7 +8404,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id); if (!spellInfo) { - sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); + sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); SendEquipError(EQUIP_ERR_NONE, item, NULL); return; } @@ -8436,7 +8436,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId); + sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId); continue; } @@ -8464,7 +8464,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - sLog->outError("Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]); + sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]); continue; } @@ -9693,7 +9693,7 @@ uint32 Player::GetXPRestBonus(uint32 xp) SetRestBonus(GetRestBonus() - rested_bonus); - sLog->outDetail("Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus()); + sLog->outInfo(LOG_FILTER_PLAYER, "Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus()); return rested_bonus; } @@ -9725,7 +9725,7 @@ void Player::ResetPetTalents() CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - sLog->outError("Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + sLog->outError(LOG_FILTER_PLAYER, "Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } pet->resetTalents(); @@ -11628,7 +11628,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest uint8 pItemslot = pItem->GetSlot(); if (pItemslot >= CURRENCYTOKEN_SLOT_START && pItemslot < CURRENCYTOKEN_SLOT_END) { - sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!", + 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); return EQUIP_ERR_ITEMS_CANT_BE_SWAPPED; } @@ -12267,7 +12267,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell); if (!spellProto) - sLog->outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); + sLog->outError(LOG_FILTER_PLAYER, "Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); else { m_weaponChangeTimer = spellProto->StartRecoveryTime; @@ -14030,7 +14030,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool // nothing do.. break; default: - sLog->outError("Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type); + sLog->outError(LOG_FILTER_PLAYER, "Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type); break; } /*switch (enchant_display_type)*/ } /*for*/ @@ -14202,7 +14202,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool VendorItemData const* vendorItems = creature->GetVendorItems(); if (!vendorItems || vendorItems->Empty()) { - sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry()); canTalk = false; } break; @@ -14251,7 +14251,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool canTalk = false; break; default: - sLog->outErrorDb("Creature entry %u have unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId); + sLog->outError(LOG_FILTER_SQL, "Creature entry %u have unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId); canTalk = false; break; } @@ -14346,7 +14346,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men { if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER) { - sLog->outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry()); + sLog->outError(LOG_FILTER_PLAYER, "Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry()); return; } } @@ -14450,7 +14450,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men if (bgTypeId == BATTLEGROUND_TYPE_NONE) { - sLog->outError("a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow()); return; } @@ -16522,7 +16522,7 @@ void Player::_LoadArenaTeamInfo(PreparedQueryResult result) ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId); if (!arenaTeam) { - sLog->outError("Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenaTeamId); + sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenaTeamId); continue; } @@ -16673,7 +16673,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (!result) { - sLog->outError("Player (GUID: %u) not found in table `characters`, can't load. ", guid); + sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) not found in table `characters`, can't load. ", guid); return false; } @@ -16685,13 +16685,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // player should be able to load/delete character only with correct account! if (dbAccountId != GetSession()->GetAccountId()) { - sLog->outError("Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId); + sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId); return false; } if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBANNED)) { - sLog->outError("Player (GUID: %u) is banned, can't load.", guid); + sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) is banned, can't load.", guid); return false; } @@ -16719,7 +16719,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) uint8 Gender = fields[5].GetUInt8(); if (!IsValidGender(Gender)) { - sLog->outError("Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender); + sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender); return false; } @@ -16842,7 +16842,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry || !IsPositionValid()) { - sLog->outError("Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); RelocateToHomebind(); } // Player was saved in Arena or Bg @@ -16880,7 +16880,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (mapId == MAPID_INVALID) // Battleground Entry Point not found (???) { - sLog->outError("Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid); + sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid); RelocateToHomebind(); } else @@ -16902,7 +16902,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // transport size limited m_movementInfo.t_pos.m_positionX > 250 || m_movementInfo.t_pos.m_positionY > 250 || m_movementInfo.t_pos.m_positionZ > 250) { - sLog->outError("Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.", + sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.", guid, GetPositionX()+m_movementInfo.t_pos.m_positionX, GetPositionY()+m_movementInfo.t_pos.m_positionY, GetPositionZ()+m_movementInfo.t_pos.m_positionZ, GetOrientation()+m_movementInfo.t_pos.m_orientation); @@ -16922,7 +16922,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) } if (!m_transport) { - sLog->outError("Player (guidlow %d) have problems with transport guid (%u). Teleport to bind location.", + sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have problems with transport guid (%u). Teleport to bind location.", guid, transGUID); RelocateToHomebind(); @@ -16949,12 +16949,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (!nodeEntry) // don't know taxi start node, to homebind { - sLog->outError("Character %u have wrong data in taxi destination list, teleport to homebind.", GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Character %u have wrong data in taxi destination list, teleport to homebind.", GetGUIDLow()); RelocateToHomebind(); } else // have start node, to it { - sLog->outError("Character %u have too short taxi destination list, teleport to original node.", GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Character %u have too short taxi destination list, teleport to original node.", GetGUIDLow()); mapId = nodeEntry->map_id; Relocate(nodeEntry->x, nodeEntry->y, nodeEntry->z, 0.0f); } @@ -17004,13 +17004,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(mapId); if (at) { - sLog->outError("Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); Relocate(at->target_X, at->target_Y, at->target_Z, GetOrientation()); mapId = at->target_mapId; } else { - sLog->outError("Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); RelocateToHomebind(); } @@ -17020,11 +17020,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); mapId = info->mapId; Relocate(info->positionX, info->positionY, info->positionZ, 0.0f); - sLog->outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); map = sMapMgr->CreateMap(mapId, this); if (!map) { - sLog->outError("Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } } @@ -17038,7 +17038,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); else { - sLog->outError("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(), GetGUIDLow(), mapId); RelocateToHomebind(); } } @@ -17082,7 +17082,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) m_stableSlots = fields[32].GetUInt8(); if (m_stableSlots > MAX_PET_STABLES) { - sLog->outError("Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots)); + sLog->outError(LOG_FILTER_PLAYER, "Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots)); m_stableSlots = MAX_PET_STABLES; } @@ -17160,7 +17160,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("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(), GetGUIDLow(), m_specsCount, m_activeSpec); } _LoadTalents(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADTALENTS)); @@ -17365,7 +17365,7 @@ void Player::_LoadActions(PreparedQueryResult result) ab->uState = ACTIONBUTTON_UNCHANGED; else { - sLog->outError(" ...at loading, and will deleted in DB also"); + sLog->outError(LOG_FILTER_PLAYER, " ...at loading, and will deleted in DB also"); // Will deleted in DB at next save (it can create data until save but marked as deleted) m_actionButtons[button].uState = ACTIONBUTTON_DELETED; @@ -17409,7 +17409,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - sLog->outError("Unknown aura (spellid %u), ignore.", spellid); + sLog->outError(LOG_FILTER_PLAYER, "Unknown aura (spellid %u), ignore.", spellid); continue; } @@ -17443,7 +17443,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]); aura->ApplyForTargets(); - sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); + sLog->outInfo(LOG_FILTER_PLAYER, "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); } } while (result->NextRow()); @@ -17466,13 +17466,13 @@ void Player::_LoadGlyphAuras() continue; } else - sLog->outError("Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags); + sLog->outError(LOG_FILTER_PLAYER, "Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags); } else - sLog->outError("Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i); + sLog->outError(LOG_FILTER_PLAYER, "Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i); } else - sLog->outError("Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i); + sLog->outError(LOG_FILTER_PLAYER, "Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i); // On any error remove glyph SetGlyph(i, 0); @@ -17582,7 +17582,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) } else { - sLog->outError("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?", + 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); item->DeleteFromInventoryDB(trans); delete item; @@ -17596,7 +17596,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) item->SetState(ITEM_UNCHANGED, this); else { - sLog->outError("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.", + 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); item->DeleteFromInventoryDB(trans); problematicItems.push_back(item); @@ -17722,7 +17722,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.", + 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); remove = true; } @@ -17737,7 +17737,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.", + sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.", GetGUIDLow(), GetName(), itemEntry); Item::DeleteFromInventoryDB(trans, itemGuid); Item::DeleteFromDB(trans, itemGuid); @@ -17768,7 +17768,7 @@ void Player::_LoadMailedItems(Mail* mail) if (!proto) { - sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID); + sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); stmt->setUInt32(0, itemGuid); @@ -17784,7 +17784,7 @@ void Player::_LoadMailedItems(Mail* mail) if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate)) { - sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); + sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); stmt->setUInt32(0, itemGuid); @@ -17847,7 +17847,7 @@ void Player::_LoadMail() if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) { - sLog->outError("Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); + sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); m->mailTemplateId = 0; } @@ -17904,7 +17904,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) else { questStatusData.Status = QUEST_STATUS_INCOMPLETE; - sLog->outError("Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", + 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); } @@ -18028,7 +18028,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result) if (quest_daily_idx >= PLAYER_MAX_DAILY_QUESTS) // max amount with exist data in query { - sLog->outError("Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow()); break; } @@ -18159,12 +18159,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry || !mapEntry->IsDungeon()) { - sLog->outError("_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(), GetGUIDLow(), mapId); deleteInstance = true; } else if (difficulty >= MAX_DIFFICULTY) { - sLog->outError("_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(), GetGUIDLow(), difficulty, mapId); deleteInstance = true; } else @@ -18172,12 +18172,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(difficulty)); if (!mapDiff) { - sLog->outError("_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(), GetGUIDLow(), difficulty, mapId); deleteInstance = true; } else if (!perm && group) { - sLog->outError("_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(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty); deleteInstance = true; } } @@ -18523,7 +18523,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { - sLog->outError("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()); return false; } @@ -18571,7 +18571,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) CharacterDatabase.Execute(stmt); } - sLog->outStaticDebug("Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f", + sLog->outDebug(LOG_FILTER_PLAYER, "Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f", m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ); return true; @@ -19015,7 +19015,7 @@ void Player::_SaveInventory(SQLTransaction& trans) } else { - sLog->outError("Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow()); m_refundableItems.erase(itr); } } @@ -19046,7 +19046,7 @@ void Player::_SaveInventory(SQLTransaction& trans) uint32 bagTestGUID = 0; if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot())) bagTestGUID = test2->GetGUIDLow(); - sLog->outError("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(), 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); @@ -19062,7 +19062,7 @@ void Player::_SaveInventory(SQLTransaction& trans) } else if (test != item) { - sLog->outError("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(), 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); @@ -19472,7 +19472,7 @@ void Player::_SaveStats(SQLTransaction& trans) void Player::outDebugValues() const { - if (!sLog->IsOutDebug()) // optimize disabled debug output + if (!sLog->ShouldLog(LOG_FILTER_UNITS, LOG_LEVEL_DEBUG)) return; sLog->outDebug(LOG_FILTER_UNITS, "HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA)); @@ -19792,7 +19792,7 @@ Pet* Player::GetPet() const return pet; //there may be a guardian in slot - //sLog->outError("Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid)); + //sLog->outError(LOG_FILTER_PLAYER, "Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid)); //const_cast(this)->SetPetGUID(0); } @@ -19894,10 +19894,10 @@ void Player::StopCastingCharm() if (GetCharmGUID()) { - sLog->outCrash("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(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId()); if (charm->GetCharmerGUID()) { - sLog->outCrash("Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); + sLog->outFatal(LOG_FILTER_PLAYER, "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); ASSERT(false); } else @@ -20089,7 +20089,7 @@ void Player::PossessSpellInitialize() if (!charmInfo) { - sLog->outError("Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID()); + sLog->outError(LOG_FILTER_PLAYER, "Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID()); return; } @@ -20201,7 +20201,7 @@ void Player::CharmSpellInitialize() CharmInfo* charmInfo = charm->GetCharmInfo(); if (!charmInfo) { - sLog->outError("Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID()); + sLog->outError(LOG_FILTER_PLAYER, "Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID()); return; } @@ -20912,7 +20912,7 @@ void Player::InitDisplayIds() PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { - sLog->outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); return; } @@ -20928,7 +20928,7 @@ void Player::InitDisplayIds() SetNativeDisplayId(info->displayId_m); break; default: - sLog->outError("Invalid gender %u for player", gender); + sLog->outError(LOG_FILTER_PLAYER, "Invalid gender %u for player", gender); return; } } @@ -21065,7 +21065,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); if (!iece) { - sLog->outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost); + sLog->outError(LOG_FILTER_PLAYER, "Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost); return false; } @@ -21108,7 +21108,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice; if ((uint32)count > maxCount) { - sLog->outError("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(), (uint32)count, pProto->ItemId); count = (uint8)maxCount; } price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT @@ -21588,7 +21588,7 @@ void Player::SetBattlegroundEntryPoint() if (const WorldSafeLocsEntry* entry = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam())) m_bgData.joinPos = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.0f); else - sLog->outError("SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId()); + sLog->outError(LOG_FILTER_PLAYER, "SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId()); } // If new entry point is not BG or arena set it else if (!GetMap()->IsBattlegroundOrArena()) @@ -22822,7 +22822,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons break; } default: - sLog->outError("HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass); + sLog->outError(LOG_FILTER_PLAYER, "HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass); break; } @@ -22900,7 +22900,7 @@ uint32 Player::GetResurrectionSpellId() case 27239: spell_id = 27240; break; // rank 6 case 47883: spell_id = 47882; break; // rank 7 default: - sLog->outError("Unhandled spell %u: S.Resurrection", (*itr)->GetId()); + sLog->outError(LOG_FILTER_PLAYER, "Unhandled spell %u: S.Resurrection", (*itr)->GetId()); continue; } @@ -23456,7 +23456,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply) if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) { - sLog->outCrash("Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName()); + sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName()); return; } @@ -23472,7 +23472,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply) if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) { - sLog->outCrash("Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName()); + sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName()); return; } @@ -23949,7 +23949,7 @@ void Player::_LoadSkills(PreparedQueryResult result) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (!pSkill) { - sLog->outError("Character %u has skill %u that does not exist.", GetGUIDLow(), skill); + sLog->outError(LOG_FILTER_PLAYER, "Character %u has skill %u that does not exist.", GetGUIDLow(), skill); continue; } @@ -23967,7 +23967,7 @@ void Player::_LoadSkills(PreparedQueryResult result) } if (value == 0) { - sLog->outError("Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill); + sLog->outError(LOG_FILTER_PLAYER, "Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SKILL); @@ -23996,7 +23996,7 @@ void Player::_LoadSkills(PreparedQueryResult result) if (count >= PLAYER_MAX_SKILLS) // client limit { - sLog->outError("Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS); + sLog->outError(LOG_FILTER_PLAYER, "Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS); break; } } @@ -24164,7 +24164,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) } //Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction - sLog->outStaticDebug("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall); + sLog->outDebug(LOG_FILTER_PLAYER, "FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall); } } RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // No fly zone - Parachute @@ -24278,7 +24278,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) uint32 spellid = talentInfo->RankID[talentRank]; if (spellid == 0) { - sLog->outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); + sLog->outError(LOG_FILTER_PLAYER, "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); return; } @@ -24290,7 +24290,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) learnSpell(spellid, false); AddTalent(spellid, m_activeSpec, true); - sLog->outDetail("TalentID: %u Rank: %u Spell: %u Spec: %u\n", talentId, talentRank, spellid, m_activeSpec); + sLog->outInfo(LOG_FILTER_PLAYER, "TalentID: %u Rank: %u Spell: %u Spec: %u\n", talentId, talentRank, spellid, m_activeSpec); // update free talent points SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1)); @@ -24415,7 +24415,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) uint32 spellid = talentInfo->RankID[talentRank]; if (spellid == 0) { - sLog->outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); + sLog->outError(LOG_FILTER_PLAYER, "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); return; } @@ -24425,7 +24425,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) // learn! (other talent ranks will unlearned at learning) pet->learnSpell(spellid); - sLog->outDetail("PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid); + sLog->outInfo(LOG_FILTER_PLAYER, "PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid); // update free talent points pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1)); @@ -24739,7 +24739,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset) if (!found) // something wrong... { - sLog->outError("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(), eqset.Guid, index); return; } } diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 95c6d308626..238b6e9cd5a 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -35,8 +35,8 @@ void MapManager::LoadTransports() if (!result) { - sLog->outString(">> Loaded 0 transports. DB table `transports` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transports. DB table `transports` is empty!"); + return; } @@ -56,17 +56,17 @@ void MapManager::LoadTransports() if (!goinfo) { - sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str()); + sLog->outError(LOG_FILTER_SQL, "Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str()); continue; } if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT) { - sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str()); + sLog->outError(LOG_FILTER_SQL, "Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str()); continue; } - // sLog->outString("Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name); + // sLog->outInfo(LOG_FILTER_TRANSPORTS, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name); std::set mapsUsed; @@ -74,7 +74,7 @@ void MapManager::LoadTransports() if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed)) // skip transports with empty waypoints list { - sLog->outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId); + sLog->outError(LOG_FILTER_SQL, "Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId); delete t; continue; } @@ -116,13 +116,13 @@ void MapManager::LoadTransports() uint32 guid = fields[0].GetUInt32(); uint32 entry = fields[1].GetUInt32(); std::string name = fields[2].GetString(); - sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid); + sLog->outError(LOG_FILTER_SQL, "Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid); } while (result->NextRow()); } - sLog->outString(">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void MapManager::LoadTransportNPCs() @@ -134,8 +134,8 @@ void MapManager::LoadTransportNPCs() if (!result) { - sLog->outString(">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!"); + return; } @@ -166,8 +166,8 @@ void MapManager::LoadTransportNPCs() } while (result->NextRow()); - sLog->outString(">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0), @@ -197,7 +197,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa if (!IsPositionValid()) { - sLog->outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + sLog->outError(LOG_FILTER_TRANSPORTS, "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, x, y); return false; } @@ -208,7 +208,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa if (!goinfo) { - sLog->outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang); + sLog->outError(LOG_FILTER_SQL, "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang); return false; } @@ -354,7 +354,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) } // for (int i = 0; i < keyFrames.size(); ++i) { - // sLog->outString("%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo); + // sLog->outInfo(LOG_FILTER_TRANSPORTS, "%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo); // } // Now we're completely set up; we can move along the length of each waypoint at 100 ms intervals @@ -397,7 +397,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) cM = keyFrames[i].node->mapid; } - // sLog->outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ); + // sLog->outInfo(LOG_FILTER_TRANSPORTS, "T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ); if (teleport) m_WayPoints[t] = WayPoint(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0); } @@ -445,14 +445,14 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) m_WayPoints[t] = WayPoint(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport, 0, keyFrames[i + 1].node->arrivalEventID, keyFrames[i + 1].node->departureEventID); - // sLog->outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport); + // sLog->outInfo(LOG_FILTER_TRANSPORTS, "T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport); t += keyFrames[i + 1].node->delay * 1000; } uint32 timer = t; - // sLog->outDetail(" Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer); + // sLog->outInfo(LOG_FILTER_TRANSPORTS, " Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer); m_curr = m_WayPoints.begin(); m_next = GetNextWayPoint(); @@ -511,7 +511,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) bool Transport::AddPassenger(Player* passenger) { if (m_passengers.insert(passenger).second) - sLog->outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName()); + sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s boarded transport %s.", passenger->GetName(), GetName()); sScriptMgr->OnAddPassenger(this, passenger); return true; @@ -520,7 +520,7 @@ bool Transport::AddPassenger(Player* passenger) bool Transport::RemovePassenger(Player* passenger) { if (m_passengers.erase(passenger)) - sLog->outDetail("Player %s removed from transport %s.", passenger->GetName(), GetName()); + sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s removed from transport %s.", passenger->GetName(), GetName()); sScriptMgr->OnRemovePassenger(this, passenger); return true; @@ -531,7 +531,7 @@ void Transport::Update(uint32 p_diff) if (!AI()) { if (!AIM_Initialize()) - sLog->outError("Could not initialize GameObjectAI for Transport"); + sLog->outError(LOG_FILTER_TRANSPORTS, "Could not initialize GameObjectAI for Transport"); } else AI()->UpdateAI(p_diff); @@ -660,7 +660,7 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, if (!creature->IsPositionValid()) { - sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY()); + sLog->outError(LOG_FILTER_TRANSPORTS, "Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY()); delete creature; return 0; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6158e08b859..d65d717c236 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -629,10 +629,10 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam return 0; } - sLog->outStaticDebug("DealDamageStart"); + sLog->outDebug(LOG_FILTER_UNITS, "DealDamageStart"); uint32 health = victim->GetHealth(); - sLog->outDetail("deal dmg:%d to health:%d ", damage, health); + sLog->outInfo(LOG_FILTER_UNITS, "deal dmg:%d to health:%d ", damage, health); // duel ends when player has 1 or less hp bool duel_hasEnded = false; @@ -686,7 +686,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam if (health <= damage) { - sLog->outStaticDebug("DealDamage: victim just died"); + sLog->outDebug(LOG_FILTER_UNITS, "DealDamage: victim just died"); if (victim->GetTypeId() == TYPEID_PLAYER && victim != this) { @@ -701,7 +701,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam } else { - sLog->outStaticDebug("DealDamageAlive"); + sLog->outDebug(LOG_FILTER_UNITS, "DealDamageAlive"); if (victim->GetTypeId() == TYPEID_PLAYER) victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); @@ -785,7 +785,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam } } - sLog->outStaticDebug("DealDamageEnd returned %d damage", damage); + sLog->outDebug(LOG_FILTER_UNITS, "DealDamageEnd returned %d damage", damage); return damage; } @@ -801,7 +801,7 @@ void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo { if (!spellInfo) { - sLog->outError("CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } @@ -829,7 +829,7 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } @@ -872,7 +872,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } SpellCastTargets targets; @@ -886,7 +886,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } SpellCastTargets targets; @@ -900,7 +900,7 @@ void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castI SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } SpellCastTargets targets; @@ -1881,10 +1881,10 @@ void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool ext DealMeleeDamage(&damageInfo, true); if (GetTypeId() == TYPEID_PLAYER) - sLog->outStaticDebug("AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", + sLog->outDebug(LOG_FILTER_UNITS, "AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); else - sLog->outStaticDebug("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", + sLog->outDebug(LOG_FILTER_UNITS, "AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); } } @@ -1915,7 +1915,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy float parry_chance = victim->GetUnitParryChance(); // Useful if want to specify crit & miss chances for melee, else it could be removed - sLog->outStaticDebug("MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance); + sLog->outDebug(LOG_FILTER_UNITS, "MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance); return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance*100), int32(miss_chance*100), int32(dodge_chance*100), int32(parry_chance*100), int32(block_chance*100)); } @@ -1936,22 +1936,22 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT int32 sum = 0, tmp = 0; int32 roll = urand (0, 10000); - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus); - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d", + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d", roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance); tmp = miss_chance; if (tmp > 0 && roll < (sum += tmp)) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: MISS"); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: MISS"); return MELEE_HIT_MISS; } // always crit against a sitting target (except 0 crit chance) if (victim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !victim->IsStandState()) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT (sitting victim)"); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT (sitting victim)"); return MELEE_HIT_CRIT; } @@ -1960,7 +1960,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT // only players can't dodge if attacker is behind if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); } else { @@ -1979,7 +1979,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT && ((tmp -= skillBonus) > 0) && roll < (sum += tmp)) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum); return MELEE_HIT_DODGE; } } @@ -1988,7 +1988,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT // check if attack comes from behind, nobody can parry or block if attacker is behind if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind."); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: attack came from behind."); else { // Reduce parry chance by attacker expertise rating @@ -2004,7 +2004,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT && (tmp2 -= skillBonus) > 0 && roll < (sum += tmp2)) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum); return MELEE_HIT_PARRY; } } @@ -2016,7 +2016,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT && (tmp -= skillBonus) > 0 && roll < (sum += tmp)) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum); return MELEE_HIT_BLOCK; } } @@ -2027,9 +2027,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT if (tmp > 0 && roll < (sum += tmp)) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum); if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT)) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT DISABLED)"); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT DISABLED)"); else return MELEE_HIT_CRIT; } @@ -2049,7 +2049,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT tmp = tmp > 4000 ? 4000 : tmp; if (roll < (sum += tmp)) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum); return MELEE_HIT_GLANCING; } } @@ -2073,13 +2073,13 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT tmp = tmp * 200 - 1500; if (roll < (sum += tmp)) { - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum); return MELEE_HIT_CRUSHING; } } } - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: NORMAL"); + sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: NORMAL"); return MELEE_HIT_NORMAL; } @@ -2144,7 +2144,7 @@ void Unit::SendMeleeAttackStart(Unit* victim) data << uint64(GetGUID()); data << uint64(victim->GetGUID()); SendMessageToSet(&data, true); - sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTART"); + sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTART"); } void Unit::SendMeleeAttackStop(Unit* victim) @@ -2154,12 +2154,12 @@ void Unit::SendMeleeAttackStop(Unit* victim) data.append(victim ? victim->GetPackGUID() : 0); data << uint32(0); //! Can also take the value 0x01, which seems related to updating rotation SendMessageToSet(&data, true); - sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTOP"); + sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTOP"); if (victim) - sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow()); + sLog->outInfo(LOG_FILTER_UNITS, "%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow()); else - sLog->outDetail("%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow()); + sLog->outInfo(LOG_FILTER_UNITS, "%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow()); } bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType) @@ -2329,7 +2329,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) case MELEE_HIT_BLOCK: canBlock = false; break; case MELEE_HIT_PARRY: canParry = false; break; default: - sLog->outStaticDebug("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue()); + sLog->outDebug(LOG_FILTER_UNITS, "Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue()); break; } } @@ -4769,7 +4769,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo) data << float(pInfo->multiplier); // gain multiplier break; default: - sLog->outError("Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType())); + sLog->outError(LOG_FILTER_UNITS, "Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType())); return; } @@ -4930,7 +4930,7 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (!triggerEntry) { - sLog->outError("Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", hasteSpell->Id, triggered_spell_id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", hasteSpell->Id, triggered_spell_id); return false; } @@ -4988,7 +4988,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEf if (!triggerEntry) { - sLog->outError("Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id); return false; } @@ -5630,7 +5630,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 31571: triggered_spell_id = 57529; break; case 31572: triggered_spell_id = 57531; break; default: - sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u", dummySpell->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u", dummySpell->Id); return false; } break; @@ -5716,7 +5716,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 12847: basepoints0 = int32(0.16f * damage); break; case 12848: basepoints0 = int32(0.20f * damage); break; default: - sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id); return false; } @@ -5834,7 +5834,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 29834: triggered_spell_id=29841; break; case 42770: triggered_spell_id=42771; break; default: - sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id); return false; } @@ -7070,7 +7070,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 3787:spellId = 58804; break; // 8 Rank default: { - sLog->outError("Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)", + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)", castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)), dummySpell->Id); return false; } @@ -7079,7 +7079,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId); if (!windfurySpellInfo) { - sLog->outError("Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId); return false; } @@ -7409,7 +7409,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 49270: spellId = 49268; break; // Rank 7 case 49271: spellId = 49269; break; // Rank 8 default: - sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id); return false; } @@ -7723,7 +7723,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!triggerEntry) { - sLog->outError("Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); return false; } @@ -7781,7 +7781,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec // Try handle unknown trigger spells if (!triggerEntry) { - sLog->outError("Unit::HandleObsModEnergyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleObsModEnergyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); return false; } @@ -7834,7 +7834,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura if (!triggerEntry) { - sLog->outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleModDamagePctTakenAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); return false; } @@ -8221,7 +8221,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 31643; break; default: - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id); return false; } } @@ -8297,7 +8297,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 27815: trigger_spell_id = 27817; break; case 27816: trigger_spell_id = 27818; break; default: - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id); return false; } basepoints0 = CalculatePctN(int32(damage), triggerAmount) / 3; @@ -8357,7 +8357,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 63468; break; default: - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id); return false; } SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id); @@ -8470,14 +8470,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 48820: originalSpellId = 48824; break; case 48821: originalSpellId = 48825; break; default: - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id); return false; } } SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId); if (!originalSpell) { - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId); return false; } // percent stored in effect 1 (class scripts) base points @@ -8631,7 +8631,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (triggerEntry == NULL) { // Don't cast unknown spell - // sLog->outError("Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex()); + // sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex()); return false; } @@ -9140,7 +9140,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au if (!triggerEntry) { - sLog->outError("Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId); return false; } @@ -9207,11 +9207,11 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const if (GetGUID() != guid) { if (Player const* player = ToPlayer()) - sLog->outError("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(), getFaction()); else if (Creature const* creature = ToCreature()) - sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); + sLog->outError(LOG_FILTER_UNITS, "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); else - sLog->outError("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(), uint32(GetTypeId()), getFaction()); guid = GetGUID(); } @@ -9559,7 +9559,7 @@ void Unit::RemoveAllAttackers() AttackerSet::iterator iter = m_attackers.begin(); if (!(*iter)->AttackStop()) { - sLog->outError("WORLD: Unit has an attacker that isn't attacking it!"); + sLog->outError(LOG_FILTER_UNITS, "WORLD: Unit has an attacker that isn't attacking it!"); m_attackers.erase(iter); } } @@ -9727,7 +9727,7 @@ Minion *Unit::GetFirstMinion() const if (pet->HasUnitTypeMask(UNIT_MASK_MINION)) return (Minion*)pet; - sLog->outError("Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid)); + sLog->outError(LOG_FILTER_UNITS, "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid)); const_cast(this)->SetMinionGUID(0); } @@ -9742,7 +9742,7 @@ Guardian* Unit::GetGuardianPet() const if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) return (Guardian*)pet; - sLog->outCrash("Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid); + sLog->outFatal(LOG_FILTER_UNITS, "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid); const_cast(this)->SetPetGUID(0); } @@ -9756,7 +9756,7 @@ Unit* Unit::GetCharm() const if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid)) return pet; - sLog->outError("Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid)); + sLog->outError(LOG_FILTER_UNITS, "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid)); const_cast(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0); } @@ -9771,7 +9771,7 @@ void Unit::SetMinion(Minion *minion, bool apply) { if (minion->GetOwnerGUID()) { - sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); + sLog->outFatal(LOG_FILTER_UNITS, "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); return; } @@ -9845,7 +9845,7 @@ void Unit::SetMinion(Minion *minion, bool apply) { if (minion->GetOwnerGUID() != GetGUID()) { - sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); + sLog->outFatal(LOG_FILTER_UNITS, "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); return; } @@ -9957,7 +9957,7 @@ void Unit::SetCharm(Unit* charm, bool apply) if (GetTypeId() == TYPEID_PLAYER) { if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - sLog->outCrash("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(), charm->GetEntry(), GetCharmGUID()); charm->m_ControlledByPlayer = true; // TODO: maybe we can use this flag to check if controlled by player @@ -9970,7 +9970,7 @@ void Unit::SetCharm(Unit* charm, bool apply) charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1)); if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) - sLog->outCrash("Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) { @@ -9985,11 +9985,11 @@ void Unit::SetCharm(Unit* charm, bool apply) if (GetTypeId() == TYPEID_PLAYER) { if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - sLog->outCrash("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(), charm->GetEntry(), GetCharmGUID()); } if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) - sLog->outCrash("Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); if (charm->GetTypeId() == TYPEID_PLAYER) { @@ -10123,14 +10123,14 @@ void Unit::RemoveAllControlled() else if (target->GetOwnerGUID() == GetGUID() && target->isSummon()) target->ToTempSummon()->UnSummon(); else - sLog->outError("Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry()); + sLog->outError(LOG_FILTER_UNITS, "Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry()); } if (GetPetGUID()) - sLog->outCrash("Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID()); if (GetMinionGUID()) - sLog->outCrash("Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID()); if (GetCharmGUID()) - sLog->outCrash("Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID()); } Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) @@ -12609,7 +12609,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) break; } default: - sLog->outError("Unit::UpdateSpeed: Unsupported move type (%d)", mtype); + sLog->outError(LOG_FILTER_UNITS, "Unit::UpdateSpeed: Unsupported move type (%d)", mtype); return; } @@ -12716,7 +12716,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8+4+2+4+4+4+4+4+4+4); break; default: - sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); + sLog->outError(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); return; } @@ -12767,7 +12767,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data.Initialize(SMSG_FORCE_PITCH_RATE_CHANGE, 16); break; default: - sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); + sLog->outError(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); return; } data.append(GetPackGUID()); @@ -13425,7 +13425,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f { if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) { - sLog->outError("ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!"); + sLog->outError(LOG_FILTER_UNITS, "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!"); return false; } @@ -13490,7 +13490,7 @@ float Unit::GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) co { if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) { - sLog->outError("attempt to access non-existing modifier value from UnitMods!"); + sLog->outError(LOG_FILTER_UNITS, "attempt to access non-existing modifier value from UnitMods!"); return 0.0f; } @@ -13520,7 +13520,7 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const { if (unitMod >= UNIT_MOD_END) { - sLog->outError("attempt to access non-existing UnitMods in GetTotalAuraModValue()!"); + sLog->outError(LOG_FILTER_UNITS, "attempt to access non-existing UnitMods in GetTotalAuraModValue()!"); return 0.0f; } @@ -13801,7 +13801,7 @@ void Unit::RemoveFromWorld() if (GetCharmerGUID()) { - sLog->outCrash("Unit %u has charmer guid when removed from world", GetEntry()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit %u has charmer guid when removed from world", GetEntry()); ASSERT(false); } @@ -13809,7 +13809,7 @@ void Unit::RemoveFromWorld() { if (owner->m_Controlled.find(this) != owner->m_Controlled.end()) { - sLog->outCrash("Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry()); ASSERT(false); } } @@ -15238,7 +15238,7 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id) if (!pet->InitStatsForLevel(level)) { - sLog->outError("Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry()); + sLog->outError(LOG_FILTER_UNITS, "Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry()); return false; } @@ -15416,7 +15416,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura) damageSpellId = 43594; break; default: - sLog->outError("Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id); + sLog->outError(LOG_FILTER_UNITS, "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id); return false; } @@ -15578,7 +15578,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) if (!spiritOfRedemption) { - sLog->outStaticDebug("SET JUST_DIED"); + sLog->outDebug(LOG_FILTER_UNITS, "SET JUST_DIED"); victim->setDeathState(JUST_DIED); } @@ -15603,7 +15603,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // only if not player and not controlled by player pet. And not at BG if ((durabilityLoss && !player && !victim->ToPlayer()->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP))) { - sLog->outStaticDebug("We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH)); + sLog->outDebug(LOG_FILTER_UNITS, "We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH)); plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false); // durability lost message WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0); @@ -15623,7 +15623,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) } else // creature died { - sLog->outStaticDebug("DealDamageNotPlayer"); + sLog->outDebug(LOG_FILTER_UNITS, "DealDamageNotPlayer"); if (!creature->isPet()) { @@ -15958,7 +15958,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au if (this == charmer) { - sLog->outCrash("Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow()); return false; } @@ -15967,14 +15967,14 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetTransport()) { - sLog->outCrash("Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow()); return false; } // Already charmed if (GetCharmerGUID()) { - sLog->outCrash("Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); return false; } @@ -15999,7 +15999,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au // StopCastingCharm may remove a possessed pet? if (!IsInWorld()) { - sLog->outCrash("Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); + sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); return false; } @@ -16099,7 +16099,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) charmer = GetCharmer(); if (charmer != GetCharmer()) // one aura overrides another? { -// sLog->outCrash("Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, +// sLog->outFatal(LOG_FILTER_UNITS, "Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, // GetGUID(), GetCharmerGUID(), charmer->GetGUID()); // ASSERT(false); return; @@ -16177,7 +16177,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) if (GetCharmInfo()) GetCharmInfo()->SetPetNumber(0, true); else - sLog->outError("Aura::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); + sLog->outError(LOG_FILTER_UNITS, "Aura::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); } } break; @@ -16982,7 +16982,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) if (!valid) { - sLog->outErrorDb("Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId); + sLog->outError(LOG_FILTER_SQL, "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId); return false; } @@ -17418,39 +17418,44 @@ void Unit::StopAttackFaction(uint32 faction_id) void Unit::OutDebugInfo() const { - sLog->outError("Unit::OutDebugInfo"); - sLog->outString("GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName()); - sLog->outString("OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID()); - sLog->outString("In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask); + 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, "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()) - sLog->outString("Mapid %u", GetMapId()); + sLog->outInfo(LOG_FILTER_UNITS, "Mapid %u", GetMapId()); - sLog->outStringInLine("Summon Slot: "); + std::ostringstream o; + o << "Summon Slot: "; for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i) - sLog->outStringInLine(UI64FMTD", ", m_SummonSlot[i]); - sLog->outString(); + o << m_SummonSlot[i] << ", "; - sLog->outStringInLine("Controlled List: "); + sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str()); + o.str(""); + + o << "Controlled List: "; for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) - sLog->outStringInLine(UI64FMTD", ", (*itr)->GetGUID()); - sLog->outString(); + o << (*itr)->GetGUID() << ", "; + sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str()); + o.str(""); - sLog->outStringInLine("Aura List: "); + o << "Aura List: "; for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr) - sLog->outStringInLine("%u, ", itr->first); - sLog->outString(); + o << itr->first << ", "; + sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str()); + o.str(""); if (IsVehicle()) { - sLog->outStringInLine("Passenger List: "); + o << "Passenger List: "; for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr) if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger)) - sLog->outStringInLine(UI64FMTD", ", passenger->GetGUID()); - sLog->outString(); + o << passenger->GetGUID() << ", "; + sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str()); } if (GetVehicle()) - sLog->outString("On vehicle %u.", GetVehicleBase()->GetEntry()); + sLog->outInfo(LOG_FILTER_UNITS, "On vehicle %u.", GetVehicleBase()->GetEntry()); } uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index d5e85d2cf2f..e1141f785e1 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -210,8 +210,8 @@ void GameEventMgr::LoadFromDB() if (!result) { mGameEvent.clear(); - sLog->outErrorDb(">> Loaded 0 game events. DB table `game_event` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 game events. DB table `game_event` is empty."); + return; } @@ -223,7 +223,7 @@ void GameEventMgr::LoadFromDB() uint8 event_id = fields[0].GetUInt8(); if (event_id == 0) { - sLog->outErrorDb("`game_event` game event entry 0 is reserved and can't be used."); + sLog->outError(LOG_FILTER_SQL, "`game_event` game event entry 0 is reserved and can't be used."); continue; } @@ -241,7 +241,7 @@ void GameEventMgr::LoadFromDB() if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check { - sLog->outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id); continue; } @@ -249,7 +249,7 @@ void GameEventMgr::LoadFromDB() { if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id)) { - sLog->outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id); + sLog->outError(LOG_FILTER_SQL, "`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id); pGameEvent.holiday_id = HOLIDAY_NONE; } } @@ -260,11 +260,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } - sLog->outString("Loading Game Event Saves Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Saves Data..."); { uint32 oldMSTime = getMSTime(); @@ -273,8 +273,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); + } else { @@ -287,7 +287,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id); continue; } @@ -298,7 +298,7 @@ void GameEventMgr::LoadFromDB() } else { - sLog->outErrorDb("game_event_save includes event save for non-worldevent id %u", event_id); + sLog->outError(LOG_FILTER_SQL, "game_event_save includes event save for non-worldevent id %u", event_id); continue; } @@ -306,12 +306,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Prerequisite Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Prerequisite Data..."); { uint32 oldMSTime = getMSTime(); @@ -319,8 +319,8 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite"); if (!result) { - sLog->outString(">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); + } else { @@ -333,7 +333,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -342,14 +342,14 @@ void GameEventMgr::LoadFromDB() uint16 prerequisite_event = fields[1].GetUInt32(); if (prerequisite_event >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event); + sLog->outError(LOG_FILTER_SQL, "`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event); continue; } mGameEvent[event_id].prerequisite_events.insert(prerequisite_event); } else { - sLog->outErrorDb("game_event_prerequisiste includes event entry for non-worldevent id %u", event_id); + sLog->outError(LOG_FILTER_SQL, "game_event_prerequisiste includes event entry for non-worldevent id %u", event_id); continue; } @@ -357,12 +357,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Creature Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Creature Data..."); { uint32 oldMSTime = getMSTime(); @@ -372,8 +372,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); + } else { @@ -389,7 +389,7 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - sLog->outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -400,12 +400,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event GO Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Data..."); { uint32 oldMSTime = getMSTime(); @@ -415,8 +415,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); + } else { @@ -432,7 +432,7 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - sLog->outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -443,12 +443,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Model/Equipment Change Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Model/Equipment Change Data..."); { uint32 oldMSTime = getMSTime(); @@ -458,8 +458,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); + } else { @@ -473,7 +473,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventModelEquip.size()) { - sLog->outErrorDb("`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -488,7 +488,7 @@ void GameEventMgr::LoadFromDB() { if (!sObjectMgr->GetEquipmentInfo(newModelEquipSet.equipment_id)) { - sLog->outErrorDb("Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", + sLog->outError(LOG_FILTER_SQL, "Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", guid, newModelEquipSet.equipment_id); continue; } @@ -500,12 +500,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Quest Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -514,8 +514,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); + } else { @@ -530,7 +530,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventCreatureQuests.size()) { - sLog->outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -541,12 +541,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event GO Quest Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -555,8 +555,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); + } else { @@ -571,7 +571,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventGameObjectQuests.size()) { - sLog->outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -582,12 +582,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Quest Condition Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -596,8 +596,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); + } else { @@ -613,7 +613,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -625,12 +625,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Condition Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -639,8 +639,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); + } else { @@ -654,7 +654,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -667,12 +667,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Condition Save Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Save Data..."); { uint32 oldMSTime = getMSTime(); @@ -681,8 +681,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); + } else { @@ -696,7 +696,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -707,7 +707,7 @@ void GameEventMgr::LoadFromDB() } else { - sLog->outErrorDb("game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition); + sLog->outError(LOG_FILTER_SQL, "game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition); continue; } @@ -715,12 +715,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event NPCflag Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event NPCflag Data..."); { uint32 oldMSTime = getMSTime(); @@ -729,8 +729,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); + } else { @@ -745,7 +745,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -755,12 +755,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Seasonal Quest Relations..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Seasonal Quest Relations..."); { uint32 oldMSTime = getMSTime(); @@ -769,8 +769,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); + } else { @@ -784,13 +784,13 @@ void GameEventMgr::LoadFromDB() if (!sObjectMgr->GetQuestTemplate(questId)) { - sLog->outErrorDb("`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId); + sLog->outError(LOG_FILTER_SQL, "`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId); continue; } if (eventEntry >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry); + sLog->outError(LOG_FILTER_SQL, "`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry); continue; } @@ -799,12 +799,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Vendor Additions Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Vendor Additions Data..."); { uint32 oldMSTime = getMSTime(); @@ -813,8 +813,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); + } else { @@ -827,7 +827,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventVendors.size()) { - sLog->outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -865,12 +865,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Battleground Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Battleground Data..."); { uint32 oldMSTime = getMSTime(); @@ -879,8 +879,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty."); + } else { @@ -893,7 +893,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -903,12 +903,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } - sLog->outString("Loading Game Event Pool Data..."); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Pool Data..."); { uint32 oldMSTime = getMSTime(); @@ -918,8 +918,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); + } else { @@ -935,13 +935,13 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - sLog->outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + sLog->outError(LOG_FILTER_SQL, "`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } if (!sPoolMgr->CheckPool(entry)) { - sLog->outErrorDb("Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry); + sLog->outError(LOG_FILTER_SQL, "Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry); continue; } @@ -952,8 +952,8 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } } @@ -1015,7 +1015,7 @@ void GameEventMgr::StartArenaSeason() if (!result) { - sLog->outError("ArenaSeason (%u) must be an existant Arena Season", season); + sLog->outError(LOG_FILTER_GAMEEVENTS, "ArenaSeason (%u) must be an existant Arena Season", season); return; } @@ -1024,13 +1024,13 @@ void GameEventMgr::StartArenaSeason() if (eventId >= mGameEvent.size()) { - sLog->outError("EventEntry %u for ArenaSeason (%u) does not exists", eventId, season); + sLog->outError(LOG_FILTER_GAMEEVENTS, "EventEntry %u for ArenaSeason (%u) does not exists", eventId, season); return; } StartEvent(eventId, true); - sLog->outString("Arena Season %u started...", season); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Arena Season %u started...", season); + } uint32 GameEventMgr::Update() // return the next event delay in ms @@ -1043,7 +1043,7 @@ uint32 GameEventMgr::Update() // return the next e { // must do the activating first, and after that the deactivating // so first queue it - //sLog->outErrorDb("Checking event %u", itr); + //sLog->outError(LOG_FILTER_SQL, "Checking event %u", itr); if (CheckOneGameEvent(itr)) { // if the world event is in NEXTPHASE state, and the time has passed to finish this event, then do so @@ -1099,13 +1099,13 @@ uint32 GameEventMgr::Update() // return the next e nextEventDelay = 0; for (std::set::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr) StopEvent(*itr); - sLog->outDetail("Next game event check in %u seconds.", nextEventDelay + 1); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Next game event check in %u seconds.", nextEventDelay + 1); return (nextEventDelay + 1) * IN_MILLISECONDS; // Add 1 second to be sure event has started/stopped at next call } void GameEventMgr::UnApplyEvent(uint16 event_id) { - sLog->outDetail("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str()); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str()); //! Run SAI scripts with SMART_EVENT_GAME_EVENT_END RunSmartAIScripts(event_id, false); // un-spawn positive event tagged objects @@ -1137,7 +1137,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id) break; } - sLog->outDetail("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); + sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); //! Run SAI scripts with SMART_EVENT_GAME_EVENT_END RunSmartAIScripts(event_id, true); @@ -1211,7 +1211,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", + sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", internal_event_id, mGameEventCreatureGuids.size()); return; } @@ -1238,7 +1238,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", + sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", internal_event_id, mGameEventGameobjectGuids.size()); return; } @@ -1271,7 +1271,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", + sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size()); return; } @@ -1286,7 +1286,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", + sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", internal_event_id, mGameEventCreatureGuids.size()); return; } @@ -1308,7 +1308,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", + sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", internal_event_id, mGameEventGameobjectGuids.size()); return; } @@ -1329,7 +1329,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) } if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size()); + sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size()); return; } diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 9a99a28c7aa..81a132a40d8 100755 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -290,7 +290,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia return NULL; } - sLog->outStaticDebug("Deleting Corpse and spawned bones."); + sLog->outDebug(LOG_FILTER_GENERAL, "Deleting Corpse and spawned bones."); // Map can be NULL Map* map = corpse->FindMap(); diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 92a7a24571e..5b31c6bfff4 100755 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -155,14 +155,14 @@ class ObjectAccessor CellCoord p = Trinity::ComputeCellCoord(x, y); if (!p.IsCoordValid()) { - sLog->outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); + sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); return NULL; } CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!q.IsCoordValid()) { - sLog->outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); + sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); return NULL; } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index eedf84ab41c..9cbf9ed1ee2 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -296,8 +296,8 @@ void ObjectMgr::LoadCreatureLocales() } } while (result->NextRow()); - sLog->outString(">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadGossipMenuItemsLocales() @@ -333,8 +333,8 @@ void ObjectMgr::LoadGossipMenuItemsLocales() } } while (result->NextRow()); - sLog->outString(">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadPointOfInterestLocales() @@ -360,8 +360,8 @@ void ObjectMgr::LoadPointOfInterestLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName); } while (result->NextRow()); - sLog->outString(">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadCreatureTemplates() @@ -388,8 +388,8 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { - sLog->outString(">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); + return; } @@ -491,8 +491,8 @@ void ObjectMgr::LoadCreatureTemplates() for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) CheckCreatureTemplate(&itr->second); - sLog->outString(">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadCreatureTemplateAddons() @@ -504,8 +504,8 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { - sLog->outString(">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); + return; } @@ -518,7 +518,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!sObjectMgr->GetCreatureTemplate(entry)) { - sLog->outErrorDb("Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry); + sLog->outError(LOG_FILTER_SQL, "Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry); continue; } @@ -538,7 +538,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) { - sLog->outErrorDb("Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr))); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr))); continue; } creatureAddon.auras[i++] = uint32(atol(*itr)); @@ -548,14 +548,14 @@ void ObjectMgr::LoadCreatureTemplateAddons() { if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount)) { - sLog->outErrorDb("Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount); creatureAddon.mount = 0; } } if (!sEmotesStore.LookupEntry(creatureAddon.emote)) { - sLog->outErrorDb("Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote); creatureAddon.emote = 0; } @@ -563,8 +563,8 @@ void ObjectMgr::LoadCreatureTemplateAddons() } while (result->NextRow()); - sLog->outString(">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) @@ -582,7 +582,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]); if (!difficultyInfo) { - sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.", + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]); continue; } @@ -593,20 +593,20 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) ok2 = false; if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end()) { - sLog->outErrorDb("Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.", + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.", cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1); continue; } if (_difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _difficultyEntries[diff2].end()) { - sLog->outErrorDb("Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1); continue; } if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end()) { - sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.", + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1); continue; } @@ -617,51 +617,51 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->unit_class != difficultyInfo->unit_class) { - sLog->outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).", + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).", cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class); continue; } if (cInfo->npcflag != difficultyInfo->npcflag) { - sLog->outErrorDb("Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_class != difficultyInfo->trainer_class) { - sLog->outErrorDb("Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_race != difficultyInfo->trainer_race) { - sLog->outErrorDb("Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_type != difficultyInfo->trainer_type) { - sLog->outErrorDb("Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_spell != difficultyInfo->trainer_spell) { - sLog->outErrorDb("Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (!difficultyInfo->AIName.empty()) { - sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.", + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (difficultyInfo->ScriptID) { - sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.", + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } @@ -673,11 +673,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_A); if (!factionTemplate) - sLog->outErrorDb("Creature (Entry: %u) has non-existing faction_A template (%u).", cInfo->Entry, cInfo->faction_A); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing faction_A template (%u).", cInfo->Entry, cInfo->faction_A); factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_H); if (!factionTemplate) - sLog->outErrorDb("Creature (Entry: %u) has non-existing faction_H template (%u).", cInfo->Entry, cInfo->faction_H); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing faction_H template (%u).", cInfo->Entry, cInfo->faction_H); // used later for scale CreatureDisplayInfoEntry const* displayScaleEntry = NULL; @@ -687,7 +687,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1); if (!displayEntry) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1); const_cast(cInfo)->Modelid1 = 0; } else if (!displayScaleEntry) @@ -695,7 +695,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid1); if (!modelInfo) - sLog->outErrorDb("No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry); + sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry); } if (cInfo->Modelid2) @@ -703,7 +703,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2); if (!displayEntry) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2); const_cast(cInfo)->Modelid2 = 0; } else if (!displayScaleEntry) @@ -711,7 +711,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2); if (!modelInfo) - sLog->outErrorDb("No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry); + sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry); } if (cInfo->Modelid3) @@ -719,7 +719,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3); if (!displayEntry) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3); const_cast(cInfo)->Modelid3 = 0; } else if (!displayScaleEntry) @@ -727,7 +727,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid3); if (!modelInfo) - sLog->outErrorDb("No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry); + sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry); } if (cInfo->Modelid4) @@ -735,7 +735,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4); if (!displayEntry) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4); const_cast(cInfo)->Modelid4 = 0; } else if (!displayScaleEntry) @@ -743,11 +743,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4); if (!modelInfo) - sLog->outErrorDb("No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry); + sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry); } if (!displayScaleEntry) - sLog->outErrorDb("Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry); for (int k = 0; k < MAX_KILL_CREDIT; ++k) { @@ -755,7 +755,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) { if (!GetCreatureTemplate(cInfo->KillCredit[k])) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1); const_cast(cInfo)->KillCredit[k] = 0; } } @@ -763,13 +763,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0) { - sLog->outErrorDb("Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class); const_cast(cInfo)->unit_class = UNIT_CLASS_WARRIOR; } if (cInfo->dmgschool >= MAX_SPELL_SCHOOL) { - sLog->outErrorDb("Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool); const_cast(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL; } @@ -780,30 +780,30 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) const_cast(cInfo)->rangeattacktime = BASE_ATTACK_TIME; if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE) - sLog->outErrorDb("Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type); if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type)) { - sLog->outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type); const_cast(cInfo)->type = CREATURE_TYPE_HUMANOID; } // must exist or used hidden but used in data horse case if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM) { - sLog->outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family); const_cast(cInfo)->family = 0; } if (cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE) { - sLog->outErrorDb("Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType); const_cast(cInfo)->InhabitType = INHABIT_ANYWHERE; } if (cInfo->HoverHeight < 0.0f) { - sLog->outErrorDb("Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight); const_cast(cInfo)->HoverHeight = 1.0f; } @@ -812,7 +812,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId); if (!vehId) { - sLog->outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); const_cast(cInfo)->VehicleId = 0; } } @@ -821,21 +821,21 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) { CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); if (!spellDataId) - sLog->outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId); } for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j) { if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j])) { - sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]); const_cast(cInfo)->spells[j] = 0; } } if (cInfo->MovementType >= MAX_DB_MOTION_TYPE) { - sLog->outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType); const_cast(cInfo)->MovementType = IDLE_MOTION_TYPE; } @@ -843,7 +843,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) { if (!GetEquipmentInfo(cInfo->equipmentId)) { - sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with `equipment_id` %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->equipmentId); + sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with `equipment_id` %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->equipmentId); const_cast(cInfo)->equipmentId = 0; } } @@ -859,13 +859,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->expansion > (MAX_CREATURE_BASE_HP - 1)) { - sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion); + sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion); const_cast(cInfo)->expansion = 0; } if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED)) { - sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags); + sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags); const_cast(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED; } @@ -881,8 +881,8 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { - sLog->outString(">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); + return; } @@ -896,7 +896,7 @@ void ObjectMgr::LoadCreatureAddons() CreatureData const* creData = GetCreatureData(guid); if (!creData) { - sLog->outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid); + sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid); continue; } @@ -906,7 +906,7 @@ void ObjectMgr::LoadCreatureAddons() if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id) { const_cast(creData)->movementType = IDLE_MOTION_TYPE; - sLog->outErrorDb("Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid); + sLog->outError(LOG_FILTER_SQL, "Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid); } creatureAddon.mount = fields[2].GetUInt32(); @@ -922,7 +922,7 @@ void ObjectMgr::LoadCreatureAddons() SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) { - sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); + sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); continue; } creatureAddon.auras[i++] = uint32(atol(*itr)); @@ -932,14 +932,14 @@ void ObjectMgr::LoadCreatureAddons() { if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount)) { - sLog->outErrorDb("Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount); + sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount); creatureAddon.mount = 0; } } if (!sEmotesStore.LookupEntry(creatureAddon.emote)) { - sLog->outErrorDb("Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote); + sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote); creatureAddon.emote = 0; } @@ -947,8 +947,8 @@ void ObjectMgr::LoadCreatureAddons() } while (result->NextRow()); - sLog->outString(">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) @@ -986,8 +986,8 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { - sLog->outString(">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); + return; } @@ -1013,7 +1013,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!dbcItem) { - sLog->outErrorDb("Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u, forced to 0.", + sLog->outError(LOG_FILTER_SQL, "Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u, forced to 0.", equipmentInfo.ItemEntry[i], i+1, entry); equipmentInfo.ItemEntry[i] = 0; continue; @@ -1029,7 +1029,7 @@ void ObjectMgr::LoadEquipmentTemplates() dbcItem->InventoryType != INVTYPE_THROWN && dbcItem->InventoryType != INVTYPE_RANGEDRIGHT) { - sLog->outErrorDb("Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u is not equipable in a hand, forced to 0.", + sLog->outError(LOG_FILTER_SQL, "Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u is not equipable in a hand, forced to 0.", equipmentInfo.ItemEntry[i], i+1, entry); equipmentInfo.ItemEntry[i] = 0; } @@ -1039,8 +1039,8 @@ void ObjectMgr::LoadEquipmentTemplates() } while (result->NextRow()); - sLog->outString(">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) @@ -1097,7 +1097,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display { CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender); if (!minfo_tmp) - sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender); + sLog->outError(LOG_FILTER_SQL, "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender); else { // Model ID changed @@ -1117,8 +1117,8 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { - sLog->outString(">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); + return; } @@ -1141,17 +1141,17 @@ void ObjectMgr::LoadCreatureModelInfo() // Checks if (!sCreatureDisplayInfoStore.LookupEntry(modelId)) - sLog->outErrorDb("Table `creature_model_info` has model for not existed display id (%u).", modelId); + sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has model for not existed display id (%u).", modelId); if (modelInfo.gender > GENDER_NONE) { - sLog->outErrorDb("Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId); + sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId); modelInfo.gender = GENDER_MALE; } if (modelInfo.modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.modelid_other_gender)) { - sLog->outErrorDb("Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId); + sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId); modelInfo.modelid_other_gender = 0; } @@ -1162,8 +1162,8 @@ void ObjectMgr::LoadCreatureModelInfo() } while (result->NextRow()); - sLog->outString(">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadLinkedRespawn() @@ -1176,8 +1176,8 @@ void ObjectMgr::LoadLinkedRespawn() if (!result) { - sLog->outErrorDb(">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); + return; } @@ -1198,7 +1198,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* slave = GetCreatureData(guidLow); if (!slave) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow); + sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", guidLow); error = true; break; } @@ -1206,7 +1206,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* master = GetCreatureData(linkedGuidLow); if (!master) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", linkedGuidLow); error = true; break; } @@ -1214,14 +1214,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1235,7 +1235,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* slave = GetCreatureData(guidLow); if (!slave) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow); + sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", guidLow); error = true; break; } @@ -1243,7 +1243,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* master = GetGOData(linkedGuidLow); if (!master) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); error = true; break; } @@ -1251,14 +1251,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1272,7 +1272,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* slave = GetGOData(guidLow); if (!slave) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow); + sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", guidLow); error = true; break; } @@ -1280,7 +1280,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* master = GetGOData(linkedGuidLow); if (!master) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); error = true; break; } @@ -1288,14 +1288,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1309,7 +1309,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* slave = GetGOData(guidLow); if (!slave) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow); + sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", guidLow); error = true; break; } @@ -1317,7 +1317,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* master = GetCreatureData(linkedGuidLow); if (!master) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", linkedGuidLow); error = true; break; } @@ -1325,14 +1325,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1348,8 +1348,8 @@ void ObjectMgr::LoadLinkedRespawn() } while (result->NextRow()); - sLog->outString(">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); + } bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) @@ -1374,13 +1374,13 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); return false; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); return false; } @@ -1408,8 +1408,8 @@ void ObjectMgr::LoadCreatures() if (!result) { - sLog->outErrorDb(">> Loaded 0 creatures. DB table `creature` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures. DB table `creature` is empty."); + return; } @@ -1433,7 +1433,7 @@ void ObjectMgr::LoadCreatures() CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) { - sLog->outErrorDb("Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry); + sLog->outError(LOG_FILTER_SQL, "Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry); continue; } @@ -1463,19 +1463,19 @@ void ObjectMgr::LoadCreatures() MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid); + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid); continue; } if (data.spawnMask & ~spawnMasks[data.mapid]) - sLog->outErrorDb("Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid); + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid); bool ok = true; for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff) { if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end()) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.", + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.", guid, diff + 1, data.id); ok = false; } @@ -1488,7 +1488,7 @@ void ObjectMgr::LoadCreatures() { if (!GetEquipmentInfo(data.equipmentId)) { - sLog->outErrorDb("Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId); + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId); data.equipmentId = -1; } } @@ -1496,19 +1496,19 @@ void ObjectMgr::LoadCreatures() if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) { if (!mapEntry || !mapEntry->IsDungeon()) - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id); + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id); } if (data.spawndist < 0.0f) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id); + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id); data.spawndist = 0.0f; } else if (data.movementType == RANDOM_MOTION_TYPE) { if (data.spawndist == 0.0f) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id); + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id); data.movementType = IDLE_MOTION_TYPE; } } @@ -1516,14 +1516,14 @@ void ObjectMgr::LoadCreatures() { if (data.spawndist != 0.0f) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id); + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id); data.spawndist = 0.0f; } } if (data.phaseMask == 0) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); + sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); data.phaseMask = 1; } @@ -1535,8 +1535,8 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); - sLog->outString(">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) @@ -1606,7 +1606,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float GameObject* go = new GameObject; if (!go->LoadGameObjectFromDB(guid, map)) { - sLog->outError("AddGOData: cannot add gameobject entry %u to map", entry); + sLog->outError(LOG_FILTER_GENERAL, "AddGOData: cannot add gameobject entry %u to map", entry); delete go; return 0; } @@ -1641,7 +1641,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos) Creature* creature = new Creature; if (!creature->LoadCreatureFromDB(guid, map)) { - sLog->outError("AddCreature: cannot add creature entry %u to map", guid); + sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", guid); delete creature; return false; } @@ -1693,7 +1693,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float Creature* creature = new Creature; if (!creature->LoadCreatureFromDB(guid, map)) { - sLog->outError("AddCreature: cannot add creature entry %u to map", entry); + sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", entry); delete creature; return 0; } @@ -1718,8 +1718,8 @@ void ObjectMgr::LoadGameobjects() if (!result) { - sLog->outErrorDb(">> Loaded 0 gameobjects. DB table `gameobject` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty."); + return; } @@ -1742,7 +1742,7 @@ void ObjectMgr::LoadGameobjects() GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry); if (!gInfo) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry); continue; } @@ -1754,14 +1754,14 @@ void ObjectMgr::LoadGameobjects() case GAMEOBJECT_TYPE_SPELL_FOCUS: break; default: - sLog->outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); + sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); break; } } if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) { - sLog->outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); + sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); continue; } @@ -1782,13 +1782,13 @@ void ObjectMgr::LoadGameobjects() MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid); continue; } if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction()) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id); } data.animprogress = fields[12].GetUInt8(); @@ -1797,7 +1797,7 @@ void ObjectMgr::LoadGameobjects() uint32 go_state = fields[13].GetUInt8(); if (go_state >= MAX_GO_STATE) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state); continue; } data.go_state = GOState(go_state); @@ -1805,7 +1805,7 @@ void ObjectMgr::LoadGameobjects() data.spawnMask = fields[14].GetUInt8(); if (data.spawnMask & ~spawnMasks[data.mapid]) - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid); data.phaseMask = fields[15].GetUInt16(); int16 gameEvent = fields[16].GetInt8(); @@ -1813,25 +1813,25 @@ void ObjectMgr::LoadGameobjects() if (data.rotation2 < -1.0f || data.rotation2 > 1.0f) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2); continue; } if (data.rotation3 < -1.0f || data.rotation3 > 1.0f) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3); continue; } if (!MapManager::IsValidMapCoord(data.mapid, data.posX, data.posY, data.posZ, data.orientation)) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id); continue; } if (data.phaseMask == 0) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); data.phaseMask = 1; } @@ -1840,8 +1840,8 @@ void ObjectMgr::LoadGameobjects() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) @@ -2009,8 +2009,8 @@ void ObjectMgr::LoadItemLocales() } } while (result->NextRow()); - sLog->outString(">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadItemTemplates() @@ -2052,8 +2052,8 @@ void ObjectMgr::LoadItemTemplates() if (!result) { - sLog->outString(">> Loaded 0 item templates. DB table `item_template` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item templates. DB table `item_template` is empty."); + return; } @@ -2183,61 +2183,61 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Class != dbcitem->Class) { - sLog->outErrorDb("Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class); if (enforceDBCAttributes) itemTemplate.Class = dbcitem->Class; } if (itemTemplate.Unk0 != dbcitem->Unk0) { - sLog->outErrorDb("Item (Entry: %u) does not have a correct Unk0 (%i), must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct Unk0 (%i), must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0); if (enforceDBCAttributes) itemTemplate.Unk0 = dbcitem->Unk0; } if (itemTemplate.Material != dbcitem->Material) { - sLog->outErrorDb("Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material); if (enforceDBCAttributes) itemTemplate.Material = dbcitem->Material; } if (itemTemplate.InventoryType != dbcitem->InventoryType) { - sLog->outErrorDb("Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType); if (enforceDBCAttributes) itemTemplate.InventoryType = dbcitem->InventoryType; } if (itemTemplate.DisplayInfoID != dbcitem->DisplayId) { - sLog->outErrorDb("Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId); if (enforceDBCAttributes) itemTemplate.DisplayInfoID = dbcitem->DisplayId; } if (itemTemplate.Sheath != dbcitem->Sheath) { - sLog->outErrorDb("Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath); if (enforceDBCAttributes) itemTemplate.Sheath = dbcitem->Sheath; } } else - sLog->outErrorDb("Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry); if (itemTemplate.Class >= MAX_ITEM_CLASS) { - sLog->outErrorDb("Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class); itemTemplate.Class = ITEM_CLASS_MISC; } if (itemTemplate.SubClass >= MaxItemSubclassValues[itemTemplate.Class]) { - sLog->outErrorDb("Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class); itemTemplate.SubClass = 0;// exist for all item classes } if (itemTemplate.Quality >= MAX_ITEM_QUALITY) { - sLog->outErrorDb("Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality); itemTemplate.Quality = ITEM_QUALITY_NORMAL; } @@ -2245,36 +2245,36 @@ void ObjectMgr::LoadItemTemplates() { if (FactionEntry const* faction = sFactionStore.LookupEntry(HORDE)) if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY); if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY); } else if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) { if (FactionEntry const* faction = sFactionStore.LookupEntry(ALLIANCE)) if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY); } if (itemTemplate.BuyCount <= 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount); itemTemplate.BuyCount = 1; } if (itemTemplate.InventoryType >= MAX_INVTYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType); itemTemplate.InventoryType = INVTYPE_NON_EQUIP; } if (itemTemplate.RequiredSkill >= MAX_SKILL_TYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill); itemTemplate.RequiredSkill = 0; } @@ -2294,60 +2294,60 @@ void ObjectMgr::LoadItemTemplates() if (req) { if (!(itemTemplate.AllowableClass & CLASSMASK_ALL_PLAYABLE)) - sLog->outErrorDb("Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass); if (!(itemTemplate.AllowableRace & RACEMASK_ALL_PLAYABLE)) - sLog->outErrorDb("Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace); } } if (itemTemplate.RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate.RequiredSpell)) { - sLog->outErrorDb("Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell); itemTemplate.RequiredSpell = 0; } if (itemTemplate.RequiredReputationRank >= MAX_REPUTATION_RANK) - sLog->outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank); if (itemTemplate.RequiredReputationFaction) { if (!sFactionStore.LookupEntry(itemTemplate.RequiredReputationFaction)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction); itemTemplate.RequiredReputationFaction = 0; } if (itemTemplate.RequiredReputationRank == MIN_REPUTATION_RANK) - sLog->outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry); } if (itemTemplate.MaxCount < -1) { - sLog->outErrorDb("Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount); itemTemplate.MaxCount = -1; } if (itemTemplate.Stackable == 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable); itemTemplate.Stackable = 1; } else if (itemTemplate.Stackable < -1) { - sLog->outErrorDb("Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable); itemTemplate.Stackable = -1; } if (itemTemplate.ContainerSlots > MAX_BAG_SIZE) { - sLog->outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE); itemTemplate.ContainerSlots = MAX_BAG_SIZE; } if (itemTemplate.StatsCount > MAX_ITEM_PROTO_STATS) { - sLog->outErrorDb("Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS); itemTemplate.StatsCount = MAX_ITEM_PROTO_STATS; } @@ -2356,7 +2356,7 @@ void ObjectMgr::LoadItemTemplates() // for ItemStatValue != 0 if (itemTemplate.ItemStat[j].ItemStatValue && itemTemplate.ItemStat[j].ItemStatType >= MAX_ITEM_MOD) { - sLog->outErrorDb("Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); itemTemplate.ItemStat[j].ItemStatType = 0; } @@ -2364,7 +2364,7 @@ void ObjectMgr::LoadItemTemplates() { case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_DAMAGE_DONE: - sLog->outErrorDb("Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); break; default: break; @@ -2375,7 +2375,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Damage[j].DamageType >= MAX_SPELL_SCHOOL) { - sLog->outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType); itemTemplate.Damage[j].DamageType = 0; } } @@ -2386,7 +2386,7 @@ void ObjectMgr::LoadItemTemplates() // spell_1 if (itemTemplate.Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; itemTemplate.Spells[1].SpellId = 0; @@ -2396,14 +2396,14 @@ void ObjectMgr::LoadItemTemplates() // spell_2 have learning spell if (itemTemplate.Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (!itemTemplate.Spells[1].SpellId) { - sLog->outErrorDb("Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2412,7 +2412,7 @@ void ObjectMgr::LoadItemTemplates() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2420,7 +2420,7 @@ void ObjectMgr::LoadItemTemplates() // allowed only in special format else if ((itemTemplate.Spells[1].SpellId == 483) || (itemTemplate.Spells[1].SpellId == 55884)) { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2432,13 +2432,13 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); itemTemplate.Spells[j].SpellId = 0; itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (itemTemplate.Spells[j].SpellId != 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } } @@ -2450,7 +2450,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate.Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); itemTemplate.Spells[j].SpellId = 0; itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2460,13 +2460,13 @@ void ObjectMgr::LoadItemTemplates() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } // allowed only in special format else if ((itemTemplate.Spells[j].SpellId == 483) || (itemTemplate.Spells[j].SpellId == 55884)) { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } } @@ -2474,17 +2474,17 @@ void ObjectMgr::LoadItemTemplates() } if (itemTemplate.Bonding >= MAX_BIND_TYPE) - sLog->outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding); if (itemTemplate.PageText && !GetPageText(itemTemplate.PageText)) - sLog->outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText); if (itemTemplate.LockID && !sLockStore.LookupEntry(itemTemplate.LockID)) - sLog->outErrorDb("Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID); if (itemTemplate.Sheath >= MAX_SHEATHETYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath); itemTemplate.Sheath = SHEATHETYPE_NONE; } @@ -2496,28 +2496,28 @@ void ObjectMgr::LoadItemTemplates() else if (!sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomProperty))) { - sLog->outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty); itemTemplate.RandomProperty = 0; } } if (itemTemplate.RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomSuffix))) { - sLog->outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix); itemTemplate.RandomSuffix = 0; } if (itemTemplate.ItemSet && !sItemSetStore.LookupEntry(itemTemplate.ItemSet)) { - sLog->outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet); itemTemplate.ItemSet = 0; } if (itemTemplate.Area && !GetAreaEntryByAreaID(itemTemplate.Area)) - sLog->outErrorDb("Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area); if (itemTemplate.Map && !sMapStore.LookupEntry(itemTemplate.Map)) - sLog->outErrorDb("Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map); if (itemTemplate.BagFamily) { @@ -2531,7 +2531,7 @@ void ObjectMgr::LoadItemTemplates() ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j+1); if (!bf) { - sLog->outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); itemTemplate.BagFamily &= ~mask; continue; } @@ -2541,7 +2541,7 @@ void ObjectMgr::LoadItemTemplates() CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemTemplate.ItemId); if (!ctEntry) { - sLog->outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry); itemTemplate.BagFamily &= ~mask; } } @@ -2549,41 +2549,41 @@ void ObjectMgr::LoadItemTemplates() } if (itemTemplate.TotemCategory && !sTotemCategoryStore.LookupEntry(itemTemplate.TotemCategory)) - sLog->outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory); for (uint8 j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j) { if (itemTemplate.Socket[j].Color && (itemTemplate.Socket[j].Color & SOCKET_COLOR_ALL) != itemTemplate.Socket[j].Color) { - sLog->outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color); itemTemplate.Socket[j].Color = 0; } } if (itemTemplate.GemProperties && !sGemPropertiesStore.LookupEntry(itemTemplate.GemProperties)) - sLog->outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties); if (itemTemplate.FoodType >= MAX_PET_DIET) { - sLog->outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType); itemTemplate.FoodType = 0; } if (itemTemplate.ItemLimitCategory && !sItemLimitCategoryStore.LookupEntry(itemTemplate.ItemLimitCategory)) { - sLog->outErrorDb("Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory); itemTemplate.ItemLimitCategory = 0; } if (itemTemplate.HolidayId && !sHolidaysStore.LookupEntry(itemTemplate.HolidayId)) { - sLog->outErrorDb("Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId); itemTemplate.HolidayId = 0; } if (itemTemplate.FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate.Duration) { - sLog->outErrorDb("Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); + sLog->outError(LOG_FILTER_SQL, "Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); itemTemplate.FlagsCu &= ~ITEM_FLAGS_CU_DURATION_REAL_TIME; } @@ -2612,10 +2612,10 @@ void ObjectMgr::LoadItemTemplates() } for (std::set::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr) - sLog->outErrorDb("Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); + sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); - sLog->outString(">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) @@ -2650,8 +2650,8 @@ void ObjectMgr::LoadItemSetNameLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name); } while (result->NextRow()); - sLog->outString(">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadItemSetNames() @@ -2679,8 +2679,8 @@ void ObjectMgr::LoadItemSetNames() if (!result) { - sLog->outString(">> Loaded 0 item set names. DB table `item_set_names` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); + return; } @@ -2694,7 +2694,7 @@ void ObjectMgr::LoadItemSetNames() uint32 entry = fields[0].GetUInt32(); if (itemSetItems.find(entry) == itemSetItems.end()) { - sLog->outErrorDb("Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry); + sLog->outError(LOG_FILTER_SQL, "Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry); continue; } @@ -2704,7 +2704,7 @@ void ObjectMgr::LoadItemSetNames() uint32 invType = fields[2].GetUInt8(); if (invType >= MAX_INVTYPE) { - sLog->outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType); + sLog->outError(LOG_FILTER_SQL, "Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType); invType = INVTYPE_NON_EQUIP; } @@ -2723,19 +2723,19 @@ void ObjectMgr::LoadItemSetNames() pProto = sObjectMgr->GetItemTemplate(entry); if (pProto) { - sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry); + sLog->outError(LOG_FILTER_SQL, "Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry); ItemSetNameEntry &data = _itemSetNameStore[entry]; data.name = pProto->Name1; data.InventoryType = pProto->InventoryType; ++count; } else - sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry); + sLog->outError(LOG_FILTER_SQL, "Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry); } } - sLog->outString(">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadVehicleTemplateAccessories() @@ -2751,8 +2751,8 @@ void ObjectMgr::LoadVehicleTemplateAccessories() if (!result) { - sLog->outErrorDb(">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); + return; } @@ -2769,19 +2769,19 @@ void ObjectMgr::LoadVehicleTemplateAccessories() if (!sObjectMgr->GetCreatureTemplate(uiEntry)) { - sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry); + sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry); continue; } if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) { - sLog->outErrorDb("Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory); + sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory); continue; } if (_spellClickInfoStore.find(uiEntry) == _spellClickInfoStore.end()) { - sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry); + sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry); continue; } @@ -2791,8 +2791,8 @@ void ObjectMgr::LoadVehicleTemplateAccessories() } while (result->NextRow()); - sLog->outString(">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadVehicleAccessories() @@ -2808,8 +2808,8 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { - sLog->outString(">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); + return; } @@ -2826,7 +2826,7 @@ void ObjectMgr::LoadVehicleAccessories() if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) { - sLog->outErrorDb("Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory); + sLog->outError(LOG_FILTER_SQL, "Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory); continue; } @@ -2836,8 +2836,8 @@ void ObjectMgr::LoadVehicleAccessories() } while (result->NextRow()); - sLog->outString(">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadPetLevelInfo() @@ -2849,8 +2849,8 @@ void ObjectMgr::LoadPetLevelInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); + return; } @@ -2863,7 +2863,7 @@ void ObjectMgr::LoadPetLevelInfo() uint32 creature_id = fields[0].GetUInt32(); if (!sObjectMgr->GetCreatureTemplate(creature_id)) { - sLog->outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id); + sLog->outError(LOG_FILTER_SQL, "Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id); continue; } @@ -2871,17 +2871,17 @@ void ObjectMgr::LoadPetLevelInfo() if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog->outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); + sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { - sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level); + sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } continue; } else if (current_level < 1) { - sLog->outErrorDb("Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level); + sLog->outError(LOG_FILTER_SQL, "Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level); continue; } @@ -2914,7 +2914,7 @@ void ObjectMgr::LoadPetLevelInfo() // fatal error if no level 1 data if (!pInfo || pInfo[0].health == 0) { - sLog->outErrorDb("Creature %u does not have pet stats data for Level 1!", itr->first); + sLog->outError(LOG_FILTER_SQL, "Creature %u does not have pet stats data for Level 1!", itr->first); exit(1); } @@ -2923,14 +2923,14 @@ void ObjectMgr::LoadPetLevelInfo() { if (pInfo[level].health == 0) { - sLog->outErrorDb("Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level+1, level); + sLog->outError(LOG_FILTER_SQL, "Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level+1, level); pInfo[level] = pInfo[level-1]; } } } - sLog->outString(">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const @@ -2952,7 +2952,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3 else { if (count < -1) - sLog->outErrorDb("Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId); + sLog->outError(LOG_FILTER_SQL, "Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId); uint32 RaceClass = (race_) | (class_ << 8); bool doneOne = false; @@ -2974,7 +2974,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3 } if (!found) - sLog->outErrorDb("Item %u specified to be removed from original create info not found in dbc!", itemId); + sLog->outError(LOG_FILTER_SQL, "Item %u specified to be removed from original create info not found in dbc!", itemId); if (!doneOne) doneOne = true; @@ -2996,8 +2996,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outString(); - sLog->outErrorDb(">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty."); + + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty."); exit(1); } else @@ -3019,39 +3019,39 @@ void ObjectMgr::LoadPlayerInfo() if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race); + sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo` table, ignoring.", current_race); continue; } ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race); + sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo` table, ignoring.", current_race); continue; } if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class); + sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo` table, ignoring.", current_class); continue; } if (!sChrClassesStore.LookupEntry(current_class)) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class); + sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo` table, ignoring.", current_class); continue; } // accept DB data only for valid position (and non instanceable) if (!MapManager::IsValidMapCoord(mapId, positionX, positionY, positionZ, orientation)) { - sLog->outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); + sLog->outError(LOG_FILTER_SQL, "Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); continue; } if (sMapStore.LookupEntry(mapId)->Instanceable()) { - sLog->outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); + sLog->outError(LOG_FILTER_SQL, "Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); continue; } @@ -3071,13 +3071,13 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outString(">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // Load playercreate items - sLog->outString("Loading Player Create Items Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Items Data..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 @@ -3085,8 +3085,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outString(">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); + } else { @@ -3099,14 +3099,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); + sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); + sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); continue; } @@ -3114,7 +3114,7 @@ void ObjectMgr::LoadPlayerInfo() if (!GetItemTemplate(item_id)) { - sLog->outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class); + sLog->outError(LOG_FILTER_SQL, "Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class); continue; } @@ -3122,7 +3122,7 @@ void ObjectMgr::LoadPlayerInfo() if (!amount) { - sLog->outErrorDb("Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class); + sLog->outError(LOG_FILTER_SQL, "Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class); continue; } @@ -3143,13 +3143,13 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outString(">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // Load playercreate spells - sLog->outString("Loading Player Create Spell Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Spell Data..."); { uint32 oldMSTime = getMSTime(); @@ -3158,8 +3158,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); + } else { @@ -3172,14 +3172,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race); + sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class); + sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class); continue; } @@ -3200,13 +3200,13 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outString(">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // Load playercreate actions - sLog->outString("Loading Player Create Action Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Action Data..."); { uint32 oldMSTime = getMSTime(); @@ -3215,8 +3215,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); + } else { @@ -3229,14 +3229,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); + sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); + sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); continue; } @@ -3247,13 +3247,13 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outString(">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // Loading levels data (class only dependent) - sLog->outString("Loading Player Create Level HP/Mana Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level HP/Mana Data..."); { uint32 oldMSTime = getMSTime(); @@ -3262,8 +3262,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty."); + exit(1); } @@ -3276,14 +3276,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_class = fields[0].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `player_classlevelstats` table, ignoring.", current_class); + sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `player_classlevelstats` table, ignoring.", current_class); continue; } uint8 current_level = fields[1].GetUInt8(); // Can't be > than STRONG_MAX_LEVEL (hardcoded level maximum) due to var type if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { - sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level); + sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. continue; } @@ -3314,7 +3314,7 @@ void ObjectMgr::LoadPlayerInfo() // fatal error if no level 1 data if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0) { - sLog->outErrorDb("Class %i Level 1 does not have health/mana data!", class_); + sLog->outError(LOG_FILTER_SQL, "Class %i Level 1 does not have health/mana data!", class_); exit(1); } @@ -3323,18 +3323,18 @@ void ObjectMgr::LoadPlayerInfo() { if (pClassInfo->levelInfo[level].basehealth == 0) { - sLog->outErrorDb("Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level+1, level); + sLog->outError(LOG_FILTER_SQL, "Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level+1, level); pClassInfo->levelInfo[level] = pClassInfo->levelInfo[level-1]; } } } - sLog->outString(">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } // Loading levels data (class/race dependent) - sLog->outString("Loading Player Create Level Stats Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level Stats Data..."); { uint32 oldMSTime = getMSTime(); @@ -3343,8 +3343,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); + exit(1); } @@ -3357,14 +3357,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race); + sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `player_levelstats` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class); + sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `player_levelstats` table, ignoring.", current_class); continue; } @@ -3372,10 +3372,10 @@ void ObjectMgr::LoadPlayerInfo() if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog->outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); + sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { - sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level); + sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } continue; @@ -3427,7 +3427,7 @@ void ObjectMgr::LoadPlayerInfo() // fatal error if no level 1 data if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0) { - sLog->outErrorDb("Race %i Class %i Level 1 does not have stats data!", race, class_); + sLog->outError(LOG_FILTER_SQL, "Race %i Class %i Level 1 does not have stats data!", race, class_); exit(1); } @@ -3436,19 +3436,19 @@ void ObjectMgr::LoadPlayerInfo() { if (pInfo->levelInfo[level].stats[0] == 0) { - sLog->outErrorDb("Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level+1, level); + sLog->outError(LOG_FILTER_SQL, "Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level+1, level); pInfo->levelInfo[level] = pInfo->levelInfo[level-1]; } } } } - sLog->outString(">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } // Loading xp per level data - sLog->outString("Loading Player Create XP Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create XP Data..."); { uint32 oldMSTime = getMSTime(); @@ -3461,8 +3461,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); + exit(1); } @@ -3478,10 +3478,10 @@ void ObjectMgr::LoadPlayerInfo() if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog->outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); + sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { - sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level); + sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } continue; @@ -3497,13 +3497,13 @@ void ObjectMgr::LoadPlayerInfo() { if (_playerXPperLevel[level] == 0) { - sLog->outErrorDb("Level %i does not have XP for level data. Using data of level [%i] + 100.", level+1, level); + sLog->outError(LOG_FILTER_SQL, "Level %i does not have XP for level data. Using data of level [%i] + 100.", level+1, level); _playerXPperLevel[level] = _playerXPperLevel[level-1]+100; } } - sLog->outString(">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } @@ -3660,8 +3660,8 @@ void ObjectMgr::LoadQuests() " FROM quest_template"); if (!result) { - sLog->outErrorDb(">> Loaded 0 quests definitions. DB table `quest_template` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quests definitions. DB table `quest_template` is empty."); + return; } @@ -3690,18 +3690,18 @@ void ObjectMgr::LoadQuests() // additional quest integrity checks (GO, creature_template and item_template must be loaded already) if (qinfo->GetQuestMethod() >= 3) - sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); + sLog->outError(LOG_FILTER_SQL, "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); if (qinfo->Flags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED) { - sLog->outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", qinfo->GetQuestId(), qinfo->Flags >> 20, QUEST_TRINITY_FLAGS_DB_ALLOWED >> 20); qinfo->Flags &= QUEST_TRINITY_FLAGS_DB_ALLOWED; } if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY) { - sLog->outErrorDb("Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId()); + sLog->outError(LOG_FILTER_SQL, "Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId()); qinfo->Flags &= ~QUEST_FLAGS_DAILY; } @@ -3709,7 +3709,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE)) { - sLog->outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); + sLog->outError(LOG_FILTER_SQL, "Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE; } } @@ -3718,7 +3718,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE)) { - sLog->outErrorDb("Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); + sLog->outError(LOG_FILTER_SQL, "Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE; } } @@ -3730,7 +3730,7 @@ void ObjectMgr::LoadQuests() { if (uint32 id = qinfo->RewardChoiceItemId[j]) { - sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest ignore this data } @@ -3742,7 +3742,7 @@ void ObjectMgr::LoadQuests() { if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort)) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client } @@ -3753,7 +3753,7 @@ void ObjectMgr::LoadQuests() QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort)); if (!qSort) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } @@ -3762,7 +3762,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredSkillId != skill_id) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); //override, and force proper value here? } @@ -3774,7 +3774,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses); + sLog->outError(LOG_FILTER_SQL, "Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses); qinfo->RequiredClasses = 0; } } @@ -3783,7 +3783,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->RequiredRaces & RACEMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces); + sLog->outError(LOG_FILTER_SQL, "Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces); qinfo->RequiredRaces = 0; } } @@ -3792,7 +3792,7 @@ void ObjectMgr::LoadQuests() { if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId)) { - sLog->outErrorDb("Quest %u has `RequiredSkillId` = %u but this skill does not exist", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSkillId` = %u but this skill does not exist", qinfo->GetQuestId(), qinfo->RequiredSkillId); } } @@ -3801,7 +3801,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue()) { - sLog->outErrorDb("Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue()); // no changes, quest can't be done for this requirement } @@ -3810,77 +3810,77 @@ void ObjectMgr::LoadQuests() if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2)) { - sLog->outErrorDb("Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2); // no changes, quest can't be done for this requirement } if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1)) { - sLog->outErrorDb("Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction)) { - sLog->outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction)) { - sLog->outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap) { - sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMinRepValue, ReputationMgr::Reputation_Cap); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue) { - sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue); // no changes, quest can't be done for this requirement } if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0) { - sLog->outErrorDb("Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredFactionValue1); // warning } if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0) { - sLog->outErrorDb("Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredFactionValue2); // warning } if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0) { - sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredMinRepValue); // warning } if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0) { - sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredMaxRepValue); // warning } if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId)) { - sLog->outErrorDb("Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId()); qinfo->RewardTitleId = 0; // quest can't reward this title @@ -3890,20 +3890,20 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(qinfo->SourceItemId)) { - sLog->outErrorDb("Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->SourceItemId, qinfo->SourceItemId); qinfo->SourceItemId = 0; // quest can't be done for this requirement } else if (qinfo->SourceItemIdCount == 0) { - sLog->outErrorDb("Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.", qinfo->GetQuestId(), qinfo->SourceItemId); qinfo->SourceItemIdCount = 1; // update to 1 for allow quest work for backward compatibility with DB } } else if (qinfo->SourceItemIdCount>0) { - sLog->outErrorDb("Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.", qinfo->GetQuestId(), qinfo->SourceItemIdCount); qinfo->SourceItemIdCount=0; // no quest work changes in fact } @@ -3913,13 +3913,13 @@ void ObjectMgr::LoadQuests() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellid); if (!spellInfo) { - sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.", qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); qinfo->SourceSpellid = 0; // quest can't be done for this requirement } else if (!SpellMgr::IsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.", qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); qinfo->SourceSpellid = 0; // quest can't be done for this requirement } @@ -3932,7 +3932,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredItemCount[j] == 0) { - sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can't be done for this requirement } @@ -3941,14 +3941,14 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, id); qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } } else if (qinfo->RequiredItemCount[j]>0) { - sLog->outErrorDb("Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredItemCount[j]); qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } @@ -3961,7 +3961,7 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, id); // no changes, quest can't be done for this requirement } @@ -3970,7 +3970,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredSourceItemCount[j]>0) { - sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.", qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemCount[j]); // no changes, quest ignore this data } @@ -3985,7 +3985,7 @@ void ObjectMgr::LoadQuests() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); if (!spellInfo) { - sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, id); continue; } @@ -4007,7 +4007,7 @@ void ObjectMgr::LoadQuests() { if (!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and RequiredNpcOrGo%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or RequiredNpcOrGo%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->Id, j+1, j+1); + sLog->outError(LOG_FILTER_SQL, "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and RequiredNpcOrGo%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or RequiredNpcOrGo%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->Id, j+1, j+1); // this will prevent quest completing without objective const_cast(qinfo)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); @@ -4015,7 +4015,7 @@ void ObjectMgr::LoadQuests() } else { - sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u and RequiredNpcOrGo%d = 0 but spell %u does not have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT effect for this quest, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `ReqSpellCast%d` = %u and RequiredNpcOrGo%d = 0 but spell %u does not have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT effect for this quest, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1, id); // no changes, quest can't be done for this requirement } @@ -4028,14 +4028,14 @@ void ObjectMgr::LoadQuests() int32 id = qinfo->RequiredNpcOrGo[j]; if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id)) { - sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, uint32(-id)); qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } if (id > 0 && !sObjectMgr->GetCreatureTemplate(id)) { - sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, uint32(id)); qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } @@ -4048,14 +4048,14 @@ void ObjectMgr::LoadQuests() if (!qinfo->RequiredNpcOrGoCount[j]) { - sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can be incorrectly done, but we already report this } } else if (qinfo->RequiredNpcOrGoCount[j]>0) { - sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.", qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredNpcOrGoCount[j]); // no changes, quest ignore this data } @@ -4068,21 +4068,21 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, id); qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this } if (!qinfo->RewardChoiceItemCount[j]) { - sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can't be done } } else if (qinfo->RewardChoiceItemCount[j]>0) { - sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.", qinfo->GetQuestId(), j+1, j+1, qinfo->RewardChoiceItemCount[j]); // no changes, quest ignore this data } @@ -4095,21 +4095,21 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, id); qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item } if (!qinfo->RewardItemIdCount[j]) { - sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, j+1); // no changes } } else if (qinfo->RewardItemIdCount[j]>0) { - sLog->outErrorDb("Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.", qinfo->GetQuestId(), j+1, j+1, qinfo->RewardItemIdCount[j]); // no changes, quest ignore this data } @@ -4121,18 +4121,18 @@ void ObjectMgr::LoadQuests() { if (abs(qinfo->RewardFactionValueId[j]) > 9) { - sLog->outErrorDb("Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]); + sLog->outError(LOG_FILTER_SQL, "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]); } if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j])) { - sLog->outErrorDb("Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); qinfo->RewardFactionId[j] = 0; // quest will not reward this } } else if (qinfo->RewardFactionValueIdOverride[j] != 0) { - sLog->outErrorDb("Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.", qinfo->GetQuestId(), j+1, j+1, qinfo->RewardFactionValueIdOverride[j]); // no changes, quest ignore this data } @@ -4144,21 +4144,21 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { - sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell reward will display for this quest } else if (!SpellMgr::IsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell reward will display for this quest } else if (GetTalentSpellCost(qinfo->RewardSpell)) { - sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell reward will display for this quest } @@ -4170,21 +4170,21 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { - sLog->outErrorDb("Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); qinfo->RewardSpellCast = 0; // no spell will be casted on player } else if (!SpellMgr::IsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); qinfo->RewardSpellCast = 0; // no spell will be casted on player } else if (GetTalentSpellCost(qinfo->RewardSpellCast)) { - sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); qinfo->RewardSpellCast = 0; // no spell will be casted on player } @@ -4194,7 +4194,7 @@ void ObjectMgr::LoadQuests() { if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId)) { - sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId); qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player @@ -4202,7 +4202,7 @@ void ObjectMgr::LoadQuests() else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end()) { std::map::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId); - sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second); qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player @@ -4216,7 +4216,7 @@ void ObjectMgr::LoadQuests() QuestMap::iterator qNextItr = _questTemplates.find(qinfo->NextQuestIdChain); if (qNextItr == _questTemplates.end()) { - sLog->outErrorDb("Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.", + sLog->outError(LOG_FILTER_SQL, "Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.", qinfo->GetQuestId(), qinfo->NextQuestIdChain, qinfo->NextQuestIdChain); qinfo->NextQuestIdChain = 0; } @@ -4229,7 +4229,7 @@ void ObjectMgr::LoadQuests() { if (_questTemplates.find(abs(qinfo->GetPrevQuestId())) == _questTemplates.end()) { - sLog->outErrorDb("Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId()); + sLog->outError(LOG_FILTER_SQL, "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId()); } else { @@ -4242,7 +4242,7 @@ void ObjectMgr::LoadQuests() QuestMap::iterator qNextItr = _questTemplates.find(abs(qinfo->GetNextQuestId())); if (qNextItr == _questTemplates.end()) { - sLog->outErrorDb("Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId()); + sLog->outError(LOG_FILTER_SQL, "Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId()); } else { @@ -4281,7 +4281,7 @@ void ObjectMgr::LoadQuests() if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id); + sLog->outError(LOG_FILTER_SQL, "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id); // this will prevent quest completing without objective const_cast(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); @@ -4289,8 +4289,8 @@ void ObjectMgr::LoadQuests() } } - sLog->outString(">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadQuestLocales() @@ -4338,8 +4338,8 @@ void ObjectMgr::LoadQuestLocales() } } while (result->NextRow()); - sLog->outString(">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadScripts(ScriptsType type) @@ -4357,7 +4357,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use. return; - sLog->outString("Loading %s...", tableName.c_str()); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading %s...", tableName.c_str()); scripts->clear(); // need for reload support @@ -4367,8 +4367,8 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { - sLog->outString(">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); + return; } @@ -4399,19 +4399,19 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (tmp.Talk.ChatType > CHAT_TYPE_WHISPER && tmp.Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER) { - sLog->outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", tableName.c_str(), tmp.Talk.ChatType, tmp.id); continue; } if (!tmp.Talk.TextID) { - sLog->outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", tableName.c_str(), tmp.Talk.TextID, tmp.id); continue; } if (tmp.Talk.TextID < MIN_DB_SCRIPT_STRING_ID || tmp.Talk.TextID >= MAX_DB_SCRIPT_STRING_ID) { - sLog->outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", tableName.c_str(), tmp.Talk.TextID, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id); continue; } @@ -4423,7 +4423,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sEmotesStore.LookupEntry(tmp.Emote.EmoteID)) { - sLog->outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tableName.c_str(), tmp.Emote.EmoteID, tmp.id); continue; } @@ -4434,14 +4434,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sMapStore.LookupEntry(tmp.TeleportTo.MapID)) { - sLog->outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tableName.c_str(), tmp.TeleportTo.MapID, tmp.id); continue; } if (!Trinity::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation)) { - sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id); continue; } @@ -4453,14 +4453,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) Quest const* quest = GetQuestTemplate(tmp.QuestExplored.QuestID); if (!quest) { - sLog->outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); continue; } if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); // this will prevent quest completing without objective @@ -4471,21 +4471,21 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE) { - sLog->outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id); continue; } if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE) { - sLog->outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE); continue; } if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) < INTERACTION_DISTANCE) { - sLog->outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, INTERACTION_DISTANCE); continue; } @@ -4497,7 +4497,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!GetCreatureTemplate(tmp.KillCredit.CreatureEntry)) { - sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", tableName.c_str(), tmp.KillCredit.CreatureEntry, tmp.id); continue; } @@ -4509,7 +4509,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid); if (!data) { - sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), tmp.RespawnGameobject.GOGuid, tmp.id); continue; } @@ -4517,7 +4517,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectTemplate const* info = GetGameObjectTemplate(data->id); if (!info) { - sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), tmp.RespawnGameobject.GOGuid, data->id, tmp.id); continue; } @@ -4528,7 +4528,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) info->type == GAMEOBJECT_TYPE_BUTTON || info->type == GAMEOBJECT_TYPE_TRAP) { - sLog->outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), info->entry, tmp.id); continue; } @@ -4539,14 +4539,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!Trinity::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation)) { - sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id); continue; } if (!GetCreatureTemplate(tmp.TempSummonCreature.CreatureEntry)) { - sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tableName.c_str(), tmp.TempSummonCreature.CreatureEntry, tmp.id); continue; } @@ -4559,7 +4559,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid); if (!data) { - sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", tableName.c_str(), tmp.ToggleDoor.GOGuid, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } @@ -4567,14 +4567,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectTemplate const* info = GetGameObjectTemplate(data->id); if (!info) { - sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", tableName.c_str(), tmp.ToggleDoor.GOGuid, data->id, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } if (info->type != GAMEOBJECT_TYPE_DOOR) { - sLog->outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject type (%u) non supported by command %s for script id %u", tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } @@ -4586,13 +4586,13 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID)) { - sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id); continue; } if (tmp.RemoveAura.Flags & ~0x1) // 1 bits (0, 1) { - sLog->outErrorDb("Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", tableName.c_str(), tmp.RemoveAura.Flags, tmp.id); continue; } @@ -4603,25 +4603,25 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID)) { - sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.SpellID, tmp.id); continue; } if (tmp.CastSpell.Flags > 4) // targeting type { - sLog->outErrorDb("Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.Flags, tmp.id); continue; } if (tmp.CastSpell.Flags != 4 && tmp.CastSpell.CreatureEntry & ~0x1) // 1 bit (0, 1) { - sLog->outErrorDb("Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); continue; } else if (tmp.CastSpell.Flags == 4 && !GetCreatureTemplate(tmp.CastSpell.CreatureEntry)) { - sLog->outErrorDb("Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); continue; } @@ -4632,13 +4632,13 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!GetItemTemplate(tmp.CreateItem.ItemEntry)) { - sLog->outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", tableName.c_str(), tmp.CreateItem.ItemEntry, tmp.id); continue; } if (!tmp.CreateItem.Amount) { - sLog->outErrorDb("Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u", + sLog->outError(LOG_FILTER_SQL, "Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u", tableName.c_str(), tmp.CreateItem.Amount, tmp.id); continue; } @@ -4659,8 +4659,8 @@ void ObjectMgr::LoadScripts(ScriptsType type) } while (result->NextRow()); - sLog->outString(">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadGameObjectScripts() @@ -4671,7 +4671,7 @@ void ObjectMgr::LoadGameObjectScripts() for (ScriptMapMap::const_iterator itr = sGameObjectScripts.begin(); itr != sGameObjectScripts.end(); ++itr) { if (!GetGOData(itr->first)) - sLog->outErrorDb("Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id", itr->first); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id", itr->first); } } @@ -4683,7 +4683,7 @@ void ObjectMgr::LoadQuestEndScripts() for (ScriptMapMap::const_iterator itr = sQuestEndScripts.begin(); itr != sQuestEndScripts.end(); ++itr) { if (!GetQuestTemplate(itr->first)) - sLog->outErrorDb("Table `quest_end_scripts` has not existing quest (Id: %u) as script id", itr->first); + sLog->outError(LOG_FILTER_SQL, "Table `quest_end_scripts` has not existing quest (Id: %u) as script id", itr->first); } } @@ -4695,7 +4695,7 @@ void ObjectMgr::LoadQuestStartScripts() for (ScriptMapMap::const_iterator itr = sQuestStartScripts.begin(); itr != sQuestStartScripts.end(); ++itr) { if (!GetQuestTemplate(itr->first)) - sLog->outErrorDb("Table `quest_start_scripts` has not existing quest (Id: %u) as script id", itr->first); + sLog->outError(LOG_FILTER_SQL, "Table `quest_start_scripts` has not existing quest (Id: %u) as script id", itr->first); } } @@ -4711,14 +4711,14 @@ void ObjectMgr::LoadSpellScripts() if (!spellInfo) { - sLog->outErrorDb("Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId); + sLog->outError(LOG_FILTER_SQL, "Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId); continue; } uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF); //check for correct spellEffect if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY)) - sLog->outErrorDb("Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i); + sLog->outError(LOG_FILTER_SQL, "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i); } } @@ -4760,7 +4760,7 @@ void ObjectMgr::LoadEventScripts() { std::set::const_iterator itr2 = evt_scripts.find(itr->first); if (itr2 == evt_scripts.end()) - sLog->outErrorDb("Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u", + sLog->outError(LOG_FILTER_SQL, "Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u", itr->first, SPELL_EFFECT_SEND_EVENT); } } @@ -4791,7 +4791,7 @@ void ObjectMgr::LoadWaypointScripts() } for (std::set::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr) - sLog->outErrorDb("There is no waypoint which links to the waypoint script %u", *itr); + sLog->outError(LOG_FILTER_SQL, "There is no waypoint which links to the waypoint script %u", *itr); } void ObjectMgr::LoadSpellScriptNames() @@ -4804,8 +4804,8 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { - sLog->outString(">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); + return; } @@ -4829,7 +4829,7 @@ void ObjectMgr::LoadSpellScriptNames() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32()); + sLog->outError(LOG_FILTER_SQL, "Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32()); continue; } @@ -4837,7 +4837,7 @@ void ObjectMgr::LoadSpellScriptNames() { if (sSpellMgr->GetFirstSpellInChain(spellId) != uint32(spellId)) { - sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32()); + sLog->outError(LOG_FILTER_SQL, "Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32()); continue; } while (spellInfo) @@ -4852,8 +4852,8 @@ void ObjectMgr::LoadSpellScriptNames() } while (result->NextRow()); - sLog->outString(">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::ValidateSpellScripts() @@ -4862,8 +4862,8 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { - sLog->outString(">> Validated 0 scripts."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated 0 scripts."); + return; } @@ -4883,7 +4883,7 @@ void ObjectMgr::ValidateSpellScripts() bool valid = true; if (!spellScript && !auraScript) { - sLog->outError("TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second)); + sLog->outError(LOG_FILTER_TSCR, "Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second)); valid = false; } if (spellScript) @@ -4910,8 +4910,8 @@ void ObjectMgr::ValidateSpellScripts() ++count; } - sLog->outString(">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadPageTexts() @@ -4923,8 +4923,8 @@ void ObjectMgr::LoadPageTexts() if (!result) { - sLog->outString(">> Loaded 0 page texts. DB table `page_text` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 page texts. DB table `page_text` is empty!"); + return; } @@ -4948,13 +4948,13 @@ void ObjectMgr::LoadPageTexts() { PageTextContainer::const_iterator itr2 = _pageTextStore.find(itr->second.NextPage); if (itr2 == _pageTextStore.end()) - sLog->outErrorDb("Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage); + sLog->outError(LOG_FILTER_SQL, "Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage); } } - sLog->outString(">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } PageText const* ObjectMgr::GetPageText(uint32 pageEntry) @@ -4989,8 +4989,8 @@ void ObjectMgr::LoadPageTextLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text); } while (result->NextRow()); - sLog->outString(">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadInstanceTemplate() @@ -5002,8 +5002,8 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { - sLog->outString(">> Loaded 0 instance templates. DB table `page_text` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); + return; } @@ -5016,7 +5016,7 @@ void ObjectMgr::LoadInstanceTemplate() if (!MapManager::IsValidMAP(mapID, true)) { - sLog->outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID); + sLog->outError(LOG_FILTER_SQL, "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID); continue; } @@ -5032,8 +5032,8 @@ void ObjectMgr::LoadInstanceTemplate() } while (result->NextRow()); - sLog->outString(">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) @@ -5053,8 +5053,8 @@ void ObjectMgr::LoadInstanceEncounters() QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters"); if (!result) { - sLog->outErrorDb(">> Loaded 0 instance encounters, table is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 instance encounters, table is empty!"); + return; } @@ -5070,13 +5070,13 @@ void ObjectMgr::LoadInstanceEncounters() DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry); if (!dungeonEncounter) { - sLog->outErrorDb("Table `instance_encounters` has an invalid encounter id %u, skipped!", entry); + sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid encounter id %u, skipped!", entry); continue; } if (lastEncounterDungeon && !sLFGDungeonStore.LookupEntry(lastEncounterDungeon)) { - sLog->outErrorDb("Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon); + sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon); continue; } @@ -5085,7 +5085,7 @@ void ObjectMgr::LoadInstanceEncounters() { if (itr != dungeonLastBosses.end()) { - sLog->outErrorDb("Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]); + sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]); continue; } @@ -5099,7 +5099,7 @@ void ObjectMgr::LoadInstanceEncounters() CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry); if (!creatureInfo) { - sLog->outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); + sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); continue; } const_cast(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; @@ -5108,12 +5108,12 @@ void ObjectMgr::LoadInstanceEncounters() case ENCOUNTER_CREDIT_CAST_SPELL: if (!sSpellMgr->GetSpellInfo(creditEntry)) { - sLog->outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); + sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); continue; } break; default: - sLog->outErrorDb("Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]); + sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]); continue; } @@ -5122,8 +5122,8 @@ void ObjectMgr::LoadInstanceEncounters() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const @@ -5143,8 +5143,8 @@ void ObjectMgr::LoadGossipText() int count = 0; if (!result) { - sLog->outString(">> Loaded %u npc texts", count); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts", count); + return; } _gossipTextStore.rehash(result->GetRowCount()); @@ -5161,7 +5161,7 @@ void ObjectMgr::LoadGossipText() uint32 Text_ID = fields[cic++].GetUInt32(); if (!Text_ID) { - sLog->outErrorDb("Table `npc_text` has record wit reserved id 0, ignore."); + sLog->outError(LOG_FILTER_SQL, "Table `npc_text` has record wit reserved id 0, ignore."); continue; } @@ -5183,8 +5183,8 @@ void ObjectMgr::LoadGossipText() } } while (result->NextRow()); - sLog->outString(">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadNpcTextLocales() @@ -5226,8 +5226,8 @@ void ObjectMgr::LoadNpcTextLocales() } } while (result->NextRow()); - sLog->outString(">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } //not very fast function but it is called only once a day, or on starting-up @@ -5238,7 +5238,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) time_t curTime = time(NULL); tm* lt = localtime(&curTime); uint64 basetime(curTime); - sLog->outDetail("Returning mails current time: hour: %d, minute: %d, second: %d ", lt->tm_hour, lt->tm_min, lt->tm_sec); + sLog->outInfo(LOG_FILTER_GENERAL, "Returning mails current time: hour: %d, minute: %d, second: %d ", lt->tm_hour, lt->tm_min, lt->tm_sec); // Delete all old mails without item and without body immediately, if starting server if (!serverUp) @@ -5252,8 +5252,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - sLog->outString(">> No expired mails found."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired mails found."); + return; // any mails need to be returned or deleted } @@ -5356,8 +5356,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) } while (result->NextRow()); - sLog->outString(">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadQuestAreaTriggers() @@ -5370,8 +5370,8 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { - sLog->outString(">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); + return; } @@ -5389,7 +5389,7 @@ void ObjectMgr::LoadQuestAreaTriggers() AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID); if (!atEntry) { - sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID); + sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID); continue; } @@ -5397,13 +5397,13 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!quest) { - sLog->outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID); + sLog->outError(LOG_FILTER_SQL, "Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID); continue; } if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID); + sLog->outError(LOG_FILTER_SQL, "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID); // this will prevent quest completing without objective const_cast(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); @@ -5415,8 +5415,8 @@ void ObjectMgr::LoadQuestAreaTriggers() } while (result->NextRow()); - sLog->outString(">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadTavernAreaTriggers() @@ -5429,8 +5429,8 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { - sLog->outString(">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); + return; } @@ -5447,15 +5447,15 @@ void ObjectMgr::LoadTavernAreaTriggers() AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if (!atEntry) { - sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } _tavernAreaTriggerStore.insert(Trigger_ID); } while (result->NextRow()); - sLog->outString(">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadAreaTriggerScripts() @@ -5467,8 +5467,8 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { - sLog->outString(">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); + return; } @@ -5486,14 +5486,14 @@ void ObjectMgr::LoadAreaTriggerScripts() AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if (!atEntry) { - sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } _areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName); } while (result->NextRow()); - sLog->outString(">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team) @@ -5588,7 +5588,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt mount_id = mount_info->GetRandomValidModelId(); if (!mount_id) { - sLog->outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry); + sLog->outError(LOG_FILTER_SQL, "No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry); return false; } } @@ -5611,8 +5611,8 @@ void ObjectMgr::LoadGraveyardZones() if (!result) { - sLog->outString(">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); + return; } @@ -5631,35 +5631,35 @@ void ObjectMgr::LoadGraveyardZones() WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId); if (!entry) { - sLog->outErrorDb("Table `game_graveyard_zone` has a record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId); + sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId); continue; } AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); if (!areaEntry) { - sLog->outErrorDb("Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId); + sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId); continue; } if (areaEntry->zone != 0) { - sLog->outErrorDb("Table `game_graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId); + sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId); continue; } if (team != 0 && team != HORDE && team != ALLIANCE) { - sLog->outErrorDb("Table `game_graveyard_zone` has a record for non player faction (%u), skipped.", team); + sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for non player faction (%u), skipped.", team); continue; } if (!AddGraveYardLink(safeLocId, zoneId, team, false)) - sLog->outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); + sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); } while (result->NextRow()); - sLog->outString(">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team) @@ -5686,7 +5686,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float { if (z > -500) { - sLog->outError("ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z); + sLog->outError(LOG_FILTER_GENERAL, "ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z); return GetDefaultGraveYard(team); } } @@ -5705,7 +5705,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float if (graveLow == graveUp && !map->IsBattleArena()) { - sLog->outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team); + sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team); return GetDefaultGraveYard(team); } @@ -5731,7 +5731,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId); if (!entry) { - sLog->outErrorDb("Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", data.safeLocId); + sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", data.safeLocId); continue; } @@ -5849,7 +5849,7 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool GraveYardContainer::iterator graveUp = GraveYardStore.upper_bound(zoneId); if (graveLow == graveUp) { - //sLog->outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team); + //sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team); return; } @@ -5904,8 +5904,8 @@ void ObjectMgr::LoadAreaTriggerTeleports() QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport"); if (!result) { - sLog->outString(">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); + return; } @@ -5930,20 +5930,20 @@ void ObjectMgr::LoadAreaTriggerTeleports() AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if (!atEntry) { - sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId); if (!mapEntry) { - sLog->outErrorDb("Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId); + sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId); continue; } if (at.target_X == 0 && at.target_Y == 0 && at.target_Z == 0) { - sLog->outErrorDb("Area trigger (ID:%u) target coordinates not provided.", Trigger_ID); + sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) target coordinates not provided.", Trigger_ID); continue; } @@ -5951,8 +5951,8 @@ void ObjectMgr::LoadAreaTriggerTeleports() } while (result->NextRow()); - sLog->outString(">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadAccessRequirements() @@ -5965,8 +5965,8 @@ void ObjectMgr::LoadAccessRequirements() QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement"); if (!result) { - sLog->outString(">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); + return; } @@ -5998,7 +5998,7 @@ void ObjectMgr::LoadAccessRequirements() ItemTemplate const* pProto = GetItemTemplate(ar.item); if (!pProto) { - sLog->outError("Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty); + sLog->outError(LOG_FILTER_GENERAL, "Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty); ar.item = 0; } } @@ -6008,7 +6008,7 @@ void ObjectMgr::LoadAccessRequirements() ItemTemplate const* pProto = GetItemTemplate(ar.item2); if (!pProto) { - sLog->outError("Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty); + sLog->outError(LOG_FILTER_GENERAL, "Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty); ar.item2 = 0; } } @@ -6017,7 +6017,7 @@ void ObjectMgr::LoadAccessRequirements() { if (!GetQuestTemplate(ar.quest_A)) { - sLog->outErrorDb("Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_A, mapid, difficulty); + sLog->outError(LOG_FILTER_SQL, "Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_A, mapid, difficulty); ar.quest_A = 0; } } @@ -6026,7 +6026,7 @@ void ObjectMgr::LoadAccessRequirements() { if (!GetQuestTemplate(ar.quest_H)) { - sLog->outErrorDb("Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_H, mapid, difficulty); + sLog->outError(LOG_FILTER_SQL, "Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_H, mapid, difficulty); ar.quest_H = 0; } } @@ -6035,7 +6035,7 @@ void ObjectMgr::LoadAccessRequirements() { if (!sAchievementStore.LookupEntry(ar.achievement)) { - sLog->outErrorDb("Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar.achievement, mapid, difficulty); + sLog->outError(LOG_FILTER_SQL, "Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar.achievement, mapid, difficulty); ar.achievement = 0; } } @@ -6043,8 +6043,8 @@ void ObjectMgr::LoadAccessRequirements() _accessRequirementStore[requirement_ID] = ar; } while (result->NextRow()); - sLog->outString(">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } /* @@ -6158,7 +6158,7 @@ uint32 ObjectMgr::GenerateAuctionID() { if (_auctionId >= 0xFFFFFFFE) { - sLog->outError("Auctions ids overflow!! Can't continue, shutting down server. "); + sLog->outError(LOG_FILTER_GENERAL, "Auctions ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return _auctionId++; @@ -6168,7 +6168,7 @@ uint64 ObjectMgr::GenerateEquipmentSetGuid() { if (_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL)) { - sLog->outError("EquipmentSet guid overflow!! Can't continue, shutting down server. "); + sLog->outError(LOG_FILTER_GENERAL, "EquipmentSet guid overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return _equipmentSetGuid++; @@ -6178,7 +6178,7 @@ uint32 ObjectMgr::GenerateMailID() { if (_mailId >= 0xFFFFFFFE) { - sLog->outError("Mail ids overflow!! Can't continue, shutting down server. "); + sLog->outError(LOG_FILTER_GENERAL, "Mail ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return _mailId++; @@ -6268,8 +6268,8 @@ void ObjectMgr::LoadGameObjectLocales() AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption); } while (result->NextRow()); - sLog->outString(">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + } inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6277,7 +6277,7 @@ inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 if (sLockStore.LookupEntry(dataN)) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.", + sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.", goInfo->entry, goInfo->type, N, goInfo->door.lockId, goInfo->door.lockId); } @@ -6286,7 +6286,7 @@ inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN, if (GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(dataN)) { if (trapInfo->type != GAMEOBJECT_TYPE_TRAP) - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", + sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", goInfo->entry, goInfo->type, N, dataN, dataN, GAMEOBJECT_TYPE_TRAP); } } @@ -6296,7 +6296,7 @@ inline void CheckGOSpellId(GameObjectTemplate const* goInfo, uint32 dataN, uint3 if (sSpellMgr->GetSpellInfo(dataN)) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", + sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", goInfo->entry, goInfo->type, N, dataN, dataN); } @@ -6305,7 +6305,7 @@ inline void CheckAndFixGOChairHeightId(GameObjectTemplate const* goInfo, uint32 if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR)) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", + sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", goInfo->entry, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR); // prevent client and server unexpected work @@ -6318,7 +6318,7 @@ inline void CheckGONoDamageImmuneId(GameObjectTemplate* goTemplate, uint32 dataN if (dataN <= 1) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN); + sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN); } inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6327,7 +6327,7 @@ inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, ui if (dataN <= 1) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.", + sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.", goInfo->entry, goInfo->type, N, dataN); } @@ -6345,8 +6345,8 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { - sLog->outString(">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); + return; } @@ -6430,7 +6430,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.spellFocus.focusId) { if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.focusId)) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", + sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", entry, got.type, got.spellFocus.focusId, got.spellFocus.focusId); } @@ -6448,7 +6448,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.goober.pageId) // pageId { if (!GetPageText(got.goober.pageId)) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", + sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", entry, got.type, got.goober.pageId, got.goober.pageId); } CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11); @@ -6473,7 +6473,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.moTransport.taxiPathId) { if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty()) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", + sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId); } break; @@ -6515,8 +6515,8 @@ void ObjectMgr::LoadGameObjectTemplate() } while (result->NextRow()); - sLog->outString(">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadExplorationBaseXP() @@ -6527,8 +6527,8 @@ void ObjectMgr::LoadExplorationBaseXP() if (!result) { - sLog->outErrorDb(">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); + return; } @@ -6544,8 +6544,8 @@ void ObjectMgr::LoadExplorationBaseXP() } while (result->NextRow()); - sLog->outString(">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } uint32 ObjectMgr::GetBaseXP(uint8 level) @@ -6568,8 +6568,8 @@ void ObjectMgr::LoadPetNames() if (!result) { - sLog->outString(">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); + return; } @@ -6589,8 +6589,8 @@ void ObjectMgr::LoadPetNames() } while (result->NextRow()); - sLog->outString(">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadPetNumber() @@ -6604,8 +6604,8 @@ void ObjectMgr::LoadPetNumber() _hiPetNumber = fields[0].GetUInt32()+1; } - sLog->outString(">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); + } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -6638,8 +6638,8 @@ void ObjectMgr::LoadCorpses() PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES)); if (!result) { - sLog->outString(">> Loaded 0 corpses. DB table `corpse` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 corpses. DB table `corpse` is empty."); + return; } @@ -6651,7 +6651,7 @@ void ObjectMgr::LoadCorpses() CorpseType type = CorpseType(fields[13].GetUInt8()); if (type >= MAX_CORPSE_TYPE) { - sLog->outError("Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type); + sLog->outError(LOG_FILTER_GENERAL, "Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type); continue; } @@ -6667,8 +6667,8 @@ void ObjectMgr::LoadCorpses() } while (result->NextRow()); - sLog->outString(">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadReputationRewardRate() @@ -6682,8 +6682,8 @@ void ObjectMgr::LoadReputationRewardRate() if (!result) { - sLog->outErrorDb(">> Loaded `reputation_reward_rate`, table is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!"); + return; } @@ -6702,25 +6702,25 @@ void ObjectMgr::LoadReputationRewardRate() FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId); continue; } if (repRate.quest_rate < 0.0f) { - sLog->outErrorDb("Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.quest_rate, factionId); + sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.quest_rate, factionId); continue; } if (repRate.creature_rate < 0.0f) { - sLog->outErrorDb("Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creature_rate, factionId); + sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creature_rate, factionId); continue; } if (repRate.spell_rate < 0.0f) { - sLog->outErrorDb("Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spell_rate, factionId); + sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spell_rate, factionId); continue; } @@ -6730,8 +6730,8 @@ void ObjectMgr::LoadReputationRewardRate() } while (result->NextRow()); - sLog->outString(">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadReputationOnKill() @@ -6751,8 +6751,8 @@ void ObjectMgr::LoadReputationOnKill() if (!result) { - sLog->outErrorDb(">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); + return; } @@ -6775,7 +6775,7 @@ void ObjectMgr::LoadReputationOnKill() if (!GetCreatureTemplate(creature_id)) { - sLog->outErrorDb("Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id); + sLog->outError(LOG_FILTER_SQL, "Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id); continue; } @@ -6784,7 +6784,7 @@ void ObjectMgr::LoadReputationOnKill() FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.RepFaction1); if (!factionEntry1) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1); continue; } } @@ -6794,7 +6794,7 @@ void ObjectMgr::LoadReputationOnKill() FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.RepFaction2); if (!factionEntry2) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2); continue; } } @@ -6804,8 +6804,8 @@ void ObjectMgr::LoadReputationOnKill() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadReputationSpilloverTemplate() @@ -6819,8 +6819,8 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { - sLog->outString(">> Loaded `reputation_spillover_template`, table is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded `reputation_spillover_template`, table is empty."); + return; } @@ -6849,13 +6849,13 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!factionEntry) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId); continue; } if (factionEntry->team == 0) { - sLog->outErrorDb("Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId); continue; } @@ -6867,19 +6867,19 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!factionSpillover) { - sLog->outErrorDb("Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId); + sLog->outError(LOG_FILTER_SQL, "Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId); continue; } if (factionSpillover->reputationListID < 0) { - sLog->outErrorDb("Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId); + sLog->outError(LOG_FILTER_SQL, "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId); continue; } if (repTemplate.faction_rank[i] >= MAX_REPUTATION_RANK) { - sLog->outErrorDb("Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]); + sLog->outError(LOG_FILTER_SQL, "Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]); continue; } } @@ -6888,25 +6888,25 @@ void ObjectMgr::LoadReputationSpilloverTemplate() FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]); if (repTemplate.faction[0] && !factionEntry0) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]); continue; } FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]); if (repTemplate.faction[1] && !factionEntry1) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]); continue; } FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]); if (repTemplate.faction[2] && !factionEntry2) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]); continue; } FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]); if (repTemplate.faction[3] && !factionEntry3) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]); + sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]); continue; } @@ -6916,8 +6916,8 @@ void ObjectMgr::LoadReputationSpilloverTemplate() } while (result->NextRow()); - sLog->outString(">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadPointsOfInterest() @@ -6933,8 +6933,8 @@ void ObjectMgr::LoadPointsOfInterest() if (!result) { - sLog->outErrorDb(">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); + return; } @@ -6954,7 +6954,7 @@ void ObjectMgr::LoadPointsOfInterest() if (!Trinity::IsValidMapCoord(POI.x, POI.y)) { - sLog->outErrorDb("Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y); + sLog->outError(LOG_FILTER_SQL, "Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y); continue; } @@ -6963,8 +6963,8 @@ void ObjectMgr::LoadPointsOfInterest() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadQuestPOI() @@ -6980,8 +6980,8 @@ void ObjectMgr::LoadQuestPOI() if (!result) { - sLog->outErrorDb(">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); + return; } @@ -7035,8 +7035,8 @@ void ObjectMgr::LoadQuestPOI() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadNPCSpellClickSpells() @@ -7049,8 +7049,8 @@ void ObjectMgr::LoadNPCSpellClickSpells() if (!result) { - sLog->outErrorDb(">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); + return; } @@ -7064,7 +7064,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() CreatureTemplate const* cInfo = GetCreatureTemplate(npc_entry); if (!cInfo) { - sLog->outErrorDb("Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry); + sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry); continue; } @@ -7072,13 +7072,13 @@ void ObjectMgr::LoadNPCSpellClickSpells() SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spellid); if (!spellinfo) { - sLog->outErrorDb("Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid); + sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid); continue; } uint8 userType = fields[3].GetUInt16(); if (userType >= SPELL_CLICK_USER_MAX) - sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); + sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); uint8 castFlags = fields[2].GetUInt8(); SpellClickInfo info; @@ -7098,13 +7098,13 @@ void ObjectMgr::LoadNPCSpellClickSpells() { if ((itr->second.npcflag & UNIT_NPC_FLAG_SPELLCLICK) && _spellClickInfoStore.find(itr->second.Entry) == _spellClickInfoStore.end()) { - sLog->outErrorDb("npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry); + sLog->outError(LOG_FILTER_SQL, "npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry); const_cast(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK; } } - sLog->outString(">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -7153,8 +7153,8 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, if (!result) { - sLog->outErrorDb(">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str()); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str()); + return; } @@ -7170,7 +7170,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, if (_questTemplates.find(quest) == _questTemplates.end()) { - sLog->outErrorDb("Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id); + sLog->outError(LOG_FILTER_SQL, "Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id); continue; } @@ -7182,8 +7182,8 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadGameobjectQuestRelations() @@ -7194,9 +7194,9 @@ void ObjectMgr::LoadGameobjectQuestRelations() { GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first); if (!goInfo) - sLog->outErrorDb("Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER) - sLog->outErrorDb("Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); } } @@ -7208,9 +7208,9 @@ void ObjectMgr::LoadGameobjectInvolvedRelations() { GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first); if (!goInfo) - sLog->outErrorDb("Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER) - sLog->outErrorDb("Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); + sLog->outError(LOG_FILTER_SQL, "Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); } } @@ -7222,9 +7222,9 @@ void ObjectMgr::LoadCreatureQuestRelations() { CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first); if (!cInfo) - sLog->outErrorDb("Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); + sLog->outError(LOG_FILTER_SQL, "Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER)) - sLog->outErrorDb("Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); + sLog->outError(LOG_FILTER_SQL, "Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); } } @@ -7236,9 +7236,9 @@ void ObjectMgr::LoadCreatureInvolvedRelations() { CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first); if (!cInfo) - sLog->outErrorDb("Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); + sLog->outError(LOG_FILTER_SQL, "Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER)) - sLog->outErrorDb("Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); + sLog->outError(LOG_FILTER_SQL, "Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); } } @@ -7252,8 +7252,8 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { - sLog->outString(">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); + return; } @@ -7268,7 +7268,7 @@ void ObjectMgr::LoadReservedPlayersNames() std::wstring wstr; if (!Utf8toWStr (name, wstr)) { - sLog->outError("Table `reserved_name` have invalid name: %s", name.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "Table `reserved_name` have invalid name: %s", name.c_str()); continue; } @@ -7279,8 +7279,8 @@ void ObjectMgr::LoadReservedPlayersNames() } while (result->NextRow()); - sLog->outString(">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } bool ObjectMgr::IsReservedName(const std::string& name) const @@ -7433,8 +7433,8 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { - sLog->outString(">> Loaded 0 GameObjects for quests"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GameObjects for quests"); + return; } @@ -7482,8 +7482,8 @@ void ObjectMgr::LoadGameObjectForQuests() } } - sLog->outString(">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value) @@ -7497,7 +7497,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max { if (end_value >= start_value) { - sLog->outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value); + sLog->outError(LOG_FILTER_SQL, "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value); return false; } @@ -7510,7 +7510,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max { if (start_value >= end_value) { - sLog->outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value); + sLog->outError(LOG_FILTER_SQL, "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value); return false; } } @@ -7529,10 +7529,10 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max if (!result) { if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings - sLog->outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); else - sLog->outString(">> Loaded 0 string templates. DB table `%s` is empty.", table); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 string templates. DB table `%s` is empty.", table); + return false; } @@ -7546,12 +7546,12 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max if (entry == 0) { - sLog->outErrorDb("Table `%s` contain reserved entry 0, ignored.", table); + sLog->outError(LOG_FILTER_SQL, "Table `%s` contain reserved entry 0, ignored.", table); continue; } else if (entry < start_value || entry >= end_value) { - sLog->outErrorDb("Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value); + sLog->outError(LOG_FILTER_SQL, "Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value); continue; } @@ -7559,7 +7559,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max if (!data.Content.empty()) { - sLog->outErrorDb("Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry); + sLog->outError(LOG_FILTER_SQL, "Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry); continue; } @@ -7571,11 +7571,11 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max } while (result->NextRow()); if (min_value == MIN_TRINITY_STRING_ID) - sLog->outString(">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outString(">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + return true; } @@ -7590,9 +7590,9 @@ const char *ObjectMgr::GetTrinityString(int32 entry, LocaleConstant locale_idx) } if (entry > 0) - sLog->outErrorDb("Entry %i not found in `trinity_string` table.", entry); + sLog->outError(LOG_FILTER_SQL, "Entry %i not found in `trinity_string` table.", entry); else - sLog->outErrorDb("Trinity string entry %i not found in DB.", entry); + sLog->outError(LOG_FILTER_SQL, "Trinity string entry %i not found in DB.", entry); return ""; } @@ -7606,8 +7606,8 @@ void ObjectMgr::LoadFishingBaseSkillLevel() if (!result) { - sLog->outErrorDb(">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); + return; } @@ -7622,7 +7622,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry); if (!fArea) { - sLog->outErrorDb("AreaId %u defined in `skill_fishing_base_level` does not exist", entry); + sLog->outError(LOG_FILTER_SQL, "AreaId %u defined in `skill_fishing_base_level` does not exist", entry); continue; } @@ -7631,8 +7631,8 @@ void ObjectMgr::LoadFishingBaseSkillLevel() } while (result->NextRow()); - sLog->outString(">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names) @@ -7715,8 +7715,8 @@ void ObjectMgr::LoadGameTele() if (!result) { - sLog->outErrorDb(">> Loaded 0 GameTeleports. DB table `game_tele` is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!"); + return; } @@ -7739,13 +7739,13 @@ void ObjectMgr::LoadGameTele() if (!MapManager::IsValidMapCoord(gt.mapId, gt.position_x, gt.position_y, gt.position_z, gt.orientation)) { - sLog->outErrorDb("Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str()); + sLog->outError(LOG_FILTER_SQL, "Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str()); continue; } if (!Utf8toWStr(gt.name, gt.wnameLow)) { - sLog->outErrorDb("Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id); + sLog->outError(LOG_FILTER_SQL, "Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id); continue; } @@ -7757,8 +7757,8 @@ void ObjectMgr::LoadGameTele() } while (result->NextRow()); - sLog->outString(">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -7856,8 +7856,8 @@ void ObjectMgr::LoadMailLevelRewards() if (!result) { - sLog->outErrorDb(">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); + return; } @@ -7874,25 +7874,25 @@ void ObjectMgr::LoadMailLevelRewards() if (level > MAX_LEVEL) { - sLog->outErrorDb("Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL); + sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL); continue; } if (!(raceMask & RACEMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level); + sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level); continue; } if (!sMailTemplateStore.LookupEntry(mailTemplateId)) { - sLog->outErrorDb("Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level); + sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level); continue; } if (!GetCreatureTemplate(senderEntry)) { - sLog->outErrorDb("Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level); + sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level); continue; } @@ -7902,8 +7902,8 @@ void ObjectMgr::LoadMailLevelRewards() } while (result->NextRow()); - sLog->outString(">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel) @@ -7914,32 +7914,32 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) { - sLog->outErrorDb("Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry); + sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry); return; } if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER)) { - sLog->outErrorDb("Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry); + sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry); return; } SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell); if (!spellinfo) { - sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell); + sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell); return; } if (!SpellMgr::IsSpellValid(spellinfo)) { - sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell); + sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell); return; } if (GetTalentSpellCost(spell)) { - sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell); + sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell); return; } @@ -7967,7 +7967,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER) { - sLog->outErrorDb("Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry); + sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry); continue; } @@ -7999,8 +7999,8 @@ void ObjectMgr::LoadTrainerSpell() if (!result) { - sLog->outErrorDb(">> Loaded 0 Trainers. DB table `npc_trainer` is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!"); + return; } @@ -8023,8 +8023,8 @@ void ObjectMgr::LoadTrainerSpell() } while (result->NextRow()); - sLog->outString(">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set *skip_vendors) @@ -8080,8 +8080,8 @@ void ObjectMgr::LoadVendors() QueryResult result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor ORDER BY entry, slot ASC"); if (!result) { - sLog->outString(); - sLog->outErrorDb(">> Loaded 0 Vendors. DB table `npc_vendor` is empty!"); + + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!"); return; } @@ -8114,8 +8114,8 @@ void ObjectMgr::LoadVendors() } while (result->NextRow()); - sLog->outString(">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadGossipMenu() @@ -8128,8 +8128,8 @@ void ObjectMgr::LoadGossipMenu() if (!result) { - sLog->outErrorDb(">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); + return; } @@ -8146,7 +8146,7 @@ void ObjectMgr::LoadGossipMenu() if (!GetGossipText(gMenu.text_id)) { - sLog->outErrorDb("Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id); + sLog->outError(LOG_FILTER_SQL, "Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id); continue; } @@ -8156,8 +8156,8 @@ void ObjectMgr::LoadGossipMenu() } while (result->NextRow()); - sLog->outString(">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadGossipMenuItems() @@ -8175,8 +8175,8 @@ void ObjectMgr::LoadGossipMenuItems() if (!result) { - sLog->outErrorDb(">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); + return; } @@ -8202,16 +8202,16 @@ void ObjectMgr::LoadGossipMenuItems() if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX) { - sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon); + sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon); gMenuItem.OptionIcon = GOSSIP_ICON_CHAT; } if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX) - sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType); + sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType); if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId)) { - sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId); + sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId); gMenuItem.ActionPoiId = 0; } @@ -8220,8 +8220,8 @@ void ObjectMgr::LoadGossipMenuItems() } while (result->NextRow()); - sLog->outString(">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/) @@ -8273,7 +8273,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); + sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); return false; } @@ -8284,7 +8284,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); + sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); if (skip_vendors) skip_vendors->insert(vendor_entry); @@ -8297,7 +8297,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id); + sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id); return false; } @@ -8306,7 +8306,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry); + sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry); return false; } @@ -8315,7 +8315,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); + sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); return false; } else if (maxcount == 0 && incrtime > 0) @@ -8323,7 +8323,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0"); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); + sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); return false; } @@ -8336,7 +8336,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost); else - sLog->outErrorDb("Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry); + sLog->outError(LOG_FILTER_SQL, "Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry); return false; } @@ -8345,7 +8345,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS); else - sLog->outErrorDb("Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry); + sLog->outError(LOG_FILTER_SQL, "Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry); return false; } @@ -8384,8 +8384,8 @@ void ObjectMgr::LoadScriptNames() if (!result) { - sLog->outString(); - sLog->outErrorDb(">> Loaded empty set of Script Names!"); + + sLog->outError(LOG_FILTER_SQL, ">> Loaded empty set of Script Names!"); return; } @@ -8399,8 +8399,8 @@ void ObjectMgr::LoadScriptNames() while (result->NextRow()); std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); - sLog->outString(">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } uint32 ObjectMgr::GetScriptId(const char *name) @@ -8432,7 +8432,7 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set& ids) case SCRIPT_COMMAND_TALK: { if (!GetTrinityStringLocale (itrM->second.Talk.TextID)) - sLog->outErrorDb("Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first); + sLog->outError(LOG_FILTER_SQL, "Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first); if (ids.find(itrM->second.Talk.TextID) != ids.end()) ids.erase(itrM->second.Talk.TextID); @@ -8458,7 +8458,7 @@ void ObjectMgr::LoadDbScriptStrings() CheckScripts(ScriptsType(type), ids); for (std::set::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) - sLog->outErrorDb("Table `db_script_string` has unused string id %u", *itr); + sLog->outError(LOG_FILTER_SQL, "Table `db_script_string` has unused string id %u", *itr); } bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value) @@ -8467,7 +8467,7 @@ bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value) // start/end reversed for negative values if (start_value > MAX_DB_SCRIPT_STRING_ID || end_value >= start_value) { - sLog->outErrorDb("Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1); + sLog->outError(LOG_FILTER_SQL, "Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1); return false; } @@ -8503,8 +8503,8 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { - sLog->outString(">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); + return; } @@ -8525,13 +8525,13 @@ void ObjectMgr::LoadCreatureClassLevelStats() stats.BaseArmor = fields[6].GetInt16(); if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0) - sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class); + sLog->outError(LOG_FILTER_SQL, "Creature base stats for level %u has invalid class %u", Level, Class); for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i) { if (stats.BaseHealth[i] < 1) { - sLog->outErrorDb("Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i); + sLog->outError(LOG_FILTER_SQL, "Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i); stats.BaseHealth[i] = 1; } } @@ -8548,12 +8548,12 @@ void ObjectMgr::LoadCreatureClassLevelStats() for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl) { if (_creatureBaseStatsStore.find(MAKE_PAIR16(lvl, itr->second.unit_class)) == _creatureBaseStatsStore.end()) - sLog->outErrorDb("Missing base stats for creature class %u level %u", itr->second.unit_class, lvl); + sLog->outError(LOG_FILTER_SQL, "Missing base stats for creature class %u level %u", itr->second.unit_class, lvl); } } - sLog->outString(">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadFactionChangeAchievements() @@ -8564,8 +8564,8 @@ void ObjectMgr::LoadFactionChangeAchievements() if (!result) { - sLog->outErrorDb(">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); + return; } @@ -8579,9 +8579,9 @@ void ObjectMgr::LoadFactionChangeAchievements() uint32 horde = fields[1].GetUInt32(); if (!sAchievementStore.LookupEntry(alliance)) - sLog->outErrorDb("Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance); + sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance); else if (!sAchievementStore.LookupEntry(horde)) - sLog->outErrorDb("Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde); + sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde); else FactionChange_Achievements[alliance] = horde; @@ -8589,8 +8589,8 @@ void ObjectMgr::LoadFactionChangeAchievements() } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadFactionChangeItems() @@ -8601,8 +8601,8 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { - sLog->outString(">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); + return; } @@ -8616,9 +8616,9 @@ void ObjectMgr::LoadFactionChangeItems() uint32 horde = fields[1].GetUInt32(); if (!GetItemTemplate(alliance)) - sLog->outErrorDb("Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); + sLog->outError(LOG_FILTER_SQL, "Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); else if (!GetItemTemplate(horde)) - sLog->outErrorDb("Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", horde); + sLog->outError(LOG_FILTER_SQL, "Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", horde); else FactionChange_Items[alliance] = horde; @@ -8626,8 +8626,8 @@ void ObjectMgr::LoadFactionChangeItems() } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadFactionChangeSpells() @@ -8638,8 +8638,8 @@ void ObjectMgr::LoadFactionChangeSpells() if (!result) { - sLog->outErrorDb(">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); + return; } @@ -8653,9 +8653,9 @@ void ObjectMgr::LoadFactionChangeSpells() uint32 horde = fields[1].GetUInt32(); if (!sSpellMgr->GetSpellInfo(alliance)) - sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); + sLog->outError(LOG_FILTER_SQL, "Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); else if (!sSpellMgr->GetSpellInfo(horde)) - sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); + sLog->outError(LOG_FILTER_SQL, "Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); else FactionChange_Spells[alliance] = horde; @@ -8663,8 +8663,8 @@ void ObjectMgr::LoadFactionChangeSpells() } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void ObjectMgr::LoadFactionChangeReputations() @@ -8675,8 +8675,8 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { - sLog->outString(">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); + return; } @@ -8690,9 +8690,9 @@ void ObjectMgr::LoadFactionChangeReputations() uint32 horde = fields[1].GetUInt32(); if (!sFactionStore.LookupEntry(alliance)) - sLog->outErrorDb("Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance); + sLog->outError(LOG_FILTER_SQL, "Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance); else if (!sFactionStore.LookupEntry(horde)) - sLog->outErrorDb("Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde); + sLog->outError(LOG_FILTER_SQL, "Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde); else FactionChange_Reputation[alliance] = horde; @@ -8700,8 +8700,8 @@ void ObjectMgr::LoadFactionChangeReputations() } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index fcc0315055e..59bb2fb536f 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -787,13 +787,13 @@ class ObjectMgr void LoadQuests(); void LoadQuestRelations() { - sLog->outString("Loading GO Start Quest Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO Start Quest Data..."); LoadGameobjectQuestRelations(); - sLog->outString("Loading GO End Quest Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO End Quest Data..."); LoadGameobjectInvolvedRelations(); - sLog->outString("Loading Creature Start Quest Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Start Quest Data..."); LoadCreatureQuestRelations(); - sLog->outString("Loading Creature End Quest Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature End Quest Data..."); LoadCreatureInvolvedRelations(); } void LoadGameobjectQuestRelations(); diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h index cf649f8d896..ad888b26dd3 100755 --- a/src/server/game/Grids/GridStates.h +++ b/src/server/game/Grids/GridStates.h @@ -32,7 +32,7 @@ class GridState { if (i_Magic != MAGIC_TESTVAL) { - sLog->outError("!!! GridState: Magic value gone !!!"); + sLog->outError(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!"); return false; } return true; diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index 519a53ad184..3b2d59dd998 100755 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -94,7 +94,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager { T* obj = new T; uint32 guid = *i_guid; - //sLog->outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); + //sLog->outInfo(LOG_FILTER_GENERAL, "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); if (!obj->LoadFromDB(guid, map)) { delete obj; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 428f0d25a8b..5ace6da2f44 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -73,7 +73,7 @@ Group::~Group() sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Group::~Group: battleground group being deleted."); if (m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL); else if (m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL); - else sLog->outError("Group::~Group: battleground group is not linked to the correct battleground."); + else sLog->outError(LOG_FILTER_GENERAL, "Group::~Group: battleground group is not linked to the correct battleground."); } Rolls::iterator itr; while (!RollId.empty()) @@ -2087,7 +2087,7 @@ void Group::BroadcastGroupUpdate(void) { pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2); pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE); - sLog->outStaticDebug("-- Forced group value update for '%s'", pp->GetName()); + sLog->outDebug(LOG_FILTER_GENERAL, "-- Forced group value update for '%s'", pp->GetName()); } } } diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index f372f08c941..acec13ab2c3 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -46,7 +46,7 @@ uint32 GroupMgr::GenerateNewGroupDbStoreId() if (newStorageId == NextGroupDbStoreId) { - sLog->outError("Group storage ID overflow!! Can't continue, shutting down server. "); + sLog->outError(LOG_FILTER_GENERAL, "Group storage ID overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } @@ -84,7 +84,7 @@ uint32 GroupMgr::GenerateGroupId() { if (NextGroupId >= 0xFFFFFFFE) { - sLog->outError("Group guid overflow!! Can't continue, shutting down server. "); + sLog->outError(LOG_FILTER_GENERAL, "Group guid overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return NextGroupId++; @@ -125,8 +125,8 @@ void GroupMgr::LoadGroups() ", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC"); if (!result) { - sLog->outString(">> Loaded 0 group definitions. DB table `groups` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group definitions. DB table `groups` is empty!"); + return; } @@ -151,11 +151,11 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - sLog->outString(">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } - sLog->outString("Loading Group members..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group members..."); { uint32 oldMSTime = getMSTime(); @@ -169,8 +169,8 @@ void GroupMgr::LoadGroups() QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid"); if (!result) { - sLog->outString(">> Loaded 0 group members. DB table `group_member` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group members. DB table `group_member` is empty!"); + return; } @@ -184,17 +184,17 @@ void GroupMgr::LoadGroups() if (group) group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8()); else - sLog->outError("GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32()); + sLog->outError(LOG_FILTER_GENERAL, "GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32()); ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } - sLog->outString("Loading Group instance saves..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group instance saves..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 4 5 6 @@ -203,8 +203,8 @@ void GroupMgr::LoadGroups() "LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid"); if (!result) { - sLog->outString(">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); + return; } @@ -218,14 +218,14 @@ void GroupMgr::LoadGroups() MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt16()); if (!mapEntry || !mapEntry->IsDungeon()) { - sLog->outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16()); + sLog->outError(LOG_FILTER_SQL, "Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16()); continue; } uint32 diff = fields[4].GetUInt8(); if (diff >= uint32(mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)) { - sLog->outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1); + sLog->outError(LOG_FILTER_SQL, "Wrong dungeon difficulty use in group_instance table: %d", diff + 1); diff = 0; // default for both difficaly types } @@ -235,7 +235,7 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - sLog->outString(">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 0811ba06137..4df77f874f3 100755 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -51,7 +51,7 @@ void Guild::SendCommandResult(WorldSession* session, GuildCommandType type, Guil data << uint32(errCode); session->SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_COMMAND_RESULT)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_COMMAND_RESULT)"); } void Guild::SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode) @@ -60,10 +60,9 @@ void Guild::SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode data << uint32(errCode); session->SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (MSG_SAVE_GUILD_EMBLEM)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (MSG_SAVE_GUILD_EMBLEM)"); } -/////////////////////////////////////////////////////////////////////////////// // LogHolder Guild::LogHolder::~LogHolder() { @@ -337,21 +336,21 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields) uint32 itemEntry = fields[15].GetUInt32(); if (slotId >= GUILD_BANK_MAX_SLOTS) { - sLog->outError("Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); + sLog->outError(LOG_FILTER_GUILD, "Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); return false; } ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry); if (!proto) { - sLog->outError("Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); + sLog->outError(LOG_FILTER_GUILD, "Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); return false; } Item* pItem = NewItemOrBag(proto); if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry)) { - sLog->outError("Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); + sLog->outError(LOG_FILTER_GUILD, "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GUILD_BANK_ITEM); stmt->setUInt32(0, m_guildId); @@ -599,7 +598,7 @@ bool Guild::Member::LoadFromDB(Field* fields) if (!m_zoneId) { - sLog->outError("Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid)); + sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid)); m_zoneId = Player::GetZoneIdFromDB(m_guid); } return true; @@ -610,12 +609,12 @@ bool Guild::Member::CheckStats() const { if (m_level < 1) { - sLog->outError("Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid)); + sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid)); return false; } if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES) { - sLog->outError("Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid)); + sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid)); return false; } return true; @@ -1220,7 +1219,7 @@ void Guild::HandleRoster(WorldSession* session /*= NULL*/) session->SendPacket(&data); else BroadcastPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_ROSTER)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_ROSTER)"); } void Guild::HandleQuery(WorldSession* session) @@ -1241,7 +1240,7 @@ void Guild::HandleQuery(WorldSession* session) data << uint32(_GetRanksSize()); // Amount of ranks session->SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)"); } void Guild::HandleSetMOTD(WorldSession* session, const std::string& motd) @@ -1450,7 +1449,7 @@ void Guild::HandleInviteMember(WorldSession* session, const std::string& name) data << m_name; pInvitee->GetSession()->SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_INVITE)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_INVITE)"); } void Guild::HandleAcceptMember(WorldSession* session) @@ -1723,7 +1722,7 @@ void Guild::SendInfo(WorldSession* session) const data << m_accountsNumber; // Number of accounts session->SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_INFO)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_INFO)"); } void Guild::SendEventLog(WorldSession* session) const @@ -1773,7 +1772,7 @@ void Guild::SendBankTabsInfo(WorldSession* session) const data << uint8(0); // Do not send tab content session->SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); } void Guild::SendBankTabText(WorldSession* session, uint8 tabId) const @@ -1913,13 +1912,13 @@ bool Guild::LoadBankEventLogFromDB(Field* fields) { if (!isMoneyTab) { - sLog->outError("GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId); + sLog->outError(LOG_FILTER_GUILD, "GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId); return false; } } else if (isMoneyTab) { - sLog->outError("GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id); + sLog->outError(LOG_FILTER_GUILD, "GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id); return false; } pLog->LoadEvent(new BankEventLogEntry( @@ -1942,7 +1941,7 @@ bool Guild::LoadBankTabFromDB(Field* fields) uint8 tabId = fields[1].GetUInt8(); if (tabId >= _GetPurchasedTabsSize()) { - sLog->outError("Invalid tab (tabId: %u) in guild bank, skipped.", tabId); + sLog->outError(LOG_FILTER_GUILD, "Invalid tab (tabId: %u) in guild bank, skipped.", tabId); return false; } return m_bankTabs[tabId]->LoadFromDB(fields); @@ -1953,7 +1952,7 @@ bool Guild::LoadBankItemFromDB(Field* fields) uint8 tabId = fields[12].GetUInt8(); if (tabId >= _GetPurchasedTabsSize()) { - sLog->outError("Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.", + sLog->outError(LOG_FILTER_GUILD, "Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.", fields[14].GetUInt32(), fields[15].GetUInt32()); return false; } @@ -1971,7 +1970,7 @@ bool Guild::Validate() bool broken_ranks = false; if (_GetRanksSize() < GUILD_RANKS_MIN_COUNT || _GetRanksSize() > GUILD_RANKS_MAX_COUNT) { - sLog->outError("Guild %u has invalid number of ranks, creating new...", m_id); + sLog->outError(LOG_FILTER_GUILD, "Guild %u has invalid number of ranks, creating new...", m_id); broken_ranks = true; } else @@ -1981,7 +1980,7 @@ bool Guild::Validate() RankInfo* rankInfo = GetRankInfo(rankId); if (rankInfo->GetId() != rankId) { - sLog->outError("Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId); + sLog->outError(LOG_FILTER_GUILD, "Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId); broken_ranks = true; } } @@ -2532,7 +2531,7 @@ void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAm /* if (pItemSrc->GetCount() == 0) { - sLog->outCrash("Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!", + sLog->outFatal(LOG_FILTER_GENERAL, "Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!", player->GetName(), player->GetGUIDLow(), pItemSrc->GetEntry(), tabId, slotId, destTabId, destSlotId, pItemSrc->GetEntry()); //return; // Commented out for now, uncomment when it's verified that this causes a crash!! } @@ -2642,7 +2641,7 @@ void Guild::_SendBankContent(WorldSession* session, uint8 tabId) const session->SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); } } @@ -2657,7 +2656,7 @@ void Guild::_SendBankMoneyUpdate(WorldSession* session) const data << uint8(0); // No items BroadcastPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); } void Guild::_SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const @@ -2717,7 +2716,7 @@ void Guild::_SendBankContentUpdate(uint8 tabId, SlotIds slots) const player->GetSession()->SendPacket(&data); } - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); } } @@ -2741,5 +2740,5 @@ void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* par BroadcastPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_GUILD_EVENT"); + sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent SMSG_GUILD_EVENT"); } diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 106be2a605d..35a217200ad 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -43,7 +43,7 @@ uint32 GuildMgr::GenerateGuildId() { if (NextGuildId >= 0xFFFFFFFE) { - sLog->outError("Guild ids overflow!! Can't continue, shutting down server. "); + sLog->outError(LOG_FILTER_GUILD, "Guild ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return NextGuildId++; @@ -93,7 +93,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const void GuildMgr::LoadGuilds() { // 1. Load all guilds - sLog->outString("Loading guilds definitions..."); + sLog->outInfo(LOG_FILTER_GUILD, "Loading guilds definitions..."); { uint32 oldMSTime = getMSTime(); @@ -105,8 +105,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild definitions. DB table `guild` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild definitions. DB table `guild` is empty."); + return; } else @@ -128,13 +128,13 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outString(">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // 2. Load all guild ranks - sLog->outString("Loading guild ranks..."); + sLog->outInfo(LOG_FILTER_GUILD, "Loading guild ranks..."); { uint32 oldMSTime = getMSTime(); @@ -146,8 +146,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); + } else { @@ -164,13 +164,13 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outString(">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // 3. Load all guild members - sLog->outString("Loading guild members..."); + sLog->outInfo(LOG_FILTER_GUILD, "Loading guild members..."); { uint32 oldMSTime = getMSTime(); @@ -189,8 +189,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild members. DB table `guild_member` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild members. DB table `guild_member` is empty."); + } else { @@ -208,13 +208,13 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outString(">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // 4. Load all guild bank tab rights - sLog->outString("Loading bank tab rights..."); + sLog->outInfo(LOG_FILTER_GUILD, "Loading bank tab rights..."); { uint32 oldMSTime = getMSTime(); @@ -226,8 +226,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); + } else { @@ -244,13 +244,13 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outString(">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // 5. Load all event logs - sLog->outString("Loading guild event logs..."); + sLog->outInfo(LOG_FILTER_GUILD, "Loading guild event logs..."); { uint32 oldMSTime = getMSTime(); @@ -261,8 +261,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); + } else { @@ -279,13 +279,13 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outString(">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // 6. Load all bank event logs - sLog->outString("Loading guild bank event logs..."); + sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank event logs..."); { uint32 oldMSTime = getMSTime(); @@ -297,8 +297,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); + } else { @@ -315,13 +315,13 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outString(">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // 7. Load all guild bank tabs - sLog->outString("Loading guild bank tabs..."); + sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank tabs..."); { uint32 oldMSTime = getMSTime(); @@ -333,8 +333,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); + } else { @@ -351,13 +351,13 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outString(">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // 8. Fill all guild bank tabs - sLog->outString("Filling bank tabs with items..."); + sLog->outInfo(LOG_FILTER_GUILD, "Filling bank tabs with items..."); { uint32 oldMSTime = getMSTime(); @@ -371,8 +371,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); + } else { @@ -389,13 +389,13 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outString(">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } // 9. Validate loaded guild data - sLog->outString("Validating data of loaded guilds..."); + sLog->outInfo(LOG_FILTER_GUILD, "Validating data of loaded guilds..."); { uint32 oldMSTime = getMSTime(); @@ -412,7 +412,7 @@ void GuildMgr::LoadGuilds() } } - sLog->outString(">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GUILD, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); + } } diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp index ef537cb6198..f86dacbc55e 100755 --- a/src/server/game/Handlers/AddonHandler.cpp +++ b/src/server/game/Handlers/AddonHandler.cpp @@ -135,7 +135,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target) } else { - sLog->outError("Addon packet uncompress error :("); + sLog->outError(LOG_FILTER_NETWORKIO, "Addon packet uncompress error :("); return false; } return true; diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 7585af7eb60..10a130536c9 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->outDetail("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(), _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); @@ -285,7 +285,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) Item* newItem = item->CloneItem(finalCount, _player); if (!newItem) { - sLog->outError("CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry()); + sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry()); SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR); return; } @@ -308,7 +308,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - sLog->outDetail("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(), _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); @@ -530,7 +530,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) } else { - sLog->outError("Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow); + sLog->outError(LOG_FILTER_NETWORKIO, "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow); SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR); return; } @@ -539,7 +539,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) { SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR); //this code isn't possible ... maybe there should be assert - sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId); + sLog->outError(LOG_FILTER_NETWORKIO, "CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId); return; } @@ -571,7 +571,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) recv_data >> outbiddedCount; if (recv_data.size() != (16 + outbiddedCount * 4)) { - sLog->outError("Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recv_data.size(), (16 + outbiddedCount * 4)); + sLog->outError(LOG_FILTER_NETWORKIO, "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recv_data.size(), (16 + outbiddedCount * 4)); outbiddedCount = 0; } diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index a0c5268136b..2e0bbf786a9 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -86,7 +86,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) { - sLog->outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_, _player->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_, _player->GetGUIDLow()); return; } @@ -366,13 +366,13 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) GroupQueueInfo ginfo; if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo)) { - sLog->outError("BattlegroundHandler: itrplayerstatus not found."); + sLog->outError(LOG_FILTER_NETWORKIO, "BattlegroundHandler: itrplayerstatus not found."); return; } // if action == 1, then instanceId is required if (!ginfo.IsInvitedToBGInstanceGUID && action == 1) { - sLog->outError("BattlegroundHandler: instance not found."); + sLog->outError(LOG_FILTER_NETWORKIO, "BattlegroundHandler: instance not found."); return; } @@ -383,7 +383,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); if (!bg) { - sLog->outError("BattlegroundHandler: bg_template not found for type id %u.", bgTypeId); + sLog->outError(LOG_FILTER_NETWORKIO, "BattlegroundHandler: bg_template not found for type id %u.", bgTypeId); return; } @@ -408,7 +408,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) //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("Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!", + 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()); action = 0; } @@ -478,7 +478,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_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); break; default: - sLog->outError("Battleground port: unknown action %u", action); + sLog->outError(LOG_FILTER_NETWORKIO, "Battleground port: unknown action %u", action); break; } } @@ -644,7 +644,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) arenatype = ARENA_TYPE_5v5; break; default: - sLog->outError("Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot); + sLog->outError(LOG_FILTER_NETWORKIO, "Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot); return; } @@ -652,7 +652,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA); if (!bg) { - sLog->outError("Battleground: template bg (all arenas) not found"); + sLog->outError(LOG_FILTER_NETWORKIO, "Battleground: template bg (all arenas) not found"); return; } diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 298c742fc3a..e83f0f55a44 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -73,7 +73,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) } else { - sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it); + sLog->outError(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it); data << uint64(0); data << uint64(0); data << uint8(0); @@ -99,7 +99,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) } else { - sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it); + sLog->outError(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it); data << uint64(0); data << uint8(0); data << uint32(0); @@ -251,7 +251,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) if (inviteCount != 1 || invitee != guid) { - sLog->outError("HandleCalendarAddEvent: [" UI64FMTD + sLog->outError(LOG_FILTER_NETWORKIO, "HandleCalendarAddEvent: [" UI64FMTD "]: More than one invite (%d) or Invitee [" UI64FMTD "] differs", guid, inviteCount, invitee); return; @@ -643,7 +643,7 @@ void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, Calenda data << uint8(0) << uint8(0) << uint8(0) << uint8(0) << uint64(0) << uint32(0) << uint8(0); - sLog->outError("SendCalendarEvent: No Invite found with id [" UI64FMTD "]", *it); + sLog->outError(LOG_FILTER_NETWORKIO, "SendCalendarEvent: No Invite found with id [" UI64FMTD "]", *it); } } SendPacket(&data); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 29ee2b5cb41..df515f879f8 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -215,7 +215,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) do { uint32 guidlow = (*result)[0].GetUInt32(); - sLog->outDetail("Loading char guid %u from account %u.", guidlow, GetAccountId()); + sLog->outInfo(LOG_FILTER_NETWORKIO, "Loading char guid %u from account %u.", guidlow, GetAccountId()); if (Player::BuildEnumData(result, &data)) { _allowedCharsToLogin.insert(guidlow); @@ -293,7 +293,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) { data << (uint8)CHAR_CREATE_FAILED; SendPacket(&data); - sLog->outError("Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId()); + sLog->outError(LOG_FILTER_NETWORKIO, "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId()); return; } @@ -302,7 +302,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) { data << (uint8)CHAR_CREATE_FAILED; SendPacket(&data); - sLog->outError("Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId()); + sLog->outError(LOG_FILTER_NETWORKIO, "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId()); return; } @@ -310,7 +310,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) if (raceEntry->expansion > Expansion()) { data << (uint8)CHAR_CREATE_EXPANSION; - sLog->outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_); + sLog->outError(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_); SendPacket(&data); return; } @@ -319,7 +319,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) if (classEntry->expansion > Expansion()) { data << (uint8)CHAR_CREATE_EXPANSION_CLASS; - sLog->outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_); + sLog->outError(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_); SendPacket(&data); return; } @@ -348,7 +348,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) { data << (uint8)CHAR_NAME_NO_NAME; SendPacket(&data); - sLog->outError("Account:[%d] but tried to Create character with empty [name] ", GetAccountId()); + sLog->outError(LOG_FILTER_NETWORKIO, "Account:[%d] but tried to Create character with empty [name] ", GetAccountId()); return; } @@ -658,8 +658,8 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte SendPacket(&data); std::string IP_str = GetRemoteAddress(); - sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); - sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER, "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()); @@ -719,16 +719,16 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) return; std::string IP_str = GetRemoteAddress(); - sLog->outDetail("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); - sLog->outChar("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); + sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); + sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->IsOutCharDump()) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_PLAYER, LOG_LEVEL_TRACE)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + sLog->outTrace(LOG_FILTER_PLAYER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } Player::DeleteFromDB(guid, GetAccountId()); @@ -742,20 +742,20 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recv_data) { if (PlayerLoading() || GetPlayer() != NULL) { - sLog->outError("Player tryes to login again, AccountId = %d", GetAccountId()); + sLog->outError(LOG_FILTER_NETWORKIO, "Player tryes to login again, AccountId = %d", GetAccountId()); return; } m_playerLoading = true; uint64 playerGuid = 0; - sLog->outStaticDebug("WORLD: Recvd Player Logon Message"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd Player Logon Message"); recv_data >> playerGuid; if (!CharCanLogin(GUID_LOPART(playerGuid))) { - sLog->outError("Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid)); + sLog->outError(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid)); KickPlayer(); return; } @@ -839,13 +839,13 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) data.put(0, linecount); SendPacket(&data); - sLog->outStaticDebug("WORLD: Sent motd (SMSG_MOTD)"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_MOTD)"); // send server info if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1) chH.PSendSysMessage(_FULLVERSION); - sLog->outStaticDebug("WORLD: Sent server info"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent server info"); } //QueryResult* result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUIDLow()); @@ -868,7 +868,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) else { // remove wrong guild data - sLog->outError("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(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId()); pCurrChar->SetInGuild(0); } } @@ -1006,7 +1006,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) @@ -1020,7 +1020,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) void WorldSession::HandleSetFactionAtWar(WorldPacket & recv_data) { - sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_ATWAR"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_ATWAR"); uint32 repListID; uint8 flag; @@ -1034,7 +1034,7 @@ void WorldSession::HandleSetFactionAtWar(WorldPacket & recv_data) //I think this function is never used :/ I dunno, but i guess this opcode not exists void WorldSession::HandleSetFactionCheat(WorldPacket & /*recv_data*/) { - sLog->outError("WORLD SESSION: HandleSetFactionCheat, not expected call, please report."); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD SESSION: HandleSetFactionCheat, not expected call, please report."); GetPlayer()->GetReputationMgr().SendStates(); } @@ -1068,7 +1068,7 @@ void WorldSession::HandleTutorialReset(WorldPacket & /*recv_data*/) void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data) { - sLog->outStaticDebug("WORLD: Received CMSG_SET_WATCHED_FACTION"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_WATCHED_FACTION"); uint32 fact; recv_data >> fact; GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact); @@ -1076,7 +1076,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data) void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data) { - sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_INACTIVE"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_INACTIVE"); uint32 replistid; uint8 inactive; recv_data >> replistid >> inactive; @@ -1086,14 +1086,14 @@ void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data) void WorldSession::HandleShowingHelmOpcode(WorldPacket& recv_data) { - sLog->outStaticDebug("CMSG_SHOWING_HELM for %s", _player->GetName()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName()); recv_data.read_skip(); // unknown, bool? _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); } void WorldSession::HandleShowingCloakOpcode(WorldPacket& recv_data) { - sLog->outStaticDebug("CMSG_SHOWING_CLOAK for %s", _player->GetName()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName()); recv_data.read_skip(); // unknown, bool? _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); } @@ -1183,7 +1183,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu CharacterDatabase.Execute(stmt); - sLog->outChar("Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); + sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1)); data << uint8(RESPONSE_SUCCESS); @@ -1450,7 +1450,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) if (result) { std::string oldname = result->Fetch()[0].GetString(); - sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); + sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); } Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 966eae598a6..880f2df86f7 100755 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -52,7 +52,7 @@ 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("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(), + sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), msg.c_str()); if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK)) KickPlayer(); @@ -73,7 +73,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) if (type >= MAX_CHAT_MSG_TYPE) { - sLog->outError("CHAT: Wrong message type received: %u", type); + sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: Wrong message type received: %u", type); recv_data.rfinish(); return; } @@ -474,7 +474,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } } break; default: - sLog->outError("CHAT: unknown message type %u, lang: %u", type, lang); + sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: unknown message type %u, lang: %u", type, lang); break; } } diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index 6693cdfca27..78547d2d0f3 100755 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.cpp @@ -80,7 +80,7 @@ void WorldSession::HandleSetSheathedOpcode(WorldPacket& recv_data) if (sheathed >= MAX_SHEATH_STATE) { - sLog->outError("Unknown sheath state %u ??", sheathed); + sLog->outError(LOG_FILTER_NETWORKIO, "Unknown sheath state %u ??", sheathed); return; } diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp index 8afd9f3b978..1b3f71c8cf1 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->outStaticDebug("Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName()); - sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName()); + 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()); 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 e6473d0e7d9..e0ff3933c3a 100755 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -210,7 +210,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recv_data) if (group->GetLeaderGUID() == GetPlayer()->GetGUID()) { - sLog->outError("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(), GetPlayer()->GetGUIDLow()); return; } @@ -283,7 +283,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) //can't uninvite yourself if (guid == GetPlayer()->GetGUID()) { - sLog->outError("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(), GetPlayer()->GetGUIDLow()); return; } @@ -333,7 +333,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data) // can't uninvite yourself if (GetPlayer()->GetName() == membername) { - sLog->outError("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(), GetPlayer()->GetGUIDLow()); return; } @@ -983,7 +983,7 @@ void WorldSession::HandleOptOutOfLootOpcode(WorldPacket & recv_data) if (!GetPlayer()) // needed because STATUS_AUTHED { if (passOnLoot != 0) - sLog->outError("CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!"); + sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!"); return; } diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index e0ba190d2fc..260220bb8d5 100755 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -284,7 +284,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data) uint32 item; recv_data >> item; - sLog->outDetail("STORAGE: Item Query = %u", item); + sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Item Query = %u", item); ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); if (pProto) @@ -444,7 +444,7 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data) uint8 bag, slot; recv_data >> bag >> slot; - //sLog->outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot); + //sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Read bag = %u, slot = %u", bag, slot); Item* pItem = _player->GetItemByPos(bag, slot); if (pItem && pItem->GetTemplate()->PageText) @@ -455,12 +455,12 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data) if (msg == EQUIP_ERR_OK) { data.Initialize (SMSG_READ_ITEM_OK, 8); - sLog->outDetail("STORAGE: Item page sent"); + sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Item page sent"); } else { data.Initialize(SMSG_READ_ITEM_FAILED, 8); - sLog->outDetail("STORAGE: Unable to read item"); + sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Unable to read item"); _player->SendEquipError(msg, pItem, NULL); } data << pItem->GetGUID(); @@ -479,7 +479,7 @@ void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket & recv_data) recv_data >> itemid >> guid; - sLog->outDetail("Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u", + sLog->outInfo(LOG_FILTER_NETWORKIO, "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u", itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid)); } @@ -561,7 +561,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) Item* pNewItem = pItem->CloneItem(count, _player); if (!pNewItem) { - sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } @@ -880,7 +880,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) // next slot ++slot; - sLog->outDetail("PLAYER: Buy bank bag slot, slot number = %u", slot); + sLog->outInfo(LOG_FILTER_NETWORKIO, "PLAYER: Buy bank bag slot, slot number = %u", slot); BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot); diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index a98453e45c3..2cf27140720 100755 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -89,13 +89,13 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) if (!rc) { - sLog->outDetail("Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", + sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND); return; } - sLog->outDetail("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); + sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); if (player->GetGUID() == rc) { @@ -713,7 +713,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data) bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender); bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK); - sLog->outDetail("HandleMailCreateTextItem mailid=%u", mailId); + sLog->outInfo(LOG_FILTER_NETWORKIO, "HandleMailCreateTextItem mailid=%u", mailId); ItemPosCountVec dest; uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, bodyItem, false); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 11f0857ca2b..02b0ef9fc05 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -963,7 +963,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) if (decompressedSize > 0xFFFF) { recv_data.rfinish(); // unnneded warning spam in this case - sLog->outError("UAD: Account data packet too big, size %u", decompressedSize); + sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Account data packet too big, size %u", decompressedSize); return; } @@ -974,7 +974,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) if (uncompress(const_cast(dest.contents()), &realSize, const_cast(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK) { recv_data.rfinish(); // unnneded warning spam in this case - sLog->outError("UAD: Failed to decompress account data"); + sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Failed to decompress account data"); return; } @@ -1039,10 +1039,10 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) uint32 action = ACTION_BUTTON_ACTION(packetData); uint8 type = ACTION_BUTTON_TYPE(packetData); - sLog->outDetail("BUTTON: %u ACTION: %u TYPE: %u", button, action, type); + sLog->outInfo(LOG_FILTER_NETWORKIO, "BUTTON: %u ACTION: %u TYPE: %u", button, action, type); if (!packetData) { - sLog->outDetail("MISC: Remove action from button %u", button); + sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Remove action from button %u", button); GetPlayer()->removeActionButton(button); } else @@ -1051,19 +1051,19 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) { case ACTION_BUTTON_MACRO: case ACTION_BUTTON_CMACRO: - sLog->outDetail("MISC: Added Macro %u into button %u", action, button); + sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Macro %u into button %u", action, button); break; case ACTION_BUTTON_EQSET: - sLog->outDetail("MISC: Added EquipmentSet %u into button %u", action, button); + sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added EquipmentSet %u into button %u", action, button); break; case ACTION_BUTTON_SPELL: - sLog->outDetail("MISC: Added Spell %u into button %u", action, button); + sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Spell %u into button %u", action, button); break; case ACTION_BUTTON_ITEM: - sLog->outDetail("MISC: Added Item %u into button %u", action, button); + sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Item %u into button %u", action, button); break; default: - sLog->outError("MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName(), _player->GetGUIDLow()); + 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); @@ -1170,7 +1170,7 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED) { if (ActionBar != 0) - sLog->outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar)); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar)); return; } @@ -1418,7 +1418,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data) if (WorldObject* target = _player->GetViewpoint()) _player->SetSeer(target); else - sLog->outError("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(), _player->GetUInt64Value(PLAYER_FARSIGHT)); break; default: sLog->outDebug(LOG_FILTER_NETWORKIO, "Unhandled mode in CMSG_FAR_SIGHT: %u", apply); @@ -1489,7 +1489,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) if (mode >= MAX_DUNGEON_DIFFICULTY) { - sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); return; } @@ -1500,7 +1500,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) Map* map = _player->FindMap(); if (map && map->IsDungeon()) { - sLog->outError("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(), _player->GetGUIDLow()); return; } @@ -1520,7 +1520,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) if (groupGuy->GetMap()->IsNonRaidDungeon()) { - sLog->outError("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(), groupGuy->GetGUIDLow()); return; } } @@ -1546,7 +1546,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) if (mode >= MAX_RAID_DIFFICULTY) { - sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); return; } @@ -1554,7 +1554,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) Map* map = _player->FindMap(); if (map && map->IsDungeon()) { - sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; } @@ -1577,7 +1577,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) if (groupGuy->GetMap()->IsRaid()) { - sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; } } @@ -1708,7 +1708,7 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) if (!_player->HasPendingBind()) { - sLog->outDetail("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(), _player->GetGUIDLow()); return; } diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index ff9030f04d5..27b1f2eca3f 100755 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -66,7 +66,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() Map* oldMap = GetPlayer()->GetMap(); if (GetPlayer()->IsInWorld()) { - sLog->outError("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(), oldMap->GetId(), loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } @@ -76,7 +76,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() // while the player is in transit, for example the map may get full if (!newMap || !newMap->CanEnter(GetPlayer())) { - sLog->outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow()); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); return; } @@ -89,7 +89,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SendInitialPacketsBeforeAddToMap(); if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer())) { - sLog->outError("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(), 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()); @@ -196,8 +196,8 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) uint32 flags, time; recv_data >> flags >> time; - sLog->outStaticDebug("Guid " UI64FMTD, guid); - sLog->outStaticDebug("Flags %u, time %u", flags, time/IN_MILLISECONDS); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Guid " UI64FMTD, guid); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Flags %u, time %u", flags, time/IN_MILLISECONDS); Player* plMover = _player->m_mover->ToPlayer(); @@ -455,7 +455,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break; case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break; default: - sLog->outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode); return; } @@ -472,13 +472,13 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) { if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct { - sLog->outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value", + 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); _player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true); } else // must be lesser - cheating { - sLog->outBasic("Player %s from account id %u kicked for incorrect speed (must be %f instead %f)", + 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->GetSession()->KickPlayer(); } @@ -495,7 +495,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data) if (GetPlayer()->IsInWorld()) { if (_player->m_mover->GetGUID() != guid) - sLog->outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID()); } } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 321c0ada247..3501b3bc068 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -69,17 +69,17 @@ void WorldSession::HandlePetAction(WorldPacket & recv_data) // used also for charmed creature Unit* pet= ObjectAccessor::GetUnit(*_player, guid1); - sLog->outDetail("HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); + sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); if (!pet) { - sLog->outError("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()); return; } if (pet != GetPlayer()->GetFirstControlled()) { - sLog->outError("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()); return; } @@ -121,13 +121,13 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recv_data) if (!pet) { - sLog->outError("HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid))); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid))); return; } if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm()) { - sLog->outError("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()); return; } @@ -142,7 +142,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - sLog->outError("WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -263,7 +263,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid } break; default: - sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); } break; case ACT_REACTION: // 0x6 @@ -292,7 +292,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - sLog->outError("WORLD: unknown PET spell id %i", spellid); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellid); return; } @@ -397,13 +397,13 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid break; } default: - sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); } } void WorldSession::HandlePetNameQuery(WorldPacket & recv_data) { - sLog->outDetail("HandlePetNameQuery. CMSG_PET_NAME_QUERY"); + sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetNameQuery. CMSG_PET_NAME_QUERY"); uint32 petnumber; uint64 petguid; @@ -454,7 +454,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) { if (!GetPlayer()->isGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE)) { - sLog->outStaticDebug("Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid)); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid)); return false; } } @@ -463,7 +463,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) { if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER)) { - sLog->outStaticDebug("Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid)); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid)); return false; } } @@ -472,7 +472,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) void WorldSession::HandlePetSetAction(WorldPacket & recv_data) { - sLog->outDetail("HandlePetSetAction. CMSG_PET_SET_ACTION"); + sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetSetAction. CMSG_PET_SET_ACTION"); uint64 petguid; uint8 count; @@ -483,14 +483,14 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data) if (!pet || pet != _player->GetFirstControlled()) { - sLog->outError("HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow()); return; } CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - sLog->outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -552,7 +552,7 @@ 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->outDetail("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(), 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))) @@ -588,7 +588,7 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data) void WorldSession::HandlePetRename(WorldPacket & recv_data) { - sLog->outDetail("HandlePetRename. CMSG_PET_RENAME"); + sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetRename. CMSG_PET_RENAME"); uint64 petguid; uint8 isdeclined; @@ -675,7 +675,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; //pet guid - sLog->outDetail("HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); + sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); if (!_player->IsInWorld()) return; @@ -701,7 +701,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recv_data) void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) { - sLog->outDetail("CMSG_PET_SPELL_AUTOCAST"); + sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_PET_SPELL_AUTOCAST"); uint64 guid; uint32 spellid; uint8 state; //1 for on, 0 for off @@ -717,7 +717,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm())) { - sLog->outError("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()); return; } @@ -729,7 +729,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -762,14 +762,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { - sLog->outError("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()); return; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("WORLD: unknown PET spell id %i", spellId); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellId); return; } diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index cb3bac0e443..90af03113bf 100755 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -479,7 +479,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) if (!result) { - sLog->outError("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()); return; } @@ -771,7 +771,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } else { - sLog->outError("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(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); return; } diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 4fb90bed10b..d3f51867831 100755 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -70,7 +70,7 @@ void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data) recv_data >> guid; // This is disable by default to prevent lots of console spam - // sLog->outString("HandleNameQueryOpcode %u", guid); + // sLog->outInfo(LOG_FILTER_NETWORKIO, "HandleNameQueryOpcode %u", guid); SendNameQueryOpcode(guid); } diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index d13c2fb0956..7492edb35fe 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -43,7 +43,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data) Object* questgiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!questgiver) { - sLog->outDetail("Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid)); + sLog->outInfo(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid)); return; } @@ -71,7 +71,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data) break; } default: - sLog->outError("QuestGiver called for unexpected type %u", questgiver->GetTypeId()); + sLog->outError(LOG_FILTER_NETWORKIO, "QuestGiver called for unexpected type %u", questgiver->GetTypeId()); break; } @@ -289,7 +289,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) if (reward >= QUEST_REWARD_CHOICES_COUNT) { - sLog->outError("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(), _player->GetGUIDLow(), reward); return; } @@ -308,7 +308,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) || (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete())) { - sLog->outError("HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!", + 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); return; } @@ -435,7 +435,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data) _player->RemoveActiveQuest(questId); _player->GetAchievementMgr().RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId); - sLog->outDetail("Player %u abandoned quest %u", _player->GetGUIDLow(), questId); + sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u abandoned quest %u", _player->GetGUIDLow(), questId); } _player->SetQuestSlot(slot, 0); @@ -500,7 +500,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) { if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) { - sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!", + 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); return; } @@ -634,7 +634,7 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32 } default: //its imposible, but check ^) - sLog->outError("Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId()); + sLog->outError(LOG_FILTER_NETWORKIO, "Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId()); return DIALOG_STATUS_NONE; } diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index c02bb43a353..d7bb10e8ba3 100755 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -187,7 +187,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) recvPacket >> bagIndex >> slot; - sLog->outDetail("bagIndex: %u, slot: %u", bagIndex, slot); + sLog->outInfo(LOG_FILTER_NETWORKIO, "bagIndex: %u, slot: %u", bagIndex, slot); Item* item = pUser->GetItemByPos(bagIndex, slot); if (!item) @@ -207,7 +207,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!(proto->Flags & ITEM_PROTO_FLAG_OPENABLE) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED)) { pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); - sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!", + 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); return; } @@ -221,7 +221,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!lockInfo) { pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, NULL); - sLog->outError("WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId); return; } @@ -254,7 +254,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) } else { - sLog->outError("Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow()); pUser->DestroyItem(item->GetBagSlot(), item->GetSlot(), true); return; } @@ -328,7 +328,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) if (!spellInfo) { - sLog->outError("WORLD: unknown spell id %u", spellId); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown spell id %u", spellId); recvPacket.rfinish(); // prevent spam at ignore packet return; } @@ -444,7 +444,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("WORLD: unknown PET spell id %u", spellId); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %u", spellId); return; } @@ -452,13 +452,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) if (!pet) { - sLog->outError("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()); return; } if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm()) { - sLog->outError("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()); return; } diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index 9d7fa7da396..f50b9ebd311 100755 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -192,21 +192,21 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) if (myItems[i]) { if (!traderCanTrade) - sLog->outError("trader can't store item: %u", myItems[i]->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "trader can't store item: %u", myItems[i]->GetGUIDLow()); if (_player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, myItems[i], false) == EQUIP_ERR_OK) _player->MoveItemToInventory(playerDst, myItems[i], true, true); else - sLog->outError("player can't take item back: %u", myItems[i]->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "player can't take item back: %u", myItems[i]->GetGUIDLow()); } // return the already removed items to the original owner if (hisItems[i]) { if (!playerCanTrade) - sLog->outError("player can't store item: %u", hisItems[i]->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "player can't store item: %u", hisItems[i]->GetGUIDLow()); if (trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false) == EQUIP_ERR_OK) trader->MoveItemToInventory(traderDst, hisItems[i], true, true); else - sLog->outError("trader can't take item back: %u", hisItems[i]->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "trader can't take item back: %u", hisItems[i]->GetGUIDLow()); } } } @@ -224,7 +224,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *m { if (Item* item = myTrade->GetItem(TradeSlots(i))) { - sLog->outStaticDebug("player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); //Can return NULL myItems[i] = item; myItems[i]->SetInTrade(); @@ -232,7 +232,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *m if (Item* item = hisTrade->GetItem(TradeSlots(i))) { - sLog->outStaticDebug("partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); hisItems[i] = item; hisItems[i]->SetInTrade(); } diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index cfd73c2c987..f0ccfc44e60 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.cpp @@ -63,7 +63,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data) if (!seat->CanSwitchFromSeat()) { recv_data.rfinish(); // prevent warnings spam - sLog->outError("HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.", + sLog->outError(LOG_FILTER_NETWORKIO, "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.", recv_data.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags); return; } @@ -150,7 +150,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) if (!vehicle) { data.rfinish(); // prevent warnings spam - sLog->outError("HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow()); return; } @@ -162,13 +162,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) Player* player = ObjectAccessor::FindPlayer(guid); if (!player) { - sLog->outError("Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } if (!player->IsOnVehicle(vehicle->GetBase())) { - sLog->outError("Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } @@ -177,7 +177,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) if (seat->IsEjectable()) player->ExitVehicle(); else - sLog->outError("Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); } else if (IS_CREATURE_GUID(guid)) @@ -185,13 +185,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) Unit* unit = ObjectAccessor::GetUnit(*_player, guid); if (!unit) // creatures can be ejected too from player mounts { - sLog->outError("Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } if (!unit->IsOnVehicle(vehicle->GetBase())) { - sLog->outError("Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } @@ -203,10 +203,10 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) unit->ExitVehicle(); } else - sLog->outError("Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); } else - sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid); + sLog->outError(LOG_FILTER_NETWORKIO, "HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid); } void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recv_data*/) @@ -220,7 +220,7 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recv_data*/) if (seat->CanEnterOrExit()) GetPlayer()->ExitVehicle(); else - sLog->outError("Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.", + sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.", GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags); } } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 59bb86cb68e..6e76f37c9d6 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -75,19 +75,19 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance const MapEntry* entry = sMapStore.LookupEntry(mapId); if (!entry) { - sLog->outError("InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId); + sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId); return NULL; } if (instanceId == 0) { - sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId); + sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId); return NULL; } if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)) { - sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty); + sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty); return NULL; } @@ -275,8 +275,8 @@ void InstanceSaveManager::LoadInstances() // Load reset times and clean expired instances sInstanceSaveMgr->LoadResetTimes(); - sLog->outString(">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); + } void InstanceSaveManager::LoadResetTimes() @@ -364,7 +364,7 @@ void InstanceSaveManager::LoadResetTimes() MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty); if (!mapDiff) { - sLog->outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty); + sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty); CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid, difficulty); continue; } @@ -458,7 +458,7 @@ void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent ev } if (itr == m_resetTimeQueue.end()) - sLog->outError("InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d, %d, %d) was not found!", event.type, event.mapid, event.instanceId); + sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d, %d, %d) was not found!", event.type, event.mapid, event.instanceId); } } else @@ -566,7 +566,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty); if (!mapDiff || !mapDiff->resetTime) { - sLog->outError("InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid); + sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid); return; } diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index d2c256e08f7..be9ee67b341 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -46,7 +46,7 @@ void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject* go) if (go) go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); else - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: InstanceScript: HandleGameObject failed"); + sLog->outDebug(LOG_FILTER_TSCR, "InstanceScript: HandleGameObject failed"); } bool InstanceScript::IsEncounterInProgress() const @@ -197,7 +197,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) if (bossInfo->state == TO_BE_DECIDED) // loading { bossInfo->state = state; - //sLog->outError("Inialize boss %u state as %u.", id, (uint32)state); + //sLog->outError(LOG_FILTER_GENERAL, "Inialize boss %u state as %u.", id, (uint32)state); return false; } else @@ -267,7 +267,7 @@ void InstanceScript::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, go->ResetDoorOrButton(); } else - sLog->outError("SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType()); + sLog->outError(LOG_FILTER_GENERAL, "SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType()); } } @@ -298,7 +298,7 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData) player->SendUpdateWorldState(uiStateId, uiStateData); } else - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoUpdateWorldState attempt send data but no players in map."); + sLog->outDebug(LOG_FILTER_TSCR, "DoUpdateWorldState attempt send data but no players in map."); } // Send Notify to all players in instance @@ -384,7 +384,7 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell) bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/) { - sLog->outError("Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", + sLog->outError(LOG_FILTER_GENERAL, "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", instance->GetId(), criteria_id); return false; } diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 71f1572624b..ba6d327e631 100755 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -25,11 +25,11 @@ //#include "GameObject.h" //#include "Map.h" -#define OUT_SAVE_INST_DATA sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_SAVE_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_LOAD_INST_DATA(a) sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) -#define OUT_LOAD_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_LOAD_INST_DATA_FAIL sLog->outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_SAVE_INST_DATA sLog->outDebug(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_SAVE_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA(a) sLog->outDebug(LOG_FILTER_TSCR, "Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) +#define OUT_LOAD_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA_FAIL sLog->outError(LOG_FILTER_TSCR, "Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) class Map; class Unit; @@ -131,7 +131,6 @@ typedef std::map MinionInfoMap; class InstanceScript : public ZoneScript { public: - explicit InstanceScript(Map* map) : instance(map), completedEncounters(0) {} virtual ~InstanceScript() {} diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 0520392461f..ddacf64507f 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -121,7 +121,7 @@ uint32 LootStore::LoadLootTable() if (maxcount > std::numeric_limits::max()) { - sLog->outErrorDb("Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits::max()); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits::max()); continue; // error already printed to log/console. } @@ -225,12 +225,12 @@ void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const { // all still listed ids isn't referenced for (LootIdSet::const_iterator itr = lootIdSet.begin(); itr != lootIdSet.end(); ++itr) - sLog->outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); } void LootStore::ReportNotExistedId(uint32 id) const { - sLog->outErrorDb("Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName()); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName()); } // @@ -259,13 +259,13 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const { if (group >= 1 << 7) // it stored in 7 bit field { - sLog->outErrorDb("Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7); return false; } if (mincountOrRef == 0) { - sLog->outErrorDb("Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef); return false; } @@ -274,36 +274,36 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid); if (!proto) { - sLog->outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); return false; } if (chance == 0 && group == 0) // Zero chance is allowed for grouped entries only { - sLog->outErrorDb("Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid); return false; } if (chance != 0 && chance < 0.000001f) // loot with low chance { - sLog->outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped", + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: low chance (%f) - skipped", store.GetName(), entry, itemid, chance); return false; } if (maxcount < mincountOrRef) // wrong max count { - sLog->outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef); return false; } } else // mincountOrRef < 0 { if (needs_quest) - sLog->outErrorDb("Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid); else if (chance == 0) // no chance for the reference { - sLog->outErrorDb("Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid); return false; } } @@ -409,7 +409,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo if (!tab) { if (!noEmptyError) - sLog->outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId); + sLog->outError(LOG_FILTER_SQL, "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId); return false; } @@ -1178,12 +1178,12 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint float chance = RawTotalChance(); if (chance > 101.0f) // TODO: replace with 100% when DBs will be ready { - sLog->outErrorDb("Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance); } if (chance >= 100.0f && !EqualChanced.empty()) { - sLog->outErrorDb("Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance); + sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance); } } @@ -1391,7 +1391,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { if (!cond || !cond->isLoaded())//should never happen, checked at loading { - sLog->outError("LootTemplate::addConditionItem: condition is null"); + sLog->outError(LOG_FILTER_LOOT, "LootTemplate::addConditionItem: condition is null"); return false; } if (!Entries.empty()) @@ -1450,7 +1450,7 @@ bool LootTemplate::isReference(uint32 id) void LoadLootTemplates_Creature() { - sLog->outString("Loading creature loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading creature loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1477,16 +1477,16 @@ void LoadLootTemplates_Creature() LootTemplates_Creature.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Disenchant() { - sLog->outString("Loading disenchanting loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading disenchanting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1512,15 +1512,15 @@ void LoadLootTemplates_Disenchant() LootTemplates_Disenchant.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); + } void LoadLootTemplates_Fishing() { - sLog->outString("Loading fishing loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading fishing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1537,16 +1537,16 @@ void LoadLootTemplates_Fishing() LootTemplates_Fishing.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Gameobject() { - sLog->outString("Loading gameobject loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading gameobject loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1573,16 +1573,16 @@ void LoadLootTemplates_Gameobject() LootTemplates_Gameobject.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Item() { - sLog->outString("Loading item loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading item loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1599,16 +1599,16 @@ void LoadLootTemplates_Item() LootTemplates_Item.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Milling() { - sLog->outString("Loading milling loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading milling loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1630,16 +1630,16 @@ void LoadLootTemplates_Milling() LootTemplates_Milling.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Pickpocketing() { - sLog->outString("Loading pickpocketing loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading pickpocketing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1666,16 +1666,16 @@ void LoadLootTemplates_Pickpocketing() LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Prospecting() { - sLog->outString("Loading prospecting loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading prospecting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1697,16 +1697,16 @@ void LoadLootTemplates_Prospecting() LootTemplates_Prospecting.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Mail() { - sLog->outString("Loading mail loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading mail loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1723,16 +1723,16 @@ void LoadLootTemplates_Mail() LootTemplates_Mail.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Skinning() { - sLog->outString("Loading skinning loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading skinning loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1759,16 +1759,16 @@ void LoadLootTemplates_Skinning() LootTemplates_Skinning.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); - sLog->outString(); + } void LoadLootTemplates_Spell() { - sLog->outString("Loading spell loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading spell loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1803,15 +1803,15 @@ void LoadLootTemplates_Spell() LootTemplates_Spell.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); + } void LoadLootTemplates_Reference() { - sLog->outString("Loading reference loot templates..."); + sLog->outInfo(LOG_FILTER_LOOT, "Loading reference loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1834,6 +1834,6 @@ void LoadLootTemplates_Reference() // output error for any still listed ids (not referenced from any loot table) LootTemplates_Reference.ReportUnusedIds(lootIdSet); - sLog->outString(">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); + } diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index 3c3888eb9f8..929a1d81d57 100755 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -50,7 +50,7 @@ MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery default: m_messageType = MAIL_NORMAL; m_senderId = 0; // will show mail from not existed player - sLog->outError("MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId()); + sLog->outError(LOG_FILTER_GENERAL, "MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId()); break; } } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 270c4c782b6..53b2f9cf437 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -81,14 +81,14 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy) FILE* pf=fopen(tmp, "rb"); if (!pf) - sLog->outError("Map file '%s': does not exist!", tmp); + sLog->outError(LOG_FILTER_MAPS, "Map file '%s': does not exist!", tmp); else { map_fileheader header; if (fread(&header, sizeof(header), 1, pf) == 1) { if (header.mapMagic != MapMagic.asUInt || header.versionMagic != MapVersionMagic.asUInt) - sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp); + sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp); else ret = true; } @@ -108,7 +108,7 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy) if (!exists) { std::string name = vmgr->getDirFileName(mapid, gx, gy); - sLog->outError("VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath()+"vmaps/"+name).c_str()); + sLog->outError(LOG_FILTER_MAPS, "VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath()+"vmaps/"+name).c_str()); return false; } } @@ -124,13 +124,13 @@ void Map::LoadVMap(int gx, int gy) switch (vmapLoadResult) { case VMAP::VMAP_LOAD_RESULT_OK: - sLog->outDetail("VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + sLog->outInfo(LOG_FILTER_MAPS, "VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); break; case VMAP::VMAP_LOAD_RESULT_ERROR: - sLog->outDetail("Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + sLog->outInfo(LOG_FILTER_MAPS, "Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); break; case VMAP::VMAP_LOAD_RESULT_IGNORED: - sLog->outStaticDebug("Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + sLog->outDebug(LOG_FILTER_MAPS, "Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); break; } } @@ -157,7 +157,7 @@ void Map::LoadMap(int gx, int gy, bool reload) //map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?) if (GridMaps[gx][gy]) { - sLog->outDetail("Unloading previously loaded map %u before reloading.", GetId()); + sLog->outInfo(LOG_FILTER_MAPS, "Unloading previously loaded map %u before reloading.", GetId()); sScriptMgr->OnUnloadGridMap(this, GridMaps[gx][gy], gx, gy); delete (GridMaps[gx][gy]); @@ -169,12 +169,12 @@ void Map::LoadMap(int gx, int gy, bool reload) int len = sWorld->GetDataPath().length()+strlen("maps/%03u%02u%02u.map")+1; tmp = new char[len]; snprintf(tmp, len, (char *)(sWorld->GetDataPath()+"maps/%03u%02u%02u.map").c_str(), GetId(), gx, gy); - sLog->outDetail("Loading map %s", tmp); + sLog->outInfo(LOG_FILTER_MAPS, "Loading map %s", tmp); // loading data GridMaps[gx][gy] = new GridMap(); if (!GridMaps[gx][gy]->loadData(tmp)) { - sLog->outError("Error loading map file: \n %s\n", tmp); + sLog->outError(LOG_FILTER_MAPS, "Error loading map file: \n %s\n", tmp); } delete [] tmp; @@ -264,7 +264,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!p.IsCoordValid()) { - sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + sLog->outError(LOG_FILTER_MAPS, "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -272,7 +272,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; - sLog->outStaticDebug("Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); + sLog->outDebug(LOG_FILTER_MAPS, "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(ngrid != NULL); @@ -346,7 +346,7 @@ void Map::EnsureGridLoadedForActiveObject(const Cell &cell, WorldObject* object) // refresh grid state & timer if (grid->GetGridState() != GRID_STATE_ACTIVE) { - sLog->outStaticDebug("Active object "UI64FMTD" triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId()); + sLog->outDebug(LOG_FILTER_MAPS, "Active object "UI64FMTD" triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId()); ResetGridExpiry(*grid, 0.1f); grid->SetGridState(GRID_STATE_ACTIVE); } @@ -387,7 +387,7 @@ bool Map::AddPlayerToMap(Player* player) CellCoord cellCoord = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()); if (!cellCoord.IsCoordValid()) { - sLog->outError("Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + sLog->outError(LOG_FILTER_MAPS, "Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; } @@ -439,7 +439,7 @@ bool Map::AddToMap(T *obj) ASSERT(cellCoord.IsCoordValid()); if (!cellCoord.IsCoordValid()) { - sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + sLog->outError(LOG_FILTER_MAPS, "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; //Should delete object } @@ -449,7 +449,7 @@ bool Map::AddToMap(T *obj) else EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY())); AddToGrid(obj, cell); - sLog->outStaticDebug("Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY()); + sLog->outDebug(LOG_FILTER_MAPS, "Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY()); //Must already be set before AddToMap. Usually during obj->Create. //obj->SetMap(this); @@ -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->outStaticDebug("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(), 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(); @@ -1002,7 +1002,7 @@ bool Map::UnloadGrid(NGridType& ngrid, bool unloadAll) GridMaps[gx][gy] = NULL; } - sLog->outStaticDebug("Unloading grid[%u, %u] for map %u finished", x, y, GetId()); + sLog->outDebug(LOG_FILTER_MAPS, "Unloading grid[%u, %u] for map %u finished", x, y, GetId()); return true; } @@ -1016,7 +1016,7 @@ void Map::RemoveAllPlayers() if (!player->IsBeingTeleportedFar()) { // this is happening for bg - sLog->outError("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(), GetId()); player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); } } @@ -1089,28 +1089,28 @@ bool GridMap::loadData(char *filename) // loadup area data if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize)) { - sLog->outError("Error loading map area data\n"); + sLog->outError(LOG_FILTER_MAPS, "Error loading map area data\n"); fclose(in); return false; } // loadup height data if (header.heightMapOffset && !loadHeihgtData(in, header.heightMapOffset, header.heightMapSize)) { - sLog->outError("Error loading map height data\n"); + sLog->outError(LOG_FILTER_MAPS, "Error loading map height data\n"); fclose(in); return false; } // loadup liquid data if (header.liquidMapOffset && !loadLiquidData(in, header.liquidMapOffset, header.liquidMapSize)) { - sLog->outError("Error loading map liquids data\n"); + sLog->outError(LOG_FILTER_MAPS, "Error loading map liquids data\n"); fclose(in); return false; } fclose(in); return true; } - sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", filename); + sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", filename); fclose(in); return false; } @@ -1700,7 +1700,7 @@ bool Map::IsOutdoors(float x, float y, float z) const WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); if (wmoEntry) { - sLog->outStaticDebug("Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId); + sLog->outDebug(LOG_FILTER_MAPS, "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId); atEntry = GetAreaEntryByAreaID(wmoEntry->areaId); } return IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry); @@ -1987,7 +1987,7 @@ void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpa void Map::SendInitSelf(Player* player) { - sLog->outDetail("Creating player data for himself %u", player->GetGUIDLow()); + sLog->outInfo(LOG_FILTER_MAPS, "Creating player data for himself %u", player->GetGUIDLow()); UpdateData data; @@ -2071,7 +2071,7 @@ inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y) { if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS) { - sLog->outError("map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y); + sLog->outError(LOG_FILTER_MAPS, "map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y); ASSERT(false); } i_grids[x][y] = grid; @@ -2144,7 +2144,7 @@ void Map::RemoveAllObjectsInRemoveList() { Corpse* corpse = ObjectAccessor::GetCorpse(*obj, obj->GetGUID()); if (!corpse) - sLog->outError("Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow()); + sLog->outError(LOG_FILTER_MAPS, "Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow()); else RemoveFromMap(corpse, true); break; @@ -2162,7 +2162,7 @@ void Map::RemoveAllObjectsInRemoveList() RemoveFromMap(obj->ToCreature(), true); break; default: - sLog->outError("Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId()); + sLog->outError(LOG_FILTER_MAPS, "Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId()); break; } @@ -2239,7 +2239,7 @@ void Map::AddToActive(Creature* c) else { GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); - sLog->outError("Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.", + sLog->outError(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.", c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } } @@ -2260,7 +2260,7 @@ void Map::RemoveFromActive(Creature* c) else { GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); - sLog->outError("Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.", + sLog->outError(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.", c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } } @@ -2311,7 +2311,7 @@ bool InstanceMap::CanEnter(Player* player) { if (player->GetMapRef().getTarget() == this) { - sLog->outError("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(), 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->outDetail("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()); player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); return false; } @@ -2394,7 +2394,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!mapSave) { - sLog->outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); + sLog->outInfo(LOG_FILTER_MAPS, "InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); mapSave = sInstanceSaveMgr->AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true); } @@ -2405,7 +2405,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // cannot enter other instances if bound permanently if (playerBind->save != mapSave) { - sLog->outError("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(), 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,9 +2417,9 @@ bool InstanceMap::AddPlayerToMap(Player* player) InstanceGroupBind* groupBind = group->GetBoundInstance(this); if (playerBind) { - sLog->outError("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(), 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("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()); + 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); return false; } @@ -2431,15 +2431,15 @@ bool InstanceMap::AddPlayerToMap(Player* player) // cannot jump to a different instance without resetting it if (groupBind->save != mapSave) { - sLog->outError("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(), 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("MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount()); + sLog->outError(LOG_FILTER_MAPS, "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount()); else - sLog->outError("MapSave NULL"); + sLog->outError(LOG_FILTER_MAPS, "MapSave NULL"); if (groupBind->save) - sLog->outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); + sLog->outError(LOG_FILTER_MAPS, "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); else - sLog->outError("GroupBind save NULL"); + sLog->outError(LOG_FILTER_MAPS, "GroupBind save NULL"); return false; } // if the group/leader is permanently bound to the instance @@ -2478,7 +2478,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // first player enters (no players yet) SetResetSchedule(false); - sLog->outDetail("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(), 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->outDetail("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(), 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("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(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId()); return; } @@ -2653,7 +2653,7 @@ void InstanceMap::SetResetSchedule(bool on) if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId())) sInstanceSaveMgr->ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId())); else - sLog->outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)", + sLog->outError(LOG_FILTER_MAPS, "InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)", on ? "on" : "off", GetId(), GetMapName(), GetInstanceId(), Difficulty(GetSpawnMode())); } } @@ -2715,7 +2715,7 @@ bool BattlegroundMap::CanEnter(Player* player) { if (player->GetMapRef().getTarget() == this) { - sLog->outError("BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow()); + sLog->outError(LOG_FILTER_MAPS, "BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow()); ASSERT(false); return false; } @@ -2743,7 +2743,7 @@ bool BattlegroundMap::AddPlayerToMap(Player* player) void BattlegroundMap::RemovePlayerFromMap(Player* player, bool remove) { - sLog->outDetail("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(), GetInstanceId(), GetMapName()); Map::RemovePlayerFromMap(player, remove); } diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 2c1bdb00834..5fcca05361b 100755 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -193,13 +193,13 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, const MapEntry* entry = sMapStore.LookupEntry(GetId()); if (!entry) { - sLog->outError("CreateInstance: no entry for map %d", GetId()); + sLog->outError(LOG_FILTER_MAPS, "CreateInstance: no entry for map %d", GetId()); ASSERT(false); } const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { - sLog->outError("CreateInstance: no instance template for map %d", GetId()); + sLog->outError(LOG_FILTER_MAPS, "CreateInstance: no instance template for map %d", GetId()); ASSERT(false); } diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index e9de3ae001f..b49d7db0a27 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -77,7 +77,7 @@ void MapManager::checkAndCorrectGridStatesArray() { if (i_GridStates[i] != si_GridStates[i]) { - sLog->outError("MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!"); + sLog->outError(LOG_FILTER_MAPS, "MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!"); ok = false; si_GridStates[i] = i_GridStates[i]; } @@ -411,7 +411,7 @@ uint32 MapManager::GenerateInstanceId() if (newInstanceId == _nextInstanceId) { - sLog->outError("Instance ID overflow!! Can't continue, shutting down server. "); + sLog->outError(LOG_FILTER_MAPS, "Instance ID overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index bf00514000e..dac5b1ef9a2 100755 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -127,7 +127,7 @@ namespace Trinity nBaseExp = 580; break; default: - sLog->outError("BaseGain: Unsupported content level %u", content); + sLog->outError(LOG_FILTER_GENERAL, "BaseGain: Unsupported content level %u", content); nBaseExp = 45; break; } diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index cde176443f0..26e83773228 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -189,7 +189,7 @@ void MotionMaster::MoveRandom(float spawndist) { if (_owner->GetTypeId() == TYPEID_UNIT) { - sLog->outStaticDebug("Creature (GUID: %u) start moving random", _owner->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (GUID: %u) start moving random", _owner->GetGUIDLow()); Mutate(new RandomMovementGenerator(spawndist), MOTION_SLOT_IDLE); } } @@ -200,22 +200,22 @@ void MotionMaster::MoveTargetedHome() if (_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)_owner)->GetCharmerOrOwnerGUID()) { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow()); Mutate(new HomeMovementGenerator(), MOTION_SLOT_ACTIVE); } else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID()) { - sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_GENERAL, "Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow()); Unit *target = ((Creature*)_owner)->GetCharmerOrOwner(); if (target) { - sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow()); + sLog->outDebug(LOG_FILTER_GENERAL, "Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE); } } else { - sLog->outError("Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow()); + sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow()); } } @@ -223,12 +223,12 @@ void MotionMaster::MoveConfused() { if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) move confused", _owner->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) move confused", _owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator(), MOTION_SLOT_CONTROLLED); } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) move confused", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) move confused", _owner->GetEntry(), _owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator(), MOTION_SLOT_CONTROLLED); } @@ -243,7 +243,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) //_owner->ClearUnitState(UNIT_STATE_FOLLOW); if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)", + sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) chase to %s (GUID: %u)", _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -251,7 +251,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -268,14 +268,14 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo //_owner->AddUnitState(UNIT_STATE_FOLLOW); if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(), + sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator(*target,dist,angle), slot); } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -287,12 +287,12 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z) { if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z); + sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator(id, x, y, z), MOTION_SLOT_ACTIVE); } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator(id, x, y, z), MOTION_SLOT_ACTIVE); } @@ -303,7 +303,7 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos) float x, y, z; pos.GetPosition(x, y, z); - sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); @@ -317,7 +317,7 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos) float x, y, z; pos.GetPosition(x, y, z); - sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); @@ -364,7 +364,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id) { - sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); + sLog->outDebug(LOG_FILTER_GENERAL, "Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); float moveTimeHalf = speedZ / Movement::gravity; float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ); @@ -383,7 +383,7 @@ void MotionMaster::MoveFall(uint32 id/*=0*/) float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE); if (tz <= INVALID_HEIGHT) { - sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", + sLog->outDebug(LOG_FILTER_GENERAL, "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ()); return; } @@ -412,12 +412,12 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id) if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); + sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator(id, x, y, z, speed), MOTION_SLOT_CONTROLLED); } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator(id, x, y, z, speed), MOTION_SLOT_CONTROLLED); } @@ -427,11 +427,11 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z) { if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outError("Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow()); + sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow()); } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); _owner->AttackStop(); _owner->ToCreature()->SetReactState(REACT_PASSIVE); @@ -443,11 +443,11 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time) { if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outError("Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow()); + sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow()); } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), time); Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE); } @@ -463,14 +463,14 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(), + sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow()); Mutate(new FleeingMovementGenerator(enemy->GetGUID()), MOTION_SLOT_CONTROLLED); } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s", _owner->GetEntry(), _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(), @@ -488,19 +488,19 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) { if (path < sTaxiPathNodesByPath.size()) { - sLog->outStaticDebug("%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(), path, pathnode); FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode); Mutate(mgen, MOTION_SLOT_CONTROLLED); } else { - sLog->outError("%s attempt taxi to (not existed Path %u node %u)", + sLog->outError(LOG_FILTER_GENERAL, "%s attempt taxi to (not existed Path %u node %u)", _owner->GetName(), path, pathnode); } } else { - sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", + sLog->outError(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", _owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode); } } @@ -512,11 +512,11 @@ void MotionMaster::MoveDistract(uint32 timer) if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer); + sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer); } else { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) (timer: %u)", + sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) (timer: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), timer); } @@ -568,7 +568,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) //Mutate(new WaypointMovementGenerator(path_id, repeatable)): Mutate(new WaypointMovementGenerator(path_id, repeatable), MOTION_SLOT_IDLE); - sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", + sLog->outDebug(LOG_FILTER_GENERAL, "%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO"); } @@ -627,7 +627,7 @@ void MotionMaster::DirectDelete(_Ty curr) void MotionMaster::DelayedDelete(_Ty curr) { - sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType()); + sLog->outFatal(LOG_FILTER_GENERAL, "Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType()); if (isStatic(curr)) return; if (!_expList) diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 25730f92161..12b85b10922 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -41,7 +41,7 @@ void WaypointMovementGenerator::LoadPath(Creature &creature) if (!i_path) { // No movement found for entry - sLog->outErrorDb("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(), creature.GetEntry(), creature.GetGUIDLow(), path_id); return; } @@ -314,11 +314,11 @@ void FlightPathMovementGenerator::PreloadEndGrid() // Load the grid if (endMap) { - sLog->outDetail("Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1)); + sLog->outInfo(LOG_FILTER_GENERAL, "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1)); endMap->LoadGrid(_endGridX, _endGridY); } else - sLog->outDetail("Unable to determine map to preload flightmaster grid"); + sLog->outInfo(LOG_FILTER_GENERAL, "Unable to determine map to preload flightmaster grid"); } diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index b1c25aedfd7..61bd3900b9d 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -153,7 +153,7 @@ void MoveSpline::init_spline(const MoveSplineInitArgs& args) // TODO: what to do in such cases? problem is in input data (all points are at same coords) if (spline.length() < minimal_duration) { - sLog->outError("MoveSpline::init_spline: zero length spline, wrong input data?"); + sLog->outError(LOG_FILTER_GENERAL, "MoveSpline::init_spline: zero length spline, wrong input data?"); spline.set_length(spline.last(), spline.isCyclic() ? 1000 : 1); } point_Idx = spline.first(); @@ -199,7 +199,7 @@ bool MoveSplineInitArgs::Validate() const #define CHECK(exp) \ if (!(exp))\ {\ - sLog->outError("MoveSplineInitArgs::Validate: expression '%s' failed", #exp);\ + sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::Validate: expression '%s' failed", #exp);\ return false;\ } CHECK(path.size() > 1); @@ -226,7 +226,7 @@ bool MoveSplineInitArgs::_checkPathBounds() const offset = path[i] - middle; if (fabs(offset.x) >= MAX_OFFSET || fabs(offset.y) >= MAX_OFFSET || fabs(offset.z) >= MAX_OFFSET) { - sLog->outError("MoveSplineInitArgs::_checkPathBounds check failed"); + sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::_checkPathBounds check failed"); return false; } } diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 296c9eee50f..a23c84b0134 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -48,8 +48,8 @@ void WaypointMgr::Load() if (!result) { - sLog->outErrorDb(">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); + return; } @@ -86,8 +86,8 @@ void WaypointMgr::Load() } while (result->NextRow()); - sLog->outString(">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void WaypointMgr::ReloadPath(uint32 id) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index dfdd4fc4ffc..4db35d5bc79 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -123,7 +123,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { - sLog->outError("OutdoorPvP: GO %u is not capture point!", entry); + sLog->outError(LOG_FILTER_OUTDOORPVP, "OutdoorPvP: GO %u is not capture point!", entry); return false; } @@ -382,7 +382,7 @@ bool OPvPCapturePoint::Update(uint32 diff) if (m_OldState != m_State) { - //sLog->outError("%u->%u", m_OldState, m_State); + //sLog->outError(LOG_FILTER_OUTDOORPVP, "%u->%u", m_OldState, m_State); if (oldTeam != m_team) ChangeTeam(oldTeam); ChangeState(); diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index a079d2f643b..3da3efe4823 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -46,8 +46,8 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (!result) { - sLog->outErrorDb(">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); + return; } @@ -65,7 +65,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (typeId >= MAX_OUTDOORPVP_TYPES) { - sLog->outErrorDb("Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId); + sLog->outError(LOG_FILTER_SQL, "Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId); continue; } @@ -85,20 +85,20 @@ void OutdoorPvPMgr::InitOutdoorPvP() OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i)); if (iter == m_OutdoorPvPDatas.end()) { - sLog->outErrorDb("Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i)); + sLog->outError(LOG_FILTER_SQL, "Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i)); continue; } pvp = sScriptMgr->CreateOutdoorPvP(iter->second); if (!pvp) { - sLog->outError("Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i)); + sLog->outError(LOG_FILTER_OUTDOORPVP, "Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i)); continue; } if (!pvp->SetupOutdoorPvP()) { - sLog->outError("Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i)); + sLog->outError(LOG_FILTER_OUTDOORPVP, "Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i)); delete pvp; continue; } @@ -106,8 +106,8 @@ void OutdoorPvPMgr::InitOutdoorPvP() m_OutdoorPvPSet.push_back(pvp); } - sLog->outString(">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_OUTDOORPVP, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle) diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index d8548b552d3..6ee70101af7 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -571,8 +571,7 @@ void PoolMgr::LoadFromDB() if (!result) { mPoolTemplate.clear(); - sLog->outString(">> Loaded 0 object pools. DB table `pool_template` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 object pools. DB table `pool_template` is empty."); return; } @@ -590,13 +589,12 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Creatures - sLog->outString("Loading Creatures Pooling Data..."); + sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Creatures Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -605,8 +603,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); } else { @@ -622,17 +619,17 @@ void PoolMgr::LoadFromDB() CreatureData const* data = sObjectMgr->GetCreatureData(guid); if (!data) { - sLog->outErrorDb("`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); continue; } if (pool_id > max_pool_id) { - sLog->outErrorDb("`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); continue; } if (chance < 0 || chance > 100) { - sLog->outErrorDb("`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id]; @@ -647,14 +644,13 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Gameobjects - sLog->outString("Loading Gameobject Pooling Data..."); + sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Gameobject Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -663,8 +659,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); } else { @@ -680,7 +675,7 @@ void PoolMgr::LoadFromDB() GameObjectData const* data = sObjectMgr->GetGOData(guid); if (!data) { - sLog->outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); continue; } @@ -689,19 +684,19 @@ void PoolMgr::LoadFromDB() goinfo->type != GAMEOBJECT_TYPE_GOOBER && goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE) { - sLog->outErrorDb("`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); continue; } if (pool_id > max_pool_id) { - sLog->outErrorDb("`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); continue; } if (chance < 0 || chance > 100) { - sLog->outErrorDb("`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } @@ -717,14 +712,13 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Pool of pools - sLog->outString("Loading Mother Pooling Data..."); + sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Mother Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -733,8 +727,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 pools in pools"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 pools in pools"); } else { @@ -749,22 +742,22 @@ void PoolMgr::LoadFromDB() if (mother_pool_id > max_pool_id) { - sLog->outErrorDb("`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id); continue; } if (child_pool_id > max_pool_id) { - sLog->outErrorDb("`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id); continue; } if (mother_pool_id == child_pool_id) { - sLog->outErrorDb("`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id); continue; } if (chance < 0 || chance > 100) { - sLog->outErrorDb("`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id); continue; } PoolTemplateData* pPoolTemplateMother = &mPoolTemplate[mother_pool_id]; @@ -794,7 +787,7 @@ void PoolMgr::LoadFromDB() ss << *itr << ' '; ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool " << poolItr->first << " and child pool " << poolItr->second; - sLog->outErrorDb("%s", ss.str().c_str()); + sLog->outError(LOG_FILTER_SQL, "%s", ss.str().c_str()); mPoolPoolGroups[poolItr->second].RemoveOneRelation(poolItr->first); mPoolSearchMap.erase(poolItr); --count; @@ -803,12 +796,11 @@ void PoolMgr::LoadFromDB() } } - sLog->outString(">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outString("Loading Quest Pooling Data..."); + sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Quest Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -817,8 +809,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 quests in pools"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 quests in pools"); } else { @@ -844,19 +835,19 @@ void PoolMgr::LoadFromDB() Quest const* quest = sObjectMgr->GetQuestTemplate(entry); if (!quest) { - sLog->outErrorDb("`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id); continue; } if (pool_id > max_pool_id) { - sLog->outErrorDb("`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); continue; } if (!quest->IsDailyOrWeekly()) { - sLog->outErrorDb("`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id); continue; } @@ -867,7 +858,7 @@ void PoolMgr::LoadFromDB() if (poolTypeMap[pool_id] != currType) { - sLog->outErrorDb("`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.", + sLog->outError(LOG_FILTER_SQL, "`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.", entry, currType == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY", pool_id, poolTypeMap[pool_id] == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY"); continue; } @@ -877,7 +868,7 @@ void PoolMgr::LoadFromDB() if (creBounds.first == creBounds.second && goBounds.first == goBounds.second) { - sLog->outErrorDb("`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id); + sLog->outError(LOG_FILTER_SQL, "`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id); continue; } @@ -893,13 +884,12 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outString(">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks - sLog->outString("Starting objects pooling system..."); + sLog->outInfo(LOG_FILTER_POOLSYS, "Starting objects pooling system..."); { uint32 oldMSTime = getMSTime(); @@ -909,8 +899,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Pool handling system initialized, 0 pools spawned."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_POOLSYS, ">> Pool handling system initialized, 0 pools spawned."); } else { @@ -926,9 +915,9 @@ void PoolMgr::LoadFromDB() if (pool_pool_id) // The pool is a child pool in pool_pool table. Ideally we should remove it from the pool handler to ensure it never gets spawned, // however that could recursively invalidate entire chain of mother pools. It can be done in the future but for now we'll do nothing. - sLog->outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32()); + sLog->outError(LOG_FILTER_SQL, "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32()); else - sLog->outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry); + sLog->outError(LOG_FILTER_SQL, "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry); continue; } @@ -941,8 +930,8 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outBasic("Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outDebug(LOG_FILTER_POOLSYS, "Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } } diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 94a6590cc4a..05b224fb024 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("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(), faction_id); return 0; } @@ -68,7 +68,7 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const if (!factionEntry) { - sLog->outError("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(), faction_id); return 0; } diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 5387a3132c6..517ea6cb6bd 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -102,7 +102,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe { Player* player = NULL; if (!source && !target) - sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else { // Check target first, then source. @@ -112,7 +112,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe player = source->ToPlayer(); if (!player) - sLog->outError("%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0, target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0); @@ -124,7 +124,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t { Creature* creature = NULL; if (!source && !target) - sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else { if (bReverse) @@ -145,7 +145,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t } if (!creature) - sLog->outError("%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0, target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0); @@ -157,15 +157,15 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s { Unit* unit = NULL; if (!obj) - sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else if (!obj->isType(TYPEMASK_UNIT)) - sLog->outError("%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); else { unit = obj->ToUnit(); if (!unit) - sLog->outError("%s %s object could not be casted to unit.", + sLog->outError(LOG_FILTER_TSCR, "%s %s object could not be casted to unit.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); } return unit; @@ -175,12 +175,12 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf { Player* player = NULL; if (!obj) - sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { player = obj->ToPlayer(); if (!player) - sLog->outError("%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).", + sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return player; @@ -190,12 +190,12 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip { Creature* creature = NULL; if (!obj) - sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { creature = obj->ToCreature(); if (!creature) - sLog->outError("%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), + sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return creature; @@ -205,13 +205,13 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const { WorldObject* pWorldObject = NULL; if (!obj) - sLog->outError("%s %s object is NULL.", + sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { pWorldObject = dynamic_cast(obj); if (!pWorldObject) - sLog->outError("%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).", + sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return pWorldObject; @@ -227,29 +227,29 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script case SCRIPT_COMMAND_OPEN_DOOR: bOpen = true; break; case SCRIPT_COMMAND_CLOSE_DOOR: break; default: - sLog->outError("%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str()); return; } if (!guid) - sLog->outError("%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str()); else if (!source) - sLog->outError("%s source object is NULL.", scriptInfo->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s source object is NULL.", scriptInfo->GetDebugInfo().c_str()); else if (!source->isType(TYPEMASK_UNIT)) - sLog->outError("%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), + sLog->outError(LOG_FILTER_TSCR, "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else { WorldObject* wSource = dynamic_cast (source); if (!wSource) - sLog->outError("%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else { GameObject* pDoor = _FindGameObject(wSource, guid); if (!pDoor) - sLog->outError("%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid); + sLog->outError(LOG_FILTER_TSCR, "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid); else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR) - sLog->outError("%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).", + sLog->outError(LOG_FILTER_TSCR, "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUIDLow()); else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY)) { @@ -331,7 +331,7 @@ void Map::ScriptsProcess() } break; default: - sLog->outError("%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", + sLog->outError(LOG_FILTER_TSCR, "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID)); break; } @@ -359,7 +359,7 @@ void Map::ScriptsProcess() target = HashMapHolder::Find(step.targetGUID); break; default: - sLog->outError("%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", + sLog->outError(LOG_FILTER_TSCR, "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID)); break; } @@ -370,7 +370,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_TALK: if (step.script->Talk.ChatType > CHAT_TYPE_WHISPER && step.script->Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER) { - sLog->outError("%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType); + sLog->outError(LOG_FILTER_TSCR, "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType); break; } if (step.script->Talk.Flags & SF_TALK_USE_PLAYER) @@ -397,7 +397,7 @@ void Map::ScriptsProcess() { uint64 targetGUID = target ? target->GetGUID() : 0; if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else player->Whisper(text, LANG_UNIVERSAL, targetGUID); break; @@ -429,13 +429,13 @@ void Map::ScriptsProcess() break; case CHAT_TYPE_WHISPER: if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else cSource->Whisper(step.script->Talk.TextID, targetGUID); break; case CHAT_MSG_RAID_BOSS_WHISPER: if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - sLog->outError("%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else cSource->MonsterWhisper(step.script->Talk.TextID, targetGUID, true); break; @@ -463,7 +463,7 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount()) - sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID, cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); else @@ -492,7 +492,7 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount()) - sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID, source->GetValuesCount(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else @@ -506,7 +506,7 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount()) - sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID, source->GetValuesCount(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else @@ -533,12 +533,12 @@ void Map::ScriptsProcess() { if (!source) { - sLog->outError("%s source object is NULL.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s source object is NULL.", step.script->GetDebugInfo().c_str()); break; } if (!target) { - sLog->outError("%s target object is NULL.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s target object is NULL.", step.script->GetDebugInfo().c_str()); break; } @@ -549,7 +549,7 @@ void Map::ScriptsProcess() { if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER) { - sLog->outError("%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); break; } @@ -562,7 +562,7 @@ void Map::ScriptsProcess() { if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER) { - sLog->outError("%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; } @@ -570,7 +570,7 @@ void Map::ScriptsProcess() } else { - sLog->outError("%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; @@ -601,7 +601,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: if (!step.script->RespawnGameobject.GOGuid) { - sLog->outError("%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str()); break; } @@ -611,7 +611,7 @@ void Map::ScriptsProcess() GameObject* pGO = _FindGameObject(pSummoner, step.script->RespawnGameobject.GOGuid); if (!pGO) { - sLog->outError("%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid); + sLog->outError(LOG_FILTER_TSCR, "%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid); break; } @@ -620,7 +620,7 @@ void Map::ScriptsProcess() pGO->GetGoType() == GAMEOBJECT_TYPE_BUTTON || pGO->GetGoType() == GAMEOBJECT_TYPE_TRAP) { - sLog->outError("%s can not be used with gameobject of type %u (guid: %u).", + sLog->outError(LOG_FILTER_TSCR, "%s can not be used with gameobject of type %u (guid: %u).", step.script->GetDebugInfo().c_str(), uint32(pGO->GetGoType()), step.script->RespawnGameobject.GOGuid); break; } @@ -643,7 +643,7 @@ void Map::ScriptsProcess() if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script)) { if (!step.script->TempSummonCreature.CreatureEntry) - sLog->outError("%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str()); else { float x = step.script->TempSummonCreature.PosX; @@ -652,7 +652,7 @@ void Map::ScriptsProcess() float o = step.script->TempSummonCreature.Orientation; if (!pSummoner->SummonCreature(step.script->TempSummonCreature.CreatureEntry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->TempSummonCreature.DespawnDelay)) - sLog->outError("%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry); + sLog->outError(LOG_FILTER_TSCR, "%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry); } } break; @@ -670,13 +670,13 @@ void Map::ScriptsProcess() // Target must be GameObject. if (!target) { - sLog->outError("%s target object is NULL.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s target object is NULL.", step.script->GetDebugInfo().c_str()); break; } if (target->GetTypeId() != TYPEID_GAMEOBJECT) { - sLog->outError("%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.", + sLog->outError(LOG_FILTER_TSCR, "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; } @@ -700,7 +700,7 @@ void Map::ScriptsProcess() // TODO: Allow gameobjects to be targets and casters if (!source && !target) { - sLog->outError("%s source and target objects are NULL.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", step.script->GetDebugInfo().c_str()); break; } @@ -733,13 +733,13 @@ void Map::ScriptsProcess() if (!uSource || !uSource->isType(TYPEMASK_UNIT)) { - sLog->outError("%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); + sLog->outError(LOG_FILTER_TSCR, "%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); break; } if (!uTarget || !uTarget->isType(TYPEMASK_UNIT)) { - sLog->outError("%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); + sLog->outError(LOG_FILTER_TSCR, "%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); break; } @@ -799,7 +799,7 @@ void Map::ScriptsProcess() if (Unit* unit = _GetScriptUnit(source, true, step.script)) { if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID)) - sLog->outError("%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID); + sLog->outError(LOG_FILTER_TSCR, "%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID); else unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); } @@ -809,12 +809,12 @@ void Map::ScriptsProcess() { if (!step.script->CallScript.CreatureEntry) { - sLog->outError("%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str()); break; } if (!step.script->CallScript.ScriptID) { - sLog->outError("%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str()); break; } @@ -840,7 +840,7 @@ void Map::ScriptsProcess() if (!cTarget) { - sLog->outError("%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry); + sLog->outError(LOG_FILTER_TSCR, "%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry); break; } @@ -849,7 +849,7 @@ void Map::ScriptsProcess() //if no scriptmap present... if (!datamap) { - sLog->outError("%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType); + sLog->outError(LOG_FILTER_TSCR, "%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType); break; } @@ -863,7 +863,7 @@ void Map::ScriptsProcess() if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { if (cSource->isDead()) - sLog->outError("%s creature is already dead (Entry: %u, GUID: %u)", + sLog->outError(LOG_FILTER_TSCR, "%s creature is already dead (Entry: %u, GUID: %u)", step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUIDLow()); else { @@ -919,7 +919,7 @@ void Map::ScriptsProcess() break; default: - sLog->outError("Unknown script command %s.", step.script->GetDebugInfo().c_str()); + sLog->outError(LOG_FILTER_TSCR, "Unknown script command %s.", step.script->GetDebugInfo().c_str()); break; } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index b6381594145..0ce3878db96 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -54,7 +54,7 @@ class ScriptRegistry { if (it->second == script) { - sLog->outError("Script '%s' has same memory pointer as '%s'.", + sLog->outError(LOG_FILTER_TSCR, "Script '%s' has same memory pointer as '%s'.", script->GetName().c_str(), it->second->GetName().c_str()); return; @@ -90,7 +90,7 @@ class ScriptRegistry else { // If the script is already assigned -> delete it! - sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.", + sLog->outError(LOG_FILTER_TSCR, "Script '%s' already assigned with the same script name, so the script can't work.", script->GetName().c_str()); ASSERT(false); // Error that should be fixed ASAP. @@ -100,7 +100,7 @@ class ScriptRegistry { // The script uses a script name from database, but isn't assigned to anything. if (script->GetName().find("example") == std::string::npos && script->GetName().find("Smart") == std::string::npos) - sLog->outErrorDb("Script named '%s' does not have a script name assigned in database.", + sLog->outError(LOG_FILTER_SQL, "Script named '%s' does not have a script name assigned in database.", script->GetName().c_str()); } } @@ -162,13 +162,13 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) { if (!pSource) { - sLog->outError("TSCR: DoScriptText entry %i, invalid Source pointer.", iTextEntry); + sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i, invalid Source pointer.", iTextEntry); return; } if (iTextEntry >= 0) { - sLog->outError("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); + sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); return; } @@ -176,18 +176,18 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) if (!pData) { - sLog->outError("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); + sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); return; } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote); + sLog->outDebug(LOG_FILTER_TSCR, "DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote); if (pData->uiSoundId) { if (sSoundEntriesStore.LookupEntry(pData->uiSoundId)) pSource->SendPlaySound(pData->uiSoundId, false); else - sLog->outError("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); + sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); } if (pData->uiEmote) @@ -195,7 +195,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) ((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote); else - sLog->outError("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId()); + sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId()); } switch (pData->uiType) @@ -217,7 +217,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) if (target && target->GetTypeId() == TYPEID_PLAYER) pSource->MonsterWhisper(iTextEntry, target->GetGUID()); else - sLog->outError("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); + sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); break; } @@ -226,7 +226,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) if (target && target->GetTypeId() == TYPEID_PLAYER) pSource->MonsterWhisper(iTextEntry, target->GetGUID(), true); else - sLog->outError("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); + sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); break; } @@ -251,13 +251,13 @@ void ScriptMgr::Initialize() LoadDatabase(); - sLog->outString("Loading C++ scripts"); + sLog->outInfo(LOG_FILTER_TSCR, "Loading C++ scripts"); FillSpellSummary(); AddScripts(); - sLog->outString(">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); + } void ScriptMgr::Unload() @@ -1443,7 +1443,7 @@ WorldMapScript::WorldMapScript(const char* name, uint32 mapId) : ScriptObject(name), MapScript(mapId) { if (GetEntry() && !GetEntry()->IsWorldMap()) - sLog->outError("WorldMapScript for map %u is invalid.", mapId); + sLog->outError(LOG_FILTER_TSCR, "WorldMapScript for map %u is invalid.", mapId); ScriptRegistry::AddScript(this); } @@ -1452,7 +1452,7 @@ InstanceMapScript::InstanceMapScript(const char* name, uint32 mapId) : ScriptObject(name), MapScript(mapId) { if (GetEntry() && !GetEntry()->IsDungeon()) - sLog->outError("InstanceMapScript for map %u is invalid.", mapId); + sLog->outError(LOG_FILTER_TSCR, "InstanceMapScript for map %u is invalid.", mapId); ScriptRegistry::AddScript(this); } @@ -1461,7 +1461,7 @@ BattlegroundMapScript::BattlegroundMapScript(const char* name, uint32 mapId) : ScriptObject(name), MapScript(mapId) { if (GetEntry() && !GetEntry()->IsBattleground()) - sLog->outError("BattlegroundMapScript for map %u is invalid.", mapId); + sLog->outError(LOG_FILTER_TSCR, "BattlegroundMapScript for map %u is invalid.", mapId); ScriptRegistry::AddScript(this); } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index b3d445af0c6..3c2ee81afff 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -314,7 +314,7 @@ template class MapScript : public UpdatableScript : _mapEntry(sMapStore.LookupEntry(mapId)) { if (!_mapEntry) - sLog->outError("Invalid MapScript for %u; no such map ID.", mapId); + sLog->outError(LOG_FILTER_TSCR, "Invalid MapScript for %u; no such map ID.", mapId); } public: diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index fb954662525..6337a358866 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -25,10 +25,10 @@ ScriptPointVector const SystemMgr::_empty; void SystemMgr::LoadScriptTexts() { - sLog->outString("TSCR: Loading Script Texts..."); + sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts..."); LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2)); - sLog->outString("TSCR: Loading Script Texts additional data..."); + sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts additional data..."); uint32 oldMSTime = getMSTime(); // 0 1 2 3 @@ -36,8 +36,8 @@ void SystemMgr::LoadScriptTexts() if (!result) { - sLog->outString(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); + return; } @@ -56,50 +56,50 @@ void SystemMgr::LoadScriptTexts() if (iId >= 0) { - sLog->outErrorDb("TSCR: Entry %i in table `script_texts` is not a negative value.", iId); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is not a negative value.", iId); continue; } if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2) { - sLog->outErrorDb("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId); continue; } if (temp.uiSoundId) { if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) - sLog->outErrorDb("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); } if (!GetLanguageDescByID(temp.uiLanguage)) - sLog->outErrorDb("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage); if (temp.uiType > CHAT_TYPE_ZONE_YELL) - sLog->outErrorDb("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType); m_mTextDataMap[iId] = temp; ++uiCount; } while (result->NextRow()); - sLog->outString(">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); + } void SystemMgr::LoadScriptTextsCustom() { - sLog->outString("TSCR: Loading Custom Texts..."); + sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts..."); LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3)); - sLog->outString("TSCR: Loading Custom Texts additional data..."); + sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts additional data..."); QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts"); if (!result) { - sLog->outString(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); + return; } @@ -118,35 +118,35 @@ void SystemMgr::LoadScriptTextsCustom() if (iId >= 0) { - sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is not a negative value.", iId); continue; } if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3) { - sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId); continue; } if (temp.uiSoundId) { if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) - sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); } if (!GetLanguageDescByID(temp.uiLanguage)) - sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage); if (temp.uiType > CHAT_TYPE_ZONE_YELL) - sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType); + sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType); m_mTextDataMap[iId] = temp; ++uiCount; } while (result->NextRow()); - sLog->outString(">> Loaded %u additional Custom Texts data.", uiCount); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Custom Texts data.", uiCount); + } void SystemMgr::LoadScriptWaypoints() @@ -163,15 +163,15 @@ void SystemMgr::LoadScriptWaypoints() if (result) uiCreatureCount = result->GetRowCount(); - sLog->outString("TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); + sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); // 0 1 2 3 4 5 result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); if (!result) { - sLog->outString(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); + return; } @@ -194,18 +194,18 @@ void SystemMgr::LoadScriptWaypoints() if (!pCInfo) { - sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry); + sLog->outError(LOG_FILTER_SQL, "TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry); continue; } if (!pCInfo->ScriptID) - sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry); + sLog->outError(LOG_FILTER_SQL, "TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry); m_mPointMoveMap[uiEntry].push_back(temp); ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp deleted file mode 100644 index cb6dcdbdb9e..00000000000 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * - * 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 . - */ - -#include "PacketLog.h" -#include "Config.h" -#include "ByteBuffer.h" -#include "WorldPacket.h" - -PacketLog::PacketLog() : _file(NULL) -{ - Initialize(); -} - -PacketLog::~PacketLog() -{ - if (_file) - fclose(_file); - - _file = NULL; -} - -void PacketLog::Initialize() -{ - std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); - - if (!logsDir.empty()) - if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\')) - logsDir.push_back('/'); - - std::string logname = ConfigMgr::GetStringDefault("PacketLogFile", ""); - if (!logname.empty()) - _file = fopen((logsDir + logname).c_str(), "wb"); -} - -void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) -{ - ByteBuffer data(4+4+4+1+packet.size()); - data << int32(packet.GetOpcode()); - data << int32(packet.size()); - data << uint32(time(NULL)); - data << uint8(direction); - - for (uint32 i = 0; i < packet.size(); i++) - data << const_cast(packet)[i]; - - fwrite(data.contents(), 1, data.size(), _file); - fflush(_file); -} diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h deleted file mode 100644 index b899daae198..00000000000 --- a/src/server/game/Server/Protocol/PacketLog.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * - * 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 . - */ - -#ifndef TRINITY_PACKETLOG_H -#define TRINITY_PACKETLOG_H - -#include "Common.h" -#include - -enum Direction -{ - CLIENT_TO_SERVER, - SERVER_TO_CLIENT -}; - -class WorldPacket; - -class PacketLog -{ - friend class ACE_Singleton; - - private: - PacketLog(); - ~PacketLog(); - - public: - void Initialize(); - bool CanLogPacket() const { return (_file != NULL); } - void LogPacket(WorldPacket const& packet, Direction direction); - - private: - FILE* _file; -}; - -#define sPacketLog ACE_Singleton::instance() -#endif diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 81ec5495421..6e45ebf37c1 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -139,7 +139,7 @@ WorldSession::~WorldSession() void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const { - sLog->outError("Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt to crash server?), skipped", + sLog->outError(LOG_FILTER_GENERAL, "Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt to crash server?), skipped", GetAccountId(), LookupOpcodeName(packet.GetOpcode()), packet.GetOpcode(), packet.size(), size); } @@ -186,8 +186,8 @@ void WorldSession::SendPacket(WorldPacket const* packet) { uint64 minTime = uint64(cur_time - lastTime); uint64 fullTime = uint64(lastTime - firstTime); - sLog->outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime)); - sLog->outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime); + sLog->outInfo(LOG_FILTER_GENERAL, "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime)); + sLog->outInfo(LOG_FILTER_GENERAL, "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime); lastTime = cur_time; sendLastPacketCount = 1; @@ -250,7 +250,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) { if (packet->GetOpcode() >= NUM_MSG_TYPES) { - sLog->outError("SESSION: received non-existed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); + sLog->outError(LOG_FILTER_GENERAL, "SESSION: received non-existed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet)); } else @@ -284,7 +284,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) { sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet)); (this->*opHandle.handler)(*packet); - if (sLog->IsOutDebug() && packet->rpos() < packet->wpos()) + if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos()) LogUnprocessedTail(packet); } // lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer @@ -298,7 +298,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) // not expected _player or must checked in packet handler sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet)); (this->*opHandle.handler)(*packet); - if (sLog->IsOutDebug() && packet->rpos() < packet->wpos()) + if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos()) LogUnprocessedTail(packet); } break; @@ -311,7 +311,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) { sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet)); (this->*opHandle.handler)(*packet); - if (sLog->IsOutDebug() && packet->rpos() < packet->wpos()) + if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos()) LogUnprocessedTail(packet); } break; @@ -330,7 +330,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet)); (this->*opHandle.handler)(*packet); - if (sLog->IsOutDebug() && packet->rpos() < packet->wpos()) + if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos()) LogUnprocessedTail(packet); break; case STATUS_NEVER: @@ -347,13 +347,10 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) } catch(ByteBufferException &) { - sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", + sLog->outError(LOG_FILTER_GENERAL, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); - if (sLog->IsOutDebug()) - { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); - packet->hexlike(); - } + sLog->outTrace(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); + packet->hexlike(); } } @@ -537,7 +534,7 @@ 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->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); + sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); @@ -610,22 +607,30 @@ const char *WorldSession::GetTrinityString(int32 entry) const void WorldSession::Handle_NULL(WorldPacket& recvPacket) { - sLog->outError("SESSION: received unhandled opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); + sLog->outError(LOG_FILTER_GENERAL, "SESSION: received unhandled opcode %s (0x%.4X)", + LookupOpcodeName(recvPacket.GetOpcode()), + recvPacket.GetOpcode()); } void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket) { - sLog->outError("SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); + sLog->outError(LOG_FILTER_GENERAL, "SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", + LookupOpcodeName(recvPacket.GetOpcode()), + recvPacket.GetOpcode()); } void WorldSession::Handle_ServerSide(WorldPacket& recvPacket) { - sLog->outError("SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); + sLog->outError(LOG_FILTER_GENERAL, "SESSION: received server-side opcode %s (0x%.4X)", + LookupOpcodeName(recvPacket.GetOpcode()), + recvPacket.GetOpcode()); } void WorldSession::Handle_Deprecated(WorldPacket& recvPacket) { - sLog->outError("SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); + sLog->outError(LOG_FILTER_GENERAL, "SESSION: received deprecated opcode %s (0x%.4X)", + LookupOpcodeName(recvPacket.GetOpcode()), + recvPacket.GetOpcode()); } void WorldSession::SendAuthWaitQue(uint32 position) @@ -668,13 +673,15 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask) uint32 type = fields[0].GetUInt8(); if (type >= NUM_ACCOUNT_DATA_TYPES) { - sLog->outError("Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); + sLog->outError(LOG_FILTER_GENERAL, "Table `%s` have invalid account data type (%u), ignore.", + mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } if ((mask & (1 << type)) == 0) { - sLog->outError("Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); + sLog->outError(LOG_FILTER_GENERAL, "Table `%s` have non appropriate for table account data type (%u), ignore.", + mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } @@ -928,7 +935,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) if (size > 0xFFFFF) { - sLog->outError("WorldSession::ReadAddonsInfo addon info too big, size %u", size); + sLog->outError(LOG_FILTER_GENERAL, "WorldSession::ReadAddonsInfo addon info too big, size %u", size); return; } @@ -958,7 +965,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) addonInfo >> enabled >> crc >> unk1; - sLog->outDetail("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1); + sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1); AddonInfo addon(addonName, enabled, crc, 2, true); @@ -971,15 +978,15 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) match = false; if (!match) - sLog->outDetail("ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC); + sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC); else - sLog->outDetail("ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC); + sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC); } else { AddonMgr::SaveAddon(addon); - sLog->outDetail("ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC); + sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC); } // TODO: Find out when to not use CRC/pubkey, and other possible states. @@ -994,7 +1001,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under-read!"); } else - sLog->outError("Addon packet uncompress error!"); + sLog->outError(LOG_FILTER_GENERAL, "Addon packet uncompress error!"); } void WorldSession::SendAddonsInfo() @@ -1033,7 +1040,7 @@ void WorldSession::SendAddonsInfo() data << uint8(usepk); if (usepk) // if CRC is wrong, add public key (client need it) { - sLog->outDetail("ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", + sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC); data.append(addonPublicKey, sizeof(addonPublicKey)); diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 646e9c13392..5b04c3dc714 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -42,7 +42,6 @@ #include "WorldSession.h" #include "WorldSocketMgr.h" #include "Log.h" -#include "PacketLog.h" #include "ScriptMgr.h" #include "AccountMgr.h" @@ -63,19 +62,19 @@ struct ServerPktHeader if (isLargePacket()) { sLog->outDebug(LOG_FILTER_NETWORKIO, "initializing large server to client packet. Size: %u, cmd: %u", size, cmd); - header[headerIndex++] = 0x80|(0xFF &(size>>16)); + header[headerIndex++] = 0x80 | (0xFF & (size >> 16)); } - header[headerIndex++] = 0xFF &(size>>8); - header[headerIndex++] = 0xFF &size; + header[headerIndex++] = 0xFF &(size >> 8); + header[headerIndex++] = 0xFF & size; header[headerIndex++] = 0xFF & cmd; - header[headerIndex++] = 0xFF & (cmd>>8); + header[headerIndex++] = 0xFF & (cmd >> 8); } uint8 getHeaderLength() { // cmd = 2 bytes, size= 2||3bytes - return 2+(isLargePacket()?3:2); + return 2 + (isLargePacket() ? 3 : 2); } bool isLargePacket() const @@ -107,8 +106,8 @@ m_Seed(static_cast (rand32())) { reference_counting_policy().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); - msg_queue()->high_water_mark(8*1024*1024); - msg_queue()->low_water_mark(8*1024*1024); + msg_queue()->high_water_mark(8 * 1024 * 1024); + msg_queue()->low_water_mark(8 * 1024 * 1024); } WorldSocket::~WorldSocket (void) @@ -160,8 +159,30 @@ int WorldSocket::SendPacket(WorldPacket const& pct) return -1; // Dump outgoing packet. - if (sPacketLog->CanLogPacket()) - sPacketLog->LogPacket(pct, SERVER_TO_CLIENT); + if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) + { + char buff[250]; + snprintf(buff, 250, "SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", + uint32(get_handle()), + uint32(pct.size()), + LookupOpcodeName (pct.GetOpcode()), + pct.GetOpcode()); + + std::string data(buff); + uint32 p = 0; + while (p < pct.size()) + { + for (uint32 j = 0; j < 16 && p < pct.size(); j++) + { + snprintf(buff, 250, "%.2X ", const_cast(pct)[p++]); + data.append(buff); + } + data.append("\n"); + } + + data.append("\n"); + sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str()); + } // Create a copy of the original packet; this is to avoid issues if a hook modifies it. sScriptMgr->OnPacketSend(this, WorldPacket(pct)); @@ -193,7 +214,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct) if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { - sLog->outError("WorldSocket::SendPacket enqueue_tail failed"); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::SendPacket enqueue_tail failed"); mb->release(); return -1; } @@ -236,7 +257,7 @@ int WorldSocket::open (void *a) if (peer().get_remote_addr(remote_addr) == -1) { - sLog->outError("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -261,7 +282,7 @@ int WorldSocket::open (void *a) // Register with ACE Reactor if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) { - sLog->outError("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -297,14 +318,14 @@ int WorldSocket::handle_input (ACE_HANDLE) return Update(); // interesting line, isn't it ? } - sLog->outStaticDebug("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); + sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); errno = ECONNRESET; return -1; } case 0: { - sLog->outStaticDebug("WorldSocket::handle_input: Peer has closed connection"); + sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::handle_input: Peer has closed connection"); errno = ECONNRESET; return -1; @@ -373,7 +394,7 @@ int WorldSocket::handle_output_queue (GuardType& g) if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { - sLog->outError("WorldSocket::handle_output_queue dequeue_head"); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::handle_output_queue dequeue_head"); return -1; } @@ -408,7 +429,7 @@ int WorldSocket::handle_output_queue (GuardType& g) if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) { - sLog->outError("WorldSocket::handle_output_queue enqueue_head"); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::handle_output_queue enqueue_head"); mblk->release(); return -1; } @@ -480,7 +501,7 @@ int WorldSocket::handle_input_header (void) if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240)) { Player* _player = m_Session ? m_Session->GetPlayer() : NULL; - sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", + sLog->outError(LOG_FILTER_GENERAL, "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() : "", @@ -586,7 +607,7 @@ int WorldSocket::handle_input_missing_data (void) // hope this is not hack, as proper m_RecvWPct is asserted around if (!m_RecvWPct) { - sLog->outError("Forcing close on input m_RecvWPct = NULL"); + sLog->outError(LOG_FILTER_GENERAL, "Forcing close on input m_RecvWPct = NULL"); errno = EINVAL; return -1; } @@ -632,7 +653,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g) (this, ACE_Event_Handler::WRITE_MASK) == -1) { // would be good to store errno from reactor with errno guard - sLog->outError("WorldSocket::cancel_wakeup_output"); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::cancel_wakeup_output"); return -1; } @@ -651,7 +672,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g) if (reactor()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { - sLog->outError("WorldSocket::schedule_wakeup_output"); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::schedule_wakeup_output"); return -1; } @@ -670,9 +691,30 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) if (closing_) return -1; - // Dump received packet. - if (sPacketLog->CanLogPacket()) - sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER); + if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) + { + char buff[250]; + snprintf(buff, 250, "CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", + uint32(get_handle()), + uint32(new_pct->size()), + LookupOpcodeName (new_pct->GetOpcode()), + new_pct->GetOpcode()); + + std::string data(buff); + uint32 p = 0; + while (p < new_pct->size()) + { + for (uint32 j = 0; j < 16 && p < new_pct->size(); j++) + { + snprintf(buff, 250, "%.2X ", const_cast(*new_pct)[p++]); + data.append(buff); + } + data.append("\n"); + } + + data.append("\n"); + sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str()); + } try { @@ -683,14 +725,14 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) case CMSG_AUTH_SESSION: if (m_Session) { - sLog->outError("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again"); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again"); return -1; } sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct)); return HandleAuthSession (*new_pct); case CMSG_KEEP_ALIVE: - sLog->outStaticDebug ("CMSG_KEEP_ALIVE, size: " UI64FMTD, uint64(new_pct->size())); + sLog->outDebug(LOG_FILTER_GENERAL, "CMSG_KEEP_ALIVE, size: " UI64FMTD, uint64(new_pct->size())); sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct)); return 0; default: @@ -712,7 +754,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) } else { - sLog->outError("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); return -1; } } @@ -720,9 +762,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) } catch (ByteBufferException &) { - sLog->outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", - opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1); - if (sLog->IsOutDebug()) + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", + opcode, GetRemoteAddress().c_str(), m_Session ? int32(m_Session->GetAccountId()) : -1); + if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_DEBUG)) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); new_pct->hexlike(); @@ -734,7 +776,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) ACE_NOTREACHED (return 0); } -int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) +int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) { // NOTE: ATM the socket is singlethread, have this in mind ... uint8 digest[20]; @@ -758,7 +800,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) packet << uint8(AUTH_REJECT); SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); return -1; } @@ -772,7 +814,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) recvPacket >> unk4; recvPacket.read(digest, 20); - sLog->outStaticDebug ("WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", + sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", BuiltNumberClient, unk2, account.c_str(), @@ -794,7 +836,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); return -1; } @@ -814,7 +856,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) const char* sStr = s.AsHexStr(); //Must be freed by OPENSSL_free() const char* vStr = v.AsHexStr(); //Must be freed by OPENSSL_free() - sLog->outStaticDebug ("WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s", + sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s", sStr, vStr); @@ -830,7 +872,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) packet << uint8 (AUTH_FAILED); SendPacket(packet); - sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); + sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); return -1; } } @@ -894,7 +936,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) packet << uint8 (AUTH_BANNED); SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); return -1; } @@ -908,7 +950,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) SendPacket(packet); - sLog->outDetail("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); + sLog->outInfo(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); return -1; } @@ -932,11 +974,11 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); return -1; } - sLog->outStaticDebug("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", + sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", account.c_str(), address.c_str()); @@ -1013,7 +1055,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity())) { Player* _player = m_Session->GetPlayer(); - sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)", + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)", m_Session->GetAccountId(), _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName() : "", @@ -1035,7 +1077,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) m_Session->SetLatency (latency); else { - sLog->outError("WorldSocket::HandlePing: peer sent CMSG_PING, " + sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandlePing: peer sent CMSG_PING, " "but is not authenticated or got recently kicked, " " address = %s", GetRemoteAddress().c_str()); diff --git a/src/server/game/Server/WorldSocketAcceptor.h b/src/server/game/Server/WorldSocketAcceptor.h index a16c5c2189f..d4ff7823b02 100644 --- a/src/server/game/Server/WorldSocketAcceptor.h +++ b/src/server/game/Server/WorldSocketAcceptor.h @@ -44,7 +44,7 @@ protected: virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/) { - sLog->outBasic("Resuming acceptor"); + sLog->outDebug(LOG_FILTER_GENERAL, "Resuming acceptor"); reactor()->cancel_timer(this, 1); return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK); } @@ -54,7 +54,7 @@ protected: #if defined(ENFILE) && defined(EMFILE) if (errno == ENFILE || errno == EMFILE) { - sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds"); + sLog->outError(LOG_FILTER_GENERAL, "Out of file descriptors, suspending incoming connections for 10 seconds"); reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); reactor()->schedule_timer(this, NULL, ACE_Time_Value(10)); } diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp index d357651a5bf..ed960258c41 100755 --- a/src/server/game/Server/WorldSocketMgr.cpp +++ b/src/server/game/Server/WorldSocketMgr.cpp @@ -155,7 +155,7 @@ class ReactorRunnable : protected ACE_Task_Base virtual int svc() { - sLog->outStaticDebug ("Network Thread Starting"); + sLog->outDebug(LOG_FILTER_GENERAL, "Network Thread Starting"); ACE_ASSERT (m_Reactor); @@ -192,7 +192,7 @@ class ReactorRunnable : protected ACE_Task_Base } } - sLog->outStaticDebug ("Network Thread exits"); + sLog->outDebug(LOG_FILTER_GENERAL, "Network Thread exits"); return 0; } @@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (num_threads <= 0) { - sLog->outError("Network.Threads is wrong in your config file"); + sLog->outError(LOG_FILTER_GENERAL, "Network.Threads is wrong in your config file"); return -1; } @@ -244,7 +244,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) m_NetThreads = new ReactorRunnable[m_NetThreadsCount]; - sLog->outBasic ("Max allowed socket connections %d", ACE::max_handles()); + sLog->outDebug(LOG_FILTER_GENERAL, "Max allowed socket connections %d", ACE::max_handles()); // -1 means use default m_SockOutKBuff = ConfigMgr::GetIntDefault ("Network.OutKBuff", -1); @@ -253,7 +253,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (m_SockOutUBuff <= 0) { - sLog->outError("Network.OutUBuff is wrong in your config file"); + sLog->outError(LOG_FILTER_GENERAL, "Network.OutUBuff is wrong in your config file"); return -1; } @@ -263,7 +263,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1) { - sLog->outError("Failed to open acceptor, check if the port is free"); + sLog->outError(LOG_FILTER_GENERAL, "Failed to open acceptor, check if the port is free"); return -1; } @@ -276,7 +276,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) int WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address) { - if (!sLog->IsOutDebug()) + if (!sLog->ShouldLog(LOG_FILTER_GENERAL, LOG_LEVEL_DEBUG)) ACE_Log_Msg::instance()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS); if (StartReactiveIO(port, address) == -1) @@ -327,7 +327,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) (void*) & m_SockOutKBuff, sizeof (int)) == -1 && errno != ENOTSUP) { - sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); return -1; } } @@ -342,7 +342,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) (void*)&ndoption, sizeof (int)) == -1) { - sLog->outError("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); + sLog->outError(LOG_FILTER_GENERAL, "WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); return -1; } } diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index e314fab07be..96a3538c759 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -55,8 +55,8 @@ void LoadSkillDiscoveryTable() if (!result) { - sLog->outErrorDb(">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); + return; } @@ -89,7 +89,7 @@ void LoadSkillDiscoveryTable() { if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end()) { - sLog->outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell); + sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell); reportedReqSpells.insert(absReqSkillOrSpell); } continue; @@ -102,7 +102,7 @@ void LoadSkillDiscoveryTable() { if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end()) { - sLog->outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" + sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table", absReqSkillOrSpell, spellId); reportedReqSpells.insert(absReqSkillOrSpell); @@ -118,7 +118,7 @@ void LoadSkillDiscoveryTable() if (bounds.first == bounds.second) { - sLog->outErrorDb("Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId); + sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId); continue; } @@ -127,7 +127,7 @@ void LoadSkillDiscoveryTable() } else { - sLog->outErrorDb("Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId); + sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId); continue; } @@ -136,7 +136,7 @@ void LoadSkillDiscoveryTable() while (result->NextRow()); if (!ssNonDiscoverableEntries.str().empty()) - sLog->outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str()); + sLog->outError(LOG_FILTER_SQL, "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str()); // report about empty data for explicit discovery spells for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id) @@ -150,11 +150,11 @@ void LoadSkillDiscoveryTable() continue; if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end()) - sLog->outErrorDb("Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id); + sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id); } - sLog->outString(">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index 3bb435145f1..869f5476719 100755 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -60,8 +60,8 @@ void LoadSkillExtraItemTable() if (!result) { - sLog->outErrorDb(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); + return; } @@ -75,28 +75,28 @@ void LoadSkillExtraItemTable() if (!sSpellMgr->GetSpellInfo(spellId)) { - sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId); + sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId); continue; } uint32 requiredSpecialization = fields[1].GetUInt32(); if (!sSpellMgr->GetSpellInfo(requiredSpecialization)) { - sLog->outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization); + sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization); continue; } float additionalCreateChance = fields[2].GetFloat(); if (additionalCreateChance <= 0.0f) { - sLog->outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId); + sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId); continue; } uint8 additionalMaxNum = fields[3].GetUInt8(); if (!additionalMaxNum) { - sLog->outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId); + sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId); continue; } @@ -110,8 +110,8 @@ void LoadSkillExtraItemTable() } while (result->NextRow()); - sLog->outString(">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance, uint8 &additionalMax) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 4bb9ff9273e..610cd7d1533 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1107,7 +1107,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster) if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN) { m_isPeriodic = false; - sLog->outError("Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId()); } else { @@ -1933,7 +1933,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo case FORM_SPIRITOFREDEMPTION: // 0x20 break; default: - sLog->outError("Auras: Unknown Shapeshift Type: %u", GetMiscValue()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Auras: Unknown Shapeshift Type: %u", GetMiscValue()); } modelid = target->GetModelForForm(form); @@ -2288,7 +2288,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, if (!ci) { target->SetDisplayId(16358); // pig pink ^_^ - sLog->outError("Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId()); } else { @@ -2807,7 +2807,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry); if (!ci) { - sLog->outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue()); + sLog->outError(LOG_FILTER_SQL, "AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue()); return; } @@ -3883,7 +3883,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo if (GetMiscValue() < -2 || GetMiscValue() > 4) { - sLog->outError("WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue()); return; } @@ -3909,7 +3909,7 @@ void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode, if (GetMiscValue() < -1 || GetMiscValue() > 4) { - sLog->outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); return; } @@ -4007,7 +4007,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 if (GetMiscValue() < -1 || GetMiscValue() > 4) { - sLog->outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); return; } @@ -4045,7 +4045,7 @@ void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const* aur { // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update // and include in UpdateResistence same code as in UpdateArmor for aura mod apply. - sLog->outError("Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!"); return; } @@ -6234,7 +6234,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); - sLog->outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); caster->DealDamageMods(target, damage, &absorb); @@ -6304,7 +6304,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c if (target->GetHealth() < damage) damage = uint32(target->GetHealth()); - sLog->outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit); @@ -6436,7 +6436,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const if (crit) damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target); - sLog->outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId()); uint32 absorb = 0; @@ -6505,7 +6505,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con drainAmount = maxmana; } - sLog->outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId()); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) @@ -6566,7 +6566,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const // ignore negative values (can be result apply spellmods to aura damage uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(powerType) /100; - sLog->outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId()); SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); @@ -6601,7 +6601,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); target->SendPeriodicAuraLog(&pInfo); - sLog->outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId()); int32 gain = target->ModifyPower(powerType, amount); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 8a320ae35e7..9ee05b9a2a4 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -424,7 +424,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA // TODO: Figure out why this happens if (itr == m_applications.end()) { - sLog->outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellInfo()->Id); ASSERT(false); } @@ -566,7 +566,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) if (!GetOwner()->IsSelfOrInSameMap(itr->first)) { //TODO: There is a crash caused by shadowfiend load addon - sLog->outCrash("Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id, + 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)); ASSERT(false); @@ -1181,7 +1181,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case 31571: spellId = 57529; break; case 31572: spellId = 57531; break; default: - sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId()); } if (spellId) caster->CastSpell(caster, spellId, true); @@ -1277,7 +1277,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case 49631: spellId = 50509; break; case 49032: spellId = 50508; break; default: - sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId()); } caster->CastSpell(target, spellId, true, 0, GetEffect(0)); } @@ -1384,7 +1384,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case 53759: spellId = 60947; break; case 53754: spellId = 60946; break; default: - sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId()); } if (spellId) caster->CastSpell(target, spellId, true); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index eef11ab25a9..3742ee5fc52 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -458,23 +458,23 @@ void SpellCastTargets::Update(Unit* caster) void SpellCastTargets::OutDebug() const { if (!m_targetMask) - sLog->outString("No targets"); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "No targets"); - sLog->outString("target mask: %u", m_targetMask); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "target mask: %u", m_targetMask); if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK)) - sLog->outString("Object target: " UI64FMTD, m_objectTargetGUID); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Object target: " UI64FMTD, m_objectTargetGUID); if (m_targetMask & TARGET_FLAG_ITEM) - sLog->outString("Item target: " UI64FMTD, m_itemTargetGUID); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Item target: " UI64FMTD, m_itemTargetGUID); if (m_targetMask & TARGET_FLAG_TRADE_ITEM) - sLog->outString("Trade item target: " UI64FMTD, m_itemTargetGUID); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Trade item target: " UI64FMTD, m_itemTargetGUID); if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) - sLog->outString("Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_DEST_LOCATION) - sLog->outString("Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_STRING) - sLog->outString("String: %s", m_strTarget.c_str()); - sLog->outString("speed: %f", m_speed); - sLog->outString("elevation: %f", m_elevation); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "String: %s", m_strTarget.c_str()); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "speed: %f", m_speed); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "elevation: %f", m_elevation); } SpellValue::SpellValue(SpellInfo const* proto) @@ -603,7 +603,7 @@ Spell::~Spell() { // Clean the reference to avoid later crash. // If this error is repeating, we may have to add an ASSERT to better track down how we get into this case. - sLog->outError("SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id); *m_selfContainer = NULL; } @@ -1637,7 +1637,7 @@ void Spell::SelectImplicitTrajTargets() float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d); if (a > -0.0001f) a = 0; - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);) + DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: a %f b %f", a, b);) float bestDist = m_spellInfo->GetMaxRange(false); @@ -1653,11 +1653,11 @@ void Spell::SelectImplicitTrajTargets() const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)); const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ; - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) + DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) float dist = objDist2d - size; float height = dist * (a * dist + b); - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);) + DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);) if (dist < bestDist && height < dz + size && height > dz - size) { bestDist = dist > 0 ? dist : 0; @@ -1665,7 +1665,7 @@ void Spell::SelectImplicitTrajTargets() } #define CHECK_DIST {\ - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ + DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ if (dist > bestDist)\ continue;\ if (dist < objDist2d + size && dist > objDist2d - size)\ @@ -1727,7 +1727,7 @@ void Spell::SelectImplicitTrajTargets() float distSq = (*itr)->GetExactDistSq(x, y, z); float sizeSq = (*itr)->GetObjectSize(); sizeSq *= sizeSq; - DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) + DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) if (distSq > sizeSq) { float factor = 1 - sqrt(sizeSq / distSq); @@ -1736,7 +1736,7 @@ void Spell::SelectImplicitTrajTargets() z += factor * ((*itr)->GetPositionZ() - z); distSq = (*itr)->GetExactDistSq(x, y, z); - DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) + DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) } } @@ -4305,7 +4305,7 @@ void Spell::TakeCastItem() { // This code is to avoid a crash // I'm not sure, if this is really an error, but I guess every item needs a prototype - sLog->outError("Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow()); return; } @@ -4395,7 +4395,7 @@ void Spell::TakePower() if (powerType >= MAX_POWERS) { - sLog->outError("Spell::TakePower: Unknown power type '%d'", powerType); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::TakePower: Unknown power type '%d'", powerType); return; } @@ -5774,7 +5774,7 @@ SpellCastResult Spell::CheckPower() // Check valid power type if (m_spellInfo->PowerType >= MAX_POWERS) { - sLog->outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType); return SPELL_FAILED_UNKNOWN; } @@ -6338,7 +6338,7 @@ void Spell::Delayed() // only called in DealDamage() else m_timer += delaytime; - sLog->outDetail("Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); WorldPacket data(SMSG_SPELL_DELAYED, 8+4); data.append(m_caster->GetPackGUID()); @@ -6554,7 +6554,7 @@ SpellEvent::~SpellEvent() } else { - sLog->outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", + sLog->outError(LOG_FILTER_SPELLS_AURAS, "~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id); ASSERT(false); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index e43c64cd388..95f67d05e9a 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -764,7 +764,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (!spellInfo) { - sLog->outError("EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id); return; } @@ -1022,7 +1022,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) if (!spellInfo) { - sLog->outError("Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); return; } @@ -1067,7 +1067,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex) if (!spellInfo) { - sLog->outError("EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); return; } @@ -1176,7 +1176,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) // If not exist data for dest location - return if (!m_targets.HasDst()) { - sLog->outError("Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id); return; } @@ -1502,7 +1502,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) if (!targetAura) { - sLog->outError("Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); return; } @@ -1977,7 +1977,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) // Players shouldn't be able to loot gameobjects that are currently despawned if (!gameObjTarget->isSpawned() && !player->isGameMaster()) { - sLog->outError("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!", + 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()); return; } @@ -2275,7 +2275,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB); if (!properties) { - sLog->outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB); return; } @@ -2836,7 +2836,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) } if (!add_socket) { - sLog->outError("Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", m_spellInfo->Id, SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET); return; } @@ -2902,14 +2902,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) case 10: spell_id = 36758; break; // 14% case 11: spell_id = 36760; break; // 20% default: - sLog->outError("Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage); return; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) { - sLog->outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); return; } @@ -2936,14 +2936,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) if (!enchant_id) { - sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex); return; } SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) { - sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); return; } @@ -4195,7 +4195,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) case 31893: spell_heal = 48084; break; case 31883: spell_heal = 48085; break; default: - sLog->outError("Unknown Lightwell spell caster %u", m_caster->GetEntry()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unknown Lightwell spell caster %u", m_caster->GetEntry()); return; } @@ -4312,7 +4312,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) case 57774: spellId1 = 20185; break; // Judgement of Light case 53408: spellId1 = 20186; break; // Judgement of Wisdom default: - sLog->outError("Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id); return; } // all seals have aura dummy in 2 effect @@ -4585,7 +4585,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/) Player* target = (Player*)m_caster; sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell Effect: Stuck"); - sLog->outDetail("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(), target->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); if (target->isInFlight()) return; @@ -5502,7 +5502,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) if (!goinfo) { - sLog->outErrorDb("Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id); + sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id); return; } @@ -5606,7 +5606,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) ExecuteLogEffectSummonObject(effIndex, pGameObj); - sLog->outStaticDebug("AddObject at SpellEfects.cpp EffectTransmitted"); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AddObject at SpellEfects.cpp EffectTransmitted"); //m_caster->AddGameObject(pGameObj); //m_ObjToDel.push_back(pGameObj); @@ -6149,7 +6149,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex) if (!sSoundEntriesStore.LookupEntry(soundid)) { - sLog->outError("EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); return; } @@ -6200,7 +6200,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex) if (!sSoundEntriesStore.LookupEntry(soundid)) { - sLog->outError("EffectPlayerNotification: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectPlayerNotification: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); return; } @@ -6310,7 +6310,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id); if (!st) { - sLog->outError("Spell::EffectBind - unknown teleport coordinates for spell ID %u", m_spellInfo->Id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectBind - unknown teleport coordinates for spell ID %u", m_spellInfo->Id); return; } @@ -6338,11 +6338,11 @@ void Spell::EffectBind(SpellEffIndex effIndex) data << uint32(area_id); player->SendDirectMessage(&data); - sLog->outStaticDebug("New homebind X : %f", loc.m_positionX); - sLog->outStaticDebug("New homebind Y : %f", loc.m_positionY); - sLog->outStaticDebug("New homebind Z : %f", loc.m_positionZ); - sLog->outStaticDebug("New homebind MapId : %u", loc.m_mapId); - sLog->outStaticDebug("New homebind AreaId : %u", area_id); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind X : %f", loc.m_positionX); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind Y : %f", loc.m_positionY); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind Z : %f", loc.m_positionZ); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind MapId : %u", loc.m_mapId); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind AreaId : %u", area_id); // zone update data.Initialize(SMSG_PLAYERBOUND, 8+4); diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 16584086245..a397bb13709 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1262,7 +1262,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const shapeInfo = sSpellShapeshiftStore.LookupEntry(form); if (!shapeInfo) { - sLog->outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); return SPELL_CAST_OK; } actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells @@ -2017,7 +2017,7 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) // Else drain all power if (PowerType < MAX_POWERS) return caster->GetPower(Powers(PowerType)); - sLog->outError("SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id); return 0; } @@ -2046,7 +2046,7 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Not implemented yet!"); break; default: - sLog->outError("CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id); return 0; } } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index d40c08f1c4c..2b0e71b4dd8 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -370,7 +370,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (player) ChatHandler(player).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id); else - sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id); + sLog->outError(LOG_FILTER_SQL, "Craft spell %u not have create item entry.", spellInfo->Id); } return false; } @@ -384,7 +384,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (player) ChatHandler(player).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType); else - sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType); + sLog->outError(LOG_FILTER_SQL, "Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType); } return false; } @@ -402,7 +402,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (player) ChatHandler(player).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell); else - sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell); + sLog->outError(LOG_FILTER_SQL, "Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell); } return false; } @@ -422,7 +422,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (player) ChatHandler(player).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]); else - sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]); + sLog->outError(LOG_FILTER_SQL, "Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]); } return false; } @@ -454,7 +454,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con uint32 mode = uint32(caster->GetMap()->GetSpawnMode()); if (mode >= MAX_DIFFICULTY) { - sLog->outError("SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId); return spellId; //return source spell } @@ -477,7 +477,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con if (difficultyEntry->SpellID[mode] <= 0) { - sLog->outErrorDb("SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode); + sLog->outError(LOG_FILTER_SQL, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode); return spellId; } @@ -1155,8 +1155,8 @@ void SpellMgr::LoadSpellRanks() if (!result) { - sLog->outString(">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); + return; } @@ -1195,13 +1195,13 @@ void SpellMgr::LoadSpellRanks() SpellInfo const* first = GetSpellInfo(lastSpell); if (!first) { - sLog->outErrorDb("Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell); + sLog->outError(LOG_FILTER_SQL, "Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell); continue; } // check if chain is long enough if (rankChain.size() < 2) { - sLog->outErrorDb("There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell); + sLog->outError(LOG_FILTER_SQL, "There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell); continue; } int32 curRank = 0; @@ -1212,14 +1212,14 @@ void SpellMgr::LoadSpellRanks() SpellInfo const* spell = GetSpellInfo(itr->first); if (!spell) { - sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell); + sLog->outError(LOG_FILTER_SQL, "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell); valid = false; break; } ++curRank; if (itr->second != curRank) { - sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank); + sLog->outError(LOG_FILTER_SQL, "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank); valid = false; break; } @@ -1251,8 +1251,8 @@ void SpellMgr::LoadSpellRanks() while (true); } while (!finished); - sLog->outString(">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellRequired() @@ -1267,8 +1267,8 @@ void SpellMgr::LoadSpellRequired() if (!result) { - sLog->outString(">> Loaded 0 spell required records. DB table `spell_required` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell required records. DB table `spell_required` is empty."); + return; } @@ -1284,26 +1284,26 @@ void SpellMgr::LoadSpellRequired() SpellInfo const* spell = GetSpellInfo(spell_id); if (!spell) { - sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id); + sLog->outError(LOG_FILTER_SQL, "spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id); continue; } SpellInfo const* req_spell = GetSpellInfo(spell_req); if (!req_spell) { - sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req); + sLog->outError(LOG_FILTER_SQL, "req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req); continue; } if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req)) { - sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id); + sLog->outError(LOG_FILTER_SQL, "req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id); continue; } if (IsSpellRequiringSpell(spell_id, spell_req)) { - sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id); + sLog->outError(LOG_FILTER_SQL, "duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id); continue; } @@ -1312,8 +1312,8 @@ void SpellMgr::LoadSpellRequired() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellLearnSkills() @@ -1350,8 +1350,8 @@ void SpellMgr::LoadSpellLearnSkills() } } - sLog->outString(">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellLearnSpells() @@ -1364,8 +1364,8 @@ void SpellMgr::LoadSpellLearnSpells() QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); if (!result) { - sLog->outString(">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); + return; } @@ -1383,19 +1383,19 @@ void SpellMgr::LoadSpellLearnSpells() if (!GetSpellInfo(spell_id)) { - sLog->outErrorDb("Spell %u listed in `spell_learn_spell` does not exist", spell_id); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` does not exist", spell_id); continue; } if (!GetSpellInfo(node.spell)) { - sLog->outErrorDb("Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell); continue; } if (GetTalentSpellCost(node.spell)) { - sLog->outErrorDb("Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell); continue; } @@ -1437,7 +1437,7 @@ void SpellMgr::LoadSpellLearnSpells() { if (itr->second.spell == dbc_node.spell) { - sLog->outErrorDb("Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.", + sLog->outError(LOG_FILTER_SQL, "Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.", spell, dbc_node.spell); found = true; break; @@ -1453,8 +1453,8 @@ void SpellMgr::LoadSpellLearnSpells() } } - sLog->outString(">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellTargetPositions() @@ -1467,8 +1467,8 @@ void SpellMgr::LoadSpellTargetPositions() QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { - sLog->outString(">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); + return; } @@ -1490,20 +1490,20 @@ void SpellMgr::LoadSpellTargetPositions() MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); if (!mapEntry) { - sLog->outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId); + sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId); continue; } if (st.target_X==0 && st.target_Y==0 && st.target_Z==0) { - sLog->outErrorDb("Spell (ID:%u) target coordinates not provided.", Spell_ID); + sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) target coordinates not provided.", Spell_ID); continue; } SpellInfo const* spellInfo = GetSpellInfo(Spell_ID); if (!spellInfo) { - sLog->outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID); + sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID); continue; } @@ -1518,7 +1518,7 @@ void SpellMgr::LoadSpellTargetPositions() uint32 area_id = sMapMgr->GetAreaId(st.target_mapId, st.target_X, st.target_Y, st.target_Z); if (area_id != uint32(spellInfo->Effects[i].MiscValue)) { - sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id); + sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id); break; } } @@ -1529,7 +1529,7 @@ void SpellMgr::LoadSpellTargetPositions() } if (!found) { - sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID); + sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID); continue; } @@ -1573,8 +1573,8 @@ void SpellMgr::LoadSpellTargetPositions() } }*/ - sLog->outString(">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellGroups() @@ -1588,8 +1588,8 @@ void SpellMgr::LoadSpellGroups() QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group"); if (!result) { - sLog->outString(">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); + return; } @@ -1602,7 +1602,7 @@ void SpellMgr::LoadSpellGroups() uint32 group_id = fields[0].GetUInt32(); if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id); + sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id); continue; } int32 spell_id = fields[1].GetInt32(); @@ -1618,7 +1618,7 @@ void SpellMgr::LoadSpellGroups() { if (groups.find(abs(itr->second)) == groups.end()) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second)); + sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second)); mSpellGroupSpell.erase(itr++); } else @@ -1630,12 +1630,12 @@ void SpellMgr::LoadSpellGroups() if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_group` does not exist", itr->second); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_group` does not exist", itr->second); mSpellGroupSpell.erase(itr++); } else if (spellInfo->GetRank() > 1) { - sLog->outErrorDb("Spell %u listed in `spell_group` is not first rank of spell", itr->second); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_group` is not first rank of spell", itr->second); mSpellGroupSpell.erase(itr++); } else @@ -1655,8 +1655,8 @@ void SpellMgr::LoadSpellGroups() } } - sLog->outString(">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellGroupStackRules() @@ -1669,8 +1669,8 @@ void SpellMgr::LoadSpellGroupStackRules() QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules"); if (!result) { - sLog->outString(">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); + return; } @@ -1683,7 +1683,7 @@ void SpellMgr::LoadSpellGroupStackRules() uint8 stack_rule = fields[1].GetInt8(); if (stack_rule >= SPELL_GROUP_STACK_RULE_MAX) { - sLog->outErrorDb("SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule); + sLog->outError(LOG_FILTER_SQL, "SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule); continue; } @@ -1691,7 +1691,7 @@ void SpellMgr::LoadSpellGroupStackRules() if (spellGroup.first == spellGroup.second) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id); + sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id); continue; } @@ -1700,8 +1700,8 @@ void SpellMgr::LoadSpellGroupStackRules() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellProcEvents() @@ -1714,8 +1714,8 @@ void SpellMgr::LoadSpellProcEvents() QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); if (!result) { - sLog->outString(">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); + return; } @@ -1730,7 +1730,7 @@ void SpellMgr::LoadSpellProcEvents() SpellInfo const* spell = GetSpellInfo(entry); if (!spell) { - sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", entry); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` does not exist", entry); continue; } @@ -1753,7 +1753,7 @@ void SpellMgr::LoadSpellProcEvents() { if (spe.procFlags == 0) { - sLog->outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", entry); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` probally not triggered spell", entry); continue; } customProc++; @@ -1762,10 +1762,10 @@ void SpellMgr::LoadSpellProcEvents() } while (result->NextRow()); if (customProc) - sLog->outString(">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outString(">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellProcs() @@ -1778,8 +1778,8 @@ void SpellMgr::LoadSpellProcs() QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc"); if (!result) { - sLog->outString(">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); + return; } @@ -1800,7 +1800,7 @@ void SpellMgr::LoadSpellProcs() SpellInfo const* spellEntry = GetSpellInfo(spellId); if (!spellEntry) { - sLog->outErrorDb("Spell %u listed in `spell_proc` does not exist", spellId); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` does not exist", spellId); continue; } @@ -1808,7 +1808,7 @@ void SpellMgr::LoadSpellProcs() { if (GetFirstSpellInChain(spellId) != uint32(spellId)) { - sLog->outErrorDb("Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32()); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32()); continue; } } @@ -1835,7 +1835,7 @@ void SpellMgr::LoadSpellProcs() { if (mSpellProcMap.find(spellId) != mSpellProcMap.end()) { - sLog->outErrorDb("Spell %u listed in `spell_proc` has duplicate entry in the table", spellId); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` has duplicate entry in the table", spellId); break; } SpellProcEntry procEntry = SpellProcEntry(baseProcEntry); @@ -1850,47 +1850,47 @@ void SpellMgr::LoadSpellProcs() // validate data if (procEntry.schoolMask & ~SPELL_SCHOOL_MASK_ALL) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask); if (procEntry.spellFamilyName && (procEntry.spellFamilyName < 3 || procEntry.spellFamilyName > 17 || procEntry.spellFamilyName == 14 || procEntry.spellFamilyName == 16)) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName); if (procEntry.chance < 0) { - sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId); procEntry.chance = 0; } if (procEntry.ratePerMinute < 0) { - sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId); procEntry.ratePerMinute = 0; } if (cooldown < 0) { - sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId); procEntry.cooldown = 0; } if (procEntry.chance == 0 && procEntry.ratePerMinute == 0) - sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId); if (procEntry.charges > 99) { - sLog->outErrorDb("`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId); procEntry.charges = 99; } if (!procEntry.typeMask) - sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId); if (procEntry.spellTypeMask & ~PROC_SPELL_PHASE_MASK_ALL) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask); if (procEntry.spellTypeMask && !(procEntry.typeMask & (SPELL_PROC_FLAG_MASK | PERIODIC_PROC_FLAG_MASK))) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId); if (!procEntry.spellPhaseMask && procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK) - sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId); if (procEntry.spellPhaseMask & ~PROC_SPELL_PHASE_MASK_ALL) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask); if (procEntry.spellPhaseMask && !(procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK)) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId); if (procEntry.hitMask & ~PROC_HIT_MASK_ALL) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask); if (procEntry.hitMask && !(procEntry.typeMask & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.typeMask & DONE_HIT_PROC_FLAG_MASK && (!procEntry.spellPhaseMask || procEntry.spellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH))))) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId); + sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId); mSpellProcMap[spellId] = procEntry; @@ -1905,8 +1905,8 @@ void SpellMgr::LoadSpellProcs() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellBonusess() @@ -1919,8 +1919,8 @@ void SpellMgr::LoadSpellBonusess() QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); if (!result) { - sLog->outString(">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); + return; } @@ -1933,7 +1933,7 @@ void SpellMgr::LoadSpellBonusess() SpellInfo const* spell = GetSpellInfo(entry); if (!spell) { - sLog->outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_bonus_data` does not exist", entry); continue; } @@ -1946,8 +1946,8 @@ void SpellMgr::LoadSpellBonusess() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellThreats() @@ -1960,8 +1960,8 @@ void SpellMgr::LoadSpellThreats() QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat"); if (!result) { - sLog->outString(">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); + return; } @@ -1974,7 +1974,7 @@ void SpellMgr::LoadSpellThreats() if (!GetSpellInfo(entry)) { - sLog->outErrorDb("Spell %u listed in `spell_threat` does not exist", entry); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_threat` does not exist", entry); continue; } @@ -1987,8 +1987,8 @@ void SpellMgr::LoadSpellThreats() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSkillLineAbilityMap() @@ -2009,8 +2009,8 @@ void SpellMgr::LoadSkillLineAbilityMap() ++count; } - sLog->outString(">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellPetAuras() @@ -2023,8 +2023,8 @@ void SpellMgr::LoadSpellPetAuras() QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); if (!result) { - sLog->outString(">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); + return; } @@ -2046,21 +2046,21 @@ void SpellMgr::LoadSpellPetAuras() SpellInfo const* spellInfo = GetSpellInfo(spell); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_pet_auras` does not exist", spell); continue; } if (spellInfo->Effects[eff].Effect != SPELL_EFFECT_DUMMY && (spellInfo->Effects[eff].Effect != SPELL_EFFECT_APPLY_AURA || spellInfo->Effects[eff].ApplyAuraName != SPELL_AURA_DUMMY)) { - sLog->outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); continue; } SpellInfo const* spellInfo2 = GetSpellInfo(aura); if (!spellInfo2) { - sLog->outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura); + sLog->outError(LOG_FILTER_SQL, "Aura %u listed in `spell_pet_auras` does not exist", aura); continue; } @@ -2071,8 +2071,8 @@ void SpellMgr::LoadSpellPetAuras() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } // Fill custom data about enchancments @@ -2112,8 +2112,8 @@ void SpellMgr::LoadEnchantCustomAttr() } } - sLog->outString(">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellEnchantProcData() @@ -2126,8 +2126,8 @@ void SpellMgr::LoadSpellEnchantProcData() QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data"); if (!result) { - sLog->outString(">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); + return; } @@ -2141,7 +2141,7 @@ void SpellMgr::LoadSpellEnchantProcData() SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId); if (!ench) { - sLog->outErrorDb("Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId); + sLog->outError(LOG_FILTER_SQL, "Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId); continue; } @@ -2156,8 +2156,8 @@ void SpellMgr::LoadSpellEnchantProcData() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellLinked() @@ -2170,8 +2170,8 @@ void SpellMgr::LoadSpellLinked() QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell"); if (!result) { - sLog->outString(">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); + return; } @@ -2187,13 +2187,13 @@ void SpellMgr::LoadSpellLinked() SpellInfo const* spellInfo = GetSpellInfo(abs(trigger)); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger)); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_linked_spell` does not exist", abs(trigger)); continue; } spellInfo = GetSpellInfo(abs(effect)); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect)); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_linked_spell` does not exist", abs(effect)); continue; } @@ -2209,8 +2209,8 @@ void SpellMgr::LoadSpellLinked() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadPetLevelupSpellMap() @@ -2266,8 +2266,8 @@ void SpellMgr::LoadPetLevelupSpellMap() } } - sLog->outString(">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); + } bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells) @@ -2351,10 +2351,10 @@ void SpellMgr::LoadPetDefaultSpells() } } - sLog->outString(">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); + - sLog->outString("Loading summonable creature templates..."); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Loading summonable creature templates..."); oldMSTime = getMSTime(); // different summon spells @@ -2395,8 +2395,8 @@ void SpellMgr::LoadPetDefaultSpells() } } - sLog->outString(">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellAreas() @@ -2414,8 +2414,8 @@ void SpellMgr::LoadSpellAreas() if (!result) { - sLog->outString(">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); + return; } @@ -2443,7 +2443,7 @@ void SpellMgr::LoadSpellAreas() } else { - sLog->outErrorDb("Spell %u listed in `spell_area` does not exist", spell); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` does not exist", spell); continue; } @@ -2472,20 +2472,20 @@ void SpellMgr::LoadSpellAreas() if (!ok) { - sLog->outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` already listed with similar requirements.", spell); continue; } } if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId)) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId); continue; } if (spellArea.questStart && !sObjectMgr->GetQuestTemplate(spellArea.questStart)) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart); continue; } @@ -2493,13 +2493,13 @@ void SpellMgr::LoadSpellAreas() { if (!sObjectMgr->GetQuestTemplate(spellArea.questEnd)) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd); continue; } if (spellArea.questEnd == spellArea.questStart && !spellArea.questStartCanActive) { - sLog->outErrorDb("Spell %u listed in `spell_area` have quest (%u) requirement for start and end in same time", spell, spellArea.questEnd); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have quest (%u) requirement for start and end in same time", spell, spellArea.questEnd); continue; } } @@ -2509,13 +2509,13 @@ void SpellMgr::LoadSpellAreas() SpellInfo const* spellInfo = GetSpellInfo(abs(spellArea.auraSpell)); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell)); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell)); continue; } if (uint32(abs(spellArea.auraSpell)) == spellArea.spellId) { - sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell)); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell)); continue; } @@ -2535,7 +2535,7 @@ void SpellMgr::LoadSpellAreas() if (chain) { - sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); continue; } @@ -2551,7 +2551,7 @@ void SpellMgr::LoadSpellAreas() if (chain) { - sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); continue; } } @@ -2559,13 +2559,13 @@ void SpellMgr::LoadSpellAreas() if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE) == 0) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask); continue; } if (spellArea.gender != GENDER_NONE && spellArea.gender != GENDER_FEMALE && spellArea.gender != GENDER_MALE) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender); + sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender); continue; } @@ -2595,8 +2595,8 @@ void SpellMgr::LoadSpellAreas() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadSpellInfoStore() @@ -2612,8 +2612,8 @@ void SpellMgr::LoadSpellInfoStore() mSpellInfoMap[i] = new SpellInfo(spellEntry); } - sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::UnloadSpellInfoStore() @@ -2925,8 +2925,8 @@ void SpellMgr::LoadSpellCustomAttr() CreatureAI::FillAISpellInfo(); - sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); + } void SpellMgr::LoadDbcDataCorrections() @@ -3569,6 +3569,6 @@ void SpellMgr::LoadDbcDataCorrections() properties = const_cast(sSummonPropertiesStore.LookupEntry(647)); // 52893 properties->Type = SUMMON_TYPE_TOTEM; - sLog->outString(">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); + } diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 3430c1b12e3..1399934efeb 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -25,7 +25,7 @@ bool _SpellScript::_Validate(SpellInfo const* entry) { if (!Validate(entry)) { - sLog->outError("TSCR: Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str()); return false; } return true; @@ -286,27 +286,27 @@ bool SpellScript::_Validate(SpellInfo const* entry) { for (std::list::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); return _SpellScript::_Validate(entry); } @@ -414,7 +414,7 @@ Unit* SpellScript::GetHitUnit() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } return m_spell->unitTarget; @@ -424,7 +424,7 @@ Creature* SpellScript::GetHitCreature() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } if (m_spell->unitTarget) @@ -437,7 +437,7 @@ Player* SpellScript::GetHitPlayer() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } if (m_spell->unitTarget) @@ -450,7 +450,7 @@ Item* SpellScript::GetHitItem() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } return m_spell->itemTarget; @@ -460,7 +460,7 @@ GameObject* SpellScript::GetHitGObj() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } return m_spell->gameObjTarget; @@ -470,7 +470,7 @@ WorldLocation* SpellScript::GetHitDest() { if (!IsInEffectHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } return m_spell->destTarget; @@ -480,7 +480,7 @@ int32 SpellScript::GetHitDamage() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->m_damage; @@ -490,7 +490,7 @@ void SpellScript::SetHitDamage(int32 damage) { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_spell->m_damage = damage; @@ -500,7 +500,7 @@ int32 SpellScript::GetHitHeal() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->m_healing; @@ -510,7 +510,7 @@ void SpellScript::SetHitHeal(int32 heal) { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_spell->m_healing = heal; @@ -520,7 +520,7 @@ Aura* SpellScript::GetHitAura() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } if (!m_spell->m_spellAura) @@ -534,7 +534,7 @@ void SpellScript::PreventHitAura() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } if (m_spell->m_spellAura) @@ -545,7 +545,7 @@ void SpellScript::PreventHitEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_hitPreventEffectMask |= 1 << effIndex; @@ -556,7 +556,7 @@ void SpellScript::PreventHitDefaultEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_hitPreventDefaultEffectMask |= 1 << effIndex; @@ -566,7 +566,7 @@ int32 SpellScript::GetEffectValue() { if (!IsInEffectHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->damage; @@ -597,7 +597,7 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result) { if (!IsInCheckCastHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId); return; } @@ -613,67 +613,67 @@ bool AuraScript::_Validate(SpellInfo const* entry) { for (std::list::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr) if (!entry->HasAreaAuraEffect()) - sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = OnDispel.begin(); itr != OnDispel.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - sLog->outError("TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = AfterDispel.begin(); itr != AfterDispel.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - sLog->outError("TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectRemove.begin(); itr != OnEffectRemove.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectApply.begin(); itr != AfterEffectApply.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectRemove.begin(); itr != AfterEffectRemove.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = DoEffectCalcAmount.begin(); itr != DoEffectCalcAmount.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = DoEffectCalcPeriodic.begin(); itr != DoEffectCalcPeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = DoEffectCalcSpellMod.begin(); itr != DoEffectCalcSpellMod.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectAbsorb.begin(); itr != OnEffectAbsorb.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectAbsorb.begin(); itr != AfterEffectAbsorb.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectManaShield.begin(); itr != OnEffectManaShield.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectManaShield.begin(); itr != AfterEffectManaShield.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); return _SpellScript::_Validate(entry); } @@ -855,7 +855,7 @@ void AuraScript::PreventDefaultAction() m_defaultActionPrevented = true; break; default: - sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); break; } } @@ -1035,7 +1035,7 @@ Unit* AuraScript::GetTarget() const case AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD: return m_auraApplication->GetTarget(); default: - sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); + sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); } return NULL; diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 2f79eaff06a..32d361faa9a 100755 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -77,8 +77,8 @@ void CreatureTextMgr::LoadCreatureTexts() if (!result) { - sLog->outString(">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); + return; } @@ -104,25 +104,25 @@ void CreatureTextMgr::LoadCreatureTexts() if (temp.sound) { if (!sSoundEntriesStore.LookupEntry(temp.sound)){ - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound); + sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound); temp.sound = 0; } } if (!GetLanguageDescByID(temp.lang)) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang)); + sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang)); temp.lang = LANG_UNIVERSAL; } if (temp.type >= MAX_CHAT_MSG_TYPE) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type)); + sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type)); temp.type = CHAT_MSG_SAY; } if (temp.emote) { if (!sEmotesStore.LookupEntry(temp.emote)) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote)); + sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote)); temp.emote = EMOTE_ONESHOT_NONE; } } @@ -136,8 +136,8 @@ void CreatureTextMgr::LoadCreatureTexts() ++textCount; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); + } void CreatureTextMgr::LoadCreatureTextLocales() @@ -166,8 +166,8 @@ void CreatureTextMgr::LoadCreatureTextLocales() ++textCount; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); + } uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid /*= 0*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, TextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/) @@ -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->outErrorDb("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(), 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->outErrorDb("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(), 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->outErrorDb("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(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); } CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index e43d6ca5443..aedb27a040f 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -263,8 +263,8 @@ void TicketMgr::LoadTickets() PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - sLog->outString(">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); + return; } @@ -290,8 +290,8 @@ void TicketMgr::LoadTickets() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void TicketMgr::LoadSurveys() @@ -303,8 +303,8 @@ void TicketMgr::LoadSurveys() if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_surveys")) _lastSurveyId = (*result)[0].GetUInt32(); - sLog->outString(">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + } void TicketMgr::AddTicket(GmTicket* ticket) diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index b734d90b040..0619491f364 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -29,7 +29,7 @@ void CharacterDatabaseCleaner::CleanDatabase() if (!sWorld->getBoolConfig(CONFIG_CLEAN_CHARACTER_DB)) return; - sLog->outString("Cleaning character database..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Cleaning character database..."); uint32 oldMSTime = getMSTime(); @@ -63,8 +63,8 @@ void CharacterDatabaseCleaner::CleanDatabase() sWorld->SetCleaningFlags(flags); - sLog->outString(">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + } void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32)) @@ -72,7 +72,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table QueryResult result = CharacterDatabase.PQuery("SELECT DISTINCT %s FROM %s", column, table); if (!result) { - sLog->outString("Table %s is empty.", table); + sLog->outInfo(LOG_FILTER_GENERAL, "Table %s is empty.", table); return; } diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 476a19b6885..f6d0de28d28 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -320,7 +320,7 @@ bool PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl case DTT_CHARACTER: { if (result->GetFieldCount() <= 68) // avoid crashes on next check - sLog->outCrash("PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table."); + sLog->outFatal(LOG_FILTER_GENERAL, "PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table."); if (result->Fetch()[68].GetUInt32()) // characters.deleteInfos_Account - if filled error return false; @@ -496,7 +496,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s std::string tn = gettablename(line); if (tn.empty()) { - sLog->outError("LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str()); ROLLBACK(DUMP_FILE_BROKEN); } @@ -513,7 +513,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s if (i == DUMP_TABLE_COUNT) { - sLog->outError("LoadPlayerDump: Unknown table: '%s'!", tn.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "LoadPlayerDump: Unknown table: '%s'!", tn.c_str()); ROLLBACK(DUMP_FILE_BROKEN); } @@ -662,7 +662,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s break; } default: - sLog->outError("Unknown dump table type: %u", type); + sLog->outError(LOG_FILTER_GENERAL, "Unknown dump table type: %u", type); break; } diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 54e56174b1a..06f11cfaa2c 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -105,7 +105,7 @@ void Warden::Update() // Kick player if client response delays more than set in config if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS) { - sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u, latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client", + sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u, latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client", _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str()); _session->KickPlayer(); diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 0677758439f..177f373c978 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -43,8 +43,8 @@ void WardenCheckMgr::LoadWardenChecks() // Check if Warden is enabled by config before loading anything if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { - sLog->outString(">> Warden disabled, loading checks skipped."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading checks skipped."); + return; } @@ -52,8 +52,8 @@ void WardenCheckMgr::LoadWardenChecks() if (!result) { - sLog->outString(">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); + return; } @@ -145,8 +145,8 @@ void WardenCheckMgr::LoadWardenChecks() } while (result->NextRow()); - sLog->outString(">> Loaded %u warden checks.", count); - sLog->outString(); + sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden checks.", count); + } void WardenCheckMgr::LoadWardenOverrides() @@ -154,8 +154,8 @@ void WardenCheckMgr::LoadWardenOverrides() // Check if Warden is enabled by config before loading anything if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { - sLog->outString(">> Warden disabled, loading check overrides skipped."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading check overrides skipped."); + return; } @@ -164,8 +164,8 @@ void WardenCheckMgr::LoadWardenOverrides() if (!result) { - sLog->outString(">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); + return; } @@ -182,10 +182,10 @@ void WardenCheckMgr::LoadWardenOverrides() // Check if action value is in range (0-2, see WardenActions enum) if (action > WARDEN_ACTION_BAN) - sLog->outError("Warden check override action out of range (ID: %u, action: %u)", checkId, action); + sLog->outError(LOG_FILTER_WARDEN, "Warden check override action out of range (ID: %u, action: %u)", checkId, action); // Check if check actually exists before accessing the CheckStore vector else if (checkId > CheckStore.size()) - sLog->outError("Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action); + sLog->outError(LOG_FILTER_WARDEN, "Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action); else { CheckStore[checkId]->Action = WardenActions(action); @@ -194,8 +194,8 @@ void WardenCheckMgr::LoadWardenOverrides() } while (result->NextRow()); - sLog->outString(">> Loaded %u warden action overrides.", count); - sLog->outString(); + sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden action overrides.", count); + } WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id) diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 3cc95b9f3f7..96b71912421 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -153,7 +153,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff) if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed"); - sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s", + sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s", _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str()); return; } diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 9aa439ec8c0..7aea6794e01 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -157,7 +157,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff) if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed"); - sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s", + sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s", _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str()); return; } @@ -344,7 +344,7 @@ void WardenWin::HandleData(ByteBuffer &buff) { buff.rpos(buff.wpos()); sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM FAIL"); - sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed checksum. Action: %s", + sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed checksum. Action: %s", _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str()); return; } @@ -357,7 +357,7 @@ void WardenWin::HandleData(ByteBuffer &buff) if (result == 0x00) { sLog->outDebug(LOG_FILTER_WARDEN, "TIMING CHECK FAIL result 0x00"); - sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed timing check. Action: %s", + sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed timing check. Action: %s", _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str()); return; } @@ -501,7 +501,7 @@ void WardenWin::HandleData(ByteBuffer &buff) { WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed); - sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed Warden check %u. Action: %s", + sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed Warden check %u. Action: %s", _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), checkFailed, Penalty(check).c_str()); } diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index 965e6bf3805..896e7161606 100755 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.cpp @@ -37,7 +37,7 @@ Weather::Weather(uint32 zone, WeatherData const* weatherChances) m_type = WEATHER_TYPE_FINE; m_grade = 0; - sLog->outDetail("WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILLISECONDS))); + sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILLISECONDS))); } /// Launch a weather update @@ -97,7 +97,7 @@ bool Weather::ReGenerate() static char const* seasonName[WEATHER_SEASONS] = { "spring", "summer", "fall", "winter" }; - sLog->outDetail("Generating a change in %s weather for zone %u.", seasonName[season], m_zone); + sLog->outInfo(LOG_FILTER_GENERAL, "Generating a change in %s weather for zone %u.", seasonName[season], m_zone); if ((u < 60) && (m_grade < 0.33333334f)) // Get fair { @@ -258,7 +258,7 @@ bool Weather::UpdateWeather() wthstr = "fine"; break; } - sLog->outDetail("Change the weather of zone %u to %s.", m_zone, wthstr); + sLog->outInfo(LOG_FILTER_GENERAL, "Change the weather of zone %u to %s.", m_zone, wthstr); sScriptMgr->OnWeatherChange(this, state, m_grade); return true; diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index bb8fadf08bc..150e9f845ec 100755 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -93,8 +93,8 @@ void LoadWeatherData() if (!result) { - sLog->outErrorDb(">> Loaded 0 weather definitions. DB table `game_weather` is empty."); - sLog->outString(); + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 weather definitions. DB table `game_weather` is empty."); + return; } @@ -115,19 +115,19 @@ void LoadWeatherData() if (wzc.data[season].rainChance > 100) { wzc.data[season].rainChance = 25; - sLog->outErrorDb("Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season); + sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season); } if (wzc.data[season].snowChance > 100) { wzc.data[season].snowChance = 25; - sLog->outErrorDb("Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season); + sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season); } if (wzc.data[season].stormChance > 100) { wzc.data[season].stormChance = 25; - sLog->outErrorDb("Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season); + sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season); } } @@ -137,8 +137,8 @@ void LoadWeatherData() } while (result->NextRow()); - sLog->outString(">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } void SendFineWeatherUpdateToPlayer(Player* player) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 94e42f26dbd..717cfd67ac6 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -267,7 +267,7 @@ void World::AddSession_(WorldSession* s) { AddQueuedPlayer (s); UpdateMaxSessionCounters(); - sLog->outDetail("PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize); + sLog->outInfo(LOG_FILTER_GENERAL, "PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize); return; } @@ -284,7 +284,7 @@ void World::AddSession_(WorldSession* s) float popu = (float)GetActiveSessionCount(); // updated number of users on the server popu /= pLimit; popu *= 2; - sLog->outDetail("Server Population (%f).", popu); + sLog->outInfo(LOG_FILTER_GENERAL, "Server Population (%f).", popu); } } @@ -395,11 +395,9 @@ void World::LoadConfigSettings(bool reload) { if (!ConfigMgr::Load()) { - sLog->outError("World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str()); + sLog->outError(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str()); return; } - - sLog->ReloadConfig(); // Reload log levels and filters } ///- Read the player limit and the Message of the day from the config file @@ -419,27 +417,27 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_HEALTH] = ConfigMgr::GetFloatDefault("Rate.Health", 1); if (rate_values[RATE_HEALTH] < 0) { - sLog->outError("Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); + sLog->outError(LOG_FILTER_GENERAL, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); rate_values[RATE_HEALTH] = 1; } rate_values[RATE_POWER_MANA] = ConfigMgr::GetFloatDefault("Rate.Mana", 1); if (rate_values[RATE_POWER_MANA] < 0) { - sLog->outError("Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); + sLog->outError(LOG_FILTER_GENERAL, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); rate_values[RATE_POWER_MANA] = 1; } rate_values[RATE_POWER_RAGE_INCOME] = ConfigMgr::GetFloatDefault("Rate.Rage.Income", 1); rate_values[RATE_POWER_RAGE_LOSS] = ConfigMgr::GetFloatDefault("Rate.Rage.Loss", 1); if (rate_values[RATE_POWER_RAGE_LOSS] < 0) { - sLog->outError("Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); + sLog->outError(LOG_FILTER_GENERAL, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); rate_values[RATE_POWER_RAGE_LOSS] = 1; } rate_values[RATE_POWER_RUNICPOWER_INCOME] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Income", 1); rate_values[RATE_POWER_RUNICPOWER_LOSS] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Loss", 1); if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0) { - sLog->outError("Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); + sLog->outError(LOG_FILTER_GENERAL, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1; } rate_values[RATE_POWER_FOCUS] = ConfigMgr::GetFloatDefault("Rate.Focus", 1.0f); @@ -463,7 +461,7 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_REPAIRCOST] = ConfigMgr::GetFloatDefault("Rate.RepairCost", 1.0f); if (rate_values[RATE_REPAIRCOST] < 0.0f) { - sLog->outError("Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); + sLog->outError(LOG_FILTER_GENERAL, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); rate_values[RATE_REPAIRCOST] = 0.0f; } rate_values[RATE_REPUTATION_GAIN] = ConfigMgr::GetFloatDefault("Rate.Reputation.Gain", 1.0f); @@ -500,13 +498,13 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TALENT] = ConfigMgr::GetFloatDefault("Rate.Talent", 1.0f); if (rate_values[RATE_TALENT] < 0.0f) { - sLog->outError("Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); + sLog->outError(LOG_FILTER_GENERAL, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); rate_values[RATE_TALENT] = 1.0f; } rate_values[RATE_MOVESPEED] = ConfigMgr::GetFloatDefault("Rate.MoveSpeed", 1.0f); if (rate_values[RATE_MOVESPEED] < 0) { - sLog->outError("Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); + sLog->outError(LOG_FILTER_GENERAL, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); rate_values[RATE_MOVESPEED] = 1.0f; } for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED]; @@ -515,12 +513,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ConfigMgr::GetFloatDefault("TargetPosRecalculateRange", 1.5f); if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE) { - sLog->outError("TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); + sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE; } else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE) { - sLog->outError("TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", + sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE; } @@ -528,12 +526,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = ConfigMgr::GetFloatDefault("DurabilityLoss.OnDeath", 10.0f); if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f) { - sLog->outError("DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f) { - sLog->outError("DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f; @@ -541,25 +539,25 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_DAMAGE] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Damage", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f) { - sLog->outError("DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); + sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ABSORB] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Absorb", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f) { - sLog->outError("DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); + sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_PARRY] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Parry", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f) { - sLog->outError("DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); + sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_BLOCK] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Block", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f) { - sLog->outError("DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); + sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f; } ///- Read other configuration items from the config file @@ -569,7 +567,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_COMPRESSION] = ConfigMgr::GetIntDefault("Compression", 1); if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9) { - sLog->outError("Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); + sLog->outError(LOG_FILTER_GENERAL, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); m_int_configs[CONFIG_COMPRESSION] = 1; } m_bool_configs[CONFIG_ADDON_CHANNEL] = ConfigMgr::GetBoolDefault("AddonChannel", true); @@ -593,14 +591,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = ConfigMgr::GetIntDefault("PlayerSave.Stats.MinLevel", 0); if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL) { - sLog->outError("PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); + sLog->outError(LOG_FILTER_GENERAL, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0; } m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = ConfigMgr::GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS); if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY) { - sLog->outError("GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY); + sLog->outError(LOG_FILTER_GENERAL, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY); m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY; } if (reload) @@ -609,7 +607,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = ConfigMgr::GetIntDefault("MapUpdateInterval", 100); if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY) { - sLog->outError("MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); + sLog->outError(LOG_FILTER_GENERAL, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY; } if (reload) @@ -621,7 +619,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("WorldServerPort", 8085); if (val != m_int_configs[CONFIG_PORT_WORLD]) - sLog->outError("WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); + sLog->outError(LOG_FILTER_GENERAL, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); } else m_int_configs[CONFIG_PORT_WORLD] = ConfigMgr::GetIntDefault("WorldServerPort", 8085); @@ -640,7 +638,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("GameType", 0); if (val != m_int_configs[CONFIG_GAME_TYPE]) - sLog->outError("GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); + sLog->outError(LOG_FILTER_GENERAL, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); } else m_int_configs[CONFIG_GAME_TYPE] = ConfigMgr::GetIntDefault("GameType", 0); @@ -649,7 +647,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); if (val != m_int_configs[CONFIG_REALM_ZONE]) - sLog->outError("RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); + sLog->outError(LOG_FILTER_GENERAL, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); } else m_int_configs[CONFIG_REALM_ZONE] = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); @@ -671,21 +669,21 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PLAYER_NAME] = ConfigMgr::GetIntDefault ("MinPlayerName", 2); if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME) { - sLog->outError("MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); + sLog->outError(LOG_FILTER_GENERAL, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2; } m_int_configs[CONFIG_MIN_CHARTER_NAME] = ConfigMgr::GetIntDefault ("MinCharterName", 2); if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME) { - sLog->outError("MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); + sLog->outError(LOG_FILTER_GENERAL, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2; } m_int_configs[CONFIG_MIN_PET_NAME] = ConfigMgr::GetIntDefault ("MinPetName", 2); if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME) { - sLog->outError("MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); + sLog->outError(LOG_FILTER_GENERAL, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); m_int_configs[CONFIG_MIN_PET_NAME] = 2; } @@ -696,7 +694,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("CharactersPerRealm", 10); if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10) { - sLog->outError("CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_GENERAL, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10; } @@ -704,14 +702,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = ConfigMgr::GetIntDefault("CharactersPerAccount", 50); if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM]) { - sLog->outError("CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_GENERAL, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM]; } m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("HeroicCharactersPerRealm", 1); if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10) { - sLog->outError("HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_GENERAL, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1; } @@ -720,7 +718,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_SKIP_CINEMATICS] = ConfigMgr::GetIntDefault("SkipCinematics", 0); if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2) { - sLog->outError("SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); + sLog->outError(LOG_FILTER_GENERAL, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); m_int_configs[CONFIG_SKIP_CINEMATICS] = 0; } @@ -728,14 +726,14 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) - sLog->outError("MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); } else m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL) { - sLog->outError("MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); + sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL; } @@ -744,25 +742,25 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartPlayerLevel", 1); if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1) { - sLog->outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1; } else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartHeroicPlayerLevel", 55); if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1) { - sLog->outError("StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", + sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55; } else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError("StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", + sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } @@ -770,12 +768,12 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_MONEY] = ConfigMgr::GetIntDefault("StartPlayerMoney", 0); if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0) { - sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); + sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); m_int_configs[CONFIG_START_PLAYER_MONEY] = 0; } else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT) { - sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", + sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT); m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT; } @@ -783,20 +781,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000); if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0) { - sLog->outError("MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); + sLog->outError(LOG_FILTER_GENERAL, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0; } m_int_configs[CONFIG_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("StartHonorPoints", 0); if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0) { - sLog->outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0); m_int_configs[CONFIG_START_HONOR_POINTS] = 0; } else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS]) { - sLog->outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS]; } @@ -804,20 +802,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_ARENA_POINTS] = ConfigMgr::GetIntDefault("MaxArenaPoints", 10000); if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0) { - sLog->outError("MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); + sLog->outError(LOG_FILTER_GENERAL, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0; } m_int_configs[CONFIG_START_ARENA_POINTS] = ConfigMgr::GetIntDefault("StartArenaPoints", 0); if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0) { - sLog->outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0); m_int_configs[CONFIG_START_ARENA_POINTS] = 0; } else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS]) { - sLog->outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS]; } @@ -825,7 +823,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("RecruitAFriend.MaxLevel", 60); if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError("RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", + sLog->outError(LOG_FILTER_GENERAL, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60); m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60; } @@ -845,7 +843,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PETITION_SIGNS] = ConfigMgr::GetIntDefault("MinPetitionSigns", 9); if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9) { - sLog->outError("MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); + sLog->outError(LOG_FILTER_GENERAL, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9; } @@ -860,13 +858,13 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_GM_LEVEL] = ConfigMgr::GetIntDefault("GM.StartLevel", 1); if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL]) { - sLog->outError("GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", + sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]); m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL]; } else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL) { - sLog->outError("GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); + sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL; } m_bool_configs[CONFIG_ALLOW_GM_GROUP] = ConfigMgr::GetBoolDefault("GM.AllowInvite", false); @@ -881,7 +879,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_UPTIME_UPDATE] = ConfigMgr::GetIntDefault("UpdateUptimeInterval", 10); if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0) { - sLog->outError("UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); + sLog->outError(LOG_FILTER_GENERAL, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); m_int_configs[CONFIG_UPTIME_UPDATE] = 10; } if (reload) @@ -894,7 +892,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearInterval", 10); if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0) { - sLog->outError("LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); + sLog->outError(LOG_FILTER_GENERAL, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10; } if (reload) @@ -903,7 +901,7 @@ void World::LoadConfigSettings(bool reload) m_timers[WUPDATE_CLEANDB].Reset(); } m_int_configs[CONFIG_LOGDB_CLEARTIME] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default - sLog->outString("Will clear `logs` table of entries older than %i seconds every %u minutes.", + sLog->outInfo(LOG_FILTER_GENERAL, "Will clear `logs` table of entries older than %i seconds every %u minutes.", m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = ConfigMgr::GetIntDefault("SkillChance.Orange", 100); @@ -928,7 +926,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = ConfigMgr::GetIntDefault("MaxOverspeedPings", 2); if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2) { - sLog->outError("MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); + sLog->outError(LOG_FILTER_GENERAL, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2; } @@ -943,7 +941,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("Expansion", 1); if (val != m_int_configs[CONFIG_EXPANSION]) - sLog->outError("Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); + sLog->outError(LOG_FILTER_GENERAL, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); } else m_int_configs[CONFIG_EXPANSION] = ConfigMgr::GetIntDefault("Expansion", 1); @@ -975,7 +973,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = ConfigMgr::GetIntDefault("Battleground.Random.ResetHour", 6); if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23) { - sLog->outError("Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); + sLog->outError(LOG_FILTER_GENERAL, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6; } @@ -1042,10 +1040,10 @@ void World::LoadConfigSettings(bool reload) if (clientCacheId > 0) { m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId; - sLog->outString("Client cache version set to: %u", clientCacheId); + sLog->outInfo(LOG_FILTER_GENERAL, "Client cache version set to: %u", clientCacheId); } else - sLog->outError("ClientCacheVersion can't be negative %d, ignored.", clientCacheId); + sLog->outError(LOG_FILTER_GENERAL, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId); } m_int_configs[CONFIG_INSTANT_LOGOUT] = ConfigMgr::GetIntDefault("InstantLogout", SEC_MODERATOR); @@ -1061,12 +1059,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceOnContinents = ConfigMgr::GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE); if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceOnContinents = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE) { - sLog->outError("Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE; } @@ -1074,12 +1072,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInInstances = ConfigMgr::GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE); if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError("Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInInstances = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE) { - sLog->outError("Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE; } @@ -1087,12 +1085,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInBGArenas = ConfigMgr::GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS); if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError("Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInBGArenas = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE) { - sLog->outError("Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE; } @@ -1113,12 +1111,12 @@ void World::LoadConfigSettings(bool reload) if (reload) { if (dataPath != m_dataPath) - sLog->outError("DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); } else { m_dataPath = dataPath; - sLog->outString("Using DataDir %s", m_dataPath.c_str()); + sLog->outInfo(LOG_FILTER_GENERAL, "Using DataDir %s", m_dataPath.c_str()); } m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = ConfigMgr::GetBoolDefault("vmap.enableIndoorCheck", 0); @@ -1129,19 +1127,19 @@ void World::LoadConfigSettings(bool reload) std::string ignoreSpellIds = ConfigMgr::GetStringDefault("vmap.ignoreSpellIds", ""); if (!enableHeight) - sLog->outError("VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); + sLog->outError(LOG_FILTER_GENERAL, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS); VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight); VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str()); - sLog->outString("WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS); - sLog->outString("WORLD: VMap data directory is: %svmaps", m_dataPath.c_str()); + sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS); + sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap data directory is: %svmaps", m_dataPath.c_str()); m_int_configs[CONFIG_MAX_WHO] = ConfigMgr::GetIntDefault("MaxWhoListReturns", 49); m_bool_configs[CONFIG_PET_LOS] = ConfigMgr::GetBoolDefault("vmap.petLOS", true); m_bool_configs[CONFIG_START_ALL_SPELLS] = ConfigMgr::GetBoolDefault("PlayerStart.AllSpells", false); if (m_bool_configs[CONFIG_START_ALL_SPELLS]) - sLog->outString("WORLD: WARNING: PlayerStart.AllSpells enabled - may not function as intended!"); + sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: WARNING: PlayerStart.AllSpells enabled - may not function as intended!"); m_int_configs[CONFIG_HONOR_AFTER_DUEL] = ConfigMgr::GetIntDefault("HonorPointsAfterDuel", 0); m_bool_configs[CONFIG_START_ALL_EXPLORED] = ConfigMgr::GetBoolDefault("PlayerStart.MapsExplored", false); m_bool_configs[CONFIG_START_ALL_REP] = ConfigMgr::GetBoolDefault("PlayerStart.AllReputation", false); @@ -1237,7 +1235,7 @@ void World::SetInitialWorldSettings() !MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) || !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f)))) { - sLog->outError("Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str()); exit(1); } @@ -1248,8 +1246,8 @@ void World::SetInitialWorldSettings() sGameEventMgr->Initialize(); ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. - sLog->outString(); - sLog->outString("Loading Trinity strings..."); + + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trinity strings..."); if (!sObjectMgr->LoadTrinityStrings()) exit(1); // Error message displayed in function already @@ -1273,36 +1271,36 @@ void World::SetInitialWorldSettings() CharacterDatabase.Execute(stmt); ///- Load the DBC files - sLog->outString("Initialize data stores..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Initialize data stores..."); LoadDBCStores(m_dataPath); DetectDBCLang(); - sLog->outString("Loading spell dbc data corrections..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell dbc data corrections..."); sSpellMgr->LoadDbcDataCorrections(); - sLog->outString("Loading SpellInfo store..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellInfo store..."); sSpellMgr->LoadSpellInfoStore(); - sLog->outString("Loading SkillLineAbilityMultiMap Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading SkillLineAbilityMultiMap Data..."); sSpellMgr->LoadSkillLineAbilityMap(); - sLog->outString("Loading spell custom attributes..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell custom attributes..."); sSpellMgr->LoadSpellCustomAttr(); - sLog->outString("Loading GameObject models..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObject models..."); LoadGameObjectModelList(); - sLog->outString("Loading Script Names..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Script Names..."); sObjectMgr->LoadScriptNames(); - sLog->outString("Loading Instance Template..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Instance Template..."); sObjectMgr->LoadInstanceTemplate(); // Must be called before `creature_respawn`/`gameobject_respawn` tables - sLog->outString("Loading instances..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading instances..."); sInstanceSaveMgr->LoadInstances(); - sLog->outString("Loading Localization strings..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Localization strings..."); uint32 oldMSTime = getMSTime(); sObjectMgr->LoadCreatureLocales(); sObjectMgr->LoadGameObjectLocales(); @@ -1315,308 +1313,308 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadPointOfInterestLocales(); sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) - sLog->outString(">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); + - sLog->outString("Loading Page Texts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Page Texts..."); sObjectMgr->LoadPageTexts(); - sLog->outString("Loading Game Object Templates..."); // must be after LoadPageTexts + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Object Templates..."); // must be after LoadPageTexts sObjectMgr->LoadGameObjectTemplate(); - sLog->outString("Loading Spell Rank Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Rank Data..."); sSpellMgr->LoadSpellRanks(); - sLog->outString("Loading Spell Required Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Required Data..."); sSpellMgr->LoadSpellRequired(); - sLog->outString("Loading Spell Group types..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group types..."); sSpellMgr->LoadSpellGroups(); - sLog->outString("Loading Spell Learn Skills..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Skills..."); sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks - sLog->outString("Loading Spell Learn Spells..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Spells..."); sSpellMgr->LoadSpellLearnSpells(); - sLog->outString("Loading Spell Proc Event conditions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc Event conditions..."); sSpellMgr->LoadSpellProcEvents(); - sLog->outString("Loading Spell Proc conditions and data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc conditions and data..."); sSpellMgr->LoadSpellProcs(); - sLog->outString("Loading Spell Bonus Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); - sLog->outString("Loading Aggro Spells Definitions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); - sLog->outString("Loading Spell Group Stack Rules..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); - sLog->outString("Loading NPC Texts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading NPC Texts..."); sObjectMgr->LoadGossipText(); - sLog->outString("Loading Enchant Spells Proc datas..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Enchant Spells Proc datas..."); sSpellMgr->LoadSpellEnchantProcData(); - sLog->outString("Loading Item Random Enchantments Table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); - sLog->outString("Loading Disables"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Disables"); DisableMgr::LoadDisables(); // must be before loading quests and items - sLog->outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sObjectMgr->LoadItemTemplates(); - sLog->outString("Loading Item set names..."); // must be after LoadItemPrototypes + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item set names..."); // must be after LoadItemPrototypes sObjectMgr->LoadItemSetNames(); - sLog->outString("Loading Creature Model Based Info Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Model Based Info Data..."); sObjectMgr->LoadCreatureModelInfo(); - sLog->outString("Loading Equipment templates..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Equipment templates..."); sObjectMgr->LoadEquipmentTemplates(); - sLog->outString("Loading Creature templates..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature templates..."); sObjectMgr->LoadCreatureTemplates(); - sLog->outString("Loading Creature template addons..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature template addons..."); sObjectMgr->LoadCreatureTemplateAddons(); - sLog->outString("Loading Reputation Reward Rates..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Reward Rates..."); sObjectMgr->LoadReputationRewardRate(); - sLog->outString("Loading Creature Reputation OnKill Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Reputation OnKill Data..."); sObjectMgr->LoadReputationOnKill(); - sLog->outString("Loading Reputation Spillover Data..." ); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Spillover Data..."); sObjectMgr->LoadReputationSpilloverTemplate(); - sLog->outString("Loading Points Of Interest Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Points Of Interest Data..."); sObjectMgr->LoadPointsOfInterest(); - sLog->outString("Loading Creature Base Stats..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Base Stats..."); sObjectMgr->LoadCreatureClassLevelStats(); - sLog->outString("Loading Creature Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Data..."); sObjectMgr->LoadCreatures(); - sLog->outString("Loading pet levelup spells..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet levelup spells..."); sSpellMgr->LoadPetLevelupSpellMap(); - sLog->outString("Loading pet default spells additional to levelup spells..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet default spells additional to levelup spells..."); sSpellMgr->LoadPetDefaultSpells(); - sLog->outString("Loading Creature Addon Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Addon Data..."); sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() - sLog->outString("Loading Gameobject Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gameobject Data..."); sObjectMgr->LoadGameobjects(); - sLog->outString("Loading Creature Linked Respawn..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Linked Respawn..."); sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects() - sLog->outString("Loading Weather Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Weather Data..."); WeatherMgr::LoadWeatherData(); - sLog->outString("Loading Quests..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests..."); sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables - sLog->outString("Checking Quest Disables"); + sLog->outInfo(LOG_FILTER_GENERAL, "Checking Quest Disables"); DisableMgr::CheckQuestDisables(); // must be after loading quests - sLog->outString("Loading Quest POI"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest POI"); sObjectMgr->LoadQuestPOI(); - sLog->outString("Loading Quests Relations..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations..."); sObjectMgr->LoadQuestRelations(); // must be after quest load - sLog->outString("Loading Objects Pooling Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Objects Pooling Data..."); sPoolMgr->LoadFromDB(); - sLog->outString("Loading Game Event Data..."); // must be after loading pools fully + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Event Data..."); // must be after loading pools fully sGameEventMgr->LoadFromDB(); - sLog->outString("Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests + sLog->outInfo(LOG_FILTER_GENERAL, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests sObjectMgr->LoadNPCSpellClickSpells(); - sLog->outString("Loading Vehicle Template Accessories..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Template Accessories..."); sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outString("Loading Vehicle Accessories..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Accessories..."); sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outString("Loading Dungeon boss data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Dungeon boss data..."); sObjectMgr->LoadInstanceEncounters(); - sLog->outString("Loading LFG rewards..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading LFG rewards..."); sLFGMgr->LoadRewards(); - sLog->outString("Loading SpellArea Data..."); // must be after quest load + sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellArea Data..."); // must be after quest load sSpellMgr->LoadSpellAreas(); - sLog->outString("Loading AreaTrigger definitions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); - sLog->outString("Loading Access Requirements..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Access Requirements..."); sObjectMgr->LoadAccessRequirements(); // must be after item template load - sLog->outString("Loading Quest Area Triggers..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests - sLog->outString("Loading Tavern Area Triggers..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); - sLog->outString("Loading AreaTrigger script names..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger script names..."); sObjectMgr->LoadAreaTriggerScripts(); - sLog->outString("Loading Graveyard-zone links..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Graveyard-zone links..."); sObjectMgr->LoadGraveyardZones(); - sLog->outString("Loading spell pet auras..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); - sLog->outString("Loading Spell target coordinates..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell target coordinates..."); sSpellMgr->LoadSpellTargetPositions(); - sLog->outString("Loading enchant custom attributes..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading enchant custom attributes..."); sSpellMgr->LoadEnchantCustomAttr(); - sLog->outString("Loading linked spells..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading linked spells..."); sSpellMgr->LoadSpellLinked(); - sLog->outString("Loading Player Create Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Data..."); sObjectMgr->LoadPlayerInfo(); - sLog->outString("Loading Exploration BaseXP Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Exploration BaseXP Data..."); sObjectMgr->LoadExplorationBaseXP(); - sLog->outString("Loading Pet Name Parts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Pet Name Parts..."); sObjectMgr->LoadPetNames(); CharacterDatabaseCleaner::CleanDatabase(); - sLog->outString("Loading the max pet number..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading the max pet number..."); sObjectMgr->LoadPetNumber(); - sLog->outString("Loading pet level stats..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet level stats..."); sObjectMgr->LoadPetLevelInfo(); - sLog->outString("Loading Player Corpses..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Corpses..."); sObjectMgr->LoadCorpses(); - sLog->outString("Loading Player level dependent mail rewards..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); // Loot tables LoadLootTables(); - sLog->outString("Loading Skill Discovery Table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); - sLog->outString("Loading Skill Extra Item Table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); - sLog->outString("Loading Skill Fishing base level requirements..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Fishing base level requirements..."); sObjectMgr->LoadFishingBaseSkillLevel(); - sLog->outString("Loading Achievements..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievements..."); sAchievementMgr->LoadAchievementReferenceList(); - sLog->outString("Loading Achievement Criteria Lists..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Lists..."); sAchievementMgr->LoadAchievementCriteriaList(); - sLog->outString("Loading Achievement Criteria Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); - sLog->outString("Loading Achievement Rewards..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Rewards..."); sAchievementMgr->LoadRewards(); - sLog->outString("Loading Achievement Reward Locales..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Reward Locales..."); sAchievementMgr->LoadRewardLocales(); - sLog->outString("Loading Completed Achievements..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Completed Achievements..."); sAchievementMgr->LoadCompletedAchievements(); // Delete expired auctions before loading - sLog->outString("Deleting expired auctions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired auctions..."); sAuctionMgr->DeleteExpiredAuctionsAtStartup(); ///- Load dynamic data tables from the database - sLog->outString("Loading Item Auctions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Auctions..."); sAuctionMgr->LoadAuctionItems(); - sLog->outString("Loading Auctions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Auctions..."); sAuctionMgr->LoadAuctions(); sGuildMgr->LoadGuilds(); - sLog->outString("Loading ArenaTeams..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading ArenaTeams..."); sArenaTeamMgr->LoadArenaTeams(); - sLog->outString("Loading Groups..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Groups..."); sGroupMgr->LoadGroups(); - sLog->outString("Loading ReservedNames..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames..."); sObjectMgr->LoadReservedPlayersNames(); - sLog->outString("Loading GameObjects for quests..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); - sLog->outString("Loading BattleMasters..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading BattleMasters..."); sBattlegroundMgr->LoadBattleMastersEntry(); - sLog->outString("Loading GameTeleports..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameTeleports..."); sObjectMgr->LoadGameTele(); - sLog->outString("Loading Gossip menu..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu..."); sObjectMgr->LoadGossipMenu(); - sLog->outString("Loading Gossip menu options..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu options..."); sObjectMgr->LoadGossipMenuItems(); - sLog->outString("Loading Vendors..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vendors..."); sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate - sLog->outString("Loading Trainers..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trainers..."); sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate - sLog->outString("Loading Waypoints..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Waypoints..."); sWaypointMgr->Load(); - sLog->outString("Loading SmartAI Waypoints..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI Waypoints..."); sSmartWaypointMgr->LoadFromDB(); - sLog->outString("Loading Creature Formations..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Formations..."); sFormationMgr->LoadCreatureFormations(); - sLog->outString("Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions + sLog->outInfo(LOG_FILTER_GENERAL, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions LoadWorldStates(); - sLog->outString("Loading Conditions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Conditions..."); sConditionMgr->LoadConditions(); - sLog->outString("Loading faction change achievement pairs..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change achievement pairs..."); sObjectMgr->LoadFactionChangeAchievements(); - sLog->outString("Loading faction change spell pairs..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change spell pairs..."); sObjectMgr->LoadFactionChangeSpells(); - sLog->outString("Loading faction change item pairs..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change item pairs..."); sObjectMgr->LoadFactionChangeItems(); - sLog->outString("Loading faction change reputation pairs..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change reputation pairs..."); sObjectMgr->LoadFactionChangeReputations(); - sLog->outString("Loading GM tickets..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM tickets..."); sTicketMgr->LoadTickets(); - sLog->outString("Loading GM surveys..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM surveys..."); sTicketMgr->LoadSurveys(); - sLog->outString("Loading client addons..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading client addons..."); AddonMgr::LoadFromDB(); ///- Handle outdated emails (delete/return) - sLog->outString("Returning old mails..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Returning old mails..."); sObjectMgr->ReturnOrDeleteOldMails(false); - sLog->outString("Loading Autobroadcasts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Autobroadcasts..."); LoadAutobroadcasts(); ///- Load and initialize scripts @@ -1627,42 +1625,42 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) sObjectMgr->LoadWaypointScripts(); - sLog->outString("Loading Scripts text locales..."); // must be after Load*Scripts calls + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Scripts text locales..."); // must be after Load*Scripts calls sObjectMgr->LoadDbScriptStrings(); - sLog->outString("Loading CreatureEventAI Texts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Texts..."); sEventAIMgr->LoadCreatureEventAI_Texts(); - sLog->outString("Loading CreatureEventAI Summons..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Summons..."); sEventAIMgr->LoadCreatureEventAI_Summons(); - sLog->outString("Loading CreatureEventAI Scripts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Scripts..."); sEventAIMgr->LoadCreatureEventAI_Scripts(); - sLog->outString("Loading spell script names..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell script names..."); sObjectMgr->LoadSpellScriptNames(); - sLog->outString("Loading Creature Texts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); - sLog->outString("Loading Creature Text Locales..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Text Locales..."); sCreatureTextMgr->LoadCreatureTextLocales(); - sLog->outString("Initializing Scripts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Initializing Scripts..."); sScriptMgr->Initialize(); sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized - sLog->outString("Validating spell scripts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Validating spell scripts..."); sObjectMgr->ValidateSpellScripts(); - sLog->outString("Loading SmartAI scripts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); - sLog->outString("Loading Calendar data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Calendar data..."); sCalendarMgr->LoadFromDB(); ///- Initialize game time and timers - sLog->outString("Initialize game time and timers"); + sLog->outInfo(LOG_FILTER_GENERAL, "Initialize game time and timers"); m_gameTime = time(NULL); m_startTime = m_gameTime; @@ -1689,16 +1687,16 @@ void World::SetInitialWorldSettings() mail_timer = ((((localtime(&m_gameTime)->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval()); //1440 mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval())); - sLog->outDetail("Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires)); + sLog->outInfo(LOG_FILTER_GENERAL, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires)); ///- Initilize static helper structures AIRegistry::Initialize(); ///- Initialize MapManager - sLog->outString("Starting Map System"); + sLog->outInfo(LOG_FILTER_GENERAL, "Starting Map System"); sMapMgr->Initialize(); - sLog->outString("Starting Game Event system..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Starting Game Event system..."); uint32 nextGameEvent = sGameEventMgr->StartSystem(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event @@ -1708,61 +1706,51 @@ void World::SetInitialWorldSettings() // Delete all custom channels which haven't been used for PreserveCustomChannelDuration days. Channel::CleanOldChannelsInDB(); - sLog->outString("Starting Arena Season..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Starting Arena Season..."); sGameEventMgr->StartArenaSeason(); sTicketMgr->Initialize(); ///- Initialize Battlegrounds - sLog->outString("Starting Battleground System"); + sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battleground System"); sBattlegroundMgr->CreateInitialBattlegrounds(); sBattlegroundMgr->InitAutomaticArenaPointDistribution(); ///- Initialize outdoor pvp - sLog->outString("Starting Outdoor PvP System"); + sLog->outInfo(LOG_FILTER_GENERAL, "Starting Outdoor PvP System"); sOutdoorPvPMgr->InitOutdoorPvP(); - sLog->outString("Loading Transports..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transports..."); sMapMgr->LoadTransports(); - sLog->outString("Loading Transport NPCs..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transport NPCs..."); sMapMgr->LoadTransportNPCs(); ///- Initialize Warden - sLog->outString("Loading Warden Checks..." ); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Checks..."); sWardenCheckMgr->LoadWardenChecks(); - sLog->outString("Loading Warden Action Overrides..." ); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Action Overrides..."); sWardenCheckMgr->LoadWardenOverrides(); - sLog->outString("Deleting expired bans..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired bans..."); LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query - sLog->outString("Calculate next daily quest reset time..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next daily quest reset time..."); InitDailyQuestResetTime(); - sLog->outString("Calculate next weekly quest reset time..." ); + sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next weekly quest reset time..."); InitWeeklyQuestResetTime(); - sLog->outString("Calculate random battleground reset time..." ); + sLog->outInfo(LOG_FILTER_GENERAL, "Calculate random battleground reset time..."); InitRandomBGResetTime(); LoadCharacterNameData(); - // possibly enable db logging; avoid massive startup spam by doing it here. - if (sLog->GetLogDBLater()) - { - sLog->outString("Enabling database logging..."); - sLog->SetLogDBLater(false); - sLog->SetLogDB(true); - } - else - sLog->SetLogDB(false); - uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); - sLog->outString(); - sLog->outString("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); - sLog->outString(); + + sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); + sLog->EnableDBAppenders(); } void World::DetectDBCLang() @@ -1771,7 +1759,7 @@ void World::DetectDBCLang() if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES) { - sLog->outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); + sLog->outError(LOG_FILTER_GENERAL, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); m_lang_confid = LOCALE_enUS; } @@ -1799,14 +1787,14 @@ void World::DetectDBCLang() if (default_locale >= TOTAL_LOCALES) { - sLog->outError("Unable to determine your DBC Locale! (corrupt DBC?)"); + sLog->outError(LOG_FILTER_GENERAL, "Unable to determine your DBC Locale! (corrupt DBC?)"); exit(1); } m_defaultDbcLocale = LocaleConstant(default_locale); - sLog->outString("Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); + } void World::RecordTimeDiff(const char *text, ...) @@ -1829,7 +1817,7 @@ void World::RecordTimeDiff(const char *text, ...) va_start(ap, text); vsnprintf(str, 256, text, ap); va_end(ap); - sLog->outDetail("Difftime %s: %u.", str, diff); + sLog->outInfo(LOG_FILTER_GENERAL, "Difftime %s: %u.", str, diff); } m_currentTime = thisTime; @@ -1845,8 +1833,8 @@ void World::LoadAutobroadcasts() if (!result) { - sLog->outString(">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); + return; } @@ -1863,8 +1851,8 @@ void World::LoadAutobroadcasts() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } /// Update the World ! @@ -1876,7 +1864,7 @@ void World::Update(uint32 diff) { if (m_updateTimeSum > m_int_configs[CONFIG_INTERVAL_LOG_UPDATE]) { - sLog->outBasic("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); + sLog->outDebug(LOG_FILTER_GENERAL, "Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); m_updateTimeSum = m_updateTime; m_updateTimeCount = 1; } @@ -2030,7 +2018,7 @@ void World::Update(uint32 diff) if (m_timers[WUPDATE_PINGDB].Passed()) { m_timers[WUPDATE_PINGDB].Reset(); - sLog->outDetail("Ping MySQL to keep connection alive"); + sLog->outInfo(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive"); CharacterDatabase.KeepAlive(); LoginDatabase.KeepAlive(); WorldDatabase.KeepAlive(); @@ -2504,7 +2492,7 @@ void World::ShutdownMsg(bool show, Player* player) ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME; SendServerMessage(msgid, str.c_str(), player); - sLog->outStaticDebug("Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str()); + sLog->outDebug(LOG_FILTER_GENERAL, "Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str()); } } @@ -2522,7 +2510,7 @@ void World::ShutdownCancel() m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value SendServerMessage(msgid); - sLog->outStaticDebug("Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown")); + sLog->outDebug(LOG_FILTER_GENERAL, "Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown")); sScriptMgr->OnShutdownCancel(); } @@ -2578,7 +2566,7 @@ void World::ProcessCliCommands() CliCommandHolder* command = NULL; while (cliCmdQueue.next(command)) { - sLog->outDetail("CLI command under processing..."); + sLog->outInfo(LOG_FILTER_GENERAL, "CLI command under processing..."); zprint = command->m_print; callbackArg = command->m_callbackArg; CliHandler handler(callbackArg, zprint); @@ -2619,7 +2607,7 @@ void World::SendAutoBroadcast() sWorld->SendGlobalMessage(&data); } - sLog->outDetail("AutoBroadcast: '%s'", msg.c_str()); + sLog->outInfo(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str()); } void World::UpdateRealmCharCount(uint32 accountId) @@ -2721,7 +2709,7 @@ void World::InitRandomBGResetTime() void World::ResetDailyQuests() { - sLog->outDetail("Daily quests reset for all characters."); + sLog->outInfo(LOG_FILTER_GENERAL, "Daily quests reset for all characters."); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_DAILY); CharacterDatabase.Execute(stmt); @@ -2782,7 +2770,7 @@ void World::ResetEventSeasonalQuests(uint16 event_id) void World::ResetRandomBG() { - sLog->outDetail("Random BG status reset for all characters."); + sLog->outInfo(LOG_FILTER_GENERAL, "Random BG status reset for all characters."); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_BATTLEGROUND_RANDOM); CharacterDatabase.Execute(stmt); @@ -2846,8 +2834,8 @@ void World::LoadWorldStates() if (!result) { - sLog->outString(">> Loaded 0 world states. DB table `worldstates` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 world states. DB table `worldstates` is empty!"); + return; } @@ -2861,8 +2849,8 @@ void World::LoadWorldStates() } while (result->NextRow()); - sLog->outString(">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } // Setting a worldstate will save it to DB @@ -2918,12 +2906,12 @@ void World::ProcessQueryCallbacks() void World::LoadCharacterNameData() { - sLog->outString("Loading character name data"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading character name data"); QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL"); if (!result) { - sLog->outError("No character name data loaded, empty query"); + sLog->outError(LOG_FILTER_GENERAL, "No character name data loaded, empty query"); return; } @@ -2937,7 +2925,7 @@ void World::LoadCharacterNameData() ++count; } while (result->NextRow()); - sLog->outString("Loaded name data for %u characters", count); + sLog->outInfo(LOG_FILTER_GENERAL, "Loaded name data for %u characters", count); } void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass) diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index b52102479b5..db975419a23 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -38,7 +38,7 @@ public: { "addon", SEC_ADMINISTRATOR, true, &HandleAccountSetAddonCommand, "", NULL }, { "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "", NULL }, { "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand accountCommandTable[] = { @@ -50,12 +50,12 @@ public: { "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable }, { "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL }, { "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { { "account", SEC_PLAYER, true, NULL, "", accountCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; return commandTable; } @@ -110,7 +110,11 @@ public: case AOR_OK: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); if (handler->GetSession()) - sLog->outChar("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->outDebug(LOG_FILTER_PLAYER, "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()); + } break; case AOR_NAME_TOO_LONG: handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG); @@ -232,8 +236,8 @@ public: } else handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str()); - - } while (result->NextRow()); + } + while (result->NextRow()); handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR); return true; @@ -377,7 +381,6 @@ public: handler->SetSentErrorMessage(true); return false; } - } // Let set addon state only for lesser (strong) security level @@ -535,8 +538,8 @@ public: ///- Get the command line arguments char* account = strtok((char*)args, " "); - char* password = strtok(NULL, " "); - char* passwordConfirmation = strtok(NULL, " "); + char* password = strtok(NULL, " "); + char* passwordConfirmation = strtok(NULL, " "); if (!account || !password || !passwordConfirmation) return false; @@ -589,7 +592,6 @@ public: handler->SetSentErrorMessage(true); return false; } - return true; } }; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index c7bcde01e9b..355ff195cf5 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -410,7 +410,7 @@ public: } else { - sLog->outError("Sending opcode that has unknown type '%s'", type.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "Sending opcode that has unknown type '%s'", type.c_str()); break; } } @@ -1325,7 +1325,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + sLog->outInfo(LOG_FILTER_SQL, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); return true; diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 232aad9f21c..167c56c20a2 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -133,7 +133,7 @@ public: if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) { // report to DB errors log as in loading case - sLog->outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId); + sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId); handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, objectId); handler->SetSentErrorMessage(true); return false; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index f8ad3f7c37e..80847d7dec4 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1278,7 +1278,7 @@ public: if (!playerTarget) playerTarget = player; - sLog->outDetail(handler->GetTrinityString(LANG_ADDITEM), itemId, count); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count); ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); if (!itemTemplate) @@ -1357,7 +1357,7 @@ public: if (!playerTarget) playerTarget = player; - sLog->outDetail(handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); bool found = false; ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); @@ -2508,7 +2508,7 @@ public: if (!pet->InitStatsForLevel(creatureTarget->getLevel())) { - sLog->outError("InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); handler->PSendSysMessage("Error 2"); delete pet; return false; diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 60c5e1cf162..1747b80efd5 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -198,7 +198,7 @@ public: target->SetMaxPower(POWER_ENERGY, energym); target->SetPower(POWER_ENERGY, energy); - sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); return true; } @@ -1010,7 +1010,7 @@ public: { int32 newmoney = int32(moneyuser) + addmoney; - sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney); if (newmoney <= 0) { handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str()); @@ -1042,7 +1042,7 @@ public: target->ModifyMoney(addmoney); } - sLog->outDetail(handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney()); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney()); return true; } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 832f7958fc8..77fc2918e0b 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -804,7 +804,7 @@ public: if (dontdel_str) { - //sLog->outError("DEBUG: All 3 params are set"); + //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: All 3 params are set"); // All 3 params are set // GUID @@ -812,7 +812,7 @@ public: // doNotDEL if (stricmp(dontdel_str, "NODEL") == 0) { - //sLog->outError("DEBUG: doNotDelete = true;"); + //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: doNotDelete = true;"); doNotDelete = true; } } @@ -821,10 +821,10 @@ public: // Only 2 params - but maybe NODEL is set if (type_str) { - sLog->outError("DEBUG: Only 2 params "); + sLog->outError(LOG_FILTER_GENERAL, "DEBUG: Only 2 params "); if (stricmp(type_str, "NODEL") == 0) { - //sLog->outError("DEBUG: type_str, NODEL "); + //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: type_str, NODEL "); doNotDelete = true; type_str = NULL; } diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 1c119fdef4c..c8568feaeb6 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -222,7 +222,7 @@ public: static bool HandleReloadAllLootCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables..."); LoadLootTables(); handler->SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded."); sConditionMgr->LoadConditions(true); @@ -245,7 +245,7 @@ public: HandleReloadQuestPOICommand(handler, "a"); HandleReloadQuestTemplateCommand(handler, "a"); - sLog->outString("Re-Loading Quests Relations..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quests Relations..."); sObjectMgr->LoadQuestRelations(); handler->SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded."); return true; @@ -260,7 +260,7 @@ public: return false; } - sLog->outString("Re-Loading Scripts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts..."); HandleReloadGameObjectScriptsCommand(handler, "a"); HandleReloadEventScriptsCommand(handler, "a"); HandleReloadQuestEndScriptsCommand(handler, "a"); @@ -333,7 +333,7 @@ public: static bool HandleReloadConfigCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading config settings..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading config settings..."); sWorld->LoadConfigSettings(true); sMapMgr->InitializeVisibilityDistanceInfo(); handler->SendGlobalGMSysMessage("World config settings reloaded."); @@ -342,7 +342,7 @@ public: static bool HandleReloadAccessRequirementCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Access Requirement definitions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Access Requirement definitions..."); sObjectMgr->LoadAccessRequirements(); handler->SendGlobalGMSysMessage("DB table `access_requirement` reloaded."); return true; @@ -350,7 +350,7 @@ public: static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Additional Achievement Criteria Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Additional Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); handler->SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded."); return true; @@ -358,7 +358,7 @@ public: static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Achievement Reward Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Achievement Reward Data..."); sAchievementMgr->LoadRewards(); handler->SendGlobalGMSysMessage("DB table `achievement_reward` reloaded."); return true; @@ -366,7 +366,7 @@ public: static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Tavern Area Triggers..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded."); return true; @@ -374,7 +374,7 @@ public: static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading AreaTrigger teleport definitions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading AreaTrigger teleport definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); handler->SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded."); return true; @@ -382,7 +382,7 @@ public: static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Autobroadcasts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Autobroadcasts..."); sWorld->LoadAutobroadcasts(); handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded."); return true; @@ -397,7 +397,7 @@ public: static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading creature award reputation definitions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading creature award reputation definitions..."); sObjectMgr->LoadReputationOnKill(); handler->SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded."); return true; @@ -431,7 +431,7 @@ public: continue; } - sLog->outString("Reloading creature template entry %u", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Reloading creature template entry %u", entry); Field* fields = result->Fetch(); @@ -527,7 +527,7 @@ public: static bool HandleReloadCreatureQuestRelationsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Quests Relations... (`creature_questrelation`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questrelation`)"); sObjectMgr->LoadCreatureQuestRelations(); handler->SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded."); return true; @@ -535,7 +535,7 @@ public: static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Linked Respawns... (`creature_linked_respawn`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Linked Respawns... (`creature_linked_respawn`)"); sObjectMgr->LoadLinkedRespawn(); handler->SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded."); return true; @@ -543,7 +543,7 @@ public: static bool HandleReloadCreatureQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Quests Relations... (`creature_involvedrelation`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_involvedrelation`)"); sObjectMgr->LoadCreatureInvolvedRelations(); handler->SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded."); return true; @@ -551,7 +551,7 @@ public: static bool HandleReloadGossipMenuCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `gossip_menu` Table!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table!"); sObjectMgr->LoadGossipMenu(); handler->SendGlobalGMSysMessage("DB table `gossip_menu` reloaded."); sConditionMgr->LoadConditions(true); @@ -560,7 +560,7 @@ public: static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `gossip_menu_option` Table!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table!"); sObjectMgr->LoadGossipMenuItems(); handler->SendGlobalGMSysMessage("DB table `gossip_menu_option` reloaded."); sConditionMgr->LoadConditions(true); @@ -569,7 +569,7 @@ public: static bool HandleReloadGOQuestRelationsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Quests Relations... (`gameobject_questrelation`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questrelation`)"); sObjectMgr->LoadGameobjectQuestRelations(); handler->SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded."); return true; @@ -577,7 +577,7 @@ public: static bool HandleReloadGOQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Quests Relations... (`gameobject_involvedrelation`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_involvedrelation`)"); sObjectMgr->LoadGameobjectInvolvedRelations(); handler->SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded."); return true; @@ -585,7 +585,7 @@ public: static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Quest Area Triggers..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded."); return true; @@ -593,12 +593,12 @@ public: static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Quest Templates..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Templates..."); sObjectMgr->LoadQuests(); handler->SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded."); /// dependent also from `gameobject` but this table not reloaded anyway - sLog->outString("Re-Loading GameObjects for quests..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); handler->SendGlobalGMSysMessage("Data GameObjects for quests reloaded."); return true; @@ -606,7 +606,7 @@ public: static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`creature_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`creature_loot_template`)"); LoadLootTemplates_Creature(); LootTemplates_Creature.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded."); @@ -616,7 +616,7 @@ public: static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`disenchant_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`disenchant_loot_template`)"); LoadLootTemplates_Disenchant(); LootTemplates_Disenchant.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded."); @@ -626,7 +626,7 @@ public: static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`fishing_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`fishing_loot_template`)"); LoadLootTemplates_Fishing(); LootTemplates_Fishing.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded."); @@ -636,7 +636,7 @@ public: static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`gameobject_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`gameobject_loot_template`)"); LoadLootTemplates_Gameobject(); LootTemplates_Gameobject.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded."); @@ -646,7 +646,7 @@ public: static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`item_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`item_loot_template`)"); LoadLootTemplates_Item(); LootTemplates_Item.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `item_loot_template` reloaded."); @@ -656,7 +656,7 @@ public: static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`milling_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`milling_loot_template`)"); LoadLootTemplates_Milling(); LootTemplates_Milling.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded."); @@ -666,7 +666,7 @@ public: static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); LoadLootTemplates_Pickpocketing(); LootTemplates_Pickpocketing.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded."); @@ -676,7 +676,7 @@ public: static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`prospecting_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`prospecting_loot_template`)"); LoadLootTemplates_Prospecting(); LootTemplates_Prospecting.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded."); @@ -686,7 +686,7 @@ public: static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`mail_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`mail_loot_template`)"); LoadLootTemplates_Mail(); LootTemplates_Mail.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `mail_loot_template` reloaded."); @@ -696,7 +696,7 @@ public: static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`reference_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`reference_loot_template`)"); LoadLootTemplates_Reference(); handler->SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded."); sConditionMgr->LoadConditions(true); @@ -705,7 +705,7 @@ public: static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`skinning_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`skinning_loot_template`)"); LoadLootTemplates_Skinning(); LootTemplates_Skinning.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded."); @@ -715,7 +715,7 @@ public: static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`spell_loot_template`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`spell_loot_template`)"); LoadLootTemplates_Spell(); LootTemplates_Spell.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded."); @@ -725,7 +725,7 @@ public: static bool HandleReloadTrinityStringCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading trinity_string Table!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading trinity_string Table!"); sObjectMgr->LoadTrinityStrings(); handler->SendGlobalGMSysMessage("DB table `trinity_string` reloaded."); return true; @@ -740,7 +740,7 @@ public: return false; } - sLog->outString("Re-Loading warden_action Table!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading warden_action Table!"); sWardenCheckMgr->LoadWardenOverrides(); handler->SendGlobalGMSysMessage("DB table `warden_action` reloaded."); return true; @@ -748,7 +748,7 @@ public: static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `npc_trainer` Table!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_trainer` Table!"); sObjectMgr->LoadTrainerSpell(); handler->SendGlobalGMSysMessage("DB table `npc_trainer` reloaded."); return true; @@ -756,7 +756,7 @@ public: static bool HandleReloadNpcVendorCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `npc_vendor` Table!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_vendor` Table!"); sObjectMgr->LoadVendors(); handler->SendGlobalGMSysMessage("DB table `npc_vendor` reloaded."); return true; @@ -764,7 +764,7 @@ public: static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `points_of_interest` Table!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `points_of_interest` Table!"); sObjectMgr->LoadPointsOfInterest(); handler->SendGlobalGMSysMessage("DB table `points_of_interest` reloaded."); return true; @@ -772,7 +772,7 @@ public: static bool HandleReloadQuestPOICommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString( "Re-Loading Quest POI ..." ); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest POI ..." ); sObjectMgr->LoadQuestPOI(); handler->SendGlobalGMSysMessage("DB Table `quest_poi` and `quest_poi_points` reloaded."); return true; @@ -780,7 +780,7 @@ public: static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `npc_spellclick_spells` Table!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_spellclick_spells` Table!"); sObjectMgr->LoadNPCSpellClickSpells(); handler->SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded."); return true; @@ -788,7 +788,7 @@ public: static bool HandleReloadReservedNameCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading ReservedNames... (`reserved_name`)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames... (`reserved_name`)"); sObjectMgr->LoadReservedPlayersNames(); handler->SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded."); return true; @@ -796,7 +796,7 @@ public: static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString( "Re-Loading `reputation_reward_rate` Table!" ); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_reward_rate` Table!" ); sObjectMgr->LoadReputationRewardRate(); handler->SendGlobalSysMessage("DB table `reputation_reward_rate` reloaded."); return true; @@ -804,7 +804,7 @@ public: static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString( "Re-Loading `reputation_spillover_template` Table!" ); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_spillover_template` Table!" ); sObjectMgr->LoadReputationSpilloverTemplate(); handler->SendGlobalSysMessage("DB table `reputation_spillover_template` reloaded."); return true; @@ -812,7 +812,7 @@ public: static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Skill Discovery Table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); handler->SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded."); return true; @@ -820,7 +820,7 @@ public: static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Skill Extra Item Table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); handler->SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded."); return true; @@ -828,7 +828,7 @@ public: static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Skill Fishing base level requirements..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Fishing base level requirements..."); sObjectMgr->LoadFishingBaseSkillLevel(); handler->SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded."); return true; @@ -836,7 +836,7 @@ public: static bool HandleReloadSpellAreaCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading SpellArea Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading SpellArea Data..."); sSpellMgr->LoadSpellAreas(); handler->SendGlobalGMSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded."); return true; @@ -844,7 +844,7 @@ public: static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Required Data... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Required Data... "); sSpellMgr->LoadSpellRequired(); handler->SendGlobalGMSysMessage("DB table `spell_required` reloaded."); return true; @@ -852,7 +852,7 @@ public: static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Groups..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Groups..."); sSpellMgr->LoadSpellGroups(); handler->SendGlobalGMSysMessage("DB table `spell_group` (spell groups) reloaded."); return true; @@ -860,7 +860,7 @@ public: static bool HandleReloadSpellLearnSpellCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Learn Spells..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Learn Spells..."); sSpellMgr->LoadSpellLearnSpells(); handler->SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded."); return true; @@ -868,7 +868,7 @@ public: static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Linked Spells..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Linked Spells..."); sSpellMgr->LoadSpellLinked(); handler->SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded."); return true; @@ -876,7 +876,7 @@ public: static bool HandleReloadSpellProcEventCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Proc Event conditions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc Event conditions..."); sSpellMgr->LoadSpellProcEvents(); handler->SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded."); return true; @@ -884,7 +884,7 @@ public: static bool HandleReloadSpellProcsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Proc conditions and data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc conditions and data..."); sSpellMgr->LoadSpellProcs(); handler->SendGlobalGMSysMessage("DB table `spell_proc` (spell proc conditions and data) reloaded."); return true; @@ -892,7 +892,7 @@ public: static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Bonus Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); handler->SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); return true; @@ -900,7 +900,7 @@ public: static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell target coordinates..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell target coordinates..."); sSpellMgr->LoadSpellTargetPositions(); handler->SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded."); return true; @@ -908,7 +908,7 @@ public: static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Aggro Spells Definitions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); handler->SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded."); return true; @@ -916,7 +916,7 @@ public: static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Group Stack Rules..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); handler->SendGlobalGMSysMessage("DB table `spell_group_stack_rules` (spell stacking definitions) reloaded."); return true; @@ -924,7 +924,7 @@ public: static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell pet auras..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); handler->SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded."); return true; @@ -932,7 +932,7 @@ public: static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Page Texts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Page Texts..."); sObjectMgr->LoadPageTexts(); handler->SendGlobalGMSysMessage("DB table `page_texts` reloaded."); return true; @@ -940,7 +940,7 @@ public: static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Item Random Enchantments Table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); handler->SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded."); return true; @@ -948,7 +948,7 @@ public: static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Item set names..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names..."); LoadRandomEnchantmentsTable(); handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded."); return true; @@ -964,7 +964,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `gameobject_scripts`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `gameobject_scripts`..."); sObjectMgr->LoadGameObjectScripts(); @@ -984,7 +984,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `event_scripts`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `event_scripts`..."); sObjectMgr->LoadEventScripts(); @@ -1004,7 +1004,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `waypoint_scripts`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `waypoint_scripts`..."); sObjectMgr->LoadWaypointScripts(); @@ -1017,7 +1017,7 @@ public: static bool HandleReloadWpCommand(ChatHandler* handler, const char* args) { if (*args != 'a') - sLog->outString("Re-Loading Waypoints data from 'waypoints_data'"); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Waypoints data from 'waypoints_data'"); sWaypointMgr->Load(); @@ -1030,7 +1030,7 @@ public: static bool HandleReloadEventAITextsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Texts from `creature_ai_texts`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Texts from `creature_ai_texts`..."); sEventAIMgr->LoadCreatureEventAI_Texts(); handler->SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded."); return true; @@ -1038,7 +1038,7 @@ public: static bool HandleReloadEventAISummonsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Summons from `creature_ai_summons`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Summons from `creature_ai_summons`..."); sEventAIMgr->LoadCreatureEventAI_Summons(); handler->SendGlobalGMSysMessage("DB table `creature_ai_summons` reloaded."); return true; @@ -1046,7 +1046,7 @@ public: static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Scripts from `creature_ai_scripts`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`..."); sEventAIMgr->LoadCreatureEventAI_Scripts(); handler->SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded."); return true; @@ -1062,7 +1062,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `quest_end_scripts`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `quest_end_scripts`..."); sObjectMgr->LoadQuestEndScripts(); @@ -1082,7 +1082,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `quest_start_scripts`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `quest_start_scripts`..."); sObjectMgr->LoadQuestStartScripts(); @@ -1102,7 +1102,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `spell_scripts`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `spell_scripts`..."); sObjectMgr->LoadSpellScripts(); @@ -1114,7 +1114,7 @@ public: static bool HandleReloadDbScriptStringCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Script strings from `db_script_string`..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Script strings from `db_script_string`..."); sObjectMgr->LoadDbScriptStrings(); handler->SendGlobalGMSysMessage("DB table `db_script_string` reloaded."); return true; @@ -1122,7 +1122,7 @@ public: static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Graveyard-zone links..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Graveyard-zone links..."); sObjectMgr->LoadGraveyardZones(); @@ -1133,7 +1133,7 @@ public: static bool HandleReloadGameTeleCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Game Tele coordinates..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Game Tele coordinates..."); sObjectMgr->LoadGameTele(); @@ -1144,9 +1144,9 @@ public: static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading disables table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading disables table..."); DisableMgr::LoadDisables(); - sLog->outString("Checking quest disables..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Checking quest disables..."); DisableMgr::CheckQuestDisables(); handler->SendGlobalGMSysMessage("DB table `disables` reloaded."); return true; @@ -1154,7 +1154,7 @@ public: static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Achievement Reward Data..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Achievement Reward Data..."); sAchievementMgr->LoadRewardLocales(); handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded."); return true; @@ -1162,7 +1162,7 @@ public: static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading lfg dungeon rewards..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading lfg dungeon rewards..."); sLFGMgr->LoadRewards(); handler->SendGlobalGMSysMessage("DB table `lfg_dungeon_rewards` reloaded."); return true; @@ -1170,7 +1170,7 @@ public: static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Creature ..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature ..."); sObjectMgr->LoadCreatureLocales(); handler->SendGlobalGMSysMessage("DB table `locales_creature` reloaded."); return true; @@ -1178,7 +1178,7 @@ public: static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Creature Texts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature Texts..."); sCreatureTextMgr->LoadCreatureTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded."); return true; @@ -1186,7 +1186,7 @@ public: static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Gameobject ... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gameobject ... "); sObjectMgr->LoadGameObjectLocales(); handler->SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded."); return true; @@ -1194,7 +1194,7 @@ public: static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString( "Re-Loading Locales Gossip Menu Option ... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gossip Menu Option ... "); sObjectMgr->LoadGossipMenuItemsLocales(); handler->SendGlobalGMSysMessage("DB table `locales_gossip_menu_option` reloaded."); return true; @@ -1202,7 +1202,7 @@ public: static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Item ... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item ... "); sObjectMgr->LoadItemLocales(); handler->SendGlobalGMSysMessage("DB table `locales_item` reloaded."); return true; @@ -1210,7 +1210,7 @@ public: static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Item set name... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item set name... "); sObjectMgr->LoadItemSetNameLocales(); handler->SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded."); return true; @@ -1218,7 +1218,7 @@ public: static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales NPC Text ... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales NPC Text ... "); sObjectMgr->LoadNpcTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded."); return true; @@ -1226,7 +1226,7 @@ public: static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Page Text ... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Page Text ... "); sObjectMgr->LoadPageTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_page_text` reloaded."); return true; @@ -1234,7 +1234,7 @@ public: static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Points Of Interest ... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Points Of Interest ... "); sObjectMgr->LoadPointOfInterestLocales(); handler->SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded."); return true; @@ -1242,7 +1242,7 @@ public: static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Quest ... "); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Quest ... "); sObjectMgr->LoadQuestLocales(); handler->SendGlobalGMSysMessage("DB table `locales_quest` reloaded."); return true; @@ -1250,7 +1250,7 @@ public: static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Player level dependent mail rewards..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); handler->SendGlobalGMSysMessage("DB table `mail_level_reward` reloaded."); return true; @@ -1259,7 +1259,7 @@ public: static bool HandleReloadAuctionsCommand(ChatHandler* handler, const char* /*args*/) { ///- Reload dynamic data tables from the database - sLog->outString("Re-Loading Auctions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Auctions..."); sAuctionMgr->LoadAuctionItems(); sAuctionMgr->LoadAuctions(); handler->SendGlobalGMSysMessage("Auctions reloaded."); @@ -1268,7 +1268,7 @@ public: static bool HandleReloadConditions(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Conditions..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Conditions..."); sConditionMgr->LoadConditions(true); handler->SendGlobalGMSysMessage("Conditions reloaded."); return true; @@ -1276,7 +1276,7 @@ public: static bool HandleReloadCreatureText(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Creature Texts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); handler->SendGlobalGMSysMessage("Creature Texts reloaded."); return true; @@ -1284,7 +1284,7 @@ public: static bool HandleReloadSmartScripts(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Smart Scripts..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Smart Scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); handler->SendGlobalGMSysMessage("Smart Scripts reloaded."); return true; @@ -1292,7 +1292,7 @@ public: static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Reloading vehicle_accessory table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_accessory table..."); sObjectMgr->LoadVehicleAccessories(); handler->SendGlobalGMSysMessage("Vehicle accessories reloaded."); return true; @@ -1300,7 +1300,7 @@ public: static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Reloading vehicle_template_accessory table..."); + sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_template_accessory table..."); sObjectMgr->LoadVehicleTemplateAccessories(); handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded."); return true; diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 88d648773eb..4da4147caa6 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -88,7 +88,7 @@ public: ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass()); if (!classEntry) { - sLog->outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass()); + sLog->outError(LOG_FILTER_GENERAL, "Class %u not found in DBC (Wrong DBC files?)", player->getClass()); return false; } diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index 8f10af5fe2a..db1995ebb6e 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -67,7 +67,6 @@ public: { { "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "", NULL }, { "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "", NULL }, - { "logfilelevel", SEC_CONSOLE, true, &HandleServerSetLogFileLevelCommand, "", NULL }, { "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "", NULL }, { "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } @@ -85,7 +84,6 @@ public: { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, - { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -378,31 +376,20 @@ public: return false; } - // Set the level of logging - static bool HandleServerSetLogFileLevelCommand(ChatHandler* /*handler*/, char const* args) - { - if (!*args) - return false; - - char* newLevel = strtok((char*)args, " "); - if (!newLevel) - return false; - - sLog->SetLogFileLevel(newLevel); - return true; - } - // Set the level of logging static bool HandleServerSetLogLevelCommand(ChatHandler* /*handler*/, char const* args) { if (!*args) return false; - char* newLevel = strtok((char*)args, " "); - if (!newLevel) + char* type = strtok((char*)args, " "); + char* name = strtok(NULL, " "); + char* level = strtok(NULL, " "); + + if (!type || !name || !level || *name == '\0' || *level == '\0' || (*type != 'a' && *type != 'l')) return false; - sLog->SetLogLevel(newLevel); + sLog->SetLogLevel(name, level, *type == 'l'); return true; } @@ -425,18 +412,6 @@ public: return true; } - - // toggle sql driver query logging - static bool HandleServerToggleQueryLogging(ChatHandler* handler, char const* /*args*/) - { - sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging()); - - if (sLog->GetSQLDriverQueryLogging()) - handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED); - else - handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED); - return true; - } }; void AddSC_server_commandscript() diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 27c90d3b45c..7286466d335 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -209,7 +209,7 @@ public: { instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me); instance->SetData(TYPE_RING_OF_LAW, DONE); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_grimstone: event reached end and set complete."); + sLog->outDebug(LOG_FILTER_TSCR, "npc_grimstone: event reached end and set complete."); } break; } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp index 91cd5d2b9a5..0d02e4495a5 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp @@ -212,7 +212,7 @@ public: void SetData64(uint32 type, uint64 data) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data); switch (type) { @@ -228,7 +228,7 @@ public: void SetData(uint32 type, uint32 data) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); switch (type) { diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp index c7e8a5ea771..30638e9edeb 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -364,7 +364,7 @@ public: Nefarian->setFaction(103); NefarianGUID = Nefarian->GetGUID(); } - else sLog->outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly."); + else sLog->outError(LOG_FILTER_TSCR, "Blackwing Lair: Unable to spawn nefarian properly."); } AddSpawnTimer = 4000; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 959f1ac8f41..30d33dc65cf 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -1223,7 +1223,7 @@ public: } } - sLog->outError("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen."); + sLog->outError(LOG_FILTER_TSCR, "boss_romuloAI: DamageTaken reach end of code, that should not happen."); } void EnterCombat(Unit* /*who*/) @@ -1469,7 +1469,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama if (Phase == PHASE_ROMULO) { - sLog->outError("TSCR: boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); + sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); damage = 0; return; } @@ -1503,7 +1503,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama return; } } - sLog->outError("TSCR: boss_julianneAI: DamageTaken reach end of code, that should not happen."); + sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: DamageTaken reach end of code, that should not happen."); } void AddSC_bosses_opera() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 7e0a11da03a..b84fc15d664 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -229,7 +229,7 @@ public: void PrepareEncounter() { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); + sLog->outDebug(LOG_FILTER_TSCR, "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); uint8 index = 0; uint8 count = 0; @@ -344,17 +344,17 @@ public: case GOSSIP_ACTION_INFO_DEF+3: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_OZ; - sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID()); + sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_HOOD; - sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID()); + sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_RAJ; - sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID()); + sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID()); break; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h index 08b9a729596..e1817034189 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h @@ -62,6 +62,6 @@ enum OperaEvents EVENT_RAJ = 3 }; -#define ERROR_INST_DATA(a) sLog->outError("TSCR: Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry()); +#define ERROR_INST_DATA(a) sLog->outError(LOG_FILTER_TSCR, "Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry()); #endif diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 8bdfeb26ca2..82ad3ee2630 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -76,7 +76,7 @@ public: for (uint8 i = 0; i < size; ++i) { uint64 guid = instance->GetData64(DATA_FEL_CRYSTAL); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Selin: Adding Fel Crystal " UI64FMTD " to list", guid); + sLog->outDebug(LOG_FILTER_TSCR, "Selin: Adding Fel Crystal " UI64FMTD " to list", guid); Crystals.push_back(guid); } } @@ -121,7 +121,7 @@ public: // Small door opened after event are expected to be closed by default // Set Inst data for encounter instance->SetData(DATA_SELIN_EVENT, NOT_STARTED); - } else sLog->outError(ERROR_INST_DATA); + } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); DrainLifeTimer = urand(3000, 7000); DrainManaTimer = DrainLifeTimer + 5000; @@ -223,7 +223,7 @@ public: else { // Make an error message in case something weird happened here - sLog->outError("TSCR: Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); + sLog->outError(LOG_FILTER_TSCR, "Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); DrainingCrystal = false; } } @@ -362,7 +362,7 @@ public: } } } - } else sLog->outError(ERROR_INST_DATA); + } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); } }; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index 33635cefa0a..677b94d8748 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -244,7 +244,7 @@ public: { if (FelCrystals.empty()) { - sLog->outError("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data"); + sLog->outError(LOG_FILTER_TSCR, "Magisters Terrace: No Fel Crystals loaded in Inst Data"); return 0; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index cc11d727dc2..c17a059d007 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -189,7 +189,7 @@ public: anchorGUID = anchor->GetGUID(); } else - sLog->outError("npc_unworthy_initiateAI: unable to find anchor!"); + sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find anchor!"); float dist = 99.0f; GameObject* prison = NULL; @@ -209,7 +209,7 @@ public: if (prison) prison->ResetDoorOrButton(); else - sLog->outError("npc_unworthy_initiateAI: unable to find prison!"); + sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find prison!"); } break; case PHASE_TO_EQUIP: @@ -1078,9 +1078,9 @@ public: { car->AI()->SetGUID(miner->GetGUID()); CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(player); - } else sLog->outError("TSCR: OnGossipHello vehicle entry is not correct."); - } else sLog->outError("TSCR: OnGossipHello player is not on the vehicle."); - } else sLog->outError("TSCR: OnGossipHello Scarlet Miner cant be found by script."); + } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello vehicle entry is not correct."); + } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello player is not on the vehicle."); + } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello Scarlet Miner cant be found by script."); } return true; } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 338d88e71f0..98df9638bae 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -124,7 +124,7 @@ class instance_stratholme : public InstanceMapScript return true; } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Cannot open slaugther square yet."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Cannot open slaugther square yet."); return false; } @@ -242,7 +242,7 @@ class instance_stratholme : public InstanceMapScript break; EncounterState[0] = data; events.ScheduleEvent(EVENT_BARON_RUN, 2700000); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Baron run in progress."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Baron run in progress."); break; case FAIL: DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM); @@ -300,10 +300,10 @@ class instance_stratholme : public InstanceMapScript //UpdateGoState(ziggurat4GUID, 0, true); if (Creature* pBaron = instance->GetCreature(baronGUID)) pBaron->SummonCreature(C_RAMSTEIN, 4032.84f, -3390.24f, 119.73f, 4.71f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Ramstein spawned."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Ramstein spawned."); } else - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: %u Abomnation left to kill.", count); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: %u Abomnation left to kill.", count); } if (data == NOT_STARTED) @@ -312,7 +312,7 @@ class instance_stratholme : public InstanceMapScript if (data == DONE) { events.ScheduleEvent(EVENT_SLAUGHTER_SQUARE, 60000); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Slaugther event will continue in 1 minute."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Slaugther event will continue in 1 minute."); } EncounterState[4] = data; break; @@ -448,7 +448,7 @@ class instance_stratholme : public InstanceMapScript case EVENT_BARON_RUN: if (GetData(TYPE_BARON_RUN) != DONE) SetData(TYPE_BARON_RUN, FAIL); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN)); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN)); break; case EVENT_SLAUGHTER_SQUARE: if (Creature* baron = instance->GetCreature(baronGUID)) @@ -458,7 +458,7 @@ class instance_stratholme : public InstanceMapScript HandleGameObject(ziggurat4GUID, true); HandleGameObject(ziggurat5GUID, true); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); } break; default: diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index 542f8168e0f..e40a48d0251 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -171,7 +171,7 @@ public: else { //Madrigosa not found, end intro - sLog->outError("Madrigosa was not found"); + sLog->outError(LOG_FILTER_TSCR, "Madrigosa was not found"); EndIntro(); } } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index f336a7ecfe7..57e69238816 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -270,7 +270,7 @@ public: } else { - sLog->outError("TSCR: Didn't find Shathrowar. Kalecgos event reseted."); + sLog->outError(LOG_FILTER_TSCR, "Didn't find Shathrowar. Kalecgos event reseted."); EnterEvadeMode(); return; } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 13201449a6e..167f040bbc4 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -755,7 +755,7 @@ public: if (pRandomPlayer) DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false); else - sLog->outError("try to cast SPELL_LEGION_LIGHTNING on invalid target"); + sLog->outError(LOG_FILTER_TSCR, "try to cast SPELL_LEGION_LIGHTNING on invalid target"); Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE Timer[TIMER_SOUL_FLAY] = 2500; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 24e4b0d9aa1..68b3bdb9b7e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -135,7 +135,7 @@ public: } } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); return NULL; } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index c0023b006d7..8a102757036 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -248,7 +248,7 @@ class boss_janalai : public CreatureScript cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange()); } - //sLog->outError("Eggs %d at middle", templist.size()); + //sLog->outError(LOG_FILTER_TSCR, "Eggs %d at middle", templist.size()); if (templist.empty()) return false; @@ -534,7 +534,7 @@ class mob_janalai_hatcher : public CreatureScript cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); } - //sLog->outError("Eggs %d at %d", templist.size(), side); + //sLog->outError(LOG_FILTER_TSCR, "Eggs %d at %d", templist.size(), side); for (std::list::const_iterator i = templist.begin(); i != templist.end() && num > 0; ++i) if ((*i)->GetDisplayId() != 11686) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index f5d5a11084c..305e3813ebc 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -184,7 +184,7 @@ class instance_zulaman : public InstanceMapScript ss << "S " << BossKilled << ' ' << ChestLooted << ' ' << QuestMinute; char* data = new char[ss.str().length()+1]; strcpy(data, ss.str().c_str()); - //sLog->outError("TSCR: Zul'aman saved, %s.", data); + //sLog->outError(LOG_FILTER_TSCR, "Zul'aman saved, %s.", data); return data; } @@ -194,17 +194,17 @@ class instance_zulaman : public InstanceMapScript return; std::istringstream ss(load); - //sLog->outError("TSCR: Zul'aman loaded, %s.", ss.str().c_str()); + //sLog->outError(LOG_FILTER_TSCR, "Zul'aman loaded, %s.", ss.str().c_str()); char dataHead; // S uint16 data1, data2, data3; ss >> dataHead >> data1 >> data2 >> data3; - //sLog->outError("TSCR: Zul'aman loaded, %d %d %d.", data1, data2, data3); + //sLog->outError(LOG_FILTER_TSCR, "Zul'aman loaded, %d %d %d.", data1, data2, data3); if (dataHead == 'S') { BossKilled = data1; ChestLooted = data2; QuestMinute = data3; - } else sLog->outError("TSCR: Zul'aman: corrupted save data."); + } else sLog->outError(LOG_FILTER_TSCR, "Zul'aman: corrupted save data."); } void SetData(uint32 type, uint32 data) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 1dc841d3518..17c3f5e8ff4 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -171,7 +171,7 @@ class boss_arlokk : public CreatureScript MarkedTargetGUID = pMarkedTarget->GetGUID(); } else - sLog->outError("TSCR: boss_arlokk could not accuire pMarkedTarget."); + sLog->outError(LOG_FILTER_TSCR, "boss_arlokk could not accuire pMarkedTarget."); m_uiMark_Timer = 15000; } diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp index 339e202fce1..870cb29c28d 100644 --- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp @@ -259,7 +259,7 @@ public: void UpdateAI(const uint32 diff) { - //sLog->outString("DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); + //sLog->outInfo(LOG_FILTER_TSCR, "DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); if (!QuestInProgress) return; diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 737d1eec8f8..cc27392919f 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -81,19 +81,19 @@ class spell_ex_5581 : public SpellScriptLoader { // this hook is executed before anything about casting the spell is done // after this hook is executed all the machinery starts - sLog->outString("Caster just finished preparing the spell (cast bar has expired)"); + sLog->outInfo(LOG_FILTER_GENERAL, "Caster just finished preparing the spell (cast bar has expired)"); } void HandleOnCast() { // cast is validated and spell targets are selected at this moment // this is a last place when the spell can be safely interrupted - sLog->outString("Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects"); + sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects"); } void HandleAfterCast() { - sLog->outString("All immediate Actions for the spell are finished now"); + sLog->outInfo(LOG_FILTER_GENERAL, "All immediate Actions for the spell are finished now"); // this is a safe for triggering additional effects for a spell without interfering // with visuals or with other effects of the spell //GetCaster()->CastSpell(target, SPELL_TRIGGERED, true); @@ -111,7 +111,7 @@ class spell_ex_5581 : public SpellScriptLoader void HandleDummyLaunch(SpellEffIndex /*effIndex*/) { - sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id); + sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id); } void HandleDummyLaunchTarget(SpellEffIndex /*effIndex*/) @@ -120,17 +120,17 @@ class spell_ex_5581 : public SpellScriptLoader if (Unit* unitTarget = GetHitUnit()) targetGUID = unitTarget->GetGUID(); // we're handling SPELL_EFFECT_DUMMY in effIndex 0 here - sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID); + sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID); } void HandleDummyHit(SpellEffIndex /*effIndex*/) { - sLog->outString("Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id); + sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id); } void HandleDummyHitTarget(SpellEffIndex /*effIndex*/) { - sLog->outString("SPELL_EFFECT_DUMMY is hits it's target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "SPELL_EFFECT_DUMMY is hits it's target!"); // make caster cast a spell on a unit target of effect if (Unit* target = GetHitUnit()) GetCaster()->CastSpell(target, SPELL_TRIGGERED, true); @@ -138,23 +138,23 @@ class spell_ex_5581 : public SpellScriptLoader void HandleBeforeHit() { - sLog->outString("Spell is about to hit target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to hit target!"); } void HandleOnHit() { - sLog->outString("Spell just hit target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Spell just hit target!"); } void HandleAfterHit() { - sLog->outString("Spell just finished hitting target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Spell just finished hitting target!"); } void FilterTargets(std::list& /*targetList*/) { // usually you want this call for Area Target spells - sLog->outString("Spell is about to add targets from targetList to final targets!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to add targets from targetList to final targets!"); } // register functions used in spell script - names of these functions do not matter @@ -229,20 +229,20 @@ class spell_ex_66244 : public SpellScriptLoader void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - sLog->outString("Aura Effect is about to be applied on target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect is about to be applied on target!"); // this hook allows you to prevent execution of AuraEffect handler, or to replace it with your own handler //PreventDefaultAction(); } void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - sLog->outString("Aura Effect is about to be removed from target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect is about to be removed from target!"); // this hook allows you to prevent execution of AuraEffect handler, or to replace it with your own handler //PreventDefaultAction(); } void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - sLog->outString("Aura Effect has just been applied on target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been applied on target!"); Unit* target = GetTarget(); // cast spell on target on aura apply target->CastSpell(target, SPELL_TRIGGERED, true); @@ -250,7 +250,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - sLog->outString("Aura Effect has just been just removed from target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been just removed from target!"); Unit* target = GetTarget(); Unit* caster = GetCaster(); // caster may be not avalible (logged out for example) @@ -262,7 +262,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { - sLog->outString("Perioidic Aura Effect is does a tick on target!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Perioidic Aura Effect is does a tick on target!"); Unit* target = GetTarget(); // aura targets damage self on tick target->DealDamage(target, 100); @@ -270,14 +270,14 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectPeriodicUpdate(AuraEffect* aurEff) { - sLog->outString("Perioidic Aura Effect is now updated!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Perioidic Aura Effect is now updated!"); // we're doubling aura amount every tick aurEff->ChangeAmount(aurEff->GetAmount() * 2); } void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) { - sLog->outString("Amount of Aura Effect is being calculated now!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Amount of Aura Effect is being calculated now!"); // we're setting amount to 100 amount = 100; // amount will be never recalculated due to applying passive aura @@ -286,7 +286,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectCalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { - sLog->outString("Periodic data of Aura Effect is being calculated now!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Periodic data of Aura Effect is being calculated now!"); // we're setting aura to be periodic and tick every 10 seconds isPeriodic = true; amplitude = 2 * IN_MILLISECONDS; @@ -294,7 +294,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectCalcSpellMod(AuraEffect const* /*aurEff*/, SpellModifier*& spellMod) { - sLog->outString("SpellMod data of Aura Effect is being calculated now!"); + sLog->outInfo(LOG_FILTER_GENERAL, "SpellMod data of Aura Effect is being calculated now!"); // we don't want spellmod for example if (spellMod) { @@ -367,14 +367,14 @@ class spell_ex_absorb_aura : public SpellScriptLoader void HandleOnEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - sLog->outString("Our aura is now absorbing damage done to us!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Our aura is now absorbing damage done to us!"); // absorb whole damage done to us absorbAmount = dmgInfo.GetDamage(); } void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) { - sLog->outString("Our aura has absorbed %u damage!", absorbAmount); + sLog->outInfo(LOG_FILTER_GENERAL, "Our aura has absorbed %u damage!", absorbAmount); } // function registering @@ -403,7 +403,7 @@ class spell_ex_463 : public SpellScriptLoader bool CheckAreaTarget(Unit* target) { - sLog->outString("Area aura checks if unit is a valid target for it!"); + sLog->outInfo(LOG_FILTER_GENERAL, "Area aura checks if unit is a valid target for it!"); // in our script we allow only players to be affected return target->GetTypeId() == TYPEID_PLAYER; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 1be8f8e058f..5b6dc784113 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -71,7 +71,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF: ai->Debug = !ai->Debug; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI - Debug mode has been toggled"); + sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled"); break; } return true; @@ -148,7 +148,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF: ai->Debug = !ai->Debug; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI - Debug mode has been toggled"); + sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled"); break; } return true; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index a407f86ba70..aa41fa992dc 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -407,7 +407,7 @@ void hyjalAI::Reset() instance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); instance->SetData(DATA_RESET_TRASH_COUNT, 0); } - } else sLog->outError(ERROR_INST_DATA); + } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); //Visibility DoHide = true; @@ -540,7 +540,7 @@ void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3] if (!instance) { - sLog->outError(ERROR_INST_DATA); + sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); return; } InfernalCount = 0;//reset infernal count every new wave @@ -570,7 +570,7 @@ void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3] else { NextWaveTimer = 15000; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI: debug mode is enabled. Next Wave in 15 seconds"); + sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI: debug mode is enabled. Next Wave in 15 seconds"); } } else @@ -614,7 +614,7 @@ uint32 hyjalAI::GetInstanceData(uint32 Event) { if (instance) return instance->GetData(Event); - else sLog->outError(ERROR_INST_DATA); + else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); return 0; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 69bb8285404..caff71c7320 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -273,7 +273,7 @@ public: break; } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data); if (data == DONE) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp index f7c4a21634c..ee8c4d1bae1 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -326,7 +326,7 @@ public: uint32 entry = 0; entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry); + sLog->outDebug(LOG_FILTER_TSCR, "npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry); ++mRiftWaveCount; @@ -351,7 +351,7 @@ public: if (me->IsNonMeleeSpellCasted(false)) return; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_time_rift: not casting anylonger, i need to die."); + sLog->outDebug(LOG_FILTER_TSCR, "npc_time_rift: not casting anylonger, i need to die."); me->setDeathState(JUST_DIED); if (instance->GetData(TYPE_RIFT) == IN_PROGRESS) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index fbbe750626b..da34eff7b77 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -193,7 +193,7 @@ public: { if (data == IN_PROGRESS) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Starting event."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Starting event."); InitWorldState(); m_auiEncounter[1] = IN_PROGRESS; NextPortal_Timer = 15000; @@ -202,7 +202,7 @@ public: if (data == DONE) { //this may be completed further out in the post-event - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Event completed."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Event completed."); Map::PlayerList const& players = instance->GetPlayers(); if (!players.isEmpty()) @@ -267,7 +267,7 @@ public: if (entry == RIFT_BOSS) entry = RandRiftBoss(); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Summoning rift boss entry %u.", entry); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Summoning rift boss entry %u.", entry); Position pos; me->GetRandomNearPosition(pos, 10.0f); @@ -278,7 +278,7 @@ public: if (Creature* summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000)) return summon; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: What just happened there? No boss, no loot, no fun..."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: What just happened there? No boss, no loot, no fun..."); return NULL; } @@ -291,7 +291,7 @@ public: if (tmp >= CurrentRiftId) ++tmp; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).", tmp, CurrentRiftId); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).", tmp, CurrentRiftId); CurrentRiftId = tmp; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index ea8aab5d46a..7f7cbeaf566 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -85,7 +85,7 @@ public: } } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); return NULL; } @@ -125,7 +125,7 @@ public: if (!player) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); return; } @@ -141,7 +141,7 @@ public: ++mBarrelCount; DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount); m_auiEncounter[0] = IN_PROGRESS; @@ -162,7 +162,7 @@ public: { ++mThrallEventCount; m_auiEncounter[1] = NOT_STARTED; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); m_auiEncounter[2] = NOT_STARTED; m_auiEncounter[3] = NOT_STARTED; m_auiEncounter[4] = NOT_STARTED; @@ -175,29 +175,29 @@ public: m_auiEncounter[3] = data; m_auiEncounter[4] = data; m_auiEncounter[5] = data; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); } } else m_auiEncounter[1] = data; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data); break; } case TYPE_THRALL_PART1: m_auiEncounter[2] = data; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data); break; case TYPE_THRALL_PART2: m_auiEncounter[3] = data; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data); break; case TYPE_THRALL_PART3: m_auiEncounter[4] = data; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data); break; case TYPE_THRALL_PART4: m_auiEncounter[5] = data; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data); break; } } diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index 374c2ae4257..cce0f8b180e 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -64,7 +64,7 @@ public: return player; } } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); return NULL; } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 92fd27a5680..95c6d033aab 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -181,7 +181,7 @@ public: { instance = creature->GetInstanceScript(); if (!instance) - sLog->outError("TSCR: No Instance eye_of_cthunAI"); + sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI"); } InstanceScript* instance; @@ -487,7 +487,7 @@ public: instance = creature->GetInstanceScript(); if (!instance) - sLog->outError("TSCR: No Instance eye_of_cthunAI"); + sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI"); } InstanceScript* instance; diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index 608117ca9af..4a8ff4780ba 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -550,7 +550,7 @@ public: } } else - sLog->outError("SD2 ERROR: FlagList is empty!"); + sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: FlagList is empty!"); } void UpdateAI(const uint32 diff) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 1fd1fdf094d..4dfe5708025 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -394,7 +394,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript if (type < MAX_ENCOUNTERS) { - sLog->outDetail("[ToCr] EncounterStatus[type %u] %u = data %u;", type, EncounterStatus[type], data); + sLog->outInfo(LOG_FILTER_TSCR, "[ToCr] EncounterStatus[type %u] %u = data %u;", type, EncounterStatus[type], data); if (data == FAIL) { --TrialCounter; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index faaea9c4cae..2ea234775c0 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -200,7 +200,7 @@ class boss_gothik : public CreatureScript if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD) { - sLog->outError("Script Gothik: cannot summon triggers!"); + sLog->outError(LOG_FILTER_TSCR, "Script Gothik: cannot summon triggers!"); EnterEvadeMode(); return; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index cf3bc2d8607..1e79cc1c5bf 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -120,7 +120,7 @@ public: } } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); return NULL; } diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index 326d214e886..9facb42107b 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -110,7 +110,7 @@ public: if (creature->isAlive()) { ++m_uiFelOverseerCount; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: counting %u Fel Overseers.", m_uiFelOverseerCount); + sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: counting %u Fel Overseers.", m_uiFelOverseerCount); } break; } @@ -127,7 +127,7 @@ public: case TYPE_OVERSEER: if (uiData != DONE) { - sLog->outError("TSCR: Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE"); + sLog->outError(LOG_FILTER_TSCR, "Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE"); return; } if (m_uiFelOverseerCount) @@ -135,11 +135,11 @@ public: --m_uiFelOverseerCount; if (m_uiFelOverseerCount) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount); + sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount); else { m_auiEncounter[1] = DONE; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE"); + sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: TYPE_OVERSEER == DONE"); } } break; diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 52704cb8f49..6fd6f61c061 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -798,7 +798,7 @@ public: { EnterEvadeMode(); me->MonsterTextEmote(EMOTE_UNABLE_TO_SUMMON, 0); - sLog->outError("SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)"); + sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)"); } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 81be46a197c..2757a862c93 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -322,7 +322,7 @@ public: GridSearcherSucceeded = true; } } - } else sLog->outError("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly"); + } else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly"); } } @@ -340,13 +340,13 @@ public: if (reseting) return; - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Increasing Death Count for Shade of Akama encounter"); + sLog->outDebug(LOG_FILTER_TSCR, "Increasing Death Count for Shade of Akama encounter"); ++DeathCount; me->RemoveAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2); if (guid) { if (Sorcerers.empty()) - sLog->outError("SD2 ERROR: Shade of Akama - attempt to remove guid " UI64FMTD " from Sorcerers list but list is already empty", guid); + sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Shade of Akama - attempt to remove guid " UI64FMTD " from Sorcerers list but list is already empty", guid); else Sorcerers.remove(guid); } } @@ -398,17 +398,17 @@ public: { CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = me->GetGUID(); Channelers.push_back((*itr)->GetGUID()); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID()); + sLog->outDebug(LOG_FILTER_TSCR, "Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID()); } } - else sLog->outError("SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy"); + else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy"); } void SetSelectableChannelers() { if (Channelers.empty()) { - sLog->outError("SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy"); + sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy"); return; } @@ -534,7 +534,7 @@ void mob_ashtongue_channeler::mob_ashtongue_channelerAI::JustDied(Unit* /*killer Creature* Shade = (Unit::GetCreature((*me), ShadeGUID)); if (Shade && Shade->isAlive()) CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(); - else sLog->outError("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama."); + else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama."); } void mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI::JustDied(Unit* /*killer*/) @@ -542,7 +542,7 @@ void mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI::JustDied(Unit* /*killer*/ Creature* Shade = (Unit::GetCreature((*me), ShadeGUID)); if (Shade && Shade->isAlive()) CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(me->GetGUID()); - else sLog->outError("SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama."); + else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama."); } class npc_akama_shade : public CreatureScript diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index 9197492fbf1..710f5c82fab 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -159,7 +159,7 @@ public: Council[1] = instance->GetData64(DATA_VERASDARKSHADOW); Council[2] = instance->GetData64(DATA_LADYMALANDE); Council[3] = instance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); - } else sLog->outError(ERROR_INST_DATA); + } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); } void EnterCombat(Unit* /*who*/) {} @@ -406,7 +406,7 @@ struct boss_illidari_councilAI : public ScriptedAI } else { - sLog->outError(ERROR_INST_DATA); + sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); EnterEvadeMode(); return; } @@ -454,7 +454,7 @@ struct boss_illidari_councilAI : public ScriptedAI { if (!instance) { - sLog->outError(ERROR_INST_DATA); + sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); return; } diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index 310bb6da651..98d90aa1818 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -138,7 +138,7 @@ public: } } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); return NULL; } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index 63fd935751d..26ab54746be 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -139,7 +139,7 @@ public: if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) HandleGameObject(MainChambersDoor, true); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Steamvault: Access panel used."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Steamvault: Access panel used."); } m_auiEncounter[0] = data; break; @@ -151,7 +151,7 @@ public: if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) HandleGameObject(MainChambersDoor, true); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Steamvault: Access panel used."); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Steamvault: Access panel used."); } m_auiEncounter[1] = data; break; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index c100fa204e2..ba7b5afb4c8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -67,7 +67,7 @@ class instance_ramparts : public InstanceMapScript void SetData(uint32 uiType, uint32 uiData) { - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Ramparts: SetData received for type %u with data %u", uiType, uiData); + sLog->outDebug(LOG_FILTER_TSCR, "Instance Ramparts: SetData received for type %u with data %u", uiType, uiData); switch (uiType) { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index e5dd1c923d9..f60cc1d188c 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -366,7 +366,7 @@ class boss_kaelthas : public CreatureScript if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3]) { - sLog->outError("TSCR: Kael'Thas One or more advisors missing, Skipping Phases 1-3"); + sLog->outError(LOG_FILTER_TSCR, "Kael'Thas One or more advisors missing, Skipping Phases 1-3"); DoScriptText(SAY_PHASE4_INTRO2, me); @@ -694,7 +694,7 @@ class boss_kaelthas : public CreatureScript Advisor = Unit::GetCreature((*me), m_auiAdvisorGuid[i]); if (!Advisor) - sLog->outError("SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); + sLog->outError(LOG_FILTER_TSCR, "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); else CAST_AI(advisorbase_ai, Advisor->AI())->Revive(target); } diff --git a/src/server/scripts/Outland/hellfire_peninsula.cpp b/src/server/scripts/Outland/hellfire_peninsula.cpp index 6825d859332..4c44d4e828e 100644 --- a/src/server/scripts/Outland/hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/hellfire_peninsula.cpp @@ -160,7 +160,7 @@ public: if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER) Start(false, false, creature->GetOwner()->GetGUID()); else - sLog->outError("TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player."); + sLog->outError(LOG_FILTER_TSCR, "TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player."); creature->SetSpeed(MOVE_WALK, 1.5f); Reset(); diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index e5795383ede..480275c42bd 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -498,7 +498,7 @@ public: return true; } - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_commander_dawnforge event already in progress, need to wait."); + sLog->outDebug(LOG_FILTER_TSCR, "npc_commander_dawnforge event already in progress, need to wait."); return false; } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 3a4132f62fe..bb0fd1e73ab 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("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(), player->GetGUIDLow(), enchant->spellid[s]); continue; } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index fec30bbdd96..e0131190916 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -202,7 +202,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader case WARLOCK_IMPROVED_HEALTHSTONE_R1: rank = 1; break; case WARLOCK_IMPROVED_HEALTHSTONE_R2: rank = 2; break; default: - sLog->outError("Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); break; } } diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp index aaeb8a13acd..fb540c177bc 100755 --- a/src/server/scripts/World/chat_log.cpp +++ b/src/server/scripts/World/chat_log.cpp @@ -31,25 +31,25 @@ public: { case CHAT_MSG_ADDON: if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s sends: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends: %s", player->GetName(), msg.c_str()); break; case CHAT_MSG_SAY: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outChat("[SAY] Player %s says (language %u): %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SAY] Player %s says (language %u): %s", player->GetName(), lang, msg.c_str()); break; case CHAT_MSG_EMOTE: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outChat("[TEXTEMOTE] Player %s emotes: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[TEXTEMOTE] Player %s emotes: %s", player->GetName(), msg.c_str()); break; case CHAT_MSG_YELL: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outChat("[YELL] Player %s yells (language %u): %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[YELL] Player %s yells (language %u): %s", player->GetName(), lang, msg.c_str()); break; } @@ -58,10 +58,10 @@ public: void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) { if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_WHISPER)) - sLog->outChat("[WHISPER] Player %s tells %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[WHISPER] Player %s tells %s: %s", player->GetName(), receiver ? receiver->GetName() : "", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s tells %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells %s: %s", player->GetName(), receiver ? receiver->GetName() : "", msg.c_str()); } @@ -73,52 +73,52 @@ public: { case CHAT_MSG_PARTY: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) - sLog->outChat("[PARTY] Player %s tells group with leader %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Player %s tells group with leader %s: %s", player->GetName(), group ? group->GetLeaderName() : "", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s tells group with leader %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells group with leader %s: %s", player->GetName(), group ? group->GetLeaderName() : "", msg.c_str()); break; case CHAT_MSG_PARTY_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) - sLog->outChat("[PARTY] Leader %s tells group: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Leader %s tells group: %s", player->GetName(), msg.c_str()); break; case CHAT_MSG_RAID: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outChat("[RAID] Player %s tells raid with leader %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Player %s tells raid with leader %s: %s", player->GetName(), group ? group->GetLeaderName() : "", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s tells raid with leader %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells raid with leader %s: %s", player->GetName(), group ? group->GetLeaderName() : "", msg.c_str()); break; case CHAT_MSG_RAID_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outChat("[RAID] Leader player %s tells raid: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s tells raid: %s", player->GetName(), msg.c_str()); break; case CHAT_MSG_RAID_WARNING: if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outChat("[RAID] Leader player %s warns raid with: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s warns raid with: %s", player->GetName(), msg.c_str()); break; case CHAT_MSG_BATTLEGROUND: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) - sLog->outChat("[BATTLEGROUND] Player %s tells battleground with leader %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Player %s tells battleground with leader %s: %s", player->GetName(), group ? group->GetLeaderName() : "", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s tells battleground with leader %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells battleground with leader %s: %s", player->GetName(), group ? group->GetLeaderName() : "", msg.c_str()); break; case CHAT_MSG_BATTLEGROUND_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) - sLog->outChat("[BATTLEGROUND] Leader player %s tells battleground: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Leader player %s tells battleground: %s", player->GetName(), msg.c_str()); break; } @@ -130,16 +130,16 @@ public: { case CHAT_MSG_GUILD: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) - sLog->outChat("[GUILD] Player %s tells guild %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[GUILD] Player %s tells guild %s: %s", player->GetName(), guild ? guild->GetName().c_str() : "", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s sends to guild %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends to guild %s: %s", player->GetName(), guild ? guild->GetName().c_str() : "", msg.c_str()); break; case CHAT_MSG_OFFICER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) - sLog->outChat("[OFFICER] Player %s tells guild %s officers: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[OFFICER] Player %s tells guild %s officers: %s", player->GetName(), guild ? guild->GetName().c_str() : "", msg.c_str()); break; } @@ -154,10 +154,10 @@ public: channel->HasFlag(CHANNEL_FLAG_LFG)); if (sWorld->getBoolConfig(CONFIG_CHATLOG_SYSCHAN) && isSystem) - sLog->outChat("[SYSCHAN] Player %s tells channel %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SYSCHAN] Player %s tells channel %s: %s", player->GetName(), channel->GetName().c_str(), msg.c_str()); else if (sWorld->getBoolConfig(CONFIG_CHATLOG_CHANNEL)) - sLog->outChat("[CHANNEL] Player %s tells channel %s: %s", + sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[CHANNEL] Player %s tells channel %s: %s", player->GetName(), channel ? channel->GetName().c_str() : "", msg.c_str()); } }; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index ad870b155f3..3ce136b9737 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -329,7 +329,7 @@ public: if (Spell) creature->CastSpell(player, Spell, false); else - sLog->outError("TSCR: go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction()); + sLog->outError(LOG_FILTER_TSCR, "go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction()); } } } diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 9126e268260..175cfb190d7 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -244,7 +244,7 @@ bool EquippedOk(Player* player, uint32 spellId) if (item && item->GetTemplate()->RequiredSpell == reqSpell) { //player has item equipped that require specialty. Not allow to unlearn, player has to unequip first - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry()); + sLog->outDebug(LOG_FILTER_TSCR, "player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry()); return false; } } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 4eea4999b0b..5640a84317c 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -141,14 +141,14 @@ public: } if (!SpawnAssoc) - sLog->outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry()); else { CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(SpawnAssoc->spawnedCreatureEntry); if (!spawnedTemplate) { - sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); + sLog->outError(LOG_FILTER_SQL, "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); SpawnAssoc = NULL; return; } @@ -168,7 +168,7 @@ public: SpawnedGUID = summoned->GetGUID(); else { - sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); + sLog->outError(LOG_FILTER_SQL, "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); SpawnAssoc = NULL; } @@ -846,7 +846,7 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 const diff) patientEntry = HordeSoldierId[rand() % 3]; break; default: - sLog->outError("TSCR: Invalid entry for Triage doctor. Please check your database"); + sLog->outError(LOG_FILTER_TSCR, "Invalid entry for Triage doctor. Please check your database"); return; } diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index b82d86cc5d0..e0df22b88ae 100755 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -80,7 +80,7 @@ std::string GetStringDefault(const char* name, const std::string &def) { ACE_TString val; return GetValueHelper(name, val) ? val.c_str() : def; -}; +} bool GetBoolDefault(const char* name, bool def) { @@ -91,19 +91,19 @@ bool GetBoolDefault(const char* name, bool def) return (val == "true" || val == "TRUE" || val == "yes" || val == "YES" || val == "1"); -}; +} int GetIntDefault(const char* name, int def) { ACE_TString val; return GetValueHelper(name, val) ? atoi(val.c_str()) : def; -}; +} float GetFloatDefault(const char* name, float def) { ACE_TString val; return GetValueHelper(name, val) ? (float)atof(val.c_str()) : def; -}; +} const std::string & GetFilename() { diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h index a870379881b..82e4d9bcce0 100755 --- a/src/server/shared/Configuration/Config.h +++ b/src/server/shared/Configuration/Config.h @@ -34,4 +34,3 @@ namespace ConfigMgr } #endif - diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.h b/src/server/shared/Cryptography/Authentication/AuthCrypt.h index 7081b4973d4..b40ce8ac40c 100755 --- a/src/server/shared/Cryptography/Authentication/AuthCrypt.h +++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.h @@ -41,4 +41,3 @@ class AuthCrypt bool _initialized; }; #endif - diff --git a/src/server/shared/DataStores/DBCStore.h b/src/server/shared/DataStores/DBCStore.h index c5b8b6f5a21..9965a5c1d71 100755 --- a/src/server/shared/DataStores/DBCStore.h +++ b/src/server/shared/DataStores/DBCStore.h @@ -117,7 +117,7 @@ class DBCStorage // Check if sql index pos is valid if (int32(result->GetFieldCount()-1) < sql->sqlIndexPos) { - sLog->outError("Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str()); return false; } } @@ -148,7 +148,7 @@ class DBCStorage uint32 id = fields[sql->sqlIndexPos].GetUInt32(); if (indexTable.asT[id]) { - sLog->outError("Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str()); return false; } indexTable.asT[id]=(T*)&sqlDataTable[offset]; @@ -203,7 +203,7 @@ class DBCStorage offset+=1; break; case FT_STRING: - sLog->outError("Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); + sLog->outError(LOG_FILTER_GENERAL, "Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); return false; case FT_SORT: break; @@ -215,13 +215,13 @@ class DBCStorage } else { - sLog->outError("Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); + sLog->outError(LOG_FILTER_GENERAL, "Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); return false; } } if (sqlColumnNumber != (result->GetFieldCount()-1)) { - sLog->outError("SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str()); + sLog->outError(LOG_FILTER_GENERAL, "SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str()); return false; } diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 314d196cc06..d86b99a062a 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -64,7 +64,7 @@ class DatabaseWorkerPool bool res = true; _connectionInfo = MySQLConnectionInfo(infoString); - sLog->outSQLDriver("Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", + sLog->outWarn(LOG_FILTER_SQL, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", GetDatabaseName(), async_threads, synch_threads); //! Open asynchronous connections (delayed operations) @@ -88,17 +88,17 @@ class DatabaseWorkerPool } if (res) - sLog->outSQLDriver("DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), + sLog->outWarn(LOG_FILTER_SQL, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC])); else - sLog->outError("DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " + sLog->outError(LOG_FILTER_SQL, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " "for specific errors.", GetDatabaseName()); return res; } void Close() { - sLog->outSQLDriver("Closing down DatabasePool '%s'.", GetDatabaseName()); + sLog->outWarn(LOG_FILTER_SQL, "Closing down DatabasePool '%s'.", GetDatabaseName()); //! Shuts down delaythreads for this connection pool by underlying deactivate(). //! The next dequeue attempt in the worker thread tasks will result in an error, @@ -114,7 +114,7 @@ class DatabaseWorkerPool t->Close(); //! Closes the actualy MySQL connection. } - sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", + sLog->outWarn(LOG_FILTER_SQL, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", GetDatabaseName()); //! Shut down the synchronous connections @@ -127,7 +127,7 @@ class DatabaseWorkerPool //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue delete _queue; - sLog->outSQLDriver("All connections on DatabasePool '%s' closed.", GetDatabaseName()); + sLog->outWarn(LOG_FILTER_SQL, "All connections on DatabasePool '%s' closed.", GetDatabaseName()); } /** @@ -351,10 +351,10 @@ class DatabaseWorkerPool switch (transaction->GetSize()) { case 0: - sLog->outSQLDriver("Transaction contains 0 queries. Not executing."); + sLog->outWarn(LOG_FILTER_SQL, "Transaction contains 0 queries. Not executing."); return; case 1: - sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code."); + sLog->outWarn(LOG_FILTER_SQL, "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); break; default: break; diff --git a/src/server/shared/Database/Field.h b/src/server/shared/Database/Field.h index bfa42dbe574..61e8fb7ccef 100755 --- a/src/server/shared/Database/Field.h +++ b/src/server/shared/Database/Field.h @@ -43,7 +43,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_TINY)) { - sLog->outSQLDriver("Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -61,7 +61,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_TINY)) { - sLog->outSQLDriver("Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -79,7 +79,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR)) { - sLog->outSQLDriver("Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -97,7 +97,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR)) { - sLog->outSQLDriver("Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -115,7 +115,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG)) { - sLog->outSQLDriver("Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -133,7 +133,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG)) { - sLog->outSQLDriver("Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -151,7 +151,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT)) { - sLog->outSQLDriver("Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -169,7 +169,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT)) { - sLog->outSQLDriver("Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -187,7 +187,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_FLOAT)) { - sLog->outSQLDriver("Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type)); return 0.0f; } #endif @@ -205,7 +205,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_DOUBLE)) { - sLog->outSQLDriver("Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type)); return 0.0f; } #endif @@ -223,7 +223,7 @@ class Field #ifdef TRINITY_DEBUG if (IsNumeric()) { - sLog->outSQLDriver("Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type)); + sLog->outWarn(LOG_FILTER_SQL, "Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type)); return NULL; } #endif @@ -322,7 +322,7 @@ class Field MYSQL_TYPE_SET: */ default: - sLog->outSQLDriver("SQL::SizeForType(): invalid field type %u", uint32(field->type)); + sLog->outWarn(LOG_FILTER_SQL, "SQL::SizeForType(): invalid field type %u", uint32(field->type)); return 0; } } diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 7fb4a4f7025..324efab067e 100755 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -22,6 +22,8 @@ #include #endif #include +#include +#include #include "MySQLConnection.h" #include "MySQLThreading.h" @@ -79,7 +81,7 @@ bool MySQLConnection::Open() mysqlInit = mysql_init(NULL); if (!mysqlInit) { - sLog->outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str()); + sLog->outError(LOG_FILTER_SQL, "Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str()); return false; } @@ -123,13 +125,13 @@ bool MySQLConnection::Open() { if (!m_reconnecting) { - sLog->outSQLDriver("MySQL client library: %s", mysql_get_client_info()); - sLog->outSQLDriver("MySQL server ver: %s ", mysql_get_server_info(m_Mysql)); + sLog->outInfo(LOG_FILTER_SQL, "MySQL client library: %s", mysql_get_client_info()); + sLog->outInfo(LOG_FILTER_SQL, "MySQL server ver: %s ", mysql_get_server_info(m_Mysql)); if (mysql_get_server_version(m_Mysql) != mysql_get_client_version()) - sLog->outSQLDriver("[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements."); + sLog->outInfo(LOG_FILTER_SQL, "[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements."); } - sLog->outDetail("Connected to MySQL database at %s", m_connectionInfo.host.c_str()); + sLog->outInfo(LOG_FILTER_SQL, "Connected to MySQL database at %s", m_connectionInfo.host.c_str()); mysql_autocommit(m_Mysql, 1); // set connection properties to UTF8 to properly handle locales for different @@ -139,7 +141,7 @@ bool MySQLConnection::Open() } else { - sLog->outError("Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit)); + sLog->outError(LOG_FILTER_SQL, "Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit)); mysql_close(mysqlInit); return false; } @@ -159,26 +161,22 @@ bool MySQLConnection::Execute(const char* sql) return false; { - uint32 _s = 0; - if (sLog->GetSQLDriverQueryLogging()) - _s = getMSTime(); + uint32 _s = getMSTime(); if (mysql_query(m_Mysql, sql)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog->outSQLDriver("SQL: %s", sql); - sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql)); + sLog->outInfo(LOG_FILTER_SQL, "SQL: %s", sql); + sLog->outError(LOG_FILTER_SQL, "[%u] %s", lErrno, mysql_error(m_Mysql)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return Execute(sql); // Try again return false; } - else if (sLog->GetSQLDriverQueryLogging()) - { - sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); - } + else + sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); } return true; @@ -201,14 +199,12 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT(); MYSQL_BIND* msql_BIND = m_mStmt->GetBind(); - uint32 _s = 0; - if (sLog->GetSQLDriverQueryLogging()) - _s = getMSTime(); + uint32 _s = getMSTime(); if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); + sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return Execute(stmt); // Try again @@ -220,7 +216,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) if (mysql_stmt_execute(msql_STMT)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); + sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return Execute(stmt); // Try again @@ -229,8 +225,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) return false; } - if (sLog->GetSQLDriverQueryLogging()) - sLog->outSQLDriver("[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str()); + sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str()); m_mStmt->ClearParameters(); return true; @@ -254,14 +249,12 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT(); MYSQL_BIND* msql_BIND = m_mStmt->GetBind(); - uint32 _s = 0; - if (sLog->GetSQLDriverQueryLogging()) - _s = getMSTime(); + uint32 _s = getMSTime(); if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); + sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return _Query(stmt, pResult, pRowCount, pFieldCount); // Try again @@ -273,7 +266,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 if (mysql_stmt_execute(msql_STMT)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", + sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) @@ -283,8 +276,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 return false; } - if (sLog->GetSQLDriverQueryLogging()) - sLog->outSQLDriver("[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str()); + sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str()); m_mStmt->ClearParameters(); @@ -319,25 +311,21 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD * return false; { - uint32 _s = 0; - if (sLog->GetSQLDriverQueryLogging()) - _s = getMSTime(); + uint32 _s = getMSTime(); if (mysql_query(m_Mysql, sql)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog->outSQLDriver("SQL: %s", sql); - sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql)); + sLog->outInfo(LOG_FILTER_SQL, "SQL: %s", sql); + sLog->outError(LOG_FILTER_SQL, "[%u] %s", lErrno, mysql_error(m_Mysql)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return _Query(sql, pResult, pFields, pRowCount, pFieldCount); // We try again return false; } - else if (sLog->GetSQLDriverQueryLogging()) - { - sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); - } + else + sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); *pResult = mysql_store_result(m_Mysql); *pRowCount = mysql_affected_rows(m_Mysql); @@ -393,7 +381,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction) ASSERT(stmt); if (!Execute(stmt)) { - sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size()); + sLog->outWarn(LOG_FILTER_SQL, "Transaction aborted. %u queries not executed.", (uint32)queries.size()); RollbackTransaction(); return false; } @@ -405,7 +393,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction) ASSERT(sql); if (!Execute(sql)) { - sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size()); + sLog->outWarn(LOG_FILTER_SQL, "Transaction aborted. %u queries not executed.", (uint32)queries.size()); RollbackTransaction(); return false; } @@ -428,7 +416,7 @@ MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index) ASSERT(index < m_stmts.size()); MySQLPreparedStatement* ret = m_stmts[index]; if (!ret) - sLog->outSQLDriver("ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.", + sLog->outError(LOG_FILTER_SQL, "Could not fetch prepared statement %u on database `%s`, connection type: %s.", index, m_connectionInfo.database.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous"); return ret; @@ -449,19 +437,19 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, Connection return; } - MYSQL_STMT * stmt = mysql_stmt_init(m_Mysql); + MYSQL_STMT* stmt = mysql_stmt_init(m_Mysql); if (!stmt) { - sLog->outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql); - sLog->outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql)); + sLog->outError(LOG_FILTER_SQL, "In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql); + sLog->outError(LOG_FILTER_SQL, "%s", mysql_error(m_Mysql)); m_prepareError = true; } else { if (mysql_stmt_prepare(stmt, sql, static_cast(strlen(sql)))) { - sLog->outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql); - sLog->outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt)); + sLog->outError(LOG_FILTER_SQL, "In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql); + sLog->outError(LOG_FILTER_SQL, "%s", mysql_stmt_error(stmt)); mysql_stmt_close(stmt); m_prepareError = true; } @@ -493,19 +481,19 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) { switch (errNo) { - case 2006: // "MySQL server has gone away" - case 2013: // "Lost connection to MySQL server during query" - case 2048: // "Invalid connection handle" - case 2055: // "Lost connection to MySQL server at '%s', system error: %d" + case CR_SERVER_GONE_ERROR: + case CR_SERVER_LOST: + case CR_INVALID_CONN_HANDLE: + case CR_SERVER_LOST_EXTENDED: { m_reconnecting = true; uint64 oldThreadId = mysql_thread_id(GetHandle()); mysql_close(GetHandle()); if (this->Open()) // Don't remove 'this' pointer unless you want to skip loading all prepared statements.... { - sLog->outSQLDriver("Connection to the MySQL server is active."); + sLog->outInfo(LOG_FILTER_SQL, "Connection to the MySQL server is active."); if (oldThreadId != mysql_thread_id(GetHandle())) - sLog->outSQLDriver("Successfully reconnected to %s @%s:%s (%s).", + sLog->outInfo(LOG_FILTER_SQL, "Successfully reconnected to %s @%s:%s (%s).", m_connectionInfo.database.c_str(), m_connectionInfo.host.c_str(), m_connectionInfo.port_or_socket.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous"); @@ -518,21 +506,23 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) return _HandleMySQLErrno(lErrno); // Call self (recursive) } - case 1213: // "Deadlock found when trying to get lock; try restarting transaction" + case ER_LOCK_DEADLOCK: return false; // Implemented in TransactionTask::Execute and DatabaseWorkerPool::DirectCommitTransaction // Query related errors - skip query - case 1058: // "Column count doesn't match value count" - case 1062: // "Duplicate entry '%s' for key '%d'" + case ER_WRONG_VALUE_COUNT: + case ER_DUP_ENTRY: return false; // Outdated table or database structure - terminate core - case 1054: // "Unknown column '%s' in '%s'" - case 1146: // "Table '%s' doesn't exist" - WPFatal(!errNo, "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders."); + case ER_BAD_FIELD_ERROR: + case ER_NO_SUCH_TABLE: + sLog->outError(LOG_FILTER_SQL, "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders."); + ACE_OS::sleep(10); + std::abort(); return false; default: - sLog->outSQLDriver("Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo); + sLog->outError(LOG_FILTER_SQL, "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo); return false; } } diff --git a/src/server/shared/Database/MySQLThreading.h b/src/server/shared/Database/MySQLThreading.h index 2004ee9826c..038ec4ee794 100755 --- a/src/server/shared/Database/MySQLThreading.h +++ b/src/server/shared/Database/MySQLThreading.h @@ -33,7 +33,7 @@ class MySQL static void Thread_Init() { mysql_thread_init(); - sLog->outSQLDriver("Core thread with ID ["UI64FMTD"] initializing MySQL thread.", + sLog->outWarn(LOG_FILTER_SQL, "Core thread with ID ["UI64FMTD"] initializing MySQL thread.", (uint64)ACE_Based::Thread::currentId()); } @@ -44,7 +44,7 @@ class MySQL static void Thread_End() { mysql_thread_end(); - sLog->outSQLDriver("Core thread with ID ["UI64FMTD"] shutting down MySQL thread.", + sLog->outWarn(LOG_FILTER_SQL, "Core thread with ID ["UI64FMTD"] shutting down MySQL thread.", (uint64)ACE_Based::Thread::currentId()); } diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index 58aa2bd3aa0..a72532e928b 100755 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -78,7 +78,7 @@ void PreparedStatement::BindParameters() } #ifdef _DEBUG if (i < m_stmt->m_paramCount) - sLog->outSQLDriver("[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index); + sLog->outWarn(LOG_FILTER_SQL, "[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index); #endif } @@ -237,7 +237,7 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index) return false; if (m_paramsSet[index]) - sLog->outSQLDriver("[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index); + sLog->outWarn(LOG_FILTER_SQL, "[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index); return true; } diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp index a3602531205..99772c7e323 100755 --- a/src/server/shared/Database/QueryHolder.cpp +++ b/src/server/shared/Database/QueryHolder.cpp @@ -24,7 +24,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char *sql) { if (m_queries.size() <= index) { - sLog->outError("Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql); + sLog->outError(LOG_FILTER_SQL, "Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql); return false; } @@ -44,7 +44,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...) { if (!format) { - sLog->outError("Query (index: %zu) is empty.", index); + sLog->outError(LOG_FILTER_SQL, "Query (index: %zu) is empty.", index); return false; } @@ -56,7 +56,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...) if (res == -1) { - sLog->outError("SQL Query truncated (and not execute) for format: %s", format); + sLog->outError(LOG_FILTER_SQL, "SQL Query truncated (and not execute) for format: %s", format); return false; } @@ -67,7 +67,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt) { if (m_queries.size() <= index) { - sLog->outError("Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size()); + sLog->outError(LOG_FILTER_SQL, "Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size()); return false; } diff --git a/src/server/shared/Database/QueryResult.cpp b/src/server/shared/Database/QueryResult.cpp index 95034387089..cb21c088d00 100755 --- a/src/server/shared/Database/QueryResult.cpp +++ b/src/server/shared/Database/QueryResult.cpp @@ -59,7 +59,7 @@ m_length(NULL) //- This is where we store the (entire) resultset if (mysql_stmt_store_result(m_stmt)) { - sLog->outSQLDriver("%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); + sLog->outWarn(LOG_FILTER_SQL, "%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); return; } @@ -86,7 +86,7 @@ m_length(NULL) //- This is where we bind the bind the buffer to the statement if (mysql_stmt_bind_result(m_stmt, m_rBind)) { - sLog->outSQLDriver("%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); + sLog->outWarn(LOG_FILTER_SQL, "%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); delete[] m_rBind; delete[] m_isNull; delete[] m_length; diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h index 48a8bda32ed..6ce3d926f4c 100755 --- a/src/server/shared/Debugging/Errors.h +++ b/src/server/shared/Debugging/Errors.h @@ -24,10 +24,10 @@ #include #include -#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError("\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } } -#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError("%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } } -#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } } -#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } } +#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } } +#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } } +#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } } +#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } } #define ASSERT WPAssert #endif diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp new file mode 100644 index 00000000000..38d58f1ffb5 --- /dev/null +++ b/src/server/shared/Logging/Appender.cpp @@ -0,0 +1,153 @@ +#include "Appender.h" +#include "Common.h" + +std::string LogMessage::getTimeStr(time_t time) +{ + tm* aTm = localtime(&time); + char buf[20]; + snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); + return std::string(buf); +} + +std::string LogMessage::getTimeStr() +{ + return getTimeStr(mtime); +} + +Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */): +id(_id), name(_name), type(_type), level(_level) +{ +} + +Appender::~Appender() +{ +} + +uint8 Appender::getId() const +{ + return id; +} + +std::string const& Appender::getName() const +{ + return name; +} + +AppenderType Appender::getType() const +{ + return type; +} + +LogLevel Appender::getLogLevel() const +{ + return level; +} + +void Appender::setLogLevel(LogLevel _level) +{ + level = _level; +} + +void Appender::write(LogMessage& message) +{ + if (level && level <= message.level) + _write(message); + //else fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe +} + +const char* Appender::getLogLevelString(LogLevel level) +{ + switch (level) + { + case LOG_LEVEL_FATAL: + return "FATAL"; + case LOG_LEVEL_ERROR: + return "ERROR"; + case LOG_LEVEL_WARN: + return "WARN"; + case LOG_LEVEL_INFO: + return "INFO"; + case LOG_LEVEL_DEBUG: + return "DEBUG"; + case LOG_LEVEL_TRACE: + return "TRACE"; + default: + return "DISABLED"; + } +} + +char const* Appender::getLogFilterTypeString(LogFilterType type) +{ + switch (type) + { + case LOG_FILTER_GENERAL: + return "GENERAL"; + case LOG_FILTER_UNITS: + return "UNITS"; + case LOG_FILTER_PETS: + return "PETS"; + case LOG_FILTER_VEHICLES: + return "VEHICLES"; + case LOG_FILTER_TSCR: + return "TSCR"; + case LOG_FILTER_DATABASE_AI: + return "DATABASE_AI"; + case LOG_FILTER_MAPSCRIPTS: + return "MAPSCRIPTS"; + case LOG_FILTER_NETWORKIO: + return "NETWORKIO"; + case LOG_FILTER_SPELLS_AURAS: + return "SPELLS_AURAS"; + case LOG_FILTER_ACHIEVEMENTSYS: + return "ACHIEVEMENTSYS"; + case LOG_FILTER_CONDITIONSYS: + return "CONDITIONSYS"; + case LOG_FILTER_POOLSYS: + return "POOLSYS"; + case LOG_FILTER_AUCTIONHOUSE: + return "AUCTIONHOUSE"; + case LOG_FILTER_BATTLEGROUND: + return "BATTLEGROUND"; + case LOG_FILTER_OUTDOORPVP: + return "OUTDOORPVP"; + case LOG_FILTER_CHATSYS: + return "CHATSYS"; + case LOG_FILTER_LFG: + return "LFG"; + case LOG_FILTER_MAPS: + return "MAPS"; + case LOG_FILTER_PLAYER: + return "PLAYER"; + case LOG_FILTER_PLAYER_LOADING: + return "PLAYER_LOADING"; + case LOG_FILTER_PLAYER_ITEMS: + return "PLAYER_ITEMS"; + case LOG_FILTER_PLAYER_SKILLS: + return "PLAYER_SKILLS"; + case LOG_FILTER_PLAYER_CHATLOG: + return "PLAYER_CHATLOG"; + case LOG_FILTER_LOOT: + return "LOOT"; + case LOG_FILTER_GUILD: + return "GUILD"; + case LOG_FILTER_TRANSPORTS: + return "TRANSPORTS"; + case LOG_FILTER_SQL: + return "SQL"; + case LOG_FILTER_GMCOMMAND: + return "GMCOMMAND"; + case LOG_FILTER_REMOTECOMMAND: + return "REMOTECOMMAND"; + case LOG_FILTER_WARDEN: + return "WARDEN"; + case LOG_FILTER_AUTHSERVER: + return "AUTHSERVER"; + case LOG_FILTER_WORLDSERVER: + return "WORLDSERVER"; + case LOG_FILTER_GAMEEVENTS: + return "GAMEEVENTS"; + default: + break; + } + return "???"; +} diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h new file mode 100644 index 00000000000..992554d59aa --- /dev/null +++ b/src/server/shared/Logging/Appender.h @@ -0,0 +1,115 @@ +#ifndef APPENDER_H +#define APPENDER_H + +#include "Define.h" + +#include +#include + +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 +}; + +const uint8 MaxLogFilter = uint8(LOG_FILTER_CALENDAR) + 1; + +// Values assigned have their equivalent in enum ACE_Log_Priority +enum LogLevel +{ + LOG_LEVEL_DISABLED = 0, + LOG_LEVEL_TRACE = 1, + LOG_LEVEL_DEBUG = 2, + LOG_LEVEL_INFO = 3, + LOG_LEVEL_WARN = 4, + LOG_LEVEL_ERROR = 5, + LOG_LEVEL_FATAL = 6, +}; + +const uint8 MaxLogLevels = 6; + +enum AppenderType +{ + APPENDER_NONE, + APPENDER_CONSOLE, + APPENDER_FILE, + APPENDER_DB, +}; + +struct LogMessage +{ + LogMessage(LogLevel _level, LogFilterType _type, std::string _text): level(_level), type(_type), text(_text) + { + mtime = time(NULL); + } + + static std::string getTimeStr(time_t time); + std::string getTimeStr(); + + LogLevel level; + LogFilterType type; + std::string text; + uint32 param1; + time_t mtime; +}; + +class Appender +{ + public: + Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED); + virtual ~Appender(); + + uint8 getId() const; + std::string const& getName() const; + AppenderType getType() const; + LogLevel getLogLevel() const; + + void setLogLevel(LogLevel); + void write(LogMessage& message); + static const char* getLogLevelString(LogLevel level); + static const char* getLogFilterTypeString(LogFilterType type); + + private: + virtual void _write(LogMessage& /*message*/) {}; + + uint8 id; + std::string name; + AppenderType type; + LogLevel level; +}; + +typedef std::map AppenderMap; + +#endif diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp new file mode 100644 index 00000000000..ad81a883bfa --- /dev/null +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -0,0 +1,174 @@ +#include "AppenderConsole.h" +#include "Config.h" +#include "Util.h" + +#include + +AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level): +Appender(id, name, APPENDER_CONSOLE, level), _colored(false), _colors() +{ +} + +void AppenderConsole::InitColors(std::string const& str) +{ + if (str.empty()) + { + _colored = false; + return; + } + + int color[MaxLogLevels]; + + std::istringstream ss(str); + + for (uint8 i = 0; i < MaxLogLevels; ++i) + { + ss >> color[i]; + + if (!ss) + return; + + if (color[i] < 0 || color[i] >= MaxColors) + return; + } + + for (uint8 i = 0; i < MaxLogLevels; ++i) + _colors[i] = ColorTypes(color[i]); + + _colored = true; +} + +void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color) +{ + #if PLATFORM == PLATFORWINDOWS + static WORD WinColorFG[MaxColors] = + { + 0, // BLACK + FOREGROUND_RED, // RED + FOREGROUND_GREEN, // GREEN + FOREGROUND_RED | FOREGROUND_GREEN, // BROWN + FOREGROUND_BLUE, // BLUE + FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA + FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN + FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE + // YELLOW + FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY, + // RED_BOLD + FOREGROUND_RED | FOREGROUND_INTENSITY, + // GREEN_BOLD + FOREGROUND_GREEN | FOREGROUND_INTENSITY, + FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD + // MAGENTA_BOLD + FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY, + // CYAN_BOLD + FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY, + // WHITE_BOLD + FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY + }; + + HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); + SetConsoleTextAttribute(hConsole, WinColorFG[color]); + #else + enum ANSITextAttr + { + TA_NORMAL = 0, + TA_BOLD = 1, + TA_BLINK = 5, + TA_REVERSE = 7 + }; + + enum ANSIFgTextAttr + { + FG_BLACK = 30, + FG_RED, + FG_GREEN, + FG_BROWN, + FG_BLUE, + FG_MAGENTA, + FG_CYAN, + FG_WHITE, + FG_YELLOW + }; + + enum ANSIBgTextAttr + { + BG_BLACK = 40, + BG_RED, + BG_GREEN, + BG_BROWN, + BG_BLUE, + BG_MAGENTA, + BG_CYAN, + BG_WHITE + }; + + static uint8 UnixColorFG[MaxColors] = + { + FG_BLACK, // BLACK + FG_RED, // RED + FG_GREEN, // GREEN + FG_BROWN, // BROWN + FG_BLUE, // BLUE + FG_MAGENTA, // MAGENTA + FG_CYAN, // CYAN + FG_WHITE, // WHITE + FG_YELLOW, // YELLOW + FG_RED, // LRED + FG_GREEN, // LGREEN + FG_BLUE, // LBLUE + FG_MAGENTA, // LMAGENTA + FG_CYAN, // LCYAN + FG_WHITE // LWHITE + }; + + fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < MaxColors ? ";1" : "")); + #endif +} + +void AppenderConsole::ResetColor(bool stdout_stream) +{ + #if PLATFORM == PLATFORWINDOWS + HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); + SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED); + #else + fprintf((stdout_stream ? stdout : stderr), "\x1b[0m"); + #endif +} + +void AppenderConsole::_write(LogMessage& message) +{ + bool stdout_stream = message.level == LOG_LEVEL_ERROR || message.level == LOG_LEVEL_FATAL; + + if (_colored) + { + uint8 index; + switch (message.level) + { + case LOG_LEVEL_TRACE: + index = 5; + break; + case LOG_LEVEL_DEBUG: + index = 4; + break; + case LOG_LEVEL_INFO: + index = 3; + break; + case LOG_LEVEL_WARN: + index = 2; + break; + case LOG_LEVEL_FATAL: + index = 0; + break; + case LOG_LEVEL_ERROR: // No break on purpose + default: + index = 1; + break; + } + + SetColor(stdout_stream, _colors[index]); + utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + ResetColor(stdout_stream); + } + else + utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); +} diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h new file mode 100644 index 00000000000..a9f46cf9c4a --- /dev/null +++ b/src/server/shared/Logging/AppenderConsole.h @@ -0,0 +1,42 @@ +#ifndef APPENDERCONSOLE_H +#define APPENDERCONSOLE_H + +#include "Appender.h" +#include + +enum ColorTypes +{ + BLACK, + RED, + GREEN, + BROWN, + BLUE, + MAGENTA, + CYAN, + GREY, + YELLOW, + LRED, + LGREEN, + LBLUE, + LMAGENTA, + LCYAN, + WHITE +}; + +const uint8 MaxColors = uint8(WHITE) + 1; + +class AppenderConsole: public Appender +{ + public: + AppenderConsole(uint8 _id, std::string const& name, LogLevel level); + void InitColors(const std::string& init_str); + + private: + void SetColor(bool stdout_stream, ColorTypes color); + void ResetColor(bool stdout_stream); + void _write(LogMessage& message); + bool _colored; + ColorTypes _colors[MaxLogLevels]; +}; + +#endif diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp new file mode 100644 index 00000000000..6f3737adf4d --- /dev/null +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -0,0 +1,30 @@ +#include "AppenderDB.h" + +/* FIXME +#include "DatabaseWorkerPool.h" +#include "Implementation/LoginDatabase.h" // For logging +extern DatabaseWorkerPool LoginDatabase; +*/ + +AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, uint8 realmId): +Appender(id, name, APPENDER_DB, level), realm(realmId), enable(false) +{ +} + +AppenderDB::~AppenderDB() +{ +} + +void AppenderDB::_write(LogMessage& /*message*/) +{ +/* FIXME + if (enable) + LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, severity, string) " + "VALUES (" UI64FMTD ", %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); +*/ +} + +void AppenderDB::setEnable(bool _enable) +{ + enable = _enable; +} diff --git a/src/server/shared/Logging/AppenderDB.h b/src/server/shared/Logging/AppenderDB.h new file mode 100644 index 00000000000..ca15fc1a1d5 --- /dev/null +++ b/src/server/shared/Logging/AppenderDB.h @@ -0,0 +1,19 @@ +#ifndef APPENDERDB_H +#define APPENDERDB_H + +#include "Appender.h" + +class AppenderDB: public Appender +{ + public: + AppenderDB(uint8 _id, std::string const& _name, LogLevel level, uint8 realmId); + ~AppenderDB(); + void setEnable(bool enable); + + private: + uint8 realm; + bool enable; + void _write(LogMessage& message); +}; + +#endif diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp new file mode 100644 index 00000000000..30c1f271c96 --- /dev/null +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -0,0 +1,54 @@ +#include "AppenderFile.h" +#include "Common.h" + +AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _mode, bool _backup) + : Appender(id, name, APPENDER_FILE, level) + , filename(_filename) + , mode(_mode) + , backup(_backup) +{ + dynamicName = std::string::npos != filename.find("%u"); + if (!dynamicName) + logfile = OpenFile(_filename, _mode, _backup); +} + +AppenderFile::~AppenderFile() +{ + if (logfile) + { + fclose(logfile); + logfile = NULL; + } +} + +void AppenderFile::_write(LogMessage& message) +{ + if (dynamicName) + { + char namebuf[TRINITY_PATH_MAX]; + snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1); + logfile = OpenFile(namebuf, mode, backup); + } + + if (logfile) + { + fprintf(logfile, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + + fflush(logfile); + + if (dynamicName) + fclose(logfile); + } +} + +FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mode, bool backup) +{ + if (mode == "w" && backup) + { + std::string newName(filename); + newName.push_back('.'); + newName.append(LogMessage::getTimeStr(time(NULL))); + rename(filename.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore + } + return fopen(filename.c_str(), mode.c_str()); +} diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h new file mode 100644 index 00000000000..a01ea947334 --- /dev/null +++ b/src/server/shared/Logging/AppenderFile.h @@ -0,0 +1,22 @@ +#ifndef APPENDERFILE_H +#define APPENDERFILE_H + +#include "Appender.h" + +class AppenderFile: public Appender +{ + public: + AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* mode, bool backup); + ~AppenderFile(); + FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup); + + private: + void _write(LogMessage& message); + FILE* logfile; + std::string filename; + std::string mode; + bool dynamicName; + bool backup; +}; + +#endif diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 79eab053d08..17c6df44125 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS + * Copyright (C) 2005-2008 MaNGOS * * 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 @@ -16,343 +16,246 @@ * with this program. If not, see . */ -#include "Common.h" #include "Log.h" -#include "Configuration/Config.h" -#include "Util.h" +#include "Common.h" +#include "Config.h" -#include "Implementation/LoginDatabase.h" // For logging -extern LoginDatabaseWorkerPool LoginDatabase; +#include "AppenderConsole.h" +#include "AppenderFile.h" +#include "AppenderDB.h" +#include "LogOperation.h" -#include -#include +#include +#include +#include -Log::Log() : - raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), - dberLogfile(NULL), chatLogfile(NULL), arenaLogFile(NULL), sqlLogFile(NULL), sqlDevLogFile(NULL), wardenLogFile(NULL), - m_gmlog_per_account(false), m_enableLogDBLater(false), - m_enableLogDB(false), m_colored(false) +Log::Log() { - Initialize(); + SetRealmID(0); + AppenderId = 0; + /// Common log files data + m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + if (!m_logsDir.empty()) + if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) + m_logsDir.push_back('/'); + + m_logsTimestamp = "_" + GetTimestampStr(); + + ReadAppendersFromConfig(); + ReadLoggersFromConfig(); + worker = new LogWorker(); } Log::~Log() { - if (logfile != NULL) - fclose(logfile); - logfile = NULL; - - if (gmLogfile != NULL) - fclose(gmLogfile); - gmLogfile = NULL; - - if (charLogfile != NULL) - fclose(charLogfile); - charLogfile = NULL; - - if (dberLogfile != NULL) - fclose(dberLogfile); - dberLogfile = NULL; - - if (raLogfile != NULL) - fclose(raLogfile); - raLogfile = NULL; - - if (chatLogfile != NULL) - fclose(chatLogfile); - chatLogfile = NULL; - - if (arenaLogFile != NULL) - fclose(arenaLogFile); - arenaLogFile = NULL; - - if (sqlLogFile != NULL) - fclose(sqlLogFile); - sqlLogFile = NULL; - - if (sqlDevLogFile != NULL) - fclose(sqlDevLogFile); - sqlDevLogFile = NULL; - - if (wardenLogFile != NULL) - fclose(wardenLogFile); - wardenLogFile = NULL; + Close(); } -void Log::SetLogLevel(char *Level) +uint8 Log::NextAppenderId() { - int32 NewLevel = atoi((char*)Level); - if (NewLevel < 0) - NewLevel = 0; - m_logLevel = NewLevel; - - outString("LogLevel is %u", m_logLevel); + return AppenderId++; } -void Log::SetLogFileLevel(char *Level) +int32 GetConfigIntDefault(std::string base, const char* name, int32 value) { - int32 NewLevel = atoi((char*)Level); - if (NewLevel < 0) - NewLevel = 0; - m_logFileLevel = NewLevel; + base.append(name); + return ConfigMgr::GetIntDefault(base.c_str(), value); +} - outString("LogFileLevel is %u", m_logFileLevel); +std::string GetConfigStringDefault(std::string base, const char* name, const char* value) +{ + base.append(name); + return ConfigMgr::GetStringDefault(base.c_str(), value); } -void Log::SetDBLogLevel(char *Level) +// Returns default logger if the requested logger is not found +Logger* Log::GetLoggerByType(LogFilterType filter) { - int32 NewLevel = atoi((char*)Level); - if (NewLevel < 0) - NewLevel = 0; - m_dbLogLevel = NewLevel; + LoggerMap::iterator it = loggers.begin(); + while (it != loggers.end() && it->second.getType() != filter) + ++it; - outString("DBLogLevel is %u", m_dbLogLevel); + return it == loggers.end() ? &(loggers[0]) : &(it->second); } -void Log::Initialize() +Appender* Log::GetAppenderByName(std::string const& name) { - /// Check whether we'll log GM commands/RA events/character outputs/chat stuffs - m_dbChar = ConfigMgr::GetBoolDefault("LogDB.Char", false); - m_dbRA = ConfigMgr::GetBoolDefault("LogDB.RA", false); - m_dbGM = ConfigMgr::GetBoolDefault("LogDB.GM", false); - m_dbChat = ConfigMgr::GetBoolDefault("LogDB.Chat", false); + AppenderMap::iterator it = appenders.begin(); + while (it != appenders.end() && it->second && it->second->getName() != name) + ++it; - /// Realm must be 0 by default - SetRealmID(0); + return it == appenders.end() ? NULL : it->second; +} - /// Common log files data - m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); - if (!m_logsDir.empty()) - if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) - m_logsDir.push_back('/'); +void Log::CreateAppenderFromConfig(const char* name) +{ + if (!name || *name == '\0') + return; - m_logsTimestamp = "_" + GetTimestampStr(); + std::string base = "Appender."; + base.append(name); + base.push_back('.'); - /// Open specific log files - logfile = openLogFile("LogFile", "LogTimestamp", "w"); - InitColors(ConfigMgr::GetStringDefault("LogColors", "")); + LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); + AppenderType type = AppenderType(GetConfigIntDefault(base, "Type", 0)); - m_gmlog_per_account = ConfigMgr::GetBoolDefault("GmLogPerAccount", false); - if (!m_gmlog_per_account) - gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a"); - else + switch(type) { - // GM log settings for per account case - m_gmlog_filename_format = ConfigMgr::GetStringDefault("GMLogFile", ""); - if (!m_gmlog_filename_format.empty()) + case APPENDER_CONSOLE: { - bool m_gmlog_timestamp = ConfigMgr::GetBoolDefault("GmLogTimestamp", false); + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level); + appenders[appender->getId()] = appender; - size_t dot_pos = m_gmlog_filename_format.find_last_of('.'); - if (dot_pos!=m_gmlog_filename_format.npos) - { - if (m_gmlog_timestamp) - m_gmlog_filename_format.insert(dot_pos, m_logsTimestamp); + appender->InitColors(GetConfigStringDefault(base, "Colors", "")); + //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe + break; + } + case APPENDER_FILE: + { + std::string filename = GetConfigStringDefault(base, "File", ""); + std::string mode = GetConfigStringDefault(base, "Mode", "a"); + std::string timestamp = GetConfigStringDefault(base, "Timestamp", ""); + bool backup = GetConfigIntDefault(base, "Backup", 0); - m_gmlog_filename_format.insert(dot_pos, "_#%u"); - } - else + if (!timestamp.empty()) { - m_gmlog_filename_format += "_#%u"; - - if (m_gmlog_timestamp) - m_gmlog_filename_format += m_logsTimestamp; + size_t dot_pos = filename.find_last_of("."); + if (dot_pos != filename.npos) + filename.insert(dot_pos, m_logsTimestamp); + else + filename += m_logsTimestamp; } - m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format; + uint8 id = NextAppenderId(); + appenders[id] = new AppenderFile(id, name, level, filename.c_str(), mode.c_str(), backup); + //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe + break; } + case APPENDER_DB: // TODO Set realm! + { + uint8 id = NextAppenderId(); + appenders[id] = new AppenderDB(id, name, level, realm); + break; + } + default: + break; } +} + +void Log::CreateLoggerFromConfig(const char* name) +{ + if (!name || *name == '\0') + return; + + std::string base = "Logger."; + base.append(name); + base.push_back('.'); + + LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); + int32 type = GetConfigIntDefault(base, "Type", -1); - charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a"); - dberLogfile = openLogFile("DBErrorLogFile", NULL, "a"); - raLogfile = openLogFile("RaLogFile", NULL, "a"); - chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a"); - arenaLogFile = openLogFile("ArenaLogFile", NULL, "a"); - sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a"); - sqlDevLogFile = openLogFile("SQLDeveloperLogFile", NULL, "a"); - wardenLogFile = openLogFile("Warden.LogFile",NULL,"a"); - - // Main log file settings - m_logLevel = ConfigMgr::GetIntDefault("LogLevel", LOGL_NORMAL); - m_logFileLevel = ConfigMgr::GetIntDefault("LogFileLevel", LOGL_NORMAL); - m_dbLogLevel = ConfigMgr::GetIntDefault("DBLogLevel", LOGL_NORMAL); - m_sqlDriverQueryLogging = ConfigMgr::GetBoolDefault("SQLDriverQueryLogging", false); - - m_DebugLogMask = DebugLogFilters(ConfigMgr::GetIntDefault("DebugLogMask", LOG_FILTER_NONE)); - - // Char log settings - m_charLog_Dump = ConfigMgr::GetBoolDefault("CharLogDump", false); - m_charLog_Dump_Separate = ConfigMgr::GetBoolDefault("CharLogDump.Separate", false); - if (m_charLog_Dump_Separate) + if (type < 0) { - m_dumpsDir = ConfigMgr::GetStringDefault("CharLogDump.SeparateDir", ""); - if (!m_dumpsDir.empty()) - if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\')) - m_dumpsDir.push_back('/'); + fprintf(stderr, "Log::CreateLoggerFromConfig: Missing entry %sType in config. Logger ignored\n", name); + return; } -} -void Log::ReloadConfig() -{ - m_logLevel = ConfigMgr::GetIntDefault("LogLevel", LOGL_NORMAL); - m_logFileLevel = ConfigMgr::GetIntDefault("LogFileLevel", LOGL_NORMAL); - m_dbLogLevel = ConfigMgr::GetIntDefault("DBLogLevel", LOGL_NORMAL); + Logger& logger = loggers[type]; - m_DebugLogMask = DebugLogFilters(ConfigMgr::GetIntDefault("DebugLogMask", LOG_FILTER_NONE)); -} + if (!logger.getName().empty()) + fprintf(stderr, "Error while configuring Logger %s. Replacing (name: %s, Type: %u, Level: %u) with (name: %s, Type: %u, Level: %u)\n", + name, logger.getName().c_str(), logger.getType(), logger.getLogLevel(), name, type, level); -FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode) -{ - std::string logfn=ConfigMgr::GetStringDefault(configFileName, ""); - if (logfn.empty()) - return NULL; + logger.Create(name, LogFilterType(type), level); + //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe - if (configTimeStampFlag && ConfigMgr::GetBoolDefault(configTimeStampFlag, false)) + std::istringstream ss(GetConfigStringDefault(base, "Appenders", "")); + std::string str; + + ss >> str; + while (ss) { - size_t dot_pos = logfn.find_last_of("."); - if (dot_pos!=logfn.npos) - logfn.insert(dot_pos, m_logsTimestamp); + if (Appender* appender = GetAppenderByName(str)) + { + logger.addAppender(appender->getId(), appender); + //fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name); // DEBUG - RemoveMe + } else - logfn += m_logsTimestamp; + fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist", str.c_str(), name); + ss >> str; } - - return fopen((m_logsDir+logfn).c_str(), mode); } -FILE* Log::openGmlogPerAccount(uint32 account) +void Log::ReadAppendersFromConfig() { - if (m_gmlog_filename_format.empty()) - return NULL; + std::istringstream ss(ConfigMgr::GetStringDefault("Appenders", "")); + std::string name; - char namebuf[TRINITY_PATH_MAX]; - snprintf(namebuf, TRINITY_PATH_MAX, m_gmlog_filename_format.c_str(), account); - return fopen(namebuf, "a"); + do + { + ss >> name; + CreateAppenderFromConfig(name.c_str()); + name = ""; + } + while (ss); } -void Log::outTimestamp(FILE* file) +void Log::ReadLoggersFromConfig() { - time_t t = time(NULL); - tm* aTm = localtime(&t); - // YYYY year - // MM month (2 digits 01-12) - // DD day (2 digits 01-31) - // HH hour (2 digits 00-23) - // MM minutes (2 digits 00-59) - // SS seconds (2 digits 00-59) - fprintf(file, "%-4d-%02d-%02d %02d:%02d:%02d ", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); -} + std::istringstream ss(ConfigMgr::GetStringDefault("Loggers", "")); + std::string name; -void Log::InitColors(const std::string& str) -{ - if (str.empty()) + do { - m_colored = false; - return; + ss >> name; + CreateLoggerFromConfig(name.c_str()); + name = ""; } + while (ss); - int color[4]; - - std::istringstream ss(str); + LoggerMap::const_iterator it = loggers.begin(); - for (uint8 i = 0; i < LogLevels; ++i) - { - ss >> color[i]; + while (it != loggers.end() && it->first) + ++it; - if (!ss) - return; - - if (color[i] < 0 || color[i] >= Colors) - return; - } + // root logger must exist. Marking as disabled as its not configured + if (it == loggers.end()) + loggers[0].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED); +} - for (uint8 i = 0; i < LogLevels; ++i) - m_colors[i] = ColorTypes(color[i]); +void Log::EnableDBAppenders() +{ + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + if (it->second && it->second->getType() == APPENDER_DB) + ((AppenderDB *)it->second)->setEnable(true); - m_colored = true; } -void Log::SetColor(bool stdout_stream, ColorTypes color) +void Log::log(LogFilterType filter, LogLevel level, char const* str, ...) { - #if PLATFORM == PLATFORM_WINDOWS - static WORD WinColorFG[Colors] = - { - 0, // BLACK - FOREGROUND_RED, // RED - FOREGROUND_GREEN, // GREEN - FOREGROUND_RED | FOREGROUND_GREEN, // BROWN - FOREGROUND_BLUE, // BLUE - FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA - FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN - FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE - // YELLOW - FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY, - // RED_BOLD - FOREGROUND_RED | FOREGROUND_INTENSITY, - // GREEN_BOLD - FOREGROUND_GREEN | FOREGROUND_INTENSITY, - FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD - // MAGENTA_BOLD - FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY, - // CYAN_BOLD - FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY, - // WHITE_BOLD - FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY - }; - - HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE ); - SetConsoleTextAttribute(hConsole, WinColorFG[color]); - #else - enum ANSITextAttr - { - TA_NORMAL=0, - TA_BOLD=1, - TA_BLINK=5, - TA_REVERSE=7 - }; + if (!str || !ShouldLog(filter, level)) + return; - enum ANSIFgTextAttr - { - FG_BLACK=30, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE, - FG_MAGENTA, FG_CYAN, FG_WHITE, FG_YELLOW - }; + va_list ap; + va_start(ap, str); - enum ANSIBgTextAttr - { - BG_BLACK=40, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE, - BG_MAGENTA, BG_CYAN, BG_WHITE - }; + vlog(filter, level, str, ap); - static uint8 UnixColorFG[Colors] = - { - FG_BLACK, // BLACK - FG_RED, // RED - FG_GREEN, // GREEN - FG_BROWN, // BROWN - FG_BLUE, // BLUE - FG_MAGENTA, // MAGENTA - FG_CYAN, // CYAN - FG_WHITE, // WHITE - FG_YELLOW, // YELLOW - FG_RED, // LRED - FG_GREEN, // LGREEN - FG_BLUE, // LBLUE - FG_MAGENTA, // LMAGENTA - FG_CYAN, // LCYAN - FG_WHITE // LWHITE - }; - - fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < Colors ? ";1" : "")); - #endif + va_end(ap); +} + +void Log::vlog(LogFilterType filter, LogLevel level, char const* str, va_list argptr) +{ + char text[MAX_QUERY_LEN]; + vsnprintf(text, MAX_QUERY_LEN, str, argptr); + write(new LogMessage(level, filter, text)); } -void Log::ResetColor(bool stdout_stream) +void Log::write(LogMessage* msg) { - #if PLATFORM == PLATFORM_WINDOWS - HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE ); - SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED ); - #else - fprintf(( stdout_stream ? stdout : stderr ), "\x1b[0m"); - #endif + msg->text.append("\n"); + Logger* logger = GetLoggerByType(msg->type); + worker->enqueue(new LogOperation(logger, msg)); } std::string Log::GetTimestampStr() @@ -370,710 +273,160 @@ std::string Log::GetTimestampStr() return std::string(buf); } -void Log::outDB(LogTypes type, const char * str) +bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLogger /* = true */) { - if (!str || type >= MAX_LOG_TYPES) - return; + LogLevel newLevel = LogLevel(atoi(newLevelc)); + if (newLevel < 0) + return false; - std::string logStr(str); - if (logStr.empty()) - return; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); - - stmt->setInt32(0, realm); - stmt->setUInt8(1, uint8(type)); - stmt->setString(2, logStr); - - LoginDatabase.Execute(stmt); -} - -void Log::outString(const char * str, ...) -{ - if (!str) - return; - - if (m_enableLogDB) + if (isLogger) { - // we don't want empty strings in the DB - std::string s(str); - if (s.empty() || s == " ") - return; - - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_STRING, nnew_str); - va_end(ap2); - } + LoggerMap::iterator it = loggers.begin(); + while (it != loggers.end() && it->second.getName() != name) + ++it; - if (m_colored) - SetColor(true, m_colors[LOGL_NORMAL]); + if (it == loggers.end()) + return false; - va_list ap; - - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf("\n"); - if (logfile) - { - outTimestamp(logfile); - va_start(ap, str); - vfprintf(logfile, str, ap); - fprintf(logfile, "\n"); - va_end(ap); - - fflush(logfile); + it->second.setLogLevel(newLevel); } - fflush(stdout); -} - -void Log::outString() -{ - printf("\n"); - if (logfile) - { - outTimestamp(logfile); - fprintf(logfile, "\n"); - fflush(logfile); - } - fflush(stdout); -} - -void Log::outCrash(const char * err, ...) -{ - if (!err) - return; - - if (m_enableLogDB) - { - va_list ap2; - va_start(ap2, err); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2); - outDB(LOG_TYPE_CRASH, nnew_str); - va_end(ap2); - } - - if (m_colored) - SetColor(false, LRED); - - va_list ap; - - va_start(ap, err); - vutf8printf(stderr, err, &ap); - va_end(ap); - - if (m_colored) - ResetColor(false); - - fprintf(stderr, "\n"); - if (logfile) + else { - outTimestamp(logfile); - fprintf(logfile, "CRASH ALERT: "); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); + Appender* appender = GetAppenderByName(name); + if (!appender) + return false; - fprintf(logfile, "\n"); - fflush(logfile); + appender->setLogLevel(newLevel); } - fflush(stderr); + return true; } -void Log::outError(const char * err, ...) +bool Log::ShouldLog(LogFilterType type, LogLevel level) const { - if (!err) - return; - - if (m_enableLogDB) - { - va_list ap2; - va_start(ap2, err); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2); - outDB(LOG_TYPE_ERROR, nnew_str); - va_end(ap2); - } - - if (m_colored) - SetColor(false, LRED); - - va_list ap; - - va_start(ap, err); - vutf8printf(stderr, err, &ap); - va_end(ap); + LoggerMap::const_iterator it = loggers.begin(); + while (it != loggers.end() && it->second.getType() != type) + ++it; - if (m_colored) - ResetColor(false); - - fprintf( stderr, "\n"); - if (logfile) + if (it != loggers.end()) { - outTimestamp(logfile); - fprintf(logfile, "ERROR: "); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); - - fprintf(logfile, "\n"); - fflush(logfile); + LogLevel loggerLevel = it->second.getLogLevel(); + return loggerLevel && loggerLevel <= level; } - fflush(stderr); -} -void Log::outArena(const char * str, ...) -{ - if (!str) - return; + if (type != LOG_FILTER_GENERAL) + return ShouldLog(LOG_FILTER_GENERAL, level); - if (arenaLogFile) - { - va_list ap; - outTimestamp(arenaLogFile); - va_start(ap, str); - vfprintf(arenaLogFile, str, ap); - fprintf(arenaLogFile, "\n"); - va_end(ap); - fflush(arenaLogFile); - } + return false; } -void Log::outSQLDriver(const char* str, ...) +void Log::outTrace(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_TRACE)) return; va_list ap; va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - printf("\n"); - - if (sqlLogFile) - { - outTimestamp(sqlLogFile); - - va_list apSQL; - va_start(apSQL, str); - vfprintf(sqlLogFile, str, apSQL); - va_end(apSQL); - - fprintf(sqlLogFile, "\n"); - fflush(sqlLogFile); - } - - fflush(stdout); -} - -void Log::outErrorDb(const char * err, ...) -{ - if (!err) - return; - - if (m_colored) - SetColor(false, LRED); - va_list ap; + vlog(filter, LOG_LEVEL_TRACE, str, ap); - va_start(ap, err); - vutf8printf(stderr, err, &ap); va_end(ap); - - if (m_colored) - ResetColor(false); - - fprintf( stderr, "\n" ); - - if (logfile) - { - outTimestamp(logfile); - fprintf(logfile, "ERROR: " ); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - - if (dberLogfile) - { - outTimestamp(dberLogfile); - va_start(ap, err); - vfprintf(dberLogfile, err, ap); - va_end(ap); - - fprintf(dberLogfile, "\n" ); - fflush(dberLogfile); - } - fflush(stderr); } -void Log::outBasic(const char * str, ...) +void Log::outDebug(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_DEBUG)) return; - if (m_enableLogDB && m_dbLogLevel > LOGL_NORMAL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_BASIC, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_NORMAL) - { - if (m_colored) - SetColor(true, m_colors[LOGL_BASIC]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf("\n"); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - fprintf(logfile, "\n" ); - va_end(ap2); - fflush(logfile); - } - } - fflush(stdout); -} - -void Log::outDetail(const char * str, ...) -{ - if (!str) - return; - - if (m_enableLogDB && m_dbLogLevel > LOGL_BASIC) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DETAIL, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_BASIC) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DETAIL]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); + va_list ap; + va_start(ap, str); - printf("\n"); + vlog(filter, LOG_LEVEL_DEBUG, str, ap); - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n"); - fflush(logfile); - } - } - - fflush(stdout); + va_end(ap); } -void Log::outDebugInLine(const char * str, ...) +void Log::outInfo(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_INFO)) return; - if (m_logLevel > LOGL_DETAIL) - { - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); + va_list ap; + va_start(ap, str); - //if (m_colored) - // ResetColor(true); + vlog(filter, LOG_LEVEL_INFO, str, ap); - if (logfile) - { - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - } - } + va_end(ap); } -void Log::outSQLDev(const char* str, ...) +void Log::outWarn(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_WARN)) return; va_list ap; va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - printf("\n"); + vlog(filter, LOG_LEVEL_WARN, str, ap); - if (sqlDevLogFile) - { - va_list ap2; - va_start(ap2, str); - vfprintf(sqlDevLogFile, str, ap2); - va_end(ap2); - - fprintf(sqlDevLogFile, "\n"); - fflush(sqlDevLogFile); - } - - fflush(stdout); + va_end(ap); } -void Log::outDebug(DebugLogFilters f, const char * str, ...) +void Log::outError(LogFilterType filter, const char * str, ...) { - if (!(m_DebugLogMask & f)) - return; - - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_ERROR)) return; - if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DEBUG, nnew_str); - va_end(ap2); - } - - if ( m_logLevel > LOGL_DETAIL ) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DEBUG]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); + va_list ap; + va_start(ap, str); - printf( "\n" ); + vlog(filter, LOG_LEVEL_ERROR, str, ap); - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - } - fflush(stdout); + va_end(ap); } -void Log::outStaticDebug(const char * str, ...) +void Log::outFatal(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_FATAL)) return; - if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DEBUG, nnew_str); - va_end(ap2); - } - - if ( m_logLevel > LOGL_DETAIL ) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DEBUG]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); + va_list ap; + va_start(ap, str); - printf( "\n" ); + vlog(filter, LOG_LEVEL_FATAL, str, ap); - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - } - fflush(stdout); + va_end(ap); } -void Log::outStringInLine(const char * str, ...) +void Log::outCommand(uint32 account, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(LOG_FILTER_GMCOMMAND, LOG_LEVEL_INFO)) return; va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); + char text[MAX_QUERY_LEN]; + vsnprintf(text, MAX_QUERY_LEN, str, ap); va_end(ap); - if (logfile) - { - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); - } -} - -void Log::outCommand(uint32 account, const char * str, ...) -{ - if (!str) - return; - - // TODO: support accountid - if (m_enableLogDB && m_dbGM) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_GM, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_NORMAL) - { - if (m_colored) - SetColor(true, m_colors[LOGL_BASIC]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); + LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_GMCOMMAND, text); + msg->param1 = account; - if (m_colored) - ResetColor(true); - - printf("\n"); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - fprintf(logfile, "\n" ); - va_end(ap2); - fflush(logfile); - } - } - - if (m_gmlog_per_account) - { - if (FILE* per_file = openGmlogPerAccount (account)) - { - outTimestamp(per_file); - va_list ap; - va_start(ap, str); - vfprintf(per_file, str, ap); - fprintf(per_file, "\n" ); - va_end(ap); - fclose(per_file); - } - } - else if (gmLogfile) - { - outTimestamp(gmLogfile); - va_list ap; - va_start(ap, str); - vfprintf(gmLogfile, str, ap); - fprintf(gmLogfile, "\n" ); - va_end(ap); - fflush(gmLogfile); - } - - fflush(stdout); + write(msg); } -void Log::outChar(const char * str, ...) +void Log::SetRealmID(uint32 id) { - if (!str) - return; - - if (m_enableLogDB && m_dbChar) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_CHAR, nnew_str); - va_end(ap2); - } - - if (charLogfile) - { - outTimestamp(charLogfile); - va_list ap; - va_start(ap, str); - vfprintf(charLogfile, str, ap); - fprintf(charLogfile, "\n" ); - va_end(ap); - fflush(charLogfile); - } -} - -void Log::outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name) -{ - FILE* file = NULL; - if (m_charLog_Dump_Separate) - { - char fileName[29]; // Max length: name(12) + guid(11) + _.log (5) + \0 - snprintf(fileName, 29, "%d_%s.log", guid, name); - std::string sFileName(m_dumpsDir); - sFileName.append(fileName); - file = fopen((m_logsDir + sFileName).c_str(), "w"); - } - else - file = charLogfile; - if (file) - { - fprintf(file, "== START DUMP == (account: %u guid: %u name: %s )\n%s\n== END DUMP ==\n", - account_id, guid, name, str); - fflush(file); - if (m_charLog_Dump_Separate) - fclose(file); - } -} - -void Log::outRemote(const char * str, ...) -{ - if (!str) - return; - - if (m_enableLogDB && m_dbRA) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_RA, nnew_str); - va_end(ap2); - } - - if (raLogfile) - { - outTimestamp(raLogfile); - va_list ap; - va_start(ap, str); - vfprintf(raLogfile, str, ap); - fprintf(raLogfile, "\n" ); - va_end(ap); - fflush(raLogfile); - } + realm = id; } -void Log::outChat(const char * str, ...) +void Log::Close() { - if (!str) - return; - - if (m_enableLogDB && m_dbChat) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_CHAT, nnew_str); - va_end(ap2); - } - - if (chatLogfile) - { - outTimestamp(chatLogfile); - va_list ap; - va_start(ap, str); - vfprintf(chatLogfile, str, ap); - fprintf(chatLogfile, "\n" ); - fflush(chatLogfile); - va_end(ap); - } -} - -void Log::outErrorST(const char * str, ...) -{ - va_list ap; - va_start(ap, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap); - va_end(ap); - - ACE_Stack_Trace st; - outError("%s [Stacktrace: %s]", nnew_str, st.c_str()); -} - -void Log::outWarden(const char * str, ...) -{ - if (!str) - return; - - if (wardenLogFile) + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) { - outTimestamp(wardenLogFile); - va_list ap; - va_start(ap, str); - vfprintf(wardenLogFile, str, ap); - fprintf(wardenLogFile, "\n" ); - fflush(wardenLogFile); - va_end(ap); + delete it->second; + it->second = NULL; } + appenders.clear(); + delete worker; + worker = NULL; } diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 296c13d86c9..5e2b7972dc8 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -19,196 +19,69 @@ #ifndef TRINITYCORE_LOG_H #define TRINITYCORE_LOG_H -#include "Common.h" -#include - -class Config; +#include "Define.h" +#include "Appender.h" +#include "LogWorker.h" +#include "Logger.h" -enum DebugLogFilters -{ - LOG_FILTER_NONE = 0x00000000, - LOG_FILTER_UNITS = 0x00000001, // Anything related to units that doesn't fit in other categories. ie. creature formations - LOG_FILTER_PETS = 0x00000002, - LOG_FILTER_VEHICLES = 0x00000004, - LOG_FILTER_TSCR = 0x00000008, // C++ AI, instance scripts, etc. - LOG_FILTER_DATABASE_AI = 0x00000010, // SmartAI, EventAI, CreatureAI - LOG_FILTER_MAPSCRIPTS = 0x00000020, - LOG_FILTER_NETWORKIO = 0x00000040, // Anything packet/netcode related - LOG_FILTER_SPELLS_AURAS = 0x00000080, - LOG_FILTER_ACHIEVEMENTSYS = 0x00000100, - LOG_FILTER_CONDITIONSYS = 0x00000200, - LOG_FILTER_POOLSYS = 0x00000400, - LOG_FILTER_AUCTIONHOUSE = 0x00000800, - LOG_FILTER_BATTLEGROUND = 0x00001000, // Anything related to arena's and battlegrounds - LOG_FILTER_OUTDOORPVP = 0x00002000, - LOG_FILTER_CHATSYS = 0x00004000, - LOG_FILTER_LFG = 0x00008000, - LOG_FILTER_MAPS = 0x00010000, // Maps, instances, grids, cells, visibility - LOG_FILTER_PLAYER_LOADING = 0x00020000, // Debug output from Player::_Load functions - LOG_FILTER_PLAYER_ITEMS = 0x00040000, // Anything item related - LOG_FILTER_PLAYER_SKILLS = 0x00080000, // Skills related - LOG_FILTER_LOOT = 0x00100000, // Loot related - LOG_FILTER_GUILD = 0x00200000, // Guild related - LOG_FILTER_TRANSPORTS = 0x00400000, // Transport related - LOG_FILTER_WARDEN = 0x00800000, // Warden related -}; - -enum LogTypes -{ - LOG_TYPE_STRING = 0, - LOG_TYPE_ERROR = 1, - LOG_TYPE_BASIC = 2, - LOG_TYPE_DETAIL = 3, - LOG_TYPE_DEBUG = 4, - LOG_TYPE_CHAR = 5, - LOG_TYPE_WORLD = 6, - LOG_TYPE_RA = 7, - LOG_TYPE_GM = 8, - LOG_TYPE_CRASH = 9, - LOG_TYPE_CHAT = 10, - MAX_LOG_TYPES -}; - -enum LogLevel -{ - LOGL_NORMAL = 0, - LOGL_BASIC, - LOGL_DETAIL, - LOGL_DEBUG -}; - -const int LogLevels = int(LOGL_DEBUG)+1; - -enum ColorTypes -{ - BLACK, - RED, - GREEN, - BROWN, - BLUE, - MAGENTA, - CYAN, - GREY, - YELLOW, - LRED, - LGREEN, - LBLUE, - LMAGENTA, - LCYAN, - WHITE -}; +#include -const int Colors = int(WHITE)+1; +#include +#include class Log { friend class ACE_Singleton; + typedef std::map LoggerMap; + private: Log(); ~Log(); public: - void Initialize(); - - void ReloadConfig(); - - void InitColors(const std::string& init_str); - void SetColor(bool stdout_stream, ColorTypes color); - void ResetColor(bool stdout_stream); - - void outErrorST(const char * err, ...) ATTR_PRINTF(2, 3); - void outDB(LogTypes type, const char * str); - void outString(const char * str, ...) ATTR_PRINTF(2, 3); - void outString(); - void outStringInLine(const char * str, ...) ATTR_PRINTF(2, 3); - void outError(const char * err, ...) ATTR_PRINTF(2, 3); - void outCrash(const char * err, ...) ATTR_PRINTF(2, 3); - void outBasic(const char * str, ...) ATTR_PRINTF(2, 3); - void outDetail(const char * str, ...) ATTR_PRINTF(2, 3); - void outSQLDev(const char * str, ...) ATTR_PRINTF(2, 3); - void outDebug(DebugLogFilters f, const char* str, ...) ATTR_PRINTF(3, 4); - void outStaticDebug(const char * str, ...) ATTR_PRINTF(2, 3); - void outDebugInLine(const char * str, ...) ATTR_PRINTF(2, 3); - void outErrorDb(const char * str, ...) ATTR_PRINTF(2, 3); - void outChar(const char * str, ...) ATTR_PRINTF(2, 3); - void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); - void outRemote(const char * str, ...) ATTR_PRINTF(2, 3); - void outChat(const char * str, ...) ATTR_PRINTF(2, 3); - void outArena(const char * str, ...) ATTR_PRINTF(2, 3); - void outSQLDriver(const char* str, ...) ATTR_PRINTF(2, 3); - void outWarden(const char * str, ...) ATTR_PRINTF(2, 3); - void outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name); - - static void outTimestamp(FILE* file); - static std::string GetTimestampStr(); + void Close(); + bool ShouldLog(LogFilterType type, LogLevel level) const; + bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true); - void SetLogLevel(char * Level); - void SetLogFileLevel(char * Level); - void SetDBLogLevel(char * Level); - void SetSQLDriverQueryLogging(bool newStatus) { m_sqlDriverQueryLogging = newStatus; } - void SetRealmID(uint32 id) { realm = id; } + void log(LogFilterType f, LogLevel level, char const* str, ...) ATTR_PRINTF(4,5); + + void outTrace(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outDebug(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outInfo(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outWarn(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outError(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outFatal(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + + void EnableDBAppenders(); + void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); + static std::string GetTimestampStr(); - bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); } - bool IsOutCharDump() const { return m_charLog_Dump; } + void SetRealmID(uint32 id); - bool GetLogDB() const { return m_enableLogDB; } - bool GetLogDBLater() const { return m_enableLogDBLater; } - void SetLogDB(bool enable) { m_enableLogDB = enable; } - void SetLogDBLater(bool value) { m_enableLogDBLater = value; } - bool GetSQLDriverQueryLogging() const { return m_sqlDriverQueryLogging; } private: - FILE* openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode); - FILE* openGmlogPerAccount(uint32 account); - - FILE* raLogfile; - FILE* logfile; - FILE* gmLogfile; - FILE* charLogfile; - FILE* dberLogfile; - FILE* chatLogfile; - FILE* arenaLogFile; - FILE* sqlLogFile; - FILE* sqlDevLogFile; - FILE* wardenLogFile; - - // cache values for after initilization use (like gm log per account case) + void vlog(LogFilterType f, LogLevel level, char const* str, va_list argptr); + void write(LogMessage* msg); + + Logger* GetLoggerByType(LogFilterType filter); + Appender* GetAppenderByName(std::string const& name); + uint8 NextAppenderId(); + void CreateAppenderFromConfig(const char* name); + void CreateLoggerFromConfig(const char* name); + void ReadAppendersFromConfig(); + void ReadLoggersFromConfig(); + + AppenderMap appenders; + LoggerMap loggers; + uint8 AppenderId; + std::string m_logsDir; std::string m_logsTimestamp; - // gm log control - bool m_gmlog_per_account; - std::string m_gmlog_filename_format; - - bool m_enableLogDBLater; - bool m_enableLogDB; uint32 realm; - - // log coloring - bool m_colored; - ColorTypes m_colors[4]; - - // log levels: - // false: errors only, true: full query logging - bool m_sqlDriverQueryLogging; - - // log levels: - // 0 minimum/string, 1 basic/error, 2 detail, 3 full/debug - uint8 m_dbLogLevel; - uint8 m_logLevel; - uint8 m_logFileLevel; - bool m_dbChar; - bool m_dbRA; - bool m_dbGM; - bool m_dbChat; - bool m_charLog_Dump; - bool m_charLog_Dump_Separate; - std::string m_dumpsDir; - - DebugLogFilters m_DebugLogMask; + LogWorker* worker; }; #define sLog ACE_Singleton::instance() #endif - diff --git a/src/server/shared/Logging/LogOperation.cpp b/src/server/shared/Logging/LogOperation.cpp new file mode 100644 index 00000000000..59368e519cd --- /dev/null +++ b/src/server/shared/Logging/LogOperation.cpp @@ -0,0 +1,14 @@ +#include "LogOperation.h" +#include "Logger.h" + +LogOperation::~LogOperation() +{ + delete msg; +} + +int LogOperation::call() +{ + if (logger && msg) + logger->write(*msg); + return 0; +} diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h new file mode 100644 index 00000000000..046ff44e62e --- /dev/null +++ b/src/server/shared/Logging/LogOperation.h @@ -0,0 +1,24 @@ +#ifndef LOGOPERATION_H +#define LOGOPERATION_H + +class Logger; +struct LogMessage; + +class LogOperation +{ + public: + LogOperation(Logger* _logger, LogMessage* _msg) + : logger(_logger) + , msg(_msg) + { } + + ~LogOperation(); + + int call(); + + protected: + Logger *logger; + LogMessage *msg; +}; + +#endif diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp new file mode 100644 index 00000000000..4dc71f7f878 --- /dev/null +++ b/src/server/shared/Logging/LogWorker.cpp @@ -0,0 +1,33 @@ +#include "LogWorker.h" + +LogWorker::LogWorker() + : m_queue(HIGH_WATERMARK, LOW_WATERMARK) +{ + ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 1); +} + +LogWorker::~LogWorker() +{ + m_queue.deactivate(); + wait(); +} + +int LogWorker::enqueue(LogOperation* op) +{ + return m_queue.enqueue(op); +} + +int LogWorker::svc() +{ + while (1) + { + LogOperation* request; + if (m_queue.dequeue(request) == -1) + break; + + request->call(); + delete request; + } + + return 0; +} diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h new file mode 100644 index 00000000000..fe51be5376c --- /dev/null +++ b/src/server/shared/Logging/LogWorker.h @@ -0,0 +1,30 @@ +#ifndef LOGWORKER_H +#define LOGWORKER_H + +#include "LogOperation.h" + +#include +#include + +class LogWorker: protected ACE_Task_Base +{ + public: + LogWorker(); + ~LogWorker(); + + typedef ACE_Message_Queue_Ex LogMessageQueueType; + + enum + { + HIGH_WATERMARK = 8 * 1024 * 1024, + LOW_WATERMARK = 8 * 1024 * 1024 + }; + + int enqueue(LogOperation *op); + + private: + virtual int svc(); + LogMessageQueueType m_queue; +}; + +#endif diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp new file mode 100644 index 00000000000..7464012c0ac --- /dev/null +++ b/src/server/shared/Logging/Logger.cpp @@ -0,0 +1,67 @@ +#include "Logger.h" + +Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED) +{ +} + +void Logger::Create(std::string const& _name, LogFilterType _type, LogLevel _level) +{ + name = _name; + type = _type; + level = _level; +} + +Logger::~Logger() +{ + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + it->second = NULL; + appenders.clear(); +} + +std::string const& Logger::getName() const +{ + return name; +} + +LogFilterType Logger::getType() const +{ + return type; +} + +LogLevel Logger::getLogLevel() const +{ + return level; +} + +void Logger::addAppender(uint8 id, Appender* appender) +{ + appenders[id] = appender; +} + +void Logger::delAppender(uint8 id) +{ + AppenderMap::iterator it = appenders.find(id); + if (it != appenders.end()) + { + it->second = NULL; + appenders.erase(it); + } +} + +void Logger::setLogLevel(LogLevel _level) +{ + level = _level; +} + +void Logger::write(LogMessage& message) +{ + if (!level || level > message.level || message.text.empty()) + { + //fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), messge.level, message.text.c_str(), .message.level); // DEBUG - RemoveMe + return; + } + + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + if (it->second) + it->second->write(message); +} diff --git a/src/server/shared/Logging/Logger.h b/src/server/shared/Logging/Logger.h new file mode 100644 index 00000000000..10b3991a537 --- /dev/null +++ b/src/server/shared/Logging/Logger.h @@ -0,0 +1,29 @@ +#ifndef LOGGER_H +#define LOGGER_H + +#include "Appender.h" + +class Logger +{ + public: + Logger(); + ~Logger(); + + void Create(std::string const& name, LogFilterType type, LogLevel level); + void addAppender(uint8 type, Appender *); + void delAppender(uint8 type); + + std::string const& getName() const; + LogFilterType getType() const; + LogLevel getLogLevel() const; + void setLogLevel(LogLevel level); + void write(LogMessage& message); + + private: + std::string name; + LogFilterType type; + LogLevel level; + AppenderMap appenders; +}; + +#endif diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 4fac31a9ac6..6912e841bc3 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -50,7 +50,7 @@ class ByteBufferPositionException : public ByteBufferException protected: void PrintError() const { - sLog->outError("Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") " , + sLog->outError(LOG_FILTER_GENERAL, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") " , (_add ? "put" : "get"), ValueSize, Pos, Size); } @@ -70,7 +70,7 @@ class ByteBufferSourceException : public ByteBufferException protected: void PrintError() const { - sLog->outError("Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")", + sLog->outError(LOG_FILTER_GENERAL, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")", (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size); } }; @@ -447,79 +447,65 @@ class ByteBuffer void print_storage() const { - if (!sLog->IsOutDebug()) // optimize disabled debug output + if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output return; - sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() ); + std::ostringstream o; + o << "STORAGE_SIZE: " << size(); for (uint32 i = 0; i < size(); ++i) - sLog->outDebugInLine("%u - ", read(i) ); - sLog->outDebug(LOG_FILTER_NETWORKIO, " "); + o << read(i) << " - "; + o << " "; + + sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); } void textlike() const { - if (!sLog->IsOutDebug()) // optimize disabled debug output + if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output return; - sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() ); + std::ostringstream o; + o << "STORAGE_SIZE: " << size(); for (uint32 i = 0; i < size(); ++i) - sLog->outDebugInLine("%c", read(i) ); - sLog->outDebug(LOG_FILTER_NETWORKIO, " "); + { + char buf[1]; + snprintf(buf, 1, "%c", read(i)); + o << buf; + } + o << " "; + sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); } void hexlike() const { - if (!sLog->IsOutDebug()) // optimize disabled debug output + if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output return; - + uint32 j = 1, k = 1; - sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() ); - + + std::ostringstream o; + o << "STORAGE_SIZE: " << size(); + for (uint32 i = 0; i < size(); ++i) { + char buf[3]; + snprintf(buf, 1, "%2X ", read(i)); if ((i == (j * 8)) && ((i != (k * 16)))) { - if (read(i) < 0x10) - { - sLog->outDebugInLine("| 0%X ", read(i) ); - } - else - { - sLog->outDebugInLine("| %X ", read(i) ); - } + o << "| "; ++j; } else if (i == (k * 16)) { - if (read(i) < 0x10) - { - sLog->outDebugInLine("\n"); - - sLog->outDebugInLine("0%X ", read(i) ); - } - else - { - sLog->outDebugInLine("\n"); - - sLog->outDebugInLine("%X ", read(i) ); - } - + o << "\n"; ++k; ++j; } - else - { - if (read(i) < 0x10) - { - sLog->outDebugInLine("0%X ", read(i) ); - } - else - { - sLog->outDebugInLine("%X ", read(i) ); - } - } + + o << buf; } - sLog->outDebugInLine("\n"); + o << " "; + sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); } protected: diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp index f2887a4d1bd..c6e9d385be3 100755 --- a/src/server/shared/Utilities/ServiceWin32.cpp +++ b/src/server/shared/Utilities/ServiceWin32.cpp @@ -257,7 +257,7 @@ bool WinServiceRun() if (!StartServiceCtrlDispatcher(serviceTable)) { - sLog->outError("StartService Failed. Error [%u]", ::GetLastError()); + sLog->outError(LOG_FILTER_GENERAL, "StartService Failed. Error [%u]", ::GetLastError()); return false; } return true; diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 699e7cad97c..23eeca11f66 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -135,7 +135,7 @@ int kb_hit_return() void CliRunnable::run() { ///- Display the list of available CLI functions then beep - //sLog->outString(""); + //sLog->outInfo(LOG_FILTER_WORLDSERVER, ""); #if PLATFORM != PLATFORM_WINDOWS rl_attempted_completion_function = cli_completion; rl_event_hook = cli_hook_func; diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 04820f59355..862ed28f2d3 100755 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -58,7 +58,7 @@ uint32 realmID; ///< Id of the realm /// Print out the usage string for this program on the console. void usage(const char *prog) { - sLog->outString("Usage: \n %s []\n" + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Usage: \n %s []\n" " -c config_file use config_file as configuration file\n\r" #ifdef _WIN32 " Running as service functions:\n\r" @@ -81,7 +81,7 @@ extern int main(int argc, char **argv) { if (++c >= argc) { - sLog->outError("Runtime-Error: -c option requires an input argument"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: -c option requires an input argument"); usage(argv[0]); return 1; } @@ -97,25 +97,25 @@ extern int main(int argc, char **argv) { if (++c >= argc) { - sLog->outError("Runtime-Error: -s option requires an input argument"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: -s option requires an input argument"); usage(argv[0]); return 1; } if (strcmp(argv[c], "install") == 0) { if (WinServiceInstall()) - sLog->outString("Installing service"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Installing service"); return 1; } else if (strcmp(argv[c], "uninstall") == 0) { if (WinServiceUninstall()) - sLog->outString("Uninstalling service"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Uninstalling service"); return 1; } else { - sLog->outError("Runtime-Error: unsupported option %s", argv[c]); + sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: unsupported option %s", argv[c]); usage(argv[0]); return 1; } @@ -131,14 +131,14 @@ extern int main(int argc, char **argv) if (!ConfigMgr::Load(cfg_file)) { - sLog->outError("Invalid or missing configuration file : %s", cfg_file); - sLog->outError("Verify that the file exists and has \'[worldserver]' written in the top of the file!"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Invalid or missing configuration file : %s", cfg_file); + sLog->outError(LOG_FILTER_WORLDSERVER, "Verify that the file exists and has \'[worldserver]' written in the top of the file!"); return 1; } - sLog->outString("Using configuration file %s.", cfg_file); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using configuration file %s.", cfg_file); - sLog->outString("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - sLog->outString("Using ACE version: %s", ACE_VERSION); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using ACE version: %s", ACE_VERSION); ///- and run the 'Master' /// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 03b2859c514..48e07c727b4 100755 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -84,7 +84,7 @@ public: { if (!_delaytime) return; - sLog->outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000); m_loops = 0; w_loops = 0; m_lastchange = 0; @@ -102,11 +102,11 @@ public: // possible freeze else if (getMSTimeDiff(w_lastchange, curtime) > _delaytime) { - sLog->outError("World Thread hangs, kicking out server!"); + sLog->outError(LOG_FILTER_WORLDSERVER, "World Thread hangs, kicking out server!"); ASSERT(false); } } - sLog->outString("Anti-freeze thread exiting without problems."); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Anti-freeze thread exiting without problems."); } }; @@ -124,18 +124,18 @@ int Master::Run() BigNumber seed1; seed1.SetRand(16 * 8); - sLog->outString("%s (worldserver-daemon)", _FULLVERSION); - sLog->outString(" to stop.\n"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon)", _FULLVERSION); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " to stop.\n"); - sLog->outString(" ______ __"); - sLog->outString("/\\__ _\\ __ __/\\ \\__"); - sLog->outString("\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __"); - sLog->outString(" \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\"); - sLog->outString(" \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\"); - sLog->outString(" \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\"); - sLog->outString(" \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\"); - sLog->outString(" C O R E /\\___/"); - sLog->outString("http://TrinityCore.org \\/__/\n"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " ______ __"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "/\\__ _\\ __ __/\\ \\__"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " C O R E /\\___/"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "http://TrinityCore.org \\/__/\n"); /// worldserver PID file creation std::string pidfile = ConfigMgr::GetStringDefault("PidFile", ""); @@ -144,11 +144,11 @@ int Master::Run() uint32 pid = CreatePIDFile(pidfile); if (!pid) { - sLog->outError("Cannot create PID file %s.\n", pidfile.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot create PID file %s.\n", pidfile.c_str()); return 1; } - sLog->outString("Daemon PID: %u\n", pid); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Daemon PID: %u\n", pid); } ///- Start the databases @@ -161,13 +161,13 @@ int Master::Run() ///- Initialize the World sWorld->SetInitialWorldSettings(); - // Initialise the signal handlers + ///- Initialize the signal handlers WorldServerSignalHandler SignalINT, SignalTERM; #ifdef _WIN32 WorldServerSignalHandler SignalBREAK; #endif /* _WIN32 */ - // Register worldserver's signal handlers + ///- Register worldserver's signal handlers ACE_Sig_Handler Handler; Handler.register_handler(SIGINT, &SignalINT); Handler.register_handler(SIGTERM, &SignalTERM); @@ -210,17 +210,16 @@ int Master::Run() if (!curAff) { - sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff); + sLog->outError(LOG_FILTER_WORLDSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff); } else { if (SetProcessAffinityMask(hProcess, curAff)) - sLog->outString("Using processors (bitmask, hex): %x", curAff); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", curAff); else - sLog->outError("Can't set used processors (hex): %x", curAff); + sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", curAff); } } - sLog->outString(""); } bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false); @@ -229,10 +228,9 @@ int Master::Run() if (Prio) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - sLog->outString("worldserver process priority class set to HIGH"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to HIGH"); else - sLog->outError("Can't set worldserver process priority class."); - sLog->outString(""); + sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class."); } } #endif @@ -250,7 +248,7 @@ int Master::Run() if (uint32 freeze_delay = ConfigMgr::GetIntDefault("MaxCoreStuckTime", 0)) { FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable(); - fdr->SetDelayTime(freeze_delay*1000); + fdr->SetDelayTime(freeze_delay * 1000); ACE_Based::Thread freeze_thread(fdr); freeze_thread.setPriority(ACE_Based::Highest); } @@ -259,9 +257,9 @@ int Master::Run() uint16 wsport = sWorld->getIntConfig(CONFIG_PORT_WORLD); std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0"); - if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str ()) == -1) + if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str()) == -1) { - sLog->outError("Failed to start network"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Failed to start network"); World::StopNow(ERROR_EXIT_CODE); // go down and shutdown the server } @@ -269,7 +267,7 @@ int Master::Run() // set server online (allow connecting now) LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); - sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon) ready...", _FULLVERSION); // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master @@ -291,7 +289,7 @@ int Master::Run() _StopDB(); - sLog->outString("Halting process..."); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Halting process..."); if (cliThread) { @@ -356,21 +354,20 @@ bool Master::_StartDB() { MySQL::Library_Init(); - sLog->SetLogDB(false); std::string dbstring; uint8 async_threads, synch_threads; dbstring = ConfigMgr::GetStringDefault("WorldDatabaseInfo", ""); if (dbstring.empty()) { - sLog->outError("World database not specified in configuration file"); + sLog->outError(LOG_FILTER_WORLDSERVER, "World database not specified in configuration file"); return false; } async_threads = ConfigMgr::GetIntDefault("WorldDatabase.WorkerThreads", 1); if (async_threads < 1 || async_threads > 32) { - sLog->outError("World database: invalid number of worker threads specified. " + sLog->outError(LOG_FILTER_WORLDSERVER, "World database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -379,7 +376,7 @@ bool Master::_StartDB() ///- Initialise the world database if (!WorldDatabase.Open(dbstring, async_threads, synch_threads)) { - sLog->outError("Cannot connect to world database %s", dbstring.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to world database %s", dbstring.c_str()); return false; } @@ -387,14 +384,14 @@ bool Master::_StartDB() dbstring = ConfigMgr::GetStringDefault("CharacterDatabaseInfo", ""); if (dbstring.empty()) { - sLog->outError("Character database not specified in configuration file"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Character database not specified in configuration file"); return false; } async_threads = ConfigMgr::GetIntDefault("CharacterDatabase.WorkerThreads", 1); if (async_threads < 1 || async_threads > 32) { - sLog->outError("Character database: invalid number of worker threads specified. " + sLog->outError(LOG_FILTER_WORLDSERVER, "Character database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -404,7 +401,7 @@ bool Master::_StartDB() ///- Initialise the Character database if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads)) { - sLog->outError("Cannot connect to Character database %s", dbstring.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to Character database %s", dbstring.c_str()); return false; } @@ -412,14 +409,14 @@ bool Master::_StartDB() dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", ""); if (dbstring.empty()) { - sLog->outError("Login database not specified in configuration file"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Login database not specified in configuration file"); return false; } async_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1); if (async_threads < 1 || async_threads > 32) { - sLog->outError("Login database: invalid number of worker threads specified. " + sLog->outError(LOG_FILTER_WORLDSERVER, "Login database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -428,7 +425,7 @@ bool Master::_StartDB() ///- Initialise the login database if (!LoginDatabase.Open(dbstring, async_threads, synch_threads)) { - sLog->outError("Cannot connect to login database %s", dbstring.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to login database %s", dbstring.c_str()); return false; } @@ -436,14 +433,11 @@ bool Master::_StartDB() realmID = ConfigMgr::GetIntDefault("RealmID", 0); if (!realmID) { - sLog->outError("Realm ID not defined in configuration file"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Realm ID not defined in configuration file"); return false; } - sLog->outString("Realm running as realm ID %d", realmID); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Realm running as realm ID %d", realmID); - ///- Initialize the DB logging system - sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished. - sLog->SetLogDB(false); sLog->SetRealmID(realmID); ///- Clean the database before starting @@ -454,7 +448,7 @@ bool Master::_StartDB() sWorld->LoadDBVersion(); - sLog->outString("Using World DB: %s", sWorld->GetDBVersion()); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using World DB: %s", sWorld->GetDBVersion()); return true; } diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp index 3f5d7bde736..7a1fff51afd 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp @@ -67,11 +67,11 @@ void RARunnable::run() if (acceptor.open(listen_addr, m_Reactor) == -1) { - sLog->outError("Trinity RA can not bind to port %d on %s", raport, stringip.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Trinity RA can not bind to port %d on %s", raport, stringip.c_str()); return; } - sLog->outString("Starting Trinity RA on port %d on %s", raport, stringip.c_str()); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Starting Trinity RA on port %d on %s", raport, stringip.c_str()); while (!World::IsStopped()) { @@ -82,5 +82,5 @@ void RARunnable::run() break; } - sLog->outStaticDebug("Trinity RA thread exiting"); + sLog->outDebug(LOG_FILTER_WORLDSERVER, "Trinity RA thread exiting"); } diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index ebc7c7624d9..18c90aa5ba5 100755 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -45,18 +45,18 @@ int RASocket::open(void *) if (peer().get_remote_addr(remote_addr) == -1) { - sLog->outError("RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); + sLog->outError(LOG_FILTER_WORLDSERVER, "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); return -1; } - sLog->outRemote("Incoming connection from %s", remote_addr.get_host_addr()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remote_addr.get_host_addr()); return activate(); } int RASocket::handle_close(ACE_HANDLE, ACE_Reactor_Mask) { - sLog->outRemote("Closing connection"); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Closing connection"); peer().close_reader(); wait(); destroy(); @@ -122,7 +122,7 @@ int RASocket::recv_line(std::string& out_line) if (recv_line(message_block) == -1) { - sLog->outRemote("Recv error %s", ACE_OS::strerror(errno)); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Recv error %s", ACE_OS::strerror(errno)); return -1; } @@ -136,7 +136,7 @@ int RASocket::process_command(const std::string& command) if (command.length() == 0) return 0; - sLog->outRemote("Got command: %s", command.c_str()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Got command: %s", command.c_str()); // handle quit, exit and logout commands to terminate connection if (command == "quit" || command == "exit" || command == "logout") { @@ -186,7 +186,7 @@ int RASocket::check_access_level(const std::string& user) if (!result) { - sLog->outRemote("User %s does not exist in database", user.c_str()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s does not exist in database", user.c_str()); return -1; } @@ -194,12 +194,12 @@ int RASocket::check_access_level(const std::string& user) if (fields[1].GetUInt8() < _minLevel) { - sLog->outRemote("User %s has no privilege to login", user.c_str()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s has no privilege to login", user.c_str()); return -1; } else if (fields[2].GetInt32() != -1) { - sLog->outRemote("User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); return -1; } @@ -225,7 +225,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass) if (!result) { - sLog->outRemote("Wrong password for user: %s", user.c_str()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Wrong password for user: %s", user.c_str()); return -1; } @@ -248,7 +248,7 @@ int RASocket::authenticate() if (recv_line(pass) == -1) return -1; - sLog->outRemote("Login attempt for user: %s", user.c_str()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Login attempt for user: %s", user.c_str()); if (check_access_level(user) == -1) return -1; @@ -256,7 +256,7 @@ int RASocket::authenticate() if (check_password(user, pass) == -1) return -1; - sLog->outRemote("User login: %s", user.c_str()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User login: %s", user.c_str()); return 0; } @@ -290,7 +290,7 @@ int RASocket::subnegotiate() if (n >= 1024) { - sLog->outRemote("RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); return -1; } @@ -324,7 +324,7 @@ int RASocket::subnegotiate() uint8 param = buf[++i]; ss << uint32(param); - sLog->outRemote(ss.str().c_str()); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, ss.str().c_str()); } ++i; } @@ -385,7 +385,7 @@ void RASocket::zprint(void* callbackArg, const char * szText) if (socket->putq(mb, const_cast(&ACE_Time_Value::zero)) == -1) { - sLog->outRemote("Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); mb->release(); } } @@ -406,7 +406,7 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/) if (socket->putq(mb) == -1) { // getting here is bad, command can't be marked as complete - sLog->outRemote("Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); + sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); mb->release(); } } diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index 26b28b25fbb..3ce4d4f59cb 100755 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -32,11 +32,11 @@ void TCSoapRunnable::run() soap.send_timeout = 5; if (!soap_valid_socket(soap_bind(&soap, m_host.c_str(), m_port, 100))) { - sLog->outError("TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port); + sLog->outError(LOG_FILTER_WORLDSERVER, "TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port); exit(-1); } - sLog->outString("TCSoap: bound to http://%s:%d", m_host.c_str(), m_port); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "TCSoap: bound to http://%s:%d", m_host.c_str(), m_port); while (!World::IsStopped()) { @@ -119,7 +119,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) int acc = connection.pendingCommands.acquire(); if (acc) { - sLog->outError("TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno); + sLog->outError(LOG_FILTER_WORLDSERVER, "TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno); } // alright, command finished diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index cc4c4a555c2..01dbd5eaf2d 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -404,317 +404,175 @@ PersistentCharacterCleanFlags = 0 PidFile = "" # -# LogLevel -# Description: Server console level of logging -# Default: 1 - (Basic) -# 0 - (Minimum) -# 2 - (Detail) -# 3 - (Full/Debug) - -LogLevel = 1 - -# -# LogFile -# Description: Log file for main server log. -# Default: "Server.log" - (Enabled) -# "" - (Disabled) - -LogFile = "Server.log" - -# -# LogTimestamp -# Description: Append timestamp to the server log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogTimestamp = 0 - -# -# LogFileLevel -# Description: Server file level of logging -# Default: 0 - (Minimum) -# 1 - (Basic) -# 2 - (Detail) -# 3 - (Full/Debug) - -LogFileLevel = 0 - -# -# Debug Log Mask -# Description: Bitmask that determines which debug log output (level 3) -# will be logged. -# Possible flags: -# 1 - Anything related to units that doesn't fit in other -# categories. -# 2 - Anything related to pets. -# 4 - Anything related to vehicles. -# 8 - Anything related to C++ AI, instance scripts, etc. -# 16 - Anything related to DB AI, such as SAI, EAI, CreatureAI -# 32 - Anything related to DB map scripts -# 64 - Anything related to network input/output, -# such as packet handlers and netcode logs -# 128 - Anything related to the spellsystem and aurasystem -# 256 - Anything related to the achievement system -# 512 - Anything related to the condition system -# 1024 - Anything related to the pool system -# 2048 - Anything related to the auction house -# 4096 - Anything related to arena's and battlegrounds -# 8192 - Anything related to outdoor PVP -# 16384 - Anything related to the chat system -# 32768 - Anything related to the LFG system -# 65536 - Anything related to maps, instances (not scripts), -# grids, cells, visibility, etc. -# 131072 - Anything related to player loading from DB -# (Player::_LoadXXX functions) -# 262144 - Anything related to items -# 524288 - Anything related to player skills -# (do not confuse with spells) -# 1048576 - Anything related to loot -# 2097152 - Anything related to guilds -# 4194304 - Anything related to transports -# 8388608 - Anything related to Warden anti cheat -# -# Simply add the values together to create a bitmask. -# For more info see enum DebugLogFilters in Log.h -# -# Default: 0 (nothing) - -DebugLogMask = 0 - -# -# PacketLogFile -# Description: Binary packet logging file for the world server. -# Filename extension must be .bin to be parsable with WowPacketParser. -# Example: "World.bin" - (Enabled) -# Default: "" - (Disabled) - -PacketLogFile = "" - -# -# DBErrorLogFile -# Description: Log file for database errors. -# Default: "DBErrors.log" - (Enabled) -# "" - (Disabled) - -DBErrorLogFile = "DBErrors.log" - -# -# CharLogFile -# Description: Log file for character operations -# Default: "Char.log" - (Enabled) -# "" - (Disabled) - -CharLogFile = "Char.log" - -# -# CharLogTimestamp -# Description: Append timestamp to the character log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# Default: 0 - (Disabled) -# 1 - (Enabled) - -CharLogTimestamp = 0 - -# -# CharLogDump -# Description: Write a character dump in the CharLogFile before deleting it. -# For restoration, copy character data from log file starting from -# line == START DUMP == to line == END DUMP == (exclusive) -# and load it using the "pdump load" command. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -CharLogDump = 0 - -# -# CharLogDump.Separate -# Description: Write character dump to separate files files rather than adding it to the -# CharLogFile. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -CharLogDump.Separate = 0 - -# -# CharLogDump.SeparateDir -# Description: Write dump files into the sub folder within the log folder. -# Example: "chardumps" - (Enabled) -# Default: "" - (Disabled) - -CharLogDump.SeparateDir = "" - -# -# GmLogFile -# Description: Log file for gamemaster commands. -# Default: "GM.log" - (Enabled) -# "" - (Disabled) - -GmLogFile = "GM.log" - -# -# GmLogTimestamp -# Description: Append timestamp to the gamemaster log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# Default: 0 - (Disabled) -# 1 - (Enabled) - -GmLogTimestamp = 0 - -# -# GmLogPerAccount -# Description: Create a log file per gamemaster account. -# Important: Logs not created if GmLogFile is not set. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -GmLogPerAccount = 0 - -# -# RaLogFile -# Description: Log file for Remote Access commands. -# Default: "RA.log" - (Enabled) -# "" - (Disabled) - -RaLogFile = "RA.log" - -# -# ArenaLogFile -# Description: Log file for arena fights and arena team creations. -# Example: "Arena.log" - (Enabled) -# Default: "" - (Disabled) - -ArenaLogFile = "" - -# -# ArenaLog.ExtendedInfo -# Description: Include extended info to ArenaLogFile for each player after rated arena -# matches (guid, name, team, IP, healing/damage done, killing blows). -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ArenaLog.ExtendedInfo = 0 - -# -# SQLDeveloperLogFile -# Description: Log file for core-generated SQL queries/dumps -# Example: "SQLDev.log" - (Enabled) -# Default: "" - (Disabled) - -SQLDeveloperLogFile = "" - -# -# SQLDriverLogFile -# Description: Log file for SQL driver events. -# Example: "SQLDriver.log" - (Enabled) -# Default: "" - (Disabled) - -SQLDriverLogFile = "" - -# -# SQLDriverQueryLogging -# Description: Log SQL queries to the SQLDriverLogFile and console. -# Default: 0 - (Disabled, Query errors only) -# 1 - (Enabled, Full query logging - may have performance impact) - -SQLDriverQueryLogging = 0 - -# -# LogColors -# Description: Colors for log messages (Format: "normal basic detail debug"). -# Colors: 0 - Black -# 1 - Red -# 2 - Green -# 3 - Brown -# 4 - Blue -# 5 - Magenta -# 6 - Cyan -# 7 - Grey -# 8 - Yellow -# 9 - Lred -# 10 - Lgreen -# 11 - Lblue -# 12 - Lmagenta -# 13 - Lcyan -# 14 - White -# Example: "13 11 9 5" - (Enabled) -# Default: "" - (Disabled) - -LogColors = "" - -# -# EnableLogDB -# Description: Write log messages to database (LogDatabaseInfo). -# Default: 0 - (Disabled) -# 1 - (Enabled) - -EnableLogDB = 0 - -# -# DBLogLevel -# Description: Log level of databases logging. -# Default: 2 - (Detail) -# 0 - (Minimum) -# 1 - (Basic) -# 3 - (Full/Debug) - -DBLogLevel = 2 - -# -# LogDB.Char -# Description: Log character operations to database. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogDB.Char = 0 - -# -# LogDB.GM -# Description: Log gamemaster commands to database. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogDB.GM = 0 - -# -# LogDB.RA -# Description: Log remote access events to database. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogDB.RA = 0 - -# -# LogDB.World -# Description: Log world server packets to database. -# Default: 0 - (Disabled) -# 1 - (Enabled, May have performance impact) - -LogDB.World = 0 - -# -# LogDB.Chat -# Description: Log chat messages to database. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogDB.Chat = 0 - - -# ChatLogFile -# Description: Log file for chat logs. -# Default: "Chat.log" - (Enabled) -# "" - (Disabled) - -ChatLogFile = "Chat.log" - -# ChatLogTimestamp -# Description: Append timestamp to the chat log file name. +# Appender config values: Given a appender "name" the following options +# can be read: +# +# Appender.name.Type +# Description: Type of appender. Extra appender config options +# will be read depending on this value +# Default: 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# Appender.name.Level +# Description: Appender level of logging +# Default: 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Appender.name.Colors +# Description: Colors for log messages +# (Format: "fatal error warn info debug trace"). +# (Only used with Type = 1) +# Default: "" - no colors +# Colors: 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# Appender.name.File +# Description: Name of the file +# Allows to use one "%u" to create dynamic files +# (Only used with Type = 2) +# +# Appender.name.Mode +# Description: Mode to open the file +# (Only used with Type = 2) +# Default: a - (Append) +# w - (Overwrite) +# +# Appender.name.Backup +# Description: Make a backup of existing file before overwrite +# (Only used with Mode = w) +# Default: 0 - false +# 1 - true +# +# Appender.name.Timestamp +# Description: Append timestamp to the log file name. # Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogTimestamp = 0 +# (Only used with Type = 2) +# +# Logger config values: Given a logger "name" the following options +# can be read: +# +# Logger.name.Type +# Description: Type of logger. Logs anything related to... +# If no logger with type = 0 exists core will create +# it but disabled. Logger with type = 0 is the +# default one, used when there is no other specific +# logger configured for other logger types +# Default: 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 1 - Units that doesn't fit in other categories +# 2 - Pets +# 3 - Vehicles +# 4 - C++ AI, instance scripts, etc. +# 5 - DB AI, such as SAI, EAI, CreatureAI +# 6 - DB map scripts +# 7 - Network input/output, +# such as packet handlers and netcode logs +# 8 - Spellsystem and aurasystem +# 9 - Achievement system +# 10 - Condition system +# 11 - Pool system +# 12 - Auction house +# 13 - Arena's and battlegrounds +# 14 - Outdoor PVP +# 15 - Chat system +# 16 - LFG system +# 17 - Maps, instances (not scripts), +# grids, cells, visibility, etc. +# 18 - Player that doesn't fit in other categories. +# 19 - Player loading from DB +# (Player::_LoadXXX functions) +# 20 - Items +# 21 - Player skills (do not confuse with spells) +# 22 - Player chat logs +# 23 - loot +# 24 - guilds +# 25 - transports +# 26 - SQL. DB errors and SQL Driver +# 27 - GM Commands +# 28 - Remote Access Commands +# 29 - Warden +# 30 - Authserver +# 31 - Worldserver +# 32 - Game Events +# 33 - Calendar +# +# Logger.name.Level +# Description: Logger level of logging +# Default: 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Logger.name.Appenders +# Description: List of appenders linked to logger +# (Using spaces as separator). + +# +# Appenders +# Description: List of Appenders to read from config +# (Using spaces as separator). +# Default: "Console Server" +# +# Loggers +# Description: List of Loggers to read from config +# (Using spaces as separator). +# Default: "root" + +Loggers=root GM SQL +Appenders=Console Server GM SQL + +Appender.Console.Type=1 +Appender.Console.Level=2 + +Appender.Server.Type=2 +Appender.Server.Level=2 +Appender.Server.File=Server.log +Appender.Server.Mode=w + +Appender.GM.Type=2 +Appender.GM.Level=2 +Appender.GM.File=gm_#%u.log + +Appender.SQL.Type=2 +Appender.SQL.Level=2 +Appender.SQL.File=SQL.log + +Logger.root.Type=0 +Logger.root.Level=3 +Logger.root.Appenders=Console Server + +Logger.SQL.Type=26 +Logger.SQL.Level=3 +Logger.SQL.Appenders=Console Server SQL + +Logger.GM.Type=27 +Logger.GM.Level=3 +Logger.GM.Appenders=Console Server GM # # ChatLogs.Channel -- cgit v1.2.3 From 634776e0bcc90e610a3f736e8ddf75792ad9b73e Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 3 Aug 2012 15:54:54 +0200 Subject: Fix compile under windows --- src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 6 +- src/server/game/Achievements/AchievementMgr.cpp | 24 +- src/server/game/Addons/AddonMgr.cpp | 4 +- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 12 +- src/server/game/Battlegrounds/ArenaTeamMgr.cpp | 4 +- src/server/game/Battlegrounds/BattlegroundMgr.cpp | 10 +- .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 2 +- src/server/game/Conditions/ConditionMgr.cpp | 4 +- src/server/game/Conditions/DisableMgr.cpp | 8 +- src/server/game/DataStores/DBCStores.cpp | 2 +- src/server/game/DungeonFinding/LFGMgr.cpp | 4 +- .../game/Entities/Creature/CreatureGroups.cpp | 4 +- .../game/Entities/Item/ItemEnchantmentMgr.cpp | 4 +- src/server/game/Entities/Transport/Transport.cpp | 8 +- src/server/game/Events/GameEventMgr.cpp | 66 ++--- src/server/game/Globals/ObjectMgr.cpp | 268 ++++++++++----------- src/server/game/Groups/GroupMgr.cpp | 12 +- src/server/game/Guilds/GuildMgr.cpp | 34 +-- src/server/game/Instances/InstanceSaveMgr.cpp | 2 +- src/server/game/Loot/LootMgr.cpp | 24 +- .../game/Movement/Waypoints/WaypointManager.cpp | 4 +- src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp | 4 +- src/server/game/Scripting/ScriptMgr.cpp | 2 +- src/server/game/Scripting/ScriptSystem.cpp | 14 +- src/server/game/Skills/SkillDiscovery.cpp | 4 +- src/server/game/Skills/SkillExtraItems.cpp | 4 +- src/server/game/Spells/SpellMgr.cpp | 74 +++--- src/server/game/Texts/CreatureTextMgr.cpp | 6 +- src/server/game/Tickets/TicketMgr.cpp | 6 +- src/server/game/Tools/CharacterDatabaseCleaner.cpp | 2 +- src/server/game/Warden/WardenCheckMgr.cpp | 12 +- src/server/game/Weather/WeatherMgr.cpp | 4 +- src/server/game/World/World.cpp | 14 +- src/server/shared/AutoPtr.h | 2 +- src/server/shared/Database/MySQLConnection.cpp | 2 +- src/server/shared/Logging/Appender.h | 2 +- src/server/shared/Packets/ByteBuffer.h | 8 +- 38 files changed, 334 insertions(+), 334 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 2d7c64bf5df..7289a4eed28 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -209,7 +209,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id); continue; } - + // Only on the first script if (cInfo->AIName != "EventAI" && m_CreatureEventAI_Event_Map[creature_id].empty()) sLog->outError(LOG_FILTER_SQL, "Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 1723e96a08a..7a997609b5d 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -51,7 +51,7 @@ void SmartWaypointMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); - + return; } @@ -89,7 +89,7 @@ void SmartWaypointMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); - + } SmartWaypointMgr::~SmartWaypointMgr() @@ -118,7 +118,7 @@ void SmartAIMgr::LoadSmartAIFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); - + return; } diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index be4ce974f70..191d91b61a7 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2202,7 +2202,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() if (sAchievementCriteriaStore.GetNumRows() == 0) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement criteria."); - + return; } @@ -2220,7 +2220,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() } sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadAchievementReferenceList() @@ -2230,7 +2230,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (sAchievementStore.GetNumRows() == 0) { sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement references."); - + return; } @@ -2251,7 +2251,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() const_cast(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar) sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadAchievementCriteriaData() @@ -2265,7 +2265,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!result) { sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); - + return; } @@ -2397,7 +2397,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() } sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadCompletedAchievements() @@ -2409,7 +2409,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() if (!result) { sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty."); - + return; } @@ -2437,7 +2437,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadRewards() @@ -2452,7 +2452,7 @@ void AchievementGlobalMgr::LoadRewards() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); - + return; } @@ -2544,7 +2544,7 @@ void AchievementGlobalMgr::LoadRewards() while (result->NextRow()); sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadRewardLocales() @@ -2560,7 +2560,7 @@ void AchievementGlobalMgr::LoadRewardLocales() if (!result) { sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); - + return; } @@ -2587,5 +2587,5 @@ void AchievementGlobalMgr::LoadRewardLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 2d1d02cf5d1..6af87827917 100755 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -44,7 +44,7 @@ void LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 known addons. DB table `addons` is empty!"); - + return; } @@ -64,7 +64,7 @@ void LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SaveAddon(AddonInfo const& addon) diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 57ab63cdd16..ab08262a928 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -264,7 +264,7 @@ void AuctionHouseMgr::LoadAuctionItems() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); - + return; } @@ -297,7 +297,7 @@ void AuctionHouseMgr::LoadAuctionItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AuctionHouseMgr::LoadAuctions() @@ -310,7 +310,7 @@ void AuctionHouseMgr::LoadAuctions() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); - + return; } @@ -336,7 +336,7 @@ void AuctionHouseMgr::LoadAuctions() CharacterDatabase.CommitTransaction(trans); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AuctionHouseMgr::AddAItem(Item* it) @@ -735,7 +735,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() if (!expAuctions) { sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired auctions to delete"); - + return; } @@ -783,7 +783,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() } while (expAuctions->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index a36be0e7749..665742c97b1 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -102,7 +102,7 @@ void ArenaTeamMgr::LoadArenaTeams() if (!result) { sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); - + return; } @@ -133,7 +133,7 @@ void ArenaTeamMgr::LoadArenaTeams() while (result->NextRow()); sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ArenaTeamMgr::DistributeArenaPoints() diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index b2615d3e54c..290da0bb31f 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -684,7 +684,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); - + return; } @@ -772,7 +772,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } data.StartMaxDist = fields[9].GetFloat(); - + selectionWeight = fields[10].GetUInt8(); data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString()); data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()]; @@ -793,7 +793,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void BattlegroundMgr::InitAutomaticArenaPointDistribution() @@ -1078,7 +1078,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() if (!result) { sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); - + return; } @@ -1103,7 +1103,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() while (result->NextRow()); sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 561cac54025..769df5445c7 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -245,6 +245,6 @@ void BattlegroundRV::TogglePillarCollision() gob->SendUpdateToPlayer(player); } } - + SetPillarCollision(!apply); } \ No newline at end of file diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index e6acefcce48..67ba643dd97 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -713,7 +713,7 @@ void ConditionMgr::LoadConditions(bool isReload) if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!"); - + return; } @@ -927,7 +927,7 @@ void ConditionMgr::LoadConditions(bool isReload) while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot) diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index 99a492a224e..6215cf5bb75 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -60,7 +60,7 @@ void LoadDisables() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 disables. DB table `disables` is empty!"); - + return; } @@ -229,7 +229,7 @@ void LoadDisables() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); - + } void CheckQuestDisables() @@ -240,7 +240,7 @@ void CheckQuestDisables() if (!count) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked 0 quest disables."); - + return; } @@ -260,7 +260,7 @@ void CheckQuestDisables() } sLog->outInfo(LOG_FILTER_GENERAL, ">> 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 abf385b1463..48ceda2a212 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -637,7 +637,7 @@ void LoadDBCStores(const std::string& dataPath) } sLog->outInfo(LOG_FILTER_GENERAL, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); - + } SimpleFactionsList const* GetFactionTeamList(uint32 faction) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 05385361e1b..3a2a044ca3b 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -136,7 +136,7 @@ void LFGMgr::LoadRewards() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); - + return; } @@ -184,7 +184,7 @@ void LFGMgr::LoadRewards() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_LFG, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void LFGMgr::Update(uint32 diff) diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 6468e611b13..21ed1a23828 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -85,7 +85,7 @@ void FormationMgr::LoadCreatureFormations() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); - + return; } @@ -137,7 +137,7 @@ void FormationMgr::LoadCreatureFormations() while (result->NextRow()); sLog->outInfo(LOG_FILTER_UNITS, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void CreatureGroup::AddMember(Creature* member) diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index c6ed8a2925a..0478173b96e 100755 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -71,12 +71,12 @@ void LoadRandomEnchantmentsTable() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } else { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); - + } } diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 238b6e9cd5a..52d5c9114ff 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -36,7 +36,7 @@ void MapManager::LoadTransports() if (!result) { sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transports. DB table `transports` is empty!"); - + return; } @@ -122,7 +122,7 @@ void MapManager::LoadTransports() } sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void MapManager::LoadTransportNPCs() @@ -135,7 +135,7 @@ void MapManager::LoadTransportNPCs() if (!result) { sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!"); - + return; } @@ -167,7 +167,7 @@ void MapManager::LoadTransportNPCs() while (result->NextRow()); sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0), diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index e1141f785e1..afbae063e5e 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -211,7 +211,7 @@ void GameEventMgr::LoadFromDB() { mGameEvent.clear(); sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 game events. DB table `game_event` is empty."); - + return; } @@ -261,7 +261,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Saves Data..."); @@ -274,7 +274,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); - + } else { @@ -307,7 +307,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -320,7 +320,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); - + } else { @@ -358,7 +358,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -373,7 +373,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); - + } else { @@ -401,7 +401,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -416,7 +416,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); - + } else { @@ -444,7 +444,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -459,7 +459,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); - + } else { @@ -501,7 +501,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -515,7 +515,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); - + } else { @@ -542,7 +542,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -556,7 +556,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); - + } else { @@ -583,7 +583,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -597,7 +597,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); - + } else { @@ -626,7 +626,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -640,7 +640,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); - + } else { @@ -668,7 +668,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -682,7 +682,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); - + } else { @@ -716,7 +716,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -730,7 +730,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); - + } else { @@ -756,7 +756,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -770,7 +770,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); - + } else { @@ -800,7 +800,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -814,7 +814,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); - + } else { @@ -866,7 +866,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -880,7 +880,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty."); - + } else { @@ -904,7 +904,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -919,7 +919,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); - + } else { @@ -953,7 +953,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } } @@ -1030,7 +1030,7 @@ void GameEventMgr::StartArenaSeason() StartEvent(eventId, true); sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Arena Season %u started...", season); - + } uint32 GameEventMgr::Update() // return the next event delay in ms diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 9cbf9ed1ee2..fc4386633ff 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -297,7 +297,7 @@ void ObjectMgr::LoadCreatureLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGossipMenuItemsLocales() @@ -334,7 +334,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPointOfInterestLocales() @@ -361,7 +361,7 @@ void ObjectMgr::LoadPointOfInterestLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadCreatureTemplates() @@ -389,7 +389,7 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); - + return; } @@ -492,7 +492,7 @@ void ObjectMgr::LoadCreatureTemplates() CheckCreatureTemplate(&itr->second); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadCreatureTemplateAddons() @@ -505,7 +505,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); - + return; } @@ -564,7 +564,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) @@ -882,7 +882,7 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); - + return; } @@ -948,7 +948,7 @@ void ObjectMgr::LoadCreatureAddons() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) @@ -987,7 +987,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); - + return; } @@ -1040,7 +1040,7 @@ void ObjectMgr::LoadEquipmentTemplates() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) @@ -1118,7 +1118,7 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); - + return; } @@ -1163,7 +1163,7 @@ void ObjectMgr::LoadCreatureModelInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadLinkedRespawn() @@ -1177,7 +1177,7 @@ void ObjectMgr::LoadLinkedRespawn() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); - + return; } @@ -1349,7 +1349,7 @@ void ObjectMgr::LoadLinkedRespawn() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); - + } bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) @@ -1409,7 +1409,7 @@ void ObjectMgr::LoadCreatures() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures. DB table `creature` is empty."); - + return; } @@ -1536,7 +1536,7 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) @@ -1719,7 +1719,7 @@ void ObjectMgr::LoadGameobjects() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty."); - + return; } @@ -1841,7 +1841,7 @@ void ObjectMgr::LoadGameobjects() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) @@ -2010,7 +2010,7 @@ void ObjectMgr::LoadItemLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadItemTemplates() @@ -2053,7 +2053,7 @@ void ObjectMgr::LoadItemTemplates() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item templates. DB table `item_template` is empty."); - + return; } @@ -2615,7 +2615,7 @@ void ObjectMgr::LoadItemTemplates() sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) @@ -2651,7 +2651,7 @@ void ObjectMgr::LoadItemSetNameLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadItemSetNames() @@ -2680,7 +2680,7 @@ void ObjectMgr::LoadItemSetNames() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); - + return; } @@ -2735,7 +2735,7 @@ void ObjectMgr::LoadItemSetNames() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadVehicleTemplateAccessories() @@ -2752,7 +2752,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); - + return; } @@ -2792,7 +2792,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadVehicleAccessories() @@ -2809,7 +2809,7 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + return; } @@ -2837,7 +2837,7 @@ void ObjectMgr::LoadVehicleAccessories() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPetLevelInfo() @@ -2850,7 +2850,7 @@ void ObjectMgr::LoadPetLevelInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); - + return; } @@ -2930,7 +2930,7 @@ void ObjectMgr::LoadPetLevelInfo() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const @@ -2996,7 +2996,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty."); exit(1); } @@ -3072,7 +3072,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3086,7 +3086,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); - + } else { @@ -3144,7 +3144,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3159,7 +3159,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); - + } else { @@ -3201,7 +3201,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3216,7 +3216,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); - + } else { @@ -3248,7 +3248,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3263,7 +3263,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty."); - + exit(1); } @@ -3330,7 +3330,7 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } // Loading levels data (class/race dependent) @@ -3344,7 +3344,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); - + exit(1); } @@ -3444,7 +3444,7 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } // Loading xp per level data @@ -3462,7 +3462,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); - + exit(1); } @@ -3503,7 +3503,7 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3661,7 +3661,7 @@ void ObjectMgr::LoadQuests() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quests definitions. DB table `quest_template` is empty."); - + return; } @@ -4290,7 +4290,7 @@ void ObjectMgr::LoadQuests() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadQuestLocales() @@ -4339,7 +4339,7 @@ void ObjectMgr::LoadQuestLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadScripts(ScriptsType type) @@ -4368,7 +4368,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); - + return; } @@ -4660,7 +4660,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGameObjectScripts() @@ -4805,7 +4805,7 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); - + return; } @@ -4853,7 +4853,7 @@ void ObjectMgr::LoadSpellScriptNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::ValidateSpellScripts() @@ -4863,7 +4863,7 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated 0 scripts."); - + return; } @@ -4911,7 +4911,7 @@ void ObjectMgr::ValidateSpellScripts() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPageTexts() @@ -4924,7 +4924,7 @@ void ObjectMgr::LoadPageTexts() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 page texts. DB table `page_text` is empty!"); - + return; } @@ -4954,7 +4954,7 @@ void ObjectMgr::LoadPageTexts() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } PageText const* ObjectMgr::GetPageText(uint32 pageEntry) @@ -4990,7 +4990,7 @@ void ObjectMgr::LoadPageTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadInstanceTemplate() @@ -5003,7 +5003,7 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); - + return; } @@ -5033,7 +5033,7 @@ void ObjectMgr::LoadInstanceTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) @@ -5054,7 +5054,7 @@ void ObjectMgr::LoadInstanceEncounters() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 instance encounters, table is empty!"); - + return; } @@ -5123,7 +5123,7 @@ void ObjectMgr::LoadInstanceEncounters() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const @@ -5144,7 +5144,7 @@ void ObjectMgr::LoadGossipText() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts", count); - + return; } _gossipTextStore.rehash(result->GetRowCount()); @@ -5184,7 +5184,7 @@ void ObjectMgr::LoadGossipText() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadNpcTextLocales() @@ -5227,7 +5227,7 @@ void ObjectMgr::LoadNpcTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } //not very fast function but it is called only once a day, or on starting-up @@ -5253,7 +5253,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired mails found."); - + return; // any mails need to be returned or deleted } @@ -5357,7 +5357,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadQuestAreaTriggers() @@ -5371,7 +5371,7 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); - + return; } @@ -5416,7 +5416,7 @@ void ObjectMgr::LoadQuestAreaTriggers() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadTavernAreaTriggers() @@ -5430,7 +5430,7 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); - + return; } @@ -5455,7 +5455,7 @@ void ObjectMgr::LoadTavernAreaTriggers() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadAreaTriggerScripts() @@ -5468,7 +5468,7 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); - + return; } @@ -5493,7 +5493,7 @@ void ObjectMgr::LoadAreaTriggerScripts() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team) @@ -5612,7 +5612,7 @@ void ObjectMgr::LoadGraveyardZones() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); - + return; } @@ -5659,7 +5659,7 @@ void ObjectMgr::LoadGraveyardZones() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team) @@ -5905,7 +5905,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); - + return; } @@ -5952,7 +5952,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadAccessRequirements() @@ -5966,7 +5966,7 @@ void ObjectMgr::LoadAccessRequirements() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); - + return; } @@ -6044,7 +6044,7 @@ void ObjectMgr::LoadAccessRequirements() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } /* @@ -6269,7 +6269,7 @@ void ObjectMgr::LoadGameObjectLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6346,7 +6346,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); - + return; } @@ -6516,7 +6516,7 @@ void ObjectMgr::LoadGameObjectTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadExplorationBaseXP() @@ -6528,7 +6528,7 @@ void ObjectMgr::LoadExplorationBaseXP() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); - + return; } @@ -6545,7 +6545,7 @@ void ObjectMgr::LoadExplorationBaseXP() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 ObjectMgr::GetBaseXP(uint8 level) @@ -6569,7 +6569,7 @@ void ObjectMgr::LoadPetNames() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); - + return; } @@ -6590,7 +6590,7 @@ void ObjectMgr::LoadPetNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPetNumber() @@ -6605,7 +6605,7 @@ void ObjectMgr::LoadPetNumber() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); - + } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -6639,7 +6639,7 @@ void ObjectMgr::LoadCorpses() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 corpses. DB table `corpse` is empty."); - + return; } @@ -6668,7 +6668,7 @@ void ObjectMgr::LoadCorpses() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadReputationRewardRate() @@ -6683,7 +6683,7 @@ void ObjectMgr::LoadReputationRewardRate() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!"); - + return; } @@ -6731,7 +6731,7 @@ void ObjectMgr::LoadReputationRewardRate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadReputationOnKill() @@ -6752,7 +6752,7 @@ void ObjectMgr::LoadReputationOnKill() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); - + return; } @@ -6805,7 +6805,7 @@ void ObjectMgr::LoadReputationOnKill() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadReputationSpilloverTemplate() @@ -6820,7 +6820,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded `reputation_spillover_template`, table is empty."); - + return; } @@ -6917,7 +6917,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPointsOfInterest() @@ -6934,7 +6934,7 @@ void ObjectMgr::LoadPointsOfInterest() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); - + return; } @@ -6964,7 +6964,7 @@ void ObjectMgr::LoadPointsOfInterest() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadQuestPOI() @@ -6981,7 +6981,7 @@ void ObjectMgr::LoadQuestPOI() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); - + return; } @@ -7036,7 +7036,7 @@ void ObjectMgr::LoadQuestPOI() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadNPCSpellClickSpells() @@ -7050,7 +7050,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); - + return; } @@ -7104,7 +7104,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -7154,7 +7154,7 @@ 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; } @@ -7183,7 +7183,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGameobjectQuestRelations() @@ -7253,7 +7253,7 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); - + return; } @@ -7280,7 +7280,7 @@ void ObjectMgr::LoadReservedPlayersNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool ObjectMgr::IsReservedName(const std::string& name) const @@ -7434,7 +7434,7 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GameObjects for quests"); - + return; } @@ -7483,7 +7483,7 @@ void ObjectMgr::LoadGameObjectForQuests() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value) @@ -7532,7 +7532,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); else sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 string templates. DB table `%s` is empty.", table); - + return false; } @@ -7575,7 +7575,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max else sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); - + return true; } @@ -7607,7 +7607,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); - + return; } @@ -7632,7 +7632,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names) @@ -7716,7 +7716,7 @@ void ObjectMgr::LoadGameTele() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!"); - + return; } @@ -7758,7 +7758,7 @@ void ObjectMgr::LoadGameTele() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -7857,7 +7857,7 @@ void ObjectMgr::LoadMailLevelRewards() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); - + return; } @@ -7903,7 +7903,7 @@ void ObjectMgr::LoadMailLevelRewards() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel) @@ -8000,7 +8000,7 @@ void ObjectMgr::LoadTrainerSpell() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!"); - + return; } @@ -8024,7 +8024,7 @@ void ObjectMgr::LoadTrainerSpell() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set *skip_vendors) @@ -8080,7 +8080,7 @@ void ObjectMgr::LoadVendors() QueryResult result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor ORDER BY entry, slot ASC"); if (!result) { - + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!"); return; } @@ -8115,7 +8115,7 @@ void ObjectMgr::LoadVendors() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGossipMenu() @@ -8129,7 +8129,7 @@ void ObjectMgr::LoadGossipMenu() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); - + return; } @@ -8157,7 +8157,7 @@ void ObjectMgr::LoadGossipMenu() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGossipMenuItems() @@ -8176,7 +8176,7 @@ void ObjectMgr::LoadGossipMenuItems() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); - + return; } @@ -8221,7 +8221,7 @@ void ObjectMgr::LoadGossipMenuItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/) @@ -8384,7 +8384,7 @@ void ObjectMgr::LoadScriptNames() if (!result) { - + sLog->outError(LOG_FILTER_SQL, ">> Loaded empty set of Script Names!"); return; } @@ -8400,7 +8400,7 @@ void ObjectMgr::LoadScriptNames() std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 ObjectMgr::GetScriptId(const char *name) @@ -8504,7 +8504,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); - + return; } @@ -8553,7 +8553,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadFactionChangeAchievements() @@ -8565,7 +8565,7 @@ void ObjectMgr::LoadFactionChangeAchievements() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); - + return; } @@ -8590,7 +8590,7 @@ void ObjectMgr::LoadFactionChangeAchievements() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadFactionChangeItems() @@ -8602,7 +8602,7 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); - + return; } @@ -8627,7 +8627,7 @@ void ObjectMgr::LoadFactionChangeItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadFactionChangeSpells() @@ -8639,7 +8639,7 @@ void ObjectMgr::LoadFactionChangeSpells() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); - + return; } @@ -8664,7 +8664,7 @@ void ObjectMgr::LoadFactionChangeSpells() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadFactionChangeReputations() @@ -8676,7 +8676,7 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); - + return; } @@ -8701,7 +8701,7 @@ void ObjectMgr::LoadFactionChangeReputations() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index acec13ab2c3..3a758f6df30 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -126,7 +126,7 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group definitions. DB table `groups` is empty!"); - + return; } @@ -152,7 +152,7 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group members..."); @@ -170,7 +170,7 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group members. DB table `group_member` is empty!"); - + return; } @@ -191,7 +191,7 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group instance saves..."); @@ -204,7 +204,7 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); - + return; } @@ -236,6 +236,6 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 35a217200ad..dab67c59d2a 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -106,7 +106,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild definitions. DB table `guild` is empty."); - + return; } else @@ -129,7 +129,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -147,7 +147,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); - + } else { @@ -165,7 +165,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -190,7 +190,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild members. DB table `guild_member` is empty."); - + } else { @@ -209,7 +209,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -227,7 +227,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); - + } else { @@ -245,7 +245,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -262,7 +262,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); - + } else { @@ -280,7 +280,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -298,7 +298,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); - + } else { @@ -316,7 +316,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -334,7 +334,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); - + } else { @@ -352,7 +352,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -372,7 +372,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); - + } else { @@ -390,7 +390,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -413,6 +413,6 @@ void GuildMgr::LoadGuilds() } sLog->outInfo(LOG_FILTER_GUILD, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 6e76f37c9d6..4ca7f97c02b 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -276,7 +276,7 @@ void InstanceSaveManager::LoadInstances() sInstanceSaveMgr->LoadResetTimes(); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void InstanceSaveManager::LoadResetTimes() diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index ddacf64507f..6f49a555950 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1481,7 +1481,7 @@ void LoadLootTemplates_Creature() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); - + } void LoadLootTemplates_Disenchant() @@ -1515,7 +1515,7 @@ void LoadLootTemplates_Disenchant() sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); - + } void LoadLootTemplates_Fishing() @@ -1541,7 +1541,7 @@ void LoadLootTemplates_Fishing() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); - + } void LoadLootTemplates_Gameobject() @@ -1577,7 +1577,7 @@ void LoadLootTemplates_Gameobject() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); - + } void LoadLootTemplates_Item() @@ -1603,7 +1603,7 @@ void LoadLootTemplates_Item() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); - + } void LoadLootTemplates_Milling() @@ -1634,7 +1634,7 @@ void LoadLootTemplates_Milling() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); - + } void LoadLootTemplates_Pickpocketing() @@ -1670,7 +1670,7 @@ void LoadLootTemplates_Pickpocketing() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); - + } void LoadLootTemplates_Prospecting() @@ -1701,7 +1701,7 @@ void LoadLootTemplates_Prospecting() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); - + } void LoadLootTemplates_Mail() @@ -1727,7 +1727,7 @@ void LoadLootTemplates_Mail() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); - + } void LoadLootTemplates_Skinning() @@ -1763,7 +1763,7 @@ void LoadLootTemplates_Skinning() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); - + } void LoadLootTemplates_Spell() @@ -1806,7 +1806,7 @@ void LoadLootTemplates_Spell() sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); - + } void LoadLootTemplates_Reference() @@ -1835,5 +1835,5 @@ void LoadLootTemplates_Reference() LootTemplates_Reference.ReportUnusedIds(lootIdSet); sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index a23c84b0134..214fd23fc8a 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -49,7 +49,7 @@ void WaypointMgr::Load() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); - + return; } @@ -87,7 +87,7 @@ void WaypointMgr::Load() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void WaypointMgr::ReloadPath(uint32 id) diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 3da3efe4823..5ada88cdf7a 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -47,7 +47,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); - + return; } @@ -107,7 +107,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() } sLog->outInfo(LOG_FILTER_OUTDOORPVP, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 0ce3878db96..f5adf67a9ab 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -257,7 +257,7 @@ void ScriptMgr::Initialize() AddScripts(); sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); - + } void ScriptMgr::Unload() diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 6337a358866..f24b01306c5 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -30,14 +30,14 @@ void SystemMgr::LoadScriptTexts() sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts additional data..."); uint32 oldMSTime = getMSTime(); - + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts"); if (!result) { sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); - + return; } @@ -84,7 +84,7 @@ void SystemMgr::LoadScriptTexts() while (result->NextRow()); sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); - + } void SystemMgr::LoadScriptTextsCustom() @@ -99,7 +99,7 @@ void SystemMgr::LoadScriptTextsCustom() if (!result) { sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); - + return; } @@ -146,7 +146,7 @@ void SystemMgr::LoadScriptTextsCustom() while (result->NextRow()); sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Custom Texts data.", uiCount); - + } void SystemMgr::LoadScriptWaypoints() @@ -171,7 +171,7 @@ void SystemMgr::LoadScriptWaypoints() if (!result) { sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); - + return; } @@ -207,5 +207,5 @@ void SystemMgr::LoadScriptWaypoints() while (result->NextRow()); sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 96a3538c759..d9cfbe6b69c 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -56,7 +56,7 @@ void LoadSkillDiscoveryTable() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); - + return; } @@ -154,7 +154,7 @@ void LoadSkillDiscoveryTable() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index 869f5476719..9cb4c145b3d 100755 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -61,7 +61,7 @@ void LoadSkillExtraItemTable() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); - + return; } @@ -111,7 +111,7 @@ void LoadSkillExtraItemTable() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance, uint8 &additionalMax) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 2b0e71b4dd8..3cc3a877337 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1156,7 +1156,7 @@ void SpellMgr::LoadSpellRanks() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); - + return; } @@ -1252,7 +1252,7 @@ void SpellMgr::LoadSpellRanks() } while (!finished); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellRequired() @@ -1268,7 +1268,7 @@ void SpellMgr::LoadSpellRequired() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell required records. DB table `spell_required` is empty."); - + return; } @@ -1313,7 +1313,7 @@ void SpellMgr::LoadSpellRequired() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellLearnSkills() @@ -1351,7 +1351,7 @@ void SpellMgr::LoadSpellLearnSkills() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellLearnSpells() @@ -1365,7 +1365,7 @@ void SpellMgr::LoadSpellLearnSpells() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); - + return; } @@ -1454,7 +1454,7 @@ void SpellMgr::LoadSpellLearnSpells() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellTargetPositions() @@ -1468,7 +1468,7 @@ void SpellMgr::LoadSpellTargetPositions() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); - + return; } @@ -1574,7 +1574,7 @@ void SpellMgr::LoadSpellTargetPositions() }*/ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellGroups() @@ -1589,7 +1589,7 @@ void SpellMgr::LoadSpellGroups() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); - + return; } @@ -1656,7 +1656,7 @@ void SpellMgr::LoadSpellGroups() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellGroupStackRules() @@ -1670,7 +1670,7 @@ void SpellMgr::LoadSpellGroupStackRules() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); - + return; } @@ -1701,7 +1701,7 @@ void SpellMgr::LoadSpellGroupStackRules() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellProcEvents() @@ -1715,7 +1715,7 @@ void SpellMgr::LoadSpellProcEvents() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); - + return; } @@ -1765,7 +1765,7 @@ void SpellMgr::LoadSpellProcEvents() sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); else sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellProcs() @@ -1779,7 +1779,7 @@ void SpellMgr::LoadSpellProcs() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); - + return; } @@ -1906,7 +1906,7 @@ void SpellMgr::LoadSpellProcs() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellBonusess() @@ -1920,7 +1920,7 @@ void SpellMgr::LoadSpellBonusess() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); - + return; } @@ -1947,7 +1947,7 @@ void SpellMgr::LoadSpellBonusess() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellThreats() @@ -1961,7 +1961,7 @@ void SpellMgr::LoadSpellThreats() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); - + return; } @@ -1988,7 +1988,7 @@ void SpellMgr::LoadSpellThreats() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSkillLineAbilityMap() @@ -2010,7 +2010,7 @@ void SpellMgr::LoadSkillLineAbilityMap() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellPetAuras() @@ -2024,7 +2024,7 @@ void SpellMgr::LoadSpellPetAuras() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); - + return; } @@ -2072,7 +2072,7 @@ void SpellMgr::LoadSpellPetAuras() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } // Fill custom data about enchancments @@ -2113,7 +2113,7 @@ void SpellMgr::LoadEnchantCustomAttr() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellEnchantProcData() @@ -2127,7 +2127,7 @@ void SpellMgr::LoadSpellEnchantProcData() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); - + return; } @@ -2157,7 +2157,7 @@ void SpellMgr::LoadSpellEnchantProcData() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellLinked() @@ -2171,7 +2171,7 @@ void SpellMgr::LoadSpellLinked() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); - + return; } @@ -2210,7 +2210,7 @@ void SpellMgr::LoadSpellLinked() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadPetLevelupSpellMap() @@ -2267,7 +2267,7 @@ void SpellMgr::LoadPetLevelupSpellMap() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); - + } bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells) @@ -2352,7 +2352,7 @@ void SpellMgr::LoadPetDefaultSpells() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Loading summonable creature templates..."); oldMSTime = getMSTime(); @@ -2396,7 +2396,7 @@ void SpellMgr::LoadPetDefaultSpells() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellAreas() @@ -2415,7 +2415,7 @@ void SpellMgr::LoadSpellAreas() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); - + return; } @@ -2596,7 +2596,7 @@ void SpellMgr::LoadSpellAreas() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellInfoStore() @@ -2613,7 +2613,7 @@ void SpellMgr::LoadSpellInfoStore() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::UnloadSpellInfoStore() @@ -2926,7 +2926,7 @@ void SpellMgr::LoadSpellCustomAttr() CreatureAI::FillAISpellInfo(); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadDbcDataCorrections() @@ -3570,5 +3570,5 @@ void SpellMgr::LoadDbcDataCorrections() properties->Type = SUMMON_TYPE_TOTEM; sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 32d361faa9a..f64043b7038 100755 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -78,7 +78,7 @@ void CreatureTextMgr::LoadCreatureTexts() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); - + return; } @@ -137,7 +137,7 @@ void CreatureTextMgr::LoadCreatureTexts() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); - + } void CreatureTextMgr::LoadCreatureTextLocales() @@ -167,7 +167,7 @@ void CreatureTextMgr::LoadCreatureTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid /*= 0*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, TextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/) diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index aedb27a040f..d03ffbbb1f6 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -264,7 +264,7 @@ void TicketMgr::LoadTickets() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); - + return; } @@ -291,7 +291,7 @@ void TicketMgr::LoadTickets() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void TicketMgr::LoadSurveys() @@ -304,7 +304,7 @@ void TicketMgr::LoadSurveys() _lastSurveyId = (*result)[0].GetUInt32(); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void TicketMgr::AddTicket(GmTicket* ticket) diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index 0619491f364..2bd9a157e73 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -64,7 +64,7 @@ void CharacterDatabaseCleaner::CleanDatabase() sWorld->SetCleaningFlags(flags); sLog->outInfo(LOG_FILTER_GENERAL, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32)) diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 177f373c978..f6daba76c1a 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -44,7 +44,7 @@ void WardenCheckMgr::LoadWardenChecks() if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading checks skipped."); - + return; } @@ -53,7 +53,7 @@ void WardenCheckMgr::LoadWardenChecks() if (!result) { sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); - + return; } @@ -146,7 +146,7 @@ void WardenCheckMgr::LoadWardenChecks() while (result->NextRow()); sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden checks.", count); - + } void WardenCheckMgr::LoadWardenOverrides() @@ -155,7 +155,7 @@ void WardenCheckMgr::LoadWardenOverrides() if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading check overrides skipped."); - + return; } @@ -165,7 +165,7 @@ void WardenCheckMgr::LoadWardenOverrides() if (!result) { sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); - + return; } @@ -195,7 +195,7 @@ void WardenCheckMgr::LoadWardenOverrides() while (result->NextRow()); sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden action overrides.", count); - + } WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id) diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 150e9f845ec..0e7f1c87b26 100755 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -94,7 +94,7 @@ void LoadWeatherData() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 weather definitions. DB table `game_weather` is empty."); - + return; } @@ -138,7 +138,7 @@ void LoadWeatherData() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SendFineWeatherUpdateToPlayer(Player* player) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 717cfd67ac6..3a13f48d807 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1246,7 +1246,7 @@ void World::SetInitialWorldSettings() sGameEventMgr->Initialize(); ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. - + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trinity strings..."); if (!sObjectMgr->LoadTrinityStrings()) exit(1); // Error message displayed in function already @@ -1314,7 +1314,7 @@ void World::SetInitialWorldSettings() sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) sLog->outInfo(LOG_FILTER_GENERAL, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Page Texts..."); sObjectMgr->LoadPageTexts(); @@ -1794,7 +1794,7 @@ void World::DetectDBCLang() m_defaultDbcLocale = LocaleConstant(default_locale); sLog->outInfo(LOG_FILTER_GENERAL, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); - + } void World::RecordTimeDiff(const char *text, ...) @@ -1834,7 +1834,7 @@ void World::LoadAutobroadcasts() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); - + return; } @@ -1852,7 +1852,7 @@ void World::LoadAutobroadcasts() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } /// Update the World ! @@ -2835,7 +2835,7 @@ void World::LoadWorldStates() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 world states. DB table `worldstates` is empty!"); - + return; } @@ -2850,7 +2850,7 @@ void World::LoadWorldStates() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } // Setting a worldstate will save it to DB diff --git a/src/server/shared/AutoPtr.h b/src/server/shared/AutoPtr.h index 988c46cc5a2..19f0680c267 100644 --- a/src/server/shared/AutoPtr.h +++ b/src/server/shared/AutoPtr.h @@ -27,7 +27,7 @@ namespace Trinity { public: AutoPtr() : ACE_Strong_Bound_Ptr() {} - + AutoPtr(Pointer* x) { ACE_Strong_Bound_Ptr::reset(x); diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 324efab067e..7332cb3ec01 100755 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -175,7 +175,7 @@ bool MySQLConnection::Execute(const char* sql) return false; } - else + else sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 992554d59aa..c32f51e5a88 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -2,7 +2,7 @@ #define APPENDER_H #include "Define.h" - +#include #include #include diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 6912e841bc3..045c5fd91c8 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -480,12 +480,12 @@ class ByteBuffer { if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output return; - + uint32 j = 1, k = 1; - + std::ostringstream o; o << "STORAGE_SIZE: " << size(); - + for (uint32 i = 0; i < size(); ++i) { char buf[3]; @@ -501,7 +501,7 @@ class ByteBuffer ++k; ++j; } - + o << buf; } o << " "; -- cgit v1.2.3 From 10891028279762eb14688ec07bc22dffe3b26886 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 3 Aug 2012 17:29:43 +0200 Subject: Add missing Copyright headers and some clarification to config files... ¬¬ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/authserver/authserver.conf.dist | 161 ++++++------ src/server/shared/Logging/Appender.cpp | 17 ++ src/server/shared/Logging/Appender.h | 17 ++ src/server/shared/Logging/AppenderConsole.cpp | 17 ++ src/server/shared/Logging/AppenderConsole.h | 17 ++ src/server/shared/Logging/AppenderDB.cpp | 17 ++ src/server/shared/Logging/AppenderDB.h | 17 ++ src/server/shared/Logging/AppenderFile.cpp | 17 ++ src/server/shared/Logging/AppenderFile.h | 17 ++ src/server/shared/Logging/LogOperation.cpp | 17 ++ src/server/shared/Logging/LogOperation.h | 17 ++ src/server/shared/Logging/LogWorker.cpp | 17 ++ src/server/shared/Logging/LogWorker.h | 17 ++ src/server/shared/Logging/Logger.cpp | 17 ++ src/server/shared/Logging/Logger.h | 17 ++ src/server/worldserver/worldserver.conf.dist | 347 +++++++++++++------------- 16 files changed, 497 insertions(+), 249 deletions(-) (limited to 'src') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 875d952b14c..93bbc9e3872 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -68,6 +68,89 @@ BindIP = "0.0.0.0" PidFile = "" +# +# UseProcessors +# Description: Processors mask for Windows based multi-processor systems. +# Default: 0 - (Selected by OS) +# 1+ - (Bit mask value of selected processors) + +UseProcessors = 0 + +# +# ProcessPriority +# Description: Process priority setting for Windows based systems. +# Default: 1 - (High) +# 0 - (Normal) + +ProcessPriority = 1 + +# +# RealmsStateUpdateDelay +# Description: Time (in seconds) between realm list updates. +# Default: 20 - (Enabled) +# 0 - (Disabled) + +RealmsStateUpdateDelay = 20 + +# +# WrongPass.MaxCount +# Description: Number of login attemps with wrong password before the account or IP will be +# banned. +# Default: 0 - (Disabled) +# 1+ - (Enabled) + +WrongPass.MaxCount = 0 + +# +# WrongPass.BanTime +# Description: Time (in seconds) for banning account or IP for invalid login attempts. +# Default: 600 - (10 minutes) +# 0 - (Permanent ban) + +WrongPass.BanTime = 600 + +# +# WrongPass.BanType +# Description: Ban type for invalid login attempts. +# Default: 0 - (Ban IP) +# 1 - (Ban Account) + +WrongPass.BanType = 0 + +# +################################################################################################### + +################################################################################################### +# MYSQL SETTINGS +# +# LoginDatabaseInfo +# Description: Database connection settings for the realm server. +# Example: "hostname;port;username;password;database" +# ".;somenumber;username;password;database" - (Use named pipes on Windows +# "enable-named-pipe" to [mysqld] +# section my.ini) +# ".;/path/to/unix_socket;username;password;database" - (use Unix sockets on +# Unix/Linux) +# Default: "127.0.0.1;3306;trinity;trinity;auth" + +LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" + +# +# LoginDatabase.WorkerThreads +# Description: The amount of worker threads spawned to handle asynchronous (delayed) MySQL +# statements. Each worker thread is mirrored with its own connection to the +# Default: 1 + +LoginDatabase.WorkerThreads = 1 + +# +################################################################################################### + +################################################################################################### +# +# Logging system options. +# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. +# # # Appender config values: Given a appender "name" the following options # can be read: @@ -187,81 +270,3 @@ Appender.Auth.Mode=w Logger.root.Type=0 Logger.root.Level=3 Logger.root.Appenders=Console Auth - -# -# UseProcessors -# Description: Processors mask for Windows based multi-processor systems. -# Default: 0 - (Selected by OS) -# 1+ - (Bit mask value of selected processors) - -UseProcessors = 0 - -# -# ProcessPriority -# Description: Process priority setting for Windows based systems. -# Default: 1 - (High) -# 0 - (Normal) - -ProcessPriority = 1 - -# -# RealmsStateUpdateDelay -# Description: Time (in seconds) between realm list updates. -# Default: 20 - (Enabled) -# 0 - (Disabled) - -RealmsStateUpdateDelay = 20 - -# -# WrongPass.MaxCount -# Description: Number of login attemps with wrong password before the account or IP will be -# banned. -# Default: 0 - (Disabled) -# 1+ - (Enabled) - -WrongPass.MaxCount = 0 - -# -# WrongPass.BanTime -# Description: Time (in seconds) for banning account or IP for invalid login attempts. -# Default: 600 - (10 minutes) -# 0 - (Permanent ban) - -WrongPass.BanTime = 600 - -# -# WrongPass.BanType -# Description: Ban type for invalid login attempts. -# Default: 0 - (Ban IP) -# 1 - (Ban Account) - -WrongPass.BanType = 0 - -# -################################################################################################### - -################################################################################################### -# MYSQL SETTINGS -# -# LoginDatabaseInfo -# Description: Database connection settings for the realm server. -# Example: "hostname;port;username;password;database" -# ".;somenumber;username;password;database" - (Use named pipes on Windows -# "enable-named-pipe" to [mysqld] -# section my.ini) -# ".;/path/to/unix_socket;username;password;database" - (use Unix sockets on -# Unix/Linux) -# Default: "127.0.0.1;3306;trinity;trinity;auth" - -LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" - -# -# LoginDatabase.WorkerThreads -# Description: The amount of worker threads spawned to handle asynchronous (delayed) MySQL -# statements. Each worker thread is mirrored with its own connection to the -# Default: 1 - -LoginDatabase.WorkerThreads = 1 - -# -################################################################################################### diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 38d58f1ffb5..0b92e74c1e9 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #include "Appender.h" #include "Common.h" diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index c32f51e5a88..3105f0e6bb4 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #ifndef APPENDER_H #define APPENDER_H diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp index ad81a883bfa..30c7cc4d135 100644 --- a/src/server/shared/Logging/AppenderConsole.cpp +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #include "AppenderConsole.h" #include "Config.h" #include "Util.h" diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h index a9f46cf9c4a..b81fe6dde57 100644 --- a/src/server/shared/Logging/AppenderConsole.h +++ b/src/server/shared/Logging/AppenderConsole.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #ifndef APPENDERCONSOLE_H #define APPENDERCONSOLE_H diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 6f3737adf4d..63af9176193 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #include "AppenderDB.h" /* FIXME diff --git a/src/server/shared/Logging/AppenderDB.h b/src/server/shared/Logging/AppenderDB.h index ca15fc1a1d5..4399195b181 100644 --- a/src/server/shared/Logging/AppenderDB.h +++ b/src/server/shared/Logging/AppenderDB.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #ifndef APPENDERDB_H #define APPENDERDB_H diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 30c1f271c96..93c02913aeb 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #include "AppenderFile.h" #include "Common.h" diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index a01ea947334..bbc500f9e76 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #ifndef APPENDERFILE_H #define APPENDERFILE_H diff --git a/src/server/shared/Logging/LogOperation.cpp b/src/server/shared/Logging/LogOperation.cpp index 59368e519cd..b36dd3a8b1e 100644 --- a/src/server/shared/Logging/LogOperation.cpp +++ b/src/server/shared/Logging/LogOperation.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #include "LogOperation.h" #include "Logger.h" diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h index 046ff44e62e..d872670d756 100644 --- a/src/server/shared/Logging/LogOperation.h +++ b/src/server/shared/Logging/LogOperation.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #ifndef LOGOPERATION_H #define LOGOPERATION_H diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp index 4dc71f7f878..a12faaf224c 100644 --- a/src/server/shared/Logging/LogWorker.cpp +++ b/src/server/shared/Logging/LogWorker.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #include "LogWorker.h" LogWorker::LogWorker() diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h index fe51be5376c..ea1744f9790 100644 --- a/src/server/shared/Logging/LogWorker.h +++ b/src/server/shared/Logging/LogWorker.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #ifndef LOGWORKER_H #define LOGWORKER_H diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp index 7464012c0ac..10276eb3acb 100644 --- a/src/server/shared/Logging/Logger.cpp +++ b/src/server/shared/Logging/Logger.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #include "Logger.h" Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED) diff --git a/src/server/shared/Logging/Logger.h b/src/server/shared/Logging/Logger.h index 10b3991a537..9d13f08620f 100644 --- a/src/server/shared/Logging/Logger.h +++ b/src/server/shared/Logging/Logger.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + #ifndef LOGGER_H #define LOGGER_H diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 01dbd5eaf2d..99cb415dc98 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -403,177 +403,6 @@ PersistentCharacterCleanFlags = 0 PidFile = "" -# -# Appender config values: Given a appender "name" the following options -# can be read: -# -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) -# -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# Colors: 0 - BLACK -# 1 - RED -# 2 - GREEN -# 3 - BROWN -# 4 - BLUE -# 5 - MAGENTA -# 6 - CYAN -# 7 - GREY -# 8 - YELLOW -# 9 - LRED -# 10 - LGREEN -# 11 - LBLUE -# 12 - LMAGENTA -# 13 - LCYAN -# 14 - WHITE -# Example: "13 11 9 5 3 1" -# -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) -# -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) -# -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) -# -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 1 - Units that doesn't fit in other categories -# 2 - Pets -# 3 - Vehicles -# 4 - C++ AI, instance scripts, etc. -# 5 - DB AI, such as SAI, EAI, CreatureAI -# 6 - DB map scripts -# 7 - Network input/output, -# such as packet handlers and netcode logs -# 8 - Spellsystem and aurasystem -# 9 - Achievement system -# 10 - Condition system -# 11 - Pool system -# 12 - Auction house -# 13 - Arena's and battlegrounds -# 14 - Outdoor PVP -# 15 - Chat system -# 16 - LFG system -# 17 - Maps, instances (not scripts), -# grids, cells, visibility, etc. -# 18 - Player that doesn't fit in other categories. -# 19 - Player loading from DB -# (Player::_LoadXXX functions) -# 20 - Items -# 21 - Player skills (do not confuse with spells) -# 22 - Player chat logs -# 23 - loot -# 24 - guilds -# 25 - transports -# 26 - SQL. DB errors and SQL Driver -# 27 - GM Commands -# 28 - Remote Access Commands -# 29 - Warden -# 30 - Authserver -# 31 - Worldserver -# 32 - Game Events -# 33 - Calendar -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: List of appenders linked to logger -# (Using spaces as separator). - -# -# Appenders -# Description: List of Appenders to read from config -# (Using spaces as separator). -# Default: "Console Server" -# -# Loggers -# Description: List of Loggers to read from config -# (Using spaces as separator). -# Default: "root" - -Loggers=root GM SQL -Appenders=Console Server GM SQL - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Server.Type=2 -Appender.Server.Level=2 -Appender.Server.File=Server.log -Appender.Server.Mode=w - -Appender.GM.Type=2 -Appender.GM.Level=2 -Appender.GM.File=gm_#%u.log - -Appender.SQL.Type=2 -Appender.SQL.Level=2 -Appender.SQL.File=SQL.log - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Server - -Logger.SQL.Type=26 -Logger.SQL.Level=3 -Logger.SQL.Appenders=Console Server SQL - -Logger.GM.Type=27 -Logger.GM.Level=3 -Logger.GM.Appenders=Console Server GM - # # ChatLogs.Channel # Description: Log custom channel chat. @@ -648,6 +477,7 @@ ChatLogs.Addon = 0 ChatLogs.BattleGround = 0 +# Extended Logging system configuration moved to end of file (on purpose) # ################################################################################################### @@ -2746,3 +2576,178 @@ PlayerDump.DisallowOverwrite = 1 # ################################################################################################### + +################################################################################################### +# +# Logging system options. +# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. +# +# +# Appender config values: Given a appender "name" the following options +# can be read: +# +# Appender.name.Type +# Description: Type of appender. Extra appender config options +# will be read depending on this value +# Default: 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# Appender.name.Level +# Description: Appender level of logging +# Default: 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Appender.name.Colors +# Description: Colors for log messages +# (Format: "fatal error warn info debug trace"). +# (Only used with Type = 1) +# Default: "" - no colors +# Colors: 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# Appender.name.File +# Description: Name of the file +# Allows to use one "%u" to create dynamic files +# (Only used with Type = 2) +# +# Appender.name.Mode +# Description: Mode to open the file +# (Only used with Type = 2) +# Default: a - (Append) +# w - (Overwrite) +# +# Appender.name.Backup +# Description: Make a backup of existing file before overwrite +# (Only used with Mode = w) +# Default: 0 - false +# 1 - true +# +# Appender.name.Timestamp +# Description: Append timestamp to the log file name. +# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext +# (Only used with Type = 2) +# +# Logger config values: Given a logger "name" the following options +# can be read: +# +# Logger.name.Type +# Description: Type of logger. Logs anything related to... +# If no logger with type = 0 exists core will create +# it but disabled. Logger with type = 0 is the +# default one, used when there is no other specific +# logger configured for other logger types +# Default: 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 1 - Units that doesn't fit in other categories +# 2 - Pets +# 3 - Vehicles +# 4 - C++ AI, instance scripts, etc. +# 5 - DB AI, such as SAI, EAI, CreatureAI +# 6 - DB map scripts +# 7 - Network input/output, +# such as packet handlers and netcode logs +# 8 - Spellsystem and aurasystem +# 9 - Achievement system +# 10 - Condition system +# 11 - Pool system +# 12 - Auction house +# 13 - Arena's and battlegrounds +# 14 - Outdoor PVP +# 15 - Chat system +# 16 - LFG system +# 17 - Maps, instances (not scripts), +# grids, cells, visibility, etc. +# 18 - Player that doesn't fit in other categories. +# 19 - Player loading from DB +# (Player::_LoadXXX functions) +# 20 - Items +# 21 - Player skills (do not confuse with spells) +# 22 - Player chat logs +# 23 - loot +# 24 - guilds +# 25 - transports +# 26 - SQL. DB errors and SQL Driver +# 27 - GM Commands +# 28 - Remote Access Commands +# 29 - Warden +# 30 - Authserver +# 31 - Worldserver +# 32 - Game Events +# 33 - Calendar +# +# Logger.name.Level +# Description: Logger level of logging +# Default: 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Logger.name.Appenders +# Description: List of appenders linked to logger +# (Using spaces as separator). +# +# Appenders +# Description: List of Appenders to read from config +# (Using spaces as separator). +# Default: "Console Server" +# +# Loggers +# Description: List of Loggers to read from config +# (Using spaces as separator). +# Default: "root" + +Loggers=root GM SQL +Appenders=Console Server GM SQL + +Appender.Console.Type=1 +Appender.Console.Level=2 + +Appender.Server.Type=2 +Appender.Server.Level=2 +Appender.Server.File=Server.log +Appender.Server.Mode=w + +Appender.GM.Type=2 +Appender.GM.Level=2 +Appender.GM.File=gm_#%u.log + +Appender.SQL.Type=2 +Appender.SQL.Level=2 +Appender.SQL.File=SQL.log + +Logger.root.Type=0 +Logger.root.Level=3 +Logger.root.Appenders=Console Server + +Logger.SQL.Type=26 +Logger.SQL.Level=3 +Logger.SQL.Appenders=Console Server SQL + +Logger.GM.Type=27 +Logger.GM.Level=3 +Logger.GM.Appenders=Console Server GM -- cgit v1.2.3 From f9a0821b2b3ebfea8966188526b6c5a5dda304ec Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 3 Aug 2012 22:50:02 +0100 Subject: Core/PacketIO: Correct a value sent in BuildPlayerChat (just for the sake of being correct, no noticeable changes) --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 85b807880c2..2fd80b7b843 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -19910,7 +19910,7 @@ inline void Player::BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std: *data << uint8(msgtype); *data << uint32(language); *data << uint64(GetGUID()); - *data << uint32(language); //language 2.1.0 ? + *data << uint32(0); // constant unknown time *data << uint64(GetGUID()); *data << uint32(text.length() + 1); *data << text; -- cgit v1.2.3 From d1b10082a21398b58cce3615efc0b89d303ba5f1 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 3 Aug 2012 22:55:18 +0100 Subject: Whitespace is the root of all evil (version 2) --- src/server/authserver/Main.cpp | 4 +- src/server/authserver/authserver.conf.dist | 2 +- src/server/collision/Models/GameObjectModel.cpp | 2 +- src/server/scripts/Commands/cs_cast.cpp | 2 +- src/server/scripts/Commands/cs_character.cpp | 10 +-- src/server/scripts/Commands/cs_disable.cpp | 72 +++++++++++----------- src/server/scripts/Commands/cs_guild.cpp | 2 +- src/server/scripts/Commands/cs_lookup.cpp | 8 +-- src/server/scripts/Commands/cs_reset.cpp | 2 +- .../instance_magisters_terrace.cpp | 20 +++--- src/server/scripts/EasternKingdoms/undercity.cpp | 10 +-- .../BattleForMountHyjal/hyjal_trash.cpp | 2 +- src/server/scripts/Kalimdor/ashenvale.cpp | 2 +- src/server/scripts/Kalimdor/azshara.cpp | 6 +- src/server/scripts/Kalimdor/azuremyst_isle.cpp | 4 +- src/server/scripts/Kalimdor/felwood.cpp | 4 +- .../SerpentShrine/boss_lady_vashj.cpp | 4 +- src/server/worldserver/worldserver.conf.dist | 8 +-- 18 files changed, 82 insertions(+), 82 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index b2828b3ffac..f5a3c7cf7e1 100755 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -182,7 +182,7 @@ extern int main(int argc, char **argv) else sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", curAff); } - + } bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false); @@ -193,7 +193,7 @@ extern int main(int argc, char **argv) sLog->outInfo(LOG_FILTER_AUTHSERVER, "The auth server process priority class has been set to HIGH"); else sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set auth server process priority class."); - + } } #endif diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 93bbc9e3872..d77b40e6591 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -229,7 +229,7 @@ LoginDatabase.WorkerThreads = 1 # Default: 0 - Default. Each type that has no config will # rely on this one. Core will create this logger # (disabled) if it's not configured -# 7 - Network input/output, +# 7 - Network input/output, # 30 - Authserver # # Logger.name.Level diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 63c42e25035..6045cbc4c9c 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -84,7 +84,7 @@ void LoadGameObjectModelList() fclose(model_list_file); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); - + } GameObjectModel::~GameObjectModel() diff --git a/src/server/scripts/Commands/cs_cast.cpp b/src/server/scripts/Commands/cs_cast.cpp index 33983411427..70cfb8cb830 100644 --- a/src/server/scripts/Commands/cs_cast.cpp +++ b/src/server/scripts/Commands/cs_cast.cpp @@ -33,7 +33,7 @@ public: ChatCommand* GetCommands() const { static ChatCommand castCommandTable[] = - { + { { "back", SEC_ADMINISTRATOR, false, &HandleCastBackCommand, "", NULL }, { "dist", SEC_ADMINISTRATOR, false, &HandleCastDistCommand, "", NULL }, { "self", SEC_ADMINISTRATOR, false, &HandleCastSelfCommand, "", NULL }, diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 0aeee8f96fc..f5fbfa33cae 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -70,7 +70,7 @@ public: { "levelup", SEC_ADMINISTRATOR, false, &HandleLevelUpCommand, "", NULL }, { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { NULL, 0, false, NULL, "", NULL } - }; + }; return commandTable; } @@ -112,14 +112,14 @@ public: if (!normalizePlayerName(searchString)) return false; - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME); - stmt->setString(0, searchString); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME); + stmt->setString(0, searchString); result = CharacterDatabase.Query(stmt); } } else { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO); result = CharacterDatabase.Query(stmt); } @@ -137,7 +137,7 @@ public: // account name will be empty for not existed account AccountMgr::GetName(info.accountId, info.accountName); - info.deleteDate = time_t(fields[3].GetUInt32()); + info.deleteDate = time_t(fields[3].GetUInt32()); foundList.push_back(info); } while (result->NextRow()); diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index c537f9a972b..e7f33885036 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -14,27 +14,27 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ - + /* ScriptData Name: disable_commandscript %Complete: 100 Comment: All disable related commands Category: commandscripts EndScriptData */ - + #include "ScriptMgr.h" #include "ObjectMgr.h" #include "Chat.h" #include "DisableMgr.h" - + class disable_commandscript : public CommandScript { public: disable_commandscript() : CommandScript("disable_commandscript") { } - + ChatCommand* GetCommands() const { - + static ChatCommand disableCommandTable[] = { { "spell", SEC_GAMEMASTER, false, &HandleDisableSpellCommand, "", NULL }, @@ -45,7 +45,7 @@ public: { "vmap", SEC_GAMEMASTER, false, &HandleDisableVmapCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - + static ChatCommand commandTable[] = { { "disable", SEC_GAMEMASTER, false, NULL, "", disableCommandTable }, @@ -53,8 +53,8 @@ public: }; return commandTable; } - - + + static void HandleDisables(ChatHandler* handler, char const* args, uint8 disableType) { char* cEntry = strtok((char*)args, " "); @@ -63,30 +63,30 @@ public: handler->SendSysMessage("No entry specified."); return; } - + char* cFlags = strtok(NULL, " "); if (!cFlags || !atoi(cFlags)) { handler->SendSysMessage("No flags specified."); return; } - + char* cComment = strtok(NULL, ""); if (!cComment) { handler->SendSysMessage("No comment specified."); return; } - + std::string entryStr = cEntry; std::string disableComment = cComment; uint32 entry = (uint32)atoi(cEntry); uint8 flags = atoi(cFlags); - - - + + + std::string disableTypeStr = ""; - + switch (disableType) { case DISABLE_TYPE_SPELL: @@ -108,87 +108,87 @@ public: disableTypeStr = "vmap"; break; } - + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); - stmt->setUInt8(1, disableType); + stmt->setUInt8(1, disableType); PreparedQueryResult result = WorldDatabase.Query(stmt); - - + + if (result) { handler->PSendSysMessage("This %s (id %u) is already disabled.", disableTypeStr.c_str(), entry); return; } - + PreparedStatement* stmt2 = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES); stmt2->setUInt32(0, entry); stmt2->setUInt8(1, disableType); stmt2->setUInt16(2, flags); stmt2->setString(3, disableComment); WorldDatabase.Execute(stmt2); - + handler->PSendSysMessage("Disabled %s %u for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str()); return; - + } - + static bool HandleDisableSpellCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - + HandleDisables(handler, args, DISABLE_TYPE_SPELL); return true; } - + static bool HandleDisableMapCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - + HandleDisables(handler, args, DISABLE_TYPE_MAP); return true; } - + static bool HandleDisableBattlegroundCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - + HandleDisables(handler, args, DISABLE_TYPE_BATTLEGROUND); return true; } - + static bool HandleDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - + HandleDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA); return true; } - + static bool HandleDisableOutdoorPvPCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - + HandleDisables(handler, args, DISABLE_TYPE_OUTDOORPVP); return true; } - + static bool HandleDisableVmapCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - + HandleDisables(handler, args, DISABLE_TYPE_VMAP); return true; } - + }; - + void AddSC_disable_commandscript() { new disable_commandscript(); diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp index 65e3daaaebc..a453122aef6 100644 --- a/src/server/scripts/Commands/cs_guild.cpp +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -51,7 +51,7 @@ public: }; return commandTable; } - + /** \brief GM command level 3 - Create a guild. * * This command allows a GM (level 3) to create a guild. diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index e7dba97ac45..951ebc7714b 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -222,7 +222,7 @@ public: return true; } - + static bool HandleLookupEventCommand(ChatHandler* handler, char const* args) { if (!*args) @@ -660,7 +660,7 @@ public: { QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId()); - switch (status) + switch (status) { case QUEST_STATUS_COMPLETE: statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); @@ -708,7 +708,7 @@ public: { QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId()); - switch (status) + switch (status) { case QUEST_STATUS_COMPLETE: statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); @@ -1315,7 +1315,7 @@ public: static bool HandleLookupPlayerEmailCommand(ChatHandler* handler, char const* args) { if (!*args) - return false; + return false; std::string email = strtok((char*)args, " "); char* limitStr = strtok(NULL, " "); diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 4da4147caa6..82fb409faa7 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -82,7 +82,7 @@ public: return true; } - + static bool HandleResetStatsOrLevelHelper(Player* player) { ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass()); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index 677b94d8748..cd2874f7253 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -219,25 +219,25 @@ public: { switch (identifier) { - case DATA_SELIN: + case DATA_SELIN: return SelinGUID; - case DATA_DELRISSA: + case DATA_DELRISSA: return DelrissaGUID; - case DATA_VEXALLUS_DOOR: + case DATA_VEXALLUS_DOOR: return VexallusDoorGUID; - case DATA_SELIN_DOOR: + case DATA_SELIN_DOOR: return SelinDoorGUID; - case DATA_SELIN_ENCOUNTER_DOOR: + case DATA_SELIN_ENCOUNTER_DOOR: return SelinEncounterDoorGUID; - case DATA_DELRISSA_DOOR: + case DATA_DELRISSA_DOOR: return DelrissaDoorGUID; - case DATA_KAEL_DOOR: + case DATA_KAEL_DOOR: return KaelDoorGUID; - case DATA_KAEL_STATUE_LEFT: + case DATA_KAEL_STATUE_LEFT: return KaelStatue[0]; - case DATA_KAEL_STATUE_RIGHT: + case DATA_KAEL_STATUE_RIGHT: return KaelStatue[1]; - case DATA_ESCAPE_ORB: + case DATA_ESCAPE_ORB: return EscapeOrbGUID; case DATA_FEL_CRYSTAL: diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index f04e8c4e772..0d44db01592 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -175,13 +175,13 @@ public: if (me->GetDistance(victim) > 10.0f) DoCast(victim, SPELL_MULTI_SHOT); } else FadeTimer -= diff; - + if (SummonSkeletonTimer <= diff) { DoCast(me, SPELL_SUMMON_SKELETON); SummonSkeletonTimer = 20000 + rand()%10000; } else SummonSkeletonTimer -= diff; - + if (BlackArrowTimer <= diff) { if (Unit* victim = me->getVictim()) @@ -190,7 +190,7 @@ public: BlackArrowTimer = 15000 + rand()%5000; } } else BlackArrowTimer -= diff; - + if (ShotTimer <= diff) { if (Unit* victim = me->getVictim()) @@ -199,7 +199,7 @@ public: ShotTimer = 8000 + rand()%2000; } } else ShotTimer -= diff; - + if (MultiShotTimer <= diff) { if (Unit* victim = me->getVictim()) @@ -207,7 +207,7 @@ public: DoCast(victim, SPELL_MULTI_SHOT); MultiShotTimer = 10000 + rand()%3000; } - } else MultiShotTimer -= diff; + } else MultiShotTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index d3218e1729e..01c1617aba4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -38,7 +38,7 @@ enum Spells SPELL_BANSHEE_CURSE = 31651, SPELL_BANSHEE_WAIL = 38183, SPELL_ANTI_MAGIC_SHELL = 31662, - SPELL_WEB = 28991, + SPELL_WEB = 28991, SPELL_MANA_BURN = 31729, SPELL_FROST_BREATH = 31688, SPELL_GARGOYLE_STRIKE = 31664, diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp index 9e8cdaa8b92..248932ecbb6 100644 --- a/src/server/scripts/Kalimdor/ashenvale.cpp +++ b/src/server/scripts/Kalimdor/ashenvale.cpp @@ -174,7 +174,7 @@ enum RuulSnowhoof NPC_THISTLEFUR_URSA = 3921, NPC_THISTLEFUR_TOTEMIC = 3922, NPC_THISTLEFUR_PATHFINDER = 3926, - + QUEST_FREEDOM_TO_RUUL = 6482, GO_CAGE = 178147 diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp index eae5baa8db2..8d08c26f0a7 100644 --- a/src/server/scripts/Kalimdor/azshara.cpp +++ b/src/server/scripts/Kalimdor/azshara.cpp @@ -182,9 +182,9 @@ public: enum RizzleSprysprocketData { QUEST_CHASING_THE_MOONSTONE = 10994, - + MOB_DEPTH_CHARGE = 23025, - + SPELL_RIZZLE_BLACKJACK = 39865, SPELL_RIZZLE_ESCAPE = 39871, SPELL_RIZZLE_FROST_GRENADE = 40525, @@ -490,7 +490,7 @@ public: { if (WeMustDieTimer <= diff) me->DespawnOrUnsummon(); - else + else WeMustDieTimer -= diff; } return; diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index 4a8ff4780ba..96e67c8de47 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -549,7 +549,7 @@ public: (*itr)->Respawn(); } } - else + else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: FlagList is empty!"); } @@ -560,7 +560,7 @@ public: if (EventStarted) SayTimer = NextStep(Step++); } - else + else SayTimer -= diff; } }; diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp index 9243ea0017e..1a0aa7b21c0 100644 --- a/src/server/scripts/Kalimdor/felwood.cpp +++ b/src/server/scripts/Kalimdor/felwood.cpp @@ -40,10 +40,10 @@ EndContentData */ enum RiverbreezeAndSilversky { SPELL_CENARION_BEACON = 15120, - + NPC_ARATHANDRIS_SILVERSKY = 9528, NPC_MAYBESS_RIVERBREEZE = 9529, - + QUEST_CLEASING_FELWOOD_A = 4101, QUEST_CLEASING_FELWOOD_H = 4102 }; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 539974a0a91..3b94feda02b 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -200,7 +200,7 @@ public: JustCreated = false; } else CanAttack = true; - + for (uint8 i = 0; i < 4; ++i) if (Unit* remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i])) remo->setDeathState(JUST_DIED); @@ -354,7 +354,7 @@ public: // Static Charge // Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true); - if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) + if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); // cast Static Charge every 2 seconds for 20 seconds StaticChargeTimer = 10000+rand()%20000; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 99cb415dc98..614d7f95eb2 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1177,7 +1177,7 @@ Warden.ClientCheckHoldOff = 30 # # Warden.ClientCheckFailAction # Description: Default action being taken if a client check failed. Actions can be -# overwritten for each single check via warden_action table in characters +# overwritten for each single check via warden_action table in characters # database. # Default: 0 - (Disabled, Logging only) # 1 - (Kick) @@ -1940,9 +1940,9 @@ Rate.MoveSpeed = 1 # # Rate.InstanceResetTime -# Description: Multiplier for the rate between global raid/heroic instance resets -# (dbc value). Higher value increases the time between resets, -# lower value lowers the time, you need clean instance_reset in +# Description: Multiplier for the rate between global raid/heroic instance resets +# (dbc value). Higher value increases the time between resets, +# lower value lowers the time, you need clean instance_reset in # characters db in order to let new values work. # Default: 1 -- cgit v1.2.3 From af92a36e889d5fc1a7575300e7652d111ccf87d9 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sat, 4 Aug 2012 02:55:11 +0100 Subject: Core/Logging: Use config LogsDir to save log files (re-added) --- src/server/shared/Logging/AppenderFile.cpp | 5 +++-- src/server/shared/Logging/AppenderFile.h | 3 ++- src/server/shared/Logging/Log.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 93c02913aeb..cb875240c46 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -18,9 +18,10 @@ #include "AppenderFile.h" #include "Common.h" -AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _mode, bool _backup) +AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, bool _backup) : Appender(id, name, APPENDER_FILE, level) , filename(_filename) + , logDir(_logDir) , mode(_mode) , backup(_backup) { @@ -67,5 +68,5 @@ FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mod newName.append(LogMessage::getTimeStr(time(NULL))); rename(filename.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore } - return fopen(filename.c_str(), mode.c_str()); + return fopen((logDir + filename).c_str(), mode.c_str()); } diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index bbc500f9e76..8d8b0c43a54 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -23,7 +23,7 @@ class AppenderFile: public Appender { public: - AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* mode, bool backup); + AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, bool backup); ~AppenderFile(); FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup); @@ -31,6 +31,7 @@ class AppenderFile: public Appender void _write(LogMessage& message); FILE* logfile; std::string filename; + std::string logDir; std::string mode; bool dynamicName; bool backup; diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 17c6df44125..2ced38847be 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -127,7 +127,7 @@ void Log::CreateAppenderFromConfig(const char* name) } uint8 id = NextAppenderId(); - appenders[id] = new AppenderFile(id, name, level, filename.c_str(), mode.c_str(), backup); + appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), backup); //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe break; } -- cgit v1.2.3 From 22415bee66f1bc74cc620df25c32840b10361604 Mon Sep 17 00:00:00 2001 From: Faq Date: Sat, 4 Aug 2012 16:25:36 +0300 Subject: Core/Spells: Wrath of the Plaguebringer should be a debuff. Tibbi --- src/server/game/Spells/SpellInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index a397bb13709..0dad4fda760 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2205,14 +2205,16 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case SPELLFAMILY_GENERIC: switch (Id) { + case 29214: // Wrath of the Plaguebringer case 34700: // Allergic Reaction + case 54836: // Wrath of the Plaguebringer case 61987: // Avenging Wrath Marker case 61988: // Divine Shield exclude aura case 62532: // Conservator's Grip return false; + case 30877: // Tag Murloc case 61716: // Rabbit Costume case 61734: // Noblegarden Bunny - case 30877: // Tag Murloc case 62344: // Fists of Stone return true; default: -- cgit v1.2.3 From f9cb4280bd8f1c29e4acbae5339bce40c3b52bcb Mon Sep 17 00:00:00 2001 From: LordJZ Date: Sun, 5 Aug 2012 00:28:23 +0200 Subject: Core/ByteBuffer: Print stack trace in ByteBufferException::PrintError. --- src/server/shared/Packets/ByteBuffer.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 045c5fd91c8..760fcfd48d9 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -50,8 +50,10 @@ class ByteBufferPositionException : public ByteBufferException protected: void PrintError() const { - sLog->outError(LOG_FILTER_GENERAL, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") " , - (_add ? "put" : "get"), ValueSize, Pos, Size); + ACE_Stack_Trace trace; + + sLog->outError(LOG_FILTER_GENERAL, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD")\n[Stacktrace: %s]" , + (_add ? "put" : "get"), ValueSize, Pos, Size, trace.c_str()); } private: @@ -70,8 +72,10 @@ class ByteBufferSourceException : public ByteBufferException protected: void PrintError() const { - sLog->outError(LOG_FILTER_GENERAL, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")", - (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size); + ACE_Stack_Trace trace; + + sLog->outError(LOG_FILTER_GENERAL, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")\n[Stacktrace: %s]", + (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size, trace.c_str()); } }; -- cgit v1.2.3 From cc0ff69ca4271614b4bb6f5813ea6267cc140edb Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 3 Aug 2012 15:15:19 +0200 Subject: Core/Commands: * Add remove support for disable command * Add quest disables support * Add check for no existent entry * Fix problems with flags 0 * Fix code style --- .../world/2012_08_05_00_world_trinity_string.sql | 5 + sql/updates/world/2012_08_05_01_world_command.sql | 19 ++ src/server/game/Miscellaneous/Language.h | 5 +- src/server/scripts/Commands/cs_disable.cpp | 314 ++++++++++++++++----- .../Database/Implementation/WorldDatabase.cpp | 3 +- .../shared/Database/Implementation/WorldDatabase.h | 1 + 6 files changed, 276 insertions(+), 71 deletions(-) create mode 100644 sql/updates/world/2012_08_05_00_world_trinity_string.sql create mode 100644 sql/updates/world/2012_08_05_01_world_command.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_05_00_world_trinity_string.sql b/sql/updates/world/2012_08_05_00_world_trinity_string.sql new file mode 100644 index 00000000000..e432f598c02 --- /dev/null +++ b/sql/updates/world/2012_08_05_00_world_trinity_string.sql @@ -0,0 +1,5 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (5032,5033,5034); +INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`) VALUES +(5032,'No battleground found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5033,'No achievement criteria found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5034,'No outdoor PvP found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/world/2012_08_05_01_world_command.sql b/sql/updates/world/2012_08_05_01_world_command.sql new file mode 100644 index 00000000000..f19bfe1c0d0 --- /dev/null +++ b/sql/updates/world/2012_08_05_01_world_command.sql @@ -0,0 +1,19 @@ +DELETE FROM `command` WHERE `name` IN ( +'disable add quest','disable add map','disable add battleground','disable add achievement_criteria','disable add spell','disable add outdoorpvp','disable add vmap', +'disable remove quest','disable remove map','disable remove battleground','disable remove achievement_criteria','disable remove spell','disable remove outdoorpvp','disable remove vmap' +); +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('disable add quest',3,'Syntax: .disable add quest $entry $flag $comment'), +('disable add map',3,'Syntax: .disable add map $entry $flag $comment'), +('disable add battleground',3,'Syntax: .disable add battleground $entry $flag $comment'), +('disable add achievement_criteria',3,'Syntax: .disable add achievement_criteria $entry $flag $comment'), +('disable add spell',3,'Syntax: .disable add spell $entry $flag $comment'), +('disable add outdoorpvp',3,'Syntax: .disable add outdoorpvp $entry $flag $comment'), +('disable add vmap',3,'Syntax: .disable add vmap $entry $flag $comment'), +('disable remove quest',3,'Syntax: .disable remove quest $entry'), +('disable remove map',3,'Syntax: .disable remove map $entry'), +('disable remove battleground',3,'Syntax: .disable remove battleground $entry'), +('disable remove achievement_criteria',3,'Syntax: .disable remove achievement_criteria $entry'), +('disable remove spell',3,'Syntax: .disable remove spell $entry'), +('disable remove outdoorpvp',3,'Syntax: .disable remove outdoorpvp $entry'), +('disable remove vmap',3,'Syntax: .disable remove vmap $entry'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index aec72835d86..a766108dbb0 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -957,7 +957,10 @@ enum TrinityStrings LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029, LANG_FLEE = 5030, LANG_NPCINFO_AIINFO = 5031, - // Room for more Trinity strings 5032-9999 + LANG_COMMAND_NO_BATTLEGROUND_FOUND = 5032, + LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033, + LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034, + // Room for more Trinity strings 5035-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index e7f33885036..a2a80edd43b 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ObjectMgr.h" #include "Chat.h" #include "DisableMgr.h" +#include "OutdoorPvP.h" class disable_commandscript : public CommandScript { @@ -34,56 +35,230 @@ public: ChatCommand* GetCommands() const { - - static ChatCommand disableCommandTable[] = + static ChatCommand removeDisableCommandTable[] = { - { "spell", SEC_GAMEMASTER, false, &HandleDisableSpellCommand, "", NULL }, - { "map", SEC_GAMEMASTER, false, &HandleDisableMapCommand, "", NULL }, - { "battleground", SEC_GAMEMASTER, false, &HandleDisableBattlegroundCommand, "", NULL }, - { "achievement_criteria", SEC_GAMEMASTER, false, &HandleDisableAchievementCriteriaCommand, "", NULL }, - { "outdoorpvp", SEC_GAMEMASTER, false, &HandleDisableOutdoorPvPCommand, "", NULL }, - { "vmap", SEC_GAMEMASTER, false, &HandleDisableVmapCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "spell", SEC_ADMINISTRATOR, true, &HandleRemoveDisableSpellCommand, "", NULL }, + { "quest", SEC_ADMINISTRATOR, true, &HandleRemoveDisableQuestCommand, "", NULL }, + { "map", SEC_ADMINISTRATOR, true, &HandleRemoveDisableMapCommand, "", NULL }, + { "battleground", SEC_ADMINISTRATOR, true, &HandleRemoveDisableBattlegroundCommand, "", NULL }, + { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleRemoveDisableAchievementCriteriaCommand, "", NULL }, + { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleRemoveDisableOutdoorPvPCommand, "", NULL }, + { "vmap", SEC_ADMINISTRATOR, true, &HandleRemoveDisableVmapCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; - + static ChatCommand addDisableCommandTable[] = + { + { "spell", SEC_ADMINISTRATOR, true, &HandleAddDisableSpellCommand, "", NULL }, + { "quest", SEC_ADMINISTRATOR, true, &HandleAddDisableQuestCommand, "", NULL }, + { "map", SEC_ADMINISTRATOR, true, &HandleAddDisableMapCommand, "", NULL }, + { "battleground", SEC_ADMINISTRATOR, true, &HandleAddDisableBattlegroundCommand, "", NULL }, + { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleAddDisableAchievementCriteriaCommand, "", NULL }, + { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleAddDisableOutdoorPvPCommand, "", NULL }, + { "vmap", SEC_ADMINISTRATOR, true, &HandleAddDisableVmapCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand disableCommandTable[] = + { + { "add", SEC_ADMINISTRATOR, true, NULL, "", addDisableCommandTable }, + { "remove", SEC_ADMINISTRATOR, true, NULL, "", removeDisableCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand commandTable[] = { - { "disable", SEC_GAMEMASTER, false, NULL, "", disableCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { "disable", SEC_ADMINISTRATOR, false, NULL, "", disableCommandTable }, + { NULL, 0, false, NULL, "", NULL } }; return commandTable; } - - static void HandleDisables(ChatHandler* handler, char const* args, uint8 disableType) + static bool HandleAddDisables(ChatHandler* handler, char const* args, uint8 disableType) { - char* cEntry = strtok((char*)args, " "); - if (!cEntry || !atoi(cEntry)) - { - handler->SendSysMessage("No entry specified."); - return; - } + char* entryStr = strtok((char*)args, " "); + if (!entryStr || !atoi(entryStr)) + return false; + + char* flagsStr = strtok(NULL, " "); + uint8 flags = flagsStr ? uint8(atoi(flagsStr)) : 0; + + char* commentStr = strtok(NULL, ""); + if (!commentStr) + return false; - char* cFlags = strtok(NULL, " "); - if (!cFlags || !atoi(cFlags)) + std::string disableComment = commentStr; + uint32 entry = uint32(atoi(entryStr)); + + std::string disableTypeStr = ""; + + switch (disableType) { - handler->SendSysMessage("No flags specified."); - return; + case DISABLE_TYPE_SPELL: + { + if (!sSpellMgr->GetSpellInfo(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "spell"; + break; + } + case DISABLE_TYPE_QUEST: + { + if (!sObjectMgr->GetQuestTemplate(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "quest"; + break; + } + case DISABLE_TYPE_MAP: + { + if (!sMapStore.LookupEntry(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "map"; + break; + } + case DISABLE_TYPE_BATTLEGROUND: + { + if (!sBattlemasterListStore.LookupEntry(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "battleground"; + break; + } + case DISABLE_TYPE_ACHIEVEMENT_CRITERIA: + { + if (!sAchievementCriteriaStore.LookupEntry(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "achievement criteria"; + break; + } + case DISABLE_TYPE_OUTDOORPVP: + { + if (entry > MAX_OUTDOORPVP_TYPES) + { + handler->PSendSysMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "outdoorpvp"; + break; + } + case DISABLE_TYPE_VMAP: + { + if (!sMapStore.LookupEntry(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "vmap"; + break; + } + default: + break; } - - char* cComment = strtok(NULL, ""); - if (!cComment) + + PreparedStatement* stmt = NULL; + stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); + stmt->setUInt32(0, entry); + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (result) { - handler->SendSysMessage("No comment specified."); - return; + handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry); + handler->SetSentErrorMessage(true); + return false; } - std::string entryStr = cEntry; - std::string disableComment = cComment; - uint32 entry = (uint32)atoi(cEntry); - uint8 flags = atoi(cFlags); + stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES); + stmt->setUInt32(0, entry); + stmt->setUInt8(1, disableType); + stmt->setUInt16(2, flags); + stmt->setString(3, disableComment); + WorldDatabase.Execute(stmt); + + handler->PSendSysMessage("Add Disabled %s (Id: %u) for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str()); + return true; + } + + static bool HandleAddDisableSpellCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_SPELL); + } + + static bool HandleAddDisableQuestCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_QUEST); + } + + static bool HandleAddDisableMapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_MAP); + } + + static bool HandleAddDisableBattlegroundCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_BATTLEGROUND); + } + + static bool HandleAddDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA); + } + + static bool HandleAddDisableOutdoorPvPCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + HandleAddDisables(handler, args, DISABLE_TYPE_OUTDOORPVP); + return true; + } + + static bool HandleAddDisableVmapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + return HandleAddDisables(handler, args, DISABLE_TYPE_VMAP); + } + + static bool HandleRemoveDisables(ChatHandler* handler, char const* args, uint8 disableType) + { + char* entryStr = strtok((char*)args, " "); + if (!entryStr || !atoi(entryStr)) + return false; + uint32 entry = uint32(atoi(entryStr)); std::string disableTypeStr = ""; @@ -92,6 +267,9 @@ public: case DISABLE_TYPE_SPELL: disableTypeStr = "spell"; break; + case DISABLE_TYPE_QUEST: + disableTypeStr = "quest"; + break; case DISABLE_TYPE_MAP: disableTypeStr = "map"; break; @@ -109,87 +287,85 @@ public: break; } - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); + PreparedStatement* stmt = NULL; + stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); - stmt->setUInt8(1, disableType); - PreparedQueryResult result = WorldDatabase.Query(stmt); - - - if (result) + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) { - handler->PSendSysMessage("This %s (id %u) is already disabled.", disableTypeStr.c_str(), entry); - return; + handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry); + handler->SetSentErrorMessage(true); + return false; } - PreparedStatement* stmt2 = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES); - stmt2->setUInt32(0, entry); - stmt2->setUInt8(1, disableType); - stmt2->setUInt16(2, flags); - stmt2->setString(3, disableComment); - WorldDatabase.Execute(stmt2); - - handler->PSendSysMessage("Disabled %s %u for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str()); - return; + stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_DISABLES); + stmt->setUInt32(0, entry); + stmt->setUInt8(1, disableType); + WorldDatabase.Execute(stmt); + handler->PSendSysMessage("Remove Disabled %s (Id: %u)", disableTypeStr.c_str(), entry); + return true; } - static bool HandleDisableSpellCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableSpellCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_SPELL); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_SPELL); } - static bool HandleDisableMapCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableQuestCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_MAP); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_QUEST); } - static bool HandleDisableBattlegroundCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableMapCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_BATTLEGROUND); - return true; + return HandleAddDisables(handler, args, DISABLE_TYPE_MAP); } - static bool HandleDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableBattlegroundCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_BATTLEGROUND); } - static bool HandleDisableOutdoorPvPCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_OUTDOORPVP); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA); } - static bool HandleDisableVmapCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableOutdoorPvPCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_VMAP); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_OUTDOORPVP); } + static bool HandleRemoveDisableVmapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleRemoveDisables(handler, args, DISABLE_TYPE_VMAP); + } }; void AddSC_disable_commandscript() { new disable_commandscript(); -} \ No newline at end of file +} diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index 3b59f283ddb..872d9ec415c 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -89,5 +89,6 @@ void WorldDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); - PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ? AND flags > 0", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_ASYNC); } diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index 10163d33c83..6d7df87cc80 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -111,6 +111,7 @@ enum WorldDatabaseStatements WORLD_INS_GAMEOBJECT, WORLD_SEL_DISABLES, WORLD_INS_DISABLES, + WORLD_DEL_DISABLES, MAX_WORLDDATABASE_STATEMENTS, }; -- cgit v1.2.3 From 0b98656b2878e1a6f644e1cd8b7745370efc488b Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 5 Aug 2012 02:16:24 +0200 Subject: Core/Spells: Remove no longer needed hack to Apply Enchanted Bridle --- src/server/game/Spells/SpellMgr.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 3cc3a877337..e2b7df2889d 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3241,10 +3241,6 @@ void SpellMgr::LoadDbcDataCorrections() // this needs research on modifier applying rules, does not seem to be in Attributes fields spellInfo->EffectSpellClassMask[0] = flag96(0x00000040, 0x00000000, 0x00000000); break; - case 63163: // Apply Enchanted Bridle (Argent Tournament) - spellInfo->EffectDieSides[0] = 0; // was 1, that should probably mean seat 0, but instead it's treated as spell 1 - spellInfo->EffectBasePoints[0] = 52391; // Ride Vehicle (forces seat 0) - break; case 45602: // Ride Carpet spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)" break; -- cgit v1.2.3 From 9afbb75321354da1f4797da812eb9cd4a6ef4ce5 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 5 Aug 2012 04:18:22 +0200 Subject: Core/Spells: Fix Divine Shield and Ice Block casted in Cyclone --- src/server/game/Spells/Spell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3742ee5fc52..1dedf8ba916 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5544,7 +5544,7 @@ SpellCastResult Spell::CheckCasterAuras() const // We use bitmasks so the loop is done only once and not on every aura check below. if (m_spellInfo->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY) { - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY) school_immune |= uint32(m_spellInfo->Effects[i].MiscValue); @@ -5612,7 +5612,7 @@ SpellCastResult Spell::CheckCasterAuras() const SpellInfo const* auraInfo = aura->GetSpellInfo(); if (auraInfo->GetAllEffectsMechanicMask() & mechanic_immune) continue; - if (auraInfo->GetSchoolMask() & school_immune) + if (auraInfo->GetSchoolMask() & school_immune && !(auraInfo->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE)) continue; if (auraInfo->GetDispelMask() & dispel_immune) continue; -- cgit v1.2.3 From 3f42094b9c563d2b2d5f2dfe43d8d47c9114f71f Mon Sep 17 00:00:00 2001 From: Spp Date: Sun, 5 Aug 2012 15:38:25 +0200 Subject: Core/Logging: Add option to remove timestamp, Log Level and Log Filter Type from logged msgs - Appender config option .Timestamp and .Backup became obsolete - New Appender config option .Flags added Appender Console prefixes Log Level and Log Filter Type to the logged text as default Appender File prefixes Timestamp, Log Level and Log Filter Type to the logged text as default --- src/server/authserver/authserver.conf.dist | 19 +++++------ src/server/game/Handlers/CharacterHandler.cpp | 2 +- src/server/game/Server/WorldSession.cpp | 2 +- src/server/shared/Logging/Appender.cpp | 48 ++++++++++++++++++++++++--- src/server/shared/Logging/Appender.h | 21 ++++++++++-- src/server/shared/Logging/AppenderConsole.cpp | 10 +++--- src/server/shared/Logging/AppenderConsole.h | 2 +- src/server/shared/Logging/AppenderFile.cpp | 11 +++--- src/server/shared/Logging/AppenderFile.h | 2 +- src/server/shared/Logging/Log.cpp | 11 +++--- src/server/worldserver/worldserver.conf.dist | 19 +++++------ 11 files changed, 100 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index d77b40e6591..30a319237a6 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -206,16 +206,15 @@ LoginDatabase.WorkerThreads = 1 # Default: a - (Append) # w - (Overwrite) # -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) +# Appender.name.Flags +# Description: +# Default: Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) # # Logger config values: Given a logger "name" the following options # can be read: diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index df515f879f8..9aecf3c4c25 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1006,7 +1006,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 6e45ebf37c1..6fdbf8a5358 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -534,7 +534,7 @@ 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->outDebug(LOG_FILTER_PLAYER, "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_PLAYER_LOADING, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 0b92e74c1e9..db7857064df 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -31,8 +31,8 @@ std::string LogMessage::getTimeStr() return getTimeStr(mtime); } -Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */): -id(_id), name(_name), type(_type), level(_level) +Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */, AppenderFlags _flags /* = APPENDER_FLAGS_NONE */): +id(_id), name(_name), type(_type), level(_level), flags(_flags) { } @@ -60,6 +60,11 @@ LogLevel Appender::getLogLevel() const return level; } +AppenderFlags Appender::getFlags() const +{ + return flags; +} + void Appender::setLogLevel(LogLevel _level) { level = _level; @@ -67,9 +72,40 @@ void Appender::setLogLevel(LogLevel _level) void Appender::write(LogMessage& message) { - if (level && level <= message.level) - _write(message); - //else fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe + if (!level || level > message.level) + { + //fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe + return; + } + + message.prefix.clear(); + if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP) + message.prefix.append(message.getTimeStr().c_str()); + + if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL) + { + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + char text[MAX_QUERY_LEN]; + snprintf(text, MAX_QUERY_LEN, "%-5s", Appender::getLogLevelString(message.level)); + message.prefix.append(text); + } + + if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE) + { + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + char text[MAX_QUERY_LEN]; + snprintf(text, MAX_QUERY_LEN, "[%-15s]", Appender::getLogFilterTypeString(message.type)); + message.prefix.append(text); + } + + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + _write(message); } const char* Appender::getLogLevelString(LogLevel level) @@ -163,6 +199,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "WORLDSERVER"; case LOG_FILTER_GAMEEVENTS: return "GAMEEVENTS"; + case LOG_FILTER_CALENDAR: + return "CALENDAR"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 3105f0e6bb4..429a685d4ee 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -85,9 +85,23 @@ enum AppenderType APPENDER_DB, }; +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 +}; + struct LogMessage { - LogMessage(LogLevel _level, LogFilterType _type, std::string _text): level(_level), type(_type), text(_text) + LogMessage(LogLevel _level, LogFilterType _type, std::string _text) + : level(_level) + , type(_type) + , text(_text) + , param1(0) { mtime = time(NULL); } @@ -98,6 +112,7 @@ struct LogMessage LogLevel level; LogFilterType type; std::string text; + std::string prefix; uint32 param1; time_t mtime; }; @@ -105,13 +120,14 @@ struct LogMessage class Appender { public: - Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED); + Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED, AppenderFlags flags = APPENDER_FLAGS_NONE); virtual ~Appender(); uint8 getId() const; std::string const& getName() const; AppenderType getType() const; LogLevel getLogLevel() const; + AppenderFlags getFlags() const; void setLogLevel(LogLevel); void write(LogMessage& message); @@ -125,6 +141,7 @@ class Appender std::string name; AppenderType type; LogLevel level; + AppenderFlags flags; }; typedef std::map AppenderMap; diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp index 30c7cc4d135..839f8512ad7 100644 --- a/src/server/shared/Logging/AppenderConsole.cpp +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -21,9 +21,11 @@ #include -AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level): -Appender(id, name, APPENDER_CONSOLE, level), _colored(false), _colors() +AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags): +Appender(id, name, APPENDER_CONSOLE, level, flags), _colored(false) { + for (uint8 i = 0; i < MaxLogLevels; ++i) + _colors[i] = ColorTypes(MaxColors); } void AppenderConsole::InitColors(std::string const& str) @@ -183,9 +185,9 @@ void AppenderConsole::_write(LogMessage& message) } SetColor(stdout_stream, _colors[index]); - utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str()); ResetColor(stdout_stream); } else - utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str()); } diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h index b81fe6dde57..ad7d9543cdb 100644 --- a/src/server/shared/Logging/AppenderConsole.h +++ b/src/server/shared/Logging/AppenderConsole.h @@ -45,7 +45,7 @@ const uint8 MaxColors = uint8(WHITE) + 1; class AppenderConsole: public Appender { public: - AppenderConsole(uint8 _id, std::string const& name, LogLevel level); + AppenderConsole(uint8 _id, std::string const& name, LogLevel level, AppenderFlags flags); void InitColors(const std::string& init_str); private: diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index cb875240c46..d66771b9055 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -18,16 +18,16 @@ #include "AppenderFile.h" #include "Common.h" -AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, bool _backup) - : Appender(id, name, APPENDER_FILE, level) +AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags) + : Appender(id, name, APPENDER_FILE, level, _flags) , filename(_filename) , logDir(_logDir) , mode(_mode) - , backup(_backup) { dynamicName = std::string::npos != filename.find("%u"); + backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; if (!dynamicName) - logfile = OpenFile(_filename, _mode, _backup); + logfile = OpenFile(_filename, _mode, backup); } AppenderFile::~AppenderFile() @@ -50,8 +50,7 @@ void AppenderFile::_write(LogMessage& message) if (logfile) { - fprintf(logfile, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); - + fprintf(logfile, "%s%s", message.prefix.c_str(), message.text.c_str()); fflush(logfile); if (dynamicName) diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index 8d8b0c43a54..e9cb858f625 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -23,7 +23,7 @@ class AppenderFile: public Appender { public: - AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, bool backup); + AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags); ~AppenderFile(); FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup); diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 2ced38847be..0bf8bcded86 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -103,7 +103,8 @@ void Log::CreateAppenderFromConfig(const char* name) { case APPENDER_CONSOLE: { - AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level); + AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; appender->InitColors(GetConfigStringDefault(base, "Colors", "")); @@ -114,10 +115,9 @@ void Log::CreateAppenderFromConfig(const char* name) { std::string filename = GetConfigStringDefault(base, "File", ""); std::string mode = GetConfigStringDefault(base, "Mode", "a"); - std::string timestamp = GetConfigStringDefault(base, "Timestamp", ""); - bool backup = GetConfigIntDefault(base, "Backup", 0); + AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_TIMESTAMP | APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); - if (!timestamp.empty()) + if (flags & APPENDER_FLAGS_USE_TIMESTAMP) { size_t dot_pos = filename.find_last_of("."); if (dot_pos != filename.npos) @@ -127,7 +127,7 @@ void Log::CreateAppenderFromConfig(const char* name) } uint8 id = NextAppenderId(); - appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), backup); + appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags); //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe break; } @@ -228,7 +228,6 @@ void Log::EnableDBAppenders() for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) if (it->second && it->second->getType() == APPENDER_DB) ((AppenderDB *)it->second)->setEnable(true); - } void Log::log(LogFilterType filter, LogLevel level, char const* str, ...) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 614d7f95eb2..f31326b104a 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2637,16 +2637,15 @@ PlayerDump.DisallowOverwrite = 1 # Default: a - (Append) # w - (Overwrite) # -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) +# Appender.name.Flags +# Description: +# Default: Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) # # Logger config values: Given a logger "name" the following options # can be read: -- cgit v1.2.3 From 1bd8cb9a7cbaa1a3644328adcceb6a0bc3039156 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 5 Aug 2012 19:56:16 +0100 Subject: Script/Commands: Fix a copy paste type in .reload item_set_names command --- src/server/scripts/Commands/cs_reload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index c8568feaeb6..3bb29f8abfe 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -949,7 +949,7 @@ public: static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/) { sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names..."); - LoadRandomEnchantmentsTable(); + sObjectMgr->LoadItemSetNames(); handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded."); return true; } -- cgit v1.2.3 From 2e3e62875b6b1bea5becd877c58349aae6006bfc Mon Sep 17 00:00:00 2001 From: Faq Date: Sun, 5 Aug 2012 16:13:49 +0300 Subject: Core/Spells: Generic fix for auras with effect SPELL_EFFECT_APPLY_AREA_AURA_ENEMY Author Vincent-Michael --- src/server/game/Spells/SpellInfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 0dad4fda760..7b3f9a1bef9 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2210,7 +2210,6 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case 54836: // Wrath of the Plaguebringer case 61987: // Avenging Wrath Marker case 61988: // Divine Shield exclude aura - case 62532: // Conservator's Grip return false; case 30877: // Tag Murloc case 61716: // Rabbit Costume @@ -2300,6 +2299,8 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case SPELL_EFFECT_HEAL_PCT: case SPELL_EFFECT_ENERGIZE_PCT: return true; + case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY: + return false; // non-positive aura use case SPELL_EFFECT_APPLY_AURA: -- cgit v1.2.3 From 483fb42306b82d92ea4c32ce016dbdd7fa91381d Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 08:49:31 +0200 Subject: Core/Logging: Move player delete logging to new type LOG_FILTER_PLAYER_DELETE (34). Also add missing sql from 55ce180f28 --- sql/updates/world/2012_08_06_00_world_command.sql | 4 ++++ src/server/game/Handlers/CharacterHandler.cpp | 16 ++++++---------- src/server/shared/Logging/Appender.cpp | 2 ++ src/server/shared/Logging/Appender.h | 5 +++-- src/server/worldserver/worldserver.conf.dist | 1 + 5 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 sql/updates/world/2012_08_06_00_world_command.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_06_00_world_command.sql b/sql/updates/world/2012_08_06_00_world_command.sql new file mode 100644 index 00000000000..50628aaa589 --- /dev/null +++ b/sql/updates/world/2012_08_06_00_world_command.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` IN ('server togglequerylog', 'server set loglevel'); + +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('server set loglevel',4,'Syntax: .server set loglevel $facility $name $loglevel. $facility can take the values: appender (a) or logger (l). $loglevel can take the values: disabled (0), trace (1), debug (2), info (3), warn (4), error (5) or fatal (6)'); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 9aecf3c4c25..e4926bfad2e 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -687,7 +687,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) if (sGuildMgr->GetGuildByLeader(guid)) { WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER; + data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER); SendPacket(&data); return; } @@ -696,18 +696,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) if (sArenaTeamMgr->GetArenaTeamByCaptain(guid)) { WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN; + data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN); SendPacket(&data); return; } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID); - stmt->setUInt32(0, GUID_LOPART(guid)); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (result) + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { Field* fields = result->Fetch(); accountId = fields[0].GetUInt32(); @@ -719,22 +716,21 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) return; std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->ShouldLog(LOG_FILTER_PLAYER, LOG_LEVEL_TRACE)) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_PLAYER_DELETE, LOG_LEVEL_INFO)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outTrace(LOG_FILTER_PLAYER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + sLog->outInfo(LOG_FILTER_PLAYER_DELETE, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } Player::DeleteFromDB(guid, GetAccountId()); WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_SUCCESS; + data << uint8(CHAR_DELETE_SUCCESS); SendPacket(&data); } diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index db7857064df..abb2649c468 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -201,6 +201,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "GAMEEVENTS"; case LOG_FILTER_CALENDAR: return "CALENDAR"; + case LOG_FILTER_PLAYER_DELETE: + return "PLAYER_DELETE"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 429a685d4ee..323da3f2be8 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -58,10 +58,11 @@ enum LogFilterType LOG_FILTER_AUTHSERVER, LOG_FILTER_WORLDSERVER, LOG_FILTER_GAMEEVENTS, - LOG_FILTER_CALENDAR + LOG_FILTER_CALENDAR, + LOG_FILTER_PLAYER_DELETE }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_CALENDAR) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_PLAYER_DELETE) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index f31326b104a..3fe9ab4c37e 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2695,6 +2695,7 @@ PlayerDump.DisallowOverwrite = 1 # 31 - Worldserver # 32 - Game Events # 33 - Calendar +# 34 - Player delete # # Logger.name.Level # Description: Logger level of logging -- cgit v1.2.3 From 5746b688fa156f2ea3a72a8f655042c24bdae8c4 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 09:30:47 +0200 Subject: Core/Logging: Reload Logging options when .reload config is used --- src/server/game/World/World.cpp | 1 + src/server/shared/Logging/Log.cpp | 26 +++++++++++++++----------- src/server/shared/Logging/Log.h | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 3a13f48d807..ab3b7150089 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -398,6 +398,7 @@ void World::LoadConfigSettings(bool reload) sLog->outError(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str()); return; } + sLog->LoadFromConfig(); } ///- Read the player limit and the Message of the day from the config file diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 0bf8bcded86..cce670922f4 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -32,18 +32,8 @@ Log::Log() { SetRealmID(0); - AppenderId = 0; - /// Common log files data - m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); - if (!m_logsDir.empty()) - if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) - m_logsDir.push_back('/'); - m_logsTimestamp = "_" + GetTimestampStr(); - - ReadAppendersFromConfig(); - ReadLoggersFromConfig(); - worker = new LogWorker(); + LoadFromConfig(); } Log::~Log() @@ -426,6 +416,20 @@ void Log::Close() it->second = NULL; } appenders.clear(); + loggers.clear(); delete worker; worker = NULL; } + +void Log::LoadFromConfig() +{ + Close(); + AppenderId = 0; + m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + if (!m_logsDir.empty()) + if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) + m_logsDir.push_back('/'); + ReadAppendersFromConfig(); + ReadLoggersFromConfig(); + worker = new LogWorker(); +} diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 5e2b7972dc8..7b0e8cd381b 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -40,6 +40,7 @@ class Log ~Log(); public: + void LoadFromConfig(); void Close(); bool ShouldLog(LogFilterType type, LogLevel level) const; bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true); -- cgit v1.2.3 From 97c4b92eb02fc673d1230aadaee23aa7827a9761 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 12:10:33 +0200 Subject: Core/Logging: Try to simplify configuration of loggers and appenders Changed multiple lines to a simple format: - Logger.name=Type,LogLevel,Flags,AppenderList - Appender.name=Type,LogLevel,Flags,optional1,optional2 * Type = File: optional1 = File name, optiona2 = Mode * Type = Console: optional1 = Colors Created a default set of loggers and appenders. - Root logger defaults to Error, that means you will see nothing on console by default (not even loading) - You need to add the loggers to Loggers options if you want to enable them, otherwise Root logger will be used for all types Restored outSQLDriver (LOG_FILTER_SQL_DRIVER), outSQLDev (LOG_FILTER_SQL_DEV), outArena (LOG_FILTER_ARENA) and outChar (LOG_FILTER_CHARACTER) functionality by creating new types (LOG_FILTER_CHARACTER is a rename of LOG_FILTER_DELETE. Note: You need to update your config file... again (yeah sorry... trying to make it simpler) --- src/server/authserver/authserver.conf.dist | 196 ++++++-------- src/server/game/Battlegrounds/ArenaTeam.cpp | 20 +- src/server/game/Entities/Player/Player.cpp | 76 +++--- src/server/game/Handlers/CharacterHandler.cpp | 15 +- src/server/game/Server/WorldSession.cpp | 2 +- src/server/scripts/Commands/cs_account.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- src/server/shared/Database/DatabaseWorkerPool.h | 16 +- src/server/shared/Logging/Appender.cpp | 10 +- src/server/shared/Logging/Appender.h | 7 +- src/server/shared/Logging/Log.cpp | 107 ++++++-- src/server/worldserver/worldserver.conf.dist | 337 ++++++++++++------------ 12 files changed, 417 insertions(+), 373 deletions(-) (limited to 'src') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 30a319237a6..d1c92dcf1d0 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -149,123 +149,101 @@ LoginDatabase.WorkerThreads = 1 ################################################################################################### # # Logging system options. -# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. -# -# -# Appender config values: Given a appender "name" the following options -# can be read: -# -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) -# -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# Colors: 0 - BLACK -# 1 - RED -# 2 - GREEN -# 3 - BROWN -# 4 - BLUE -# 5 - MAGENTA -# 6 - CYAN -# 7 - GREY -# 8 - YELLOW -# 9 - LRED -# 10 - LGREEN -# 11 - LBLUE -# 12 - LMAGENTA -# 13 - LCYAN -# 14 - WHITE -# Example: "13 11 9 5 3 1" -# -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) -# -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) -# -# Appender.name.Flags -# Description: -# Default: Console = 6, File = 7, DB = 0 -# 0 - None -# 1 - Prefix Timestamp to the text -# 2 - Prefix Log Level to the text -# 4 - Prefix Log Filter type to the text -# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) -# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) -# -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 7 - Network input/output, -# 30 - Authserver -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: List of appenders linked to logger +# +# Appender config values: Given a appender "name" +# Appender.name +# Description: Defines 'where to log' +# Format: Type,LogLevel,Flags,optional1,optional2 +# +# Type +# 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Flags: Default Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) +# +# Colors (read as optional1 if Type = Console) +# Format: "fatal error warn info debug trace" +# 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# File: Name of the file (read as optional1 if Type = File) +# Allows to use one "%u" to create dynamic files +# +# Mode: Mode to open the file (read as optional2 if Type = File) +# a - (Append) +# w - (Overwrite) +# + +Appender.Console=1,2,6 +Appender.Auth=2,2,7,Auth.log,w + +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 7 - Network input/output, +# 30 - Authserver + +Logger.Root=0,3,Console Auth + +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# AppenderList: List of appenders linked to logger # (Using spaces as separator). # # Appenders # Description: List of Appenders to read from config # (Using spaces as separator). -# Default: "Console Auth" +# Default: "Console Server" + +Appenders=Console Auth + # # Loggers # Description: List of Loggers to read from config # (Using spaces as separator). # Default: "root" -Loggers=root -Appenders=Console Auth - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Auth.Type=2 -Appender.Auth.Level=2 -Appender.Auth.File=Auth.log -Appender.Auth.Mode=w - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Auth +Loggers=Root diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 7c6cabe37ba..b9ddabcf254 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -87,7 +87,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uin // Add captain as member AddMember(CaptainGuid); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); + sLog->outInfo(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); return true; } @@ -125,7 +125,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // Check if player is already in a similar arena team if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0) { - sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); return false; } @@ -184,7 +184,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); } - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId()); return true; } @@ -251,7 +251,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (newMember.Name.empty()) { sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid)); - this->DelMember(newMember.Guid, true); + DelMember(newMember.Guid, true); continue; } @@ -267,7 +267,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (Empty() || !captainPresentInTeam) { // Arena team is empty or captain is not in team, delete from db - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); + sLog->outDebug(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); return false; } @@ -297,7 +297,7 @@ void ArenaTeam::SetCaptain(uint64 guid) newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : ""; uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0; - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", + 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()); } } @@ -321,7 +321,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->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } // Only used for single member deletion, for arena team disband we use a single query for more efficiency @@ -346,7 +346,7 @@ void ArenaTeam::Disband(WorldSession* session) BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); if (Player* player = session->GetPlayer()) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } // Update database @@ -507,7 +507,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun data << str1 << str2 << str3; break; default: - sLog->outError(LOG_FILTER_BATTLEGROUND, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); + sLog->outError(LOG_FILTER_ARENAS, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); return; } @@ -529,7 +529,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type) default: break; } - sLog->outError(LOG_FILTER_BATTLEGROUND, "FATAL: Unknown arena team type %u for some arena team", type); + sLog->outError(LOG_FILTER_ARENAS, "FATAL: Unknown arena team type %u for some arena team", type); return 0xFF; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2fd80b7b843..0731046892d 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1228,7 +1228,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - sLog->outError(LOG_FILTER_PLAYER, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); return false; } @@ -1534,7 +1534,7 @@ void Player::Update(uint32 p_time) { //sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad); //if (m_spellModTakingSpell) - sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); + sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); m_spellModTakingSpell = NULL; } @@ -1731,7 +1731,7 @@ void Player::Update(uint32 p_time) { // m_nextSave reseted in SaveToDB call SaveToDB(); - sLog->outInfo(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); } else m_nextSave -= p_time; @@ -1879,12 +1879,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass); if (!info) { - sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Don't build enum.", guid); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has incorrect race/class pair. Don't build enum.", guid); return false; } else if (!IsValidGender(gender)) { - sLog->outError(LOG_FILTER_PLAYER, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); return false; } @@ -2066,14 +2066,14 @@ 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_PLAYER, "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).", + 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()); return false; } if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { - sLog->outError(LOG_FILTER_PLAYER, "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(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); return false; } @@ -2426,7 +2426,7 @@ void Player::RemoveFromWorld() { if (WorldObject* viewpoint = GetViewpoint()) { - sLog->outFatal(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(), viewpoint->GetEntry(), viewpoint->GetTypeId()); SetViewpoint(viewpoint, false); } } @@ -3355,7 +3355,7 @@ void Player::SendInitialSpells() GetSession()->SendPacket(&data); - sLog->outInfo(LOG_FILTER_PLAYER, "CHARACTER: Sent Initial Spells"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CHARACTER: Sent Initial Spells"); } void Player::RemoveMail(uint32 id) @@ -3436,7 +3436,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3445,7 +3445,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3455,7 +3455,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3464,7 +3464,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); return false; } @@ -3509,7 +3509,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3518,7 +3518,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3528,7 +3528,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3537,7 +3537,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); return false; } @@ -4291,7 +4291,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) if (!sSpellMgr->GetSpellInfo(spell_id)) { - sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); continue; } @@ -5003,7 +5003,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) if (result) { - sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); + sLog->outDebug(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); do { Field* fields = result->Fetch(); @@ -5418,7 +5418,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { - sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); return TotalCost; } @@ -5426,7 +5426,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { - sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); return TotalCost; } @@ -5442,7 +5442,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g { if (GetGuildId() == 0) { - sLog->outDebug(LOG_FILTER_PLAYER, "You are not member of a guild"); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You are not member of a guild"); return TotalCost; } @@ -5457,7 +5457,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g } else if (!HasEnoughMoney(costs)) { - sLog->outDebug(LOG_FILTER_PLAYER, "You do not have enough money"); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You do not have enough money"); return TotalCost; } else @@ -5665,7 +5665,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa { if (modGroup >= BASEMOD_END || modType >= MOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); return; } @@ -5696,7 +5696,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { if (modGroup >= BASEMOD_END || modType > MOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "trial to access non existed BaseModGroup or wrong BaseModType!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!"); return 0.0f; } @@ -5710,7 +5710,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const { if (modGroup >= BASEMOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "wrong BaseModGroup in GetTotalBaseModValue()!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "wrong BaseModGroup in GetTotalBaseModValue()!"); return 0.0f; } @@ -6432,7 +6432,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id); if (!pSkill) { - sLog->outError(LOG_FILTER_PLAYER, "Skill not found in SkillLineStore: skill #%u", id); + sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Skill not found in SkillLineStore: skill #%u", id); return; } @@ -6592,8 +6592,6 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const void Player::SendActionButtons(uint32 state) const { - sLog->outInfo(LOG_FILTER_PLAYER, "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); - WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4)); data << uint8(state); /* @@ -6615,20 +6613,20 @@ void Player::SendActionButtons(uint32 state) const } GetSession()->SendPacket(&data); - sLog->outInfo(LOG_FILTER_PLAYER, "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); + sLog->outInfo(LOG_FILTER_NETWORKIO, "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); } bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= 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(), 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); return false; } if (action >= 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(), 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); return false; } @@ -6637,7 +6635,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName()); return false; } @@ -6650,7 +6648,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName()); return false; } break; @@ -6672,7 +6670,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, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); return &ab; } @@ -6687,7 +6685,7 @@ void Player::removeActionButton(uint8 button) else buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save - sLog->outInfo(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); } ActionButton const* Player::GetActionButton(uint8 button) @@ -7698,7 +7696,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) if (item->IsBroken()) return; - sLog->outInfo(LOG_FILTER_PLAYER, "applying mods for item %u ", item->GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, "applying mods for item %u ", item->GetGUIDLow()); uint8 attacktype = Player::GetAttackBySlot(slot); @@ -8290,7 +8288,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - sLog->outError(LOG_FILTER_PLAYER, "WORLD: unknown Item spellid %i", spellData.SpellId); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown Item spellid %i", spellData.SpellId); continue; } @@ -8359,7 +8357,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", + 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]); continue; } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index e4926bfad2e..7451bd2dc2a 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -658,8 +658,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte SendPacket(&data); std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + 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()); @@ -716,15 +715,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) return; std::string IP_str = GetRemoteAddress(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->ShouldLog(LOG_FILTER_PLAYER_DELETE, LOG_LEVEL_INFO)) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_CHARACTER, LOG_LEVEL_DEBUG)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outInfo(LOG_FILTER_PLAYER_DELETE, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + sLog->outDebug(LOG_FILTER_CHARACTER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } Player::DeleteFromDB(guid, GetAccountId()); @@ -1002,7 +1001,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + 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()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) @@ -1179,7 +1178,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu CharacterDatabase.Execute(stmt); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1)); data << uint8(RESPONSE_SUCCESS); @@ -1446,7 +1445,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) if (result) { std::string oldname = result->Fetch()[0].GetString(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); } Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 6fdbf8a5358..118b0d68d5d 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -534,7 +534,7 @@ 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_PLAYER_LOADING, "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(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index db975419a23..1024a3acf15 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -111,7 +111,7 @@ public: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); if (handler->GetSession()) { - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password." + 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()); } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 355ff195cf5..7f25a11bcdd 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1325,7 +1325,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - sLog->outInfo(LOG_FILTER_SQL, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + sLog->outInfo(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); return true; diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index d86b99a062a..9d6fabb9dfa 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -64,7 +64,7 @@ class DatabaseWorkerPool bool res = true; _connectionInfo = MySQLConnectionInfo(infoString); - sLog->outWarn(LOG_FILTER_SQL, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", GetDatabaseName(), async_threads, synch_threads); //! Open asynchronous connections (delayed operations) @@ -88,17 +88,17 @@ class DatabaseWorkerPool } if (res) - sLog->outWarn(LOG_FILTER_SQL, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC])); else - sLog->outError(LOG_FILTER_SQL, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " + sLog->outError(LOG_FILTER_SQL_DRIVER, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " "for specific errors.", GetDatabaseName()); return res; } void Close() { - sLog->outWarn(LOG_FILTER_SQL, "Closing down DatabasePool '%s'.", GetDatabaseName()); + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Closing down DatabasePool '%s'.", GetDatabaseName()); //! Shuts down delaythreads for this connection pool by underlying deactivate(). //! The next dequeue attempt in the worker thread tasks will result in an error, @@ -114,7 +114,7 @@ class DatabaseWorkerPool t->Close(); //! Closes the actualy MySQL connection. } - sLog->outWarn(LOG_FILTER_SQL, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", GetDatabaseName()); //! Shut down the synchronous connections @@ -127,7 +127,7 @@ class DatabaseWorkerPool //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue delete _queue; - sLog->outWarn(LOG_FILTER_SQL, "All connections on DatabasePool '%s' closed.", GetDatabaseName()); + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "All connections on DatabasePool '%s' closed.", GetDatabaseName()); } /** @@ -351,10 +351,10 @@ class DatabaseWorkerPool switch (transaction->GetSize()) { case 0: - sLog->outWarn(LOG_FILTER_SQL, "Transaction contains 0 queries. Not executing."); + sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Transaction contains 0 queries. Not executing."); return; case 1: - sLog->outWarn(LOG_FILTER_SQL, "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); + sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); break; default: break; diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index abb2649c468..be30a54ff02 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -201,8 +201,14 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "GAMEEVENTS"; case LOG_FILTER_CALENDAR: return "CALENDAR"; - case LOG_FILTER_PLAYER_DELETE: - return "PLAYER_DELETE"; + case LOG_FILTER_CHARACTER: + return "CHARACTER"; + case LOG_FILTER_ARENAS: + return "ARENAS"; + case LOG_FILTER_SQL_DRIVER: + return "SQL DRIVER"; + case LOG_FILTER_SQL_DEV: + return "SQL DEV"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 323da3f2be8..7d7375a1edb 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -59,10 +59,13 @@ enum LogFilterType LOG_FILTER_WORLDSERVER, LOG_FILTER_GAMEEVENTS, LOG_FILTER_CALENDAR, - LOG_FILTER_PLAYER_DELETE + LOG_FILTER_CHARACTER, + LOG_FILTER_ARENAS, + LOG_FILTER_SQL_DRIVER, + LOG_FILTER_SQL_DEV }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_PLAYER_DELETE) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_SQL_DEV) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index cce670922f4..c9ba159cdea 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -19,7 +19,7 @@ #include "Log.h" #include "Common.h" #include "Config.h" - +#include "Util.h" #include "AppenderConsole.h" #include "AppenderFile.h" #include "AppenderDB.h" @@ -82,30 +82,66 @@ void Log::CreateAppenderFromConfig(const char* name) if (!name || *name == '\0') return; - std::string base = "Appender."; - base.append(name); - base.push_back('.'); + // Format=type,level,flags,optional1,optional2 + // if type = File. optional1 = file and option2 = mode + // if type = Console. optional1 = Color + std::string options = "Appender."; + options.append(name); + options = ConfigMgr::GetStringDefault(options.c_str(), ""); + Tokens tokens(options, ','); + Tokens::iterator iter = tokens.begin(); + + if (tokens.size() < 2) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name, options.c_str()); + return; + } - LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); - AppenderType type = AppenderType(GetConfigIntDefault(base, "Type", 0)); + AppenderFlags flags = APPENDER_FLAGS_NONE; + AppenderType type = AppenderType(atoi(*iter)); + ++iter; + LogLevel level = LogLevel(atoi(*iter)); + if (level > LOG_LEVEL_FATAL) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %u for appender %s\n", level, name); + return; + } - switch(type) + if (++iter != tokens.end()) + flags = AppenderFlags(atoi(*iter)); + + switch (type) { case APPENDER_CONSOLE: { - AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + if (flags == APPENDER_FLAGS_NONE) + flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE); + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; - - appender->InitColors(GetConfigStringDefault(base, "Colors", "")); + if (++iter != tokens.end()) + appender->InitColors(*iter); //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe break; } case APPENDER_FILE: { - std::string filename = GetConfigStringDefault(base, "File", ""); - std::string mode = GetConfigStringDefault(base, "Mode", "a"); - AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_TIMESTAMP | APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + std::string filename; + std::string mode = "a"; + + if (++iter == tokens.end()) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name); + return; + } + + if (flags == APPENDER_FLAGS_NONE) + flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE | APPENDER_FLAGS_PREFIX_TIMESTAMP); + + filename = *iter; + + if (++iter != tokens.end()) + mode = *iter; if (flags & APPENDER_FLAGS_USE_TIMESTAMP) { @@ -121,13 +157,14 @@ void Log::CreateAppenderFromConfig(const char* name) //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe break; } - case APPENDER_DB: // TODO Set realm! + case APPENDER_DB: { uint8 id = NextAppenderId(); appenders[id] = new AppenderDB(id, name, level, realm); break; } default: + fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %u for appender %s\n", type, name); break; } } @@ -137,29 +174,49 @@ void Log::CreateLoggerFromConfig(const char* name) if (!name || *name == '\0') return; - std::string base = "Logger."; - base.append(name); - base.push_back('.'); + LogLevel level = LOG_LEVEL_DISABLED; + int32 type = -1; - LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); - int32 type = GetConfigIntDefault(base, "Type", -1); + std::string options = "Logger."; + options.append(name); + options = ConfigMgr::GetStringDefault(options.c_str(), ""); - if (type < 0) + Tokens tokens(options, ','); + Tokens::iterator iter = tokens.begin(); + + if (tokens.size() != 3) { - fprintf(stderr, "Log::CreateLoggerFromConfig: Missing entry %sType in config. Logger ignored\n", name); + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong configuration for logger %s. Config line: %s\n", name, options.c_str()); return; } - Logger& logger = loggers[type]; + type = atoi(*iter); + if (type > MaxLogFilter) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong type %u for logger %s\n", type, name); + return; + } + Logger& logger = loggers[type]; if (!logger.getName().empty()) - fprintf(stderr, "Error while configuring Logger %s. Replacing (name: %s, Type: %u, Level: %u) with (name: %s, Type: %u, Level: %u)\n", - name, logger.getName().c_str(), logger.getType(), logger.getLogLevel(), name, type, level); + { + fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name); + return; + } + + ++iter; + level = LogLevel(atoi(*iter)); + if (level > LOG_LEVEL_FATAL) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name); + return; + } logger.Create(name, LogFilterType(type), level); //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe - std::istringstream ss(GetConfigStringDefault(base, "Appenders", "")); + ++iter; + std::istringstream ss(*iter); std::string str; ss >> str; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 3fe9ab4c37e..be5a452c7b4 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1148,15 +1148,6 @@ Warden.NumMemChecks = 3 Warden.NumOtherChecks = 7 -# -# Warden.LogFile -# Description: Client check fails will be logged here. -# Default: "" - (Disabled) -# "Warden.log" - (Enabled) -# - -Warden.LogFile = "" - # # Warden.ClientResponseDelay # Description: Time (in seconds) before client is getting disconnecting for not responding. @@ -2580,174 +2571,186 @@ PlayerDump.DisallowOverwrite = 1 ################################################################################################### # # Logging system options. -# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. -# # -# Appender config values: Given a appender "name" the following options -# can be read: -# -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) -# -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# Colors: 0 - BLACK -# 1 - RED -# 2 - GREEN -# 3 - BROWN -# 4 - BLUE -# 5 - MAGENTA -# 6 - CYAN -# 7 - GREY -# 8 - YELLOW -# 9 - LRED -# 10 - LGREEN -# 11 - LBLUE -# 12 - LMAGENTA -# 13 - LCYAN -# 14 - WHITE -# Example: "13 11 9 5 3 1" -# -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) -# -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) -# -# Appender.name.Flags -# Description: -# Default: Console = 6, File = 7, DB = 0 -# 0 - None -# 1 - Prefix Timestamp to the text -# 2 - Prefix Log Level to the text -# 4 - Prefix Log Filter type to the text -# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) -# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) -# -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 1 - Units that doesn't fit in other categories -# 2 - Pets -# 3 - Vehicles -# 4 - C++ AI, instance scripts, etc. -# 5 - DB AI, such as SAI, EAI, CreatureAI -# 6 - DB map scripts -# 7 - Network input/output, -# such as packet handlers and netcode logs -# 8 - Spellsystem and aurasystem -# 9 - Achievement system -# 10 - Condition system -# 11 - Pool system -# 12 - Auction house -# 13 - Arena's and battlegrounds -# 14 - Outdoor PVP -# 15 - Chat system -# 16 - LFG system -# 17 - Maps, instances (not scripts), -# grids, cells, visibility, etc. -# 18 - Player that doesn't fit in other categories. -# 19 - Player loading from DB -# (Player::_LoadXXX functions) -# 20 - Items -# 21 - Player skills (do not confuse with spells) -# 22 - Player chat logs -# 23 - loot -# 24 - guilds -# 25 - transports -# 26 - SQL. DB errors and SQL Driver -# 27 - GM Commands -# 28 - Remote Access Commands -# 29 - Warden -# 30 - Authserver -# 31 - Worldserver -# 32 - Game Events -# 33 - Calendar -# 34 - Player delete -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: List of appenders linked to logger +# Appender config values: Given a appender "name" +# Appender.name +# Description: Defines 'where to log' +# Format: Type,LogLevel,Flags,optional1,optional2 +# +# Type +# 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Flags: Default Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) +# +# Colors (read as optional1 if Type = Console) +# Format: "fatal error warn info debug trace" +# 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# File: Name of the file (read as optional1 if Type = File) +# Allows to use one "%u" to create dynamic files +# +# Mode: Mode to open the file (read as optional2 if Type = File) +# a - (Append) +# w - (Overwrite) +# + +Appender.Console=1,2,6 +Appender.Server=2,2,7,Server.log,w +Appender.GM=2,2,7,GM.log +Appender.SQL=2,2,7,SQL.log +Appender.DBErrors=2,2,7,DBErrors.log +Appender.Char=2,2,7,Char.log,w +Appender.RA=2,2,7,RA.log +Appender.Arenas=2,2,7,Arena.log +Appender.SQLDev=2,2,7,SQLDev.log +Appender.SQLDriver=2,2,7,SQLDriver.log +Appender.Warden=2,2,7,Warden.log +Appender.Chat=2,2,7,Chat.log + +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 1 - Units that doesn't fit in other categories +# 2 - Pets +# 3 - Vehicles +# 4 - C++ AI, instance scripts, etc. +# 5 - DB AI, such as SAI, EAI, CreatureAI +# 6 - DB map scripts +# 7 - Network input/output, +# such as packet handlers and netcode logs +# 8 - Spellsystem and aurasystem +# 9 - Achievement system +# 10 - Condition system +# 11 - Pool system +# 12 - Auction house +# 13 - Arena's and battlegrounds +# 14 - Outdoor PVP +# 15 - Chat system +# 16 - LFG system +# 17 - Maps, instances (not scripts), +# grids, cells, visibility, etc. +# 18 - Player that doesn't fit in other categories. +# 19 - Player loading from DB +# (Player::_LoadXXX functions) +# 20 - Items +# 21 - Player skills (do not confuse with spells) +# 22 - Player chat logs +# 23 - loot +# 24 - guilds +# 25 - transports +# 26 - SQL. DB errors +# 27 - GM Commands +# 28 - Remote Access Commands +# 29 - Warden +# 30 - Authserver +# 31 - Worldserver +# 32 - Game Events +# 33 - Calendar +# 34 - Character (Exclusive to log login, logout, create, rename, delete actions) +# 35 - Arenas +# 36 - SQL Driver +# 37 - SQL Dev + +Logger.Root=0,5,Console Server +Logger.Units=1,3,Console Server +Logger.Pets=2,3,Console Server +Logger.Vehicles=3,3,Console Server +Logger.TCSR=4,3,Console Server +Logger.AI=5,3,Console Server +Logger.MapScripts=6,3,Console Server +Logger.NetWork=7,3,Console Server +Logger.Spells=8,3,Console Server +Logger.Achievements=9,3,Console Server +Logger.Conditions=10,3,Console Server +Logger.Pool=11,3,Console Server +Logger.AuctionHouse=12,3,Console Server +Logger.Battlegrounds=13,3,Console Server +Logger.OutdoorPvP=14,3,Console Server +Logger.ChatSystem=15,3,Console Server +Logger.LFG=16,3,Console Server +Logger.Maps=17,3,Console Server +Logger.Player=18,3,Console Server +Logger.PlayerLoading=19,3,Console Server +Logger.PlayerItems=20,3,Console Server +Logger.PlayerSkills=21,3,Console Server +Logger.PlayerChat=22,3,Chat +Logger.Loot=23,3,Console Server +Logger.Guilds=24,3,Console Server +Logger.Transports=25,3,Console Server +Logger.SQL=26,2,Console Server SQL +Logger.GM=27,3,Console Server GM +Logger.RA=28,3,RA +Logger.Warden=29,3,Warden +Logger.Authserver=30,3,Console Server +Logger.Worldserver=31,3,Console Server +Logger.GameEvents=32,3,Console Server +Logger.Calendar=33,3,Console Server +Logger.Character=34,3,Char +Logger.Arenas=35,3,Arenas +Logger.SQLDriver=36,5,SQLDriver +Logger.SQLDev=37,3,SQLDev + +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# AppenderList: List of appenders linked to logger # (Using spaces as separator). # # Appenders # Description: List of Appenders to read from config # (Using spaces as separator). # Default: "Console Server" + +Appenders=Console Server + # # Loggers # Description: List of Loggers to read from config # (Using spaces as separator). # Default: "root" -Loggers=root GM SQL -Appenders=Console Server GM SQL - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Server.Type=2 -Appender.Server.Level=2 -Appender.Server.File=Server.log -Appender.Server.Mode=w - -Appender.GM.Type=2 -Appender.GM.Level=2 -Appender.GM.File=gm_#%u.log - -Appender.SQL.Type=2 -Appender.SQL.Level=2 -Appender.SQL.File=SQL.log - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Server - -Logger.SQL.Type=26 -Logger.SQL.Level=3 -Logger.SQL.Appenders=Console Server SQL - -Logger.GM.Type=27 -Logger.GM.Level=3 -Logger.GM.Appenders=Console Server GM +Loggers=Root -- cgit v1.2.3 From 6d21515939388c5f24e3954880a21bea10c35173 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 13:20:24 +0200 Subject: Core/Logging: Implement logging to database --- sql/updates/auth/2012_08_06_00_auth_logs.sql | 2 ++ src/server/shared/Logging/AppenderDB.cpp | 27 +++++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 sql/updates/auth/2012_08_06_00_auth_logs.sql (limited to 'src') diff --git a/sql/updates/auth/2012_08_06_00_auth_logs.sql b/sql/updates/auth/2012_08_06_00_auth_logs.sql new file mode 100644 index 00000000000..04e90e7d208 --- /dev/null +++ b/sql/updates/auth/2012_08_06_00_auth_logs.sql @@ -0,0 +1,2 @@ +ALTER TABLE `logs` ADD COLUMN `level` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `type`; + diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 63af9176193..0254ec72bd0 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -16,12 +16,7 @@ */ #include "AppenderDB.h" - -/* FIXME -#include "DatabaseWorkerPool.h" -#include "Implementation/LoginDatabase.h" // For logging -extern DatabaseWorkerPool LoginDatabase; -*/ +#include "Database/DatabaseEnv.h" AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, uint8 realmId): Appender(id, name, APPENDER_DB, level), realm(realmId), enable(false) @@ -32,13 +27,21 @@ AppenderDB::~AppenderDB() { } -void AppenderDB::_write(LogMessage& /*message*/) +void AppenderDB::_write(LogMessage& message) { -/* FIXME - if (enable) - LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, severity, string) " - "VALUES (" UI64FMTD ", %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); -*/ + if (!enable) + return; + switch (message.type) + { + case LOG_FILTER_SQL: + case LOG_FILTER_SQL_DRIVER: + case LOG_FILTER_SQL_DEV: + break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type + default: + LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, level, string) " + "VALUES (" UI64FMTD ", %u, %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); + break; + } } void AppenderDB::setEnable(bool _enable) -- cgit v1.2.3 From 156d1e7b3c5201fd9d7c2510d2f40ec5adf90a84 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 13:23:09 +0200 Subject: Core/SQL: Kill core if error 1064 is triggered (error code 1064 you have an error in your sql syntax). This means the sql has an build error and core fix is needed --- src/server/shared/Database/MySQLConnection.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 7332cb3ec01..c6d2a165ca2 100755 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -520,7 +520,11 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) ACE_OS::sleep(10); std::abort(); return false; - + case ER_PARSE_ERROR: + sLog->outError(LOG_FILTER_SQL, "Error while parsing SQL. Core fix required."); + ACE_OS::sleep(10); + std::abort(); + return false; default: sLog->outError(LOG_FILTER_SQL, "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo); return false; -- cgit v1.2.3 From 4a5a077b655664e2daa98dfe3e7e781605734027 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 13:36:34 +0200 Subject: Core/Logging: Use prepared statements in AppenderDB --- src/server/shared/Database/Implementation/LoginDatabase.cpp | 2 +- src/server/shared/Logging/AppenderDB.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 028d927a720..31d9f5ec1f6 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -59,7 +59,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 0254ec72bd0..8836be2b24a 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -37,9 +37,14 @@ void AppenderDB::_write(LogMessage& message) case LOG_FILTER_SQL_DRIVER: case LOG_FILTER_SQL_DEV: break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type - default: - LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, level, string) " - "VALUES (" UI64FMTD ", %u, %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); + default: + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(LOGIN_INS_LOG); + stmt->setUInt64(0, message.mtime); + stmt->setUInt32(1, realm); + stmt->setUInt8(2, message.type); + stmt->setUInt8(3, message.level); + stmt->setString(4, message.text); + LoginDatabase.Execute(stmt); break; } } -- cgit v1.2.3 From 5aa54ca0e97b48194376e504ad5d2b91cc8abdd1 Mon Sep 17 00:00:00 2001 From: kandera Date: Mon, 6 Aug 2012 13:02:11 -0300 Subject: Update src/server/shared/Logging/AppenderDB.cpp Core/Appender: fix typo --- src/server/shared/Logging/AppenderDB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 8836be2b24a..76abfca2d85 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -38,7 +38,7 @@ void AppenderDB::_write(LogMessage& message) case LOG_FILTER_SQL_DEV: break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type default: - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(LOGIN_INS_LOG); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); stmt->setUInt64(0, message.mtime); stmt->setUInt32(1, realm); stmt->setUInt8(2, message.type); -- cgit v1.2.3 From 429130522e223c8a5cd80d6e23fda4cc30ce5132 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 7 Aug 2012 04:21:58 +0200 Subject: Core/Authserver: Fix logging crash at startup --- src/server/shared/Logging/Log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index c9ba159cdea..1dca5e71006 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -29,7 +29,7 @@ #include #include -Log::Log() +Log::Log() : worker(NULL) { SetRealmID(0); m_logsTimestamp = "_" + GetTimestampStr(); -- cgit v1.2.3 From f8cd39b2ed1056f409c2690ac8bb661fbcb68e18 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 7 Aug 2012 17:45:10 +0200 Subject: Core/Players: Improved alcohol handling, weeeeeeeeeeeeeeeee Closes #7293 --- sql/base/characters_database.sql | 2 +- .../2012_08_07_00_characters_characters.sql | 2 + src/server/game/Entities/Player/Player.cpp | 62 +++++++++++----------- src/server/game/Entities/Player/Player.h | 7 ++- src/server/game/Spells/SpellEffects.cpp | 14 ++--- src/server/scripts/Commands/cs_modify.cpp | 15 ++---- 6 files changed, 49 insertions(+), 53 deletions(-) create mode 100644 sql/updates/characters/2012_08_07_00_characters_characters.sql (limited to 'src') diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index b4a3af6e8ff..bbd5a70e933 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -1177,7 +1177,7 @@ CREATE TABLE `characters` ( `chosenTitle` int(10) unsigned NOT NULL DEFAULT '0', `knownCurrencies` bigint(20) unsigned NOT NULL DEFAULT '0', `watchedFaction` int(10) unsigned NOT NULL DEFAULT '0', - `drunk` smallint(5) unsigned NOT NULL DEFAULT '0', + `drunk` tinyint(3) unsigned NOT NULL DEFAULT '0', `health` int(10) unsigned NOT NULL DEFAULT '0', `power1` int(10) unsigned NOT NULL DEFAULT '0', `power2` int(10) unsigned NOT NULL DEFAULT '0', diff --git a/sql/updates/characters/2012_08_07_00_characters_characters.sql b/sql/updates/characters/2012_08_07_00_characters_characters.sql new file mode 100644 index 00000000000..e9bea82ad4b --- /dev/null +++ b/sql/updates/characters/2012_08_07_00_characters_characters.sql @@ -0,0 +1,2 @@ +UPDATE characters SET drunk = (drunk / 256) & 0xFF; +ALTER TABLE characters CHANGE drunk drunk tinyint(3) unsigned NOT NULL DEFAULT '0'; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 0731046892d..72c500513cd 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -726,7 +726,6 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep m_MirrorTimerFlagsLast = UNDERWATER_NONE; m_isInWater = false; m_drunkTimer = 0; - m_drunk = 0; m_restTime = 0; m_deathTimer = 0; m_deathExpireTime = 0; @@ -1458,49 +1457,51 @@ void Player::HandleDrowning(uint32 time_diff) m_MirrorTimerFlagsLast = m_MirrorTimerFlags; } -///The player sobers by 256 every 10 seconds +///The player sobers by 1% every 9 seconds void Player::HandleSobering() { m_drunkTimer = 0; - uint32 drunk = (m_drunk <= 256) ? 0 : (m_drunk - 256); + uint8 currentDrunkValue = GetDrunkValue(); + uint8 drunk = currentDrunkValue ? --currentDrunkValue : 0; SetDrunkValue(drunk); } -DrunkenState Player::GetDrunkenstateByValue(uint16 value) +DrunkenState Player::GetDrunkenstateByValue(uint8 value) { - if (value >= 23000) + if (value >= 90) return DRUNKEN_SMASHED; - if (value >= 12800) + if (value >= 50) return DRUNKEN_DRUNK; - if (value & 0xFFFE) + if (value) return DRUNKEN_TIPSY; return DRUNKEN_SOBER; } -void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId) +void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/) { - uint32 oldDrunkenState = Player::GetDrunkenstateByValue(m_drunk); + bool isSobering = newDrunkValue < GetDrunkValue(); + uint32 oldDrunkenState = Player::GetDrunkenstateByValue(GetDrunkValue()); + if (newDrunkValue > 100) + newDrunkValue = 100; // select drunk percent or total SPELL_AURA_MOD_FAKE_INEBRIATE amount, whichever is higher for visibility updates - int32 drunkPercent = newDrunkenValue * 100 / 0xFFFF; - drunkPercent = std::max(drunkPercent, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE)); - + int32 drunkPercent = std::max(newDrunkValue, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE)); if (drunkPercent) { m_invisibilityDetect.AddFlag(INVISIBILITY_DRUNK); m_invisibilityDetect.SetValue(INVISIBILITY_DRUNK, drunkPercent); } - else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkenValue) + else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkValue) m_invisibilityDetect.DelFlag(INVISIBILITY_DRUNK); - m_drunk = newDrunkenValue; - SetUInt32Value(PLAYER_BYTES_3, (GetUInt32Value(PLAYER_BYTES_3) & 0xFFFF0001) | (m_drunk & 0xFFFE)); - - uint32 newDrunkenState = Player::GetDrunkenstateByValue(m_drunk); - + uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue); + SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue); UpdateObjectVisibility(); + if (!isSobering) + m_drunkTimer = 0; // reset sobering timer + if (newDrunkenState == oldDrunkenState) return; @@ -1508,7 +1509,6 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId) data << uint64(GetGUID()); data << uint32(newDrunkenState); data << uint32(itemId); - SendMessageToSet(&data, true); } @@ -1749,11 +1749,10 @@ void Player::Update(uint32 p_time) m_Last_tick = now; } - if (m_drunk) + if (GetDrunkValue()) { m_drunkTimer += p_time; - - if (m_drunkTimer > 10*IN_MILLISECONDS) + if (m_drunkTimer > 9 * IN_MILLISECONDS) HandleSobering(); } @@ -16748,7 +16747,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetUInt32Value(PLAYER_BYTES, fields[9].GetUInt32()); SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32()); - SetUInt32Value(PLAYER_BYTES_3, (fields[49].GetUInt16() & 0xFFFE) | fields[5].GetUInt8()); + SetByteValue(PLAYER_BYTES_3, 0, fields[5].GetUInt8()); + SetByteValue(PLAYER_BYTES_3, 1, fields[49].GetUInt8()); SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32()); SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetUInt32()); @@ -17058,13 +17058,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // set value, including drunk invisibility detection // calculate sobering. after 15 minutes logged out, the player will be sober again - float soberFactor; - if (time_diff > 15*MINUTE) - soberFactor = 0; - else - soberFactor = 1-time_diff/(15.0f*MINUTE); - uint16 newDrunkenValue = uint16(soberFactor*(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE)); - SetDrunkValue(newDrunkenValue); + uint8 newDrunkValue = 0; + if (time_diff < GetDrunkValue() * 9) + newDrunkValue = GetDrunkValue() - time_diff / 9; + + SetDrunkValue(newDrunkValue); m_cinematic = fields[18].GetUInt8(); m_Played_time[PLAYED_TIME_TOTAL]= fields[19].GetUInt32(); @@ -18658,7 +18656,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE)); stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES)); stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX)); - stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE)); + stmt->setUInt8(index++, GetDrunkValue()); stmt->setUInt32(index++, GetHealth()); for (uint32 i = 0; i < MAX_POWERS; ++i) @@ -18769,7 +18767,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE)); stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES)); stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX)); - stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE)); + stmt->setUInt8(index++, GetDrunkValue()); stmt->setUInt32(index++, GetHealth()); for (uint32 i = 0; i < MAX_POWERS; ++i) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 774e75104b1..413d7fae32c 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2050,9 +2050,9 @@ class Player : public Unit, public GridObject inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; } - void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0); - uint16 GetDrunkValue() const { return m_drunk; } - static DrunkenState GetDrunkenstateByValue(uint16 value); + void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0); + uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, 1); } + static DrunkenState GetDrunkenstateByValue(uint8 value); uint32 GetDeathTimer() const { return m_deathTimer; } uint32 GetCorpseReclaimDelay(bool pvp) const; @@ -2720,7 +2720,6 @@ class Player : public Unit, public GridObject time_t m_lastDailyQuestTime; uint32 m_drunkTimer; - uint16 m_drunk; uint32 m_weaponChangeTimer; uint32 m_zoneUpdateId; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 484d03f1504..d30f6e593dd 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4772,16 +4772,18 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player* player = (Player*)unitTarget; - uint16 currentDrunk = player->GetDrunkValue(); - uint16 drunkMod = damage * 256; - if (currentDrunk + drunkMod > 0xFFFF) + Player* player = unitTarget->ToPlayer(); + uint8 currentDrunk = player->GetDrunkValue(); + uint8 drunkMod = damage; + if (currentDrunk + drunkMod > 100) { - currentDrunk = 0xFFFF; - player->CastSpell(player, 67468, false); + currentDrunk = 100; + if (rand_chance() < 25.0f) + player->CastSpell(player, 67468, false); // Drunken Vomit } else currentDrunk += drunkMod; + player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0); } diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 1747b80efd5..a88c765c596 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1130,20 +1130,15 @@ public: static bool HandleModifyDrunkCommand(ChatHandler* handler, const char* args) { - if (!*args) return false; + if (!*args) + return false; - uint32 drunklevel = (uint32)atoi(args); + uint8 drunklevel = (uint8)atoi(args); if (drunklevel > 100) drunklevel = 100; - uint16 drunkMod = drunklevel * 0xFFFF / 100; - - Player* target = handler->getSelectedPlayer(); - if (!target) - target = handler->GetSession()->GetPlayer(); - - if (target) - target->SetDrunkValue(drunkMod); + if (Player* target = handler->getSelectedPlayer()) + target->SetDrunkValue(drunklevel); return true; } -- cgit v1.2.3 From 78fdeca8518506328209654d1fa503a7cd649ff1 Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 9 Aug 2012 12:54:35 +0200 Subject: Core/Logging: Fix crash in AppenderFile deconstructor when logfile is uninitialized --- src/server/shared/Logging/AppenderFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index d66771b9055..d47a7c4028d 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -26,8 +26,8 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, co { dynamicName = std::string::npos != filename.find("%u"); backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; - if (!dynamicName) - logfile = OpenFile(_filename, _mode, backup); + + logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL; } AppenderFile::~AppenderFile() -- cgit v1.2.3 From ca0a54f3572e91f75f880ff9b8e74c450f7d9c36 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 9 Aug 2012 14:31:09 +0200 Subject: Core/Logging: Fixed a possible crash with dynamic log file names --- src/server/shared/Logging/Appender.h | 2 +- src/server/shared/Logging/AppenderFile.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 7d7375a1edb..332edbf170c 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -139,7 +139,7 @@ class Appender static const char* getLogFilterTypeString(LogFilterType type); private: - virtual void _write(LogMessage& /*message*/) {}; + virtual void _write(LogMessage& /*message*/) = 0; uint8 id; std::string name; diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index d47a7c4028d..01a2f34baa7 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -26,7 +26,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, co { dynamicName = std::string::npos != filename.find("%u"); backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; - + logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL; } @@ -54,7 +54,10 @@ void AppenderFile::_write(LogMessage& message) fflush(logfile); if (dynamicName) + { fclose(logfile); + logfile = NULL; + } } } -- cgit v1.2.3 From a3adf6a2b95427b7e6322b62e53a2fbf6ced7871 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sat, 11 Aug 2012 16:53:43 +0200 Subject: Scripts/Grizzly Hills: Fix uninitialized variable in npc_venture_co_straggler. minor cleanup --- src/server/scripts/Northrend/grizzly_hills.cpp | 147 ++++++++++++------------- 1 file changed, 73 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 1a0f6b57375..4ca12bc82a1 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -600,100 +600,99 @@ enum eSmokeEmOut QUEST_SMOKE_EM_OUT_H = 12324, SPELL_SMOKE_BOMB = 49075, SPELL_CHOP = 43410, - NPC_VENTURE_CO_STABLES_KC = 27568, + SPELL_VENTURE_STRAGGLER_CREDIT = 49093, }; class npc_venture_co_straggler : public CreatureScript { -public: - npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_venture_co_stragglerAI(creature); - } + public: + npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { } - struct npc_venture_co_stragglerAI : public ScriptedAI - { - npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { } + struct npc_venture_co_stragglerAI : public ScriptedAI + { + npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { } - uint64 uiPlayerGUID; - uint32 uiRunAwayTimer; - uint32 uiTimer; - uint32 uiChopTimer; + uint64 uiPlayerGUID; + uint32 uiRunAwayTimer; + uint32 uiTimer; + uint32 uiChopTimer; - void Reset() - { - uiPlayerGUID = 0; - uiTimer = 0; - uiChopTimer = urand(10000, 12500); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - } + void Reset() + { + uiPlayerGUID = 0; + uiTimer = 0; + uiRunAwayTimer = 0; + uiChopTimer = urand(10000, 12500); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetReactState(REACT_AGGRESSIVE); + } - void UpdateAI(const uint32 uiDiff) - { - if (uiRunAwayTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID)) + if (uiPlayerGUID && uiRunAwayTimer <= uiDiff) { - switch (uiTimer) + if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID)) { - case 0: - if (player->GetQuestStatus(QUEST_SMOKE_EM_OUT_A) == QUEST_STATUS_INCOMPLETE || - player->GetQuestStatus(QUEST_SMOKE_EM_OUT_H) == QUEST_STATUS_INCOMPLETE) - player->KilledMonsterCredit(NPC_VENTURE_CO_STABLES_KC, 0); - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ()); - uiRunAwayTimer = 2500; - ++uiTimer; - break; - case 1: - DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me); - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ()); - uiRunAwayTimer = 2500; - ++uiTimer; - break; - case 2: - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ()); - uiRunAwayTimer = 2500; - ++uiTimer; - break; - case 3: - me->DisappearAndDie(); - uiTimer = 0; - break; + switch (uiTimer) + { + case 0: + DoCast(player, SPELL_VENTURE_STRAGGLER_CREDIT); + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ()); + uiRunAwayTimer = 2500; + ++uiTimer; + break; + case 1: + DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me); + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ()); + uiRunAwayTimer = 2500; + ++uiTimer; + break; + case 2: + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ()); + uiRunAwayTimer = 2500; + ++uiTimer; + break; + case 3: + me->DisappearAndDie(); + uiTimer = 0; + break; + } } } - } - else - uiRunAwayTimer -= uiDiff; + else if (uiRunAwayTimer) + uiRunAwayTimer -= uiDiff; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (uiChopTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CHOP); - uiChopTimer = urand(10000, 12000); - } - else - uiChopTimer -= uiDiff; + if (uiChopTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CHOP); + uiChopTimer = urand(10000, 12000); + } + else + uiChopTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void SpellHit(Unit* pCaster, const SpellInfo* pSpell) - { - if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_SMOKE_BOMB) + void SpellHit(Unit* caster, SpellInfo const* spell) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - me->CombatStop(false); - uiPlayerGUID = pCaster->GetGUID(); - uiRunAwayTimer = 3500; + if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetReactState(REACT_PASSIVE); + me->CombatStop(false); + uiPlayerGUID = caster->GetGUID(); + uiRunAwayTimer = 3500; + } } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_venture_co_stragglerAI(creature); } - }; }; void AddSC_grizzly_hills() -- cgit v1.2.3 From 666602e1aad855d80ff0657ad80ffe60f5054ea9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 12 Aug 2012 13:56:43 +0200 Subject: Scripts: Fixed some unitialized variables --- src/server/scripts/Kalimdor/moonglade.cpp | 5 ++++- src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 9df208d2578..3c8d2267903 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -296,7 +296,10 @@ public: struct npc_clintar_spiritAI : public npc_escortAI { public: - npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {} + npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) + { + PlayerGUID = 0; + } uint8 Step; uint32 CurrWP; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 654d763ddbc..2f37fb06f24 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -134,6 +134,7 @@ class instance_ulduar : public InstanceMapScript elderCount = 0; conSpeedAtory = false; Unbroken = true; + _algalonSummoned = false; _summonAlgalon = false; memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID)); -- cgit v1.2.3 From da229008bb1e9c1c548cdc0052b978a1394a53d2 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 12 Aug 2012 13:03:27 +0200 Subject: Scripts/The Culling of Stratholme: Fix quest credit for Mal'Ganis --- sql/updates/world/2012_08_12_00_world_conditions.sql | 3 +++ .../Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 sql/updates/world/2012_08_12_00_world_conditions.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_12_00_world_conditions.sql b/sql/updates/world/2012_08_12_00_world_conditions.sql new file mode 100644 index 00000000000..6e1fd0ac1db --- /dev/null +++ b/sql/updates/world/2012_08_12_00_world_conditions.sql @@ -0,0 +1,3 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=58124; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,58124,0,0,32,0,0x90,0,0,0,0,'','Mal''Ganis Kill Credit - Player target'); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index d4359a100b4..88b2a766671 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -36,6 +36,7 @@ enum Spells SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. H_SPELL_SLEEP = 58849, SPELL_VAMPIRIC_TOUCH = 52723, //Heals the caster for half the damage dealt by a melee attack. + SPELL_MAL_GANIS_KILL_CREDIT = 58124, // Quest credit SPELL_KILL_CREDIT = 58630 // Non-existing spell as encounter credit, created in spell_dbc }; @@ -238,9 +239,9 @@ public: if (instance) { instance->SetData(DATA_MAL_GANIS_EVENT, DONE); - + DoCastAOE(SPELL_MAL_GANIS_KILL_CREDIT); // give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc - DoCast(me, SPELL_KILL_CREDIT); + DoCastAOE(SPELL_KILL_CREDIT); } } -- cgit v1.2.3 From 7d29e585df3c16b22a7177d43e3ec1e1136a4ad4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 12 Aug 2012 14:16:11 +0200 Subject: Scripts/Karazhan: Fixed some uninitialized variables --- .../EasternKingdoms/Karazhan/boss_moroes.cpp | 22 ++++++---------------- .../Karazhan/boss_prince_malchezaar.cpp | 4 ++++ 2 files changed, 10 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index bc29a6f1f3c..06c1243645c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -75,8 +75,8 @@ public: { boss_moroesAI(Creature* creature) : ScriptedAI(creature) { - for (uint8 i = 0; i < 4; ++i) - AddId[i] = 0; + memset(AddId, 0, sizeof(AddId)); + memset(AddGUID, 0, sizeof(AddGUID)); instance = creature->GetInstanceScript(); } @@ -105,10 +105,8 @@ public: Enrage = false; InVanish = false; - if (me->GetHealth() > 0) - { + if (me->GetHealth()) SpawnAdds(); - } if (instance) instance->SetData(TYPE_MOROES, NOT_STARTED); @@ -193,10 +191,9 @@ public: bool isAddlistEmpty() { for (uint8 i = 0; i < 4; ++i) - { if (AddId[i] == 0) return true; - } + return false; } @@ -341,17 +338,10 @@ struct boss_moroes_guestAI : public ScriptedAI if (!instance) return; - uint64 MoroesGUID = instance->GetData64(DATA_MOROES); - Creature* Moroes = (Unit::GetCreature((*me), MoroesGUID)); - if (Moroes) - { + if (Creature* Moroes = Unit::GetCreature(*me, instance->GetData64(DATA_MOROES))) for (uint8 i = 0; i < 4; ++i) - { - uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]; - if (GUID) + if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]) GuestGUID[i] = GUID; - } - } } Unit* SelectGuestTarget() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 1ed4da1f25e..d5add0f0bb7 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -187,6 +187,7 @@ public: boss_malchezaarAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); + memset(axes, 0, sizeof(axes)); } InstanceScript* instance; @@ -218,7 +219,10 @@ public: positions.clear(); for (uint8 i = 0; i < 5; ++i) + { enfeeble_targets[i] = 0; + enfeeble_health[i] = 0; + } for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); -- cgit v1.2.3 From 65469c9ee916fd8a910ce39e94cc929b4e1487ea Mon Sep 17 00:00:00 2001 From: e000 Date: Sun, 12 Aug 2012 20:04:02 +0200 Subject: Core/Gameobject: Properly toggle collision state when a gameobject is activated or spawned. --- src/server/game/Entities/GameObject/GameObject.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 7375ed9f886..20e5055dc15 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -138,9 +138,8 @@ void GameObject::AddToWorld() bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false; if (m_model) GetMap()->Insert(*m_model); - if (startOpen ^ toggledState) - EnableCollision(false); + EnableCollision(startOpen ^ toggledState); WorldObject::AddToWorld(); } } @@ -1923,7 +1922,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); // Use the current go state - if (GetGoState() == GO_STATE_ACTIVE) + if (GetGoState() != GO_STATE_ACTIVE) startOpen = !startOpen; if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED) -- cgit v1.2.3 From f92946e128ed44de21c97900b0a935c7c55fcd65 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 12 Aug 2012 20:06:12 +0200 Subject: Core/Misc: Fix some mem-leaks and uninitialized variables. --- src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp | 3 ++- .../SunwellPlateau/instance_sunwell_plateau.cpp | 11 +++-------- .../scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp | 9 +++++---- src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp | 12 ++++++++++++ .../TrialOfTheChampion/boss_argent_challenge.cpp | 2 -- .../Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp | 6 +----- .../UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp | 1 + .../Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp | 1 + .../CoilfangReservoir/SteamVault/instance_steam_vault.cpp | 12 ++++-------- .../scripts/Outland/GruulsLair/instance_gruuls_lair.cpp | 10 ++-------- .../scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp | 12 ++++-------- 11 files changed, 35 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 202869567d8..90571dfb758 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -57,7 +57,8 @@ BattlegroundIC::BattlegroundIC() BattlegroundIC::~BattlegroundIC() { - + delete gunshipHorde; + delete gunshipAlliance; } void BattlegroundIC::HandlePlayerResurrect(Player* player) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 68b3bdb9b7e..6324c5adf16 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -276,14 +276,9 @@ public: std::ostringstream stream; stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; + + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); } void Load(const char* in) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 305e3813ebc..235bec7cc8a 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -180,12 +180,13 @@ class instance_zulaman : public InstanceMapScript std::string GetSaveData() { + OUT_SAVE_INST_DATA; + std::ostringstream ss; ss << "S " << BossKilled << ' ' << ChestLooted << ' ' << QuestMinute; - char* data = new char[ss.str().length()+1]; - strcpy(data, ss.str().c_str()); - //sLog->outError(LOG_FILTER_TSCR, "Zul'aman saved, %s.", data); - return data; + + OUT_SAVE_INST_DATA_COMPLETE; + return ss.str(); } void Load(const char* load) diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 6c0d43b053e..3a6a3f6241c 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -119,6 +119,18 @@ public: void Initialize() { GahzRillaEncounter = NOT_STARTED; + ZumrahGUID = 0; + BlyGUID = 0; + WeegliGUID = 0; + OroGUID = 0; + RavenGUID = 0; + MurtaGUID = 0; + EndDoorGUID = 0; + PyramidPhase = 0; + major_wave_Timer = 0; + minor_wave_Timer = 0; + addGroupSize = 0; + waypoint = 0; } void OnCreatureCreate(Creature* creature) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 76d5949eb44..d77c84b2978 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -219,8 +219,6 @@ public: } InstanceScript* instance; - - Creature* pMemory; uint64 MemoryGUID; bool bHealth; diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 7778a79a816..7875d8edacf 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -190,16 +190,12 @@ public: { OUT_SAVE_INST_DATA; - std::string str_data; - std::ostringstream saveStream; saveStream << "D K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + return saveStream.str(); } void Load(const char* in) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 191f4530e65..48667053373 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -101,6 +101,7 @@ public: boss_ingvar_the_plundererAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); + bIsUndead = false; } InstanceScript* instance; diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index c1850ee821c..a1780d1d4a8 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -171,6 +171,7 @@ public: summonTraveler_Timer = 90000; banish_Timer = 17000; HelpYell = false; + sumportals = false; destroyPortals(); if (instance) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index 26ab54746be..dd0b5ea9160 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -200,16 +200,12 @@ public: std::string GetSaveData() { OUT_SAVE_INST_DATA; + std::ostringstream stream; stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; + + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); } void Load(const char* in) diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index fdb386372d4..fa67659ca66 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -171,15 +171,9 @@ public: OUT_SAVE_INST_DATA; std::ostringstream stream; stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); } void Load(const char* in) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 78ffddca4d8..1230b7e88cf 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -166,16 +166,12 @@ class instance_the_eye : public InstanceMapScript std::string GetSaveData() { OUT_SAVE_INST_DATA; + std::ostringstream stream; stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; + + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); } void Load(const char* in) -- cgit v1.2.3 From d1ed95faa58af818f2d6b7f21e6054047a042f20 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 13 Aug 2012 13:47:51 +0200 Subject: Scripts: Fixed more uninitialized variables --- src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp | 1 + src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp | 3 +++ .../scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp | 5 +++-- .../scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index f81ddbf6bf8..29a0a11af9b 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -104,6 +104,7 @@ public: if (me->GetEntry() == MOB_HORSEMEN[i]) id = Horsemen(i); caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR); + encounterActionReset = false; } Horsemen id; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index 152f0b2d647..5d430ae048d 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -58,6 +58,9 @@ public: Anomalus = 0; Keristrasza = 0; + AnomalusContainmentSphere = 0; + OrmoroksContainmentSphere = 0; + TelestrasContainmentSphere = 0; } void OnCreatureCreate(Creature* creature) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index f0d64bb8344..a6ad7befc38 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -172,6 +172,7 @@ public: boss_skadiAI(Creature* creature) : ScriptedAI(creature), Summons(me) { instance = creature->GetInstanceScript(); + m_uiGraufGUID = 0; } InstanceScript* instance; @@ -207,7 +208,7 @@ public: Summons.DespawnAll(); me->SetSpeed(MOVE_FLIGHT, 3.0f); - if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted()) + if ((Unit::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted()) me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); if (instance) { @@ -221,7 +222,7 @@ public: me->SetCanFly(false); me->Dismount(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL) + if (!Unit::GetCreature(*me, m_uiGraufGUID)) me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 5dacaff2d6b..39fd01a9269 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -121,6 +121,9 @@ public: m_uiActiveOrder[i] = m_uiActiveOrder[r]; m_uiActiveOrder[r] = temp; } + + m_uiActivedCreatureGUID = 0; + m_uiOrbGUID = 0; } bool m_bIsWalking; -- cgit v1.2.3 From 56d10f218ddba624f78aff250e271dac7a134af6 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 13 Aug 2012 19:24:47 +0200 Subject: Core: Fix warnings --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 72c500513cd..2814b7dba64 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17059,7 +17059,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // set value, including drunk invisibility detection // calculate sobering. after 15 minutes logged out, the player will be sober again uint8 newDrunkValue = 0; - if (time_diff < GetDrunkValue() * 9) + if (time_diff < uint32(GetDrunkValue()) * 9) newDrunkValue = GetDrunkValue() - time_diff / 9; SetDrunkValue(newDrunkValue); -- cgit v1.2.3 From d1071d6e818dda613f87d631b6cefc5f0f707498 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 13 Aug 2012 19:37:58 +0200 Subject: Scripts/Trial of the Crusader: Convert script_texts in creature_text --- .../world/2012_08_13_00_world_creature_text.sql | 133 ++++++++++++++++ sql/updates/world/2012_08_13_01_world_creature.sql | 10 ++ .../TrialOfTheCrusader/boss_anubarak_trial.cpp | 25 +-- .../TrialOfTheCrusader/boss_faction_champions.cpp | 12 +- .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 26 +-- .../TrialOfTheCrusader/boss_northrend_beasts.cpp | 39 +++-- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 39 ++--- .../instance_trial_of_the_crusader.cpp | 8 + .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 175 +++++++++++---------- .../TrialOfTheCrusader/trial_of_the_crusader.h | 1 + 10 files changed, 317 insertions(+), 151 deletions(-) create mode 100644 sql/updates/world/2012_08_13_00_world_creature_text.sql create mode 100644 sql/updates/world/2012_08_13_01_world_creature.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_13_00_world_creature_text.sql b/sql/updates/world/2012_08_13_00_world_creature_text.sql new file mode 100644 index 00000000000..aeb24dbfe90 --- /dev/null +++ b/sql/updates/world/2012_08_13_00_world_creature_text.sql @@ -0,0 +1,133 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1649999 AND -1649000; +DELETE FROM `creature_text` WHERE `entry` IN (34996,34990,34995,36095,34796,35144,34799,34797,34780,35458,34496,34497,16980,35877,34564,34660); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +-- Highlord Tirion Fordring + -- Northrend Beasts +(34996, 0, 0, 'Welcome, champions! You have heard the call of the Argent Crusade and you have boldly answered! It is here, in the Crusaders'' Coliseum, that you will face your greatest challenges. Those of you who survive the rigors of the coliseum will join the Argent Crusade on its march to Icecrown Citadel.', 14, 0, 100, 0, 0, 16036, 'Highlord Tirion Fordring - Welcome'), +(34996, 1, 0, 'Hailing from the deepest, darkest caverns of the Storm Peaks, Gormok the Impaler! Battle on, heroes!', 14, 0, 100, 0, 0, 16038, 'Highlord Tirion Fordring - Summing Gormok the Impaler'), +(34996, 2, 0, 'Steel yourselves, heroes, for the twin terrors, Acidmaw and Dreadscale, enter the arena!', 14, 0, 100, 0, 0, 16039, 'Highlord Tirion Fordring - Summing Acidmaw and Dreadscale'), +(34996, 3, 0, 'The air itself freezes with the introduction of our next combatant, Icehowl! Kill or be killed, champions!', 14, 0, 100, 0, 0, 16040, 'Highlord Tirion Fordring Summing Icehowl'), +(34996, 4, 0, 'The monstrous menagerie has been vanquished!', 14, 0, 100, 0, 0, 16041, 'Highlord Tirion Fordring - Northrend Beasts Done'), +(34996, 5, 0, 'Tragic... They fought valiantly, but the beasts of Northrend triumphed. Let us observe a moment of silence for our fallen heroes.', 14, 0, 0, 0, 0, 16042, 'Highlord Tirion Fordring - Northrend Beasts FAIL'), + -- Lord Jaraxxus +(34996, 6, 0, 'Grand Warlock Wilfred Fizzlebang will summon forth your next challenge. Stand by for his entry.', 14, 0, 100, 0, 0, 16043, 'Highlord Tirion Fordring - Summing Wilfred Fizzlebang'), +(34996, 7, 0, 'Quickly, heroes, destroy the demon lord before it can open a portal to its twisted demonic realm!', 14, 0, 100, 5, 0, 16044, 'Highlord Tirion Fordring to Wilfred Fizzlebang - Lord Jaraxxus Intro'), +(34996, 8, 0, 'The loss of Wilfred Fizzlebang, while unfortunate, should be a lesson to those that dare dabble in dark magic. Alas, you are victorious and must now face the next challenge.', 14, 0, 100, 0, 0, 16045, 'Highlord Tirion Fordring - Lord Jaraxxus Outro'), +(34996, 9, 0, 'Everyone calm down! Compose yourselves! There is no conspiracy at play here! The warlock acted on his own volition, outside of influences from the Alliance. The tournament must go on!', 14, 0, 100, 5, 0, 16046, 'Highlord Tirion Fordring - Lord Jaraxxus Outro'), + -- Faction Champions +(34996, 10, 0, 'The next battle will be against the Argent Crusade''s most powerful knights! Only by defeating them will you be deemed worthy...', 14, 0, 100, 0, 0, 16047, 'Highlord Tirion Fordring - Faction Champions Intro'), +(34996, 11, 0, 'Very well. I will allow it. Fight with honor!', 14, 0, 100, 1, 0, 16048, 'Highlord Tirion Fordring - Faction Champions Intro'), +(34996, 12, 0, 'A shallow and tragic victory. We are weaker as a whole from the losses suffered today. Who but the Lich King could benefit from such foolishness? Great warriors have lost their lives. And for what? The true threat looms ahead - the Lich King awaits us all in death.', 14, 0, 100, 0, 0, 16049, 'Highlord Tirion Fordring - Faction Champions Outro'), + -- Twin Val'kyr +(34996, 13, 0, 'Only by working together will you overcome the final challenge. From the depths of Icecrown come two of the Scourge''s most powerful lieutenants: fearsome val''kyr, winged harbingers of the Lich King!', 14, 0, 100, 0, 0, 16050, 'Highlord Tirion Fordring - Twin Val''kyr Intro'), +(34996, 14, 0, 'Let the games begin!', 14, 0, 100, 0, 0, 16037, 'Highlord Tirion Fordring - Twin Val''kyr Intro'), + -- Anub''arak +(34996, 15, 0, 'A mighty blow has been dealt to the Lich King! You have proven yourselves as able bodied champions of the Argent Crusade. Together we will strike against Icecrown Citadel and destroy what remains of the Scourge! There is no challenge that we cannot face united!', 14, 0, 100, 5, 0, 16051, 'Highlord Tirion Fordring - Anub''arak Intro'), +(34996, 16, 0, 'Arthas! You are hopelessly outnumbered! Lay down Frostmourne and I will grant you a just death.', 14, 0, 100, 25, 0, 16052, 'Highlord Tirion Fordring'), + +-- King Varian Wrynn +(34990, 0, 0, 'Your beasts will be no match for my champions, Tirion!', 14, 0, 0, 0, 0, 16069, 'King Varian Wrynn'), +(34990, 1, 0, 'The Alliance doesn''t need the help of a demon lord to deal with Horde filth! Come, pig!', 14, 0, 100, 5, 0, 16064, 'King Varian Wrynn'), +(34990, 2, 0, 'Our honor has been besmirched! They make wild claims and false accusations against us. I demand justice! Allow my champions to fight in place of your knights, Tirion. We challenge the Horde!', 14, 0, 100, 5, 0, 16066, 'King Varian Wrynn'), +(34990, 3, 0, 'Fight for the glory of the Alliance, heroes! Honor your king and your people!', 14, 0, 100, 5, 0, 16065, 'King Varian Wrynn'), +(34990, 4, 0, 'GLORY TO THE ALLIANCE!', 14, 0, 0, 0, 0, 16067, 'King Varian Wrynn'), +(34990, 5, 0, 'Not even the Lich King most powerful minions can stand against the Alliance! All hail our victors!', 14, 0, 0, 0, 0, 16068, 'King Varian Wrynn'), +(34990, 6, 0, 'Hardly a challenge.', 14, 0, 100, 274, 0, 16061, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 1, 'HAH!', 14, 0, 100, 5, 0, 16060, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 2, 'Is this the best the Horde has to offer?', 14, 0, 100, 6, 0, 16063, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 3, 'Worthless scrub.', 14, 0, 100, 25, 0, 16062, 'King Varian Wrynn - Faction Champions Kill Player'), + +-- Garrosh Hellscream +(34995, 0, 0, 'The Horde demands justice! We challenge the Alliance. Allow us to battle in place of your knights, paladin. We will show these dogs what it means to insult the Horde!', 14, 0, 100, 1, 0, 16023, 'Garrosh Hellscream'), +(34995, 1, 0, 'I''ve seen more worthy challenges in the Ring of Blood. You waste our time, paladin.', 14, 0, 100, 1, 0, 16026, 'Garrosh Hellscream'), +(34995, 2, 0, 'Treacherous Alliance dogs! You summon a demon lord against warriors of the Horde? Your deaths will be swift!', 14, 0, 100, 5, 0, 16021, 'Garrosh Hellscream'), +(34995, 3, 0, 'That was just a taste of what the future brings. FOR THE HORDE!', 14, 0, 100, 1, 0, 16024, 'Garrosh Hellscream'), +(34995, 4, 0, 'Show them no mercy, Horde champions! LOK''TAR OGAR!', 14, 0, 0, 0, 0, 16022, 'Garrosh - Faction Champions Intro'), +(34995, 5, 0, 'Do you still question the might of the Horde, paladin? We will take on all comers!', 14, 0, 100, 1, 0, 16025, 'Garrosh Hellscream'), +(34995, 6, 0, 'Weakling!', 14, 0, 0, 0, 0, 16017, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 1, 'Pathetic!', 14, 0, 0, 0, 0, 16018, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 2, 'Overpowered.', 14, 0, 0, 0, 0, 16019, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 3, 'Lok''tar!', 14, 0, 0, 0, 0, 16020, 'Garrosh Hellscream - Faction Champions Kill Player'), + +-- Highlord Tirion Fordring +(36095, 0, 0, 'Champions, you''re alive! Not only have you defeated every challenge of the Trial of the Crusader, but also thwarted Arthas'' plans! Your skill and cunning will prove to be a powerful weapon against the Scourge. Well done! Allow one of the Crusade''s mages to transport you to the surface!', 14, 0, 100, 5, 0, 16053, 'Highlord Tirion Fordring'), +(36095, 1, 0, 'Let me hand you the chests as a reward, and let its contents will serve you faithfully in the campaign against Arthas in the heart of the Icecrown Citadel!', 41, 0, 0, 0, 0, 0, 'Highlord Tirion Fordring'), + +-- Gormok +(34796, 0, 0, 'My slaves! Destroy the enemy!', 41, 0, 0, 0, 0, 0, 'Gormok the Impaler - Snowball'), + +-- Acidmaw +(35144, 0, 0, 'Upon seeing its companion perish, %s becomes enraged!', 41, 0, 100, 0, 0, 0, 'Acidmaw to Beasts Controller - Enrage'), + +-- Dreadscale +(34799, 0, 0, 'Upon seeing its companion perish, %s becomes enraged!', 41, 0, 100, 0, 0, 0, 'Dreadscale to Beasts Controller - Enrage'), + +-- Icehowl +(34797, 0, 0, '%s glares at $n and lets out a bellowing roar!', 41, 0, 100, 0, 0, 0, 'Icehowl - Start'), +(34797, 1, 0, '%s crashes into the Coliseum wall and is stunned!', 41, 0, 100, 0, 0, 0, 'Icehowl - Crash'), +(34797, 2, 0, 'Trampling combatants underfoot, %s goes into a frothing rage!', 41, 0, 100, 0, 0, 0, 'Icehowl - Fail'), + +-- Wilfred Fizzlebang +(35458, 0, 0, 'Thank you, Highlord. Now, challengers, I will begin the ritual of summoning. When I am done a fearsome doomguard will appear!', 14, 0, 100, 2, 0, 16268, 'Wilfred Fizzlebang - Intro'), +(35458, 1, 0, 'Prepare for oblivion!', 14, 0, 100, 0, 0, 16269, 'Wilfred Fizzlebang - Intro'), +(35458, 2, 0, 'A-HA! I''ve done it! Behold the absolute power of Wilfred Fizzlebang, master summoner! You are bound to me, demon!', 14, 0, 100, 5, 0, 16270, 'Wilfred Fizzlebang to Wilfred Fizzlebang - Intro'), +(35458, 3, 0, 'But I''m in charge here...', 14, 0, 100, 5, 0, 16271, 'Wilfred Fizzlebang to Wilfred Fizzlebang - Death'), + +-- Lord Jaraxxus +(34780, 0, 0, 'Trifling gnome! Your arrogance will be your undoing!', 14, 0, 100, 397, 0, 16143, 'Lord Jaraxxus to Wilfred Fizzlebang - Intro'), +(34780, 1, 0, 'You face Jaraxxus, Eredar Lord of the Burning Legion!', 14, 0, 100, 0, 0, 16144, 'Lord Jaraxxus - Aggro'), +(34780, 2, 0, '$n has |cFFFF0000Legion Flames!|r', 41, 0, 100, 0, 0, 0, 'Lord Jaraxxus - Legion Flame'), +(34780, 3, 0, '%s creates a Nether Portal!', 41, 0, 100, 0, 0, 16150, 'Lord Jaraxxus - Summing Nether Portal'), +(34780, 4, 0, 'Come forth, sister! Your master calls!', 14, 0, 100, 0, 0, 16150, 'Lord Jaraxxus - Summoning Mistress of Pain'), +(34780, 5, 0, '$n has |cFF00FFFFIncinerate Flesh!|r Heal $g him:her;!', 41, 0, 100, 0, 0, 16149, 'Lord Jaraxxus - Incinerate Flesh'), +(34780, 6, 0, 'FLESH FROM BONE!', 14, 0, 100, 0, 0, 16149, 'Lord Jaraxxus - Incinerate Flesh'), +(34780, 7, 0, '%s creates an |cFF00FF00Infernal Volcano!|r', 41, 0, 100, 0, 0, 16151, 'Lord Jaraxxus - Summoning Infernal Volcano emote'), +(34780, 8, 0, 'IN-FER-NO!', 14, 0, 100, 0, 0, 16151, 'Lord Jaraxxus - Summoning Infernals'), +(34780, 9, 0, 'Insignificant gnat!', 14, 0, 0, 0, 0, 16145, 'Lord Jaraxxus - Killing a player'), +(34780, 9, 1, 'Banished to the Nether!', 14, 0, 0, 0, 0, 16146, 'Lord Jaraxxus - Killing a player'), +(34780, 10, 0, 'Another will take my place. Your world is doomed...', 14, 0, 100, 0, 0, 16147, 'Lord Jaraxxus - Death'), +(34780, 11, 0,'', 14, 0, 0, 0, 0, 16148, 'Lord Jaraxxus - Berserk'), + +-- Eydis Darkban +(34496, 0, 0, 'In the name of our dark master. For the Lich King. You. Will. Die.', 14, 0, 100, 0, 0, 16272, 'Eydis Darkbane - Aggro'), +(34496, 1, 0, 'Let the light consume you!', 14, 0, 100, 0, 0, 16279, 'Eydis Darkbane to Fjola Lightbane - Light Vortex'), +(34496, 2, 0, 'Let the dark consume you!', 14, 0, 100, 0, 0, 16278, 'Eydis Darkbane to Fjola Lightbane - Dark Vortex'), +(34496, 3, 0, '%s begins to cast |cFF9932CDDark Vortex!|r Switch to |cFF9932CDDark|r Essence!', 41, 0, 100, 0, 0, 16278, 'Eydis Darkbane to Fjola Lightbane - Dark Vortex emote'), +(34496, 4, 0, '%s begins to cast |cFFFF0000Twin''s Pact!|r', 41, 0, 100, 0, 0, 16274, 'Eydis Darkbane to Fjola Lightbane - Twin''s Pact emote'), +(34496, 5, 0, 'CHAOS!', 14, 0, 100, 0, 0, 16274, 'Eydis Darkbane to Fjola Lightbane - Twin''s Pact'), +(34496, 6, 0, 'You have been measured and found wanting.', 14, 0, 100, 0, 0, 16276, 'Eydis Darkbane - Killing a player'), +(34496, 6, 1, 'UNWORTHY!', 14, 0, 100, 0, 0, 16276, 'Eydis Darkbane - Killing a player'), +(34496, 7, 0, 'YOU ARE FINISHED!', 14, 0, 0, 0, 0, 16273, 'Eydis Darkbane - Berserk'), +(34496, 8, 0, 'The Scourge cannot be stopped...', 14, 0, 100, 0, 0, 16275, 'Eydis Darkbane - Death'), + +-- Fjola Lightbane +(34497, 0, 0, 'In the name of our dark master. For the Lich King. You. Will. Die.', 14, 0, 100, 0, 0, 16272, 'Fjola Lightbane - Aggro'), +(34497, 1, 0, 'Let the light consume you!', 14, 0, 100, 0, 0, 16279, 'Fjola Lightbane to Fjola Lightbane - Light Vortex'), +(34497, 2, 0, 'Let the dark consume you!', 14, 0, 100, 0, 0, 16278, 'Fjola Lightbane to Fjola Lightbane - Dark Vortex'), +(34497, 3, 0, '%s begins to cast |cFFFFFFFFLight Vortex!|r Switch to |cFFFFFFFFLight|r Essence!', 41, 0, 100, 0, 0, 16279, 'Fjola Lightbane to Fjola Lightbane - Light Vortex emote'), +(34497, 4, 0, '%s begins to cast Twin''s Pact!', 41, 0, 100, 0, 0, 16274, 'Fjola Lightbane to Fjola Lightbane - Twin''s Pact emote'), +(34497, 5, 0, 'CHAOS!', 14, 0, 100, 0, 0, 16274, 'Fjola Lightbane to Fjola Lightbane - Twin''s Pact'), +(34497, 6, 0, 'You have been measured and found wanting.', 14, 0, 100, 0, 0, 16276, 'Fjola Lightbane - Killing a player'), +(34497, 6, 1, 'UNWORTHY!', 14, 0, 100, 0, 0, 16276, 'Fjola Lightbane - Killing a player'), +(34497, 7, 0, 'YOU ARE FINISHED!', 14, 0, 0, 0, 0, 16273, 'Fjola Lightbane - Berserk'), +(34497, 8, 0, 'The Scourge cannot be stopped...', 14, 0, 100, 0, 0, 16275, 'Fjola Lightbane - Death'), + +-- The Lich King +(35877, 0, 0, 'You will have your challenge, Fordring.', 14, 0, 100, 0, 0, 16321, 'The Lich King'), +(35877, 1, 0, 'The souls of your fallen champions will be mine, Fordring.', 14, 0, 100, 0, 0, 16323, 'The Lich King'), +(35877, 2, 0, 'The Nerubians built an empire beneath the frozen wastes of Northrend. An empire that you so foolishly built your structures upon. MY EMPIRE.', 14, 0, 100, 11, 0, 16322, 'The Lich King'), + +-- Anub''arak +(34564, 0, 0, 'Ahhh, our guests have arrived, just as the master promised.', 14, 0, 100, 0, 0, 16235, 'Anub''arak - Intro'), +(34564, 1, 0, 'This place will serve as your tomb!', 14, 0, 100, 0, 0, 16234, 'Anub''arak - Aggro'), +(34564, 2, 0, 'Auum na-l ak-k-k-k, isshhh. Rise, minions. Devour...', 14, 0, 100, 0, 0, 16240, 'Anub''arak - Submerge'), +(34564, 3, 0, '%s burrows into the ground!', 41, 0, 100, 0, 0, 16240, 'Anub''arak - Burrows'), +(34564, 4, 0, '%s emerges from the ground!', 41, 0, 100, 0, 0, 0, 'Anub''arak - Emerge emote'), +(34564, 5, 0, 'The swarm shall overtake you!', 14, 0, 100, 0, 0, 16241, 'Anub''arak - Leeching Swarm'), +(34564, 6, 0, '%s unleashes a Leeching Swarm to heal himself!', 41, 0, 100, 0, 0, 16241, 'Anub''arak - Leeching Swarm emote'), +(34564, 7, 0, 'F-lakkh shir!', 14, 0, 100, 0, 0, 16236, 'Anub''arak - Killing a player'), +(34564, 7, 1, 'Another soul to sate the host.', 14, 0, 100, 0, 0, 16237, 'Anub''arak - Killing a player'), +(34564, 8, 0, 'I have failed you, master...', 14, 0, 100, 0, 0, 16238, 'Anub''arak - Death'), + +-- Anub''arak Spike +(34660, 0, 0, '%s''s spikes pursue $n!', 41, 0, 100, 0, 0, 0, 'Anub''arak - Spike target'); diff --git a/sql/updates/world/2012_08_13_01_world_creature.sql b/sql/updates/world/2012_08_13_01_world_creature.sql new file mode 100644 index 00000000000..4d8544206dd --- /dev/null +++ b/sql/updates/world/2012_08_13_01_world_creature.sql @@ -0,0 +1,10 @@ +SET @GUID := 42575; +SET @ENTRY := 36095; -- Highlord Tirion Fordring + +DELETE FROM `creature` WHERE `id`=@ENTRY; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`MovementType`) VALUES +(@GUID,@ENTRY,649,15,1,648.9167,131.0208,141.6161,0,7200,0,0); + +DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY; +INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES +(@ENTRY,0,0x0,0x1,'57545'); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index b3b9801fd00..1019deac106 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -37,15 +37,17 @@ EndScriptData */ enum Yells { - SAY_INTRO = -1649055, - SAY_AGGRO = -1649056, - SAY_KILL1 = -1649057, - SAY_KILL2 = -1649058, - SAY_DEATH = -1649059, - EMOTE_SPIKE = -1649060, - SAY_BURROWER = -1649061, - EMOTE_LEECHING_SWARM = -1649062, - SAY_LEECHING_SWARM = -1649063, + SAY_INTRO = 0, + SAY_AGGRO = 1, + EMOTE_SUBMERGE = 2, + EMOTE_BURROWER = 3, + SAY_EMERGE = 4, + SAY_LEECHING_SWARM = 5, + EMOTE_LEECHING_SWARM = 6, + SAY_KILL_PLAYER = 7, + SAY_DEATH = 8, + + EMOTE_SPIKE = 0, }; enum Summons @@ -195,7 +197,7 @@ public: { if (who->GetTypeId() == TYPEID_PLAYER) { - DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me); + Talk(SAY_KILL_PLAYER); if (instance) instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } @@ -321,7 +323,7 @@ public: DoCast(me, SPELL_SUBMERGE_ANUBARAK); DoCast(me, SPELL_CLEAR_ALL_DEBUFFS); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - DoScriptText(SAY_BURROWER, me); + Talk(EMOTE_BURROWER); m_uiScarabSummoned = 0; m_uiSummonScarabTimer = 4*IN_MILLISECONDS; m_uiStage = 2; @@ -669,6 +671,7 @@ public: { m_uiTargetGUID = who->GetGUID(); DoCast(who, SPELL_MARK); + Talk(EMOTE_SPIKE, who->GetGUID()); me->SetSpeed(MOVE_RUN, 0.5f); m_uiSpeed = 0; m_uiIncreaseSpeedTimer = 1*IN_MILLISECONDS; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 3b0aeb958cb..c662daf3671 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -33,10 +33,9 @@ EndScriptData */ #include "SpellAuraEffects.h" #include "trial_of_the_crusader.h" -enum eYell +enum Yells { - SAY_GARROSH_KILL_ALLIANCE_PLAYER4 = -1649118, - SAY_VARIAN_KILL_HORDE_PLAYER4 = -1649123, + SAY_KILL_PLAYER = 6, }; enum eAIs @@ -359,11 +358,12 @@ struct boss_faction_championsAI : public ScriptedAI if (TeamInInstance == ALLIANCE) { if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_VARIAN))) - DoScriptText(SAY_VARIAN_KILL_HORDE_PLAYER4+urand(0, 3), temp); // + cause we are on negative + temp->AI()->Talk(SAY_KILL_PLAYER); } else - if (Creature* temp = me->FindNearestCreature(NPC_GARROSH, 300.f)) - DoScriptText(SAY_GARROSH_KILL_ALLIANCE_PLAYER4+urand(0, 3), temp); // + cause we are on negative + if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_GARROSH))) + temp->AI()->Talk(SAY_KILL_PLAYER); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 4e791dfc22f..f9e2080895a 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -36,16 +36,18 @@ EndScriptData */ enum Yells { - SAY_INTRO = -1649030, - SAY_AGGRO = -1649031, - SAY_DEATH = -1649032, - EMOTE_INCINERATE = -1649033, - SAY_INCINERATE = -1649034, - EMOTE_LEGION_FLAME = -1649035, - EMOTE_NETHER_PORTAL = -1649036, - SAY_NETHER_PORTAL = -1649037, - EMOTE_INFERNAL_ERUPTION = -1649038, - SAY_INFERNAL_ERUPTION = -1649039, + SAY_INTRO = 0, + SAY_AGGRO = 1, + EMOTE_LEGION_FLAME = 2, + EMOTE_NETHER_PORTAL = 3, + SAY_MISTRESS_OF_PAIN = 4, + EMOTE_INCINERATE = 5, + SAY_INCINERATE = 6, + EMOTE_INFERNAL_ERUPTION = 7, + SAY_INFERNAL_ERUPTION = 8, + SAY_KILL_PLAYER = 9, + SAY_DEATH = 10, + SAY_BERSERK = 11, }; enum Equipment @@ -192,8 +194,8 @@ public: if (m_uiSummonNetherPortalTimer <= uiDiff) { - DoScriptText(EMOTE_NETHER_PORTAL, me); - DoScriptText(SAY_NETHER_PORTAL, me); + Talk(EMOTE_NETHER_PORTAL); + Talk(SAY_MISTRESS_OF_PAIN); DoCast(SPELL_NETHER_PORTAL); m_uiSummonNetherPortalTimer = 2*MINUTE*IN_MILLISECONDS; } else m_uiSummonNetherPortalTimer -= uiDiff; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 6c69ccbc72d..8dd4f7dad3e 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -35,16 +35,16 @@ EndScriptData */ enum Yells { - //Gormok - SAY_SNOBOLLED = -1649000, - //Acidmaw & Dreadscale - SAY_SUBMERGE = -1649010, - SAY_EMERGE = -1649011, - SAY_BERSERK = -1649012, - //Icehowl - SAY_TRAMPLE_STARE = -1649020, - SAY_TRAMPLE_FAIL = -1649021, - SAY_TRAMPLE_START = -1649022, + // Gormok + EMOTE_SNOBOLLED = 0, + + // Acidmaw & Dreadscale + EMOTE_ENRAGE = 0, + + // Icehowl + EMOTE_TRAMPLE_START = 0, + EMOTE_TRAMPLE_CRASH = 1, + EMOTE_TRAMPLE_FAIL = 2, }; enum Equipment @@ -239,7 +239,7 @@ public: if (m_uiSummonCount > 0) { me->SummonCreature(NPC_SNOBOLD_VASSAL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN); - DoScriptText(SAY_SNOBOLLED, me); + Talk(EMOTE_SNOBOLLED); } m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else m_uiSummonTimer -= diff; @@ -460,12 +460,11 @@ struct boss_jormungarAI : public ScriptedAI if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged) { - DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(SPELL_ENRAGE); enraged = true; - DoScriptText(SAY_BERSERK, me); + Talk(EMOTE_ENRAGE); switch (stage) { case 0: @@ -512,7 +511,6 @@ struct boss_jormungarAI : public ScriptedAI case 1: // Submerge me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_SUBMERGE_0); - DoScriptText(SAY_SUBMERGE, me); me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); stage = 2; case 2: // Wait til emerge @@ -524,7 +522,6 @@ struct boss_jormungarAI : public ScriptedAI break; case 3: // Emerge me->SetDisplayId(modelStationary); - DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); DoCast(me, SPELL_EMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); @@ -558,7 +555,6 @@ struct boss_jormungarAI : public ScriptedAI case 5: // Submerge me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_SUBMERGE_0); - DoScriptText(SAY_SUBMERGE, me); me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); stage = 6; case 6: // Wait til emerge @@ -570,7 +566,6 @@ struct boss_jormungarAI : public ScriptedAI break; case 7: // Emerge me->SetDisplayId(modelMobile); - DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); DoCast(me, SPELL_EMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); @@ -925,7 +920,6 @@ public: { m_uiTrampleTargetGUID = target->GetGUID(); me->SetTarget(m_uiTrampleTargetGUID); - DoScriptText(SAY_TRAMPLE_STARE, me, target); m_bTrampleCasted = false; SetCombatMovement(false); me->GetMotionMaster()->MoveIdle(); @@ -953,7 +947,7 @@ public: } else m_uiTrampleTimer -= diff; break; case 4: - DoScriptText(SAY_TRAMPLE_START, me); + Talk(EMOTE_TRAMPLE_START, m_uiTrampleTargetGUID); me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1); me->SetTarget(0); m_uiStage = 5; @@ -985,7 +979,12 @@ public: if (!m_bTrampleCasted) { DoCast(me, SPELL_STAGGERED_DAZE); - DoScriptText(SAY_TRAMPLE_FAIL, me); + Talk(EMOTE_TRAMPLE_CRASH); + } + else + { + DoCast(me, SPELL_FROTHING_RAGE, true); + Talk(EMOTE_TRAMPLE_FAIL); } m_bMovementStarted = false; me->GetMotionMaster()->MovementExpired(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 4cfe4f61dbb..203e49420be 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -40,17 +40,15 @@ EndScriptData */ enum Yells { - SAY_AGGRO = -1649040, - SAY_DEATH = -1649041, - SAY_BERSERK = -1649042, - EMOTE_SHIELD = -1649043, - SAY_SHIELD = -1649044, - SAY_KILL1 = -1649045, - SAY_KILL2 = -1649046, - EMOTE_LIGHT_VORTEX = -1649047, - SAY_LIGHT_VORTEX = -1649048, - EMOTE_DARK_VORTEX = -1649049, - SAY_DARK_VORTEX = -1649050, + SAY_AGGRO = 0, + SAY_NIGHT = 1, + SAY_LIGHT = 2, + EMOTE_VORTEX = 3, + EMOTE_TWINK_PACT = 4, + SAY_TWINK_PACT = 5, + SAY_KILL_PLAYER = 6, + SAY_BERSERK = 7, + SAY_DEATH = 8, }; enum Equipment @@ -167,7 +165,6 @@ struct boss_twin_baseAI : public ScriptedAI uint32 m_uiTouchTimer; uint32 m_uiBerserkTimer; - int32 m_uiVortexSay; int32 m_uiVortexEmote; uint32 m_uiSisterNpcId; uint32 m_uiMyEmphatySpellId; @@ -179,7 +176,8 @@ struct boss_twin_baseAI : public ScriptedAI uint32 m_uiSpikeSpellId; uint32 m_uiTouchSpellId; - void Reset() { + void Reset() + { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); me->ModifyAuraState(m_uiAuraState, true); @@ -224,7 +222,7 @@ struct boss_twin_baseAI : public ScriptedAI { if (who->GetTypeId() == TYPEID_PLAYER) { - DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me); + Talk(SAY_KILL_PLAYER); if (instance) instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } @@ -336,8 +334,7 @@ struct boss_twin_baseAI : public ScriptedAI { if (Creature* pSister = GetSister()) pSister->AI()->DoAction(ACTION_VORTEX); - DoScriptText(m_uiVortexEmote, me); - DoScriptText(m_uiVortexSay, me); + Talk(m_uiVortexEmote); DoCastAOE(m_uiVortexSpellId); m_uiStage = 0; m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS; @@ -348,8 +345,8 @@ struct boss_twin_baseAI : public ScriptedAI case 2: // Shield+Pact if (m_uiSpecialAbilityTimer <= uiDiff) { - DoScriptText(EMOTE_SHIELD, me); - DoScriptText(SAY_SHIELD, me); + Talk(EMOTE_TWINK_PACT); + Talk(SAY_TWINK_PACT); if (Creature* pSister = GetSister()) { pSister->AI()->DoAction(ACTION_PACT); @@ -426,8 +423,7 @@ public: m_uiStage = 0; m_uiWeapon = EQUIP_MAIN_1; m_uiAuraState = AURA_STATE_UNKNOWN22; - m_uiVortexEmote = EMOTE_LIGHT_VORTEX; - m_uiVortexSay = SAY_LIGHT_VORTEX; + m_uiVortexEmote = EMOTE_VORTEX; m_uiSisterNpcId = NPC_DARKBANE; m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK; m_uiOtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER; @@ -496,8 +492,7 @@ public: m_uiStage = 1; m_uiWeapon = EQUIP_MAIN_2; m_uiAuraState = AURA_STATE_UNKNOWN19; - m_uiVortexEmote = EMOTE_DARK_VORTEX; - m_uiVortexSay = SAY_DARK_VORTEX; + m_uiVortexEmote = EMOTE_VORTEX; m_uiSisterNpcId = NPC_LIGHTBANE; m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT; m_uiOtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 4dfe5708025..3fb76ea52dc 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -47,6 +47,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript uint64 BarrentGUID; uint64 TirionGUID; + uint64 TirionFordringGUID; uint64 FizzlebangGUID; uint64 GarroshGUID; uint64 VarianGUID; @@ -85,6 +86,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript TrialCounter = 50; EventStage = 0; + TirionFordringGUID = 0; + TributeChestGUID = 0; MainGateDoorGUID = 0; @@ -147,6 +150,9 @@ class instance_trial_of_the_crusader : public InstanceMapScript case NPC_TIRION: TirionGUID = creature->GetGUID(); break; + case NPC_TIRION_FORDRING: + TirionFordringGUID = creature->GetGUID(); + break; case NPC_FIZZLEBANG: FizzlebangGUID = creature->GetGUID(); break; @@ -422,6 +428,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript return BarrentGUID; case NPC_TIRION: return TirionGUID; + case NPC_TIRION_FORDRING: + return TirionFordringGUID; case NPC_FIZZLEBANG: return FizzlebangGUID; case NPC_GARROSH: 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 4ad93c0afe1..2a8eab0040a 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -34,45 +34,58 @@ EndScriptData */ enum eYells { - SAY_STAGE_0_01 = -1649070, - SAY_STAGE_0_02 = -1649071, - SAY_STAGE_0_03a = -1649072, - SAY_STAGE_0_03h = -1649073, - SAY_STAGE_0_04 = -1649074, - SAY_STAGE_0_05 = -1649075, - SAY_STAGE_0_06 = -1649076, - SAY_STAGE_0_WIPE = -1649077, - SAY_STAGE_1_01 = -1649080, - SAY_STAGE_1_02 = -1649081, - SAY_STAGE_1_03 = -1649082, - SAY_STAGE_1_04 = -1649083, - SAY_STAGE_1_05 = -1649030, //INTRO Jaraxxus - SAY_STAGE_1_06 = -1649084, - SAY_STAGE_1_07 = -1649086, - SAY_STAGE_1_08 = -1649087, - SAY_STAGE_1_09 = -1649088, - SAY_STAGE_1_10 = -1649089, - SAY_STAGE_1_11 = -1649090, - SAY_STAGE_2_01 = -1649091, - SAY_STAGE_2_02a = -1649092, - SAY_STAGE_2_02h = -1649093, - SAY_STAGE_2_03 = -1649094, - SAY_STAGE_2_04a = -1649095, - SAY_STAGE_2_04h = -1649096, - SAY_STAGE_2_05a = -1649097, - SAY_STAGE_2_05h = -1649098, - SAY_STAGE_2_06 = -1649099, - SAY_STAGE_3_01 = -1649100, - SAY_STAGE_3_02 = -1649101, - SAY_STAGE_3_03a = -1649102, - SAY_STAGE_3_03h = -1649103, - SAY_STAGE_4_01 = -1649104, - SAY_STAGE_4_02 = -1649105, - SAY_STAGE_4_03 = -1649106, - SAY_STAGE_4_04 = -1649107, - SAY_STAGE_4_05 = -1649108, - SAY_STAGE_4_06 = -1649109, - SAY_STAGE_4_07 = -1649110, + // Highlord Tirion Fordring - 34996 + SAY_STAGE_0_01 = 0, + SAY_STAGE_0_02 = 1, + SAY_STAGE_0_04 = 2, + SAY_STAGE_0_05 = 3, + SAY_STAGE_0_06 = 4, + SAY_STAGE_0_WIPE = 5, + SAY_STAGE_1_01 = 6, + SAY_STAGE_1_07 = 7, + SAY_STAGE_1_08 = 8, + SAY_STAGE_1_11 = 9, + SAY_STAGE_2_01 = 10, + SAY_STAGE_2_03 = 11, + SAY_STAGE_2_06 = 12, + SAY_STAGE_3_01 = 13, + SAY_STAGE_3_02 = 14, + SAY_STAGE_4_01 = 15, + SAY_STAGE_4_03 = 16, + + // Varian Wrynn + SAY_STAGE_0_03a = 0, + SAY_STAGE_1_10 = 1, + SAY_STAGE_2_02a = 2, + SAY_STAGE_2_04a = 3, + SAY_STAGE_2_05a = 4, + SAY_STAGE_3_03a = 5, + + // Garrosh + SAY_STAGE_0_03h = 0, + SAY_STAGE_1_09 = 1, + SAY_STAGE_2_02h = 2, + SAY_STAGE_2_04h = 3, + SAY_STAGE_2_05h = 4, + SAY_STAGE_3_03h = 5, + + // Wilfred Fizzlebang + SAY_STAGE_1_02 = 0, + SAY_STAGE_1_03 = 1, + SAY_STAGE_1_04 = 2, + SAY_STAGE_1_06 = 3, + + // Lord Jaraxxus + SAY_STAGE_1_05 = 0, + + // The Lich King + SAY_STAGE_4_02 = 0, + SAY_STAGE_4_05 = 1, + SAY_STAGE_4_04 = 2, + + // Highlord Tirion Fordring - 36095 + SAY_STAGE_4_06 = 0, + SAY_STAGE_4_07 = 1, }; struct _Messages @@ -289,13 +302,13 @@ class boss_lich_king_toc : public CreatureScript switch (instance->GetData(TYPE_EVENT)) { case 5010: - DoScriptText(SAY_STAGE_4_02, me); + Talk(SAY_STAGE_4_02); m_uiUpdateTimer = 3000; me->GetMotionMaster()->MovePoint(0, LichKingLoc[0]); instance->SetData(TYPE_EVENT, 5020); break; case 5030: - DoScriptText(SAY_STAGE_4_04, me); + Talk(SAY_STAGE_4_04); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); m_uiUpdateTimer = 10000; instance->SetData(TYPE_EVENT, 5040); @@ -312,7 +325,7 @@ class boss_lich_king_toc : public CreatureScript instance->SetData(TYPE_EVENT, 5060); break; case 5060: - DoScriptText(SAY_STAGE_4_05, me); + Talk(SAY_STAGE_4_05); me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); m_uiUpdateTimer = 2500; instance->SetData(TYPE_EVENT, 5070); @@ -371,7 +384,7 @@ class npc_fizzlebang_toc : public CreatureScript void JustDied(Unit* killer) { - DoScriptText(SAY_STAGE_1_06, me, killer); + Talk(SAY_STAGE_1_06, killer->GetGUID()); instance->SetData(TYPE_EVENT, 1180); if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) { @@ -430,13 +443,13 @@ class npc_fizzlebang_toc : public CreatureScript m_uiUpdateTimer = 4000; break; case 1120: - DoScriptText(SAY_STAGE_1_02, me); + Talk(SAY_STAGE_1_02); instance->SetData(TYPE_EVENT, 1130); m_uiUpdateTimer = 12000; break; case 1130: me->GetMotionMaster()->MovementExpired(); - DoScriptText(SAY_STAGE_1_03, me); + Talk(SAY_STAGE_1_03); me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI); if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN)) { @@ -470,7 +483,7 @@ class npc_fizzlebang_toc : public CreatureScript m_uiUpdateTimer = 3000; break; case 1140: - DoScriptText(SAY_STAGE_1_04, me); + Talk(SAY_STAGE_1_04); if (Creature* temp = me->SummonCreature(NPC_JARAXXUS, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 5.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -492,7 +505,7 @@ class npc_fizzlebang_toc : public CreatureScript break; case 1144: if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) - DoScriptText(SAY_STAGE_1_05, temp); + temp->AI()->Talk(SAY_STAGE_1_05); instance->SetData(TYPE_EVENT, 1150); m_uiUpdateTimer = 5000; break; @@ -555,13 +568,13 @@ class npc_tirion_toc : public CreatureScript { case 110: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); - DoScriptText(SAY_STAGE_0_01, me); + Talk(SAY_STAGE_0_01); m_uiUpdateTimer = 22000; instance->SetData(TYPE_EVENT, 120); break; case 140: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); - DoScriptText(SAY_STAGE_0_02, me); + Talk(SAY_STAGE_0_02); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 150); break; @@ -587,7 +600,7 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 160); break; case 200: - DoScriptText(SAY_STAGE_0_04, me); + Talk(SAY_STAGE_0_04); m_uiUpdateTimer = 8000; instance->SetData(TYPE_EVENT, 205); break; @@ -619,7 +632,7 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 230); break; case 300: - DoScriptText(SAY_STAGE_0_05, me); + Talk(SAY_STAGE_0_05); m_uiUpdateTimer = 8000; instance->SetData(TYPE_EVENT, 305); break; @@ -646,54 +659,54 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 320); break; case 400: - DoScriptText(SAY_STAGE_0_06, me); + Talk(SAY_STAGE_0_06); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 0); break; case 666: - DoScriptText(SAY_STAGE_0_WIPE, me); + Talk(SAY_STAGE_0_WIPE); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 0); break; case 1010: - DoScriptText(SAY_STAGE_1_01, me); + Talk(SAY_STAGE_1_01); m_uiUpdateTimer = 7000; instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); instance->SetData(TYPE_EVENT, 0); break; case 1180: - DoScriptText(SAY_STAGE_1_07, me); + Talk(SAY_STAGE_1_07); m_uiUpdateTimer = 3000; instance->SetData(TYPE_EVENT, 0); break; case 2000: - DoScriptText(SAY_STAGE_1_08, me); + Talk(SAY_STAGE_1_08); m_uiUpdateTimer = 18000; instance->SetData(TYPE_EVENT, 2010); break; case 2030: - DoScriptText(SAY_STAGE_1_11, me); + Talk(SAY_STAGE_1_11); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 0); break; case 3000: - DoScriptText(SAY_STAGE_2_01, me); + Talk(SAY_STAGE_2_01); m_uiUpdateTimer = 12000; instance->SetData(TYPE_EVENT, 3050); break; case 3001: - DoScriptText(SAY_STAGE_2_01, me); + Talk(SAY_STAGE_2_01); m_uiUpdateTimer = 12000; instance->SetData(TYPE_EVENT, 3051); break; case 3060: - DoScriptText(SAY_STAGE_2_03, me); + Talk(SAY_STAGE_2_03); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 3070); break; case 3061: - DoScriptText(SAY_STAGE_2_03, me); + Talk(SAY_STAGE_2_03); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 3071); break; @@ -718,17 +731,17 @@ class npc_tirion_toc : public CreatureScript break; //Crusaders battle end case 3100: - DoScriptText(SAY_STAGE_2_06, me); + Talk(SAY_STAGE_2_06); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 0); break; case 4000: - DoScriptText(SAY_STAGE_3_01, me); + Talk(SAY_STAGE_3_01); m_uiUpdateTimer = 13000; instance->SetData(TYPE_EVENT, 4010); break; case 4010: - DoScriptText(SAY_STAGE_3_02, me); + Talk(SAY_STAGE_3_02); if (Creature* temp = me->SummonCreature(NPC_LIGHTBANE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { temp->SetVisible(false); @@ -769,7 +782,7 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 5000); break; case 5000: - DoScriptText(SAY_STAGE_4_01, me); + Talk(SAY_STAGE_4_01); m_uiUpdateTimer = 10000; instance->SetData(TYPE_EVENT, 5005); break; @@ -779,7 +792,7 @@ class npc_tirion_toc : public CreatureScript me->SummonCreature(NPC_LICH_KING_1, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5); break; case 5020: - DoScriptText(SAY_STAGE_4_03, me); + Talk(SAY_STAGE_4_03); m_uiUpdateTimer = 1000; instance->SetData(TYPE_EVENT, 0); break; @@ -789,14 +802,16 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 6005); break; case 6005: - DoScriptText(SAY_STAGE_4_06, me); + if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING))) + tirionFordring->AI()->Talk(NPC_TIRION_FORDRING); m_uiUpdateTimer = 20000; instance->SetData(TYPE_EVENT, 6010); break; case 6010: if (IsHeroic()) { - DoScriptText(SAY_STAGE_4_07, me); + if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING))) + tirionFordring->AI()->Talk(SAY_STAGE_4_07); m_uiUpdateTimer = 60000; instance->SetData(TYPE_ANUBARAK, SPECIAL); instance->SetData(TYPE_EVENT, 6020); @@ -854,7 +869,7 @@ class npc_garrosh_toc : public CreatureScript { case 130: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); - DoScriptText(SAY_STAGE_0_03h, me); + Talk(SAY_STAGE_0_03h); m_uiUpdateTimer = 3000; instance->SetData(TYPE_EVENT, 132); break; @@ -864,27 +879,27 @@ class npc_garrosh_toc : public CreatureScript instance->SetData(TYPE_EVENT, 140); break; case 2010: - DoScriptText(SAY_STAGE_1_09, me); + Talk(SAY_STAGE_1_09); m_uiUpdateTimer = 9000; instance->SetData(TYPE_EVENT, 2020); break; case 3050: - DoScriptText(SAY_STAGE_2_02h, me); + Talk(SAY_STAGE_2_02h); m_uiUpdateTimer = 15000; instance->SetData(TYPE_EVENT, 3060); break; case 3070: - DoScriptText(SAY_STAGE_2_04h, me); + Talk(SAY_STAGE_2_04h); m_uiUpdateTimer = 6000; instance->SetData(TYPE_EVENT, 3080); break; case 3081: - DoScriptText(SAY_STAGE_2_05h, me); + Talk(SAY_STAGE_2_05h); m_uiUpdateTimer = 3000; instance->SetData(TYPE_EVENT, 3091); break; case 4030: - DoScriptText(SAY_STAGE_3_03h, me); + Talk(SAY_STAGE_3_03h); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 4040); break; @@ -935,7 +950,7 @@ class npc_varian_toc : public CreatureScript { case 120: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); - DoScriptText(SAY_STAGE_0_03a, me); + Talk(SAY_STAGE_0_03a); m_uiUpdateTimer = 2000; instance->SetData(TYPE_EVENT, 122); break; @@ -945,27 +960,27 @@ class npc_varian_toc : public CreatureScript instance->SetData(TYPE_EVENT, 130); break; case 2020: - DoScriptText(SAY_STAGE_1_10, me); + Talk(SAY_STAGE_1_10); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 2030); break; case 3051: - DoScriptText(SAY_STAGE_2_02a, me); + Talk(SAY_STAGE_2_02a); m_uiUpdateTimer = 10000; instance->SetData(TYPE_EVENT, 3061); break; case 3071: - DoScriptText(SAY_STAGE_2_04a, me); + Talk(SAY_STAGE_2_04a); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 3081); break; case 3080: - DoScriptText(SAY_STAGE_2_05a, me); + Talk(SAY_STAGE_2_05a); m_uiUpdateTimer = 3000; instance->SetData(TYPE_EVENT, 3090); break; case 4020: - DoScriptText(SAY_STAGE_3_03a, me); + Talk(SAY_STAGE_3_03a); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 4040); break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index 99525b6fb32..f361c3521d1 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -162,6 +162,7 @@ enum eCreature { NPC_BARRENT = 34816, NPC_TIRION = 34996, + NPC_TIRION_FORDRING = 36095, NPC_FIZZLEBANG = 35458, NPC_GARROSH = 34995, NPC_VARIAN = 34990, -- cgit v1.2.3 From c9f4866648a8e22cfda2f92b7f6afae6c8c86695 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 00:01:39 +0200 Subject: Scripts/Trial Of The Crusader: * Fix typo * Fix creature_text group id for King Varian Wrynn / Garrosh Hellscream --- .../world/2012_08_14_00_world_creature_text.sql | 24 ++++++++++++++++++++++ .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2012_08_14_00_world_creature_text.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_14_00_world_creature_text.sql b/sql/updates/world/2012_08_14_00_world_creature_text.sql new file mode 100644 index 00000000000..bd0f3531937 --- /dev/null +++ b/sql/updates/world/2012_08_14_00_world_creature_text.sql @@ -0,0 +1,24 @@ +DELETE FROM `creature_text` WHERE `entry` IN (34990,34995); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +-- King Varian Wrynn +(34990, 0, 0, 'Your beasts will be no match for my champions, Tirion!', 14, 0, 0, 0, 0, 16069, 'King Varian Wrynn - Northrend Beasts Outro'), +(34990, 1, 0, 'The Alliance doesn''t need the help of a demon lord to deal with Horde filth! Come, pig!', 14, 0, 100, 5, 0, 16064, 'King Varian Wrynn - Lord Jaraxxus Outro'), +(34990, 2, 0, 'Our honor has been besmirched! They make wild claims and false accusations against us. I demand justice! Allow my champions to fight in place of your knights, Tirion. We challenge the Horde!', 14, 0, 100, 5, 0, 16066, 'King Varian Wrynn - Faction Champions Intro'), +(34990, 3, 0, 'Fight for the glory of the Alliance, heroes! Honor your king and your people!', 14, 0, 100, 5, 0, 16065, 'King Varian Wrynn - Faction Champions Intro'), +(34990, 4, 0, 'GLORY TO THE ALLIANCE!', 14, 0, 100, 0, 0, 16067, 'King Varian Wrynn - Victory'), +(34990, 5, 0, 'Not even the Lich King most powerful minions can stand against the Alliance! All hail our victors!', 14, 0, 0, 0, 0, 16068, 'King Varian Wrynn - Faction Champions Outro'), +(34990, 6, 0, 'Hardly a challenge.', 14, 0, 100, 274, 0, 16061, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 1, 'HAH!', 14, 0, 100, 5, 0, 16060, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 2, 'Is this the best the Horde has to offer?', 14, 0, 100, 6, 0, 16063, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 3, 'Worthless scrub.', 14, 0, 100, 25, 0, 16062, 'King Varian Wrynn - Faction Champions Kill Player'), +-- Garrosh Hellscream +(34995, 0, 0, 'I''ve seen more worthy challenges in the Ring of Blood. You waste our time, paladin.', 14, 0, 100, 1, 0, 16026, 'Garrosh Hellscream - Northrend Beasts Outro'), +(34995, 1, 0, 'Treacherous Alliance dogs! You summon a demon lord against warriors of the Horde? Your deaths will be swift!', 14, 0, 100, 5, 0, 16021, 'Garrosh Hellscream - Lord Jaraxxus Outro'), +(34995, 2, 0, 'The Horde demands justice! We challenge the Alliance. Allow us to battle in place of your knights, paladin. We will show these dogs what it means to insult the Horde!', 14, 0, 100, 1, 0, 16023, 'Garrosh Hellscream - Faction Champions Intro'), +(34995, 3, 0, 'Show them no mercy, Horde champions! LOK''TAR OGAR!', 14, 0, 0, 0, 0, 16022, 'Garrosh - Faction Champions Intro'), +(34995, 4, 0, 'That was just a taste of what the future brings. FOR THE HORDE!', 14, 0, 100, 1, 0, 16024, 'Garrosh Hellscream - Faction Champions Victory'), +(34995, 5, 0, 'Do you still question the might of the Horde, paladin? We will take on all comers!', 14, 0, 100, 1, 0, 16025, 'Garrosh Hellscream - Faction Champions Outro'), +(34995, 6, 0, 'Weakling!', 14, 0, 100, 0, 0, 16017, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 1, 'Pathetic!', 14, 0, 100, 0, 0, 16018, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 2, 'Overpowered.', 14, 0, 100, 0, 0, 16019, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 3, 'Lok''tar!', 14, 0, 100, 0, 0, 16020, 'Garrosh Hellscream - Faction Champions Kill Player'); 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 2a8eab0040a..7064368f090 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -803,7 +803,7 @@ class npc_tirion_toc : public CreatureScript break; case 6005: if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING))) - tirionFordring->AI()->Talk(NPC_TIRION_FORDRING); + tirionFordring->AI()->Talk(SAY_STAGE_4_06); m_uiUpdateTimer = 20000; instance->SetData(TYPE_EVENT, 6010); break; -- cgit v1.2.3 From a896fa8e76f8a43bcd6c9fe9812dbed5acc90858 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 18:10:15 +0200 Subject: Scripts/Onyxias Lair: Convert script_texts in creature_text --- .../world/2012_08_14_01_world_creature_text.sql | 8 ++++++++ .../scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp | 23 ++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 sql/updates/world/2012_08_14_01_world_creature_text.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_14_01_world_creature_text.sql b/sql/updates/world/2012_08_14_01_world_creature_text.sql new file mode 100644 index 00000000000..0f182ae098e --- /dev/null +++ b/sql/updates/world/2012_08_14_01_world_creature_text.sql @@ -0,0 +1,8 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=10184; +DELETE FROM `creature_text` WHERE `entry`=10184; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(10184, 0, 0, 'How fortuitous. Usually, I must leave my lair in order to feed.', 14, 0, 100, 0, 0, 0, 'Onyxia - Aggro'), +(10184, 1, 0, 'Learn your place mortal!', 14, 0, 100, 0, 0, 0, 'Onyxia - Kill Player'), +(10184, 2, 0, 'This meaningless exertion bores me. I''ll incinerate you all from above!', 14, 0, 100, 0, 0, 0, 'Onyxia - Phase 2'), +(10184, 3, 0, 'It seems you''ll need another lesson, mortals!', 14, 0, 100, 0, 0, 0, 'Onyxia - Phase 3'), +(10184, 4, 0, '%s takes in a deep breath...', 41, 0, 100, 0, 0, 0, 'Onyxia - Deep Breath Emote'); diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 1fdf941d75c..c243682cc61 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -35,11 +35,14 @@ EndScriptData */ enum Yells { - SAY_AGGRO = -1249000, - SAY_KILL = -1249001, - SAY_PHASE_2_TRANS = -1249002, - SAY_PHASE_3_TRANS = -1249003, - EMOTE_BREATH = -1249004, + // Say + SAY_AGGRO = 0, + SAY_KILL = 1, + SAY_PHASE_2_TRANS = 2, + SAY_PHASE_3_TRANS = 3, + + // Emote + EMOTE_BREATH = 4, }; enum Spells @@ -184,7 +187,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); me->SetInCombatWithZone(); if (instance) @@ -227,7 +230,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void SpellHit(Unit* /*pCaster*/, const SpellInfo* Spell) @@ -269,7 +272,7 @@ public: me->SetCanFly(true); me->GetMotionMaster()->MovePoint(11, Phase2Location.GetPositionX(), Phase2Location.GetPositionY(), Phase2Location.GetPositionZ()+25); me->SetSpeed(MOVE_FLIGHT, 1.0f); - DoScriptText(SAY_PHASE_2_TRANS, me); + Talk(SAY_PHASE_2_TRANS); if (instance) instance->SetData(DATA_ONYXIA_PHASE, Phase); WhelpTimer = 5000; @@ -416,7 +419,7 @@ public: Phase = PHASE_END; if (instance) instance->SetData(DATA_ONYXIA_PHASE, Phase); - DoScriptText(SAY_PHASE_3_TRANS, me); + Talk(SAY_PHASE_3_TRANS); SetCombatMovement(true); me->SetCanFly(false); @@ -432,7 +435,7 @@ public: if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); - DoScriptText(EMOTE_BREATH, me); + Talk(EMOTE_BREATH); DoCast(me, PointData->SpellId); DeepBreathTimer = 70000; } -- cgit v1.2.3 From 302051da3d01dce352e514caff7485ef9afe4df1 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 23:46:42 +0200 Subject: Core/Scripts: Fixed more uninitialized variables --- src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp | 1 + .../scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index ecf173b02e5..a8afd19cd96 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -109,6 +109,7 @@ class boss_halazzi : public CreatureScript if (instance) instance->SetData(DATA_HALAZZIEVENT, NOT_STARTED); + LynxGUID = 0; TransformCount = 0; BerserkTimer = 600000; CheckTimer = 1000; diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 7875d8edacf..99401c1d944 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -70,6 +70,7 @@ public: void Initialize() { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); uiTrollgore = 0; uiNovos = 0; uiDred = 0; -- cgit v1.2.3 From bddaf9b3a4c4385a02ff11ba92aef95ebac7ccab Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 23:58:08 +0200 Subject: Core/Scripts: Fix uninitialized variable in boss_akilzon --- src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index c7d6e2fb6e4..871a82c8e28 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -116,8 +116,7 @@ class boss_akilzon : public CreatureScript CloudGUID = 0; CycloneGUID = 0; DespawnSummons(); - for (uint8 i = 0; i < 8; ++i) - BirdGUIDs[i] = 0; + memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); StormCount = 0; StormSequenceTimer = 0; -- cgit v1.2.3 From a306d39bb4c20b48fb1a0a3d035a18c206205701 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 15 Aug 2012 00:06:19 +0200 Subject: Core/Scripts: Missing change from previous commit --- src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 871a82c8e28..068d00f550f 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -80,7 +80,9 @@ class boss_akilzon : public CreatureScript boss_akilzonAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); + memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); } + InstanceScript* instance; uint64 BirdGUIDs[8]; -- cgit v1.2.3 From b77d88ec51e734a65f3d2ce3c69991980ac23ffd Mon Sep 17 00:00:00 2001 From: Spp Date: Wed, 15 Aug 2012 15:59:11 +0200 Subject: Core/Logging: Fix crash on authserver shutdown Closes #7365 Closes #7325 --- src/server/shared/Logging/Log.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 1dca5e71006..27f33754da9 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -181,12 +181,18 @@ void Log::CreateLoggerFromConfig(const char* name) options.append(name); options = ConfigMgr::GetStringDefault(options.c_str(), ""); + if (options.empty()) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name); + return; + } + Tokens tokens(options, ','); Tokens::iterator iter = tokens.begin(); if (tokens.size() != 3) { - fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong configuration for logger %s. Config line: %s\n", name, options.c_str()); + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name, options.c_str()); return; } @@ -467,15 +473,15 @@ void Log::SetRealmID(uint32 id) void Log::Close() { + delete worker; + worker = NULL; + loggers.clear(); for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) { delete it->second; it->second = NULL; } appenders.clear(); - loggers.clear(); - delete worker; - worker = NULL; } void Log::LoadFromConfig() -- cgit v1.2.3 From 52a5991c1258073d561e8b74ef99a7b940808d92 Mon Sep 17 00:00:00 2001 From: Spp Date: Wed, 15 Aug 2012 19:58:02 +0200 Subject: Core/Logging: Added documentation about this system - Restored old CharDump (LOG_FILTER_PLAYER_DUMP) but disabled by default. - "%s" is now used to set dynamic file names, only used by GM commands and Player dump --- doc/LoggingHOWTO.txt | 276 ++++++++++++++++++++++++++ src/server/authserver/authserver.conf.dist | 2 +- src/server/game/Handlers/CharacterHandler.cpp | 8 +- src/server/shared/Logging/Appender.h | 9 +- src/server/shared/Logging/AppenderFile.cpp | 4 +- src/server/shared/Logging/Log.cpp | 22 +- src/server/shared/Logging/Log.h | 1 + src/server/worldserver/worldserver.conf.dist | 21 +- 8 files changed, 325 insertions(+), 18 deletions(-) create mode 100644 doc/LoggingHOWTO.txt (limited to 'src') diff --git a/doc/LoggingHOWTO.txt b/doc/LoggingHOWTO.txt new file mode 100644 index 00000000000..12850eb06cf --- /dev/null +++ b/doc/LoggingHOWTO.txt @@ -0,0 +1,276 @@ +Logging system "log4j-like" + +--- LOGGERS AND APPENDERS --- + +Logging system has two components: loggers and appenders. These types of +components enable users to log messages according to message type and level and +control at runtime where they are reported. + +LOGGERS + +The first and foremost advantage of this system resided in the ability to +disable certain log statements while allowing others to print unhindered. +This capability assumes that the loggers are categorized according to some +developer-chosen criteria. + +Loggers follow hierarchy, if a logger is not defined a root logger will be used + +Loggers may be assigned levels. The set of possible levels are TRACE, DEBUG, +INFO, WARN, ERROR AND FATAL, or be disabled using level DISABLED. + +By definition the printing method determines the level of a logging request. +For example, sLog->outInfo(...) is a logging request of level INFO. + +A logging request is said to be enabled if its level is higher than or equal to +the level of its logger. Otherwise, the request is said to be disabled. A logger +without an assigned level will inherit one from the hierarchy + +Example +Logger Name Assigned Level Inherited Level +root Proot Proot +Network None Proot + +As Network is not defined, it uses the root logger and it's log level. +TRACE < DEBUG < INFO < WARN < ERROR < FATAL. + + +APPENDERS + +The ability to selectively enable of dissable logging request based on their +loggers is only part of the picture. This system allows logging requests to +print to multiple destinations. An output destination is called an appender. +Current system defines appenders for Console, files and Database, but can be +easily extended to remote socket server, NT event loggers, syslog daemons or +any other system. + +More than one appender can be attached to one logger. Each enabled logging +request for a given logger will be forwarded to all the appenders in that +logger + + +CONFIGURATION + +System will read "Loggers" and "Appenders" to know the list of loggers and +appenders to read from config file. Both are a list of elements separated +by space. + +Once we have the list of appenders to read, system will try to configure a new +appender from its config line. Appender config line follows the format: + + Type,LogLevel,Flags,optional1,optional2 + +Its a list of elements separated by comma where each element has its own meaning + Type: Type of the appender + 1 - (Console) + 2 - (File) + 3 - (DB) + LogLevel: Log level + 0 - (Disabled) + 1 - (Trace) + 2 - (Debug) + 3 - (Info) + 4 - (Warn) + 5 - (Error) + 6 - (Fatal) + Flags: Define some extra modifications to do to logging message + 1 - Prefix Timestamp to the text + 2 - Prefix Log Level to the text + 4 - Prefix Log Filter type to the text + 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS + (Only used with Type = 2) + 16 - Make a backup of existing file before overwrite + (Only used with Mode = w) + +Depending on the type, elements optional1 and optional2 will take different + + Colors (read as optional1 if Type = Console) + Format: "fatal error warn info debug trace" + 0 - BLACK + 1 - RED + 2 - GREEN + 3 - BROWN + 4 - BLUE + 5 - MAGENTA + 6 - CYAN + 7 - GREY + 8 - YELLOW + 9 - LRED + 10 - LGREEN + 11 - LBLUE + 12 - LMAGENTA + 13 - LCYAN + 14 - WHITE + Example: "13 11 9 5 3 1" + + File: Name of the file (read as optional1 if Type = File) + Allows to use one "%u" to create dynamic files + + Mode: Mode to open the file (read as optional2 if Type = File) + a - (Append) + w - (Overwrite) + +Example: + Appender.Console1=1,2,6 + + Creates new appender to log to console any message with log level DEBUG + or higher and prefixes log type and level to the message. + + Appender.Console2=1,5,1,13 11 9 5 3 1 + + Creates new appender to log to console any message with log level ERROR + or higher and prefixes timestamp to the message using colored text. + + Appender.File=2,2,7,Auth.log,w + + Creates new appender to log to file "Auth.log" any message with log level + DEBUG or higher and prefixes timestamp, type and level to message + +In the example, having two different loggers to log to console is perfectly +legal but redundant. + +Once we have the list of loggers to read, system will try to configure a new +logger from its config line. Logger config line follows the format: + + Type,LogLevel,AppenderList + +Its a list of elements separated by comma where each element has its own meaning + Type: Type of the logger ( + 0 - Default. Each type that has no config will + rely on this one. Core will create this logger + (disabled) if it's not configured + 1 - Units that doesn't fit in other categories + 2 - Pets + 3 - Vehicles + 4 - C++ AI, instance scripts, etc. + 5 - DB AI, such as SAI, EAI, CreatureAI + 6 - DB map scripts + 7 - Network input/output, + such as packet handlers and netcode logs + 8 - Spellsystem and aurasystem + 9 - Achievement system + 10 - Condition system + 11 - Pool system + 12 - Auction house + 13 - Arena's and battlegrounds + 14 - Outdoor PVP + 15 - Chat system + 16 - LFG system + 17 - Maps, instances (not scripts), + grids, cells, visibility, etc. + 18 - Player that doesn't fit in other categories. + 19 - Player loading from DB + (Player::_LoadXXX functions) + 20 - Items + 21 - Player skills (do not confuse with spells) + 22 - Player chat logs + 23 - loot + 24 - guilds + 25 - transports + 26 - SQL. DB errors + 27 - GM Commands + 28 - Remote Access Commands + 29 - Warden + 30 - Authserver + 31 - Worldserver + 32 - Game Events + 33 - Calendar + 34 - Character (Exclusive to login, logout, create, rename and delete) + 35 - Arenas + 36 - SQL Driver + 37 - SQL Dev + LogLevel + 0 - (Disabled) + 1 - (Trace) + 2 - (Debug) + 3 - (Info) + 4 - (Warn) + 5 - (Error) + 6 - (Fatal) + AppenderList: List of appenders linked to logger + (Using spaces as separator). + +--- EXAMPLES --- + +EXAMPLE 1 + +Log errors to console and a file called server.log that only contain +logs for this server run. File should prefix timestamp, type and log level to +the messages. Console should prefix type and log level. + + Appenders=Console Server + Loggers=Root + Appender.Console=1,5,6 + Appender.Server=2,5,7,Server.log,w + Logger.Root=0,5,Console Server + +Lets trace how system will log two different messages: + 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created"); + System will try to find logger of type GUILD, as no logger is configured + for GUILD it will use Root logger. As message Log Level is equal or higher + than the Log level of logger the message is sent to the Appenders + configured in the Logger. "Console" and "Server". + Console will write: "ERROR [GUILD ] Guild 1 created" + Server will write to file "2012-08-15 ERROR [GUILD ] Guild 1 created" + + 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in"); + System will try to find logger of type CHARACTER, as no logger is + configured for CHARACTER it will use Root logger. As message Log Level is + not equal or higher than the Log level of logger the message its discarted. + +EXAMPLE 2 + +Same example that above, but now i want to see all messages of level INFO on +file and server file should add timestamp on creation. + + Appenders=Console Server + Loggers=Root + Appender.Console=1,5,6 + Appender.Server=2,4,15,Server.log + Logger.Root=0,4,Console Server + +Lets trace how system will log two different messages: + 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created"); + Performs exactly as example 1. + 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in"); + System will try to find logger of type CHARACTER, as no logger is + configured for CHARACTER it will use Root logger. As message Log Level is + equal or higher than the Log level of logger the message is sent to the + Appenders configured in the Logger. "Console" and "Server". + Console will discard msg as Log Level is not higher or equal to this + appender + Server will write to file + "2012-08-15 INFO [CHARACTER ] Guild 1 Player Name Logged in" + +EXAMPLE 3 +As a dev, i may be interested in logging just a particular part of the core +while i'm trying to fix something. So... i want to debug GUILDS to maximum +and also some CHARACTER events to some point. Also im checking some Waypoints +so i want SQLDEV to be logged to file without prefixes. All other messages +should only be logged to console, GUILD to TRACE and CHARACTER to INFO + + Appenders=Console SQLDev + Loggers=Guild Characters SQLDev + Appender.Console=1,1 + Appender.SQLDev=2,2,0,SQLDev.log + Logger.Guild=24,1,Console + Logger.Characters=34,3,Console + Logger.SQLDev=37,3,SQLDev + +With this config, any message logger with a Log type different to GUILD, +CHARACTER or SQLDEV will be ignored, as we didn't define a logger Root and +system created a default Root disabled. Appender Console, log level should be +defined to allow all possible messages of its loggers, in this case GUILD uses +TRACE (1), so Appender should allow it. Logger Characters will limit it's own +messages to INFO (3) + +--- SOME EXTRA COMMENTS --- +why this system is better than previous one? +- Can be extended: Anyone can easily create new appenders to log to new + systems as syslog or IRC, having all code related to that system in particular + files +- It's asyncronous: Uses threads to write messages, so core performance wont be + affected by IO operations +- Lets us select "What to log" and "Where to log" on the fly. You can log to a + dozen of files without having to change a single line of code + + \ No newline at end of file diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index d1c92dcf1d0..15dd02d9052 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -170,7 +170,7 @@ LoginDatabase.WorkerThreads = 1 # 5 - (Error) # 6 - (Fatal) # -# Flags: Default Console = 6, File = 7, DB = 0 +# Flags: # 0 - None # 1 - Prefix Timestamp to the text # 2 - Prefix Log Level to the text diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 7451bd2dc2a..8544266840f 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -719,11 +719,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->ShouldLog(LOG_FILTER_CHARACTER, LOG_LEVEL_DEBUG)) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outDebug(LOG_FILTER_CHARACTER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + { + std::ostringstream ss; + ss << GetAccountId() << '_' << name.c_str(); + sLog->outCharDump(ss.str().c_str(), dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + } } Player::DeleteFromDB(guid, GetAccountId()); diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 332edbf170c..ebe7408d400 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -62,10 +62,12 @@ enum LogFilterType LOG_FILTER_CHARACTER, LOG_FILTER_ARENAS, LOG_FILTER_SQL_DRIVER, - LOG_FILTER_SQL_DEV + LOG_FILTER_SQL_DEV, + LOG_FILTER_PLAYER_DUMP, + LOG_FILTER_BATTLEFIELD }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_SQL_DEV) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_BATTLEFIELD) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel @@ -105,7 +107,6 @@ struct LogMessage : level(_level) , type(_type) , text(_text) - , param1(0) { mtime = time(NULL); } @@ -117,7 +118,7 @@ struct LogMessage LogFilterType type; std::string text; std::string prefix; - uint32 param1; + std::string param1; time_t mtime; }; diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 01a2f34baa7..67adff39aae 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -24,7 +24,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, co , logDir(_logDir) , mode(_mode) { - dynamicName = std::string::npos != filename.find("%u"); + dynamicName = std::string::npos != filename.find("%s"); backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL; @@ -44,7 +44,7 @@ void AppenderFile::_write(LogMessage& message) if (dynamicName) { char namebuf[TRINITY_PATH_MAX]; - snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1); + snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1.c_str()); logfile = OpenFile(namebuf, mode, backup); } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 27f33754da9..64f7e697f1f 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -449,6 +449,23 @@ void Log::outFatal(LogFilterType filter, const char * str, ...) va_end(ap); } +void Log::outCharDump(const char* param, const char * str, ...) +{ + if (!str || !ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) + return; + + va_list ap; + va_start(ap, str); + char text[MAX_QUERY_LEN]; + vsnprintf(text, MAX_QUERY_LEN, str, ap); + va_end(ap); + + LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_PLAYER_DUMP, text); + msg->param1 = param; + + write(msg); +} + void Log::outCommand(uint32 account, const char * str, ...) { if (!str || !ShouldLog(LOG_FILTER_GMCOMMAND, LOG_LEVEL_INFO)) @@ -461,7 +478,10 @@ void Log::outCommand(uint32 account, const char * str, ...) va_end(ap); LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_GMCOMMAND, text); - msg->param1 = account; + + std::ostringstream ss; + ss << account; + msg->param1 = ss.str(); write(msg); } diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 7b0e8cd381b..cd1e9dc80df 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -56,6 +56,7 @@ class Log void EnableDBAppenders(); void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); + void outCharDump(const char* param, const char* str, ...) ATTR_PRINTF(3, 4); static std::string GetTimestampStr(); void SetRealmID(uint32 id); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index be5a452c7b4..789af4e371b 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2592,7 +2592,7 @@ PlayerDump.DisallowOverwrite = 1 # 5 - (Error) # 6 - (Fatal) # -# Flags: Default Console = 6, File = 7, DB = 0 +# Flags: # 0 - None # 1 - Prefix Timestamp to the text # 2 - Prefix Log Level to the text @@ -2629,13 +2629,14 @@ PlayerDump.DisallowOverwrite = 1 Appender.Console=1,2,6 Appender.Server=2,2,7,Server.log,w -Appender.GM=2,2,7,GM.log +Appender.GM=2,2,7,GM_%s.log Appender.SQL=2,2,7,SQL.log Appender.DBErrors=2,2,7,DBErrors.log Appender.Char=2,2,7,Char.log,w +Appender.CharDump=2,2,0,chardumps/%s.log Appender.RA=2,2,7,RA.log Appender.Arenas=2,2,7,Arena.log -Appender.SQLDev=2,2,7,SQLDev.log +Appender.SQLDev=2,2,0,SQLDev.log Appender.SQLDriver=2,2,7,SQLDriver.log Appender.Warden=2,2,7,Warden.log Appender.Chat=2,2,7,Chat.log @@ -2684,12 +2685,14 @@ Appender.Chat=2,2,7,Chat.log # 31 - Worldserver # 32 - Game Events # 33 - Calendar -# 34 - Character (Exclusive to log login, logout, create, rename, delete actions) +# 34 - Character (Exclusive to log login, logout, create, rename) # 35 - Arenas # 36 - SQL Driver # 37 - SQL Dev +# 38 - Player Dump +# 39 - Battlefield -Logger.Root=0,5,Console Server +Logger.Root=0,3,Console Server Logger.Units=1,3,Console Server Logger.Pets=2,3,Console Server Logger.Vehicles=3,3,Console Server @@ -2715,7 +2718,7 @@ Logger.PlayerChat=22,3,Chat Logger.Loot=23,3,Console Server Logger.Guilds=24,3,Console Server Logger.Transports=25,3,Console Server -Logger.SQL=26,2,Console Server SQL +Logger.SQL=26,2,Console Server DBErrors Logger.GM=27,3,Console Server GM Logger.RA=28,3,RA Logger.Warden=29,3,Warden @@ -2727,6 +2730,8 @@ Logger.Character=34,3,Char Logger.Arenas=35,3,Arenas Logger.SQLDriver=36,5,SQLDriver Logger.SQLDev=37,3,SQLDev +Logger.CharDump=38,5,CharDump +Logger.Battlefield=39,3,Console Server # LogLevel # 0 - (Disabled) @@ -2745,7 +2750,7 @@ Logger.SQLDev=37,3,SQLDev # (Using spaces as separator). # Default: "Console Server" -Appenders=Console Server +Appenders=Console Server GM Char Arenas Warden DBErrors CharDump # # Loggers @@ -2753,4 +2758,4 @@ Appenders=Console Server # (Using spaces as separator). # Default: "root" -Loggers=Root +Loggers=Root GM Character Arenas Warden SQL -- cgit v1.2.3 From ca2bc35713895adebbae30e1b371d9ff2d970bff Mon Sep 17 00:00:00 2001 From: Nay Date: Wed, 15 Aug 2012 21:30:55 +0100 Subject: Misc: CRLF to LF, whitespace cleanup and tabs to spaces --- doc/LoggingHOWTO.txt | 82 +- src/server/scripts/Commands/cs_disable.cpp | 14 +- src/server/scripts/Commands/cs_misc.cpp | 5758 ++++++++++++++-------------- src/server/shared/Logging/AppenderDB.cpp | 2 +- src/server/shared/Logging/Log.cpp | 2 +- 5 files changed, 2929 insertions(+), 2929 deletions(-) (limited to 'src') diff --git a/doc/LoggingHOWTO.txt b/doc/LoggingHOWTO.txt index 12850eb06cf..4e61812d7d8 100644 --- a/doc/LoggingHOWTO.txt +++ b/doc/LoggingHOWTO.txt @@ -23,7 +23,7 @@ For example, sLog->outInfo(...) is a logging request of level INFO. A logging request is said to be enabled if its level is higher than or equal to the level of its logger. Otherwise, the request is said to be disabled. A logger -without an assigned level will inherit one from the hierarchy +without an assigned level will inherit one from the hierarchy Example Logger Name Assigned Level Inherited Level @@ -72,16 +72,16 @@ Its a list of elements separated by comma where each element has its own meaning 4 - (Warn) 5 - (Error) 6 - (Fatal) - Flags: Define some extra modifications to do to logging message + Flags: Define some extra modifications to do to logging message 1 - Prefix Timestamp to the text 2 - Prefix Log Level to the text 4 - Prefix Log Filter type to the text 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS - (Only used with Type = 2) + (Only used with Type = 2) 16 - Make a backup of existing file before overwrite - (Only used with Mode = w) + (Only used with Mode = w) -Depending on the type, elements optional1 and optional2 will take different +Depending on the type, elements optional1 and optional2 will take different Colors (read as optional1 if Type = Console) Format: "fatal error warn info debug trace" @@ -111,22 +111,22 @@ Depending on the type, elements optional1 and optional2 will take different Example: Appender.Console1=1,2,6 - - Creates new appender to log to console any message with log level DEBUG - or higher and prefixes log type and level to the message. - - Appender.Console2=1,5,1,13 11 9 5 3 1 - - Creates new appender to log to console any message with log level ERROR - or higher and prefixes timestamp to the message using colored text. - - Appender.File=2,2,7,Auth.log,w - - Creates new appender to log to file "Auth.log" any message with log level - DEBUG or higher and prefixes timestamp, type and level to message - + + Creates new appender to log to console any message with log level DEBUG + or higher and prefixes log type and level to the message. + + Appender.Console2=1,5,1,13 11 9 5 3 1 + + Creates new appender to log to console any message with log level ERROR + or higher and prefixes timestamp to the message using colored text. + + Appender.File=2,2,7,Auth.log,w + + Creates new appender to log to file "Auth.log" any message with log level + DEBUG or higher and prefixes timestamp, type and level to message + In the example, having two different loggers to log to console is perfectly -legal but redundant. +legal but redundant. Once we have the list of loggers to read, system will try to configure a new logger from its config line. Logger config line follows the format: @@ -188,7 +188,7 @@ Its a list of elements separated by comma where each element has its own meaning 6 - (Fatal) AppenderList: List of appenders linked to logger (Using spaces as separator). - + --- EXAMPLES --- EXAMPLE 1 @@ -198,23 +198,23 @@ logs for this server run. File should prefix timestamp, type and log level to the messages. Console should prefix type and log level. Appenders=Console Server - Loggers=Root + Loggers=Root Appender.Console=1,5,6 Appender.Server=2,5,7,Server.log,w Logger.Root=0,5,Console Server Lets trace how system will log two different messages: 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created"); - System will try to find logger of type GUILD, as no logger is configured - for GUILD it will use Root logger. As message Log Level is equal or higher - than the Log level of logger the message is sent to the Appenders - configured in the Logger. "Console" and "Server". - Console will write: "ERROR [GUILD ] Guild 1 created" - Server will write to file "2012-08-15 ERROR [GUILD ] Guild 1 created" - + System will try to find logger of type GUILD, as no logger is configured + for GUILD it will use Root logger. As message Log Level is equal or higher + than the Log level of logger the message is sent to the Appenders + configured in the Logger. "Console" and "Server". + Console will write: "ERROR [GUILD ] Guild 1 created" + Server will write to file "2012-08-15 ERROR [GUILD ] Guild 1 created" + 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in"); - System will try to find logger of type CHARACTER, as no logger is - configured for CHARACTER it will use Root logger. As message Log Level is + System will try to find logger of type CHARACTER, as no logger is + configured for CHARACTER it will use Root logger. As message Log Level is not equal or higher than the Log level of logger the message its discarted. EXAMPLE 2 @@ -223,23 +223,23 @@ Same example that above, but now i want to see all messages of level INFO on file and server file should add timestamp on creation. Appenders=Console Server - Loggers=Root + Loggers=Root Appender.Console=1,5,6 Appender.Server=2,4,15,Server.log Logger.Root=0,4,Console Server Lets trace how system will log two different messages: 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created"); - Performs exactly as example 1. + Performs exactly as example 1. 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in"); - System will try to find logger of type CHARACTER, as no logger is - configured for CHARACTER it will use Root logger. As message Log Level is + System will try to find logger of type CHARACTER, as no logger is + configured for CHARACTER it will use Root logger. As message Log Level is equal or higher than the Log level of logger the message is sent to the - Appenders configured in the Logger. "Console" and "Server". + Appenders configured in the Logger. "Console" and "Server". Console will discard msg as Log Level is not higher or equal to this - appender - Server will write to file - "2012-08-15 INFO [CHARACTER ] Guild 1 Player Name Logged in" + appender + Server will write to file + "2012-08-15 INFO [CHARACTER ] Guild 1 Player Name Logged in" EXAMPLE 3 As a dev, i may be interested in logging just a particular part of the core @@ -249,11 +249,11 @@ so i want SQLDEV to be logged to file without prefixes. All other messages should only be logged to console, GUILD to TRACE and CHARACTER to INFO Appenders=Console SQLDev - Loggers=Guild Characters SQLDev + Loggers=Guild Characters SQLDev Appender.Console=1,1 Appender.SQLDev=2,2,0,SQLDev.log Logger.Guild=24,1,Console - Logger.Characters=34,3,Console + Logger.Characters=34,3,Console Logger.SQLDev=37,3,SQLDev With this config, any message logger with a Log type different to GUILD, diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index a2a80edd43b..0bb376b08dd 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -62,7 +62,7 @@ public: { "add", SEC_ADMINISTRATOR, true, NULL, "", addDisableCommandTable }, { "remove", SEC_ADMINISTRATOR, true, NULL, "", removeDisableCommandTable }, { NULL, 0, false, NULL, "", NULL } - }; + }; static ChatCommand commandTable[] = { { "disable", SEC_ADMINISTRATOR, false, NULL, "", disableCommandTable }, @@ -88,7 +88,7 @@ public: uint32 entry = uint32(atoi(entryStr)); std::string disableTypeStr = ""; - + switch (disableType) { case DISABLE_TYPE_SPELL: @@ -171,12 +171,12 @@ public: default: break; } - + PreparedStatement* stmt = NULL; stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); - stmt->setUInt8(1, disableType); - PreparedQueryResult result = WorldDatabase.Query(stmt); + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (result) { handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry); @@ -290,8 +290,8 @@ public: PreparedStatement* stmt = NULL; stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); - stmt->setUInt8(1, disableType); - PreparedQueryResult result = WorldDatabase.Query(stmt); + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) { handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 80847d7dec4..1edaaf5bcbf 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1,2879 +1,2879 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * - * 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 . - */ - -#include "Chat.h" -#include "ScriptMgr.h" -#include "AccountMgr.h" -#include "ArenaTeamMgr.h" -#include "CellImpl.h" -#include "GridNotifiers.h" -#include "Group.h" -#include "InstanceSaveMgr.h" -#include "MovementGenerator.h" -#include "ObjectAccessor.h" -#include "SpellAuras.h" -#include "TargetedMovementGenerator.h" -#include "WeatherMgr.h" -#include "ace/INET_Addr.h" - -class misc_commandscript : public CommandScript -{ -public: - misc_commandscript() : CommandScript("misc_commandscript") { } - - ChatCommand* GetCommands() const - { - static ChatCommand groupCommandTable[] = - { - { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL }, - { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL }, - { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand petCommandTable[] = - { - { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL }, - { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL }, - { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand sendCommandTable[] = - { - { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL }, - { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL }, - { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL }, - { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand commandTable[] = - { - { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL }, - { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, - { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL }, - { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL }, - { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL }, - { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL }, - { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL }, - { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL }, - { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL }, - { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL }, - { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL }, - { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL }, - { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL }, - { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL }, - { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL }, - { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL }, - { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL }, - { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL }, - { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL }, - { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL }, - { "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL }, - { "taxicheat", SEC_MODERATOR, false, &HandleTaxiCheatCommand, "", NULL }, - { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL }, - { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL }, - { "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "", NULL }, - { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL }, - { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL }, - { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL }, - { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL }, - { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL }, - { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL }, - { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL }, - { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL }, - { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL }, - { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL }, - { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable }, - { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, - { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL }, - { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL }, - { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL }, - { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL }, - { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL }, - { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL }, - { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL }, - { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL }, - { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "", NULL }, - { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL }, - { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL }, - { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL }, - { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, - { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL }, - { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL }, - { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL }, - { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL }, - { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - return commandTable; - } - - static bool HandleDevCommand(ChatHandler* handler, char const* args) - { - if (!*args) - { - if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER)) - handler->GetSession()->SendNotification(LANG_DEV_ON); - else - handler->GetSession()->SendNotification(LANG_DEV_OFF); - return true; - } - - std::string argstr = (char*)args; - - if (argstr == "on") - { - handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); - handler->GetSession()->SendNotification(LANG_DEV_ON); - return true; - } - - if (argstr == "off") - { - handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); - handler->GetSession()->SendNotification(LANG_DEV_OFF); - return true; - } - - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - return false; - } - - static bool HandleGPSCommand(ChatHandler* handler, char const* args) - { - WorldObject* object = NULL; - if (*args) - { - uint64 guid = handler->extractGuidFromLink((char*)args); - if (guid) - object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); - - if (!object) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - object = handler->getSelectedUnit(); - - if (!object) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - } - - CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); - Cell cell(cellCoord); - - uint32 zoneId, areaId; - object->GetZoneAndAreaId(zoneId, areaId); - - MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); - AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); - - float zoneX = object->GetPositionX(); - float zoneY = object->GetPositionY(); - - Map2ZoneCoordinates(zoneX, zoneY, zoneId); - - Map const* map = object->GetMap(); - float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); - float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); - - GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); - - // 63? WHY? - int gridX = 63 - gridCoord.x_coord; - int gridY = 63 - gridCoord.y_coord; - - uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - - if (haveVMap) - { - if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) - handler->PSendSysMessage("You are outdoors"); - else - handler->PSendSysMessage("You are indoors"); - } - else - handler->PSendSysMessage("no VMAP available for area info"); - - handler->PSendSysMessage(LANG_MAP_POSITION, - object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : ""), - zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : ""), - areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : ""), - object->GetPhaseMask(), - object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), - cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), - zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); - - LiquidData liquidStatus; - ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); - - if (status) - handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); - - return true; - } - - static bool HandleAuraCommand(ChatHandler* handler, char const* args) - { - Unit* target = handler->getSelectedUnit(); - if (!target) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellId = handler->extractSpellIdFromLink((char*)args); - - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) - Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target); - - return true; - } - - static bool HandleUnAuraCommand(ChatHandler* handler, char const* args) - { - Unit* target = handler->getSelectedUnit(); - if (!target) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - std::string argstr = args; - if (argstr == "all") - { - target->RemoveAllAuras(); - return true; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellId = handler->extractSpellIdFromLink((char*)args); - if (!spellId) - return false; - - target->RemoveAurasDueToSpell(spellId); - - return true; - } - // Teleport to Player - static bool HandleAppearCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - Player* _player = handler->GetSession()->GetPlayer(); - if (target == _player || targetGuid == _player->GetGUID()) - { - handler->SendSysMessage(LANG_CANT_TELEPORT_SELF); - handler->SetSentErrorMessage(true); - return false; - } - - if (target) - { - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - std::string chrNameLink = handler->playerLink(targetName); - - Map* map = target->GetMap(); - if (map->IsBattlegroundOrArena()) - { - // only allow if gm mode is on - if (!_player->isGameMaster()) - { - handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - // if both players are in different bgs - else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) - _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff - - // all's well, set bg id - // when porting out from the bg, it will be reset to 0 - _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId()); - // remember current position as entry point for return at bg end teleportation - if (!_player->GetMap()->IsBattlegroundOrArena()) - _player->SetBattlegroundEntryPoint(); - } - else if (map->IsDungeon()) - { - // we have to go to instance, and can go to player only if: - // 1) we are in his group (either as leader or as member) - // 2) we are not bound to any group and have GM mode on - if (_player->GetGroup()) - { - // we are in group, we can go only if we are in the player group - if (_player->GetGroup() != target->GetGroup()) - { - handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - // we are not in group, let's verify our GM mode - if (!_player->isGameMaster()) - { - handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - - // if the player or the player's group is bound to another instance - // the player will not be bound to another one - InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid())); - if (!bind) - { - Group* group = _player->GetGroup(); - // if no bind exists, create a solo bind - InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind - if (!gBind) - if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) - _player->BindToInstance(save, !save->CanReset()); - } - - if (map->IsRaid()) - _player->SetRaidDifficulty(target->GetRaidDifficulty()); - else - _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); - } - - handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); - - // stop flight if need - if (_player->isInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - _player->SaveRecallPosition(); - - // to point to see at target with same orientation - float x, y, z; - target->GetContactPoint(_player, x, y, z); - - _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); - _player->SetPhaseMask(target->GetPhaseMask(), true); - } - else - { - // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) - return false; - - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str()); - - // to point where player stay (if loaded) - float x, y, z, o; - uint32 map; - bool in_flight; - if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid)) - return false; - - // stop flight if need - if (_player->isInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - _player->SaveRecallPosition(); - - _player->TeleportTo(map, x, y, z, _player->GetOrientation()); - } - - return true; - } - // Summon Player - static bool HandleSummonCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - Player* _player = handler->GetSession()->GetPlayer(); - if (target == _player || targetGuid == _player->GetGUID()) - { - handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF); - handler->SetSentErrorMessage(true); - return false; - } - - if (target) - { - std::string nameLink = handler->playerLink(targetName); - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - if (target->IsBeingTeleported()) - { - handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - Map* map = handler->GetSession()->GetPlayer()->GetMap(); - - if (map->IsBattlegroundOrArena()) - { - // only allow if gm mode is on - if (!_player->isGameMaster()) - { - handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - // if both players are in different bgs - else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId()) - target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff - - // all's well, set bg id - // when porting out from the bg, it will be reset to 0 - target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId()); - // remember current position as entry point for return at bg end teleportation - if (!target->GetMap()->IsBattlegroundOrArena()) - target->SetBattlegroundEntryPoint(); - } - else if (map->IsDungeon()) - { - Map* map = target->GetMap(); - - if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId()) - target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true); - - // we are in instance, and can summon only player in our group with us as lead - if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() || - (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || - (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())) - // the last check is a bit excessive, but let it be, just in case - { - handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - - handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), ""); - if (handler->needReportToTarget(target)) - ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); - - // stop flight if need - if (target->isInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - target->SaveRecallPosition(); - - // before GM - float x, y, z; - handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize()); - target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation()); - target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true); - } - else - { - // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) - return false; - - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE)); - - // in point where GM stay - Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(), - handler->GetSession()->GetPlayer()->GetPositionX(), - handler->GetSession()->GetPlayer()->GetPositionY(), - handler->GetSession()->GetPlayer()->GetPositionZ(), - handler->GetSession()->GetPlayer()->GetOrientation(), - handler->GetSession()->GetPlayer()->GetZoneId(), - targetGuid); - } - - return true; - } - // Summon group of player - static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args) - { - Player* target; - if (!handler->extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - Group* group = target->GetGroup(); - - std::string nameLink = handler->GetNameLink(target); - - if (!group) - { - handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - Map* gmMap = handler->GetSession()->GetPlayer()->GetMap(); - bool toInstance = gmMap->Instanceable(); - - // we are in instance, and can summon only player in our group with us as lead - if (toInstance && ( - !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || - (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))) - // the last check is a bit excessive, but let it be, just in case - { - handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST); - handler->SetSentErrorMessage(true); - return false; - } - - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* player = itr->getSource(); - - if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession()) - continue; - - // check online security - if (handler->HasLowerSecurity(player, 0)) - return false; - - std::string plNameLink = handler->GetNameLink(player); - - if (player->IsBeingTeleported() == true) - { - handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - if (toInstance) - { - Map* playerMap = player->GetMap(); - - if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId()) - { - // cannot summon from instance to instance - handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - - handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), ""); - if (handler->needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str()); - - // stop flight if need - if (player->isInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - player->SaveRecallPosition(); - - // before GM - float x, y, z; - handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize()); - player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation()); - } - - return true; - } - - static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/) - { - handler->ShowHelpForCommand(handler->getCommandTable(), ""); - return true; - } - - static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* target = handler->getSelectedUnit(); - - if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - if (target->GetTypeId() == TYPEID_PLAYER) - { - if (handler->HasLowerSecurity((Player*)target, 0, false)) - return false; - } - - if (target->isAlive()) - { - if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE)) - handler->GetSession()->GetPlayer()->Kill(target); - else - handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - - return true; - } - - static bool HandleReviveCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) - return false; - - if (target) - { - target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); - target->SpawnCorpseBones(); - target->SaveToDB(); - } - else - // will resurrected at login without corpse - sObjectAccessor->ConvertCorpseForPlayer(targetGuid); - - return true; - } - - static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - // If player is not mounted, so go out :) - if (!player->IsMounted()) - { - handler->SendSysMessage(LANG_CHAR_NON_MOUNTED); - handler->SetSentErrorMessage(true); - return false; - } - - if (player->isInFlight()) - { - handler->SendSysMessage(LANG_YOU_IN_FLIGHT); - handler->SetSentErrorMessage(true); - return false; - } - - player->Dismount(); - player->RemoveAurasByType(SPELL_AURA_MOUNTED); - return true; - } - - static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/) - { - uint64 guid = handler->GetSession()->GetPlayer()->GetSelection(); - - if (guid == 0) - { - handler->SendSysMessage(LANG_NO_SELECTION); - handler->SetSentErrorMessage(true); - return false; - } - - handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); - return true; - } - - static bool HandleHelpCommand(ChatHandler* handler, char const* args) - { - char const* cmd = strtok((char*)args, " "); - if (!cmd) - { - handler->ShowHelpForCommand(handler->getCommandTable(), "help"); - handler->ShowHelpForCommand(handler->getCommandTable(), ""); - } - else - { - if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd)) - handler->SendSysMessage(LANG_NO_HELP_CMD); - } - - return true; - } - // move item to other slot - static bool HandleItemMoveCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char const* param1 = strtok((char*)args, " "); - if (!param1) - return false; - - char const* param2 = strtok(NULL, " "); - if (!param2) - return false; - - uint8 srcSlot = uint8(atoi(param1)); - uint8 dstSlot = uint8(atoi(param2)); - - if (srcSlot == dstSlot) - return true; - - if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true)) - return false; - - if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false)) - return false; - - uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot); - uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot); - - handler->GetSession()->GetPlayer()->SwapItem(src, dst); - - return true; - } - - static bool HandleCooldownCommand(ChatHandler* handler, char const* args) - { - Player* target = handler->getSelectedPlayer(); - if (!target) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - - std::string nameLink = handler->GetNameLink(target); - - if (!*args) - { - target->RemoveAllSpellCooldown(); - handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str()); - } - else - { - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellIid = handler->extractSpellIdFromLink((char*)args); - if (!spellIid) - return false; - - if (!sSpellMgr->GetSpellInfo(spellIid)) - { - handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - target->RemoveSpellCooldown(spellIid, true); - handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); - } - return true; - } - - static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args) - { - WorldObject* obj = NULL; - - if (*args) - { - uint64 guid = handler->extractGuidFromLink((char*)args); - if (guid) - obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); - - if (!obj) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - obj = handler->getSelectedUnit(); - - if (!obj) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - } - - handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj)); - return true; - } - // Teleport player to last position - static bool HandleRecallCommand(ChatHandler* handler, char const* args) - { - Player* target; - if (!handler->extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - if (target->IsBeingTeleported()) - { - handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - // stop flight if need - if (target->isInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } - - target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO); - return true; - } - - static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - // save GM account without delay and output message - if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity())) - { - if (Player* target = handler->getSelectedPlayer()) - target->SaveToDB(); - else - player->SaveToDB(); - handler->SendSysMessage(LANG_PLAYER_SAVED); - return true; - } - - // save if the player has last been saved over 20 seconds ago - uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); - if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS)) - player->SaveToDB(); - - return true; - } - - // Save all players in the world - static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/) - { - sObjectAccessor->SaveAllPlayers(); - handler->SendSysMessage(LANG_PLAYERS_SAVED); - return true; - } - - // kick player - static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args) - { - Player* target = NULL; - std::string playerName; - if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) - return false; - - if (handler->GetSession() && target == handler->GetSession()->GetPlayer()) - { - handler->SendSysMessage(LANG_COMMAND_KICKSELF); - handler->SetSentErrorMessage(true); - return false; - } - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD)) - sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); - else - handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); - - target->GetSession()->KickPlayer(); - - return true; - } - - static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - if (player->isInFlight()) - { - handler->SendSysMessage(LANG_YOU_IN_FLIGHT); - handler->SetSentErrorMessage(true); - return false; - } - - if (player->isInCombat()) - { - handler->SendSysMessage(LANG_YOU_IN_COMBAT); - handler->SetSentErrorMessage(true); - return false; - } - - if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - { - // if player is dead and stuck, send ghost to graveyard - player->RepopAtGraveyard(); - return true; - } - - // cast spell Stuck - player->CastSpell(player, 7355, false); - return true; - } - // Enable on\off all taxi paths - static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args) - { - if (!*args) - { - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - return false; - } - - std::string argStr = (char*)args; - - Player* chr = handler->getSelectedPlayer(); - - if (!chr) - chr = handler->GetSession()->GetPlayer(); - else if (handler->HasLowerSecurity(chr, 0)) // check online security - return false; - - if (argStr == "on") - { - chr->SetTaxiCheater(true); - handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str()); - if (handler->needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str()); - return true; - } - - if (argStr == "off") - { - chr->SetTaxiCheater(false); - handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str()); - if (handler->needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str()); - - return true; - } - - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - - return false; - } - - static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char* px = strtok((char*)args, " "); - if (!px) - return false; - - uint32 graveyardId = uint32(atoi(px)); - - uint32 team; - - char* px2 = strtok(NULL, " "); - - if (!px2) - team = 0; - else if (strncmp(px2, "horde", 6) == 0) - team = HORDE; - else if (strncmp(px2, "alliance", 9) == 0) - team = ALLIANCE; - else - return false; - - WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId); - - if (!graveyard) - { - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId); - handler->SetSentErrorMessage(true); - return false; - } - - Player* player = handler->GetSession()->GetPlayer(); - - uint32 zoneId = player->GetZoneId(); - - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); - if (!areaEntry || areaEntry->zone !=0) - { - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId); - handler->SetSentErrorMessage(true); - return false; - } - - if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team)) - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId); - else - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId); - - return true; - } - - static bool HandleNearGraveCommand(ChatHandler* handler, char const* args) - { - uint32 team; - - size_t argStr = strlen(args); - - if (!*args) - team = 0; - else if (strncmp((char*)args, "horde", argStr) == 0) - team = HORDE; - else if (strncmp((char*)args, "alliance", argStr) == 0) - team = ALLIANCE; - else - return false; - - Player* player = handler->GetSession()->GetPlayer(); - uint32 zone_id = player->GetZoneId(); - - WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard( - player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); - - if (graveyard) - { - uint32 graveyardId = graveyard->ID; - - GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id); - if (!data) - { - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId); - handler->SetSentErrorMessage(true); - return false; - } - - team = data->team; - - std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); - - if (team == 0) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (team == HORDE) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); - else if (team == ALLIANCE) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); - - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id); - } - else - { - std::string team_name; - - if (team == 0) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (team == HORDE) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); - else if (team == ALLIANCE) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); - - if (team == ~uint32(0)) - handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); - else - handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); - } - - return true; - } - - static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - int32 flag = int32(atoi((char*)args)); - - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - if (flag != 0) - { - handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str()); - if (handler->needReportToTarget(playerTarget)) - ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str()); - } - else - { - handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str()); - if (handler->needReportToTarget(playerTarget)) - ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str()); - } - - for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) - { - if (flag != 0) - handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); - else - handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); - } - - return true; - } - - static bool HandleShowAreaCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - int32 area = GetAreaFlagByAreaID(atoi((char*)args)); - int32 offset = area / 32; - uint32 val = uint32((1 << (area % 32))); - - if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) - { - handler->SendSysMessage(LANG_BAD_VALUE); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); - playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val))); - - handler->SendSysMessage(LANG_EXPLORE_AREA); - return true; - } - - static bool HandleHideAreaCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - int32 area = GetAreaFlagByAreaID(atoi((char*)args)); - int32 offset = area / 32; - uint32 val = uint32((1 << (area % 32))); - - if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) - { - handler->SendSysMessage(LANG_BAD_VALUE); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); - playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val))); - - handler->SendSysMessage(LANG_UNEXPLORE_AREA); - return true; - } - - static bool HandleAddItemCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - uint32 itemId = 0; - - if (args[0] == '[') // [name] manual form - { - char const* itemNameStr = strtok((char*)args, "]"); - - if (itemNameStr && itemNameStr[0]) - { - std::string itemName = itemNameStr+1; - WorldDatabase.EscapeString(itemName); - - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME); - stmt->setString(0, itemName); - PreparedQueryResult result = WorldDatabase.Query(stmt); - - if (!result) - { - handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1); - handler->SetSentErrorMessage(true); - return false; - } - itemId = result->Fetch()->GetUInt32(); - } - else - return false; - } - else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r - { - char const* id = handler->extractKeyFromLink((char*)args, "Hitem"); - if (!id) - return false; - itemId = uint32(atol(id)); - } - - char const* ccount = strtok(NULL, " "); - - int32 count = 1; - - if (ccount) - count = strtol(ccount, NULL, 10); - - if (count == 0) - count = 1; - - Player* player = handler->GetSession()->GetPlayer(); - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - playerTarget = player; - - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count); - - ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); - if (!itemTemplate) - { - handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); - handler->SetSentErrorMessage(true); - return false; - } - - // Subtract - if (count < 0) - { - playerTarget->DestroyItemCount(itemId, -count, true, false); - handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str()); - return true; - } - - // Adding items - uint32 noSpaceForCount = 0; - - // check space and find places - ItemPosCountVec dest; - InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); - if (msg != EQUIP_ERR_OK) // convert to possible store amount - count -= noSpaceForCount; - - if (count == 0 || dest.empty()) // can't add any - { - handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); - handler->SetSentErrorMessage(true); - return false; - } - - Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); - - // remove binding (let GM give it to another player later) - if (player == playerTarget) - for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) - if (Item* item1 = player->GetItemByPos(itr->pos)) - item1->SetBinding(false); - - if (count > 0 && item) - { - player->SendNewItem(item, count, false, true); - if (player != playerTarget) - playerTarget->SendNewItem(item, count, true, false); - } - - if (noSpaceForCount > 0) - handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); - - return true; - } - - static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r - if (!id) - return false; - - uint32 itemSetId = atol(id); - - // prevent generation all items with itemset field value '0' - if (itemSetId == 0) - { - handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); - handler->SetSentErrorMessage(true); - return false; - } - - Player* player = handler->GetSession()->GetPlayer(); - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - playerTarget = player; - - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); - - bool found = false; - ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); - for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) - { - if (itr->second.ItemSet == itemSetId) - { - found = true; - ItemPosCountVec dest; - InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1); - if (msg == EQUIP_ERR_OK) - { - Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true); - - // remove binding (let GM give it to another player later) - if (player == playerTarget) - item->SetBinding(false); - - player->SendNewItem(item, 1, false, true); - if (player != playerTarget) - playerTarget->SendNewItem(item, 1, true, false); - } - else - { - player->SendEquipError(msg, NULL, NULL, itr->second.ItemId); - handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1); - } - } - } - - if (!found) - { - handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); - handler->SetSentErrorMessage(true); - return false; - } - - return true; - } - - static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/) - { - handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID()); - return true; - } - - static bool HandleChangeWeather(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - // Weather is OFF - if (!sWorld->getBoolConfig(CONFIG_WEATHER)) - { - handler->SendSysMessage(LANG_WEATHER_DISABLED); - handler->SetSentErrorMessage(true); - return false; - } - - // *Change the weather of a cell - char const* px = strtok((char*)args, " "); - char const* py = strtok(NULL, " "); - - if (!px || !py) - return false; - - uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand - float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather - - Player* player = handler->GetSession()->GetPlayer(); - uint32 zoneid = player->GetZoneId(); - - Weather* weather = WeatherMgr::FindWeather(zoneid); - - if (!weather) - weather = WeatherMgr::AddWeather(zoneid); - if (!weather) - { - handler->SendSysMessage(LANG_NO_WEATHER); - handler->SetSentErrorMessage(true); - return false; - } - - weather->SetWeather(WeatherType(type), grade); - - return true; - } - - - static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/) - { - Player* SelectedPlayer = handler->getSelectedPlayer(); - if (!SelectedPlayer) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - // each skills that have max skill value dependent from level seted to current level max skill value - SelectedPlayer->UpdateSkillsToMaxSkillsForLevel(); - return true; - } - - static bool HandleSetSkillCommand(ChatHandler* handler, char const* args) - { - // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r - char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill"); - if (!skillStr) - return false; - - char const* levelStr = strtok(NULL, " "); - if (!levelStr) - return false; - - char const* maxPureSkill = strtok(NULL, " "); - - int32 skill = atoi(skillStr); - if (skill <= 0) - { - handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); - handler->SetSentErrorMessage(true); - return false; - } - - int32 level = uint32(atol(levelStr)); - - Player* target = handler->getSelectedPlayer(); - if (!target) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill); - if (!skillLine) - { - handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); - handler->SetSentErrorMessage(true); - return false; - } - - std::string tNameLink = handler->GetNameLink(target); - - if (!target->GetSkillValue(skill)) - { - handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]); - handler->SetSentErrorMessage(true); - return false; - } - - uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill); - - if (level <= 0 || level > max || max <= 0) - return false; - - target->SetSkill(skill, target->GetSkillStep(skill), level, max); - handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max); - - return true; - } - // show info of player - static bool HandlePInfoCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - std::string targetName; - - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); - - if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) - { - target = sObjectMgr->GetPlayerByLowGUID(parseGUID); - targetGuid = parseGUID; - } - 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; - uint32 mapId; - uint32 areaId; - uint32 phase = 0; - - // get additional information from Player object - if (target) - { - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - accId = target->GetSession()->GetAccountId(); - money = target->GetMoney(); - totalPlayerTime = target->GetTotalPlayedTime(); - level = target->getLevel(); - latency = target->GetSession()->GetLatency(); - race = target->getRace(); - Class = target->getClass(); - muteTime = target->GetSession()->m_muteTime; - mapId = target->GetMapId(); - areaId = target->GetAreaId(); - phase = target->GetPhaseMask(); - } - // get additional information from DB - else - { - // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) - return false; - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); - stmt->setUInt32(0, GUID_LOPART(targetGuid)); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (!result) - return false; - - Field* fields = result->Fetch(); - totalPlayerTime = fields[0].GetUInt32(); - level = fields[1].GetUInt8(); - money = fields[2].GetUInt32(); - accId = fields[3].GetUInt32(); - race = fields[4].GetUInt8(); - Class = fields[5].GetUInt8(); - mapId = fields[6].GetUInt16(); - areaId = fields[7].GetUInt16(); - } - - std::string userName = handler->GetTrinityString(LANG_ERROR); - std::string eMail = handler->GetTrinityString(LANG_ERROR); - std::string lastIp = handler->GetTrinityString(LANG_ERROR); - uint32 security = 0; - std::string lastLogin = handler->GetTrinityString(LANG_ERROR); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO); - stmt->setInt32(0, int32(realmID)); - stmt->setUInt32(1, accId); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - if (result) - { - Field* fields = result->Fetch(); - userName = fields[0].GetString(); - security = fields[1].GetUInt8(); - eMail = fields[2].GetString(); - muteTime = fields[5].GetUInt64(); - - if (eMail.empty()) - eMail = "-"; - - if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)) - { - lastIp = fields[3].GetString(); - lastLogin = fields[4].GetString(); - - uint32 ip = inet_addr(lastIp.c_str()); -#if TRINITY_ENDIAN == BIGENDIAN - EndianConvertReverse(ip); -#endif - - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY); - - stmt->setUInt32(0, ip); - - PreparedQueryResult result2 = WorldDatabase.Query(stmt); - - if (result2) - { - Field* fields2 = result2->Fetch(); - lastIp.append(" ("); - lastIp.append(fields2[0].GetString()); - lastIp.append(")"); - } - } - else - { - lastIp = "-"; - lastLogin = "-"; - } - } - - 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); - if (!result2) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); - stmt->setUInt32(0, GUID_LOPART(targetGuid)); - result2 = CharacterDatabase.Query(stmt); - } - - if (result2) - { - Field* fields = result2->Fetch(); - banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32()); - bannedby = fields[2].GetString(); - banreason = fields[3].GetString(); - } - - if (muteTime > 0) - handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str()); - - 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 = ""; - std::string zoneName = ""; - - MapEntry const* map = sMapStore.LookupEntry(mapId); - - AreaTableEntry const* area = GetAreaEntryByAreaID(areaId); - if (area) - { - areaName = area->area_name[locale]; - - AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); - if (zone) - zoneName = zone->area_name[locale]; - } - - 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(), "", phase); - } - else - handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); - - return true; - } - - static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - // accept only explicitly selected target (not implicitly self targeting case) - Unit* target = handler->getSelectedUnit(); - if (player->GetSelection() && target) - { - if (target->GetTypeId() != TYPEID_UNIT || target->isPet()) - { - handler->SendSysMessage(LANG_SELECT_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - if (target->isDead()) - target->ToCreature()->Respawn(); - return true; - } - - CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY())); - Cell cell(p); - cell.SetNoCreate(); - - Trinity::RespawnDo u_do; - Trinity::WorldObjectWorker worker(player, u_do); - - TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); - cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange()); - - return true; - } - // mute player for some times - static bool HandleMuteCommand(ChatHandler* handler, char const* args) - { - char* nameStr; - char* delayStr; - handler->extractOptFirstArg((char*)args, &nameStr, &delayStr); - if (!delayStr) - return false; - - char const* muteReason = strtok(NULL, "\r"); - std::string muteReasonStr = "No reason"; - if (muteReason != NULL) - muteReasonStr = muteReason; - - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) - return false; - - uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); - - // find only player from same account if any - if (!target) - if (WorldSession* session = sWorld->FindSession(accountId)) - target = session->GetPlayer(); - - uint32 notSpeakTime = uint32(atoi(delayStr)); - - // must have strong lesser security level - if (handler->HasLowerSecurity (target, targetGuid, true)) - return false; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); - - if (target) - { - // Target is online, mute will be in effect right away. - int64 muteTime = time(NULL) + notSpeakTime * MINUTE; - target->GetSession()->m_muteTime = muteTime; - stmt->setInt64(0, muteTime); - ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str()); - } - else - { - // Target is offline, mute will be in effect starting from the next login. - int32 muteTime = -int32(notSpeakTime * MINUTE); - stmt->setInt64(0, muteTime); - } - - stmt->setUInt32(1, accountId); - LoginDatabase.Execute(stmt); - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str()); - - return true; - } - - // unmute player - static bool HandleUnmuteCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); - - // find only player from same account if any - if (!target) - if (WorldSession* session = sWorld->FindSession(accountId)) - target = session->GetPlayer(); - - // must have strong lesser security level - if (handler->HasLowerSecurity (target, targetGuid, true)) - return false; - - if (target) - { - if (target->CanSpeak()) - { - handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED); - handler->SetSentErrorMessage(true); - return false; - } - - target->GetSession()->m_muteTime = 0; - } - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); - stmt->setInt64(0, 0); - stmt->setUInt32(1, accountId); - LoginDatabase.Execute(stmt); - - if (target) - ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); - - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str()); - - return true; - } - - - static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* unit = handler->getSelectedUnit(); - if (!unit) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow()); - - MotionMaster* motionMaster = unit->GetMotionMaster(); - float x, y, z; - motionMaster->GetDestination(x, y, z); - - for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) - { - MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i); - if (!movementGenerator) - { - handler->SendSysMessage("Empty"); - continue; - } - - switch (movementGenerator->GetMovementGeneratorType()) - { - case IDLE_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_IDLE); - break; - case RANDOM_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_RANDOM); - break; - case WAYPOINT_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT); - break; - case ANIMAL_RANDOM_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); - break; - case CONFUSED_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_CONFUSED); - break; - case CHASE_MOTION_TYPE: - { - Unit* target = NULL; - if (unit->GetTypeId() == TYPEID_PLAYER) - target = static_cast const*>(movementGenerator)->GetTarget(); - else - target = static_cast const*>(movementGenerator)->GetTarget(); - - if (!target) - handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); - else if (target->GetTypeId() == TYPEID_PLAYER) - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); - else - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); - break; - } - case FOLLOW_MOTION_TYPE: - { - Unit* target = NULL; - if (unit->GetTypeId() == TYPEID_PLAYER) - target = static_cast const*>(movementGenerator)->GetTarget(); - else - target = static_cast const*>(movementGenerator)->GetTarget(); - - if (!target) - handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); - else if (target->GetTypeId() == TYPEID_PLAYER) - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); - else - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); - break; - } - case HOME_MOTION_TYPE: - { - if (unit->GetTypeId() == TYPEID_UNIT) - handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z); - else - handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); - break; - } - case FLIGHT_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_FLIGHT); - break; - case POINT_MOTION_TYPE: - { - handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z); - break; - } - case FLEEING_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_FEAR); - break; - case DISTRACT_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_DISTRACT); - break; - case EFFECT_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_EFFECT); - break; - default: - handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType()); - break; - } - } - return true; - } - /* - ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator - Without this function 3rd party scripting library will get linking errors (unresolved external) - when attempting to use the PointMovementGenerator - */ - static bool HandleComeToMeCommand(ChatHandler* handler, char const* args) - { - char const* newFlagStr = strtok((char*)args, " "); - if (!newFlagStr) - return false; - - Creature* caster = handler->getSelectedCreature(); - if (!caster) - { - handler->SendSysMessage(LANG_SELECT_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - Player* player = handler->GetSession()->GetPlayer(); - - caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); - - return true; - } - - static bool HandleDamageCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Unit* target = handler->getSelectedUnit(); - if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - if (target->GetTypeId() == TYPEID_PLAYER) - { - if (handler->HasLowerSecurity((Player*)target, 0, false)) - return false; - } - - if (!target->isAlive()) - return true; - - char* damageStr = strtok((char*)args, " "); - if (!damageStr) - return false; - - int32 damage_int = atoi((char*)damageStr); - if (damage_int <= 0) - return true; - - uint32 damage = damage_int; - - char* schoolStr = strtok((char*)NULL, " "); - - // flat melee damage without resistence/etc reduction - if (!schoolStr) - { - handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - if (target != handler->GetSession()->GetPlayer()) - handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); - return true; - } - - uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; - if (school >= MAX_SPELL_SCHOOL) - return false; - - SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); - - if (Unit::IsDamageReducedByArmor(schoolmask)) - damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); - - char* spellStr = strtok((char*)NULL, " "); - - // melee damage by specific school - if (!spellStr) - { - uint32 absorb = 0; - uint32 resist = 0; - - handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); - - if (damage <= absorb + resist) - return true; - - damage -= absorb + resist; - - handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb); - handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); - handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); - return true; - } - - // non-melee damage - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellid = handler->extractSpellIdFromLink((char*)args); - if (!spellid || !sSpellMgr->GetSpellInfo(spellid)) - return false; - - handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage); - return true; - } - - static bool HandleCombatStopCommand(ChatHandler* handler, char const* args) - { - Player* target = NULL; - - if (args && strlen(args) > 0) - { - target = sObjectAccessor->FindPlayerByName(args); - if (!target) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - - if (!target) - { - if (!handler->extractPlayerTarget((char*)args, &target)) - return false; - } - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - target->CombatStop(); - target->getHostileRefManager().deleteReferences(); - return true; - } - - static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/) - { - sArenaTeamMgr->DistributeArenaPoints(); - return true; - } - - static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args) - { - Player* target; - if (!handler->extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - // Repair items - target->DurabilityRepairAll(false, 0, false); - - handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str()); - if (handler->needReportToTarget(target)) - ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str()); - - return true; - } - - static bool HandleWaterwalkCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* player = handler->getSelectedPlayer(); - if (!player) - { - handler->PSendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - // check online security - if (handler->HasLowerSecurity(player, 0)) - return false; - - if (strncmp(args, "on", 3) == 0) - player->SetMovement(MOVE_WATER_WALK); // ON - else if (strncmp(args, "off", 4) == 0) - player->SetMovement(MOVE_LAND_WALK); // OFF - else - { - handler->SendSysMessage(LANG_USE_BOL); - return false; - } - - handler->PSendSysMessage(LANG_YOU_SET_WATERWALK, args, handler->GetNameLink(player).c_str()); - if (handler->needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, handler->GetNameLink().c_str()); - return true; - } - - // Send mail by command - static bool HandleSendMailCommand(ChatHandler* handler, char const* args) - { - // format: name "subject text" "mail text" - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char const* msgSubject = handler->extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char const* msgText = handler->extractQuotedArg(tail2); - if (!msgText) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - //- TODO: Fix poor design - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - MailDraft(subject, text) - .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender); - - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = handler->playerLink(targetName); - handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; - } - // Send items by mail - static bool HandleSendItemsCommand(ChatHandler* handler, char const* args) - { - // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] - Player* receiver; - uint64 receiverGuid; - std::string receiverName; - if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char const* msgSubject = handler->extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char const* msgText = handler->extractQuotedArg(tail2); - if (!msgText) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // extract items - typedef std::pair ItemPair; - typedef std::list< ItemPair > ItemPairs; - ItemPairs items; - - // get all tail string - char* tail = strtok(NULL, ""); - - // get from tail next item str - while (char* itemStr = strtok(tail, " ")) - { - // and get new tail - tail = strtok(NULL, ""); - - // parse item str - char const* itemIdStr = strtok(itemStr, ":"); - char const* itemCountStr = strtok(NULL, " "); - - uint32 itemId = atoi(itemIdStr); - if (!itemId) - return false; - - ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId); - if (!item_proto) - { - handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1; - if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount))) - { - handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId); - handler->SetSentErrorMessage(true); - return false; - } - - while (itemCount > item_proto->GetMaxStackSize()) - { - items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize())); - itemCount -= item_proto->GetMaxStackSize(); - } - - items.push_back(ItemPair(itemId, itemCount)); - - if (items.size() > MAX_MAIL_ITEMS) - { - handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS); - handler->SetSentErrorMessage(true); - return false; - } - } - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - // fill mail - MailDraft draft(subject, text); - - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr) - { - if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0)) - { - item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted - draft.AddItem(item); - } - } - - draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = handler->playerLink(receiverName); - handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; - } - /// Send money by mail - static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args) - { - /// format: name "subject text" "mail text" money - - Player* receiver; - uint64 receiverGuid; - std::string receiverName; - if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char* msgSubject = handler->extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char* msgText = handler->extractQuotedArg(tail2); - if (!msgText) - return false; - - char* moneyStr = strtok(NULL, ""); - int32 money = moneyStr ? atoi(moneyStr) : 0; - if (money <= 0) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - MailDraft(subject, text) - .AddMoney(money) - .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); - - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = handler->playerLink(receiverName); - handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; - } - /// Send a message to a player in game - static bool HandleSendMessageCommand(ChatHandler* handler, char const* args) - { - /// - Find the player - Player* player; - if (!handler->extractPlayerTarget((char*)args, &player)) - return false; - - char* msgStr = strtok(NULL, ""); - if (!msgStr) - return false; - - ///- Check that he is not logging out. - if (player->GetSession()->isLogingOut()) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - - /// - Send the message - // Use SendAreaTriggerMessage for fastest delivery. - player->GetSession()->SendAreaTriggerMessage("%s", msgStr); - player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); - - // Confirmation message - std::string nameLink = handler->GetNameLink(player); - handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr); - - return true; - } - - static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - Creature* creatureTarget = handler->getSelectedCreature(); - - if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) - { - handler->PSendSysMessage(LANG_SELECT_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry()); - // Creatures with family 0 crashes the server - if (!creatrueTemplate->family) - { - handler->PSendSysMessage("This creature cannot be tamed. (family id: 0)."); - handler->SetSentErrorMessage(true); - return false; - } - - if (player->GetPetGUID()) - { - handler->PSendSysMessage("You already have a pet"); - handler->SetSentErrorMessage(true); - return false; - } - - // Everything looks OK, create new pet - Pet* pet = new Pet(player, HUNTER_PET); - if (!pet->CreateBaseAtCreature(creatureTarget)) - { - delete pet; - handler->PSendSysMessage("Error 1"); - return false; - } - - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view - - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); - - if (!pet->InitStatsForLevel(creatureTarget->getLevel())) - { - sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); - handler->PSendSysMessage("Error 2"); - delete pet; - return false; - } - - // prepare visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1); - - pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true); - // this enables pet details window (Shift+P) - pet->InitPetCreateSpells(); - pet->SetFullHealth(); - - pet->GetMap()->AddToMap(pet->ToCreature()); - - // visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()); - - player->SetMinion(pet, true); - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - player->PetSpellInitialize(); - - return true; - } - - static bool HandlePetLearnCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* player = handler->GetSession()->GetPlayer(); - Pet* pet = player->GetPet(); - - if (!pet) - { - handler->PSendSysMessage("You have no pet"); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 spellId = handler->extractSpellIdFromLink((char*)args); - - if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) - return false; - - // Check if pet already has it - if (pet->HasSpell(spellId)) - { - handler->PSendSysMessage("Pet already has spell: %u", spellId); - handler->SetSentErrorMessage(true); - return false; - } - - // Check if spell is valid - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) - { - handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); - handler->SetSentErrorMessage(true); - return false; - } - - pet->learnSpell(spellId); - - handler->PSendSysMessage("Pet has learned spell %u", spellId); - return true; - } - - static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* player = handler->GetSession()->GetPlayer(); - Pet* pet = player->GetPet(); - if (!pet) - { - handler->PSendSysMessage("You have no pet"); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 spellId = handler->extractSpellIdFromLink((char*)args); - - if (pet->HasSpell(spellId)) - pet->removeSpell(spellId, false); - else - handler->PSendSysMessage("Pet doesn't have that spell"); - - return true; - } - - static bool HandleFreezeCommand(ChatHandler* handler, char const* args) - { - std::string name; - Player* player; - char const* TargetName = strtok((char*)args, " "); // get entered name - if (!TargetName) // if no name entered use target - { - player = handler->getSelectedPlayer(); - if (player) //prevent crash with creature as target - { - name = player->GetName(); - normalizePlayerName(name); - } - } - else // if name entered - { - name = TargetName; - normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name.c_str()); - } - - if (!player) - { - handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - - if (player == handler->GetSession()->GetPlayer()) - { - handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR); - return true; - } - - // effect - if (player && (player != handler->GetSession()->GetPlayer())) - { - handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str()); - - // stop combat + make player unattackable + duel stop + stop some spells - player->setFaction(35); - player->CombatStop(); - if (player->IsNonMeleeSpellCasted(true)) - player->InterruptNonMeleeSpells(true); - player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - // if player class = hunter || warlock remove pet if alive - if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) - { - if (Pet* pet = player->GetPet()) - { - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - // not let dismiss dead pet - if (pet && pet->isAlive()) - player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); - } - } - - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454)) - Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player); - - // save player - player->SaveToDB(); - } - - return true; - } - - static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args) - { - std::string name; - Player* player; - char* targetName = strtok((char*)args, " "); // Get entered name - - if (targetName) - { - name = targetName; - normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name.c_str()); - } - else // If no name was entered - use target - { - player = handler->getSelectedPlayer(); - if (player) - name = player->GetName(); - } - - if (player) - { - handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - - // Reset player faction + allow combat + allow duels - player->setFactionForRace(player->getRace()); - player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - // Remove Freeze spell (allowing movement and spells) - player->RemoveAurasDueToSpell(9454); - - // Save player - player->SaveToDB(); - } - else - { - if (targetName) - { - // Check for offline players - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME); - stmt->setString(0, name); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (!result) - { - handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - - // If player found: delete his freeze aura - Field* fields = result->Fetch(); - uint32 lowGuid = fields[0].GetUInt32(); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); - stmt->setUInt32(0, lowGuid); - CharacterDatabase.Execute(stmt); - - handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - return true; - } - else - { - handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - } - - return true; - } - - static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/) - { - // Get names from DB - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - if (!result) - { - handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); - return true; - } - - // Header of the names - handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE); - - // Output of the results - do - { - Field* fields = result->Fetch(); - std::string player = fields[0].GetString(); - handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str()); - } - while (result->NextRow()); - - return true; - } - - static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args) - { - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* nameStr = strtok((char*)args, " "); - - if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) - if (group && group->GetLeaderGUID() != guid) - { - group->ChangeLeader(guid); - group->SendUpdate(); - } - - return true; - } - - static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args) - { - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* nameStr = strtok((char*)args, " "); - - if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) - if (group) - group->Disband(); - - return true; - } - - static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args) - { - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* nameStr = strtok((char*)args, " "); - - if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true)) - if (group) - group->RemoveMember(guid); - - return true; - } - - static bool HandlePlayAllCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - uint32 soundId = atoi((char*)args); - - if (!sSoundEntriesStore.LookupEntry(soundId)) - { - handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); - handler->SetSentErrorMessage(true); - return false; - } - - WorldPacket data(SMSG_PLAY_SOUND, 4); - data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID(); - sWorld->SendGlobalMessage(&data); - - handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); - return true; - } - - static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* unit = handler->getSelectedUnit(); - if (!unit) - return false; - - handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true); - return true; - } - - static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* unit = handler->getSelectedUnit(); - if (!unit) - unit = handler->GetSession()->GetPlayer(); - - unit->RemoveCharmAuras(); - - return true; - } - - static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* unit = handler->getSelectedUnit(); - if (!unit) - return false; - - handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true); - return true; - } - - static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - if (player->isPossessing()) - return false; - - player->StopCastingBindSight(); - return true; - } -}; - -void AddSC_misc_commandscript() -{ - new misc_commandscript(); -} +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +#include "Chat.h" +#include "ScriptMgr.h" +#include "AccountMgr.h" +#include "ArenaTeamMgr.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "Group.h" +#include "InstanceSaveMgr.h" +#include "MovementGenerator.h" +#include "ObjectAccessor.h" +#include "SpellAuras.h" +#include "TargetedMovementGenerator.h" +#include "WeatherMgr.h" +#include "ace/INET_Addr.h" + +class misc_commandscript : public CommandScript +{ +public: + misc_commandscript() : CommandScript("misc_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand groupCommandTable[] = + { + { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL }, + { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL }, + { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand petCommandTable[] = + { + { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL }, + { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL }, + { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand sendCommandTable[] = + { + { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL }, + { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL }, + { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL }, + { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL }, + { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, + { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL }, + { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL }, + { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL }, + { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL }, + { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL }, + { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL }, + { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL }, + { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL }, + { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL }, + { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL }, + { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL }, + { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL }, + { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL }, + { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL }, + { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL }, + { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL }, + { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL }, + { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL }, + { "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL }, + { "taxicheat", SEC_MODERATOR, false, &HandleTaxiCheatCommand, "", NULL }, + { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL }, + { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL }, + { "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "", NULL }, + { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL }, + { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL }, + { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL }, + { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL }, + { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL }, + { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL }, + { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL }, + { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL }, + { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL }, + { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL }, + { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable }, + { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, + { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL }, + { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL }, + { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL }, + { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL }, + { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL }, + { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL }, + { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL }, + { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL }, + { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "", NULL }, + { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL }, + { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL }, + { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL }, + { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, + { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL }, + { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL }, + { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL }, + { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL }, + { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleDevCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER)) + handler->GetSession()->SendNotification(LANG_DEV_ON); + else + handler->GetSession()->SendNotification(LANG_DEV_OFF); + return true; + } + + std::string argstr = (char*)args; + + if (argstr == "on") + { + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); + handler->GetSession()->SendNotification(LANG_DEV_ON); + return true; + } + + if (argstr == "off") + { + handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); + handler->GetSession()->SendNotification(LANG_DEV_OFF); + return true; + } + + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + static bool HandleGPSCommand(ChatHandler* handler, char const* args) + { + WorldObject* object = NULL; + if (*args) + { + uint64 guid = handler->extractGuidFromLink((char*)args); + if (guid) + object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); + + if (!object) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + object = handler->getSelectedUnit(); + + if (!object) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + } + + CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); + Cell cell(cellCoord); + + uint32 zoneId, areaId; + object->GetZoneAndAreaId(zoneId, areaId); + + MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); + AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); + + float zoneX = object->GetPositionX(); + float zoneY = object->GetPositionY(); + + Map2ZoneCoordinates(zoneX, zoneY, zoneId); + + Map const* map = object->GetMap(); + float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); + float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); + + GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); + + // 63? WHY? + int gridX = 63 - gridCoord.x_coord; + int gridY = 63 - gridCoord.y_coord; + + uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; + uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; + + if (haveVMap) + { + if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) + handler->PSendSysMessage("You are outdoors"); + else + handler->PSendSysMessage("You are indoors"); + } + else + handler->PSendSysMessage("no VMAP available for area info"); + + handler->PSendSysMessage(LANG_MAP_POSITION, + object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : ""), + zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : ""), + areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : ""), + object->GetPhaseMask(), + object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), + cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), + zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); + + LiquidData liquidStatus; + ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); + + if (status) + handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); + + return true; + } + + static bool HandleAuraCommand(ChatHandler* handler, char const* args) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) + Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target); + + return true; + } + + static bool HandleUnAuraCommand(ChatHandler* handler, char const* args) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + std::string argstr = args; + if (argstr == "all") + { + target->RemoveAllAuras(); + return true; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId) + return false; + + target->RemoveAurasDueToSpell(spellId); + + return true; + } + // Teleport to Player + static bool HandleAppearCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + Player* _player = handler->GetSession()->GetPlayer(); + if (target == _player || targetGuid == _player->GetGUID()) + { + handler->SendSysMessage(LANG_CANT_TELEPORT_SELF); + handler->SetSentErrorMessage(true); + return false; + } + + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + std::string chrNameLink = handler->playerLink(targetName); + + Map* map = target->GetMap(); + if (map->IsBattlegroundOrArena()) + { + // only allow if gm mode is on + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + // if both players are in different bgs + else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) + _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff + + // all's well, set bg id + // when porting out from the bg, it will be reset to 0 + _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId()); + // remember current position as entry point for return at bg end teleportation + if (!_player->GetMap()->IsBattlegroundOrArena()) + _player->SetBattlegroundEntryPoint(); + } + else if (map->IsDungeon()) + { + // we have to go to instance, and can go to player only if: + // 1) we are in his group (either as leader or as member) + // 2) we are not bound to any group and have GM mode on + if (_player->GetGroup()) + { + // we are in group, we can go only if we are in the player group + if (_player->GetGroup() != target->GetGroup()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + // we are not in group, let's verify our GM mode + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + // if the player or the player's group is bound to another instance + // the player will not be bound to another one + InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid())); + if (!bind) + { + Group* group = _player->GetGroup(); + // if no bind exists, create a solo bind + InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind + if (!gBind) + if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) + _player->BindToInstance(save, !save->CanReset()); + } + + if (map->IsRaid()) + _player->SetRaidDifficulty(target->GetRaidDifficulty()); + else + _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); + } + + handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + // to point to see at target with same orientation + float x, y, z; + target->GetContactPoint(_player, x, y, z); + + _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); + _player->SetPhaseMask(target->GetPhaseMask(), true); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str()); + + // to point where player stay (if loaded) + float x, y, z, o; + uint32 map; + bool in_flight; + if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid)) + return false; + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(map, x, y, z, _player->GetOrientation()); + } + + return true; + } + // Summon Player + static bool HandleSummonCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + Player* _player = handler->GetSession()->GetPlayer(); + if (target == _player || targetGuid == _player->GetGUID()) + { + handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF); + handler->SetSentErrorMessage(true); + return false; + } + + if (target) + { + std::string nameLink = handler->playerLink(targetName); + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (target->IsBeingTeleported()) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + Map* map = handler->GetSession()->GetPlayer()->GetMap(); + + if (map->IsBattlegroundOrArena()) + { + // only allow if gm mode is on + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + // if both players are in different bgs + else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId()) + target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff + + // all's well, set bg id + // when porting out from the bg, it will be reset to 0 + target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId()); + // remember current position as entry point for return at bg end teleportation + if (!target->GetMap()->IsBattlegroundOrArena()) + target->SetBattlegroundEntryPoint(); + } + else if (map->IsDungeon()) + { + Map* map = target->GetMap(); + + if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId()) + target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true); + + // we are in instance, and can summon only player in our group with us as lead + if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() || + (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || + (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())) + // the last check is a bit excessive, but let it be, just in case + { + handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), ""); + if (handler->needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + target->SaveRecallPosition(); + + // before GM + float x, y, z; + handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize()); + target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation()); + target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE)); + + // in point where GM stay + Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(), + handler->GetSession()->GetPlayer()->GetPositionX(), + handler->GetSession()->GetPlayer()->GetPositionY(), + handler->GetSession()->GetPlayer()->GetPositionZ(), + handler->GetSession()->GetPlayer()->GetOrientation(), + handler->GetSession()->GetPlayer()->GetZoneId(), + targetGuid); + } + + return true; + } + // Summon group of player + static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + Group* group = target->GetGroup(); + + std::string nameLink = handler->GetNameLink(target); + + if (!group) + { + handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + Map* gmMap = handler->GetSession()->GetPlayer()->GetMap(); + bool toInstance = gmMap->Instanceable(); + + // we are in instance, and can summon only player in our group with us as lead + if (toInstance && ( + !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || + (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))) + // the last check is a bit excessive, but let it be, just in case + { + handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST); + handler->SetSentErrorMessage(true); + return false; + } + + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* player = itr->getSource(); + + if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession()) + continue; + + // check online security + if (handler->HasLowerSecurity(player, 0)) + return false; + + std::string plNameLink = handler->GetNameLink(player); + + if (player->IsBeingTeleported() == true) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + if (toInstance) + { + Map* playerMap = player->GetMap(); + + if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId()) + { + // cannot summon from instance to instance + handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), ""); + if (handler->needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str()); + + // stop flight if need + if (player->isInFlight()) + { + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + player->SaveRecallPosition(); + + // before GM + float x, y, z; + handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize()); + player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation()); + } + + return true; + } + + static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/) + { + handler->ShowHelpForCommand(handler->getCommandTable(), ""); + return true; + } + + static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* target = handler->getSelectedUnit(); + + if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (handler->HasLowerSecurity((Player*)target, 0, false)) + return false; + } + + if (target->isAlive()) + { + if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE)) + handler->GetSession()->GetPlayer()->Kill(target); + else + handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + + return true; + } + + static bool HandleReviveCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) + return false; + + if (target) + { + target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); + target->SpawnCorpseBones(); + target->SaveToDB(); + } + else + // will resurrected at login without corpse + sObjectAccessor->ConvertCorpseForPlayer(targetGuid); + + return true; + } + + static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // If player is not mounted, so go out :) + if (!player->IsMounted()) + { + handler->SendSysMessage(LANG_CHAR_NON_MOUNTED); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isInFlight()) + { + handler->SendSysMessage(LANG_YOU_IN_FLIGHT); + handler->SetSentErrorMessage(true); + return false; + } + + player->Dismount(); + player->RemoveAurasByType(SPELL_AURA_MOUNTED); + return true; + } + + static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/) + { + uint64 guid = handler->GetSession()->GetPlayer()->GetSelection(); + + if (guid == 0) + { + handler->SendSysMessage(LANG_NO_SELECTION); + handler->SetSentErrorMessage(true); + return false; + } + + handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); + return true; + } + + static bool HandleHelpCommand(ChatHandler* handler, char const* args) + { + char const* cmd = strtok((char*)args, " "); + if (!cmd) + { + handler->ShowHelpForCommand(handler->getCommandTable(), "help"); + handler->ShowHelpForCommand(handler->getCommandTable(), ""); + } + else + { + if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd)) + handler->SendSysMessage(LANG_NO_HELP_CMD); + } + + return true; + } + // move item to other slot + static bool HandleItemMoveCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char const* param1 = strtok((char*)args, " "); + if (!param1) + return false; + + char const* param2 = strtok(NULL, " "); + if (!param2) + return false; + + uint8 srcSlot = uint8(atoi(param1)); + uint8 dstSlot = uint8(atoi(param2)); + + if (srcSlot == dstSlot) + return true; + + if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true)) + return false; + + if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false)) + return false; + + uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot); + uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot); + + handler->GetSession()->GetPlayer()->SwapItem(src, dst); + + return true; + } + + static bool HandleCooldownCommand(ChatHandler* handler, char const* args) + { + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + std::string nameLink = handler->GetNameLink(target); + + if (!*args) + { + target->RemoveAllSpellCooldown(); + handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str()); + } + else + { + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellIid = handler->extractSpellIdFromLink((char*)args); + if (!spellIid) + return false; + + if (!sSpellMgr->GetSpellInfo(spellIid)) + { + handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + target->RemoveSpellCooldown(spellIid, true); + handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); + } + return true; + } + + static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args) + { + WorldObject* obj = NULL; + + if (*args) + { + uint64 guid = handler->extractGuidFromLink((char*)args); + if (guid) + obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); + + if (!obj) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + obj = handler->getSelectedUnit(); + + if (!obj) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj)); + return true; + } + // Teleport player to last position + static bool HandleRecallCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (target->IsBeingTeleported()) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + + target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO); + return true; + } + + static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // save GM account without delay and output message + if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity())) + { + if (Player* target = handler->getSelectedPlayer()) + target->SaveToDB(); + else + player->SaveToDB(); + handler->SendSysMessage(LANG_PLAYER_SAVED); + return true; + } + + // save if the player has last been saved over 20 seconds ago + uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); + if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS)) + player->SaveToDB(); + + return true; + } + + // Save all players in the world + static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/) + { + sObjectAccessor->SaveAllPlayers(); + handler->SendSysMessage(LANG_PLAYERS_SAVED); + return true; + } + + // kick player + static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args) + { + Player* target = NULL; + std::string playerName; + if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + return false; + + if (handler->GetSession() && target == handler->GetSession()->GetPlayer()) + { + handler->SendSysMessage(LANG_COMMAND_KICKSELF); + handler->SetSentErrorMessage(true); + return false; + } + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD)) + sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); + else + handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); + + target->GetSession()->KickPlayer(); + + return true; + } + + static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + if (player->isInFlight()) + { + handler->SendSysMessage(LANG_YOU_IN_FLIGHT); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isInCombat()) + { + handler->SendSysMessage(LANG_YOU_IN_COMBAT); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + { + // if player is dead and stuck, send ghost to graveyard + player->RepopAtGraveyard(); + return true; + } + + // cast spell Stuck + player->CastSpell(player, 7355, false); + return true; + } + // Enable on\off all taxi paths + static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + std::string argStr = (char*)args; + + Player* chr = handler->getSelectedPlayer(); + + if (!chr) + chr = handler->GetSession()->GetPlayer(); + else if (handler->HasLowerSecurity(chr, 0)) // check online security + return false; + + if (argStr == "on") + { + chr->SetTaxiCheater(true); + handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str()); + if (handler->needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str()); + return true; + } + + if (argStr == "off") + { + chr->SetTaxiCheater(false); + handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str()); + if (handler->needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str()); + + return true; + } + + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + + return false; + } + + static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* px = strtok((char*)args, " "); + if (!px) + return false; + + uint32 graveyardId = uint32(atoi(px)); + + uint32 team; + + char* px2 = strtok(NULL, " "); + + if (!px2) + team = 0; + else if (strncmp(px2, "horde", 6) == 0) + team = HORDE; + else if (strncmp(px2, "alliance", 9) == 0) + team = ALLIANCE; + else + return false; + + WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId); + + if (!graveyard) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + + uint32 zoneId = player->GetZoneId(); + + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); + if (!areaEntry || areaEntry->zone !=0) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId); + handler->SetSentErrorMessage(true); + return false; + } + + if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team)) + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId); + else + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId); + + return true; + } + + static bool HandleNearGraveCommand(ChatHandler* handler, char const* args) + { + uint32 team; + + size_t argStr = strlen(args); + + if (!*args) + team = 0; + else if (strncmp((char*)args, "horde", argStr) == 0) + team = HORDE; + else if (strncmp((char*)args, "alliance", argStr) == 0) + team = ALLIANCE; + else + return false; + + Player* player = handler->GetSession()->GetPlayer(); + uint32 zone_id = player->GetZoneId(); + + WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard( + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); + + if (graveyard) + { + uint32 graveyardId = graveyard->ID; + + GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id); + if (!data) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId); + handler->SetSentErrorMessage(true); + return false; + } + + team = data->team; + + std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); + + if (team == 0) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); + else if (team == HORDE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); + else if (team == ALLIANCE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id); + } + else + { + std::string team_name; + + if (team == 0) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); + else if (team == HORDE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); + else if (team == ALLIANCE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + + if (team == ~uint32(0)) + handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); + else + handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); + } + + return true; + } + + static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + int32 flag = int32(atoi((char*)args)); + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + if (flag != 0) + { + handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str()); + if (handler->needReportToTarget(playerTarget)) + ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str()); + } + else + { + handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str()); + if (handler->needReportToTarget(playerTarget)) + ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str()); + } + + for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) + { + if (flag != 0) + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); + else + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); + } + + return true; + } + + static bool HandleShowAreaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + int32 area = GetAreaFlagByAreaID(atoi((char*)args)); + int32 offset = area / 32; + uint32 val = uint32((1 << (area % 32))); + + if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); + playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val))); + + handler->SendSysMessage(LANG_EXPLORE_AREA); + return true; + } + + static bool HandleHideAreaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + int32 area = GetAreaFlagByAreaID(atoi((char*)args)); + int32 offset = area / 32; + uint32 val = uint32((1 << (area % 32))); + + if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); + playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val))); + + handler->SendSysMessage(LANG_UNEXPLORE_AREA); + return true; + } + + static bool HandleAddItemCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 itemId = 0; + + if (args[0] == '[') // [name] manual form + { + char const* itemNameStr = strtok((char*)args, "]"); + + if (itemNameStr && itemNameStr[0]) + { + std::string itemName = itemNameStr+1; + WorldDatabase.EscapeString(itemName); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME); + stmt->setString(0, itemName); + PreparedQueryResult result = WorldDatabase.Query(stmt); + + if (!result) + { + handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1); + handler->SetSentErrorMessage(true); + return false; + } + itemId = result->Fetch()->GetUInt32(); + } + else + return false; + } + else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r + { + char const* id = handler->extractKeyFromLink((char*)args, "Hitem"); + if (!id) + return false; + itemId = uint32(atol(id)); + } + + char const* ccount = strtok(NULL, " "); + + int32 count = 1; + + if (ccount) + count = strtol(ccount, NULL, 10); + + if (count == 0) + count = 1; + + Player* player = handler->GetSession()->GetPlayer(); + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + playerTarget = player; + + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count); + + ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); + if (!itemTemplate) + { + handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + // Subtract + if (count < 0) + { + playerTarget->DestroyItemCount(itemId, -count, true, false); + handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str()); + return true; + } + + // Adding items + uint32 noSpaceForCount = 0; + + // check space and find places + ItemPosCountVec dest; + InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) // convert to possible store amount + count -= noSpaceForCount; + + if (count == 0 || dest.empty()) // can't add any + { + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); + handler->SetSentErrorMessage(true); + return false; + } + + Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + + // remove binding (let GM give it to another player later) + if (player == playerTarget) + for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) + if (Item* item1 = player->GetItemByPos(itr->pos)) + item1->SetBinding(false); + + if (count > 0 && item) + { + player->SendNewItem(item, count, false, true); + if (player != playerTarget) + playerTarget->SendNewItem(item, count, true, false); + } + + if (noSpaceForCount > 0) + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); + + return true; + } + + static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r + if (!id) + return false; + + uint32 itemSetId = atol(id); + + // prevent generation all items with itemset field value '0' + if (itemSetId == 0) + { + handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + playerTarget = player; + + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); + + bool found = false; + ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); + for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) + { + if (itr->second.ItemSet == itemSetId) + { + found = true; + ItemPosCountVec dest; + InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1); + if (msg == EQUIP_ERR_OK) + { + Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true); + + // remove binding (let GM give it to another player later) + if (player == playerTarget) + item->SetBinding(false); + + player->SendNewItem(item, 1, false, true); + if (player != playerTarget) + playerTarget->SendNewItem(item, 1, true, false); + } + else + { + player->SendEquipError(msg, NULL, NULL, itr->second.ItemId); + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1); + } + } + } + + if (!found) + { + handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/) + { + handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID()); + return true; + } + + static bool HandleChangeWeather(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // Weather is OFF + if (!sWorld->getBoolConfig(CONFIG_WEATHER)) + { + handler->SendSysMessage(LANG_WEATHER_DISABLED); + handler->SetSentErrorMessage(true); + return false; + } + + // *Change the weather of a cell + char const* px = strtok((char*)args, " "); + char const* py = strtok(NULL, " "); + + if (!px || !py) + return false; + + uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand + float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather + + Player* player = handler->GetSession()->GetPlayer(); + uint32 zoneid = player->GetZoneId(); + + Weather* weather = WeatherMgr::FindWeather(zoneid); + + if (!weather) + weather = WeatherMgr::AddWeather(zoneid); + if (!weather) + { + handler->SendSysMessage(LANG_NO_WEATHER); + handler->SetSentErrorMessage(true); + return false; + } + + weather->SetWeather(WeatherType(type), grade); + + return true; + } + + + static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/) + { + Player* SelectedPlayer = handler->getSelectedPlayer(); + if (!SelectedPlayer) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + // each skills that have max skill value dependent from level seted to current level max skill value + SelectedPlayer->UpdateSkillsToMaxSkillsForLevel(); + return true; + } + + static bool HandleSetSkillCommand(ChatHandler* handler, char const* args) + { + // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r + char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill"); + if (!skillStr) + return false; + + char const* levelStr = strtok(NULL, " "); + if (!levelStr) + return false; + + char const* maxPureSkill = strtok(NULL, " "); + + int32 skill = atoi(skillStr); + if (skill <= 0) + { + handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); + handler->SetSentErrorMessage(true); + return false; + } + + int32 level = uint32(atol(levelStr)); + + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill); + if (!skillLine) + { + handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); + handler->SetSentErrorMessage(true); + return false; + } + + std::string tNameLink = handler->GetNameLink(target); + + if (!target->GetSkillValue(skill)) + { + handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]); + handler->SetSentErrorMessage(true); + return false; + } + + uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill); + + if (level <= 0 || level > max || max <= 0) + return false; + + target->SetSkill(skill, target->GetSkillStep(skill), level, max); + handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max); + + return true; + } + // show info of player + static bool HandlePInfoCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + + uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + + if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) + { + target = sObjectMgr->GetPlayerByLowGUID(parseGUID); + targetGuid = parseGUID; + } + 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; + uint32 mapId; + uint32 areaId; + uint32 phase = 0; + + // get additional information from Player object + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + accId = target->GetSession()->GetAccountId(); + money = target->GetMoney(); + totalPlayerTime = target->GetTotalPlayedTime(); + level = target->getLevel(); + latency = target->GetSession()->GetLatency(); + race = target->getRace(); + Class = target->getClass(); + muteTime = target->GetSession()->m_muteTime; + mapId = target->GetMapId(); + areaId = target->GetAreaId(); + phase = target->GetPhaseMask(); + } + // get additional information from DB + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); + stmt->setUInt32(0, GUID_LOPART(targetGuid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) + return false; + + Field* fields = result->Fetch(); + totalPlayerTime = fields[0].GetUInt32(); + level = fields[1].GetUInt8(); + money = fields[2].GetUInt32(); + accId = fields[3].GetUInt32(); + race = fields[4].GetUInt8(); + Class = fields[5].GetUInt8(); + mapId = fields[6].GetUInt16(); + areaId = fields[7].GetUInt16(); + } + + std::string userName = handler->GetTrinityString(LANG_ERROR); + std::string eMail = handler->GetTrinityString(LANG_ERROR); + std::string lastIp = handler->GetTrinityString(LANG_ERROR); + uint32 security = 0; + std::string lastLogin = handler->GetTrinityString(LANG_ERROR); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO); + stmt->setInt32(0, int32(realmID)); + stmt->setUInt32(1, accId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + if (result) + { + Field* fields = result->Fetch(); + userName = fields[0].GetString(); + security = fields[1].GetUInt8(); + eMail = fields[2].GetString(); + muteTime = fields[5].GetUInt64(); + + if (eMail.empty()) + eMail = "-"; + + if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)) + { + lastIp = fields[3].GetString(); + lastLogin = fields[4].GetString(); + + uint32 ip = inet_addr(lastIp.c_str()); +#if TRINITY_ENDIAN == BIGENDIAN + EndianConvertReverse(ip); +#endif + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY); + + stmt->setUInt32(0, ip); + + PreparedQueryResult result2 = WorldDatabase.Query(stmt); + + if (result2) + { + Field* fields2 = result2->Fetch(); + lastIp.append(" ("); + lastIp.append(fields2[0].GetString()); + lastIp.append(")"); + } + } + else + { + lastIp = "-"; + lastLogin = "-"; + } + } + + 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); + if (!result2) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); + stmt->setUInt32(0, GUID_LOPART(targetGuid)); + result2 = CharacterDatabase.Query(stmt); + } + + if (result2) + { + Field* fields = result2->Fetch(); + banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32()); + bannedby = fields[2].GetString(); + banreason = fields[3].GetString(); + } + + if (muteTime > 0) + handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str()); + + 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 = ""; + std::string zoneName = ""; + + MapEntry const* map = sMapStore.LookupEntry(mapId); + + AreaTableEntry const* area = GetAreaEntryByAreaID(areaId); + if (area) + { + areaName = area->area_name[locale]; + + AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); + if (zone) + zoneName = zone->area_name[locale]; + } + + 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(), "", phase); + } + else + handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); + + return true; + } + + static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // accept only explicitly selected target (not implicitly self targeting case) + Unit* target = handler->getSelectedUnit(); + if (player->GetSelection() && target) + { + if (target->GetTypeId() != TYPEID_UNIT || target->isPet()) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->isDead()) + target->ToCreature()->Respawn(); + return true; + } + + CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY())); + Cell cell(p); + cell.SetNoCreate(); + + Trinity::RespawnDo u_do; + Trinity::WorldObjectWorker worker(player, u_do); + + TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); + cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange()); + + return true; + } + // mute player for some times + static bool HandleMuteCommand(ChatHandler* handler, char const* args) + { + char* nameStr; + char* delayStr; + handler->extractOptFirstArg((char*)args, &nameStr, &delayStr); + if (!delayStr) + return false; + + char const* muteReason = strtok(NULL, "\r"); + std::string muteReasonStr = "No reason"; + if (muteReason != NULL) + muteReasonStr = muteReason; + + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) + return false; + + uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); + + // find only player from same account if any + if (!target) + if (WorldSession* session = sWorld->FindSession(accountId)) + target = session->GetPlayer(); + + uint32 notSpeakTime = uint32(atoi(delayStr)); + + // must have strong lesser security level + if (handler->HasLowerSecurity (target, targetGuid, true)) + return false; + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); + + if (target) + { + // Target is online, mute will be in effect right away. + int64 muteTime = time(NULL) + notSpeakTime * MINUTE; + target->GetSession()->m_muteTime = muteTime; + stmt->setInt64(0, muteTime); + ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str()); + } + else + { + // Target is offline, mute will be in effect starting from the next login. + int32 muteTime = -int32(notSpeakTime * MINUTE); + stmt->setInt64(0, muteTime); + } + + stmt->setUInt32(1, accountId); + LoginDatabase.Execute(stmt); + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str()); + + return true; + } + + // unmute player + static bool HandleUnmuteCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); + + // find only player from same account if any + if (!target) + if (WorldSession* session = sWorld->FindSession(accountId)) + target = session->GetPlayer(); + + // must have strong lesser security level + if (handler->HasLowerSecurity (target, targetGuid, true)) + return false; + + if (target) + { + if (target->CanSpeak()) + { + handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED); + handler->SetSentErrorMessage(true); + return false; + } + + target->GetSession()->m_muteTime = 0; + } + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); + stmt->setInt64(0, 0); + stmt->setUInt32(1, accountId); + LoginDatabase.Execute(stmt); + + if (target) + ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str()); + + return true; + } + + + static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow()); + + MotionMaster* motionMaster = unit->GetMotionMaster(); + float x, y, z; + motionMaster->GetDestination(x, y, z); + + for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) + { + MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i); + if (!movementGenerator) + { + handler->SendSysMessage("Empty"); + continue; + } + + switch (movementGenerator->GetMovementGeneratorType()) + { + case IDLE_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_IDLE); + break; + case RANDOM_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_RANDOM); + break; + case WAYPOINT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT); + break; + case ANIMAL_RANDOM_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); + break; + case CONFUSED_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_CONFUSED); + break; + case CHASE_MOTION_TYPE: + { + Unit* target = NULL; + if (unit->GetTypeId() == TYPEID_PLAYER) + target = static_cast const*>(movementGenerator)->GetTarget(); + else + target = static_cast const*>(movementGenerator)->GetTarget(); + + if (!target) + handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); + else if (target->GetTypeId() == TYPEID_PLAYER) + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); + else + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); + break; + } + case FOLLOW_MOTION_TYPE: + { + Unit* target = NULL; + if (unit->GetTypeId() == TYPEID_PLAYER) + target = static_cast const*>(movementGenerator)->GetTarget(); + else + target = static_cast const*>(movementGenerator)->GetTarget(); + + if (!target) + handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); + else if (target->GetTypeId() == TYPEID_PLAYER) + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); + else + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); + break; + } + case HOME_MOTION_TYPE: + { + if (unit->GetTypeId() == TYPEID_UNIT) + handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z); + else + handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); + break; + } + case FLIGHT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_FLIGHT); + break; + case POINT_MOTION_TYPE: + { + handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z); + break; + } + case FLEEING_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_FEAR); + break; + case DISTRACT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_DISTRACT); + break; + case EFFECT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_EFFECT); + break; + default: + handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType()); + break; + } + } + return true; + } + /* + ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator + Without this function 3rd party scripting library will get linking errors (unresolved external) + when attempting to use the PointMovementGenerator + */ + static bool HandleComeToMeCommand(ChatHandler* handler, char const* args) + { + char const* newFlagStr = strtok((char*)args, " "); + if (!newFlagStr) + return false; + + Creature* caster = handler->getSelectedCreature(); + if (!caster) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + + caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + + return true; + } + + static bool HandleDamageCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Unit* target = handler->getSelectedUnit(); + if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (handler->HasLowerSecurity((Player*)target, 0, false)) + return false; + } + + if (!target->isAlive()) + return true; + + char* damageStr = strtok((char*)args, " "); + if (!damageStr) + return false; + + int32 damage_int = atoi((char*)damageStr); + if (damage_int <= 0) + return true; + + uint32 damage = damage_int; + + char* schoolStr = strtok((char*)NULL, " "); + + // flat melee damage without resistence/etc reduction + if (!schoolStr) + { + handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (target != handler->GetSession()->GetPlayer()) + handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); + return true; + } + + uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; + if (school >= MAX_SPELL_SCHOOL) + return false; + + SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); + + if (Unit::IsDamageReducedByArmor(schoolmask)) + damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); + + char* spellStr = strtok((char*)NULL, " "); + + // melee damage by specific school + if (!spellStr) + { + uint32 absorb = 0; + uint32 resist = 0; + + handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); + + if (damage <= absorb + resist) + return true; + + damage -= absorb + resist; + + handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb); + handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); + handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); + return true; + } + + // non-melee damage + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellid = handler->extractSpellIdFromLink((char*)args); + if (!spellid || !sSpellMgr->GetSpellInfo(spellid)) + return false; + + handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage); + return true; + } + + static bool HandleCombatStopCommand(ChatHandler* handler, char const* args) + { + Player* target = NULL; + + if (args && strlen(args) > 0) + { + target = sObjectAccessor->FindPlayerByName(args); + if (!target) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + + if (!target) + { + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + } + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + target->CombatStop(); + target->getHostileRefManager().deleteReferences(); + return true; + } + + static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/) + { + sArenaTeamMgr->DistributeArenaPoints(); + return true; + } + + static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + // Repair items + target->DurabilityRepairAll(false, 0, false); + + handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str()); + if (handler->needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str()); + + return true; + } + + static bool HandleWaterwalkCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->getSelectedPlayer(); + if (!player) + { + handler->PSendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + // check online security + if (handler->HasLowerSecurity(player, 0)) + return false; + + if (strncmp(args, "on", 3) == 0) + player->SetMovement(MOVE_WATER_WALK); // ON + else if (strncmp(args, "off", 4) == 0) + player->SetMovement(MOVE_LAND_WALK); // OFF + else + { + handler->SendSysMessage(LANG_USE_BOL); + return false; + } + + handler->PSendSysMessage(LANG_YOU_SET_WATERWALK, args, handler->GetNameLink(player).c_str()); + if (handler->needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, handler->GetNameLink().c_str()); + return true; + } + + // Send mail by command + static bool HandleSendMailCommand(ChatHandler* handler, char const* args) + { + // format: name "subject text" "mail text" + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char const* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char const* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + //- TODO: Fix poor design + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + MailDraft(subject, text) + .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender); + + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(targetName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + // Send items by mail + static bool HandleSendItemsCommand(ChatHandler* handler, char const* args) + { + // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] + Player* receiver; + uint64 receiverGuid; + std::string receiverName; + if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char const* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char const* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // extract items + typedef std::pair ItemPair; + typedef std::list< ItemPair > ItemPairs; + ItemPairs items; + + // get all tail string + char* tail = strtok(NULL, ""); + + // get from tail next item str + while (char* itemStr = strtok(tail, " ")) + { + // and get new tail + tail = strtok(NULL, ""); + + // parse item str + char const* itemIdStr = strtok(itemStr, ":"); + char const* itemCountStr = strtok(NULL, " "); + + uint32 itemId = atoi(itemIdStr); + if (!itemId) + return false; + + ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId); + if (!item_proto) + { + handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1; + if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount))) + { + handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + while (itemCount > item_proto->GetMaxStackSize()) + { + items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize())); + itemCount -= item_proto->GetMaxStackSize(); + } + + items.push_back(ItemPair(itemId, itemCount)); + + if (items.size() > MAX_MAIL_ITEMS) + { + handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS); + handler->SetSentErrorMessage(true); + return false; + } + } + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + // fill mail + MailDraft draft(subject, text); + + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + + for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr) + { + if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0)) + { + item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted + draft.AddItem(item); + } + } + + draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(receiverName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + /// Send money by mail + static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args) + { + /// format: name "subject text" "mail text" money + + Player* receiver; + uint64 receiverGuid; + std::string receiverName; + if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + char* moneyStr = strtok(NULL, ""); + int32 money = moneyStr ? atoi(moneyStr) : 0; + if (money <= 0) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + + MailDraft(subject, text) + .AddMoney(money) + .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(receiverName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + /// Send a message to a player in game + static bool HandleSendMessageCommand(ChatHandler* handler, char const* args) + { + /// - Find the player + Player* player; + if (!handler->extractPlayerTarget((char*)args, &player)) + return false; + + char* msgStr = strtok(NULL, ""); + if (!msgStr) + return false; + + ///- Check that he is not logging out. + if (player->GetSession()->isLogingOut()) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + /// - Send the message + // Use SendAreaTriggerMessage for fastest delivery. + player->GetSession()->SendAreaTriggerMessage("%s", msgStr); + player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); + + // Confirmation message + std::string nameLink = handler->GetNameLink(player); + handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr); + + return true; + } + + static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + Creature* creatureTarget = handler->getSelectedCreature(); + + if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) + { + handler->PSendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry()); + // Creatures with family 0 crashes the server + if (!creatrueTemplate->family) + { + handler->PSendSysMessage("This creature cannot be tamed. (family id: 0)."); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->GetPetGUID()) + { + handler->PSendSysMessage("You already have a pet"); + handler->SetSentErrorMessage(true); + return false; + } + + // Everything looks OK, create new pet + Pet* pet = new Pet(player, HUNTER_PET); + if (!pet->CreateBaseAtCreature(creatureTarget)) + { + delete pet; + handler->PSendSysMessage("Error 1"); + return false; + } + + creatureTarget->setDeathState(JUST_DIED); + creatureTarget->RemoveCorpse(); + creatureTarget->SetHealth(0); // just for nice GM-mode view + + pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); + + if (!pet->InitStatsForLevel(creatureTarget->getLevel())) + { + sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + handler->PSendSysMessage("Error 2"); + delete pet; + return false; + } + + // prepare visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1); + + pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true); + // this enables pet details window (Shift+P) + pet->InitPetCreateSpells(); + pet->SetFullHealth(); + + pet->GetMap()->AddToMap(pet->ToCreature()); + + // visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()); + + player->SetMinion(pet, true); + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + player->PetSpellInitialize(); + + return true; + } + + static bool HandlePetLearnCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->GetSession()->GetPlayer(); + Pet* pet = player->GetPet(); + + if (!pet) + { + handler->PSendSysMessage("You have no pet"); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) + return false; + + // Check if pet already has it + if (pet->HasSpell(spellId)) + { + handler->PSendSysMessage("Pet already has spell: %u", spellId); + handler->SetSentErrorMessage(true); + return false; + } + + // Check if spell is valid + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) + { + handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); + handler->SetSentErrorMessage(true); + return false; + } + + pet->learnSpell(spellId); + + handler->PSendSysMessage("Pet has learned spell %u", spellId); + return true; + } + + static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->GetSession()->GetPlayer(); + Pet* pet = player->GetPet(); + if (!pet) + { + handler->PSendSysMessage("You have no pet"); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (pet->HasSpell(spellId)) + pet->removeSpell(spellId, false); + else + handler->PSendSysMessage("Pet doesn't have that spell"); + + return true; + } + + static bool HandleFreezeCommand(ChatHandler* handler, char const* args) + { + std::string name; + Player* player; + char const* TargetName = strtok((char*)args, " "); // get entered name + if (!TargetName) // if no name entered use target + { + player = handler->getSelectedPlayer(); + if (player) //prevent crash with creature as target + { + name = player->GetName(); + normalizePlayerName(name); + } + } + else // if name entered + { + name = TargetName; + normalizePlayerName(name); + player = sObjectAccessor->FindPlayerByName(name.c_str()); + } + + if (!player) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + + if (player == handler->GetSession()->GetPlayer()) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR); + return true; + } + + // effect + if (player && (player != handler->GetSession()->GetPlayer())) + { + handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str()); + + // stop combat + make player unattackable + duel stop + stop some spells + player->setFaction(35); + player->CombatStop(); + if (player->IsNonMeleeSpellCasted(true)) + player->InterruptNonMeleeSpells(true); + player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + // if player class = hunter || warlock remove pet if alive + if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) + { + if (Pet* pet = player->GetPet()) + { + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + // not let dismiss dead pet + if (pet && pet->isAlive()) + player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); + } + } + + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454)) + Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player); + + // save player + player->SaveToDB(); + } + + return true; + } + + static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args) + { + std::string name; + Player* player; + char* targetName = strtok((char*)args, " "); // Get entered name + + if (targetName) + { + name = targetName; + normalizePlayerName(name); + player = sObjectAccessor->FindPlayerByName(name.c_str()); + } + else // If no name was entered - use target + { + player = handler->getSelectedPlayer(); + if (player) + name = player->GetName(); + } + + if (player) + { + handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); + + // Reset player faction + allow combat + allow duels + player->setFactionForRace(player->getRace()); + player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + // Remove Freeze spell (allowing movement and spells) + player->RemoveAurasDueToSpell(9454); + + // Save player + player->SaveToDB(); + } + else + { + if (targetName) + { + // Check for offline players + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME); + stmt->setString(0, name); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + + // If player found: delete his freeze aura + Field* fields = result->Fetch(); + uint32 lowGuid = fields[0].GetUInt32(); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); + stmt->setUInt32(0, lowGuid); + CharacterDatabase.Execute(stmt); + + handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); + return true; + } + else + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + } + + return true; + } + + static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/) + { + // Get names from DB + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) + { + handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); + return true; + } + + // Header of the names + handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE); + + // Output of the results + do + { + Field* fields = result->Fetch(); + std::string player = fields[0].GetString(); + handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str()); + } + while (result->NextRow()); + + return true; + } + + static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) + if (group && group->GetLeaderGUID() != guid) + { + group->ChangeLeader(guid); + group->SendUpdate(); + } + + return true; + } + + static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) + if (group) + group->Disband(); + + return true; + } + + static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true)) + if (group) + group->RemoveMember(guid); + + return true; + } + + static bool HandlePlayAllCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 soundId = atoi((char*)args); + + if (!sSoundEntriesStore.LookupEntry(soundId)) + { + handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); + handler->SetSentErrorMessage(true); + return false; + } + + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID(); + sWorld->SendGlobalMessage(&data); + + handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); + return true; + } + + static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + return false; + + handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true); + return true; + } + + static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + unit = handler->GetSession()->GetPlayer(); + + unit->RemoveCharmAuras(); + + return true; + } + + static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + return false; + + handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true); + return true; + } + + static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + if (player->isPossessing()) + return false; + + player->StopCastingBindSight(); + return true; + } +}; + +void AddSC_misc_commandscript() +{ + new misc_commandscript(); +} diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 76abfca2d85..d85a4db9f7a 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -37,7 +37,7 @@ void AppenderDB::_write(LogMessage& message) case LOG_FILTER_SQL_DRIVER: case LOG_FILTER_SQL_DEV: break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type - default: + default: PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); stmt->setUInt64(0, message.mtime); stmt->setUInt32(1, realm); diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 64f7e697f1f..8e740ba83b8 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -109,7 +109,7 @@ void Log::CreateAppenderFromConfig(const char* name) if (++iter != tokens.end()) flags = AppenderFlags(atoi(*iter)); - + switch (type) { case APPENDER_CONSOLE: -- cgit v1.2.3 From 8a1e7dd0709027825a3cd28a9d5911d0e2750501 Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 16 Aug 2012 00:23:44 +0200 Subject: Core/Loading: Re-enable Server loading log --- doc/LoggingHOWTO.txt | 4 +- src/server/collision/Models/GameObjectModel.cpp | 2 +- src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 12 +- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 8 +- src/server/game/Addons/AddonMgr.cpp | 4 +- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 12 +- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/Conditions/DisableMgr.cpp | 8 +- src/server/game/DataStores/DBCStores.cpp | 2 +- src/server/game/Globals/ObjectMgr.cpp | 210 +++++----- src/server/game/Groups/GroupMgr.cpp | 12 +- src/server/game/Instances/InstanceSaveMgr.cpp | 2 +- .../game/Movement/Waypoints/WaypointManager.cpp | 2 +- src/server/game/Skills/SkillDiscovery.cpp | 2 +- src/server/game/Skills/SkillExtraItems.cpp | 2 +- src/server/game/Texts/CreatureTextMgr.cpp | 6 +- src/server/game/Tickets/TicketMgr.cpp | 6 +- src/server/game/Tools/CharacterDatabaseCleaner.cpp | 2 +- src/server/game/Weather/WeatherMgr.cpp | 2 +- src/server/game/World/World.cpp | 436 ++++++++++----------- src/server/shared/Logging/Appender.cpp | 16 +- src/server/shared/Logging/Appender.h | 5 +- src/server/worldserver/worldserver.conf.dist | 66 ++-- 23 files changed, 415 insertions(+), 408 deletions(-) (limited to 'src') diff --git a/doc/LoggingHOWTO.txt b/doc/LoggingHOWTO.txt index 4e61812d7d8..79b03d3dd2f 100644 --- a/doc/LoggingHOWTO.txt +++ b/doc/LoggingHOWTO.txt @@ -239,7 +239,7 @@ Lets trace how system will log two different messages: Console will discard msg as Log Level is not higher or equal to this appender Server will write to file - "2012-08-15 INFO [CHARACTER ] Guild 1 Player Name Logged in" + "2012-08-15 INFO [CHARACTER ] Player Name Logged in" EXAMPLE 3 As a dev, i may be interested in logging just a particular part of the core @@ -272,5 +272,3 @@ why this system is better than previous one? affected by IO operations - Lets us select "What to log" and "Where to log" on the fly. You can log to a dozen of files without having to change a single line of code - - \ No newline at end of file diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 6045cbc4c9c..6cb0f90d98e 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -83,7 +83,7 @@ void LoadGameObjectModelList() } fclose(model_list_file); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 7289a4eed28..728b17b0bbf 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -43,7 +43,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); return; } @@ -98,7 +98,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -114,7 +114,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); return; } @@ -146,7 +146,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -167,7 +167,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); return; } @@ -738,6 +738,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 7a997609b5d..3b69408354e 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -50,7 +50,7 @@ void SmartWaypointMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); return; } @@ -88,7 +88,7 @@ void SmartWaypointMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); } @@ -117,7 +117,7 @@ void SmartAIMgr::LoadSmartAIFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); return; } @@ -234,7 +234,7 @@ void SmartAIMgr::LoadSmartAIFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 6af87827917..a0789040e9a 100755 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -43,7 +43,7 @@ void LoadFromDB() QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 known addons. DB table `addons` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!"); return; } @@ -63,7 +63,7 @@ void LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index ab08262a928..84b5513b659 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -263,7 +263,7 @@ void AuctionHouseMgr::LoadAuctionItems() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); return; } @@ -296,7 +296,7 @@ void AuctionHouseMgr::LoadAuctionItems() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -309,7 +309,7 @@ void AuctionHouseMgr::LoadAuctions() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); return; } @@ -335,7 +335,7 @@ void AuctionHouseMgr::LoadAuctions() CharacterDatabase.CommitTransaction(trans); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -734,7 +734,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() if (!expAuctions) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired auctions to delete"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired auctions to delete"); return; } @@ -782,7 +782,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() } while (expAuctions->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 67ba643dd97..7bb28556514 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -926,7 +926,7 @@ void ConditionMgr::LoadConditions(bool isReload) } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index 6215cf5bb75..27695f3eafa 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -59,7 +59,7 @@ void LoadDisables() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 disables. DB table `disables` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disables. DB table `disables` is empty!"); return; } @@ -228,7 +228,7 @@ void LoadDisables() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); } @@ -239,7 +239,7 @@ void CheckQuestDisables() uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size(); if (!count) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked 0 quest disables."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked 0 quest disables."); return; } @@ -259,7 +259,7 @@ void CheckQuestDisables() ++itr; } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 48ceda2a212..850c58bdf93 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -636,7 +636,7 @@ void LoadDBCStores(const std::string& dataPath) exit(1); } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index fc4386633ff..efe944d541b 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -296,7 +296,7 @@ void ObjectMgr::LoadCreatureLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -333,7 +333,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -360,7 +360,7 @@ void ObjectMgr::LoadPointOfInterestLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -388,7 +388,7 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); return; } @@ -491,7 +491,7 @@ void ObjectMgr::LoadCreatureTemplates() for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) CheckCreatureTemplate(&itr->second); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -504,7 +504,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); return; } @@ -563,7 +563,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -881,7 +881,7 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); return; } @@ -947,7 +947,7 @@ void ObjectMgr::LoadCreatureAddons() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -986,7 +986,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); return; } @@ -1039,7 +1039,7 @@ void ObjectMgr::LoadEquipmentTemplates() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1117,7 +1117,7 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); return; } @@ -1162,7 +1162,7 @@ void ObjectMgr::LoadCreatureModelInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1348,7 +1348,7 @@ void ObjectMgr::LoadLinkedRespawn() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); } @@ -1535,7 +1535,7 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1840,7 +1840,7 @@ void ObjectMgr::LoadGameobjects() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -2009,7 +2009,7 @@ void ObjectMgr::LoadItemLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -2052,7 +2052,7 @@ void ObjectMgr::LoadItemTemplates() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item templates. DB table `item_template` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty."); return; } @@ -2614,7 +2614,7 @@ void ObjectMgr::LoadItemTemplates() for (std::set::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr) sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2650,7 +2650,7 @@ void ObjectMgr::LoadItemSetNameLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); } @@ -2679,7 +2679,7 @@ void ObjectMgr::LoadItemSetNames() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); return; } @@ -2734,7 +2734,7 @@ void ObjectMgr::LoadItemSetNames() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2791,7 +2791,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2808,7 +2808,7 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); return; } @@ -2836,7 +2836,7 @@ void ObjectMgr::LoadVehicleAccessories() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2929,7 +2929,7 @@ void ObjectMgr::LoadPetLevelInfo() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3071,7 +3071,7 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3085,7 +3085,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); } else @@ -3143,7 +3143,7 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3200,7 +3200,7 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3247,7 +3247,7 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3329,7 +3329,7 @@ void ObjectMgr::LoadPlayerInfo() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3443,7 +3443,7 @@ void ObjectMgr::LoadPlayerInfo() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3502,7 +3502,7 @@ void ObjectMgr::LoadPlayerInfo() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -4289,7 +4289,7 @@ void ObjectMgr::LoadQuests() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -4338,7 +4338,7 @@ void ObjectMgr::LoadQuestLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -4367,7 +4367,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); return; } @@ -4659,7 +4659,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -4804,7 +4804,7 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); return; } @@ -4852,7 +4852,7 @@ void ObjectMgr::LoadSpellScriptNames() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -4862,7 +4862,7 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated 0 scripts."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts."); return; } @@ -4910,7 +4910,7 @@ void ObjectMgr::ValidateSpellScripts() ++count; } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -4923,7 +4923,7 @@ void ObjectMgr::LoadPageTexts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 page texts. DB table `page_text` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!"); return; } @@ -4953,7 +4953,7 @@ void ObjectMgr::LoadPageTexts() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -4989,7 +4989,7 @@ void ObjectMgr::LoadPageTextLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -5002,7 +5002,7 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); return; } @@ -5032,7 +5032,7 @@ void ObjectMgr::LoadInstanceTemplate() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5122,7 +5122,7 @@ void ObjectMgr::LoadInstanceEncounters() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5143,7 +5143,7 @@ void ObjectMgr::LoadGossipText() int count = 0; if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts", count); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count); return; } @@ -5183,7 +5183,7 @@ void ObjectMgr::LoadGossipText() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5226,7 +5226,7 @@ void ObjectMgr::LoadNpcTextLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -5252,7 +5252,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired mails found."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired mails found."); return; // any mails need to be returned or deleted } @@ -5356,7 +5356,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); } @@ -5370,7 +5370,7 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); return; } @@ -5415,7 +5415,7 @@ void ObjectMgr::LoadQuestAreaTriggers() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5429,7 +5429,7 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); return; } @@ -5454,7 +5454,7 @@ void ObjectMgr::LoadTavernAreaTriggers() _tavernAreaTriggerStore.insert(Trigger_ID); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5467,7 +5467,7 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); return; } @@ -5492,7 +5492,7 @@ void ObjectMgr::LoadAreaTriggerScripts() _areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5611,7 +5611,7 @@ void ObjectMgr::LoadGraveyardZones() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); return; } @@ -5658,7 +5658,7 @@ void ObjectMgr::LoadGraveyardZones() sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5904,7 +5904,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); return; } @@ -5951,7 +5951,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5965,7 +5965,7 @@ void ObjectMgr::LoadAccessRequirements() QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); return; } @@ -6043,7 +6043,7 @@ void ObjectMgr::LoadAccessRequirements() _accessRequirementStore[requirement_ID] = ar; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6268,7 +6268,7 @@ void ObjectMgr::LoadGameObjectLocales() AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -6345,7 +6345,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); return; } @@ -6515,7 +6515,7 @@ void ObjectMgr::LoadGameObjectTemplate() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6544,7 +6544,7 @@ void ObjectMgr::LoadExplorationBaseXP() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6568,7 +6568,7 @@ void ObjectMgr::LoadPetNames() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); return; } @@ -6589,7 +6589,7 @@ void ObjectMgr::LoadPetNames() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6604,7 +6604,7 @@ void ObjectMgr::LoadPetNumber() _hiPetNumber = fields[0].GetUInt32()+1; } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); } @@ -6638,7 +6638,7 @@ void ObjectMgr::LoadCorpses() PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES)); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 corpses. DB table `corpse` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty."); return; } @@ -6667,7 +6667,7 @@ void ObjectMgr::LoadCorpses() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6730,7 +6730,7 @@ void ObjectMgr::LoadReputationRewardRate() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6804,7 +6804,7 @@ void ObjectMgr::LoadReputationOnKill() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6819,7 +6819,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded `reputation_spillover_template`, table is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty."); return; } @@ -6916,7 +6916,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6963,7 +6963,7 @@ void ObjectMgr::LoadPointsOfInterest() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7035,7 +7035,7 @@ void ObjectMgr::LoadQuestPOI() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7103,7 +7103,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7182,7 +7182,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); } @@ -7252,7 +7252,7 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); return; } @@ -7279,7 +7279,7 @@ void ObjectMgr::LoadReservedPlayersNames() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7433,7 +7433,7 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GameObjects for quests"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests"); return; } @@ -7482,7 +7482,7 @@ void ObjectMgr::LoadGameObjectForQuests() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7531,7 +7531,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); else - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 string templates. DB table `%s` is empty.", table); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table); return false; } @@ -7571,9 +7571,9 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max } while (result->NextRow()); if (min_value == MIN_TRINITY_STRING_ID) - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); return true; @@ -7631,7 +7631,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7757,7 +7757,7 @@ void ObjectMgr::LoadGameTele() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7902,7 +7902,7 @@ void ObjectMgr::LoadMailLevelRewards() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8023,7 +8023,7 @@ void ObjectMgr::LoadTrainerSpell() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8114,7 +8114,7 @@ void ObjectMgr::LoadVendors() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8156,7 +8156,7 @@ void ObjectMgr::LoadGossipMenu() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8220,7 +8220,7 @@ void ObjectMgr::LoadGossipMenuItems() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8399,7 +8399,7 @@ void ObjectMgr::LoadScriptNames() while (result->NextRow()); std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8503,7 +8503,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); return; } @@ -8552,7 +8552,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8589,7 +8589,7 @@ void ObjectMgr::LoadFactionChangeAchievements() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8601,7 +8601,7 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); return; } @@ -8626,7 +8626,7 @@ void ObjectMgr::LoadFactionChangeItems() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8663,7 +8663,7 @@ void ObjectMgr::LoadFactionChangeSpells() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8675,7 +8675,7 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); return; } @@ -8700,7 +8700,7 @@ void ObjectMgr::LoadFactionChangeReputations() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 3a758f6df30..7cb8a8ff7b1 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -125,7 +125,7 @@ void GroupMgr::LoadGroups() ", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group definitions. DB table `groups` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!"); return; } @@ -151,7 +151,7 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -169,7 +169,7 @@ void GroupMgr::LoadGroups() QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group members. DB table `group_member` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!"); return; } @@ -190,7 +190,7 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -203,7 +203,7 @@ void GroupMgr::LoadGroups() "LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); return; } @@ -235,7 +235,7 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 4ca7f97c02b..48ed7bdba1f 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -275,7 +275,7 @@ void InstanceSaveManager::LoadInstances() // Load reset times and clean expired instances sInstanceSaveMgr->LoadResetTimes(); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 214fd23fc8a..a01e18347f6 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -86,7 +86,7 @@ void WaypointMgr::Load() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index d9cfbe6b69c..3eac3d34fd2 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -153,7 +153,7 @@ void LoadSkillDiscoveryTable() sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id); } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index 9cb4c145b3d..9e2648dc943 100755 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -110,7 +110,7 @@ void LoadSkillExtraItemTable() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index f64043b7038..7818527b34b 100755 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -77,7 +77,7 @@ void CreatureTextMgr::LoadCreatureTexts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); return; } @@ -136,7 +136,7 @@ void CreatureTextMgr::LoadCreatureTexts() ++textCount; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); } @@ -166,7 +166,7 @@ void CreatureTextMgr::LoadCreatureTextLocales() ++textCount; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index d03ffbbb1f6..0a4682db759 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -263,7 +263,7 @@ void TicketMgr::LoadTickets() PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); return; } @@ -290,7 +290,7 @@ void TicketMgr::LoadTickets() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -303,7 +303,7 @@ void TicketMgr::LoadSurveys() if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_surveys")) _lastSurveyId = (*result)[0].GetUInt32(); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index 2bd9a157e73..f87b81c8be8 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -63,7 +63,7 @@ void CharacterDatabaseCleaner::CleanDatabase() sWorld->SetCleaningFlags(flags); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 0e7f1c87b26..da62122d7a3 100755 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -137,7 +137,7 @@ void LoadWeatherData() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index ab3b7150089..9ec98491180 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -418,27 +418,27 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_HEALTH] = ConfigMgr::GetFloatDefault("Rate.Health", 1); if (rate_values[RATE_HEALTH] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); rate_values[RATE_HEALTH] = 1; } rate_values[RATE_POWER_MANA] = ConfigMgr::GetFloatDefault("Rate.Mana", 1); if (rate_values[RATE_POWER_MANA] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); rate_values[RATE_POWER_MANA] = 1; } rate_values[RATE_POWER_RAGE_INCOME] = ConfigMgr::GetFloatDefault("Rate.Rage.Income", 1); rate_values[RATE_POWER_RAGE_LOSS] = ConfigMgr::GetFloatDefault("Rate.Rage.Loss", 1); if (rate_values[RATE_POWER_RAGE_LOSS] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); rate_values[RATE_POWER_RAGE_LOSS] = 1; } rate_values[RATE_POWER_RUNICPOWER_INCOME] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Income", 1); rate_values[RATE_POWER_RUNICPOWER_LOSS] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Loss", 1); if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1; } rate_values[RATE_POWER_FOCUS] = ConfigMgr::GetFloatDefault("Rate.Focus", 1.0f); @@ -462,7 +462,7 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_REPAIRCOST] = ConfigMgr::GetFloatDefault("Rate.RepairCost", 1.0f); if (rate_values[RATE_REPAIRCOST] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); rate_values[RATE_REPAIRCOST] = 0.0f; } rate_values[RATE_REPUTATION_GAIN] = ConfigMgr::GetFloatDefault("Rate.Reputation.Gain", 1.0f); @@ -499,13 +499,13 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TALENT] = ConfigMgr::GetFloatDefault("Rate.Talent", 1.0f); if (rate_values[RATE_TALENT] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); rate_values[RATE_TALENT] = 1.0f; } rate_values[RATE_MOVESPEED] = ConfigMgr::GetFloatDefault("Rate.MoveSpeed", 1.0f); if (rate_values[RATE_MOVESPEED] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); rate_values[RATE_MOVESPEED] = 1.0f; } for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED]; @@ -514,12 +514,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ConfigMgr::GetFloatDefault("TargetPosRecalculateRange", 1.5f); if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE) { - sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); + sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE; } else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE) { - sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE; } @@ -527,12 +527,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = ConfigMgr::GetFloatDefault("DurabilityLoss.OnDeath", 10.0f); if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f; @@ -540,25 +540,25 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_DAMAGE] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Damage", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ABSORB] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Absorb", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_PARRY] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Parry", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_BLOCK] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Block", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f; } ///- Read other configuration items from the config file @@ -568,7 +568,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_COMPRESSION] = ConfigMgr::GetIntDefault("Compression", 1); if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9) { - sLog->outError(LOG_FILTER_GENERAL, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); m_int_configs[CONFIG_COMPRESSION] = 1; } m_bool_configs[CONFIG_ADDON_CHANNEL] = ConfigMgr::GetBoolDefault("AddonChannel", true); @@ -592,14 +592,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = ConfigMgr::GetIntDefault("PlayerSave.Stats.MinLevel", 0); if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL) { - sLog->outError(LOG_FILTER_GENERAL, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0; } m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = ConfigMgr::GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS); if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY) { - sLog->outError(LOG_FILTER_GENERAL, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY); + sLog->outError(LOG_FILTER_SERVER_LOADING, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY); m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY; } if (reload) @@ -608,7 +608,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = ConfigMgr::GetIntDefault("MapUpdateInterval", 100); if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY) { - sLog->outError(LOG_FILTER_GENERAL, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY; } if (reload) @@ -620,7 +620,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("WorldServerPort", 8085); if (val != m_int_configs[CONFIG_PORT_WORLD]) - sLog->outError(LOG_FILTER_GENERAL, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); } else m_int_configs[CONFIG_PORT_WORLD] = ConfigMgr::GetIntDefault("WorldServerPort", 8085); @@ -639,7 +639,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("GameType", 0); if (val != m_int_configs[CONFIG_GAME_TYPE]) - sLog->outError(LOG_FILTER_GENERAL, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); } else m_int_configs[CONFIG_GAME_TYPE] = ConfigMgr::GetIntDefault("GameType", 0); @@ -648,7 +648,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); if (val != m_int_configs[CONFIG_REALM_ZONE]) - sLog->outError(LOG_FILTER_GENERAL, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); } else m_int_configs[CONFIG_REALM_ZONE] = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); @@ -670,21 +670,21 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PLAYER_NAME] = ConfigMgr::GetIntDefault ("MinPlayerName", 2); if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME) { - sLog->outError(LOG_FILTER_GENERAL, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2; } m_int_configs[CONFIG_MIN_CHARTER_NAME] = ConfigMgr::GetIntDefault ("MinCharterName", 2); if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME) { - sLog->outError(LOG_FILTER_GENERAL, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2; } m_int_configs[CONFIG_MIN_PET_NAME] = ConfigMgr::GetIntDefault ("MinPetName", 2); if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME) { - sLog->outError(LOG_FILTER_GENERAL, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); m_int_configs[CONFIG_MIN_PET_NAME] = 2; } @@ -695,7 +695,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("CharactersPerRealm", 10); if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10) { - sLog->outError(LOG_FILTER_GENERAL, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10; } @@ -703,14 +703,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = ConfigMgr::GetIntDefault("CharactersPerAccount", 50); if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM]) { - sLog->outError(LOG_FILTER_GENERAL, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM]; } m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("HeroicCharactersPerRealm", 1); if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10) { - sLog->outError(LOG_FILTER_GENERAL, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1; } @@ -719,7 +719,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_SKIP_CINEMATICS] = ConfigMgr::GetIntDefault("SkipCinematics", 0); if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2) { - sLog->outError(LOG_FILTER_GENERAL, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); m_int_configs[CONFIG_SKIP_CINEMATICS] = 0; } @@ -727,14 +727,14 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) - sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); } else m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL) { - sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL; } @@ -743,25 +743,25 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartPlayerLevel", 1); if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1) { - sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1; } else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartHeroicPlayerLevel", 55); if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1) { - sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55; } else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } @@ -769,12 +769,12 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_MONEY] = ConfigMgr::GetIntDefault("StartPlayerMoney", 0); if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); m_int_configs[CONFIG_START_PLAYER_MONEY] = 0; } else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT) { - sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT); m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT; } @@ -782,20 +782,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000); if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0; } m_int_configs[CONFIG_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("StartHonorPoints", 0); if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0); m_int_configs[CONFIG_START_HONOR_POINTS] = 0; } else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS]) { - sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS]; } @@ -803,20 +803,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_ARENA_POINTS] = ConfigMgr::GetIntDefault("MaxArenaPoints", 10000); if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0; } m_int_configs[CONFIG_START_ARENA_POINTS] = ConfigMgr::GetIntDefault("StartArenaPoints", 0); if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0); m_int_configs[CONFIG_START_ARENA_POINTS] = 0; } else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS]) { - sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS]; } @@ -824,7 +824,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("RecruitAFriend.MaxLevel", 60); if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError(LOG_FILTER_GENERAL, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60); m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60; } @@ -844,7 +844,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PETITION_SIGNS] = ConfigMgr::GetIntDefault("MinPetitionSigns", 9); if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9) { - sLog->outError(LOG_FILTER_GENERAL, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9; } @@ -859,13 +859,13 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_GM_LEVEL] = ConfigMgr::GetIntDefault("GM.StartLevel", 1); if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL]) { - sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]); m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL]; } else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL) { - sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); + sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL; } m_bool_configs[CONFIG_ALLOW_GM_GROUP] = ConfigMgr::GetBoolDefault("GM.AllowInvite", false); @@ -880,7 +880,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_UPTIME_UPDATE] = ConfigMgr::GetIntDefault("UpdateUptimeInterval", 10); if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0) { - sLog->outError(LOG_FILTER_GENERAL, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); m_int_configs[CONFIG_UPTIME_UPDATE] = 10; } if (reload) @@ -893,7 +893,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearInterval", 10); if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0) { - sLog->outError(LOG_FILTER_GENERAL, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10; } if (reload) @@ -902,7 +902,7 @@ void World::LoadConfigSettings(bool reload) m_timers[WUPDATE_CLEANDB].Reset(); } m_int_configs[CONFIG_LOGDB_CLEARTIME] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default - sLog->outInfo(LOG_FILTER_GENERAL, "Will clear `logs` table of entries older than %i seconds every %u minutes.", + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Will clear `logs` table of entries older than %i seconds every %u minutes.", m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = ConfigMgr::GetIntDefault("SkillChance.Orange", 100); @@ -927,7 +927,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = ConfigMgr::GetIntDefault("MaxOverspeedPings", 2); if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2) { - sLog->outError(LOG_FILTER_GENERAL, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2; } @@ -942,7 +942,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("Expansion", 1); if (val != m_int_configs[CONFIG_EXPANSION]) - sLog->outError(LOG_FILTER_GENERAL, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); } else m_int_configs[CONFIG_EXPANSION] = ConfigMgr::GetIntDefault("Expansion", 1); @@ -974,7 +974,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = ConfigMgr::GetIntDefault("Battleground.Random.ResetHour", 6); if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23) { - sLog->outError(LOG_FILTER_GENERAL, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6; } @@ -1041,10 +1041,10 @@ void World::LoadConfigSettings(bool reload) if (clientCacheId > 0) { m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId; - sLog->outInfo(LOG_FILTER_GENERAL, "Client cache version set to: %u", clientCacheId); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Client cache version set to: %u", clientCacheId); } else - sLog->outError(LOG_FILTER_GENERAL, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId); + sLog->outError(LOG_FILTER_SERVER_LOADING, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId); } m_int_configs[CONFIG_INSTANT_LOGOUT] = ConfigMgr::GetIntDefault("InstantLogout", SEC_MODERATOR); @@ -1060,12 +1060,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceOnContinents = ConfigMgr::GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE); if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceOnContinents = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE; } @@ -1073,12 +1073,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInInstances = ConfigMgr::GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE); if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInInstances = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE; } @@ -1086,12 +1086,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInBGArenas = ConfigMgr::GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS); if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInBGArenas = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE; } @@ -1112,12 +1112,12 @@ void World::LoadConfigSettings(bool reload) if (reload) { if (dataPath != m_dataPath) - sLog->outError(LOG_FILTER_GENERAL, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); } else { m_dataPath = dataPath; - sLog->outInfo(LOG_FILTER_GENERAL, "Using DataDir %s", m_dataPath.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using DataDir %s", m_dataPath.c_str()); } m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = ConfigMgr::GetBoolDefault("vmap.enableIndoorCheck", 0); @@ -1128,19 +1128,19 @@ void World::LoadConfigSettings(bool reload) std::string ignoreSpellIds = ConfigMgr::GetStringDefault("vmap.ignoreSpellIds", ""); if (!enableHeight) - sLog->outError(LOG_FILTER_GENERAL, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); + sLog->outError(LOG_FILTER_SERVER_LOADING, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS); VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight); VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str()); - sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS); - sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap data directory is: %svmaps", m_dataPath.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap data directory is: %svmaps", m_dataPath.c_str()); m_int_configs[CONFIG_MAX_WHO] = ConfigMgr::GetIntDefault("MaxWhoListReturns", 49); m_bool_configs[CONFIG_PET_LOS] = ConfigMgr::GetBoolDefault("vmap.petLOS", true); m_bool_configs[CONFIG_START_ALL_SPELLS] = ConfigMgr::GetBoolDefault("PlayerStart.AllSpells", false); if (m_bool_configs[CONFIG_START_ALL_SPELLS]) - sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: WARNING: PlayerStart.AllSpells enabled - may not function as intended!"); + sLog->outWarn(LOG_FILTER_SERVER_LOADING, "PlayerStart.AllSpells enabled - may not function as intended!"); m_int_configs[CONFIG_HONOR_AFTER_DUEL] = ConfigMgr::GetIntDefault("HonorPointsAfterDuel", 0); m_bool_configs[CONFIG_START_ALL_EXPLORED] = ConfigMgr::GetBoolDefault("PlayerStart.MapsExplored", false); m_bool_configs[CONFIG_START_ALL_REP] = ConfigMgr::GetBoolDefault("PlayerStart.AllReputation", false); @@ -1236,7 +1236,7 @@ void World::SetInitialWorldSettings() !MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) || !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f)))) { - sLog->outError(LOG_FILTER_GENERAL, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str()); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str()); exit(1); } @@ -1248,7 +1248,7 @@ void World::SetInitialWorldSettings() ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trinity strings..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trinity strings..."); if (!sObjectMgr->LoadTrinityStrings()) exit(1); // Error message displayed in function already @@ -1272,36 +1272,36 @@ void World::SetInitialWorldSettings() CharacterDatabase.Execute(stmt); ///- Load the DBC files - sLog->outInfo(LOG_FILTER_GENERAL, "Initialize data stores..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize data stores..."); LoadDBCStores(m_dataPath); DetectDBCLang(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell dbc data corrections..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell dbc data corrections..."); sSpellMgr->LoadDbcDataCorrections(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellInfo store..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo store..."); sSpellMgr->LoadSpellInfoStore(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SkillLineAbilityMultiMap Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SkillLineAbilityMultiMap Data..."); sSpellMgr->LoadSkillLineAbilityMap(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell custom attributes..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell custom attributes..."); sSpellMgr->LoadSpellCustomAttr(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObject models..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObject models..."); LoadGameObjectModelList(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Script Names..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Names..."); sObjectMgr->LoadScriptNames(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Instance Template..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Instance Template..."); sObjectMgr->LoadInstanceTemplate(); // Must be called before `creature_respawn`/`gameobject_respawn` tables - sLog->outInfo(LOG_FILTER_GENERAL, "Loading instances..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading instances..."); sInstanceSaveMgr->LoadInstances(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Localization strings..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Localization strings..."); uint32 oldMSTime = getMSTime(); sObjectMgr->LoadCreatureLocales(); sObjectMgr->LoadGameObjectLocales(); @@ -1314,308 +1314,308 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadPointOfInterestLocales(); sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) - sLog->outInfo(LOG_FILTER_GENERAL, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Page Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Page Texts..."); sObjectMgr->LoadPageTexts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Object Templates..."); // must be after LoadPageTexts + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Object Templates..."); // must be after LoadPageTexts sObjectMgr->LoadGameObjectTemplate(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Rank Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Rank Data..."); sSpellMgr->LoadSpellRanks(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Required Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Required Data..."); sSpellMgr->LoadSpellRequired(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group types..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group types..."); sSpellMgr->LoadSpellGroups(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Skills..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Skills..."); sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Spells..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Spells..."); sSpellMgr->LoadSpellLearnSpells(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc Event conditions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc Event conditions..."); sSpellMgr->LoadSpellProcEvents(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc conditions and data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc conditions and data..."); sSpellMgr->LoadSpellProcs(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Bonus Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Aggro Spells Definitions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group Stack Rules..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading NPC Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading NPC Texts..."); sObjectMgr->LoadGossipText(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Enchant Spells Proc datas..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Enchant Spells Proc datas..."); sSpellMgr->LoadSpellEnchantProcData(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Random Enchantments Table..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Disables"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Disables"); DisableMgr::LoadDisables(); // must be before loading quests and items - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sObjectMgr->LoadItemTemplates(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item set names..."); // must be after LoadItemPrototypes + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item set names..."); // must be after LoadItemPrototypes sObjectMgr->LoadItemSetNames(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Model Based Info Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data..."); sObjectMgr->LoadCreatureModelInfo(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Equipment templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates..."); sObjectMgr->LoadEquipmentTemplates(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature templates..."); sObjectMgr->LoadCreatureTemplates(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature template addons..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons..."); sObjectMgr->LoadCreatureTemplateAddons(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Reward Rates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Reward Rates..."); sObjectMgr->LoadReputationRewardRate(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Reputation OnKill Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Reputation OnKill Data..."); sObjectMgr->LoadReputationOnKill(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Spillover Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Spillover Data..."); sObjectMgr->LoadReputationSpilloverTemplate(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Points Of Interest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Points Of Interest Data..."); sObjectMgr->LoadPointsOfInterest(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Base Stats..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Base Stats..."); sObjectMgr->LoadCreatureClassLevelStats(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Data..."); sObjectMgr->LoadCreatures(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet levelup spells..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet levelup spells..."); sSpellMgr->LoadPetLevelupSpellMap(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet default spells additional to levelup spells..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet default spells additional to levelup spells..."); sSpellMgr->LoadPetDefaultSpells(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Addon Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Addon Data..."); sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gameobject Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Data..."); sObjectMgr->LoadGameobjects(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Linked Respawn..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Linked Respawn..."); sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects() - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Weather Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Weather Data..."); WeatherMgr::LoadWeatherData(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests..."); sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables - sLog->outInfo(LOG_FILTER_GENERAL, "Checking Quest Disables"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Checking Quest Disables"); DisableMgr::CheckQuestDisables(); // must be after loading quests - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest POI"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest POI"); sObjectMgr->LoadQuestPOI(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests Relations..."); sObjectMgr->LoadQuestRelations(); // must be after quest load - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Objects Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Objects Pooling Data..."); sPoolMgr->LoadFromDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Event Data..."); // must be after loading pools fully + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Data..."); // must be after loading pools fully sGameEventMgr->LoadFromDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests sObjectMgr->LoadNPCSpellClickSpells(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Template Accessories..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Template Accessories..."); sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Accessories..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Accessories..."); sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Dungeon boss data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data..."); sObjectMgr->LoadInstanceEncounters(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading LFG rewards..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards..."); sLFGMgr->LoadRewards(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellArea Data..."); // must be after quest load + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellArea Data..."); // must be after quest load sSpellMgr->LoadSpellAreas(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger definitions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Access Requirements..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Access Requirements..."); sObjectMgr->LoadAccessRequirements(); // must be after item template load - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest Area Triggers..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Tavern Area Triggers..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger script names..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger script names..."); sObjectMgr->LoadAreaTriggerScripts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Graveyard-zone links..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Graveyard-zone links..."); sObjectMgr->LoadGraveyardZones(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell pet auras..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell target coordinates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell target coordinates..."); sSpellMgr->LoadSpellTargetPositions(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading enchant custom attributes..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading enchant custom attributes..."); sSpellMgr->LoadEnchantCustomAttr(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading linked spells..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading linked spells..."); sSpellMgr->LoadSpellLinked(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Data..."); sObjectMgr->LoadPlayerInfo(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Exploration BaseXP Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Exploration BaseXP Data..."); sObjectMgr->LoadExplorationBaseXP(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Pet Name Parts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Pet Name Parts..."); sObjectMgr->LoadPetNames(); CharacterDatabaseCleaner::CleanDatabase(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading the max pet number..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading the max pet number..."); sObjectMgr->LoadPetNumber(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet level stats..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet level stats..."); sObjectMgr->LoadPetLevelInfo(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Corpses..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Corpses..."); sObjectMgr->LoadCorpses(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player level dependent mail rewards..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); // Loot tables LoadLootTables(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Discovery Table..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Extra Item Table..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Fishing base level requirements..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Fishing base level requirements..."); sObjectMgr->LoadFishingBaseSkillLevel(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievements..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievements..."); sAchievementMgr->LoadAchievementReferenceList(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Lists..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Lists..."); sAchievementMgr->LoadAchievementCriteriaList(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Rewards..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Rewards..."); sAchievementMgr->LoadRewards(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Reward Locales..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Reward Locales..."); sAchievementMgr->LoadRewardLocales(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Completed Achievements..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Completed Achievements..."); sAchievementMgr->LoadCompletedAchievements(); // Delete expired auctions before loading - sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired auctions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired auctions..."); sAuctionMgr->DeleteExpiredAuctionsAtStartup(); ///- Load dynamic data tables from the database - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Auctions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Auctions..."); sAuctionMgr->LoadAuctionItems(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Auctions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Auctions..."); sAuctionMgr->LoadAuctions(); sGuildMgr->LoadGuilds(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading ArenaTeams..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ArenaTeams..."); sArenaTeamMgr->LoadArenaTeams(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Groups..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Groups..."); sGroupMgr->LoadGroups(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ReservedNames..."); sObjectMgr->LoadReservedPlayersNames(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObjects for quests..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading BattleMasters..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading BattleMasters..."); sBattlegroundMgr->LoadBattleMastersEntry(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameTeleports..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameTeleports..."); sObjectMgr->LoadGameTele(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu..."); sObjectMgr->LoadGossipMenu(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu options..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu options..."); sObjectMgr->LoadGossipMenuItems(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vendors..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vendors..."); sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trainers..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trainers..."); sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Waypoints..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Waypoints..."); sWaypointMgr->Load(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI Waypoints..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI Waypoints..."); sSmartWaypointMgr->LoadFromDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Formations..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Formations..."); sFormationMgr->LoadCreatureFormations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions LoadWorldStates(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Conditions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Conditions..."); sConditionMgr->LoadConditions(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change achievement pairs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change achievement pairs..."); sObjectMgr->LoadFactionChangeAchievements(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change spell pairs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change spell pairs..."); sObjectMgr->LoadFactionChangeSpells(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change item pairs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change item pairs..."); sObjectMgr->LoadFactionChangeItems(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change reputation pairs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change reputation pairs..."); sObjectMgr->LoadFactionChangeReputations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM tickets..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM tickets..."); sTicketMgr->LoadTickets(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM surveys..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM surveys..."); sTicketMgr->LoadSurveys(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading client addons..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading client addons..."); AddonMgr::LoadFromDB(); ///- Handle outdated emails (delete/return) - sLog->outInfo(LOG_FILTER_GENERAL, "Returning old mails..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Returning old mails..."); sObjectMgr->ReturnOrDeleteOldMails(false); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Autobroadcasts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Autobroadcasts..."); LoadAutobroadcasts(); ///- Load and initialize scripts @@ -1626,42 +1626,42 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) sObjectMgr->LoadWaypointScripts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Scripts text locales..."); // must be after Load*Scripts calls + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Scripts text locales..."); // must be after Load*Scripts calls sObjectMgr->LoadDbScriptStrings(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Texts..."); sEventAIMgr->LoadCreatureEventAI_Texts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Summons..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Summons..."); sEventAIMgr->LoadCreatureEventAI_Summons(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Scripts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Scripts..."); sEventAIMgr->LoadCreatureEventAI_Scripts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell script names..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell script names..."); sObjectMgr->LoadSpellScriptNames(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Text Locales..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Text Locales..."); sCreatureTextMgr->LoadCreatureTextLocales(); - sLog->outInfo(LOG_FILTER_GENERAL, "Initializing Scripts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initializing Scripts..."); sScriptMgr->Initialize(); sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized - sLog->outInfo(LOG_FILTER_GENERAL, "Validating spell scripts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Validating spell scripts..."); sObjectMgr->ValidateSpellScripts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI scripts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Calendar data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Calendar data..."); sCalendarMgr->LoadFromDB(); ///- Initialize game time and timers - sLog->outInfo(LOG_FILTER_GENERAL, "Initialize game time and timers"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize game time and timers"); m_gameTime = time(NULL); m_startTime = m_gameTime; @@ -1688,16 +1688,16 @@ void World::SetInitialWorldSettings() mail_timer = ((((localtime(&m_gameTime)->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval()); //1440 mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval())); - sLog->outInfo(LOG_FILTER_GENERAL, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires)); ///- Initilize static helper structures AIRegistry::Initialize(); ///- Initialize MapManager - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Map System"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Map System"); sMapMgr->Initialize(); - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Game Event system..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Game Event system..."); uint32 nextGameEvent = sGameEventMgr->StartSystem(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event @@ -1707,50 +1707,50 @@ void World::SetInitialWorldSettings() // Delete all custom channels which haven't been used for PreserveCustomChannelDuration days. Channel::CleanOldChannelsInDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Arena Season..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Arena Season..."); sGameEventMgr->StartArenaSeason(); sTicketMgr->Initialize(); ///- Initialize Battlegrounds - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battleground System"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battleground System"); sBattlegroundMgr->CreateInitialBattlegrounds(); sBattlegroundMgr->InitAutomaticArenaPointDistribution(); ///- Initialize outdoor pvp - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Outdoor PvP System"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System"); sOutdoorPvPMgr->InitOutdoorPvP(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transports..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); sMapMgr->LoadTransports(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transport NPCs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transport NPCs..."); sMapMgr->LoadTransportNPCs(); ///- Initialize Warden - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Checks..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Checks..."); sWardenCheckMgr->LoadWardenChecks(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Action Overrides..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Action Overrides..."); sWardenCheckMgr->LoadWardenOverrides(); - sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired bans..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired bans..."); LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query - sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next daily quest reset time..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next daily quest reset time..."); InitDailyQuestResetTime(); - sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next weekly quest reset time..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next weekly quest reset time..."); InitWeeklyQuestResetTime(); - sLog->outInfo(LOG_FILTER_GENERAL, "Calculate random battleground reset time..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time..."); InitRandomBGResetTime(); LoadCharacterNameData(); uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); - sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); sLog->EnableDBAppenders(); } @@ -1760,7 +1760,7 @@ void World::DetectDBCLang() if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES) { - sLog->outError(LOG_FILTER_GENERAL, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); m_lang_confid = LOCALE_enUS; } @@ -1788,13 +1788,13 @@ void World::DetectDBCLang() if (default_locale >= TOTAL_LOCALES) { - sLog->outError(LOG_FILTER_GENERAL, "Unable to determine your DBC Locale! (corrupt DBC?)"); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Unable to determine your DBC Locale! (corrupt DBC?)"); exit(1); } m_defaultDbcLocale = LocaleConstant(default_locale); - sLog->outInfo(LOG_FILTER_GENERAL, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); } @@ -1834,7 +1834,7 @@ void World::LoadAutobroadcasts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); return; } @@ -1852,7 +1852,7 @@ void World::LoadAutobroadcasts() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2019,7 +2019,7 @@ void World::Update(uint32 diff) if (m_timers[WUPDATE_PINGDB].Passed()) { m_timers[WUPDATE_PINGDB].Reset(); - sLog->outInfo(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive"); + sLog->outDebug(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive"); CharacterDatabase.KeepAlive(); LoginDatabase.KeepAlive(); WorldDatabase.KeepAlive(); @@ -2608,7 +2608,7 @@ void World::SendAutoBroadcast() sWorld->SendGlobalMessage(&data); } - sLog->outInfo(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str()); + sLog->outDebug(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str()); } void World::UpdateRealmCharCount(uint32 accountId) @@ -2835,7 +2835,7 @@ void World::LoadWorldStates() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 world states. DB table `worldstates` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 world states. DB table `worldstates` is empty!"); return; } @@ -2850,7 +2850,7 @@ void World::LoadWorldStates() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2907,12 +2907,12 @@ void World::ProcessQueryCallbacks() void World::LoadCharacterNameData() { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading character name data"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data"); QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL"); if (!result) { - sLog->outError(LOG_FILTER_GENERAL, "No character name data loaded, empty query"); + sLog->outError(LOG_FILTER_SQL, "No character name data loaded, empty query"); return; } @@ -2926,7 +2926,7 @@ void World::LoadCharacterNameData() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, "Loaded name data for %u characters", count); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loaded name data for %u characters", count); } void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass) diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index be30a54ff02..1a24cb1d592 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -98,7 +98,7 @@ void Appender::write(LogMessage& message) message.prefix.push_back(' '); char text[MAX_QUERY_LEN]; - snprintf(text, MAX_QUERY_LEN, "[%-15s]", Appender::getLogFilterTypeString(message.type)); + snprintf(text, MAX_QUERY_LEN, "[%s]", Appender::getLogFilterTypeString(message.type)); message.prefix.append(text); } @@ -172,13 +172,13 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) case LOG_FILTER_PLAYER: return "PLAYER"; case LOG_FILTER_PLAYER_LOADING: - return "PLAYER_LOADING"; + return "PLAYER LOADING"; case LOG_FILTER_PLAYER_ITEMS: - return "PLAYER_ITEMS"; + return "PLAYER ITEMS"; case LOG_FILTER_PLAYER_SKILLS: - return "PLAYER_SKILLS"; + return "PLAYER SKILLS"; case LOG_FILTER_PLAYER_CHATLOG: - return "PLAYER_CHATLOG"; + return "PLAYER CHATLOG"; case LOG_FILTER_LOOT: return "LOOT"; case LOG_FILTER_GUILD: @@ -209,6 +209,12 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "SQL DRIVER"; case LOG_FILTER_SQL_DEV: return "SQL DEV"; + case LOG_FILTER_PLAYER_DUMP: + return "PLAYER DUMP"; + case LOG_FILTER_BATTLEFIELD: + return "BATTLEFIELD"; + case LOG_FILTER_SERVER_LOADING: + return "SERVER LOADING"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index ebe7408d400..37b53178af3 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -64,10 +64,11 @@ enum LogFilterType LOG_FILTER_SQL_DRIVER, LOG_FILTER_SQL_DEV, LOG_FILTER_PLAYER_DUMP, - LOG_FILTER_BATTLEFIELD + LOG_FILTER_BATTLEFIELD, + LOG_FILTER_SERVER_LOADING }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_BATTLEFIELD) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_SERVER_LOADING) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 789af4e371b..13cd1bdcbd8 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2691,47 +2691,49 @@ Appender.Chat=2,2,7,Chat.log # 37 - SQL Dev # 38 - Player Dump # 39 - Battlefield +# 40 - Server Loading Logger.Root=0,3,Console Server -Logger.Units=1,3,Console Server -Logger.Pets=2,3,Console Server -Logger.Vehicles=3,3,Console Server -Logger.TCSR=4,3,Console Server -Logger.AI=5,3,Console Server -Logger.MapScripts=6,3,Console Server -Logger.NetWork=7,3,Console Server -Logger.Spells=8,3,Console Server -Logger.Achievements=9,3,Console Server -Logger.Conditions=10,3,Console Server -Logger.Pool=11,3,Console Server -Logger.AuctionHouse=12,3,Console Server -Logger.Battlegrounds=13,3,Console Server -Logger.OutdoorPvP=14,3,Console Server -Logger.ChatSystem=15,3,Console Server -Logger.LFG=16,3,Console Server -Logger.Maps=17,3,Console Server -Logger.Player=18,3,Console Server -Logger.PlayerLoading=19,3,Console Server -Logger.PlayerItems=20,3,Console Server -Logger.PlayerSkills=21,3,Console Server +Logger.Units=1,5,Console Server +Logger.Pets=2,5,Console Server +Logger.Vehicles=3,5,Console Server +Logger.TCSR=4,5,Console Server +Logger.AI=5,5,Console Server +Logger.MapScripts=6,5,Console Server +Logger.NetWork=7,5,Console Server +Logger.Spells=8,5,Console Server +Logger.Achievements=9,5,Console Server +Logger.Conditions=10,5,Console Server +Logger.Pool=11,5,Console Server +Logger.AuctionHouse=12,5,Console Server +Logger.Battlegrounds=13,5,Console Server +Logger.OutdoorPvP=14,5,Console Server +Logger.ChatSystem=15,5,Console Server +Logger.LFG=16,5,Console Server +Logger.Maps=17,5,Console Server +Logger.Player=18,5,Console Server +Logger.PlayerLoading=19,5,Console Server +Logger.PlayerItems=20,5,Console Server +Logger.PlayerSkills=21,5,Console Server Logger.PlayerChat=22,3,Chat -Logger.Loot=23,3,Console Server -Logger.Guilds=24,3,Console Server -Logger.Transports=25,3,Console Server -Logger.SQL=26,2,Console Server DBErrors +Logger.Loot=23,5,Console Server +Logger.Guilds=24,5,Console Server +Logger.Transports=25,5,Console Server +Logger.SQL=26,5,Console Server DBErrors Logger.GM=27,3,Console Server GM Logger.RA=28,3,RA Logger.Warden=29,3,Warden -Logger.Authserver=30,3,Console Server -Logger.Worldserver=31,3,Console Server -Logger.GameEvents=32,3,Console Server -Logger.Calendar=33,3,Console Server +Logger.Authserver=30,5,Console Server +Logger.Worldserver=31,5,Console Server +Logger.GameEvents=32,5,Console Server +Logger.Calendar=33,5,Console Server Logger.Character=34,3,Char Logger.Arenas=35,3,Arenas Logger.SQLDriver=36,5,SQLDriver Logger.SQLDev=37,3,SQLDev -Logger.CharDump=38,5,CharDump -Logger.Battlefield=39,3,Console Server +Logger.CharDump=38,3,CharDump +Logger.Battlefield=39,5,Console Server +Logger.Load=40,3,Console Server # LogLevel # 0 - (Disabled) @@ -2758,4 +2760,4 @@ Appenders=Console Server GM Char Arenas Warden DBErrors CharDump # (Using spaces as separator). # Default: "root" -Loggers=Root GM Character Arenas Warden SQL +Loggers=Root GM Character Arenas Warden SQL Load -- cgit v1.2.3 From 3c42401d662104145bf55a6550b432dd8a4428e2 Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 16 Aug 2012 00:56:58 +0200 Subject: Core/Logging: Set config options to behave like old log system. --- src/server/shared/Logging/Appender.cpp | 2 + src/server/shared/Logging/Appender.h | 5 +- src/server/worldserver/worldserver.conf.dist | 96 ++++++++++------------------ 3 files changed, 39 insertions(+), 64 deletions(-) (limited to 'src') diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 1a24cb1d592..348ec4b3c7c 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -215,6 +215,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "BATTLEFIELD"; case LOG_FILTER_SERVER_LOADING: return "SERVER LOADING"; + case LOG_FILTER_OPCODES: + return "OPCODE"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 37b53178af3..c0e03b13db1 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -65,10 +65,11 @@ enum LogFilterType LOG_FILTER_SQL_DEV, LOG_FILTER_PLAYER_DUMP, LOG_FILTER_BATTLEFIELD, - LOG_FILTER_SERVER_LOADING + LOG_FILTER_SERVER_LOADING, + LOG_FILTER_OPCODES }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_SERVER_LOADING) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_OPCODES) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 13cd1bdcbd8..ce084e2fb96 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2627,19 +2627,25 @@ PlayerDump.DisallowOverwrite = 1 # w - (Overwrite) # -Appender.Console=1,2,6 -Appender.Server=2,2,7,Server.log,w -Appender.GM=2,2,7,GM_%s.log -Appender.SQL=2,2,7,SQL.log -Appender.DBErrors=2,2,7,DBErrors.log -Appender.Char=2,2,7,Char.log,w -Appender.CharDump=2,2,0,chardumps/%s.log -Appender.RA=2,2,7,RA.log -Appender.Arenas=2,2,7,Arena.log +Appender.Console=1,5,0 +Appender.Server=2,2,0,Server.log,w +Appender.GM=2,2,0,GM.log +Appender.DBErrors=2,2,0,DBErrors.log +Appender.Char=2,2,0,Char.log,w +Appender.RA=2,2,0,RA.log +Appender.Warden=2,2,0,Warden.log +Appender.Chat=2,2,0,Chat.log +Appender.CharDump=2,2,0,%s.log +Appender.Arenas=2,2,0,Arena.log Appender.SQLDev=2,2,0,SQLDev.log -Appender.SQLDriver=2,2,7,SQLDriver.log -Appender.Warden=2,2,7,Warden.log -Appender.Chat=2,2,7,Chat.log +Appender.SQLDriver=2,2,0,SQLDriver.log + +# Appenders +# Description: List of Appenders to read from config +# (Using spaces as separator). +# Default: "Console Server GM DBErrors Char RA Warden Chat" + +Appenders=Console Server GM DBErrors Char RA Warden Chat # Logger config values: Given a logger "name" # Logger.name @@ -2692,49 +2698,7 @@ Appender.Chat=2,2,7,Chat.log # 38 - Player Dump # 39 - Battlefield # 40 - Server Loading - -Logger.Root=0,3,Console Server -Logger.Units=1,5,Console Server -Logger.Pets=2,5,Console Server -Logger.Vehicles=3,5,Console Server -Logger.TCSR=4,5,Console Server -Logger.AI=5,5,Console Server -Logger.MapScripts=6,5,Console Server -Logger.NetWork=7,5,Console Server -Logger.Spells=8,5,Console Server -Logger.Achievements=9,5,Console Server -Logger.Conditions=10,5,Console Server -Logger.Pool=11,5,Console Server -Logger.AuctionHouse=12,5,Console Server -Logger.Battlegrounds=13,5,Console Server -Logger.OutdoorPvP=14,5,Console Server -Logger.ChatSystem=15,5,Console Server -Logger.LFG=16,5,Console Server -Logger.Maps=17,5,Console Server -Logger.Player=18,5,Console Server -Logger.PlayerLoading=19,5,Console Server -Logger.PlayerItems=20,5,Console Server -Logger.PlayerSkills=21,5,Console Server -Logger.PlayerChat=22,3,Chat -Logger.Loot=23,5,Console Server -Logger.Guilds=24,5,Console Server -Logger.Transports=25,5,Console Server -Logger.SQL=26,5,Console Server DBErrors -Logger.GM=27,3,Console Server GM -Logger.RA=28,3,RA -Logger.Warden=29,3,Warden -Logger.Authserver=30,5,Console Server -Logger.Worldserver=31,5,Console Server -Logger.GameEvents=32,5,Console Server -Logger.Calendar=33,5,Console Server -Logger.Character=34,3,Char -Logger.Arenas=35,3,Arenas -Logger.SQLDriver=36,5,SQLDriver -Logger.SQLDev=37,3,SQLDev -Logger.CharDump=38,3,CharDump -Logger.Battlefield=39,5,Console Server -Logger.Load=40,3,Console Server - +# 41 - Opcodes (just id and name sent / received) # LogLevel # 0 - (Disabled) # 1 - (Trace) @@ -2747,17 +2711,25 @@ Logger.Load=40,3,Console Server # AppenderList: List of appenders linked to logger # (Using spaces as separator). # -# Appenders -# Description: List of Appenders to read from config -# (Using spaces as separator). -# Default: "Console Server" -Appenders=Console Server GM Char Arenas Warden DBErrors CharDump +Logger.Root=0,3,Console Server +Logger.Chat=22,3,Chat +Logger.DBErrors=26,5,Console Server DBErrors +Logger.GM=27,3,Console Server GM +Logger.RA=28,3,RA +Logger.Warden=29,3,Warden +Logger.Character=34,3,Char +Logger.Arenas=35,3,Arenas +Logger.SQLDriver=36,5,SQLDriver +Logger.SQLDev=37,3,SQLDev +Logger.CharDump=38,3,CharDump +Logger.Load=40,3,Console Server # # Loggers # Description: List of Loggers to read from config # (Using spaces as separator). -# Default: "root" +# Default: "Root Chat DBErrors GM RA Warden Character Load" + +Loggers=Root Chat DBErrors GM RA Warden Character Load -Loggers=Root GM Character Arenas Warden SQL Load -- cgit v1.2.3 From a566e3e58bc54635c0caa019f6fdbe6f7adf8ceb Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 16 Aug 2012 11:02:46 +0200 Subject: Core/Logging: Move more log messages to LOG_FILTER_SERVER_LOADING --- src/server/authserver/authserver.conf.dist | 28 ++--- src/server/game/Achievements/AchievementMgr.cpp | 36 +++---- src/server/game/Battlegrounds/ArenaTeamMgr.cpp | 6 +- src/server/game/Battlegrounds/BattlegroundMgr.cpp | 12 +-- .../game/Battlegrounds/Zones/BattlegroundWS.cpp | 54 ++++++---- src/server/game/DungeonFinding/LFGMgr.cpp | 6 +- .../game/Entities/Creature/CreatureGroups.cpp | 6 +- .../game/Entities/Item/ItemEnchantmentMgr.cpp | 6 +- src/server/game/Entities/Transport/Transport.cpp | 14 +-- src/server/game/Events/GameEventMgr.cpp | 115 ++++++++------------ src/server/game/Globals/ObjectMgr.cpp | 117 ++------------------- src/server/game/Globals/ObjectMgr.h | 8 +- src/server/game/Groups/GroupMgr.cpp | 10 +- src/server/game/Guilds/GuildMgr.cpp | 65 +++++------- src/server/game/Loot/LootMgr.cpp | 69 +++++------- src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp | 6 +- src/server/game/Pools/PoolMgr.cpp | 32 +++--- src/server/game/Scripting/ScriptMgr.cpp | 5 +- src/server/game/Scripting/ScriptMgr.h | 2 +- src/server/game/Scripting/ScriptSystem.cpp | 28 ++--- src/server/game/Spells/SpellMgr.cpp | 109 +++++++------------ src/server/shared/Logging/Log.cpp | 6 -- src/server/worldserver/worldserver.conf.dist | 9 +- 23 files changed, 258 insertions(+), 491 deletions(-) (limited to 'src') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 15dd02d9052..9a4beca9bf6 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -198,7 +198,7 @@ LoginDatabase.WorkerThreads = 1 # Example: "13 11 9 5 3 1" # # File: Name of the file (read as optional1 if Type = File) -# Allows to use one "%u" to create dynamic files +# Allows to use one "%s" to create dynamic files # # Mode: Mode to open the file (read as optional2 if Type = File) # a - (Append) @@ -208,19 +208,6 @@ LoginDatabase.WorkerThreads = 1 Appender.Console=1,2,6 Appender.Auth=2,2,7,Auth.log,w -# Logger config values: Given a logger "name" -# Logger.name -# Description: Defines 'What to log' -# Format: Type,LogLevel,AppenderList -# Type -# 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 7 - Network input/output, -# 30 - Authserver - -Logger.Root=0,3,Console Auth - # LogLevel # 0 - (Disabled) # 1 - (Trace) @@ -240,6 +227,19 @@ Logger.Root=0,3,Console Auth Appenders=Console Auth +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 7 - Network input/output, +# 30 - Authserver + +Logger.Root=0,3,Console Auth + # # Loggers # Description: List of Loggers to read from config diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 191d91b61a7..c607132dfe1 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2201,8 +2201,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() if (sAchievementCriteriaStore.GetNumRows() == 0) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement criteria."); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement criteria."); return; } @@ -2219,8 +2218,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria); } - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadAchievementReferenceList() @@ -2229,8 +2227,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (sAchievementStore.GetNumRows() == 0) { - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement references."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement references."); return; } @@ -2250,8 +2247,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539)) const_cast(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar) - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadAchievementCriteriaData() @@ -2264,8 +2260,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!result) { - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); return; } @@ -2396,8 +2391,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadCompletedAchievements() @@ -2408,8 +2402,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() if (!result) { - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty."); return; } @@ -2436,8 +2429,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() m_allCompletedAchievements.insert(achievementId); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadRewards() @@ -2451,8 +2443,7 @@ void AchievementGlobalMgr::LoadRewards() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); return; } @@ -2543,8 +2534,7 @@ void AchievementGlobalMgr::LoadRewards() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadRewardLocales() @@ -2559,8 +2549,7 @@ void AchievementGlobalMgr::LoadRewardLocales() if (!result) { - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); return; } @@ -2586,6 +2575,5 @@ void AchievementGlobalMgr::LoadRewardLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index 665742c97b1..55de445345b 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -101,8 +101,7 @@ void ArenaTeamMgr::LoadArenaTeams() if (!result) { - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); return; } @@ -132,8 +131,7 @@ void ArenaTeamMgr::LoadArenaTeams() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ArenaTeamMgr::DistributeArenaPoints() diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 290da0bb31f..0b107983379 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -683,8 +683,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); return; } @@ -792,8 +791,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void BattlegroundMgr::InitAutomaticArenaPointDistribution() @@ -1077,8 +1075,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() if (!result) { - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); return; } @@ -1102,8 +1099,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 483e8ffdaf6..ededaf15bb5 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -700,28 +700,40 @@ void BattlegroundWS::Reset() //call parent's class reset Battleground::Reset(); - m_FlagKeepers[BG_TEAM_ALLIANCE] = 0; - m_FlagKeepers[BG_TEAM_HORDE] = 0; + m_FlagKeepers[BG_TEAM_ALLIANCE] = 0; + m_FlagKeepers[BG_TEAM_HORDE] = 0; + m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0; - m_DroppedFlagGUID[BG_TEAM_HORDE] = 0; - _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; - _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; - m_TeamScores[BG_TEAM_ALLIANCE] = 0; - m_TeamScores[BG_TEAM_HORDE] = 0; - bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID()); - m_ReputationCapture = (isBGWeekend) ? 45 : 35; - m_HonorWinKills = (isBGWeekend) ? 3 : 1; - m_HonorEndKills = (isBGWeekend) ? 4 : 2; - // For WorldState - _minutesElapsed = 0; - _lastFlagCaptureTeam = 0; - - /* Spirit nodes is static at this BG and then not required deleting at BG reset. - if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE]) - DelCreature(WS_SPIRIT_MAIN_ALLIANCE); - if (BgCreatures[WS_SPIRIT_MAIN_HORDE]) - DelCreature(WS_SPIRIT_MAIN_HORDE); - */ + m_DroppedFlagGUID[BG_TEAM_HORDE] = 0; + + _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + + m_TeamScores[BG_TEAM_ALLIANCE] = 0; + m_TeamScores[BG_TEAM_HORDE] = 0; + + if (sBattlegroundMgr->IsBGWeekend(GetTypeID())) + { + m_ReputationCapture = 45; + m_HonorWinKills = 3; + m_HonorEndKills = 4; + } + else + { + m_ReputationCapture = 35; + m_HonorWinKills = 1; + m_HonorEndKills = 2; + } + _minutesElapsed = 0; + _lastFlagCaptureTeam = 0; + _bothFlagsKept = false; + _flagDebuffState = 0; + _flagSpellForceTimer = 0; + _lastFlagCaptureTeam = 0; + _flagsDropTimer[BG_TEAM_ALLIANCE] = 0; + _flagsDropTimer[BG_TEAM_HORDE] = 0; + _flagsTimer[BG_TEAM_ALLIANCE] = 0; + _flagsTimer[BG_TEAM_HORDE] = 0; } void BattlegroundWS::EndBattleground(uint32 winner) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 3a2a044ca3b..a7dd677313e 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -135,8 +135,7 @@ void LFGMgr::LoadRewards() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); return; } @@ -183,8 +182,7 @@ void LFGMgr::LoadRewards() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_LFG, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void LFGMgr::Update(uint32 diff) diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 21ed1a23828..8823a788555 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -84,8 +84,7 @@ void FormationMgr::LoadCreatureFormations() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); return; } @@ -136,8 +135,7 @@ void FormationMgr::LoadCreatureFormations() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_UNITS, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void CreatureGroup::AddMember(Creature* member) diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index 0478173b96e..f85bf80e145 100755 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -70,14 +70,10 @@ void LoadRandomEnchantmentsTable() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } else - { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); - - } } uint32 GetItemEnchantMod(int32 entry) diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 52d5c9114ff..88d3108dbe2 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -35,8 +35,7 @@ void MapManager::LoadTransports() if (!result) { - sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transports. DB table `transports` is empty!"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transports. DB table `transports` is empty!"); return; } @@ -66,7 +65,7 @@ void MapManager::LoadTransports() continue; } - // sLog->outInfo(LOG_FILTER_TRANSPORTS, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name); + // sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name); std::set mapsUsed; @@ -121,8 +120,7 @@ void MapManager::LoadTransports() while (result->NextRow()); } - sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void MapManager::LoadTransportNPCs() @@ -134,8 +132,7 @@ void MapManager::LoadTransportNPCs() if (!result) { - sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!"); return; } @@ -166,8 +163,7 @@ void MapManager::LoadTransportNPCs() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0), diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index afbae063e5e..bead65bbfdd 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -260,11 +260,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Saves Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Saves Data..."); { uint32 oldMSTime = getMSTime(); @@ -273,7 +273,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); } else @@ -306,12 +306,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Prerequisite Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Prerequisite Data..."); { uint32 oldMSTime = getMSTime(); @@ -319,7 +319,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite"); if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); } else @@ -357,12 +357,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Creature Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Creature Data..."); { uint32 oldMSTime = getMSTime(); @@ -372,7 +372,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); } else @@ -400,12 +400,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Data..."); { uint32 oldMSTime = getMSTime(); @@ -415,7 +415,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); } else @@ -443,12 +443,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Model/Equipment Change Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Model/Equipment Change Data..."); { uint32 oldMSTime = getMSTime(); @@ -458,8 +457,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); } else { @@ -500,12 +498,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -514,8 +511,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); } else { @@ -541,12 +537,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -555,8 +550,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); } else { @@ -582,12 +576,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Condition Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -596,8 +589,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); } else { @@ -625,12 +617,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -639,8 +630,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); } else { @@ -667,12 +657,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Save Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Save Data..."); { uint32 oldMSTime = getMSTime(); @@ -681,8 +670,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); } else { @@ -715,12 +703,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event NPCflag Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event NPCflag Data..."); { uint32 oldMSTime = getMSTime(); @@ -729,8 +716,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); } else { @@ -755,12 +741,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Seasonal Quest Relations..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Seasonal Quest Relations..."); { uint32 oldMSTime = getMSTime(); @@ -769,8 +754,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); } else { @@ -799,12 +783,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Vendor Additions Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Vendor Additions Data..."); { uint32 oldMSTime = getMSTime(); @@ -813,8 +796,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); } else { @@ -865,12 +847,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Battleground Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Battleground Data..."); { uint32 oldMSTime = getMSTime(); @@ -879,8 +860,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty."); } else { @@ -903,12 +883,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Pool Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Pool Data..."); { uint32 oldMSTime = getMSTime(); @@ -918,8 +897,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); } else { @@ -952,8 +930,7 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index efe944d541b..08a76008fde 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -297,7 +297,6 @@ void ObjectMgr::LoadCreatureLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGossipMenuItemsLocales() @@ -334,7 +333,6 @@ void ObjectMgr::LoadGossipMenuItemsLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPointOfInterestLocales() @@ -361,7 +359,6 @@ void ObjectMgr::LoadPointOfInterestLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadCreatureTemplates() @@ -389,7 +386,6 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); - return; } @@ -492,7 +488,6 @@ void ObjectMgr::LoadCreatureTemplates() CheckCreatureTemplate(&itr->second); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadCreatureTemplateAddons() @@ -505,7 +500,6 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); - return; } @@ -564,7 +558,6 @@ void ObjectMgr::LoadCreatureTemplateAddons() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) @@ -882,7 +875,6 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); - return; } @@ -948,7 +940,6 @@ void ObjectMgr::LoadCreatureAddons() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) @@ -987,7 +978,6 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); - return; } @@ -1040,7 +1030,6 @@ void ObjectMgr::LoadEquipmentTemplates() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) @@ -1118,7 +1107,6 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); - return; } @@ -1163,7 +1151,6 @@ void ObjectMgr::LoadCreatureModelInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadLinkedRespawn() @@ -1349,7 +1336,6 @@ void ObjectMgr::LoadLinkedRespawn() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); - } bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) @@ -1536,7 +1522,6 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) @@ -1841,7 +1826,6 @@ void ObjectMgr::LoadGameobjects() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) @@ -2010,7 +1994,6 @@ void ObjectMgr::LoadItemLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadItemTemplates() @@ -2053,7 +2036,6 @@ void ObjectMgr::LoadItemTemplates() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty."); - return; } @@ -2615,7 +2597,6 @@ void ObjectMgr::LoadItemTemplates() sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) @@ -2651,7 +2632,6 @@ void ObjectMgr::LoadItemSetNameLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadItemSetNames() @@ -2680,7 +2660,6 @@ void ObjectMgr::LoadItemSetNames() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); - return; } @@ -2735,7 +2714,6 @@ void ObjectMgr::LoadItemSetNames() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadVehicleTemplateAccessories() @@ -2792,7 +2770,6 @@ void ObjectMgr::LoadVehicleTemplateAccessories() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadVehicleAccessories() @@ -2809,7 +2786,6 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); - return; } @@ -2837,7 +2813,6 @@ void ObjectMgr::LoadVehicleAccessories() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPetLevelInfo() @@ -2930,7 +2905,6 @@ void ObjectMgr::LoadPetLevelInfo() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const @@ -3072,12 +3046,11 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } // Load playercreate items - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Items Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Items Data..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 @@ -3086,7 +3059,6 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); - } else { @@ -3144,12 +3116,11 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } // Load playercreate spells - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Spell Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Spell Data..."); { uint32 oldMSTime = getMSTime(); @@ -3201,12 +3172,11 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } // Load playercreate actions - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Action Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Action Data..."); { uint32 oldMSTime = getMSTime(); @@ -3248,12 +3218,11 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } // Loading levels data (class only dependent) - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level HP/Mana Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level HP/Mana Data..."); { uint32 oldMSTime = getMSTime(); @@ -3330,11 +3299,10 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } // Loading levels data (class/race dependent) - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level Stats Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level Stats Data..."); { uint32 oldMSTime = getMSTime(); @@ -3444,11 +3412,10 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } // Loading xp per level data - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create XP Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create XP Data..."); { uint32 oldMSTime = getMSTime(); @@ -3503,7 +3470,6 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } @@ -4290,7 +4256,6 @@ void ObjectMgr::LoadQuests() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadQuestLocales() @@ -4339,7 +4304,6 @@ void ObjectMgr::LoadQuestLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadScripts(ScriptsType type) @@ -4357,7 +4321,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use. return; - sLog->outInfo(LOG_FILTER_GENERAL, "Loading %s...", tableName.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading %s...", tableName.c_str()); scripts->clear(); // need for reload support @@ -4368,7 +4332,6 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); - return; } @@ -4660,7 +4623,6 @@ void ObjectMgr::LoadScripts(ScriptsType type) while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGameObjectScripts() @@ -4805,7 +4767,6 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); - return; } @@ -4853,7 +4814,6 @@ void ObjectMgr::LoadSpellScriptNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::ValidateSpellScripts() @@ -4863,7 +4823,6 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts."); - return; } @@ -4911,7 +4870,6 @@ void ObjectMgr::ValidateSpellScripts() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPageTexts() @@ -4924,7 +4882,6 @@ void ObjectMgr::LoadPageTexts() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!"); - return; } @@ -4954,7 +4911,6 @@ void ObjectMgr::LoadPageTexts() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } PageText const* ObjectMgr::GetPageText(uint32 pageEntry) @@ -4990,7 +4946,6 @@ void ObjectMgr::LoadPageTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadInstanceTemplate() @@ -5003,7 +4958,6 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); - return; } @@ -5033,7 +4987,6 @@ void ObjectMgr::LoadInstanceTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) @@ -5123,7 +5076,6 @@ void ObjectMgr::LoadInstanceEncounters() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const @@ -5144,7 +5096,6 @@ void ObjectMgr::LoadGossipText() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count); - return; } _gossipTextStore.rehash(result->GetRowCount()); @@ -5184,7 +5135,6 @@ void ObjectMgr::LoadGossipText() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadNpcTextLocales() @@ -5227,7 +5177,6 @@ void ObjectMgr::LoadNpcTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } //not very fast function but it is called only once a day, or on starting-up @@ -5253,7 +5202,6 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired mails found."); - return; // any mails need to be returned or deleted } @@ -5357,7 +5305,6 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadQuestAreaTriggers() @@ -5371,7 +5318,6 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); - return; } @@ -5416,7 +5362,6 @@ void ObjectMgr::LoadQuestAreaTriggers() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadTavernAreaTriggers() @@ -5430,7 +5375,6 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); - return; } @@ -5455,7 +5399,6 @@ void ObjectMgr::LoadTavernAreaTriggers() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadAreaTriggerScripts() @@ -5468,7 +5411,6 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); - return; } @@ -5493,7 +5435,6 @@ void ObjectMgr::LoadAreaTriggerScripts() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team) @@ -5612,7 +5553,6 @@ void ObjectMgr::LoadGraveyardZones() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); - return; } @@ -5659,7 +5599,6 @@ void ObjectMgr::LoadGraveyardZones() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team) @@ -5905,7 +5844,6 @@ void ObjectMgr::LoadAreaTriggerTeleports() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); - return; } @@ -5952,7 +5890,6 @@ void ObjectMgr::LoadAreaTriggerTeleports() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadAccessRequirements() @@ -5966,7 +5903,6 @@ void ObjectMgr::LoadAccessRequirements() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); - return; } @@ -6044,7 +5980,6 @@ void ObjectMgr::LoadAccessRequirements() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } /* @@ -6269,7 +6204,6 @@ void ObjectMgr::LoadGameObjectLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6346,7 +6280,6 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); - return; } @@ -6516,7 +6449,6 @@ void ObjectMgr::LoadGameObjectTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadExplorationBaseXP() @@ -6545,7 +6477,6 @@ void ObjectMgr::LoadExplorationBaseXP() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } uint32 ObjectMgr::GetBaseXP(uint8 level) @@ -6569,7 +6500,6 @@ void ObjectMgr::LoadPetNames() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); - return; } @@ -6590,7 +6520,6 @@ void ObjectMgr::LoadPetNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPetNumber() @@ -6605,7 +6534,6 @@ void ObjectMgr::LoadPetNumber() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); - } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -6639,7 +6567,6 @@ void ObjectMgr::LoadCorpses() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty."); - return; } @@ -6668,7 +6595,6 @@ void ObjectMgr::LoadCorpses() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadReputationRewardRate() @@ -6731,7 +6657,6 @@ void ObjectMgr::LoadReputationRewardRate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadReputationOnKill() @@ -6805,7 +6730,6 @@ void ObjectMgr::LoadReputationOnKill() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadReputationSpilloverTemplate() @@ -6820,7 +6744,6 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty."); - return; } @@ -6917,7 +6840,6 @@ void ObjectMgr::LoadReputationSpilloverTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPointsOfInterest() @@ -6964,7 +6886,6 @@ void ObjectMgr::LoadPointsOfInterest() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadQuestPOI() @@ -7036,7 +6957,6 @@ void ObjectMgr::LoadQuestPOI() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadNPCSpellClickSpells() @@ -7104,7 +7024,6 @@ void ObjectMgr::LoadNPCSpellClickSpells() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -7183,7 +7102,6 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGameobjectQuestRelations() @@ -7253,7 +7171,6 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); - return; } @@ -7280,7 +7197,6 @@ void ObjectMgr::LoadReservedPlayersNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } bool ObjectMgr::IsReservedName(const std::string& name) const @@ -7434,7 +7350,6 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests"); - return; } @@ -7483,7 +7398,6 @@ void ObjectMgr::LoadGameObjectForQuests() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value) @@ -7575,7 +7489,6 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max else sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); - return true; } @@ -7632,7 +7545,6 @@ void ObjectMgr::LoadFishingBaseSkillLevel() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names) @@ -7758,7 +7670,6 @@ void ObjectMgr::LoadGameTele() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -7903,7 +7814,6 @@ void ObjectMgr::LoadMailLevelRewards() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel) @@ -8024,7 +7934,6 @@ void ObjectMgr::LoadTrainerSpell() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set *skip_vendors) @@ -8115,7 +8024,6 @@ void ObjectMgr::LoadVendors() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGossipMenu() @@ -8157,7 +8065,6 @@ void ObjectMgr::LoadGossipMenu() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGossipMenuItems() @@ -8221,7 +8128,6 @@ void ObjectMgr::LoadGossipMenuItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/) @@ -8400,7 +8306,6 @@ void ObjectMgr::LoadScriptNames() std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } uint32 ObjectMgr::GetScriptId(const char *name) @@ -8504,7 +8409,6 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); - return; } @@ -8553,7 +8457,6 @@ void ObjectMgr::LoadCreatureClassLevelStats() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadFactionChangeAchievements() @@ -8590,7 +8493,6 @@ void ObjectMgr::LoadFactionChangeAchievements() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadFactionChangeItems() @@ -8602,7 +8504,6 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); - return; } @@ -8627,7 +8528,6 @@ void ObjectMgr::LoadFactionChangeItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadFactionChangeSpells() @@ -8664,7 +8564,6 @@ void ObjectMgr::LoadFactionChangeSpells() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadFactionChangeReputations() @@ -8676,7 +8575,6 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); - return; } @@ -8701,7 +8599,6 @@ void ObjectMgr::LoadFactionChangeReputations() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 59bb2fb536f..da0d37cf27a 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -787,13 +787,13 @@ class ObjectMgr void LoadQuests(); void LoadQuestRelations() { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO Start Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO Start Quest Data..."); LoadGameobjectQuestRelations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO End Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO End Quest Data..."); LoadGameobjectInvolvedRelations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Start Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Start Quest Data..."); LoadCreatureQuestRelations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature End Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature End Quest Data..."); LoadCreatureInvolvedRelations(); } void LoadGameobjectQuestRelations(); diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 7cb8a8ff7b1..77b3a304f6b 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -126,7 +126,6 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!"); - return; } @@ -152,10 +151,9 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group members..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group members..."); { uint32 oldMSTime = getMSTime(); @@ -170,7 +168,6 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!"); - return; } @@ -191,10 +188,9 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group instance saves..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group instance saves..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 4 5 6 @@ -204,7 +200,6 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); - return; } @@ -236,6 +231,5 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index dab67c59d2a..cebcf6040f9 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -93,7 +93,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const void GuildMgr::LoadGuilds() { // 1. Load all guilds - sLog->outInfo(LOG_FILTER_GUILD, "Loading guilds definitions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guilds definitions..."); { uint32 oldMSTime = getMSTime(); @@ -105,8 +105,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild definitions. DB table `guild` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild definitions. DB table `guild` is empty."); return; } else @@ -128,13 +127,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 2. Load all guild ranks - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild ranks..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild ranks..."); { uint32 oldMSTime = getMSTime(); @@ -146,8 +144,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); } else { @@ -164,13 +161,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 3. Load all guild members - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild members..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild members..."); { uint32 oldMSTime = getMSTime(); @@ -189,8 +185,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild members. DB table `guild_member` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild members. DB table `guild_member` is empty."); } else { @@ -208,13 +203,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 4. Load all guild bank tab rights - sLog->outInfo(LOG_FILTER_GUILD, "Loading bank tab rights..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading bank tab rights..."); { uint32 oldMSTime = getMSTime(); @@ -226,8 +220,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); } else { @@ -244,13 +237,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 5. Load all event logs - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild event logs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild event logs..."); { uint32 oldMSTime = getMSTime(); @@ -261,8 +253,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); } else { @@ -279,13 +270,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 6. Load all bank event logs - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank event logs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank event logs..."); { uint32 oldMSTime = getMSTime(); @@ -297,8 +287,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); } else { @@ -315,13 +304,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 7. Load all guild bank tabs - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank tabs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank tabs..."); { uint32 oldMSTime = getMSTime(); @@ -333,8 +321,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); } else { @@ -351,8 +338,7 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -371,8 +357,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); } else { @@ -389,8 +374,7 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -412,7 +396,6 @@ void GuildMgr::LoadGuilds() } } - sLog->outInfo(LOG_FILTER_GUILD, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); } } diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 6f49a555950..72636a5d2aa 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1450,7 +1450,7 @@ bool LootTemplate::isReference(uint32 id) void LoadLootTemplates_Creature() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading creature loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading creature loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1477,16 +1477,14 @@ void LoadLootTemplates_Creature() LootTemplates_Creature.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); - - } void LoadLootTemplates_Disenchant() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading disenchanting loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading disenchanting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1512,15 +1510,14 @@ void LoadLootTemplates_Disenchant() LootTemplates_Disenchant.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); - } void LoadLootTemplates_Fishing() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading fishing loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading fishing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1537,16 +1534,14 @@ void LoadLootTemplates_Fishing() LootTemplates_Fishing.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); - - } void LoadLootTemplates_Gameobject() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading gameobject loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading gameobject loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1573,16 +1568,14 @@ void LoadLootTemplates_Gameobject() LootTemplates_Gameobject.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); - - } void LoadLootTemplates_Item() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading item loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading item loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1599,16 +1592,14 @@ void LoadLootTemplates_Item() LootTemplates_Item.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); - - } void LoadLootTemplates_Milling() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading milling loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading milling loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1630,16 +1621,14 @@ void LoadLootTemplates_Milling() LootTemplates_Milling.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); - - } void LoadLootTemplates_Pickpocketing() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading pickpocketing loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pickpocketing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1666,16 +1655,14 @@ void LoadLootTemplates_Pickpocketing() LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); - - } void LoadLootTemplates_Prospecting() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading prospecting loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading prospecting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1697,16 +1684,14 @@ void LoadLootTemplates_Prospecting() LootTemplates_Prospecting.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); - - } void LoadLootTemplates_Mail() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading mail loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading mail loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1723,16 +1708,14 @@ void LoadLootTemplates_Mail() LootTemplates_Mail.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); - - } void LoadLootTemplates_Skinning() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading skinning loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading skinning loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1759,16 +1742,14 @@ void LoadLootTemplates_Skinning() LootTemplates_Skinning.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); - - } void LoadLootTemplates_Spell() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading spell loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1803,15 +1784,14 @@ void LoadLootTemplates_Spell() LootTemplates_Spell.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); - } void LoadLootTemplates_Reference() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading reference loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading reference loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1834,6 +1814,5 @@ void LoadLootTemplates_Reference() // output error for any still listed ids (not referenced from any loot table) LootTemplates_Reference.ReportUnusedIds(lootIdSet); - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 5ada88cdf7a..ce987e25eed 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -46,8 +46,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); return; } @@ -106,8 +105,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() m_OutdoorPvPSet.push_back(pvp); } - sLog->outInfo(LOG_FILTER_OUTDOORPVP, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle) diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 6ee70101af7..79e8d47aa94 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -571,7 +571,7 @@ void PoolMgr::LoadFromDB() if (!result) { mPoolTemplate.clear(); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 object pools. DB table `pool_template` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty."); return; } @@ -589,12 +589,12 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Creatures - sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Creatures Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -603,7 +603,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); } else { @@ -644,13 +644,13 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Gameobjects - sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Gameobject Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -659,7 +659,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); } else { @@ -712,13 +712,13 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Pool of pools - sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Mother Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Mother Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -727,7 +727,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 pools in pools"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools in pools"); } else { @@ -796,11 +796,11 @@ void PoolMgr::LoadFromDB() } } - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Quest Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -809,7 +809,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 quests in pools"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests in pools"); } else { @@ -884,12 +884,12 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks - sLog->outInfo(LOG_FILTER_POOLSYS, "Starting objects pooling system..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting objects pooling system..."); { uint32 oldMSTime = getMSTime(); @@ -899,7 +899,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Pool handling system initialized, 0 pools spawned."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Pool handling system initialized, 0 pools spawned."); } else { diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index f5adf67a9ab..98675f118e1 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -251,13 +251,12 @@ void ScriptMgr::Initialize() LoadDatabase(); - sLog->outInfo(LOG_FILTER_TSCR, "Loading C++ scripts"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading C++ scripts"); FillSpellSummary(); AddScripts(); - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); } void ScriptMgr::Unload() diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 3c2ee81afff..270182509f9 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -164,7 +164,7 @@ class ScriptObject protected: ScriptObject(const char* name) - : _name(std::string(name)) + : _name(name) { } diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index f24b01306c5..41b41b91808 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -25,10 +25,10 @@ ScriptPointVector const SystemMgr::_empty; void SystemMgr::LoadScriptTexts() { - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts..."); LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2)); - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts additional data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts additional data..."); uint32 oldMSTime = getMSTime(); // 0 1 2 3 @@ -36,8 +36,7 @@ void SystemMgr::LoadScriptTexts() if (!result) { - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); return; } @@ -83,23 +82,21 @@ void SystemMgr::LoadScriptTexts() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); } void SystemMgr::LoadScriptTextsCustom() { - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts..."); LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3)); - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts additional data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts additional data..."); QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts"); if (!result) { - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); return; } @@ -145,8 +142,7 @@ void SystemMgr::LoadScriptTextsCustom() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Custom Texts data.", uiCount); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Custom Texts data.", uiCount); } void SystemMgr::LoadScriptWaypoints() @@ -163,15 +159,14 @@ void SystemMgr::LoadScriptWaypoints() if (result) uiCreatureCount = result->GetRowCount(); - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); // 0 1 2 3 4 5 result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); if (!result) { - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); return; } @@ -206,6 +201,5 @@ void SystemMgr::LoadScriptWaypoints() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index e2b7df2889d..c26e78f3418 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1155,7 +1155,7 @@ void SpellMgr::LoadSpellRanks() if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); return; } @@ -1251,7 +1251,7 @@ void SpellMgr::LoadSpellRanks() while (true); } while (!finished); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1267,7 +1267,7 @@ void SpellMgr::LoadSpellRequired() if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell required records. DB table `spell_required` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell required records. DB table `spell_required` is empty."); return; } @@ -1312,7 +1312,7 @@ void SpellMgr::LoadSpellRequired() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1350,8 +1350,7 @@ void SpellMgr::LoadSpellLearnSkills() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellLearnSpells() @@ -1364,8 +1363,7 @@ void SpellMgr::LoadSpellLearnSpells() QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); return; } @@ -1453,8 +1451,7 @@ void SpellMgr::LoadSpellLearnSpells() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellTargetPositions() @@ -1467,8 +1464,7 @@ void SpellMgr::LoadSpellTargetPositions() QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); return; } @@ -1573,8 +1569,7 @@ void SpellMgr::LoadSpellTargetPositions() } }*/ - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellGroups() @@ -1588,8 +1583,7 @@ void SpellMgr::LoadSpellGroups() QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); return; } @@ -1655,8 +1649,7 @@ void SpellMgr::LoadSpellGroups() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellGroupStackRules() @@ -1669,8 +1662,7 @@ void SpellMgr::LoadSpellGroupStackRules() QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); return; } @@ -1700,8 +1692,7 @@ void SpellMgr::LoadSpellGroupStackRules() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellProcEvents() @@ -1714,8 +1705,7 @@ void SpellMgr::LoadSpellProcEvents() QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); return; } @@ -1762,9 +1752,9 @@ void SpellMgr::LoadSpellProcEvents() } while (result->NextRow()); if (customProc) - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1778,8 +1768,7 @@ void SpellMgr::LoadSpellProcs() QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); return; } @@ -1905,8 +1894,7 @@ void SpellMgr::LoadSpellProcs() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellBonusess() @@ -1919,8 +1907,7 @@ void SpellMgr::LoadSpellBonusess() QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); return; } @@ -1946,8 +1933,7 @@ void SpellMgr::LoadSpellBonusess() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellThreats() @@ -1960,8 +1946,7 @@ void SpellMgr::LoadSpellThreats() QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); return; } @@ -1987,8 +1972,7 @@ void SpellMgr::LoadSpellThreats() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSkillLineAbilityMap() @@ -2009,8 +1993,7 @@ void SpellMgr::LoadSkillLineAbilityMap() ++count; } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellPetAuras() @@ -2023,8 +2006,7 @@ void SpellMgr::LoadSpellPetAuras() QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); return; } @@ -2071,8 +2053,7 @@ void SpellMgr::LoadSpellPetAuras() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Fill custom data about enchancments @@ -2112,8 +2093,7 @@ void SpellMgr::LoadEnchantCustomAttr() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellEnchantProcData() @@ -2126,8 +2106,7 @@ void SpellMgr::LoadSpellEnchantProcData() QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); return; } @@ -2156,8 +2135,7 @@ void SpellMgr::LoadSpellEnchantProcData() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellLinked() @@ -2170,8 +2148,7 @@ void SpellMgr::LoadSpellLinked() QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); return; } @@ -2209,8 +2186,7 @@ void SpellMgr::LoadSpellLinked() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadPetLevelupSpellMap() @@ -2266,8 +2242,7 @@ void SpellMgr::LoadPetLevelupSpellMap() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); } bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells) @@ -2351,10 +2326,9 @@ void SpellMgr::LoadPetDefaultSpells() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Loading summonable creature templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading summonable creature templates..."); oldMSTime = getMSTime(); // different summon spells @@ -2395,8 +2369,7 @@ void SpellMgr::LoadPetDefaultSpells() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellAreas() @@ -2414,7 +2387,7 @@ void SpellMgr::LoadSpellAreas() if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); return; } @@ -2595,8 +2568,7 @@ void SpellMgr::LoadSpellAreas() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellInfoStore() @@ -2612,8 +2584,7 @@ void SpellMgr::LoadSpellInfoStore() mSpellInfoMap[i] = new SpellInfo(spellEntry); } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::UnloadSpellInfoStore() @@ -2925,8 +2896,7 @@ void SpellMgr::LoadSpellCustomAttr() CreatureAI::FillAISpellInfo(); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadDbcDataCorrections() @@ -3565,6 +3535,5 @@ void SpellMgr::LoadDbcDataCorrections() properties = const_cast(sSummonPropertiesStore.LookupEntry(647)); // 52893 properties->Type = SUMMON_TYPE_TOTEM; - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 8e740ba83b8..3a24190d8fa 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -114,9 +114,6 @@ void Log::CreateAppenderFromConfig(const char* name) { case APPENDER_CONSOLE: { - if (flags == APPENDER_FLAGS_NONE) - flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE); - AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; if (++iter != tokens.end()) @@ -135,9 +132,6 @@ void Log::CreateAppenderFromConfig(const char* name) return; } - if (flags == APPENDER_FLAGS_NONE) - flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE | APPENDER_FLAGS_PREFIX_TIMESTAMP); - filename = *iter; if (++iter != tokens.end()) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index ce084e2fb96..bdeb60129ec 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2620,14 +2620,14 @@ PlayerDump.DisallowOverwrite = 1 # Example: "13 11 9 5 3 1" # # File: Name of the file (read as optional1 if Type = File) -# Allows to use one "%u" to create dynamic files +# Allows to use one "%s" to create dynamic files # # Mode: Mode to open the file (read as optional2 if Type = File) # a - (Append) # w - (Overwrite) # -Appender.Console=1,5,0 +Appender.Console=1,3,0 Appender.Server=2,2,0,Server.log,w Appender.GM=2,2,0,GM.log Appender.DBErrors=2,2,0,DBErrors.log @@ -2712,12 +2712,13 @@ Appenders=Console Server GM DBErrors Char RA Warden Chat # (Using spaces as separator). # -Logger.Root=0,3,Console Server +Logger.Root=0,5,Console Server Logger.Chat=22,3,Chat Logger.DBErrors=26,5,Console Server DBErrors Logger.GM=27,3,Console Server GM Logger.RA=28,3,RA Logger.Warden=29,3,Warden +Logger.WorldServer=31,3,Console Server Logger.Character=34,3,Char Logger.Arenas=35,3,Arenas Logger.SQLDriver=36,5,SQLDriver @@ -2731,5 +2732,5 @@ Logger.Load=40,3,Console Server # (Using spaces as separator). # Default: "Root Chat DBErrors GM RA Warden Character Load" -Loggers=Root Chat DBErrors GM RA Warden Character Load +Loggers=Root Chat DBErrors GM RA Warden Character Load WorldServer -- cgit v1.2.3 From 77b7933ed364ff92287f275685f13a8195fe650c Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 17 Aug 2012 10:31:09 +0200 Subject: Core/Logging: Restore proper Log Filter to some arena messages --- src/server/game/Battlegrounds/Battleground.cpp | 8 ++++---- src/server/worldserver/worldserver.conf.dist | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index cfb4aec8525..cf767a2986e 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -771,17 +771,17 @@ void Battleground::EndBattleground(uint32 winner) winner_matchmaker_rating = GetArenaMatchmakerRating(winner); winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change); loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, + sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change); SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change); SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change); SetArenaTeamRatingChangeForTeam(winner, winner_change); SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); 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_BATTLEGROUND, "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(), 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 @@ -1103,7 +1103,7 @@ void Battleground::StartBattleground() // and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this); if (m_IsRated) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); } void Battleground::AddPlayer(Player* player) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index bdeb60129ec..5bdf805fb4f 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2260,6 +2260,15 @@ Arena.ArenaStartPersonalRating = 0 Arena.ArenaStartMatchmakerRating = 1500 +# +# ArenaLog.ExtendedInfo +# Description: Include extended info to ArenaLogFile for each player after rated arena +# matches (guid, name, team, IP, healing/damage done, killing blows). +# Default: 0 - (Disabled) +# 1 - (Enabled) + +ArenaLog.ExtendedInfo = 0 + # ################################################################################################### -- cgit v1.2.3 From 13aa00d5f21610d4849767b1105709767a2ba408 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 17 Aug 2012 10:36:48 +0200 Subject: Core/Logging: Restore dumping packets in binary format --- src/server/game/Server/Protocol/PacketLog.cpp | 62 +++++++++++++++++++++++++++ src/server/game/Server/Protocol/PacketLog.h | 50 +++++++++++++++++++++ src/server/game/Server/WorldSocket.cpp | 54 +++-------------------- src/server/worldserver/worldserver.conf.dist | 9 ++++ 4 files changed, 127 insertions(+), 48 deletions(-) create mode 100644 src/server/game/Server/Protocol/PacketLog.cpp create mode 100644 src/server/game/Server/Protocol/PacketLog.h (limited to 'src') diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp new file mode 100644 index 00000000000..cb6dcdbdb9e --- /dev/null +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +#include "PacketLog.h" +#include "Config.h" +#include "ByteBuffer.h" +#include "WorldPacket.h" + +PacketLog::PacketLog() : _file(NULL) +{ + Initialize(); +} + +PacketLog::~PacketLog() +{ + if (_file) + fclose(_file); + + _file = NULL; +} + +void PacketLog::Initialize() +{ + std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + + if (!logsDir.empty()) + if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\')) + logsDir.push_back('/'); + + std::string logname = ConfigMgr::GetStringDefault("PacketLogFile", ""); + if (!logname.empty()) + _file = fopen((logsDir + logname).c_str(), "wb"); +} + +void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) +{ + ByteBuffer data(4+4+4+1+packet.size()); + data << int32(packet.GetOpcode()); + data << int32(packet.size()); + data << uint32(time(NULL)); + data << uint8(direction); + + for (uint32 i = 0; i < packet.size(); i++) + data << const_cast(packet)[i]; + + fwrite(data.contents(), 1, data.size(), _file); + fflush(_file); +} diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h new file mode 100644 index 00000000000..b899daae198 --- /dev/null +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * 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 . + */ + +#ifndef TRINITY_PACKETLOG_H +#define TRINITY_PACKETLOG_H + +#include "Common.h" +#include + +enum Direction +{ + CLIENT_TO_SERVER, + SERVER_TO_CLIENT +}; + +class WorldPacket; + +class PacketLog +{ + friend class ACE_Singleton; + + private: + PacketLog(); + ~PacketLog(); + + public: + void Initialize(); + bool CanLogPacket() const { return (_file != NULL); } + void LogPacket(WorldPacket const& packet, Direction direction); + + private: + FILE* _file; +}; + +#define sPacketLog ACE_Singleton::instance() +#endif diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 5b04c3dc714..ed960fd9693 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -42,6 +42,7 @@ #include "WorldSession.h" #include "WorldSocketMgr.h" #include "Log.h" +#include "PacketLog.h" #include "ScriptMgr.h" #include "AccountMgr.h" @@ -159,30 +160,8 @@ int WorldSocket::SendPacket(WorldPacket const& pct) return -1; // Dump outgoing packet. - if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) - { - char buff[250]; - snprintf(buff, 250, "SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - uint32(get_handle()), - uint32(pct.size()), - LookupOpcodeName (pct.GetOpcode()), - pct.GetOpcode()); - - std::string data(buff); - uint32 p = 0; - while (p < pct.size()) - { - for (uint32 j = 0; j < 16 && p < pct.size(); j++) - { - snprintf(buff, 250, "%.2X ", const_cast(pct)[p++]); - data.append(buff); - } - data.append("\n"); - } - - data.append("\n"); - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str()); - } + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(pct, SERVER_TO_CLIENT); // Create a copy of the original packet; this is to avoid issues if a hook modifies it. sScriptMgr->OnPacketSend(this, WorldPacket(pct)); @@ -691,30 +670,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) if (closing_) return -1; - if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) - { - char buff[250]; - snprintf(buff, 250, "CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - uint32(get_handle()), - uint32(new_pct->size()), - LookupOpcodeName (new_pct->GetOpcode()), - new_pct->GetOpcode()); - - std::string data(buff); - uint32 p = 0; - while (p < new_pct->size()) - { - for (uint32 j = 0; j < 16 && p < new_pct->size(); j++) - { - snprintf(buff, 250, "%.2X ", const_cast(*new_pct)[p++]); - data.append(buff); - } - data.append("\n"); - } - - data.append("\n"); - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str()); - } + // Dump received packet. + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER); try { diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 5bdf805fb4f..133fdff3dd0 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -403,6 +403,15 @@ PersistentCharacterCleanFlags = 0 PidFile = "" +# +# PacketLogFile +# Description: Binary packet logging file for the world server. +# Filename extension must be .bin to be parsable with WowPacketParser. +# Example: "World.bin" - (Enabled) +# Default: "" - (Disabled) + +PacketLogFile = "" + # # ChatLogs.Channel # Description: Log custom channel chat. -- cgit v1.2.3 From 48e50b8254a2cc45ed561e4ff96180783787d93a Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 19 Aug 2012 11:07:21 -0500 Subject: Misc/Codestyle: Made some changes to function names --- src/server/game/Entities/GameObject/GameObject.cpp | 16 ++++++++-------- src/server/game/Maps/Map.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 20e5055dc15..bebed9ce0bd 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -137,7 +137,7 @@ void GameObject::AddToWorld() // The state can be changed after GameObject::Create but before GameObject::AddToWorld bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false; if (m_model) - GetMap()->Insert(*m_model); + GetMap()->InsertGameObjectModel(*m_model); EnableCollision(startOpen ^ toggledState); WorldObject::AddToWorld(); @@ -154,8 +154,8 @@ void GameObject::RemoveFromWorld() RemoveFromOwner(); if (m_model) - if (GetMap()->Contains(*m_model)) - GetMap()->Remove(*m_model); + if (GetMap()->ContainsGameObjectModel(*m_model)) + GetMap()->RemoveGameObjectModel(*m_model); WorldObject::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } @@ -1971,8 +1971,8 @@ void GameObject::EnableCollision(bool enable) if (!m_model) return; - /*if (enable && !GetMap()->Contains(*m_model)) - GetMap()->Insert(*m_model);*/ + /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model)) + GetMap()->InsertGameObjectModel(*m_model);*/ m_model->enable(enable ? GetPhaseMask() : 0); } @@ -1982,12 +1982,12 @@ void GameObject::UpdateModel() if (!IsInWorld()) return; if (m_model) - if (GetMap()->Contains(*m_model)) - GetMap()->Remove(*m_model); + if (GetMap()->ContainsGameObjectModel(*m_model)) + GetMap()->RemoveGameObjectModel(*m_model); delete m_model; m_model = GameObjectModel::Create(*this); if (m_model) - GetMap()->Insert(*m_model); + GetMap()->InsertGameObjectModel(*m_model); } Player* GameObject::GetLootRecipient() const diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 6d526f23a94..0743c4e545f 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -439,9 +439,9 @@ class Map : public GridRefManager float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; void Balance() { _dynamicTree.balance(); } - void Remove(const GameObjectModel& mdl) { _dynamicTree.remove(mdl); } - void Insert(const GameObjectModel& mdl) { _dynamicTree.insert(mdl); } - bool Contains(const GameObjectModel& mdl) const { return _dynamicTree.contains(mdl);} + void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); } + void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); } + bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);} bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist); /* -- cgit v1.2.3 From 28c0874873a3b6ec32a644d0c458520c2e5e7633 Mon Sep 17 00:00:00 2001 From: Faq Date: Mon, 20 Aug 2012 10:59:07 +0200 Subject: Core/Spells: Fixed Libram of Wracking. thnx Vincent-Michael Closes #7094 --- .../2012_08_20_00_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_paladin.cpp | 36 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 sql/updates/world/2012_08_20_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_20_00_world_spell_script_names.sql b/sql/updates/world/2012_08_20_00_world_spell_script_names.sql new file mode 100644 index 00000000000..d0aa185ea3a --- /dev/null +++ b/sql/updates/world/2012_08_20_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE (`spell_id`='33695'); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(33695, 'spell_pal_exorcism_and_holy_wrath_damage'); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 7d248b35853..0bf2e5664a0 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -531,6 +531,41 @@ class spell_pal_righteous_defense : public SpellScriptLoader } }; +class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader +{ + public: + spell_pal_exorcism_and_holy_wrath_damage() : SpellScriptLoader("spell_pal_exorcism_and_holy_wrath_damage") { } + + class spell_pal_exorcism_and_holy_wrath_damage_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage_AuraScript); + + void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod) + { + if (!spellMod) + { + spellMod = new SpellModifier(aurEff->GetBase()); + spellMod->op = SPELLMOD_DAMAGE; + spellMod->type = SPELLMOD_FLAT; + spellMod->spellId = GetId(); + spellMod->mask[1] = 0x200002; + } + + spellMod->value = aurEff->GetAmount(); + } + + void Register() + { + DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_pal_exorcism_and_holy_wrath_damage_AuraScript(); + } +}; + void AddSC_paladin_spell_scripts() { new spell_pal_ardent_defender(); @@ -543,4 +578,5 @@ void AddSC_paladin_spell_scripts() new spell_pal_divine_storm_dummy(); new spell_pal_lay_on_hands(); new spell_pal_righteous_defense(); + new spell_pal_exorcism_and_holy_wrath_damage(); } -- cgit v1.2.3 From fb1ac16b0ce27567dc4bb435ee4fa0b0b228e4ad Mon Sep 17 00:00:00 2001 From: Chaplain Date: Mon, 20 Aug 2012 11:05:50 +0200 Subject: Core/Misc: Some fixes here and there Closes #7277 --- src/server/collision/Maps/TileAssembler.cpp | 8 +++++++- src/server/game/DungeonFinding/LFGMgr.cpp | 4 ++-- src/tools/vmap4_extractor/vmapexport.cpp | 22 +++++++++++----------- 3 files changed, 20 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 3bfed7d322d..207b652a4d6 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -336,9 +336,15 @@ namespace VMAP void TileAssembler::exportGameobjectModels() { FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb"); + if (!model_list) + return; + FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb"); - if (!model_list || !model_list_copy) + if (!model_list_copy) + { + fclose(model_list); return; + } uint32 name_length, displayId; char buff[500]; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index a7dd677313e..bb6c1dfdcc1 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1239,11 +1239,11 @@ LfgAnswer LFGMgr::GetCompatibles(std::string key) void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap) { lockMap.clear(); - for (PlayerSet::const_iterator it = players.begin(); it != players.end() && dungeons.size(); ++it) + for (PlayerSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it) { uint64 guid = (*it)->GetGUID(); LfgLockMap cachedLockMap = GetLockedDungeons(guid); - for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2) + for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2) { uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId); diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index e60a773c6de..126a543400c 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -382,9 +382,9 @@ bool processArgv(int argc, char ** argv, const char *versionString) { bool result = true; hasInputPathParam = false; - bool preciseVectorData = false; + preciseVectorData = false; - for(int i=1; i< argc; ++i) + for(int i = 1; i < argc; ++i) { if(strcmp("-s",argv[i]) == 0) { @@ -447,7 +447,7 @@ int main(int argc, char ** argv) const char *versionString = "V4.00 2012_02"; // Use command line arguments, when some - if(!processArgv(argc, argv, versionString)) + if (!processArgv(argc, argv, versionString)) return 1; // some simple check if working dir is dirty @@ -469,7 +469,7 @@ int main(int argc, char ** argv) printf("Extract %s. Beginning work ....\n",versionString); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory - if(mkdir(szWorkDirWmo + if (mkdir(szWorkDirWmo #ifdef __linux__ , 0711 #endif @@ -482,11 +482,11 @@ int main(int argc, char ** argv) for (size_t i=0; i < archiveNames.size(); ++i) { MPQArchive *archive = new MPQArchive(archiveNames[i].c_str()); - if(!gOpenArchives.size() || gOpenArchives.front() != archive) + if (gOpenArchives.empty() || gOpenArchives.front() != archive) delete archive; } - if(gOpenArchives.empty()) + if (gOpenArchives.empty()) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path); return 1; @@ -494,15 +494,15 @@ int main(int argc, char ** argv) ReadLiquidTypeTableDBC(); // extract data - if(success) + if (success) success = ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc - if(success) + if (success) { DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); - if(!dbc->open()) + if (!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); @@ -510,7 +510,7 @@ int main(int argc, char ** argv) } map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; - for(unsigned int x=0;xgetRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); @@ -527,7 +527,7 @@ int main(int argc, char ** argv) } printf("\n"); - if(!success) + if (!success) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); getchar(); -- cgit v1.2.3 From 936c62ef4cfe85b04f689d08696a29a792815c2a Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 20 Aug 2012 16:49:19 +0200 Subject: Core/Players: Fixed uninitialized trade data --- src/server/game/Entities/Player/Player.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 413d7fae32c..271bf2b22f8 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -981,7 +981,7 @@ class TradeData public: // constructors TradeData(Player* player, Player* trader) : m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false), - m_money(0), m_spell(0) {} + m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); } Player* GetTrader() const { return m_trader; } TradeData* GetTraderData() const; -- cgit v1.2.3 From eb669c31e230eecd5467508261869414d12936c1 Mon Sep 17 00:00:00 2001 From: Imprtat Date: Tue, 28 Jun 2011 13:06:35 +0300 Subject: Core/Battlefield: added enum for worldstates --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 1140 ++++++++++++ src/server/game/Battlefield/Zones/BattlefieldWG.h | 1918 ++++++++++++++++++++ 2 files changed, 3058 insertions(+) create mode 100644 src/server/game/Battlefield/Zones/BattlefieldWG.cpp create mode 100644 src/server/game/Battlefield/Zones/BattlefieldWG.h (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp new file mode 100644 index 00000000000..977048361be --- /dev/null +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -0,0 +1,1140 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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 . + */ + +// TODO: Implement proper support for vehicle+player teleportation +// TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor +// TODO: Add proper implement of achievement + +#include "ObjectMgr.h" +#include "BattlefieldWG.h" +#include "SpellAuras.h" + +enum eWGBfData +{ + BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp + BATTLEFIELD_WG_MAPID = 571, // Northrend +}; + +bool BattlefieldWG::SetupBattlefield() +{ + InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); + + m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes + m_BattleId = BATTLEFIELD_BATTLEID_WG; + m_ZoneId = BATTLEFIELD_WG_ZONEID; + m_MapId = BATTLEFIELD_WG_MAPID; + + m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX); + m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); + m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN); + m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL); + m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE; + m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE; + m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE; + + m_TimeForAcceptInvite = 20; + m_StartGroupingTimer = 15 * MINUTE; + m_StartGrouping = false; + + m_tenacityStack = 0; + + KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0); + KickPosition.m_mapId = m_MapId; + + RegisterZone(m_ZoneId); + + m_Data32.resize(BATTLEFIELD_WG_DATA_MAX); + + m_saveTimer = 60000; + + // Init GraveYards + SetGraveyardNumber(BATTLEFIELD_WG_GY_MAX); + + // Load from db + if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0) + && (sWorld->getWorldState(ClockWorldState[0]) == 0)) + { + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, false); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, urand(0, 1)); + sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime); + } + + m_BattlefieldActive = sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE); + m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER)); + + m_Timer = sWorld->getWorldState(ClockWorldState[0]); + if (m_BattlefieldActive) + { + m_BattlefieldActive = false; + m_Timer = m_RestartAfterCrash; + } + + for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++) + { + BfGraveYardWG *gy = new BfGraveYardWG(this); + if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) // When between games, the graveyard is controlled by the defending team + gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, m_DefenderTeam, WGGraveYard[i].gyid); + else + gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + gy->SetTextId(WGGraveYard[i].textid); + m_GraveYardList[i] = gy; + } + + // Spawn workshop creatures and gameobjects + for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++) + { + BfWGWorkShopData *ws = new BfWGWorkShopData(this); // Create new object + // Init:setup variable + ws->Init(WGWorkShopDataBase[i].worldstate, WGWorkShopDataBase[i].type, WGWorkShopDataBase[i].nameid); + // Spawn associate npc on this point (Guard/Engineer) + for (uint8 c = 0; c < WGWorkShopDataBase[i].nbcreature; c++) + ws->AddCreature(WGWorkShopDataBase[i].CreatureData[c]); + + // Spawn associate gameobject on this point (Horde/Alliance flags) + for (uint8 g = 0; g < WGWorkShopDataBase[i].nbgob; g++) + ws->AddGameObject(WGWorkShopDataBase[i].GameObjectData[g]); + + // Create PvPCapturePoint + if (WGWorkShopDataBase[i].type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + { + ws->ChangeControl(GetAttackerTeam(), true); // Update control of this point + // Create Object + BfCapturePointWG *workshop = new BfCapturePointWG(this, GetAttackerTeam()); + // Spawn gameobject associate (see in OnGameObjectCreate, of OutdoorPvP for see association) + workshop->SetCapturePointData(WGWorkShopDataBase[i].CapturePoint.entryh, 571, + WGWorkShopDataBase[i].CapturePoint.x, WGWorkShopDataBase[i].CapturePoint.y, WGWorkShopDataBase[i].CapturePoint.z, 0); + workshop->LinkToWorkShop(ws); // Link our point to the capture point (for faction changement) + AddCapturePoint(workshop); // Add this capture point to list for update this (view in Update() of OutdoorPvP) + } + else + ws->ChangeControl(GetDefenderTeam(), true); // Update control of this point (Keep workshop= to deffender team) + + WorkShopList.insert(ws); + } + // Spawning npc in keep + for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++) + { + // Horde npc + if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE)) + KeepCreature[TEAM_HORDE].insert(creature->GetGUID()); + // Alliance npc + if (Creature* creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE)) + KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); + } + // Hide keep npc + for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + HideNpc(creature); + // Spawn out of keep npc + // Horde npc + for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++) + if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) + OutsideCreature[TEAM_HORDE].insert(creature->GetGUID()); + // Alliance npc + for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++) + if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) + OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); + // Hide outside npc + for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + HideNpc(creature); + for (uint8 i = 0; i < WG_MAX_TURRET; i++) + { + if (Creature* creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0))) + { + CanonList.insert(creature->GetGUID()); + HideNpc(creature); + } + } + // Spawning Buiding + for (uint8 i = 0; i < WG_MAX_OBJ; i++) + { + GameObject* go = + SpawnGameObject(WGGameObjectBuillding[i].entry, WGGameObjectBuillding[i].x, WGGameObjectBuillding[i].y, WGGameObjectBuillding[i].z, WGGameObjectBuillding[i].o); + BfWGGameObjectBuilding *b = new BfWGGameObjectBuilding(this); + b->Init(go, WGGameObjectBuillding[i].type, WGGameObjectBuillding[i].WorldState, WGGameObjectBuillding[i].nameid); + BuildingsInZone.insert(b); + } + // Spawning portal defender + for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++) + { + GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o); + DefenderPortalList.insert(go); + go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]); + } + + // Spawn banner in keep + for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++) + { + if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) + { + go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY); + m_KeepGameObject[1].insert(go); + } + if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) + { + go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + m_KeepGameObject[0].insert(go); + } + } + + // Show defender banner in keep + for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + + // Hide attackant banner in keep + for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + UpdateCounterVehicle(true); + return true; +} + +bool BattlefieldWG::Update(uint32 diff) +{ + bool m_return = Battlefield::Update(diff); + if (m_saveTimer <= diff) + { + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_BattlefieldActive); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam); + sWorld->setWorldState(ClockWorldState[0], m_Timer); + m_saveTimer = 60 * IN_MILLISECONDS; + } + else + m_saveTimer -= diff; + + for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) + { + const WorldSafeLocsEntry *graveyard = GetClosestGraveYard(player); + if (graveyard) + { + if (player->GetDistance2d(graveyard->x, graveyard->y) > 10.0f) + { + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + m_PlayersIsSpellImu.erase(player->GetGUID()); + } + } + } + } + + if (m_BattlefieldActive) + { + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (unit->IsInWater() && !unit->HasAura(SPELL_WINTERGRASP_WATER)) + unit->AddAura(SPELL_WINTERGRASP_WATER, unit); + if (!unit->IsInWater() && unit->HasAura(SPELL_WINTERGRASP_WATER)) + unit->RemoveAurasDueToSpell(SPELL_WINTERGRASP_WATER); + } + + } + + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr) + { + if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150 + { + player->AddAura((*cp_itr).second->GetTeamId() == TEAM_HORDE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT, player); + player->RemoveAurasDueToSpell((*cp_itr).second->GetTeamId() == TEAM_ALLIANCE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); + break; + } + } + + return m_return; +} + +void BattlefieldWG::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) +{ + Battlefield::AddPlayerToResurrectQueue(npc_guid, player_guid); + if (IsWarTime()) + { + if (Player* player = sObjectMgr->GetPlayer(player_guid)) + { + if (!player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) + { + player->CastSpell(player, SPELL_SPIRITUAL_IMMUNITY, true); + m_PlayersIsSpellImu.insert(player->GetGUID()); + } + } + } +} + +void BattlefieldWG::OnBattleStart() +{ + // Spawn titan relic + m_relic = SpawnGameObject(BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC, 5440.0f, 2840.8f, 430.43f, 0); + if (m_relic) + { + // Update faction of relic, only attacker can click on + m_relic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]); + // Set in use (not allow to click on before last door is broken) + m_relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + } + else + sLog->outError("WG: Failed to spawn titan relic."); + + + // Update tower visibility and update faction + for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature* creature = unit->ToCreature()) + { + ShowNpc(creature, true); + creature->setFaction(WintergraspFaction[GetDefenderTeam()]); + } + } + } + + // Rebuild all wall + for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) + { + if ((*itr)) + { + (*itr)->Rebuild(); + (*itr)->UpdateTurretAttack(false); + } + } + + m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] = 0; + m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] = 0; + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT] = 0; + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF] = 0; + + // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) + for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + { + if ((*itr)) + (*itr)->UpdateGraveYardAndWorkshop(); + } + + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::const_iterator p_itr = m_players[team].begin(); p_itr != m_players[team].end(); ++p_itr) + { + // Kick player in orb room, TODO: offline player ? + if (Player* player = sObjectMgr->GetPlayer((*p_itr))) + { + float x, y, z; + player->GetPosition(x, y, z); + if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480) + player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f); + SendInitWorldStatesTo(player); + } + } + // Initialize vehicle counter + UpdateCounterVehicle(true); + // Send start warning to all players + SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START); +} + +void BattlefieldWG::UpdateCounterVehicle(bool init) +{ + if (init) + { + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H] = 0; + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A] = 0; + } + m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = 0; + m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = 0; + + for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + { + if (BfWGWorkShopData * workshop = (*itr)) + { + if (workshop->m_TeamControl == TEAM_ALLIANCE) + m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4; + else if (workshop->m_TeamControl == TEAM_HORDE) + m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] + 4; + } + } + + UpdateVehicleCountWG(); +} + +void BattlefieldWG::OnBattleEnd(bool endbytimer) +{ + // Remove relic + if (m_relic) + m_relic->RemoveFromWorld(); + m_relic = NULL; + + // Remove turret + for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature* creature = unit->ToCreature()) + { + if (!endbytimer) + creature->setFaction(WintergraspFaction[GetDefenderTeam()]); + HideNpc(creature); + } + } + } + + // If endbytimer is false, battle is end by clicking on relic + if (!endbytimer) + { + // Change all npc in keep + for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + HideNpc(creature); + } + for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + ShowNpc(creature, true); + } + // Change all npc out of keep + for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + HideNpc(creature); + } + for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + ShowNpc(creature, true); + } + } + + // Update all graveyard, control is to defender when no wartime + for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++) + { + if (GetGraveYardById(i)) + { + GetGraveYardById(i)->ChangeControl(GetDefenderTeam()); + } + } + + for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + + for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + // Update portal defender faction + for (GameObjectSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr) + (*itr)->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]); + + // Saving data + for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) + (*itr)->Save(); + for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + (*itr)->Save(); + + uint32 WinHonor = 0; + uint32 LossHonor = 0; + + if (!endbytimer) + { + WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]; + LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]; + } + else + { + WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]; + LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]; + } + + for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) + { + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); + if (player->HasAura(SPELL_LIEUTENANT)) + { + player->RewardHonor(NULL, 1, WinHonor); + RewardMarkOfHonor(player, 3); + } + else if (player->HasAura(SPELL_CORPORAL)) + { + player->RewardHonor(NULL, 1, WinHonor); + RewardMarkOfHonor(player, 2); + } + if (player->GetTeamId() == TEAM_HORDE) + IncrementQuest(player, 13183, true); + else + IncrementQuest(player, 13181, true); + // Send Wintergrasp victory achievement + DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); + // Award achievement for succeeding in Wintergrasp in 10 minutes or less + if (!endbytimer && GetTimer() <= 10000) + DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player); + } + } + for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) + { + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + if (player->HasAura(SPELL_LIEUTENANT)) + { + player->RewardHonor(NULL, 1, LossHonor); + RewardMarkOfHonor(player, 1); + } + else if (player->HasAura(SPELL_CORPORAL)) + { + player->RewardHonor(NULL, 1, LossHonor); + RewardMarkOfHonor(player, 1); + } + } + } + + for (uint8 team = 0; team < 2; ++team) + { + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + { + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + player->RemoveAura(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + } + } + m_PlayersInWar[team].clear(); + + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + if (creature->IsVehicle()) + creature->GetVehicleKit()->Dismiss(); + } + m_vehicles[team].clear(); + } + + if (!endbytimer) + { + for (uint8 team = 0; team < 2; ++team) + { + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + { + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID()); + player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); + } + } + } + } + + if (!endbytimer) + { // win alli/horde + SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1); + } + else + { // defend alli/horde + SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1); + } +} + +// ***************************************************** +// *******************Reward System********************* +// ***************************************************** +void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 /*incrementNumber */ ) +{ + AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement); + + switch (achievement) + { + case ACHIEVEMENTS_WIN_WG_100: + { + // player->GetAchievementMgr().UpdateAchievementCriteria(); + } + default: + { + if (player) + player->CompletedAchievement(AE); + } + break; + } + +} + +void BattlefieldWG::RewardMarkOfHonor(Player* player, uint32 count) +{ + // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens + if (count == 0) + return; + + ItemPosCountVec dest; + uint32 no_space_count = 0; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count); + + if (msg == EQUIP_ERR_ITEM_NOT_FOUND) + { + return; + } + + if (msg != EQUIP_ERR_OK) // convert to possible store amount + count -= no_space_count; + + if (count != 0 && !dest.empty()) // can add some + if (Item * item = player->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0)) + player->SendNewItem(item, count, true, false); +} + +void BattlefieldWG::OnStartGrouping() +{ + // Warn + SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); +} + +void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add) +{ + if (IsWarTime()) + { + switch (creature->GetEntry()) + { + case 28312: + case 32627: + case 27881: + case 28094: + { + uint8 team; + if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) + team = TEAM_ALLIANCE; + else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) + team = TEAM_HORDE; + else + return; + + if (add) + { + if (team == TEAM_HORDE) + { + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) + { + creature->AddAura(SPELL_HORDE_FLAG, creature); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); + } + else + { + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; + } + } + else + { + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) + { + creature->AddAura(SPELL_ALLIANCE_FLAG, creature); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); + } + else + { + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; + } + } + } + else + { + m_vehicles[team].erase(creature->GetGUID()); + if (team == TEAM_HORDE) + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--; + else + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--; + UpdateVehicleCountWG(); + } + break; + } + } + } +} + +// Called when player kill a unit in wg zone +void BattlefieldWG::HandleKill(Player* killer, Unit* victim) +{ + if (killer == victim) + return; + + bool again = false; + if (victim->GetTypeId() == TYPEID_PLAYER) + { + IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); + IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); + for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + { + if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (player->GetDistance2d(killer) < 40) + PromotePlayer(player); + } + return; + } + for (GuidSet::const_iterator itr = m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); + itr != m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature* creature = unit->ToCreature()) + { + if (victim->GetEntry() == creature->GetEntry() && !again) + { + again = true; + for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + { + if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (player->GetDistance2d(killer) < 40) + IncrementQuest(player, IncrementQuest(killer, WGQuest[killer->GetTeamId()][0])); + } + } + } + } + } + for (GuidSet::const_iterator itr = KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); + itr != KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature* creature = unit->ToCreature()) + { + if (victim->GetEntry() == creature->GetEntry() && !again) + { + again = true; + IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); + IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); + for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + { + if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (player->GetDistance2d(killer) < 40) + PromotePlayer(player); + } + } + } + } + } + // TODO:Recent PvP activity worldstate +} + +// Update rank for player +void BattlefieldWG::PromotePlayer(Player* killer) +{ + if (!m_BattlefieldActive) + return; + // Updating rank of player + if (Aura* aur = killer->GetAura(SPELL_RECRUIT)) + { + if (aur->GetStackAmount() >= 5) // 7 or more TODO: + { + killer->RemoveAura(SPELL_RECRUIT); + killer->CastSpell(killer, SPELL_CORPORAL, true); + SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK); + } + else + killer->CastSpell(killer, SPELL_RECRUIT, true); + } + else if (Aura* aur = killer->GetAura(SPELL_CORPORAL)) + { + if (aur->GetStackAmount() >= 5) // 7 or more TODO: + { + killer->RemoveAura(SPELL_CORPORAL); + killer->CastSpell(killer, SPELL_LIEUTENANT, true); + SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK); + } + else + killer->CastSpell(killer, SPELL_CORPORAL, true); + } +} + +void BattlefieldWG::OnPlayerJoinWar(Player* player) +{ + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + + player->CastSpell(player, SPELL_RECRUIT, true); + + if (player->GetZoneId() != m_ZoneId) + { + if (player->GetTeamId() == GetDefenderTeam()) + { + player->TeleportTo(571, 5345, 2842, 410, 3.14f); + } + else + { + if (player->GetTeamId() == TEAM_HORDE) + player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f); + else + player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f); + } + } + + UpdateTenacity(); + + if (player->GetTeamId() == GetAttackerTeam()) + { + if (3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) + player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); + } + else + { + if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) + player->SetAuraStack(SPELL_TOWER_CONTROL, player, m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); + } + SendInitWorldStatesTo(player); +} + +void BattlefieldWG::OnPlayerLeaveWar(Player* player) +{ + // Remove all aura from WG // TODO: false we can go out of this zone on retail and keep Rank buff, remove on end of WG + if (!player->GetSession()->PlayerLogout()) + { + if (player->GetVehicle()) // Remove vehicle of player if he go out. + player->GetVehicle()->Dismiss(); + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); + player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + } + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT); +} + +void BattlefieldWG::OnPlayerLeaveZone(Player* player) +{ + player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + if (!m_BattlefieldActive) + { + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + } + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT); +} + +void BattlefieldWG::OnPlayerEnterZone(Player* player) +{ + player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + if (!m_BattlefieldActive) + { + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + if (player->GetTeamId() == GetDefenderTeam()) + player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); + } + + player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); + // Send worldstate to player + SendInitWorldStatesTo(player); +} + +// Method sending worldsate to player +WorldPacket BattlefieldWG::BuildInitWorldStates() +{ + WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkShopList.size() * 8))); + + data << uint32(m_MapId); + data << uint32(m_ZoneId); + data << uint32(0); + data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkShopList.size()); + + data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam()); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam()); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); + data << uint32(3710) << uint32(IsWarTime()? 1 : 0); + + for (uint32 i = 0; i < 2; ++i) + data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000)); + + data << uint32(3490) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + data << uint32(3491) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H); + data << uint32(3680) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + data << uint32(3681) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); + + for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) + { + data << (*itr)->m_WorldState << (*itr)->m_State; + } + for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + { + data << (*itr)->m_WorldState << (*itr)->m_State; + } + return data; +} + +void BattlefieldWG::SendInitWorldStatesTo(Player *player) +{ + WorldPacket data = BuildInitWorldStates(); + player->GetSession()->SendPacket(&data); +} + +void BattlefieldWG::SendInitWorldStatesToAll() +{ + WorldPacket data = BuildInitWorldStates(); + for (uint8 team = 0; team < 2; team++) + for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + player->GetSession()->SendPacket(&data); +} + +void BattlefieldWG::BrokenWallOrTower(TeamId team) +{ + if (team == GetDefenderTeam()) + { + for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) + { + if (Player* player = sObjectMgr->GetPlayer((*p_itr))) + { + if (player->GetTeamId() == TEAM_ALLIANCE) + IncrementQuest(player, 13222); + else + IncrementQuest(player, 13223); + } + } + } +} +// Called when a tower is broke +void BattlefieldWG::AddBrokenTower(TeamId team) +{ + // Destroy an attack tower + if (team == GetAttackerTeam()) + { + // Update counter + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]--; + m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]++; + + // Remove buff stack + for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + player->RemoveAuraFromStack(SPELL_TOWER_CONTROL); + + // Add buff stack + for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + player->CastSpell(player, SPELL_TOWER_CONTROL, true); + if (player->GetTeamId() == TEAM_HORDE) + IncrementQuest(player, 13539, true); + else + IncrementQuest(player, 13538, true); + DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); + } + // If the threw south tower is destroy + if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] == 3) + { + // Remove 10 minutes to battle time + if (int32(m_Timer - 600000) < 0) + { + m_Timer = 0; + } + else + { + m_Timer -= 600000; + } + SendInitWorldStatesToAll(); + } + } + else + { + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]--; + m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF]++; + } +} + +void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId) +{ + if (!obj || !IsWarTime()) + return; + + // On click on titan relic + if (obj->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC) + { + // Check that the door is break + if (m_CanClickOnOrb) + EndBattle(false); + else // if door is not break, respawn relic. + m_relic->SetRespawnTime(RESPAWN_IMMEDIATELY); + } + + // if destroy or damage event, search the wall/tower and update worldstate/send warning message + for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) + { + if (obj->GetEntry() == (*itr)->m_Build->GetEntry()) + { + if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId) + (*itr)->Damaged(); + + if ((*itr)->m_Build->GetGOInfo()->building.destroyedEvent == eventId) + (*itr)->Destroyed(); + + break; + } + } +} + +// Called when a tower is damaged, used for honor reward calcul +void BattlefieldWG::AddDamagedTower(TeamId team) +{ + if (team == GetAttackerTeam()) + { + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]++; + } + else + { + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]++; + } +} + +// Update vehicle count WorldState to player +void BattlefieldWG::UpdateVehicleCountWG() +{ + SendUpdateWorldState(3490, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + SendUpdateWorldState(3491, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); + SendUpdateWorldState(3680, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + SendUpdateWorldState(3681, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); +} + +void BattlefieldWG::UpdateTenacity() +{ + TeamId team = TEAM_NEUTRAL; + uint32 allianceNum = m_PlayersInWar[TEAM_ALLIANCE].size(); + uint32 hordeNum = m_PlayersInWar[TEAM_HORDE].size(); + int32 newStack = 0; + + if (allianceNum && hordeNum) + { + if (allianceNum < hordeNum) + newStack = int32((float (hordeNum) / float (allianceNum) - 1) *4); // positive, should cast on alliance + else if (allianceNum > hordeNum) + newStack = int32((1 - float (allianceNum) / float (hordeNum)) *4); // negative, should cast on horde + } + + if (newStack == int32(m_tenacityStack)) + return; + + if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance + team = TEAM_ALLIANCE; + else if (newStack >= 0) // old buff was on horde + team = TEAM_HORDE; + + m_tenacityStack = newStack; + // Remove old buff + if (team != TEAM_NEUTRAL) + { + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (player->getLevel() >= m_MinLevel) + player->RemoveAurasDueToSpell(SPELL_TENACITY); + + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE); + } + + // Apply new buff + if (newStack) + { + team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE; + + if (newStack < 0) + newStack = -newStack; + if (newStack > 20) + newStack = 20; + + uint32 buff_honor = SPELL_GREATEST_HONOR; + buff_honor = (newStack < 15) ? (uint32) SPELL_GREATER_HONOR : buff_honor; + buff_honor = (newStack < 10) ? (uint32) SPELL_GREAT_HONOR : buff_honor; + buff_honor = (newStack < 5) ? 0 : buff_honor; + + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + player->SetAuraStack(SPELL_TENACITY, player, newStack); + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack); + + if (buff_honor != 0) + { + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + player->AddAura(buff_honor, player); + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + creature->AddAura(buff_honor, creature); + } + } +} + +void BfCapturePointWG::ChangeTeam(TeamId /*oldTeam */ ) +{ + m_WorkShop->ChangeControl(m_team, false); +} + +BfCapturePointWG::BfCapturePointWG(BattlefieldWG* bf, TeamId control) : BfCapturePoint(bf) +{ + m_Bf = bf; + m_team = control; +} + +BfGraveYardWG::BfGraveYardWG(BattlefieldWG* bf) : BfGraveYard(bf) +{ + m_Bf = bf; +} diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h new file mode 100644 index 00000000000..ffde7cb060c --- /dev/null +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -0,0 +1,1918 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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 . + */ + +#ifndef BATTLEFIELD_WG_ +#define BATTLEFIELD_WG_ + +#include "ObjectAccessor.h" +#include "WorldPacket.h" +#include "World.h" +#include "Group.h" +#include "Battlefield.h" + +const uint32 VehNumWorldState[2] = { 3680, 3490 }; +const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; +const uint32 ClockWorldState[2] = { 3781, 4354 }; +const uint32 WintergraspFaction[3] = { 1732, 1735, 35 }; + +const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; + +class BattlefieldWG; +class BfCapturePointWG; + +struct BfWGGameObjectBuilding; +struct BfWGWorkShopData; + +typedef std::setGameObjectSet; +typedef std::set GameObjectBuilding; +typedef std::set WorkShop; +//typedef std::set CapturePointSet; unused ? +typedef std::set GroupSet; + +enum eWGItem +{ +// *INDENT-OFF* + WG_MARK_OF_HONOR = 43589, +// *INDENT-ON* +}; + +enum eWGSpell +{ +// *INDENT-OFF* + // AWartime auras + SPELL_RECRUIT = 37795, + SPELL_CORPORAL = 33280, + SPELL_LIEUTENANT = 55629, + SPELL_TENACITY = 58549, + SPELL_TENACITY_VEHICLE = 59911, + SPELL_TOWER_CONTROL = 62064, + SPELL_SPIRITUAL_IMMUNITY = 58729, + SPELL_GREAT_HONOR = 58555, + SPELL_GREATER_HONOR = 58556, + SPELL_GREATEST_HONOR = 58557, + SPELL_ALLIANCE_FLAG = 14268, + SPELL_HORDE_FLAG = 14267, + + // Reward spells + SPELL_VICTORY_REWARD = 56902, + SPELL_DEFEAT_REWARD = 58494, + SPELL_DAMAGED_TOWER = 59135, + SPELL_DESTROYED_TOWER = 59136, + SPELL_DAMAGED_BUILDING = 59201, + SPELL_INTACT_BUILDING = 59203, + + SPELL_TELEPORT_BRIDGE = 59096, + SPELL_TELEPORT_FORTRESS = 60035, + + SPELL_TELEPORT_DALARAN = 53360, + SPELL_VICTORY_AURA = 60044, + + // Other spells + SPELL_WINTERGRASP_WATER = 36444, + SPELL_ESSENCE_OF_WINTERGRASP = 58045, + SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730, + + // Phasing spells + SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618,// ADDS PHASE 16 + SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617,// ADDS PHASE 32 + + SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64 + SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128 + +// *INDENT-ON* +}; + +enum eWGData32 +{ + BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, + BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, + BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, + BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, + BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, + BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, + BATTLEFIELD_WG_DATA_VEHICLE_A, + BATTLEFIELD_WG_DATA_VEHICLE_H, + BATTLEFIELD_WG_DATA_MAX, +}; + +enum WB_ACHIEVEMENTS +{ +// *INDENT-OFF* + ACHIEVEMENTS_WIN_WG = 1717, + ACHIEVEMENTS_WIN_WG_100 = 1718, // todo + ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo + ACHIEVEMENTS_WG_TOWER_DESTROY = 1727, + ACHIEVEMENTS_DESTRUCTION_DERBY_A = 1737, // todo + ACHIEVEMENTS_WG_TOWER_CANNON_KILL = 1751, // todo + ACHIEVEMENTS_WG_MASTER_A = 1752, // todo + ACHIEVEMENTS_WIN_WG_TIMER_10 = 1755, + ACHIEVEMENTS_STONE_KEEPER_50 = 2085, // todo + ACHIEVEMENTS_STONE_KEEPER_100 = 2086, // todo + ACHIEVEMENTS_STONE_KEEPER_250 = 2087, // todo + ACHIEVEMENTS_STONE_KEEPER_500 = 2088, // todo + ACHIEVEMENTS_STONE_KEEPER_1000 = 2089, // todo + ACHIEVEMENTS_WG_RANGER = 2199, // todo + ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo + ACHIEVEMENTS_WG_MASTER_H = 2776, // todo +// *INDENT-ON* +}; + +enum eWGWorldStates +{ + BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801, + BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, + BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, +}; +/*######################### +*####### Graveyards ######* +#########################*/ + +class BfGraveYardWG : public BfGraveYard +{ + public: + BfGraveYardWG(BattlefieldWG *Bf); + + void SetTextId(uint32 textid) { m_GossipTextId = textid; } + uint32 GetTextId() { return m_GossipTextId; } + protected: + uint32 m_GossipTextId; +}; + +enum eWGGraveyardId +{ + BATTLEFIELD_WG_GY_WORKSHOP_NE, + BATTLEFIELD_WG_GY_WORKSHOP_NW, + BATTLEFIELD_WG_GY_WORKSHOP_SE, + BATTLEFIELD_WG_GY_WORKSHOP_SW, + BATTLEFIELD_WG_GY_KEEP, + BATTLEFIELD_WG_GY_HORDE, + BATTLEFIELD_WG_GY_ALLIANCE, + BATTLEFIELD_WG_GY_MAX, +}; + +enum eWGGossipText +{ +// *INDENT-OFF* + BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501, + BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502, + BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504, + BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = -1850503, + BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500, + BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505, + BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506, +// *INDENT-ON* +}; + +enum eWGNpc +{ +// *INDENT-OFF* + BATTLEFIELD_WG_NPC_GUARD_H = 30739, + BATTLEFIELD_WG_NPC_GUARD_A = 30740, + BATTLEFIELD_WG_NPC_STALKER = 00000, + + BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102, + BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296,// + BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101,// + BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173,// + BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH = 31091, + BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH = 31151, + BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106, + BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053, + BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107, + + BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052, + BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294,// + BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051,// + BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172,// + BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH = 31036, + BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS = 31153, + BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108, + BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054, + BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109, + + NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp + NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp +// *INDENT-ON* +}; + +struct BfWGCoordGY +{ + float x; + float y; + float z; + float o; + uint32 gyid; + uint8 type; + uint32 textid; // for gossip menu + TeamId startcontrol; +}; + +const uint32 WGQuest[2][6] = { + { 13186, 13181, 13222, 13538, 13177, 13179 }, + { 13185, 13183, 13223, 13539, 13178, 13180 }, +}; +// 7 in sql, 7 in header +const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = { + { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL }, + { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL }, + { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL }, + { 4331.716f, 3235.695f, 390.251f, 0.008500f, 1334, BATTLEFIELD_WG_GY_WORKSHOP_SW, BATTLEFIELD_WG_GOSSIPTEXT_GY_SW, TEAM_NEUTRAL }, + { 5537.986f, 2897.493f, 517.057f, 4.819249f, 1285, BATTLEFIELD_WG_GY_KEEP, BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP, TEAM_NEUTRAL }, + { 5032.454f, 3711.382f, 372.468f, 3.971623f, 1331, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE, TEAM_HORDE }, + { 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE }, +}; + +/*######################### +* BfCapturePointWG * +#########################*/ + +class BfCapturePointWG : public BfCapturePoint +{ + public: + BfCapturePointWG(BattlefieldWG *bf, TeamId control); + + void LinkToWorkShop(BfWGWorkShopData *ws) + { + m_WorkShop = ws; + } + + void ChangeTeam(TeamId oldteam); + TeamId GetTeam() const + { + return m_team; + } + + protected: + BfWGWorkShopData *m_WorkShop; +}; + +/*######################### +* WinterGrasp Battlefield * +#########################*/ + +class BattlefieldWG : public Battlefield +{ + public: + /** + * \brief Called when the battle start + * -Spawn relic and turret + * -Rebuild tower and wall + * -Invite player to war + */ + void OnBattleStart(); + + /** + * \brief Called when battle end + * -Remove relic and turret + * -Change banner/npc in keep if it needed + * -Saving battlestate + * -Reward honor/mark to player + * -Remove vehicle + * \param endbytimer : true if battle end when timer is at 00:00, false if battle end by clicking on relic + */ + void OnBattleEnd(bool endbytimer); + + /** + * \brief Called when grouping start (15 minutes before battlestart) + * -Invite all player in zone to join queue + */ + void OnStartGrouping(); + + /** + * \brief Called when player accept invite to join battle + * -Update aura + * -Teleport if it needed + * -Update worldstate + * -Update tenacity + * \param plr: Player who accept invite + */ + void OnPlayerJoinWar(Player *plr); + + /** + * \brief Called when player leave battle + * -Update player aura + * \param plr : Player who leave battle + */ + void OnPlayerLeaveWar(Player *plr); + + /** + * \brief Called when player leave WG zone + * \param plr : Player who leave zone + */ + void OnPlayerLeaveZone(Player *plr); + + /** + * \brief Called when player enter in WG zone + * -Update aura + * -Update worldstate + * \param plr : Player who leave zone + */ + void OnPlayerEnterZone(Player *plr); + + /** + * \brief Called for update battlefield data + * -Save battle timer in database every minutes + * -Update imunity aura from graveyard + * -Update water aura, if player is in water (HACK) + * \param diff : time ellapsed since the last call (in ms) + */ + bool Update(uint32 diff); + + /** + * \brief Called when a creature is spawn or remove from WG + * -Update vehicle count + * \param add : true > creature is spawn false > creature is remove + */ + void OnCreatureCreate(Creature *creature, bool add); + + /** + * \brief Called when a wall/tower is broken + * -Update quest + */ + void BrokenWallOrTower(TeamId team); + + /** + * \brief Called when a tower is damaged + * -Update tower count (for reward calcul) + */ + void AddDamagedTower(TeamId team); + + /** + * \brief Called when tower is broken + * -Update tower buff + * -check if three south tower is down for remove 10 minutes to wg + */ + void AddBrokenTower(TeamId team); + + void DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 incrementNumber = 1); + + /** + * \brief called when a player is die, for add him to resurrect queue + */ + void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); + + /** + * \brief Called when battlefield is setup, at server start + */ + bool SetupBattlefield(); + + /// Return pointer to relic object + GameObject *GetRelic() + { + return m_relic; + } + + /// Define relic object + void SetRelic(GameObject * relic) + { + m_relic = relic; + } + + /// Say if player can click or not on orb (last door broken) + bool CanClickOnOrb() + { + return m_CanClickOnOrb; + } + + /// Define if player can click or not on orb (if last door broken) + void AllowToClickOnOrb(bool allow) + { + m_CanClickOnOrb = allow; + } + + void RewardMarkOfHonor(Player *plr, uint32 count); + + void UpdateVehicleCountWG(); + void UpdateCounterVehicle(bool init); + + WorldPacket BuildInitWorldStates(); + void SendInitWorldStatesTo(Player * plr); + void SendInitWorldStatesToAll(); + + void HandleKill(Player *killer, Unit *victim); + void PromotePlayer(Player *killer); + + void UpdateTenacity(); + void ProcessEvent(GameObject *obj, uint32 eventId); + + protected: + bool m_CanClickOnOrb; + GameObject* m_relic; + GameObjectBuilding BuildingsInZone; + GuidSet KeepCreature[2]; + GuidSet OutsideCreature[2]; + WorkShop WorkShopList; + GuidSet CanonList; + GameObjectSet DefenderPortalList; + GameObjectSet m_KeepGameObject[2]; + GuidSet m_vehicles[2]; + GuidSet m_PlayersIsSpellImu; // Player is dead + uint32 m_tenacityStack; + uint32 m_saveTimer; +}; + +#define NORTHREND_WINTERGRASP 4197 + +enum eWGGameObjectBuildingType +{ + BATTLEFIELD_WG_OBJECTTYPE_DOOR, + BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC, + BATTLEFIELD_WG_OBJECTTYPE_WALL, + BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, + BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, + BATTLEFIELD_WG_OBJECTTYPE_TOWER, +}; + +enum eWGGameObjectState +{ + BATTLEFIELD_WG_OBJECTSTATE_NONE, + BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT, + BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DAMAGE, + BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DESTROY, + BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT, + BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE, + BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY, + BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT, + BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE, + BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY, +}; + +enum eWGWorkShopType +{ + BATTLEFIELD_WG_WORKSHOP_NE, + BATTLEFIELD_WG_WORKSHOP_NW, + BATTLEFIELD_WG_WORKSHOP_SE, + BATTLEFIELD_WG_WORKSHOP_SW, + BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, + BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, +}; + +enum eWGTeamControl +{ + BATTLEFIELD_WG_TEAM_ALLIANCE, + BATTLEFIELD_WG_TEAM_HORDE, + BATTLEFIELD_WG_TEAM_NEUTRAL, +}; + +// TODO: Handle this with creature_text ? +enum eWGText +{ +// *INDENT-OFF* + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW = 12054, + BATTLEFIELD_WG_TEXT_WORKSHOP_ATTACK = 12051, + BATTLEFIELD_WG_TEXT_WORKSHOP_TAKEN = 12050, + BATTLEFIELD_WG_TEXT_ALLIANCE = 12057, + BATTLEFIELD_WG_TEXT_HORDE = 12056, + BATTLEFIELD_WG_TEXT_WILL_START = 12058, + BATTLEFIELD_WG_TEXT_START = 12067, + BATTLEFIELD_WG_TEXT_FIRSTRANK = 12059, + BATTLEFIELD_WG_TEXT_SECONDRANK = 12060, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE = 12062, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW = 12064, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE = 12061, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW = 12063, + BATTLEFIELD_WG_TEXT_TOWER_DAMAGE = 12065, + BATTLEFIELD_WG_TEXT_TOWER_DESTROY = 12066, + BATTLEFIELD_WG_TEXT_TOWER_NAME_S = 12069, + BATTLEFIELD_WG_TEXT_TOWER_NAME_E = 12070, + BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071, + BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068, + BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072, +// *INDENT-ON* +}; + +enum eWGObject +{ +// *INDENT-OFF* + BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE = 190475, + BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW = 190487, + BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE = 194959, + BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW = 194962, + BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC = 192829, +// *INDENT-ON* +}; +struct BfWGObjectPosition +{ + float x; + float y; + float z; + float o; + uint32 entryh; + uint32 entrya; +}; + +// ********************************************************* +// ************Destructible (Wall,Tower..)****************** +// ********************************************************* + +struct BfWGBuildingSpawnData +{ + uint32 entry; + uint32 WorldState; + float x; + float y; + float z; + float o; + uint32 type; + uint32 nameid; +}; + +#define WG_MAX_OBJ 32 +const BfWGBuildingSpawnData WGGameObjectBuillding[WG_MAX_OBJ] = { + // Wall (Not spawned in db) + // Entry WS X Y Z O type NameID + { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190220, 3750, 5331.26f, 3047.1f, 407.923f, 0.052359f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191795, 3764, 5385.84f, 2909.49f, 409.713f, 0.00872f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191796, 3772, 5384.45f, 2771.84f, 410.27f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191799, 3762, 5371.44f, 2630.61f, 408.816f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191800, 3766, 5301.84f, 2909.09f, 409.866f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191801, 3770, 5301.06f, 2771.41f, 409.901f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191802, 3751, 5280.2f, 2995.58f, 408.825f, 1.61443f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191803, 3752, 5279.14f, 2956.02f, 408.604f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191804, 3767, 5278.69f, 2882.51f, 409.539f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191806, 3769, 5279.5f, 2798.94f, 409.998f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191807, 3759, 5279.94f, 2724.77f, 409.945f, 1.56207f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191808, 3760, 5279.6f, 2683.79f, 409.849f, 1.55334f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191809, 3761, 5330.96f, 2630.78f, 409.283f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190369, 3753, 5256.08f, 2933.96f, 409.357f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190370, 3758, 5257.46f, 2747.33f, 409.743f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190371, 3754, 5214.96f, 2934.09f, 409.19f, -0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190372, 3757, 5215.82f, 2747.57f, 409.188f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190374, 3755, 5162.27f, 2883.04f, 410.256f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190376, 3756, 5163.72f, 2799.84f, 409.227f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + + // Tower of keep (Not spawned in db) + { 190221, 3711, 5281.15f, 3044.59f, 407.843f, 3.11539f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW }, + { 190373, 3713, 5163.76f, 2932.23f, 409.19f, 3.12412f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW }, + { 190377, 3714, 5166.4f, 2748.37f, 409.188f, -1.5708f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE }, + { 190378, 3712, 5281.19f, 2632.48f, 409.099f, -1.58825f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE }, + + // Wall (with passage) (Not spawned in db) + { 191797, 3765, 5343.29f, 2908.86f, 409.576f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191798, 3771, 5342.72f, 2771.39f, 409.625f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191805, 3768, 5279.13f, 2840.8f, 409.783f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + + // South tower (Not spawned in db) + { 190356, 3704, 4557.17f, 3623.94f, 395.883f, 1.67552f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_W }, + { 190357, 3705, 4398.17f, 2822.5f, 405.627f, -3.12412f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_S }, + { 190358, 3706, 4459.1f, 1944.33f, 434.991f, -2.00276f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_E }, + + // Door of forteress (Not spawned in db) + { 190375, 3763, 5162.99f, 2841.23f, 410.162f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_DOOR, 0 }, + + // Last door (Not spawned in db) + { 191810, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 }, +}; + + +// ********************************************************* +// **********Keep Element(GameObject,Creature)************** +// ********************************************************* + +// Keep gameobject +// 192488 : 10 in sql, 19 in header +// 192501 : 12 in sql, 17 in header +// 192416 : 1 in sql, 33 in header +// 192374 : 1 in sql, 1 in header +// 192375 : 1 in sql, 1 in header +// 192336 : 1 in sql, 1 in header +// 192255 : 1 in sql, 1 in header +// 192269 : 1 in sql, 7 in header +// 192254 : 1 in sql, 1 in header +// 192349 : 1 in sql, 1 in header +// 192366 : 1 in sql, 3 in header +// 192367 : 1 in sql, 1 in header +// 192364 : 1 in sql, 1 in header +// 192370 : 1 in sql, 1 in header +// 192369 : 1 in sql, 1 in header +// 192368 : 1 in sql, 1 in header +// 192362 : 1 in sql, 1 in header +// 192363 : 1 in sql, 1 in header +// 192379 : 1 in sql, 1 in header +// 192378 : 1 in sql, 1 in header +// 192355 : 1 in sql, 1 in header +// 192354 : 1 in sql, 1 in header +// 192358 : 1 in sql, 1 in header +// 192359 : 1 in sql, 1 in header +// 192338 : 1 in sql, 1 in header +// 192339 : 1 in sql, 1 in header +// 192284 : 1 in sql, 1 in header +// 192285 : 1 in sql, 1 in header +// 192371 : 1 in sql, 1 in header +// 192372 : 1 in sql, 1 in header +// 192373 : 1 in sql, 1 in header +// 192360 : 1 in sql, 1 in header +// 192361 : 1 in sql, 1 in header +// 192356 : 1 in sql, 1 in header +// 192352 : 1 in sql, 1 in header +// 192353 : 1 in sql, 1 in header +// 192357 : 1 in sql, 1 in header +// 192350 : 1 in sql, 1 in header +// 192351 : 1 in sql, 1 in header +#define WG_KEEPGAMEOBJECT_MAX 44 +const BfWGObjectPosition WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { + { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower + { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect + { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect + { 5163.129883f, 2952.590088f, 433.502991f, 1.535890f, 192488, 192501 }, // Flag on tower + { 5145.109863f, 2935.000000f, 433.385986f, 3.141590f, 192488, 192501 }, // Flag on tower + { 5158.810059f, 2883.129883f, 431.618011f, 3.141590f, 192488, 192416 }, // Flag on wall + { 5154.490234f, 2862.149902f, 445.011993f, 3.141590f, 192336, 192416 }, // Flag on Wall Intersect + { 5154.520020f, 2853.310059f, 409.183014f, 3.141590f, 192255, 192269 }, // Flag on the floor + { 5154.459961f, 2828.939941f, 409.188995f, 3.141590f, 192254, 192269 }, // Flag on the floor + { 5155.310059f, 2820.739990f, 444.979004f, -3.13286f, 192349, 192416 }, // Flag on wall intersect + { 5160.339844f, 2798.610107f, 430.769012f, 3.141590f, 192488, 192416 }, // Flag on wall + { 5146.040039f, 2747.209961f, 433.584015f, 3.071770f, 192488, 192501 }, // Flag on tower + { 5163.779785f, 2729.679932f, 433.394012f, -1.58825f, 192488, 192501 }, // Flag on tower + { 5236.270020f, 2739.459961f, 444.992004f, -1.59698f, 192366, 192416 }, // Flag on wall intersect + { 5271.799805f, 2704.870117f, 445.183014f, -3.13286f, 192367, 192416 }, // Flag on wall intersect + { 5260.819824f, 2631.800049f, 433.324005f, 3.054330f, 192488, 192501 }, // Flag on tower + { 5278.379883f, 2613.830078f, 433.408997f, -1.58825f, 192488, 192501 }, // Flag on tower + { 5350.879883f, 2622.719971f, 444.686005f, -1.57080f, 192364, 192416 }, // Flag on wall intersect + { 5392.270020f, 2639.739990f, 435.330994f, 1.509710f, 192370, 192416 }, // Flag on wall intersect + { 5350.950195f, 2640.360107f, 435.407990f, 1.570800f, 192369, 192416 }, // Flag on wall intersect + { 5289.459961f, 2704.679932f, 435.875000f, -0.01745f, 192368, 192416 }, // Flag on wall intersect + { 5322.120117f, 2763.610107f, 444.973999f, -1.55334f, 192362, 192416 }, // Flag on wall intersect + { 5363.609863f, 2763.389893f, 445.023987f, -1.54462f, 192363, 192416 }, // Flag on wall intersect + { 5363.419922f, 2781.030029f, 435.763000f, 1.570800f, 192379, 192416 }, // Flag on wall intersect + { 5322.020020f, 2781.129883f, 435.811005f, 1.570800f, 192378, 192416 }, // Flag on wall intersect + { 5288.919922f, 2820.219971f, 435.721008f, 0.017452f, 192355, 192416 }, // Flag on wall intersect + { 5288.410156f, 2861.790039f, 435.721008f, 0.017452f, 192354, 192416 }, // Flag on wall intersect + { 5322.229980f, 2899.429932f, 435.808014f, -1.58825f, 192358, 192416 }, // Flag on wall intersect + { 5364.350098f, 2899.399902f, 435.838989f, -1.57080f, 192359, 192416 }, // Flag on wall intersect + { 5397.759766f, 2873.080078f, 455.460999f, 3.106650f, 192338, 192416 }, // Flag on keep + { 5397.390137f, 2809.330078f, 455.343994f, 3.106650f, 192339, 192416 }, // Flag on keep + { 5372.479980f, 2862.500000f, 409.049011f, 3.141590f, 192284, 192269 }, // Flag on floor + { 5371.490234f, 2820.800049f, 409.177002f, 3.141590f, 192285, 192269 }, // Flag on floor + { 5364.290039f, 2916.939941f, 445.330994f, 1.579520f, 192371, 192416 }, // Flag on wall intersect + { 5322.859863f, 2916.949951f, 445.153992f, 1.562070f, 192372, 192416 }, // Flag on wall intersect + { 5290.350098f, 2976.560059f, 435.221008f, 0.017452f, 192373, 192416 }, // Flag on wall intersect + { 5352.370117f, 3037.090088f, 435.252014f, -1.57080f, 192360, 192416 }, // Flag on wall intersect + { 5392.649902f, 3037.110107f, 433.713013f, -1.52716f, 192361, 192416 }, // Flag on wall intersect + { 5237.069824f, 2757.030029f, 435.795990f, 1.518440f, 192356, 192416 }, // Flag on wall intersect + { 5173.020020f, 2820.929932f, 435.720001f, 0.017452f, 192352, 192416 }, // Flag on wall intersect + { 5172.109863f, 2862.570068f, 435.721008f, 0.017452f, 192353, 192416 }, // Flag on wall intersect + { 5235.339844f, 2924.340088f, 435.040009f, -1.57080f, 192357, 192416 }, // Flag on wall intersect + { 5270.689941f, 2861.780029f, 445.058014f, -3.11539f, 192350, 192416 }, // Flag on wall intersect + { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect +}; + +// Keep turret +struct BfWGTurretPos +{ + float x; + float y; + float z; + float o; +}; + +#define WG_MAX_TURRET 15 +const BfWGTurretPos WGTurret[WG_MAX_TURRET] = { + { 5391.19f, 3060.8f, 419.616f, 1.69557f }, + { 5266.75f, 2976.5f, 421.067f, 3.20354f }, + { 5234.86f, 2948.8f, 420.88f, 1.61311f }, + { 5323.05f, 2923.7f, 421.645f, 1.5817f }, + { 5363.82f, 2923.87f, 421.709f, 1.60527f }, + { 5264.04f, 2861.34f, 421.587f, 3.21142f }, + { 5264.68f, 2819.78f, 421.656f, 3.15645f }, + { 5322.16f, 2756.69f, 421.646f, 4.69978f }, + { 5363.78f, 2756.77f, 421.629f, 4.78226f }, + { 5236.2f, 2732.68f, 421.649f, 4.72336f }, + { 5265.02f, 2704.63f, 421.7f, 3.12507f }, + { 5350.87f, 2616.03f, 421.243f, 4.72729f }, + { 5390.95f, 2615.5f, 421.126f, 4.6409f }, + { 5148.8f, 2820.24f, 421.621f, 3.16043f }, + { 5147.98f, 2861.93f, 421.63f, 3.18792f }, +}; + + +// Here there is all npc keeper spawn point +#define WG_MAX_KEEP_NPC 39 +const BfWGObjectPosition WGKeepNPC[WG_MAX_KEEP_NPC] = { + // X Y Z O horde alliance + // North East + { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard + { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Plumembrase + { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + // North + { 5373.470215f, 2789.060059f, 409.322998f, 2.600540f, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR, BATTLEFIELD_WG_NPC_KNIGHT_DAMERON }, // Stone Guard Mukar + { 5296.560059f, 2789.870117f, 409.274994f, 0.733038f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, // Voodoo Master Fu'jin + { 5372.670000f, 2786.740000f, 409.442000f, 2.809980f, BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI, BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER }, // Wintergrasp Quartermaster + { 5368.709961f, 2856.360107f, 409.322998f, 2.949610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5367.910156f, 2826.520020f, 409.322998f, 3.333580f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5389.270020f, 2847.370117f, 418.759003f, 3.106690f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5388.560059f, 2834.770020f, 418.759003f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5359.129883f, 2837.989990f, 409.364014f, 4.698930f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh + { 5366.129883f, 2833.399902f, 409.322998f, 3.141590f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath + // X Y Z O horde alliance + // North West + { 5350.680176f, 2917.010010f, 409.274994f, 1.466080f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5335.120117f, 2916.800049f, 409.444000f, 1.500980f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5295.560059f, 2926.669922f, 409.274994f, 0.872665f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, // Stronghoof + { 5371.399902f, 3026.510010f, 409.205994f, 3.250030f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, // Primalist Mulfort + { 5392.123535f, 3031.110352f, 409.187683f, 3.677212f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard + // South + { 5270.060059f, 2847.550049f, 409.274994f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5270.160156f, 2833.479980f, 409.274994f, 3.124140f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5179.109863f, 2837.129883f, 409.274994f, 3.211410f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5179.669922f, 2846.600098f, 409.274994f, 3.089230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5234.970215f, 2883.399902f, 409.274994f, 4.293510f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, // Lieutenant Murp + // X Y Z O horde alliance + // Portal guards (from around the fortress) + { 5319.209473f, 3055.947754f, 409.176636f, 1.020201f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5311.612305f, 3061.207275f, 408.734161f, 0.965223f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5264.713379f, 3017.283447f, 408.479706f, 3.482424f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5269.096191f, 3008.315918f, 408.826294f, 3.843706f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5201.414551f, 2945.096924f, 409.190735f, 0.945592f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5193.386230f, 2949.617188f, 409.190735f, 1.145859f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5148.116211f, 2904.761963f, 409.193756f, 3.368532f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5153.355957f, 2895.501465f, 409.199310f, 3.549174f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5154.353027f, 2787.349365f, 409.250183f, 2.555644f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5150.066406f, 2777.876953f, 409.343903f, 2.708797f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5193.706543f, 2732.882812f, 409.189514f, 4.845073f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5202.126953f, 2737.570557f, 409.189514f, 5.375215f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5269.181152f, 2671.174072f, 409.098999f, 2.457459f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5264.960938f, 2662.332520f, 409.098999f, 2.598828f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5307.111816f, 2616.006836f, 409.095734f, 5.355575f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard +}; + +#define WG_MAX_OUTSIDE_NPC 14 +#define WG_OUTSIDE_ALLIANCE_NPC 7 +const BfWGObjectPosition WGOutsideNPC[WG_MAX_OUTSIDE_NPC] = +{ + { 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 }, + { 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 }, + { 4994.85f, 3660.51f, 359.150f, 2.260f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, 0 }, + { 5015.46f, 3677.11f, 362.970f, 6.009f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, 0 }, + { 5031.12f, 3663.77f, 363.500f, 3.110f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, 0 }, + { 5042.74f, 3675.82f, 363.060f, 3.358f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, 0 }, + { 5014.45f, 3640.87f, 361.390f, 3.280f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, 0 }, + { 5100.07f, 2168.89f, 365.779f, 1.972f, 0, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, + { 5081.70f, 2173.73f, 365.878f, 0.855f, 0, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, + { 5078.28f, 2183.70f, 365.029f, 1.466f, 0, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, + { 5088.49f, 2188.18f, 365.647f, 5.253f, 0, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, + { 5095.67f, 2193.28f, 365.924f, 4.939f, 0, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, + { 5088.61f, 2167.66f, 365.689f, 0.680f, 0, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, + { 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, +}; + +struct BfWGWGTeleporterData +{ + uint32 entry; // gameobject entry + float x; + float y; + float z; + float o; +}; + +#define WG_MAX_TELEPORTER 12 +const BfWGWGTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] = +{ + // Player teleporter + { 190763, 5153.41f, 2901.35f, 409.191f, -0.069f }, + { 190763, 5268.70f, 2666.42f, 409.099f, -0.715f }, + { 190763, 5197.05f, 2944.81f, 409.191f, 2.3387f }, + { 190763, 5196.67f, 2737.34f, 409.189f, -2.932f }, + { 190763, 5314.58f, 3055.85f, 408.862f, 0.5410f }, + { 190763, 5391.28f, 2828.09f, 418.675f, -2.164f }, + { 190763, 5153.93f, 2781.67f, 409.246f, 1.6580f }, + { 190763, 5311.44f, 2618.93f, 409.092f, -2.373f }, + { 190763, 5269.21f, 3013.84f, 408.828f, -1.762f }, + { 190763, 5401.62f, 2853.66f, 418.674f, 2.6354f }, + // Vehicle teleporter + { 192951, 5314.51f, 2703.69f, 408.550f, -0.890f }, + { 192951, 5316.25f, 2977.04f, 408.539f, -0.820f }, +}; + +// ********************************************************* +// **********Tower Element(GameObject,Creature)************* +// ********************************************************* + +struct BfWGTowerData +{ + uint32 towerentry; // Gameobject id of tower + uint8 nbObject; // Number of gameobjects spawned on this point + BfWGObjectPosition GameObject[6]; // Gameobject position and entry (Horde/Alliance) + + // Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage? + uint8 nbCreatureBottom; + BfWGObjectPosition CreatureBottom[9]; + uint8 nbCreatureTop; + BfWGObjectPosition CreatureTop[5]; +}; + +#define WG_MAX_ATTACKTOWERS 3 +// 192414 : 0 in sql, 1 in header +// 192278 : 0 in sql, 3 in header +const BfWGTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { + // West tower + { + 190356, + 6, + { + { 4559.109863f, 3606.219971f, 419.998993f, -1.483530f, 192488, 192501 }, // Flag on tower + { 4539.419922f, 3622.489990f, 420.033997f, -3.071770f, 192488, 192501 }, // Flag on tower + { 4555.259766f, 3641.649902f, 419.973999f, 1.675510f, 192488, 192501 }, // Flag on tower + { 4574.870117f, 3625.909912f, 420.079010f, 0.080117f, 192488, 192501 }, // Flag on tower + { 4433.899902f, 3534.139893f, 360.274994f, -1.850050f, 192269, 192278 }, // Flag near workshop + { 4572.930176f, 3475.520020f, 363.009003f, 1.42240f, 192269, 192278 } // Flag near bridge + }, + 1, + { + { 4418.688477f, 3506.251709f, 358.975494f, 4.293305f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + } + }, + + // South Tower + { + 190357, + 5, + { + { 4416.000000f, 2822.669922f, 429.851013f, -0.017452f, 192488, 192501 }, // Flag on tower + { 4398.819824f, 2804.699951f, 429.791992f, -1.588250f, 192488, 192501 }, // Flag on tower + { 4387.620117f, 2719.570068f, 389.934998f, -1.544620f, 192366, 192414 }, // Flag near tower + { 4464.120117f, 2855.449951f, 406.110992f, 0.829032f, 192366, 192429 }, // Flag near tower + { 4526.459961f, 2810.179932f, 391.200012f, -2.993220f, 192269, 192278 }, // Flag near bridge + { 0, 0, 0, 0, 0, 0 }, + }, + 6, + { + { 4452.859863f, 2808.870117f, 402.604004f, 6.056290f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4455.899902f, 2835.958008f, 401.122559f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4412.649414f, 2953.792236f, 374.799957f, 0.980838f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard + { 4362.089844f, 2811.510010f, 407.337006f, 3.193950f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4412.290039f, 2753.790039f, 401.015015f, 5.829400f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4421.939941f, 2773.189941f, 400.894989f, 5.707230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + }, + + // East Tower + { + 190358, + 4, + { + { 4466.790039f, 1960.420044f, 459.144012f, 1.151920f, 192488, 192501 }, // Flag on tower + { 4475.350098f, 1937.030029f, 459.070007f, -0.43633f, 192488, 192501 }, // Flag on tower + { 4451.759766f, 1928.099976f, 459.075989f, -2.00713f, 192488, 192501 }, // Flag on tower + { 4442.990234f, 1951.900024f, 459.092987f, 2.740160f, 192488, 192501 }, // Flag on tower + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + 5, + { + { 4501.060059f, 1990.280029f, 431.157013f, 1.029740f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4463.830078f, 2015.180054f, 430.299988f, 1.431170f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4494.580078f, 1943.760010f, 435.627014f, 6.195920f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4450.149902f, 1897.579956f, 435.045013f, 4.398230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4428.870117f, 1906.869995f, 432.648010f, 3.996800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + }, +}; + +struct BfWGTurretData +{ + uint32 towerentry; + uint8 nbTurretBottom; + BfWGTurretPos TurretBottom[5]; + uint8 nbTurretTop; + BfWGTurretPos TurretTop[5]; +}; + +#define WG_MAX_TOWERTURRET 7 + +const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] = +{ + { + 190221, + 0, + { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 5255.88f, 3047.63f, 438.499f, 3.13677f }, + { 5280.9f, 3071.32f, 438.499f, 1.62879f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190373, + 0, + { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 5138.59f, 2935.16f, 439.845f, 3.11723f }, + { 5163.06f, 2959.52f, 439.846f, 1.47258f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190377, + 0, + { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 5163.84f, 2723.74f, 439.844f, 1.3994f }, + { 5139.69f, 2747.4f, 439.844f, 3.17221f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190378, + 0, + { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 5278.21f, 2607.23f, 439.755f, 4.71944f }, + { 5255.01f, 2631.98f, 439.755f, 3.15257f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190356, + 2, + { + {4537.380371f, 3599.531738f, 402.886993f, 3.998462f}, + {4581.497559f, 3604.087158f, 402.886963f, 5.651723f}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + }, + 2, + { + {4469.448242f, 1966.623779f, 465.647217f, 1.153573f}, + {4581.895996f, 3626.438477f, 426.539062f, 0.117806f}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + }, + }, + { + 190357, + 2, + { + { 4421.640137f, 2799.935791f, 412.630920f, 5.459298f }, + { 4420.263184f, 2845.340332f, 412.630951f, 0.742197f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 3, + { + { 4423.430664f, 2822.762939f, 436.283142f, 6.223487f }, + { 4397.825684f, 2847.629639f, 436.283325f, 1.579430f }, + { 4398.814941f, 2797.266357f, 436.283051f, 4.703747f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190358, + 2, + { + { 4448.138184f, 1974.998779f, 441.995911f, 1.967238f }, + { 4448.713379f, 1955.148682f, 441.995178f, 0.380733f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 4469.448242f, 1966.623779f, 465.647217f, 1.153573f }, + { 4481.996582f, 1933.658325f, 465.647186f, 5.873029f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, +}; + +// ********************************************************* +// *****************WorkShop Data & Element***************** +// ********************************************************* + +struct BfWGWorkShopDataBase +{ + uint32 entry; + uint32 worldstate; + uint32 type; + uint32 nameid; + BfWGObjectPosition CapturePoint; + uint8 nbcreature; + BfWGObjectPosition CreatureData[10]; + uint8 nbgob; + BfWGObjectPosition GameObjectData[10]; +}; +// 6 engineer per faction in sql / 6 engineer per faction in header +#define WG_MAX_WORKSHOP 6 +const BfWGWorkShopDataBase WGWorkShopDataBase[WG_MAX_WORKSHOP] = { + { + 192031, + 3701, + BATTLEFIELD_WG_WORKSHOP_NE, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE, + { 4949.344238f, 2432.585693f, 320.176971f, 1.386214f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE }, + 1, + { + { 4939.759766f, 2389.060059f, 326.153015f, 3.263770f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }, + 6, + { + { 4778.189f, 2438.060f, 345.644f, -2.940f, 192280, 192274 }, + { 5024.569f, 2532.750f, 344.023f, -1.937f, 192280, 192274 }, + { 4811.399f, 2441.899f, 358.207f, -2.003f, 192435, 192406 }, + { 4805.669f, 2407.479f, 358.191f, 1.780f, 192435, 192406 }, + { 5004.350f, 2486.360f, 358.449f, 2.172f, 192435, 192406 }, + { 4983.279f, 2503.090f, 358.177f, -0.427f, 192435, 192406 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192030, + 3700, + BATTLEFIELD_WG_WORKSHOP_NW, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW, + { 4948.524414f, 3342.337891f, 376.875366f, 4.400566f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW }, + 1, + { + { 4964.890137f, 3383.060059f, 382.911011f, 6.126110f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }, + 4, + { + { 5006.339f, 3280.399f, 371.162f, 2.225f, 192280, 192274 }, + { 5041.609f, 3294.399f, 382.149f, -1.631f, 192434, 192406 }, + { 4857.970f, 3335.439f, 368.881f, -2.945f, 192280, 192274 }, + { 4855.629f, 3297.620f, 376.739f, -3.132f, 192435, 192406 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192033, + 3703, + BATTLEFIELD_WG_WORKSHOP_SE, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE, + { 4398.076660f, 2356.503662f, 376.190491f, 0.525406f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE }, + 9, + { + { 4417.919922f, 2331.239990f, 370.919006f, 5.846850f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4418.609863f, 2355.290039f, 372.490997f, 6.021390f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4391.669922f, 2300.610107f, 374.743011f, 4.921830f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4349.120117f, 2299.280029f, 374.743011f, 4.904380f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4333.549805f, 2333.909912f, 376.156006f, 0.973007f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4413.430176f, 2393.449951f, 376.359985f, 1.064650f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4388.129883f, 2411.979980f, 374.743011f, 1.640610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4349.540039f, 2411.260010f, 374.743011f, 2.059490f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4357.669922f, 2357.989990f, 382.006989f, 1.675520f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 } + }, + 2, + { + { 4417.250f, 2301.139f, 377.213f, 0.026f, 192435, 192406 }, + { 4417.939f, 2324.810f, 371.576f, 3.080f, 192280, 192274 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192032, + 3702, + BATTLEFIELD_WG_WORKSHOP_SW, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW, + { 4390.776367f, 3304.094482f, 372.429077f, 6.097023f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW }, + 9, + { + { 4425.290039f, 3291.510010f, 370.773987f, 0.122173f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4424.609863f, 3321.100098f, 369.800995f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4392.399902f, 3354.610107f, 369.597992f, 1.570800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4370.979980f, 3355.020020f, 371.196991f, 1.675520f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4394.660156f, 3231.989990f, 369.721985f, 4.625120f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4366.979980f, 3233.560059f, 371.584991f, 4.939280f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4337.029785f, 3261.659912f, 373.524994f, 3.263770f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4323.779785f, 3287.100098f, 378.894989f, 2.862340f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4354.149902f, 3312.820068f, 378.045990f, 1.675520f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 } + }, + 3, + { + { 4438.299f, 3361.080f, 371.567f, -0.017f, 192435, 192406 }, + { 4448.169f, 3235.629f, 370.411f, -1.562f, 192435, 192406 }, + { 4424.149f, 3286.540f, 371.545f, 3.124f, 192280, 192274 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192028, + 3698, + BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, + 0, + { 0, 0, 0, 0, 0, 0 }, + 1, + { + { 5392.910156f, 2975.260010f, 415.222992f, 4.555310f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192029, + 3699, + BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, + 0, + { 0, 0, 0, 0, 0, 0 }, + 1, + { + { 5391.609863f, 2707.719971f, 415.050995f, 4.555310f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + } +}; + +// ******************************************************************** +// * Structs using for Building,Graveyard,Workshop * +// ******************************************************************** +// Structure for different buildings that can be destroyed during battle +struct BfWGGameObjectBuilding +{ + BfWGGameObjectBuilding(BattlefieldWG *WG) + { + m_WG = WG; + m_Team = 0; + m_Build = NULL; + m_Type = 0; + m_WorldState = 0; + m_State = 0; + m_NameId = 0; + } + + // the team that controls this point + uint8 m_Team; + + // WG object + BattlefieldWG *m_WG; + + // Linked gameobject + GameObject *m_Build; + + // eWGGameObjectBuildingType + uint32 m_Type; + + // WorldState + uint32 m_WorldState; + + // eWGGameObjectState + uint32 m_State; + + // Name id for warning text + uint32 m_NameId; + + // GameObject associations + GameObjectSet m_GameObjectList[2]; + + // Creature associations + GuidSet m_CreatureBottomList[2]; + GuidSet m_CreatureTopList[2]; + GuidSet m_TurretBottomList; + GuidSet m_TurretTopList; + + void Rebuild() + { + switch (m_Type) + { + case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: + case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: + case BATTLEFIELD_WG_OBJECTTYPE_DOOR: + case BATTLEFIELD_WG_OBJECTTYPE_WALL: + m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's + break; + case BATTLEFIELD_WG_OBJECTTYPE_TOWER: + m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's + break; + default: + m_Team = TEAM_NEUTRAL; + break; + } + + // Rebuild gameobject + m_Build->Rebuild(); + + // Update worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); + m_WG->SendUpdateWorldState(m_WorldState, m_State); + UpdateCreatureAndGo(); + m_Build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]); + } + + // Called when associated gameobject is damaged + void Damaged() + { + // Update worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE - (m_Team * 3); + m_WG->SendUpdateWorldState(m_WorldState, m_State); + + // Send warning message + if (m_NameId) // tower damage + name + m_WG->SendWarningToAllInZone(m_NameId); + + for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER) + m_WG->AddDamagedTower(m_WG->GetDefenderTeam()); + else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER) + m_WG->AddDamagedTower(m_WG->GetAttackerTeam()); + } + + // Called when associated gameobject is destroyed + void Destroyed() + { + // Update worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY - (m_Team * 3); + m_WG->SendUpdateWorldState(m_WorldState, m_State); + + // Warn players + if (m_NameId) + m_WG->SendWarningToAllInZone(m_NameId); + + switch (m_Type) + { + // Inform the global wintergrasp script of the destruction of this object + case BATTLEFIELD_WG_OBJECTTYPE_TOWER: + case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: + m_WG->AddBrokenTower(TeamId(m_Team)); + break; + case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: + m_WG->AllowToClickOnOrb(true); + if (m_WG->GetRelic()) + m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + else + sLog->outError("BATTLEFIELD: WG: Relic cant be clickable"); + break; + } + + m_WG->BrokenWallOrTower(TeamId(m_Team)); + } + + void Init(GameObject *go, uint32 type, uint32 worldstate, uint32 nameid) + { + // GameObject associated to object + m_Build = go; + + // Type of building (WALL/TOWER/DOOR) + m_Type = type; + + // WorldState for client (icon on map) + m_WorldState = worldstate; + + // NameId for Warning text + m_NameId = nameid; + + switch (m_Type) + { + case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: + case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: + case BATTLEFIELD_WG_OBJECTTYPE_DOOR: + case BATTLEFIELD_WG_OBJECTTYPE_WALL: + m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's + break; + case BATTLEFIELD_WG_OBJECTTYPE_TOWER: + m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's + break; + default: + m_Team = TEAM_NEUTRAL; + break; + } + + m_State = sWorld->getWorldState(m_WorldState); + if (m_Build) + { + switch (m_State) + { + case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT: + case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT: + m_Build->Rebuild(); + break; + case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY: + case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY: + m_Build->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); + m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED); + m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.destroyedDisplayId); + break; + case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE: + case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE: + m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); + m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.damagedDisplayId); + break; + } + } + + int32 towerid = -1; + switch (go->GetEntry()) + { + case 190221: + towerid = 0; + break; + case 190373: + towerid = 1; + break; + case 190377: + towerid = 2; + break; + case 190378: + towerid = 3; + break; + case 190356: + towerid = 4; + break; + case 190357: + towerid = 5; + break; + case 190358: + towerid = 6; + break; + } + + if (towerid > 3) + { + // Spawn associate gameobjects + for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++) + { + BfWGObjectPosition gob = AttackTowers[towerid - 4].GameObject[i]; + if (GameObject *go = m_WG->SpawnGameObject(gob.entryh, gob.x, gob.y, gob.z, gob.o)) + m_GameObjectList[TEAM_HORDE].insert(go); + if (GameObject *go = m_WG->SpawnGameObject(gob.entrya, gob.x, gob.y, gob.z, gob.o)) + m_GameObjectList[TEAM_ALLIANCE].insert(go); + } + + // Spawn associate npc bottom + for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++) + { + BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureBottom[i]; + if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE)) + m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID()); + if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE)) + m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID()); + } + + // Spawn associate npc top + for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++) + { + BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureTop[i]; + if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE)) + m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID()); + if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE)) + m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID()); + } + } + + if (towerid >= 0) + { + // Spawn Turret bottom + for (uint8 i = 0; i < TowerTurret[towerid].nbTurretBottom; i++) + { + BfWGTurretPos turretpos = TowerTurret[towerid].TurretBottom[i]; + if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0))) + { + m_TurretBottomList.insert(turret->GetGUID()); + switch (go->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->HideNpc(turret); + } + } + + // Spawn Turret top + for (uint8 i = 0; i < TowerTurret[towerid].nbTurretTop; i++) + { + BfWGTurretPos turretpos = TowerTurret[towerid].TurretTop[i]; + if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0))) + { + m_TurretTopList.insert(turret->GetGUID()); + switch (go->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->HideNpc(turret); + } + } + UpdateCreatureAndGo(); + } + } + + void UpdateCreatureAndGo() + { + for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->ShowNpc(creature, true); + + for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->ShowNpc(creature, true); + + for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetAttackerTeam()].begin(); itr != m_GameObjectList[m_WG->GetAttackerTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + } + + void UpdateTurretAttack(bool disable) + { + for (GuidSet::const_iterator itr = m_TurretBottomList.begin(); itr != m_TurretBottomList.end(); ++itr) + { + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature *creature = unit->ToCreature()) + { + if (m_Build) + { + if (disable) + { + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->HideNpc(creature); + } + else + { + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->ShowNpc(creature, true); + } + } + } + } + } + + for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) + { + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature *creature = unit->ToCreature()) + { + if (m_Build) + { + if (disable) + { + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->HideNpc(creature); + } + else + { + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->ShowNpc(creature, true); + } + } + } + } + } + } + + void Save() + { + sWorld->setWorldState(m_WorldState, m_State); + } +}; + +// Structure for the 6 workshop +struct BfWGWorkShopData +{ + BattlefieldWG* m_WG; // Object du joug + GameObject* m_Build; + uint32 m_Type; + uint32 m_State; // For worldstate + uint32 m_WorldState; + uint32 m_TeamControl; // Team witch control the workshop + GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point + GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point + uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message + + BfWGWorkShopData(BattlefieldWG * WG) + { + m_WG = WG; + m_Build = NULL; + m_Type = 0; + m_State = 0; + m_WorldState = 0; + m_TeamControl = 0; + m_NameId = 0; + } + + // Spawning associate creature and store them + void AddCreature(BfWGObjectPosition obj) + { + if (Creature *creature = m_WG->SpawnCreature(obj.entryh, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE)) + m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID()); + + if (Creature *creature = m_WG->SpawnCreature(obj.entrya, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE)) + m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID()); + + } + + // Spawning Associate gameobject and store them + void AddGameObject(BfWGObjectPosition obj) + { + if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryh, obj.x, obj.y, obj.z, obj.o)) + m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject); + if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entrya, obj.x, obj.y, obj.z, obj.o)) + m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject); + } + + // Init method, setup variable + void Init(uint32 worldstate, uint32 type, uint32 nameid) + { + m_WorldState = worldstate; + m_Type = type; + m_NameId = nameid; + } + + // Called on change faction in CapturePoint class + void ChangeControl(uint8 team, bool init /* for first call in setup */ ) + { + switch (team) + { + case BATTLEFIELD_WG_TEAM_NEUTRAL: + { + // Send warning message to all player for inform a faction attack a workshop + // alliance / horde attacking workshop + m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1); + break; + } + case BATTLEFIELD_WG_TEAM_ALLIANCE: + { + // Show Alliance creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->ShowNpc(creature, creature->GetEntry() != 30499); + + // Hide Horde creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + // Show Alliance gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + + // Hide Horde gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + + // Updating worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT; + m_WG->SendUpdateWorldState(m_WorldState, m_State); + + // Warning message + if (!init) // workshop taken - alliance + m_WG->SendWarningToAllInZone(m_NameId); + + // Found associate graveyard and update it + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (m_WG && m_WG->GetGraveYardById(m_Type)) + m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_ALLIANCE); + + m_TeamControl = team; + break; + } + case BATTLEFIELD_WG_TEAM_HORDE: + { + // Show Horde creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->ShowNpc(creature, creature->GetEntry() != 30400); + + // Hide Alliance creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + // Hide Alliance gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + // Show Horde gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + + // Update worlstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT; + m_WG->SendUpdateWorldState(m_WorldState, m_State); + + // Warning message + if (!init) // workshop taken - horde + m_WG->SendWarningToAllInZone(m_NameId + 1); + + // Update graveyard control + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (m_WG && m_WG->GetGraveYardById(m_Type)) + m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_HORDE); + + m_TeamControl = team; + break; + } + } + if (!init) + m_WG->UpdateCounterVehicle(false); + } + + void UpdateGraveYardAndWorkshop() + { + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + m_WG->GetGraveYardById(m_Type)->ChangeControl(TeamId(m_TeamControl)); + else + ChangeControl(m_WG->GetDefenderTeam(), true); + } + + void Save() + { + sWorld->setWorldState(m_WorldState, m_State); + } +}; + +#endif -- cgit v1.2.3 From 4ac5301c9faa0e1260ee86aec86c4f19f5966b01 Mon Sep 17 00:00:00 2001 From: Imprtat Date: Tue, 28 Jun 2011 13:34:04 +0300 Subject: Core/Battlefield: removed "magic numbers" --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 25 ++++++---------------- src/server/game/Battlefield/Zones/BattlefieldWG.h | 10 ++++++--- 2 files changed, 14 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 977048361be..2cfc262371d 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -482,10 +482,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) player->RewardHonor(NULL, 1, WinHonor); RewardMarkOfHonor(player, 2); } - if (player->GetTeamId() == TEAM_HORDE) - IncrementQuest(player, 13183, true); - else - IncrementQuest(player, 13181, true); + IncrementQuest(player, WGQuest[killer->GetTeamId()][1], true); // Send Wintergrasp victory achievement DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); // Award achievement for succeeding in Wintergrasp in 10 minutes or less @@ -939,12 +936,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) { if (Player* player = sObjectMgr->GetPlayer((*p_itr))) - { - if (player->GetTeamId() == TEAM_ALLIANCE) - IncrementQuest(player, 13222); - else - IncrementQuest(player, 13223); - } + IncrementQuest(player, WGQuest[killer->GetTeamId()][2], true); } } } @@ -968,10 +960,7 @@ void BattlefieldWG::AddBrokenTower(TeamId team) if (Player* player = sObjectMgr->GetPlayer((*itr))) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); - if (player->GetTeamId() == TEAM_HORDE) - IncrementQuest(player, 13539, true); - else - IncrementQuest(player, 13538, true); + IncrementQuest(player, WGQuest[killer->GetTeamId()][3], true); DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); } // If the threw south tower is destroy @@ -1043,10 +1032,10 @@ void BattlefieldWG::AddDamagedTower(TeamId team) // Update vehicle count WorldState to player void BattlefieldWG::UpdateVehicleCountWG() { - SendUpdateWorldState(3490, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); - SendUpdateWorldState(3491, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); - SendUpdateWorldState(3680, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); - SendUpdateWorldState(3681, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); } void BattlefieldWG::UpdateTenacity() diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index ffde7cb060c..1e3d7a93d94 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -134,9 +134,13 @@ enum WB_ACHIEVEMENTS enum eWGWorldStates { - BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801, - BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, - BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, + BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490, + BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491, + BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A = 3680, + BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A = 3681, + BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801, + BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, + BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, }; /*######################### *####### Graveyards ######* -- cgit v1.2.3 From d45b66ce22b5fcb3b3ee31770510d3b309c071b9 Mon Sep 17 00:00:00 2001 From: Imprtat Date: Tue, 28 Jun 2011 13:44:53 +0300 Subject: Core/Battlefield: missed changes --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 2cfc262371d..17e28add397 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -898,10 +898,10 @@ WorldPacket BattlefieldWG::BuildInitWorldStates() for (uint32 i = 0; i < 2; ++i) data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000)); - data << uint32(3490) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); - data << uint32(3491) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H); - data << uint32(3680) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); - data << uint32(3681) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) { @@ -936,7 +936,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) { if (Player* player = sObjectMgr->GetPlayer((*p_itr))) - IncrementQuest(player, WGQuest[killer->GetTeamId()][2], true); + IncrementQuest(player, WGQuest[killer->GetTeamId()][2], true); } } } -- cgit v1.2.3 From c736dc3e34a695e9f141bb69d2d819e64d9db42b Mon Sep 17 00:00:00 2001 From: Imprtat Date: Tue, 28 Jun 2011 17:25:42 +0300 Subject: Core/Battlefield: fix copy/paste typo in prev commits --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 17e28add397..0c44ea766a0 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -482,7 +482,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) player->RewardHonor(NULL, 1, WinHonor); RewardMarkOfHonor(player, 2); } - IncrementQuest(player, WGQuest[killer->GetTeamId()][1], true); + IncrementQuest(player, WGQuest[player->GetTeamId()][1], true); // Send Wintergrasp victory achievement DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); // Award achievement for succeeding in Wintergrasp in 10 minutes or less @@ -712,7 +712,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) if (player->GetDistance2d(killer) < 40) - IncrementQuest(player, IncrementQuest(killer, WGQuest[killer->GetTeamId()][0])); + IncrementQuest(player, WGQuest[player->GetTeamId()][0]); } } } @@ -936,7 +936,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) { if (Player* player = sObjectMgr->GetPlayer((*p_itr))) - IncrementQuest(player, WGQuest[killer->GetTeamId()][2], true); + IncrementQuest(player, WGQuest[player->GetTeamId()][2], true); } } } @@ -960,7 +960,7 @@ void BattlefieldWG::AddBrokenTower(TeamId team) if (Player* player = sObjectMgr->GetPlayer((*itr))) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); - IncrementQuest(player, WGQuest[killer->GetTeamId()][3], true); + IncrementQuest(player, WGQuest[player->GetTeamId()][3], true); DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); } // If the threw south tower is destroy -- cgit v1.2.3 From afd9c28d8e69885e9e58e7241d9ea6d21a7b294d Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 3 Jul 2011 19:18:20 +0100 Subject: - Rename scriptnames to keep naming consistent; - Template updates and spells to WG vehicles; - Cleanup SQL files a bit. --- Wintergrasp_temp/Gossips.sql | 62 ++-- Wintergrasp_temp/Misc.sql | 24 +- Wintergrasp_temp/Quests.sql | 24 +- Wintergrasp_temp/SAI.sql | 3 + Wintergrasp_temp/Scriptnames.sql | 20 +- Wintergrasp_temp/Spells.txt | 8 +- Wintergrasp_temp/Strings.sql | 13 +- Wintergrasp_temp/Template_update.sql | 66 +++-- src/server/scripts/Northrend/wintergrasp.cpp | 429 +++++++++++++++++++++++++++ 9 files changed, 545 insertions(+), 104 deletions(-) create mode 100644 src/server/scripts/Northrend/wintergrasp.cpp (limited to 'src') diff --git a/Wintergrasp_temp/Gossips.sql b/Wintergrasp_temp/Gossips.sql index 90f903b7717..3f9ce230d5f 100644 --- a/Wintergrasp_temp/Gossips.sql +++ b/Wintergrasp_temp/Gossips.sql @@ -1,53 +1,54 @@ --- Gossip Menu insert from sniff +-- Template gossip updates +UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; +UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; + +-- Gossip Menu DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13759; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9904,13759); DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13761; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9904,13761); DELETE FROM `gossip_menu` WHERE `entry`=9923 AND `text_id`=14172; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9923,14172); DELETE FROM `gossip_menu` WHERE `entry`=10229 AND `text_id`=14221; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (10229,14221); +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(9904,13759), +(9904,13761), +(9923,14172), +(10229,14221); --- Creature Gossip_menu_option Update from sniff -DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9904); +-- Gossip Menu Option +DELETE FROM `gossip_menu_option` WHERE `menu_id`=9904; +DELETE FROM `gossip_menu_option` WHERE `menu_id`=10129 AND `id` IN (2,4); INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES (9904,0,0, 'I would like to build a catapult.',1,1,0,0,0,0, ''), (9904,1,0, 'I would like to build a demolisher.',1,1,0,0,0,0, ''), -(9904,2,0, 'I would like to build a siege engine.',1,1,0,0,0,0, ''); +(9904,2,0, 'I would like to build a siege engine.',1,1,0,0,0,0, ''), +(10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''), +(10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, ''); + +-- Conditions -- Add gossip_menu condition for 9904 Horde DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9904; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9923; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9904; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9923; INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES (14,9904,13759,0,1,33280), -- Must have Rank 1: Corporal (14,9904,13759,1,1,55629), -- Or must have Rank 2: First Lieutenant (14,9904,13761,0,11,33280), -- Must not have Rank 1: Corporal -(14,9904,13761,0,11,55629); -- Must not have Rank 2: First Lieutenant +(14,9904,13761,0,11,55629), -- Must not have Rank 2: First Lieutenant -- Add gossip_menu condition for 9923 Alliance -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9923; -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES (14,9923,13798,0,1,33280), -- Must have Rank 1: Corporal (14,9923,13798,1,1,55629), -- Or must have Rank 2: First Lieutenant (14,9923,14172,0,11,33280), -- Must not have Rank 1: Corporal -(14,9923,14172,0,11,55629); -- Must not have Rank 2: First Lieutenant +(14,9923,14172,0,11,55629), -- Must not have Rank 2: First Lieutenant -- Add conditions to gossip options horde -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9904; -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`) VALUES -(15,9904,0,0,1,33280,0), -- Must have reached Rank 1: Corporal -(15,9904,0,1,1,55629,0), -- Or must have reached Rank 2: First Lieutenant -(15,9904,1,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant -(15,9904,2,0,1,55629,0); -- Must have reached Rank 2: First Lieutenant +(15,9904,0,0,1,33280), -- Must have reached Rank 1: Corporal +(15,9904,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant +(15,9904,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant +(15,9904,2,0,1,55629), -- Must have reached Rank 2: First Lieutenant -- Add conditions to gossip options alliance -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9923; -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`) VALUES -(15,9923,0,0,1,33280,0), -- Must have reached Rank 1: Corporal -(15,9923,0,1,1,55629,0), -- Or must have reached Rank 2: First Lieutenant -(15,9923,1,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant -(15,9923,2,0,1,55629,0); -- Must have reached Rank 2: First Lieutenant - --- Add Missing Horde Spirt Healer options Wintergrasp -DELETE FROM `gossip_menu_option` WHERE `menu_id`=10129 AND `id` IN (2,4); -INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES -(10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''), -(10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, ''); +(15,9923,0,0,1,33280), -- Must have reached Rank 1: Corporal +(15,9923,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant +(15,9923,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant +(15,9923,2,0,1,55629); -- Must have reached Rank 2: First Lieutenant /* -- Add scripts to Wintergrasp spirit guide gossip -- !!!should be scripted by SAI or cpp script!!! @@ -85,4 +86,3 @@ INSERT INTO `gossip_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`) VAL (990402,0,33,0,0),(990402,0,15,61408,1), (990403,0,33,0,0),(990403,0,15,56661,1); */ - diff --git a/Wintergrasp_temp/Misc.sql b/Wintergrasp_temp/Misc.sql index 42817764fef..d68853b6c04 100644 --- a/Wintergrasp_temp/Misc.sql +++ b/Wintergrasp_temp/Misc.sql @@ -3,10 +3,10 @@ DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=54640; INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES (54640,54643,0, 'WG teleporter'); --- 58730 Restricted Flight Area (Wintergrasp Eject) -DELETE FROM `spell_area` WHERE `spell`=58730; +-- Spell area +DELETE FROM `spell_area` WHERE `spell` IN (58730,57940); INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES -(58730,4581,0,0,0,0,0,2,1), +(58730,4581,0,0,0,0,0,2,1), -- Restricted Flight Area (Wintergrasp Eject) (58730,4539,0,0,0,0,0,2,1), (58730,4197,0,0,0,0,0,2,1), (58730,4585,0,0,0,0,0,2,1), @@ -16,12 +16,8 @@ INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`que (58730,4589,0,0,0,0,0,2,1), (58730,4575,0,0,0,0,0,2,1), (58730,4538,0,0,0,0,0,2,1), -(58730,4577,0,0,0,0,0,2,1); - --- 57940 Essence of Wintergrasp -DELETE FROM `spell_area` WHERE `spell`=57940; -INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES -(57940,65,0,0,0,0,0,2,1), +(58730,4577,0,0,0,0,0,2,1), +(57940,65,0,0,0,0,0,2,1), -- Essence of Wintergrasp (57940,66,0,0,0,0,0,2,1), (57940,67,0,0,0,0,0,2,1), (57940,206,0,0,0,0,0,2,1), @@ -48,12 +44,12 @@ INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`que (57940,4494,0,0,0,0,0,2,1), (57940,4603,0,0,0,0,0,2,1); --- 49899 Activate Robotic Arms +-- Spell scripts DELETE FROM `spell_scripts` WHERE `id`=49899; INSERT INTO `spell_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES -(49899,0,1,406,0,0,0,0,0,0); +(49899,0,1,406,0,0,0,0,0,0); -- Activate Robotic Arms --- Add Spell Target position for Wintergrasp Graveyard spells +-- Spell Target position for Wintergrasp Graveyard spells DELETE FROM `spell_target_position` WHERE `id` IN (59760,59762,59763,59765,59766,59767,59769); INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES (59760,571,5537.986,2897.493,517.057,4.819249), -- Teleport: Fortress Graveyard @@ -63,7 +59,3 @@ INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`targ (59766,571,4331.716,3235.695,390.251,0.008500), -- Teleport: Westspark Factory Graveyard "area 4611" (59767,571,4314.648,2408.522,392.642,6.268125), -- Teleport: Eastspark Factory Graveyard "area 4612" (59769,571,5140.790,2179.120,390.950,1.972220); -- Teleport: Alliance Landing Zone - - - - diff --git a/Wintergrasp_temp/Quests.sql b/Wintergrasp_temp/Quests.sql index 277f9ebb038..75f2e931806 100644 --- a/Wintergrasp_temp/Quests.sql +++ b/Wintergrasp_temp/Quests.sql @@ -1,14 +1,16 @@ -- Wintergrasp Quests - Horde -UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `entry` IN (13180, 13178); -UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `entry` IN (13185, 13223); -UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `entry` IN (13192, 13202); -UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `entry` IN (13193, 13199); -UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `entry` IN (13200, 13191); -UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `entry` IN (13201, 13194); +UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `entry` IN (13180,13178); -- Slay them all! +UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `entry` IN (13185,13223); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `entry` IN (13201,13194); -- Healing with Roses +UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `entry` IN (13193,13199); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `entry` IN (13192,13202); -- Warding/Jinxing the Walls +UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `entry` IN (13200,13191); -- Fueling the Demolishers -- Wintergrasp Quests - Alliance -UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `entry` IN (13179, 13177); -UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `entry` IN (13186, 13222); -UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `entry` IN (13195, 13156); -UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `entry` IN (13196, 13154); -UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `entry` IN (13198, 13153); \ No newline at end of file +UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `entry` IN (13179,13177); -- No Mercy for the Merciless +UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `entry` IN (13186,13222); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `entry` IN (13195,13156); -- A Rare Herb +UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `entry` IN (13196,13154); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `entry` IN (13198,13153); -- Warding the Warriors + +-- Note: The offered quests (they are in pairs) depend on who controls the keep. npc_wg_quest_giver does that already? diff --git a/Wintergrasp_temp/SAI.sql b/Wintergrasp_temp/SAI.sql index 098565ce016..71d1b8de81c 100644 --- a/Wintergrasp_temp/SAI.sql +++ b/Wintergrasp_temp/SAI.sql @@ -1,6 +1,9 @@ +/* +These two npcs already have a scriptname assigned (npc_wg_spiritguide). That core script should make these npcs cast the 22011 spell. -- Spirit healers SAI UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (31841,31842); DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (31841,31842); INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES (31841,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'cast Spirit Heal Channel every 30 sec'), (31842,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Dwarven Spirit Guide - cast Spirit Heal Channel every 30 sec'); +*/ diff --git a/Wintergrasp_temp/Scriptnames.sql b/Wintergrasp_temp/Scriptnames.sql index f8eb806fc6d..f9a121b3e78 100644 --- a/Wintergrasp_temp/Scriptnames.sql +++ b/Wintergrasp_temp/Scriptnames.sql @@ -1,14 +1,14 @@ --- Wintergrasp queue template NPCs -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_dalaran_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); +-- Wintergrasp queue template NPCs script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); -- --- Wintergrasp spiritguide NPC script -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_spiritguide' WHERE `entry` IN (31841,31842); +-- Wintergrasp spirit guide NPCs script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry` IN (31841,31842); -- Taunka Spirit Guide, Dwarven Spirit Guide --- Wintergrasp demolisher engineer NPC script -UPDATE `creature_template` SET `ScriptName`= 'npc_demolisher_engineerer' WHERE `entry` IN (30400,30499); +-- Wintergrasp demolisher engineer NPCs script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_demolisher_engineer' WHERE `entry` IN (30400,30499); -- Goblin Mechanic, Gnomish Engineer --- Wintergrasp vehicle teleport -UPDATE `gameobject_template` SET `ScriptName`= 'go_wintergrasp_teleporter' WHERE `entry`=192951; +-- Wintergrasp Questgiver NPCs script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` IN (31054,31052,31091,31036,31101,31107,31053,31051,31153,31151,31102,31106); --- Wintergrasp Questgiver NPCs - requires binding to Wintergrasp questgiver script -UPDATE `creature_template` SET `ScriptName`= 'npc_wintergrasp_quest_giver' WHERE `entry` IN (31054, 31052, 31091, 31036, 31101, 31107, 31053, 31051, 31153, 31151, 31102, 31106); +-- Wintergrasp vehicle teleport GO script +UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter diff --git a/Wintergrasp_temp/Spells.txt b/Wintergrasp_temp/Spells.txt index b70507e700e..583e46db04e 100644 --- a/Wintergrasp_temp/Spells.txt +++ b/Wintergrasp_temp/Spells.txt @@ -20,4 +20,10 @@ Wintergrasp Vehicle On spawn entries: 28312,27881,28094,32627 set x,y,z,o to nearest trigger entry: 23472 make player cast 60968 on vehicle aura 14267 on self if player is horde -aura 14268 on self if player is alliance \ No newline at end of file +aura 14268 on self if player is alliance + +Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns): +61178 (Grab Passenger) (Catapult, Siege Engine... NOT tower cannons) +56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons) +14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons) +14267 (Horde Flag) \ No newline at end of file diff --git a/Wintergrasp_temp/Strings.sql b/Wintergrasp_temp/Strings.sql index 43038cc9fba..090c5350c74 100644 --- a/Wintergrasp_temp/Strings.sql +++ b/Wintergrasp_temp/Strings.sql @@ -47,15 +47,16 @@ INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1` (0, -1850504, 'Guide me to the Eastspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), (0, -1850505, 'Guide me back to the Horde landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), (0, -1850506, 'Guide me back to the Alliance landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850507, 'Se mettre dans la file pour le Joug-d''hiver.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''); -- (Needs proper english text) +(0, -1850507, 'Se mettre dans la file pour le Joug-d''hiver.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''); -- (Needs proper english text, maybe "Get in the queue for Wintergrasp."?) -- New support-commands for battlefield class DELETE FROM `command` WHERE name IN ('bf start', 'bf stop', 'bf enable', 'bf switch', 'bf timer'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf start',3,'Syntaxe: .bf start #battleid'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf stop',3,'Syntaxe: .bf stop #battleid'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf enable',3,'Syntaxe: .bf enable #battleid'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf switch',3,'Syntaxe: .bf switch #battleid'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf timer',3,'Syntaxe: .bf timer #battleid #timer'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('bf start',3,'Syntax: .bf start #battleid'), +('bf stop',3,'Syntax: .bf stop #battleid'), +('bf enable',3,'Syntax: .bf enable #battleid'), +('bf switch',3,'Syntax: .bf switch #battleid'), +('bf timer',3,'Syntax: .bf timer #battleid #timer'); -- NPC talk text insert from sniff DELETE FROM `creature_text` WHERE `entry`=15214 AND `groupid` BETWEEN 0 AND 30; diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/Template_update.sql index c55f86fceef..1b1ff6d130f 100644 --- a/Wintergrasp_temp/Template_update.sql +++ b/Wintergrasp_temp/Template_update.sql @@ -1,15 +1,14 @@ UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,192322,192323,192324,192325,192326,192327,192328,192329, - 192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner +192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner - UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192269,192284,192285,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,192357,192358,192359,192360,192361, - 192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, - 192255,192336); -- Horde Banner - +192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, +192255,192336); -- Horde Banner + UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127, - 193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, - 193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, - 193164,193165); -- nameless GOs +193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, +193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, +193164,193165); -- nameless GOs UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31841; -- Taunka Spirit Guide UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31842; -- Dwarven Spirit Guide @@ -21,31 +20,20 @@ UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4 WHERE `entry`=311 UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?) UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms - -/* -Sniff check these --- Wintergrasp Cannons (Spell 51421 : Fire Cannon) -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735 WHERE `entry`=28366; -- *** WRONG **** -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1732 WHERE `entry` IN (30499,30740, 28319); -- Alliance -UPDATE `creature_template` SET `faction_A`=1735,`faction_H`=1735 WHERE `entry` IN (30400,30739, 32629); -- Horde - --- Added by Malcrom -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1732 WHERE `entry` IN (28312); -- Alliance -UPDATE `creature_template` SET `faction_A`=1735,`faction_H`=1735 WHERE `entry` IN (32627); -- Horde - --- Wintergrasp Catapult speed adjustments -UPDATE `creature_template` SET `speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; - --- Creature Gossip_menu_id Update from sniff -UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; -UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; -*/ +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216 WHERE `entry`=28366; -- Wintergrasp Tower Cannon +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=32629; -- Wintergrasp Siege Turret +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=28319; -- Wintergrasp Siege Turret +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=32627; -- Wintergrasp Siege Engine +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28312; -- Wintergrasp Siege Engine +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28094; -- Wintergrasp Demolisher +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; -- Wintergrasp Catapult UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31347; -- Champion Ros'slai +UPDATE `creature_model_info` SET `bounding_radius`=0.305,`combat_reach`=5,`gender`=2 WHERE `modelid`=25301; -- Wintergrasp Siege Turret -DELETE FROM `creature_template_addon` WHERE `entry` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,32294,39172,30870,31053,31091,31101,31102,31106,31107,31151,32296,39173,30740); +DELETE FROM `creature_template_addon` WHERE `entry` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,32294,39172,30870,31053,31091,31101,31102,31106,31107,31151,32296,39173,30740,32629,28319,28366,32627,28312,28094,27881,30739); INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES (31841,0,0,1,0, '58729'), -- Taunka Spirit Guide (Spiritual Immunity, Spirit Heal Channel) FIX: Do we need the spell that revives players here (22011)? It has a duration (found in sniffs). (31842,0,0,1,0, '58729'), -- Dwarven Spirit Guide This spell (and the spell it triggers, are used in the "ressurect system" in Battleground.cpp @@ -72,5 +60,25 @@ INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote` (31151,0,0,257,0, NULL), -- Tactical Officer Kilrath (32296,27245,0,1,0, NULL), -- Stone Guard Mukar (39173,29261,0,1,0, NULL), -- Champion Ros'slai -(30740,0,0,257,375, NULL); -- Valiance Expedition Champion +(30740,0,0,257,375, NULL), -- Valiance Expedition Champion +(32629,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(28319,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(28366,0,0,257,0, NULL), -- Wintergrasp Tower Cannon +(32627,0,0,257,0, NULL), -- Wintergrasp Siege Engine +(28312,0,0,257,0, NULL), -- Wintergrasp Siege Engine +(28094,0,0,257,0, NULL), -- Wintergrasp Demolisher +(27881,0,0,257,0, NULL), -- Wintergrasp Catapult +(30739,0,0,257,375, NULL); -- Warsong Champion + +-- Wintergrasp vehicles: +UPDATE `creature_template` SET `spell1`=51421, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28366; -- Wintergrasp Tower Cannon (Both) +UPDATE `creature_template` SET `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32629; -- Wintergrasp Siege Turret (H) +UPDATE `creature_template` SET `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28319; -- Wintergrasp Siege Turret (A) +UPDATE `creature_template` SET `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32627; -- Wintergrasp Siege Engine (H) +UPDATE `creature_template` SET `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28312; -- Wintergrasp Siege Engine (A) +UPDATE `creature_template` SET `spell1`=54107, /* Ram */ `spell2`=50896, /* Hurl Boulder */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28094; -- Wintergrasp Demolisher (H) +UPDATE `creature_template` SET `spell1`=57606, /* Plague Barrel */ `spell2`=50989, /* Flame Breath */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=27881; -- Wintergrasp Catapult (Both) +-- Note: Siege Engines, Demolisher faction is guess (vehicles get the faction of his driver) +-- Demolisher spell positions is not confirmed +-- Wintergrasp Tower Cannon H: 1735 A: 1732 diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp new file mode 100644 index 00000000000..3e35500a556 --- /dev/null +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -0,0 +1,429 @@ +/* Copyright (C) 2008 - 2009 Trinity + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ScriptPCH.h" +#include "BattlefieldMgr.h" +#include "BattlefieldWG.h" +#include "Battlefield.h" +#include "ScriptSystem.h" +#include "WorldSession.h" +#include "ObjectMgr.h" + +#define GOSSIP_HELLO_DEMO1 "Build catapult." +#define GOSSIP_HELLO_DEMO2 "Build demolisher." +#define GOSSIP_HELLO_DEMO3 "Build siege engine." +#define GOSSIP_HELLO_DEMO4 "I cannot build more!" + +enum eWGqueuenpctext +{ + WG_NPCQUEUE_TEXT_H_NOWAR = 14775, + WG_NPCQUEUE_TEXT_H_QUEUE = 14790, + WG_NPCQUEUE_TEXT_H_WAR = 14777, + WG_NPCQUEUE_TEXT_A_NOWAR = 14782, + WG_NPCQUEUE_TEXT_A_QUEUE = 14791, + WG_NPCQUEUE_TEXT_A_WAR = 14781, + WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507, +}; + +enum eWGdata +{ + // engineer spells + SPELL_BUILD_CATAPULT = 56663, + SPELL_BUILD_DEMOLISHER = 56575, + SPELL_BUILD_SIEGE_ENGINE = 61408, + SPELL_BUILD_SIEGE_ENGINE2 = 56661, // does it's really needed here? + SPELL_ACTIVATE_ROBOTIC_ARMS = 49899, + + // teleporter spells + SPELL_VEHICLE_TELEPORT = 49759, +}; + +class npc_wg_demolisher_engineer : public CreatureScript +{ + public: + npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") + { + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(1); + + if (!BfWG) + return true; + + if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > + BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + { + if (pPlayer->HasAura(SPELL_CORPORAL)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + else if (pPlayer->HasAura(SPELL_LIEUTENANT)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + } + } + else + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender */ , uint32 uiAction) + { + pPlayer->CLOSE_GOSSIP_MENU(); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(1); + + if (!BfWG) + return true; + + if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > + BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + { + switch (uiAction - GOSSIP_ACTION_INFO_DEF) + { + case 0: + pPlayer->CastSpell(pPlayer, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); + break; + case 1: + pPlayer->CastSpell(pPlayer, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, pCreature->GetGUID()); + break; + case 2: + pPlayer->CastSpell(pPlayer, pPlayer->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, pCreature->GetGUID()); + break; + } + //spell 49899 Emote : 406 from sniff + //INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0'); + if (Creature* creature = pCreature->FindNearestCreature(27852, 30.0f, true)) + creature->CastSpell(creature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); + } + return true; + } +}; + +class npc_wg_spirit_guide : public CreatureScript +{ + public: + npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") + { + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + GraveYardVect gy = BfWG->GetGraveYardVect(); + for (uint8 i = 0; i < gy.size(); i++) + { + if (gy[i]->GetControlTeamId() == pPlayer->GetTeamId()) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN, + GOSSIP_ACTION_INFO_DEF + i); + } + } + } + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 uiAction) + { + pPlayer->CLOSE_GOSSIP_MENU(); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + GraveYardVect gy = BfWG->GetGraveYardVect(); + for (uint8 i = 0; i < gy.size(); i++) + { + if (uiAction - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == pPlayer->GetTeamId()) + { + WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId()); + pPlayer->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); + } + } + } + return true; + } +}; + +class npc_wg_queue : public CreatureScript +{ + public: + npc_wg_queue() : CreatureScript("npc_wg_queue") + { + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + + if (BfWG->IsWarTime()) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); + } + else + { + uint32 uiTime = BfWG->GetTimer() / 1000; + pPlayer->SendUpdateWorldState(4354, time(NULL) + uiTime); + if (uiTime < 15 * MINUTE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); + } + else + { + pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); + } + } + } + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 /*uiAction */ ) + { + pPlayer->CLOSE_GOSSIP_MENU(); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + if (BfWG->IsWarTime()) + { + BfWG->InvitePlayerToWar(pPlayer); + } + else + { + uint32 uiTime = BfWG->GetTimer() / 1000; + if (uiTime < 15 * MINUTE) + BfWG->InvitePlayerToQueue(pPlayer); + } + } + return true; + } +}; + +const uint32 Vehicules[4] = { 32627, 28312, 28094, 27881 }; + +class go_wg_vehicle_teleporter : public GameObjectScript +{ + public: + go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") + { + } + + struct go_wg_vehicle_teleporterAI : public GameObjectAI + { + go_wg_vehicle_teleporterAI(GameObject* g) : GameObjectAI(g) + { + uiCheckTimer = 1000; + } + + void UpdateAI(const uint32 diff) + { + if (uiCheckTimer <= diff) + { + for (uint8 i = 0; i < 4; i++) + if (Creature* pVehicle = go->FindNearestCreature(Vehicules[i], 3.0f, true)) + if (!pVehicle->HasAura(SPELL_VEHICLE_TELEPORT)) + { + if (pVehicle->GetVehicle()) + { + if (Unit* player = pVehicle->GetVehicle()->GetPassenger(0)) + { + uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION); + uint32 plfaction = player->getFaction(); + if (gofaction == plfaction) + { + pVehicle->CastSpell(pVehicle, SPELL_VEHICLE_TELEPORT, true); + if (Creature* TargetTeleport = pVehicle->FindNearestCreature(23472, 100.0f, true)) + { + float x, y, z, o; + TargetTeleport->GetPosition(x, y, z, o); + pVehicle->GetVehicle()->TeleportVehicle(x, y, z, o); + } + } + } + } + } + uiCheckTimer = 1000; + } + else + uiCheckTimer -= diff; + } + private: + uint32 uiCheckTimer; + }; + + GameObjectAI *GetAI(GameObject* go) const + { + return new go_wg_vehicle_teleporterAI(go); + } +}; + +class npc_wg_quest_giver : public CreatureScript +{ + public: + npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") + { + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + if (pCreature->isQuestGiver()) + { + Object* pObject = (Object *) pCreature; + QuestRelations* pObjectQR = sObjectMgr->GetCreatureQuestRelationMap(); + QuestRelations* pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); + + QuestMenu & qm = pPlayer->PlayerTalkClass->GetQuestMenu(); + qm.ClearMenu(); + + for (QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i) + { + uint32 quest_id = i->second; + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + if (status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_INCOMPLETE) + qm.AddMenuItem(quest_id, 4); + } + + for (QuestRelations::const_iterator i = pObjectQR->lower_bound(pObject->GetEntry()); i != pObjectQR->upper_bound(pObject->GetEntry()); ++i) + { + uint32 quest_id = i->second; + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); + if (!pQuest) + continue; + + switch (quest_id) + { + // Horde attacker + case 13193: + case 13202: + case 13180: + case 13200: + case 13201: + case 13223: + if (BfWG->GetAttackerTeam() == TEAM_HORDE) + { + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + } + break; + // Horde defender + case 13199: + case 13192: + case 13178: + case 13191: + case 13194: + case 13539: + case 13185: + if (BfWG->GetDefenderTeam() == TEAM_HORDE) + { + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + } + break; + // Alliance attacker + case 13196: + case 13198: + case 13179: + case 13222: + case 13195: + if (BfWG->GetAttackerTeam() == TEAM_ALLIANCE) + { + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + } + break; + // Alliance defender + case 13154: + case 13153: + case 13177: + case 13538: + case 13186: + case 13156: + if (BfWG->GetDefenderTeam() == TEAM_ALLIANCE) + { + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + } + break; + default: + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + break; + } + } + } + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + return true; + } +}; + +void AddSC_wintergrasp() +{ + new npc_wg_queue(); + new npc_wg_spirit_guide(); + new npc_wg_demolisher_engineer(); + new go_wg_vehicle_teleporter(); + new npc_wg_quest_giver(); +} -- cgit v1.2.3 From ff85ebe632a2aa3ea87d97dfd684c6f7c94552f5 Mon Sep 17 00:00:00 2001 From: Shocker Date: Tue, 5 Jul 2011 01:48:03 +0300 Subject: Fix Didn't Stand a Chance achievement --- ...11_07_05_00_world_achievement_criteria_data.sql | 4 ++++ sql/updates/world/2011_07_05_00_world_disables.sql | 1 + src/server/scripts/Northrend/wintergrasp.cpp | 25 ++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql create mode 100644 sql/updates/world/2011_07_05_00_world_disables.sql (limited to 'src') diff --git a/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql b/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql new file mode 100644 index 00000000000..fa995e7804f --- /dev/null +++ b/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql @@ -0,0 +1,4 @@ +DELETE FROM `achievement_criteria_data` WHERE criteria_id = 7703; +INSERT INTO `achievement_criteria_data` VALUES +(7703, 6, 4197, 0, ''), +(7703, 11, 0, 0, 'achievement_wg_didnt_stand_a_chance'); diff --git a/sql/updates/world/2011_07_05_00_world_disables.sql b/sql/updates/world/2011_07_05_00_world_disables.sql new file mode 100644 index 00000000000..fa5010b669f --- /dev/null +++ b/sql/updates/world/2011_07_05_00_world_disables.sql @@ -0,0 +1 @@ +DELETE FROM `disables` WHERE `entry` = 7703 AND `sourceType` = 4; diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 3e35500a556..a11a47a19f9 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -419,6 +419,30 @@ class npc_wg_quest_giver : public CreatureScript } }; +class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript +{ +public: + achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { } + + bool OnCheck(Player* source, Unit* target) + { + if (!target) + return false; + + if (Player* victim = target->ToPlayer()) + { + if (!victim->IsMounted()) + return false; + + if (Vehicle* vehicle = source->GetVehicle()) + if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon + return true; + } + + return false; + } +}; + void AddSC_wintergrasp() { new npc_wg_queue(); @@ -426,4 +450,5 @@ void AddSC_wintergrasp() new npc_wg_demolisher_engineer(); new go_wg_vehicle_teleporter(); new npc_wg_quest_giver(); + new achievement_wg_didnt_stand_a_chance(); } -- cgit v1.2.3 From 23b59c560323a8414e2067bb53731e3e73d30e5a Mon Sep 17 00:00:00 2001 From: tobmaps Date: Wed, 27 Jul 2011 04:07:24 +0700 Subject: Core/Battlefield * Fix compile * Restored GO damage events after recent changes --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 11 ++++++++--- src/server/game/Battlefield/Zones/BattlefieldWG.h | 13 +++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 0c44ea766a0..81e661bd02c 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -985,13 +985,18 @@ void BattlefieldWG::AddBrokenTower(TeamId team) } } -void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId) +void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) { if (!obj || !IsWarTime()) return; + // We handle only gameobjects here + GameObject* go = obj->ToGameObject(); + if (!go) + return; + // On click on titan relic - if (obj->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC) + if (go->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC) { // Check that the door is break if (m_CanClickOnOrb) @@ -1003,7 +1008,7 @@ void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId) // if destroy or damage event, search the wall/tower and update worldstate/send warning message for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) { - if (obj->GetEntry() == (*itr)->m_Build->GetEntry()) + if (go->GetEntry() == (*itr)->m_Build->GetEntry()) { if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId) (*itr)->Damaged(); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 1e3d7a93d94..74974041fa4 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -412,7 +412,7 @@ class BattlefieldWG : public Battlefield void PromotePlayer(Player *killer); void UpdateTenacity(); - void ProcessEvent(GameObject *obj, uint32 eventId); + void ProcessEvent(WorldObject *obj, uint32 eventId); protected: bool m_CanClickOnOrb; @@ -1366,7 +1366,7 @@ struct BfWGGameObjectBuilding } // Rebuild gameobject - m_Build->Rebuild(); + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); // Update worldstate m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); @@ -1469,18 +1469,15 @@ struct BfWGGameObjectBuilding { case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT: - m_Build->Rebuild(); + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); break; case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY: - m_Build->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); - m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED); - m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.destroyedDisplayId); + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED); break; case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE: - m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); - m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.damagedDisplayId); + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); break; } } -- cgit v1.2.3 From c28a8aafc0cd0f2b8bd6aa4c5106eb52a4b768b2 Mon Sep 17 00:00:00 2001 From: tobmaps Date: Wed, 27 Jul 2011 04:07:46 +0700 Subject: Core/Battlefield * Fix battle start * cleanups and code style fixes --- src/server/game/Battlefield/Battlefield.cpp | 1151 ++++++++++++++++++++ .../game/Battlefield/Zones/BattlefieldWG.cpp | 88 +- src/server/game/Battlefield/Zones/BattlefieldWG.h | 48 +- 3 files changed, 1219 insertions(+), 68 deletions(-) create mode 100644 src/server/game/Battlefield/Battlefield.cpp (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp new file mode 100644 index 00000000000..62aebfe5173 --- /dev/null +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -0,0 +1,1151 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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 . + */ + +#include "Battlefield.h" +#include "BattlefieldMgr.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "Map.h" +#include "MapManager.h" +#include "Group.h" +#include "WorldPacket.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "CellImpl.h" +#include "CreatureTextMgr.h" + +#include "GroupMgr.h" + +Battlefield::Battlefield() +{ + m_Timer = 0; + m_enable = true; + m_BattlefieldActive = false; + m_DefenderTeam = TEAM_NEUTRAL; + + m_TypeId = 0; + m_BattleId = 0; + m_ZoneId = 0; + m_MapId = 0; + m_MaxPlayer = 0; + m_MinPlayer = 0; + m_BattleTime = 0; + m_NoWarBattleTime = 0; + m_TimeForAcceptInvite = 20; + m_uiKickDontAcceptTimer = 1000; + + m_uiKickAfkTimer = 1000; + + m_LastResurectTimer = 30 * IN_MILLISECONDS; + m_StartGroupingTimer = 0; + m_StartGrouping = false; + StalkerGuid = 0; +} + +Battlefield::~Battlefield() +{ +} + +void Battlefield::HandlePlayerEnterZone(Player *plr, uint32 /*zone */ ) +{ + //If battle is start, + // if it not fully > invite player to join the war + // if it fully > announce to player that BF is full and kick after few second if he dont leave + if (IsWarTime()) + { + if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) //Not fully + { + InvitePlayerToWar(plr); + } + else //Full + { + //TODO:Send packet for announce it to player + m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + InvitePlayerToQueue(plr); + } + } + else + { + //If time left is <15 minutes invite player to join queue + if (m_Timer <= m_StartGroupingTimer) + InvitePlayerToQueue(plr); + } + + //Add player in list of player in zone + m_players[plr->GetTeamId()].insert(plr->GetGUID()); + OnPlayerEnterZone(plr); //for scripting +} + +//Called when a player leave the zone +void Battlefield::HandlePlayerLeaveZone(Player *plr, uint32 /*zone */ ) +{ + if (IsWarTime()) + { + //if player is in war list + if (m_PlayersInWar[plr->GetTeamId()].find(plr->GetGUID()) != m_PlayersInWar[plr->GetTeamId()].end()) + { + m_PlayersInWar[plr->GetTeamId()].erase(plr->GetGUID()); + plr->GetSession()->SendBfLeaveMessage(m_BattleId); + if (Group* group = GetGroupPlayer(plr->GetGUID(), plr->GetTeamId())) // remove from raid group if player is member + { + // I think that now is not a hack + if (!group->RemoveMember(plr->GetGUID())) // group was disbanded + { + m_Groups[plr->GetTeamId()].erase(group->GetGUID()); + group->SetBattlefieldGroup(NULL); + sGroupMgr->RemoveGroup(group); + delete group; + } + } + OnPlayerLeaveWar(plr); //For scripting + } + } + + for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) + itr->second->HandlePlayerLeave(plr); + + m_InvitedPlayers[plr->GetTeamId()].erase(plr->GetGUID()); + m_PlayersWillBeKick[plr->GetTeamId()].erase(plr->GetGUID()); + m_players[plr->GetTeamId()].erase(plr->GetGUID()); + SendRemoveWorldStates(plr); + RemovePlayerFromResurrectQueue(plr->GetGUID()); + OnPlayerLeaveZone(plr); //For scripting +} + +bool Battlefield::Update(uint32 diff) +{ + //When global timer is end + if (m_Timer <= diff) + { + //Here end of battle by timer + if (IsWarTime()) + EndBattle(true); + //Start of battle + else + StartBattle(); + } + else + m_Timer -= diff; + + //Some times before battle start invite player to queue + if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer) + { + m_StartGrouping = true; + InvitePlayerInZoneToQueue(); + OnStartGrouping(); // for scripting + } + + bool objective_changed = false; + if (IsWarTime()) + { + if (m_uiKickAfkTimer <= diff) + { + m_uiKickAfkTimer = 1000; + KickAfk(); + } + else + m_uiKickAfkTimer -= diff; + + //Here kick player witch dont have accept invitation to join the war when time is end (time of windows) + if (m_uiKickDontAcceptTimer <= diff) + { + for (int team = 0; team < 2; team++) + for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++) + if ((*itr).second <= time(NULL)) + KickPlayerFromBf((*itr).first); + InvitePlayerInZoneToWar(); + for (int team = 0; team < 2; team++) + for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++) + if ((*itr).second <= time(NULL)) + KickPlayerFromBf((*itr).first); + + m_uiKickDontAcceptTimer = 1000; + } + else + m_uiKickDontAcceptTimer -= diff; + + for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) + if (itr->second->Update(diff)) + objective_changed = true; + } + + + if (m_LastResurectTimer <= diff) + { + for (uint8 i = 0; i < m_GraveYardList.size(); i++) + if (GetGraveYardById(i)) + m_GraveYardList[i]->Resurrect(); + m_LastResurectTimer = RESURRECTION_INTERVAL; + } + else + m_LastResurectTimer -= diff; + + return objective_changed; +} + +void Battlefield::InvitePlayerInZoneToQueue() +{ + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + InvitePlayerToQueue(plr); +} + +void Battlefield::InvitePlayerToQueue(Player *plr) +{ + if (m_PlayersInQueue[plr->GetTeamId()].count(plr->GetGUID())) + return; + + if (m_PlayersInQueue[plr->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[plr->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer) + plr->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); +} + +void Battlefield::InvitePlayerInQueueToWar() +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + { + for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) + { + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + { + if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) + InvitePlayerToWar(plr); + else + { + //Full + } + } + } + m_PlayersInQueue[team].clear(); + } +} + +void Battlefield::InvitePlayerInZoneToWar() +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + { + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + { + if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) + continue; + if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) + InvitePlayerToWar(plr); + else + { + //full + m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + } + } + } +} + +void Battlefield::InvitePlayerToWar(Player *plr) +{ + if (!plr) + return; + + // TODO : needed ? + if (plr->isInFlight()) + return; + + if (plr->InArena() || plr->GetBattleground()) + { + m_PlayersInQueue[plr->GetTeamId()].erase(plr->GetGUID()); + return; + } + + if (plr->getLevel() < m_MinLevel) + { + if (m_PlayersWillBeKick[plr->GetTeamId()].count(plr->GetGUID()) == 0) + m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + return; + } + //Check if player is not already in war + if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) + return; + + m_PlayersWillBeKick[plr->GetTeamId()].erase(plr->GetGUID()); + m_InvitedPlayers[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + m_TimeForAcceptInvite; + plr->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite); +} + +void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) +{ + if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL)) + StalkerGuid = creature->GetGUID(); + else + sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); +} + +void Battlefield::KickAfk() +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + if (plr->isAFK()) + KickPlayerFromBf(*itr); +} + +void Battlefield::KickPlayerFromBf(uint64 guid) +{ + if (Player* plr = sObjectAccessor->FindPlayer(guid)) + if (plr->GetZoneId() == GetZoneId()) + plr->TeleportTo(KickPosition); +} + +void Battlefield::StartBattle() +{ + if (m_BattlefieldActive) + return; + + for (int team = 0; team < BG_TEAMS_COUNT; team++) + { + m_PlayersInWar[team].clear(); + m_Groups[team].clear(); + } + + m_Timer = m_BattleTime; + m_BattlefieldActive = true; + + InvitePlayerInZoneToWar(); + InvitePlayerInQueueToWar(); + + PlaySoundToAll(BF_START); + + OnBattleStart(); +} + +void Battlefield::EndBattle(bool endbytimer) +{ + m_BattlefieldActive = false; + + m_StartGrouping = false; + + if (!endbytimer) + SetDefenderTeam(GetAttackerTeam()); + + if (GetDefenderTeam() == TEAM_ALLIANCE) + PlaySoundToAll(BF_ALLIANCE_WINS); // alliance wins sound + else + PlaySoundToAll(BF_HORDE_WINS); // horde wins sound + + OnBattleEnd(endbytimer); + + // reset bf timer + m_Timer = m_NoWarBattleTime; + SendInitWorldStatesToAll(); +} + +void Battlefield::PlaySoundToAll(uint32 SoundID) +{ + WorldPacket data; + data.Initialize(SMSG_PLAY_SOUND, 4); + data << uint32(SoundID); + + for (int team = 0; team < BG_TEAMS_COUNT; team++) + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + { + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->GetSession()->SendPacket(&data); + } +} + +bool Battlefield::HasPlayer(Player *plr) const +{ + return m_players[plr->GetTeamId()].find(plr->GetGUID()) != m_players[plr->GetTeamId()].end(); +} + +// Called in WorldSession::HandleBfQueueInviteResponse +void Battlefield::PlayerAcceptInviteToQueue(Player *plr) +{ + // Add player in queueVenez + m_PlayersInQueue[plr->GetTeamId()].insert(plr->GetGUID()); + // Send notification + plr->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId); +} +// Called in WorldSession::HandleBfExitRequest +void Battlefield::AskToLeaveQueue(Player *plr) +{ + // Remove player from queue + m_PlayersInQueue[plr->GetTeamId()].erase(plr->GetGUID()); +} + +// Called in WorldSession::HandleBfEntryInviteResponse +void Battlefield::PlayerAcceptInviteToWar(Player *plr) +{ + if (!IsWarTime()) + return; + + if (AddOrSetPlayerToCorrectBfGroup(plr)) + { + plr->GetSession()->SendBfEntered(m_BattleId); + m_PlayersInWar[plr->GetTeamId()].insert(plr->GetGUID()); + m_InvitedPlayers[plr->GetTeamId()].erase(plr->GetGUID()); + //Remove player AFK + if (plr->isAFK()) + plr->ToggleAFK(); + + OnPlayerJoinWar(plr); //for scripting + } +} + +void Battlefield::TeamCastSpell(TeamId team, int32 spellId) +{ + if (spellId > 0) + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->CastSpell(plr, (uint32) spellId, true); + else + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->RemoveAuraFromStack((uint32) - spellId); +} + +void Battlefield::BroadcastPacketZone(WorldPacket & data) const +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->GetSession()->SendPacket(&data); +} + +void Battlefield::BroadcastPacketQueue(WorldPacket & data) const +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->GetSession()->SendPacket(&data); +} + +void Battlefield::BroadcastPacketWar(WorldPacket & data) const +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->GetSession()->SendPacket(&data); +} + +WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg) +{ + WorldPacket data(SMSG_MESSAGECHAT, 200); + + data << uint8(CHAT_MSG_RAID_BOSS_EMOTE); + data << uint32(LANG_UNIVERSAL); + data << uint64(0); + data << uint32(0); // 2.1.0 + data << uint32(1); + data << uint8(0); + data << uint64(0); + data << uint32(strlen(msg.c_str()) + 1); + data << msg.c_str(); + data << uint8(0); + + return data; +} + +void Battlefield::SendWarningToAllInZone(uint32 entry) +{ + if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) + if (Creature* stalker = unit->ToCreature()) + // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/ + sCreatureTextMgr->SendChat(stalker, (uint8) entry, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE); +} + +/*void Battlefield::SendWarningToAllInWar(int32 entry,...) +{ + const char *format = sObjectMgr->GetTrinityStringForDBCLocale(entry); + va_list ap; + char str [1024]; + va_start(ap, entry); + vsnprintf(str,1024,format, ap); + va_end(ap); + std::string msg = (std::string)str; + + WorldPacket data = BuildWarningAnnPacket(msg); + BroadcastPacketWar(data); +}*/ +void Battlefield::SendWarningToPlayer(Player *plr, uint32 entry) +{ + if (!plr) + return; + + if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) + if (Creature* stalker = unit->ToCreature()) + sCreatureTextMgr->SendChat(stalker, (uint8)entry, plr->GetGUID()); +} + +void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) +{ + for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) + for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->SendUpdateWorldState(field, value); +} + +void Battlefield::RegisterZone(uint32 zoneId) +{ + sBattlefieldMgr.AddZone(zoneId, this); +} + +void Battlefield::HideNpc(Creature *p_Creature) +{ + p_Creature->CombatStop(); + p_Creature->SetReactState(REACT_PASSIVE); + p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + p_Creature->SetPhaseMask(2, true); + p_Creature->DisappearAndDie(); + p_Creature->SetVisible(false); +} + +void Battlefield::ShowNpc(Creature *p_Creature, bool p_Aggressive) +{ + p_Creature->SetPhaseMask(1, true); + p_Creature->SetVisible(true); + p_Creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + if (!p_Creature->isAlive()) + p_Creature->Respawn(true); + if (p_Aggressive) + p_Creature->SetReactState(REACT_AGGRESSIVE); + else + { + p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + p_Creature->SetReactState(REACT_PASSIVE); + } +} + +//***************************************************** +//*******************Group System********************** +//***************************************************** +Group *Battlefield::GetFreeBfRaid(TeamId TeamId) +{ + //if found free group we return it + for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) + if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) + if (!group->IsFull()) + return group; + + return NULL; +} + +Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) +{ + for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) + if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) + if (group->IsMember(guid)) + return group; + + return NULL; +} + +bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *plr) +{ + if (!plr->IsInWorld()) + return false; + + if (Group* group = plr->GetGroup()) + group->RemoveMember(plr->GetGUID()); + + Group* group = GetFreeBfRaid(plr->GetTeamId()); + if (!group) + { + group = new Group; + group->SetBattlefieldGroup(this); + group->Create(plr); + sGroupMgr->AddGroup(group); + m_Groups[plr->GetTeamId()].insert(group->GetGUID()); + } + else if (group->IsMember(plr->GetGUID())) + { + uint8 subgroup = group->GetMemberGroup(plr->GetGUID()); + plr->SetBattlegroundOrBattlefieldRaid(group, subgroup); + } + else + group->AddMember(plr); + + return true; +} + +//***************End of Group System******************* + +//***************************************************** +//***************Spirit Guide System******************* +//***************************************************** +//-------------------- +//-Battlefield Method- +//-------------------- +BfGraveYard *Battlefield::GetGraveYardById(uint32 id) +{ + if (id < m_GraveYardList.size()) + { + if (m_GraveYardList[id]) + return m_GraveYardList[id]; + else + sLog->outError("Battlefield::GetGraveYardById Id:%u not existed", id); + } + else + sLog->outError("Battlefield::GetGraveYardById Id:%u cant be found", id); + + return NULL; +} + +WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *plr) +{ + BfGraveYard* closestGY = NULL; + float maxdist = -1; + for (uint8 i = 0; i < m_GraveYardList.size(); i++) + { + if (m_GraveYardList[i]) + { + if (m_GraveYardList[i]->GetControlTeamId() != plr->GetTeamId()) + continue; + + float dist = m_GraveYardList[i]->GetDistance(plr); + if (dist < maxdist || maxdist < 0) + { + closestGY = m_GraveYardList[i]; + maxdist = dist; + } + } + } + + if (closestGY) + return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveYardId()); + + return NULL; +} + +void Battlefield::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) +{ + for (uint8 i = 0; i < m_GraveYardList.size(); i++) + { + if (!m_GraveYardList[i]) + continue; + + if (m_GraveYardList[i]->HasNpc(npc_guid)) + { + m_GraveYardList[i]->AddPlayer(player_guid); + break; + } + } +} + +void Battlefield::RemovePlayerFromResurrectQueue(uint64 player_guid) +{ + for (uint8 i = 0; i < m_GraveYardList.size(); i++) + { + if (!m_GraveYardList[i]) + continue; + + if (m_GraveYardList[i]->HasPlayer(player_guid)) + { + m_GraveYardList[i]->RemovePlayer(player_guid); + break; + } + } +} + +void Battlefield::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64 &guid) +{ + sLog->outError("SendAreaSpiritHealerQueryOpcode"); + WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); + uint32 time = m_LastResurectTimer; // resurrect every 30 seconds + + data << guid << time; + ASSERT(pl && pl->GetSession()); + pl->GetSession()->SendPacket(&data); +} + +bool Battlefield::IncrementQuest(Player *player, uint32 quest, bool complete) +{ + if (!player) + return false; + + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest); + if (!pQuest || player->GetQuestStatus(quest) == QUEST_STATUS_NONE) + return false; + + if (complete) + { + player->CompleteQuest(quest); + return true; + } + else + { + for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + { + int32 creature = pQuest->ReqCreatureOrGOId[i]; + if (uint32 spell_id = pQuest->ReqSpell[i]) + { + player->CastedCreatureOrGO(creature, 0, spell_id); + return true; + } + else if (creature > 0) + { + player->KilledMonsterCredit(creature, 0); + return true; + } + else if (creature < 0) + { + player->CastedCreatureOrGO(creature, 0, 0); + return true; + } + } + } + return false; +} + +//-------------------- +//-BfGraveYard Method- +//-------------------- +BfGraveYard::BfGraveYard(Battlefield *Bf) +{ + m_Bf = Bf; + m_GraveyardId = 0; + m_ControlTeam = TEAM_NEUTRAL; + m_SpiritGuide[0] = NULL; + m_SpiritGuide[1] = NULL; + m_ResurrectQueue.clear(); +} + +void BfGraveYard::Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy) +{ + m_ControlTeam = startcontrol; + if (Creature* cre = m_Bf->SpawnCreature(horde_entry, x, y, z, o, TEAM_HORDE)) + { + m_SpiritGuide[TEAM_HORDE] = cre; + m_SpiritGuide[TEAM_HORDE]->SetReactState(REACT_PASSIVE); + if (m_ControlTeam == TEAM_ALLIANCE) + m_SpiritGuide[TEAM_HORDE]->SetVisible(false); + } + else + sLog->outError("BfGraveYard::Init can't spawn horde spiritguide %u", horde_entry); + + if (Creature* cre = m_Bf->SpawnCreature(alliance_entry, x, y, z, o, TEAM_ALLIANCE)) + { + m_SpiritGuide[TEAM_ALLIANCE] = cre; + m_SpiritGuide[TEAM_ALLIANCE]->SetReactState(REACT_PASSIVE); + if (m_ControlTeam == TEAM_HORDE) + m_SpiritGuide[TEAM_ALLIANCE]->SetVisible(false); + } + else + sLog->outError("BfGraveYard::Init can't spawn alliance spiritguide %u", alliance_entry); + + m_GraveyardId = gy; +} + +float BfGraveYard::GetDistance(Player *plr) +{ + const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); + return plr->GetDistance2d(ws->x, ws->y); +} + +void BfGraveYard::AddPlayer(uint64 player_guid) +{ + if (!m_ResurrectQueue.count(player_guid)) + { + m_ResurrectQueue.insert(player_guid); + + if (Player* plr = sObjectMgr->GetPlayer(player_guid)) + plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); + } +} + +void BfGraveYard::RemovePlayer(uint64 player_guid) +{ + m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid)); + + if (Player* plr = sObjectMgr->GetPlayer(player_guid)) + plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); +} + +void BfGraveYard::Resurrect() +{ + if (m_ResurrectQueue.empty()) + return; + + for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) + { + // Get player object from his guid + Player* plr = sObjectMgr->GetPlayer(*itr); + if (!plr) + continue; + + // Check player isinworld and player is on good graveyard + if (plr->IsInWorld()) + if (m_SpiritGuide[m_ControlTeam]) + m_SpiritGuide[m_ControlTeam]->CastSpell(m_SpiritGuide[m_ControlTeam], SPELL_SPIRIT_HEAL, true); + + // Resurect player + plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); + plr->ResurrectPlayer(1.0f); + plr->CastSpell(plr, 6962, true); + plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true); + + sObjectAccessor->ConvertCorpseForPlayer(plr->GetGUID()); + } + + m_ResurrectQueue.clear(); +} + +// For changing graveyard control +void BfGraveYard::ChangeControl(TeamId team) +{ + // Guide switching + if (m_SpiritGuide[1 - team]) + m_SpiritGuide[1 - team]->SetVisible(false); + if (m_SpiritGuide[team]) + m_SpiritGuide[team]->SetVisible(true); + + m_ControlTeam = team; + // Teleport to other graveyard, player witch were on this graveyard + RelocateDeadPlayers(); +} + +void BfGraveYard::RelocateDeadPlayers() +{ + WorldSafeLocsEntry const* ClosestGrave = NULL; + for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) + { + Player* plr = sObjectMgr->GetPlayer(*itr); + if (!plr) + continue; + + if (ClosestGrave) + plr->TeleportTo(plr->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + else + { + ClosestGrave = m_Bf->GetClosestGraveYard(plr); + if (ClosestGrave) + plr->TeleportTo(plr->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + } + } +} + +//***************End Spirit Guide system*************** + +//***************************************************** +//**********************Misc*************************** +//***************************************************** +//Method for spawn creature on map +Creature *Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team) +{ + return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team); +} + +Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team) +{ + //Get map object + Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId)); + if (!map) + { + sLog->outError("Can't create creature entry: %u map not found", entry); + return 0; + } + + //Create creature + Creature* pCreature = new Creature; + if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) + { + sLog->outError("Can't create creature entry: %u", entry); + delete pCreature; + return NULL; + } + + pCreature->SetHomePosition(x, y, z, o); + + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); + if (!cinfo) + { + sLog->outErrorDb("Battleground::AddCreature: entry %u does not exist.", entry); + return NULL; + } + // force using DB speeds -- do we really need this? + pCreature->SetSpeed(MOVE_WALK, cinfo->speed_walk); + pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run); + + // Set creature in world + map->Add(pCreature); + pCreature->setActive(true); + + return pCreature; +} + +// Method for spawning gameobject on map +GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o) +{ + // Get map object + Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(571)); + if (!map) + return 0; + + // Create gameobject + GameObject* go = new GameObject; + if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY)) + { + sLog->outErrorDb("Gameobject template %u not found in database! Battleground not created!", entry); + sLog->outError("Cannot create gameobject template %u! Battleground not created!", entry); + delete go; + return NULL; + } + + // Add in the world + map->Add(go); + go->setActive(true); + return go; +} + +//***************************************************** +//*******************CapturePoint********************** +//***************************************************** + +BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL) +{ + m_team = TEAM_NEUTRAL; + m_value = 0; + m_maxValue = 0; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL; + m_OldState = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL; + m_capturePointEntry = 0; + m_neutralValuePct = 0; + m_maxSpeed = 0; +} + +bool BfCapturePoint::HandlePlayerEnter(Player *plr) +{ + if (m_capturePoint) + { + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); + } + return m_activePlayers[plr->GetTeamId()].insert(plr->GetGUID()).second; +} + +void BfCapturePoint::HandlePlayerLeave(Player *plr) +{ + if (m_capturePoint) + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); + m_activePlayers[plr->GetTeamId()].erase(plr->GetGUID()); +} + +void BfCapturePoint::SendChangePhase() +{ + if (!m_capturePoint) + return; + + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); + // send these updates to only the ones in this objective + SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); + // send this too, sometimes it resets :S + SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); +} + +bool BfCapturePoint::SetCapturePointData(uint32 entry, uint32 /*map */ , float x, float y, float z, float o) +{ + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", entry); + + // check info existence + GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); + if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) + { + sLog->outError("OutdoorPvP: GO %u is not capture point!", entry); + return false; + } + m_capturePoint = m_Bf->SpawnGameObject(entry, x, y, z, o); + if (m_capturePoint) + { + // get the needed values from goinfo + m_maxValue = goinfo->capturePoint.maxTime; + m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60); + m_neutralValuePct = goinfo->capturePoint.neutralPercent; + m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100; + m_capturePointEntry = entry; + if (m_team == TEAM_ALLIANCE) + { + m_value = m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE; + } + else + { + m_value = -m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE; + } + return true; + } + + return false; +} + +bool BfCapturePoint::DelCapturePoint() +{ + if (m_capturePoint) + { + m_capturePoint->SetRespawnTime(0); // not save respawn time + m_capturePoint->Delete(); + m_capturePoint = NULL; + } + + return true; +} + +bool BfCapturePoint::Update(uint32 diff) +{ + if (!m_capturePoint) + return false; + + float radius = m_capturePoint->GetGOInfo()->capturePoint.radius; + + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) + HandlePlayerLeave(plr); + + std::list < Player * >players; + Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius); + Trinity::PlayerListSearcher < Trinity::AnyPlayerInObjectRangeCheck > searcher(m_capturePoint, players, checker); + m_capturePoint->VisitNearbyWorldObject(radius, searcher); + + for (std::list < Player * >::iterator itr = players.begin(); itr != players.end(); ++itr) + if ((*itr)->IsOutdoorPvPActive()) + if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second) + HandlePlayerEnter(*itr); + + // get the difference of numbers + float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL; + if (!fact_diff) + return false; + + uint32 Challenger = 0; + float maxDiff = m_maxSpeed * diff; + + if (fact_diff < 0) + { + // horde is in majority, but it's already horde-controlled -> no change + if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE && m_value <= -m_maxValue) + return false; + + if (fact_diff < -maxDiff) + fact_diff = -maxDiff; + + Challenger = HORDE; + } + else + { + // ally is in majority, but it's already ally-controlled -> no change + if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue) + return false; + + if (fact_diff > maxDiff) + fact_diff = maxDiff; + + Challenger = ALLIANCE; + } + + float oldValue = m_value; + TeamId oldTeam = m_team; + + m_OldState = m_State; + + m_value += fact_diff; + + if (m_value < -m_minValue) // red + { + if (m_value < -m_maxValue) + m_value = -m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE; + m_team = TEAM_HORDE; + } + else if (m_value > m_minValue) // blue + { + if (m_value > m_maxValue) + m_value = m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE; + m_team = TEAM_ALLIANCE; + } + else if (oldValue * m_value <= 0) // grey, go through mid point + { + // if challenger is ally, then n->a challenge + if (Challenger == ALLIANCE) + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE; + // if challenger is horde, then n->h challenge + else if (Challenger == HORDE) + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE; + m_team = TEAM_NEUTRAL; + } + else // grey, did not go through mid point + { + // old phase and current are on the same side, so one team challenges the other + if (Challenger == ALLIANCE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE)) + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE; + else if (Challenger == HORDE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE)) + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE; + m_team = TEAM_NEUTRAL; + } + + if (m_value != oldValue) + SendChangePhase(); + + if (m_OldState != m_State) + { + //sLog->outError("%u->%u", m_OldState, m_State); + if (oldTeam != m_team) + ChangeTeam(oldTeam); + return true; + } + + return false; +} + +void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) +{ + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->SendUpdateWorldState(field, value); +} + +void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) +{ + uint8 team; + switch (m_State) + { + case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE: + team = 0; + break; + case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE: + team = 1; + break; + default: + return; + } + + // send to all players present in the area + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->KilledMonsterCredit(id, guid); +} + +bool BfCapturePoint::IsInsideObjective(Player *plr) const +{ + return m_activePlayers[plr->GetTeamId()].find(plr->GetGUID()) != m_activePlayers[plr->GetTeamId()].end(); +} diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 81e661bd02c..43bce64f5f9 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -43,12 +43,12 @@ bool BattlefieldWG::SetupBattlefield() m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL); - m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE; - m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE; - m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE; + m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS; + m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS; + m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS; m_TimeForAcceptInvite = 20; - m_StartGroupingTimer = 15 * MINUTE; + m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS; m_StartGrouping = false; m_tenacityStack = 0; @@ -138,7 +138,7 @@ bool BattlefieldWG::SetupBattlefield() } // Hide keep npc for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); // Spawn out of keep npc @@ -152,7 +152,7 @@ bool BattlefieldWG::SetupBattlefield() OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); // Hide outside npc for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); for (uint8 i = 0; i < WG_MAX_TURRET; i++) @@ -221,7 +221,7 @@ bool BattlefieldWG::Update(uint32 diff) m_saveTimer -= diff; for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) { @@ -241,7 +241,7 @@ bool BattlefieldWG::Update(uint32 diff) { for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (unit->IsInWater() && !unit->HasAura(SPELL_WINTERGRASP_WATER)) unit->AddAura(SPELL_WINTERGRASP_WATER, unit); @@ -253,7 +253,7 @@ bool BattlefieldWG::Update(uint32 diff) for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr) { if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150 @@ -301,7 +301,7 @@ void BattlefieldWG::OnBattleStart() // Update tower visibility and update faction for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (Creature* creature = unit->ToCreature()) { @@ -314,7 +314,7 @@ void BattlefieldWG::OnBattleStart() // Rebuild all wall for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) { - if ((*itr)) + if (*itr) { (*itr)->Rebuild(); (*itr)->UpdateTurretAttack(false); @@ -329,15 +329,15 @@ void BattlefieldWG::OnBattleStart() // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) { - if ((*itr)) + if (*itr) (*itr)->UpdateGraveYardAndWorkshop(); } for (uint8 team = 0; team < 2; ++team) - for (GuidSet::const_iterator p_itr = m_players[team].begin(); p_itr != m_players[team].end(); ++p_itr) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { // Kick player in orb room, TODO: offline player ? - if (Player* player = sObjectMgr->GetPlayer((*p_itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { float x, y, z; player->GetPosition(x, y, z); @@ -364,7 +364,7 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) { - if (BfWGWorkShopData * workshop = (*itr)) + if (BfWGWorkShopData* workshop = *itr) { if (workshop->m_TeamControl == TEAM_ALLIANCE) m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4; @@ -386,7 +386,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) // Remove turret for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (Creature* creature = unit->ToCreature()) { @@ -403,26 +403,26 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) // Change all npc in keep for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); } for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) ShowNpc(creature, true); } // Change all npc out of keep for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); } for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) ShowNpc(creature, true); } @@ -469,7 +469,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); if (player->HasAura(SPELL_LIEUTENANT)) @@ -492,7 +492,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) } for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { if (player->HasAura(SPELL_LIEUTENANT)) { @@ -511,7 +511,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { player->RemoveAura(SPELL_TOWER_CONTROL); player->RemoveAurasDueToSpell(SPELL_RECRUIT); @@ -525,7 +525,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) if (creature->IsVehicle()) creature->GetVehicleKit()->Dismiss(); @@ -539,7 +539,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID()); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); @@ -690,9 +690,9 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); - for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr) { - if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); } @@ -701,16 +701,16 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) for (GuidSet::const_iterator itr = m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); itr != m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (Creature* creature = unit->ToCreature()) { if (victim->GetEntry() == creature->GetEntry() && !again) { again = true; - for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) { - if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (Player* player = sObjectAccessor->FindPlayer(*iter)) if (player->GetDistance2d(killer) < 40) IncrementQuest(player, WGQuest[player->GetTeamId()][0]); } @@ -721,7 +721,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) for (GuidSet::const_iterator itr = KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); itr != KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (Creature* creature = unit->ToCreature()) { @@ -730,9 +730,9 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) again = true; IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); - for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) { - if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (Player* player = sObjectAccessor->FindPlayer(*iter)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); } @@ -925,7 +925,7 @@ void BattlefieldWG::SendInitWorldStatesToAll() WorldPacket data = BuildInitWorldStates(); for (uint8 team = 0; team < 2; team++) for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) player->GetSession()->SendPacket(&data); } @@ -933,9 +933,9 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) { if (team == GetDefenderTeam()) { - for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) + for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*p_itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) IncrementQuest(player, WGQuest[player->GetTeamId()][2], true); } } @@ -952,12 +952,12 @@ void BattlefieldWG::AddBrokenTower(TeamId team) // Remove buff stack for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) player->RemoveAuraFromStack(SPELL_TOWER_CONTROL); // Add buff stack for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); IncrementQuest(player, WGQuest[player->GetTeamId()][3], true); @@ -1071,12 +1071,12 @@ void BattlefieldWG::UpdateTenacity() if (team != TEAM_NEUTRAL) { for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) if (player->getLevel() >= m_MinLevel) player->RemoveAurasDueToSpell(SPELL_TENACITY); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE); } @@ -1097,20 +1097,20 @@ void BattlefieldWG::UpdateTenacity() buff_honor = (newStack < 5) ? 0 : buff_honor; for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) player->SetAuraStack(SPELL_TENACITY, player, newStack); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack); if (buff_honor != 0) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) player->AddAura(buff_honor, player); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) creature->AddAura(buff_honor, creature); } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 74974041fa4..6e604ef4e69 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1387,13 +1387,13 @@ struct BfWGGameObjectBuilding m_WG->SendWarningToAllInZone(m_NameId); for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER) @@ -1607,23 +1607,23 @@ struct BfWGGameObjectBuilding void UpdateCreatureAndGo() { for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->ShowNpc(creature, true); for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->ShowNpc(creature, true); for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr) @@ -1637,9 +1637,9 @@ struct BfWGGameObjectBuilding { for (GuidSet::const_iterator itr = m_TurretBottomList.begin(); itr != m_TurretBottomList.end(); ++itr) { - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { - if (Creature *creature = unit->ToCreature()) + if (Creature* creature = unit->ToCreature()) { if (m_Build) { @@ -1694,9 +1694,9 @@ struct BfWGGameObjectBuilding for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) { - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { - if (Creature *creature = unit->ToCreature()) + if (Creature* creature = unit->ToCreature()) { if (m_Build) { @@ -1824,14 +1824,14 @@ struct BfWGWorkShopData { // Show Alliance creature for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->ShowNpc(creature, creature->GetEntry() != 30499); // Hide Horde creature for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); // Show Alliance gameobject @@ -1863,14 +1863,14 @@ struct BfWGWorkShopData { // Show Horde creature for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->ShowNpc(creature, creature->GetEntry() != 30400); // Hide Alliance creature for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); // Hide Alliance gameobject -- cgit v1.2.3 From 16f2c3a48e4909aab000a89fd4b4ced4a8bae43c Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 21 Feb 2012 11:33:49 -0500 Subject: merge master into wintergrasp and fix build errors. yay me! --- src/server/game/Battlefield/Battlefield.cpp | 40 +++++++++++----------- .../game/Battlefield/Zones/BattlefieldWG.cpp | 31 +++++++++-------- src/server/game/Globals/ObjectMgr.h | 5 +++ src/server/game/Handlers/BattleGroundHandler.cpp | 40 ---------------------- src/server/game/Spells/SpellMgr.cpp | 10 ++++++ src/server/game/World/World.cpp | 8 +++++ src/server/scripts/Northrend/wintergrasp.cpp | 2 +- 7 files changed, 60 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 62aebfe5173..6a5ca0b5c02 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -204,7 +204,7 @@ void Battlefield::InvitePlayerInZoneToQueue() { for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) InvitePlayerToQueue(plr); } @@ -242,7 +242,7 @@ void Battlefield::InvitePlayerInZoneToWar() for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) { if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) continue; @@ -363,7 +363,7 @@ void Battlefield::PlaySoundToAll(uint32 SoundID) for (int team = 0; team < BG_TEAMS_COUNT; team++) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) { - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->GetSession()->SendPacket(&data); } } @@ -411,11 +411,11 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId) { if (spellId > 0) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->CastSpell(plr, (uint32) spellId, true); else for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->RemoveAuraFromStack((uint32) - spellId); } @@ -423,7 +423,7 @@ void Battlefield::BroadcastPacketZone(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->GetSession()->SendPacket(&data); } @@ -431,7 +431,7 @@ void Battlefield::BroadcastPacketQueue(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->GetSession()->SendPacket(&data); } @@ -439,7 +439,7 @@ void Battlefield::BroadcastPacketWar(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->GetSession()->SendPacket(&data); } @@ -496,7 +496,7 @@ void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) { for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->SendUpdateWorldState(field, value); } @@ -691,8 +691,8 @@ bool Battlefield::IncrementQuest(Player *player, uint32 quest, bool complete) { for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { - int32 creature = pQuest->ReqCreatureOrGOId[i]; - if (uint32 spell_id = pQuest->ReqSpell[i]) + int32 creature = pQuest->RequiredNpcOrGo[i]; + if (uint32 spell_id = pQuest->RequiredSpellCast[i]) { player->CastedCreatureOrGO(creature, 0, spell_id); return true; @@ -763,7 +763,7 @@ void BfGraveYard::AddPlayer(uint64 player_guid) { m_ResurrectQueue.insert(player_guid); - if (Player* plr = sObjectMgr->GetPlayer(player_guid)) + if (Player* plr = sObjectAccessor->FindPlayer(player_guid)) plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); } } @@ -772,7 +772,7 @@ void BfGraveYard::RemovePlayer(uint64 player_guid) { m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid)); - if (Player* plr = sObjectMgr->GetPlayer(player_guid)) + if (Player* plr = sObjectAccessor->FindPlayer(player_guid)) plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); } @@ -784,7 +784,7 @@ void BfGraveYard::Resurrect() for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { // Get player object from his guid - Player* plr = sObjectMgr->GetPlayer(*itr); + Player* plr = sObjectAccessor->FindPlayer(*itr); if (!plr) continue; @@ -824,7 +824,7 @@ void BfGraveYard::RelocateDeadPlayers() WorldSafeLocsEntry const* ClosestGrave = NULL; for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { - Player* plr = sObjectMgr->GetPlayer(*itr); + Player* plr = sObjectAccessor->FindPlayer(*itr); if (!plr) continue; @@ -882,7 +882,7 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run); // Set creature in world - map->Add(pCreature); + map->AddToMap(pCreature); pCreature->setActive(true); return pCreature; @@ -907,7 +907,7 @@ GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z } // Add in the world - map->Add(go); + map->AddToMap(go); go->setActive(true); return go; } @@ -1016,7 +1016,7 @@ bool BfCapturePoint::Update(uint32 diff) for (uint8 team = 0; team < 2; ++team) for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) HandlePlayerLeave(plr); @@ -1120,7 +1120,7 @@ void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) { for (uint8 team = 0; team < 2; ++team) for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->SendUpdateWorldState(field, value); } @@ -1141,7 +1141,7 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) // send to all players present in the area for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->KilledMonsterCredit(id, guid); } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 43bce64f5f9..7e27f9560be 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -23,6 +23,7 @@ #include "ObjectMgr.h" #include "BattlefieldWG.h" #include "SpellAuras.h" +#include "Vehicle.h" enum eWGBfData { @@ -221,7 +222,7 @@ bool BattlefieldWG::Update(uint32 diff) m_saveTimer -= diff; for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) { @@ -253,7 +254,7 @@ bool BattlefieldWG::Update(uint32 diff) for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr) { if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150 @@ -272,7 +273,7 @@ void BattlefieldWG::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_gui Battlefield::AddPlayerToResurrectQueue(npc_guid, player_guid); if (IsWarTime()) { - if (Player* player = sObjectMgr->GetPlayer(player_guid)) + if (Player* player = sObjectAccessor->FindPlayer(player_guid)) { if (!player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) { @@ -337,7 +338,7 @@ void BattlefieldWG::OnBattleStart() for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { // Kick player in orb room, TODO: offline player ? - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { float x, y, z; player->GetPosition(x, y, z); @@ -469,7 +470,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); if (player->HasAura(SPELL_LIEUTENANT)) @@ -492,7 +493,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) } for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { if (player->HasAura(SPELL_LIEUTENANT)) { @@ -511,7 +512,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->RemoveAura(SPELL_TOWER_CONTROL); player->RemoveAurasDueToSpell(SPELL_RECRUIT); @@ -539,7 +540,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID()); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); @@ -925,7 +926,7 @@ void BattlefieldWG::SendInitWorldStatesToAll() WorldPacket data = BuildInitWorldStates(); for (uint8 team = 0; team < 2; team++) for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->GetSession()->SendPacket(&data); } @@ -935,7 +936,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) { for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) IncrementQuest(player, WGQuest[player->GetTeamId()][2], true); } } @@ -952,12 +953,12 @@ void BattlefieldWG::AddBrokenTower(TeamId team) // Remove buff stack for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->RemoveAuraFromStack(SPELL_TOWER_CONTROL); // Add buff stack for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); IncrementQuest(player, WGQuest[player->GetTeamId()][3], true); @@ -1071,7 +1072,7 @@ void BattlefieldWG::UpdateTenacity() if (team != TEAM_NEUTRAL) { for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->getLevel() >= m_MinLevel) player->RemoveAurasDueToSpell(SPELL_TENACITY); @@ -1097,7 +1098,7 @@ void BattlefieldWG::UpdateTenacity() buff_honor = (newStack < 5) ? 0 : buff_honor; for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->SetAuraStack(SPELL_TENACITY, player, newStack); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) @@ -1107,7 +1108,7 @@ void BattlefieldWG::UpdateTenacity() if (buff_honor != 0) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->AddAura(buff_honor, player); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index da0d37cf27a..044bf7fb32e 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -821,6 +821,11 @@ class ObjectMgr return &_creatureQuestRelations; } + QuestRelations* GetCreatureQuestInvolvedRelation() + { + return &_creatureQuestInvolvedRelations; + } + QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry) { return _creatureQuestRelations.equal_range(creature_entry); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 2e0bbf786a9..475c1c42fca 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -565,46 +565,6 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/) } } -void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); -} - -void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); -} - void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index c26e78f3418..93bb15d844b 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1120,6 +1120,16 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return false; break; } + case 58730: // No fly Zone - Wintergrasp + { + if (!player) + return false; + + Battlefield* Bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()); + if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY))) + return false; + break; + } case 68719: // Oil Refinery - Isle of Conquest. case 68720: // Quarry - Isle of Conquest. { diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 9ec98491180..c0da783da71 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1201,6 +1201,14 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true); // call ScriptMgr if we're reloading the configuration + m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = ConfigMgr::GetBoolDefault("Wintergrasp.Enable", false); + m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMax", 100); + m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMin", 0); + m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMinLvl", 77); + m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.BattleTimer", 30); + m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.NoBattleTimer", 150); + m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = ConfigMgr::GetIntDefault("Wintergrasp.CrashRestartTimer", 10); + if (reload) sScriptMgr->OnConfigLoad(reload); } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index a11a47a19f9..4533f40ad8c 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -14,13 +14,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ScriptPCH.h" #include "BattlefieldMgr.h" #include "BattlefieldWG.h" #include "Battlefield.h" #include "ScriptSystem.h" #include "WorldSession.h" #include "ObjectMgr.h" +#include "Vehicle.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." -- cgit v1.2.3 From ba91b8bde9205954127070d62aeb254e804dd7b6 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 21 Feb 2012 14:26:46 -0500 Subject: change some packets. fix sql. --- Wintergrasp_temp/Quests.sql | 22 +-- src/server/game/Battlefield/BattlefieldHandler.cpp | 150 +++++++++++++++++++++ .../game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/game/Server/WorldSession.h | 11 +- 4 files changed, 172 insertions(+), 13 deletions(-) create mode 100644 src/server/game/Battlefield/BattlefieldHandler.cpp (limited to 'src') diff --git a/Wintergrasp_temp/Quests.sql b/Wintergrasp_temp/Quests.sql index 75f2e931806..d456f5d5e71 100644 --- a/Wintergrasp_temp/Quests.sql +++ b/Wintergrasp_temp/Quests.sql @@ -1,16 +1,16 @@ -- Wintergrasp Quests - Horde -UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `entry` IN (13180,13178); -- Slay them all! -UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `entry` IN (13185,13223); -- Stop/Defend the Siege -UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `entry` IN (13201,13194); -- Healing with Roses -UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `entry` IN (13193,13199); -- Bones and Arrows -UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `entry` IN (13192,13202); -- Warding/Jinxing the Walls -UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `entry` IN (13200,13191); -- Fueling the Demolishers +UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `id` IN (13180,13178); -- Slay them all! +UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `id` IN (13185,13223); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `id` IN (13201,13194); -- Healing with Roses +UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `id` IN (13193,13199); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `id` IN (13192,13202); -- Warding/Jinxing the Walls +UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `id` IN (13200,13191); -- Fueling the Demolishers -- Wintergrasp Quests - Alliance -UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `entry` IN (13179,13177); -- No Mercy for the Merciless -UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `entry` IN (13186,13222); -- Stop/Defend the Siege -UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `entry` IN (13195,13156); -- A Rare Herb -UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `entry` IN (13196,13154); -- Bones and Arrows -UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `entry` IN (13198,13153); -- Warding the Warriors +UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `id` IN (13179,13177); -- No Mercy for the Merciless +UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `id` IN (13186,13222); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `id` IN (13195,13156); -- A Rare Herb +UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `id` IN (13196,13154); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `id` IN (13198,13153); -- Warding the Warriors -- Note: The offered quests (they are in pairs) depend on who controls the keep. npc_wg_quest_giver does that already? diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp new file mode 100644 index 00000000000..950c9e34811 --- /dev/null +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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 . + */ + +#include "Common.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "WorldPacket.h" +#include "WorldSession.h" + +#include "Battlefield.h" +#include "BattlefieldMgr.h" +#include "Opcodes.h" + +//This send to player windows for invite player to join the war +//Param1:(BattleId) the BattleId of Bf +//Param2:(ZoneId) the zone where the battle is (4197 for wg) +//Param3:(time) Time in second that the player have for accept +void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time) +{ + //Send packet + WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12); + data << uint32(BattleId); + data << uint32(ZoneId); + data << uint32((time(NULL) + p_time)); + + //Sending the packet to player + SendPacket(&data); +} + +//This send invitation to player to join the queue +//Param1:(BattleId) the BattleId of Bf +void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId) +{ + WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5); + + data << uint32(BattleId); + data << uint8(1); //warmup ? used ? + + //Sending packet to player + SendPacket(&data); +} + +//This send packet for inform player that he join queue +//Param1:(BattleId) the BattleId of Bf +//Param2:(ZoneId) the zone where the battle is (4197 for wg) +//Param3:(CanQueue) if able to queue +//Param4:(Full) on log in is full +void WorldSession::SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full) +{ + WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11); + data << uint32(BattleId); + data << uint32(ZoneId); + data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued + data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming + data << uint8(1); //Warmup + SendPacket(&data); +} + +//This is call when player accept to join war +//Param1:(BattleId) the BattleId of Bf +void WorldSession::SendBfEntered(uint32 BattleId) +{ +// m_PlayerInWar[plr->GetTeamId()].insert(plr->GetGUID()); + WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7); + data << uint32(BattleId); + data << uint8(1); //unk + data << uint8(1); //unk + data << uint8(_player->isAFK() ? 1 : 0); //Clear AFK + SendPacket(&data); +} + +void WorldSession::SendBfLeaveMessage(uint32 BattleId, uint8 reason) +{ + WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7); + data << uint32(BattleId); + data << uint8(reason);//byte Reason (1=close invite,8="exited",10="to low level") + data << uint8(2);//byte BattleStatus + data << uint8(0);//bool Relocated + SendPacket(&data); +} + +//Send by client when he click on accept for queue +void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data) +{ + uint32 BattleId; + uint8 Accepted; + + recv_data >> BattleId >> Accepted; + sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + if (!Bf) + return; + + if (Accepted) + { + Bf->PlayerAcceptInviteToQueue(_player); + } +} + +//Send by client on clicking in accept or refuse of invitation windows for join game +void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data) +{ + uint32 BattleId; + uint8 Accepted; + + recv_data >> BattleId >> Accepted; + sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + if (!Bf) + return; + + //If player accept invitation + if (Accepted) + { + Bf->PlayerAcceptInviteToWar(_player); + } + else + { + if (_player->GetZoneId() == Bf->GetZoneId()) + Bf->KickPlayerFromBf(_player->GetGUID()); + } +} + +void WorldSession::HandleBfExitRequest(WorldPacket & recv_data) +{ + uint32 BattleId; + + recv_data >> BattleId; + sLog->outError("HandleBfExitRequest: BattleID:%u ", BattleId); + Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + if (!Bf) + return; + + Bf->AskToLeaveQueue(_player); +} diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 7e27f9560be..823691a60f3 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -25,7 +25,7 @@ #include "SpellAuras.h" #include "Vehicle.h" -enum eWGBfData +enum WGBfData { BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp BATTLEFIELD_WG_MAPID = 571, // Northrend diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index b8b09531082..413d0a586a3 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -786,7 +786,16 @@ class WorldSession void HandleResetInstancesOpcode(WorldPacket& recv_data); void HandleHearthAndResurrect(WorldPacket& recv_data); void HandleInstanceLockResponse(WorldPacket& recvPacket); - void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); + + // Battlefield + void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time); + void SendBfInvitePlayerToQueue(uint32 BattleId); + void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false); + void SendBfEntered(uint32 BattleId); + void SendBfLeaveMessage(uint32 BattleId, uint8 reason = 8); + void HandleBfQueueInviteResponse(WorldPacket &recv_data); + void HandleBfEntryInviteResponse(WorldPacket &recv_data); + void HandleBfExitRequest(WorldPacket &recv_data); // Looking for Dungeon/Raid void HandleLfgSetCommentOpcode(WorldPacket& recv_data); -- cgit v1.2.3 From f663f881f72a281218198363f4114adac895989a Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Feb 2012 11:52:54 -0500 Subject: fix broken stalker npc id. --- src/server/game/Battlefield/Zones/BattlefieldWG.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 6e604ef4e69..4c7afcdaeeb 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -187,7 +187,7 @@ enum eWGNpc // *INDENT-OFF* BATTLEFIELD_WG_NPC_GUARD_H = 30739, BATTLEFIELD_WG_NPC_GUARD_A = 30740, - BATTLEFIELD_WG_NPC_STALKER = 00000, + BATTLEFIELD_WG_NPC_STALKER = 15214, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296,// -- cgit v1.2.3 From 6318fd91ff3630923c0e2b088fe66c14f7c31101 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Feb 2012 12:55:51 -0500 Subject: added enum for battlefield leave reason. --- src/server/game/Battlefield/BattlefieldHandler.cpp | 11 ++++++++++- src/server/game/Server/WorldSession.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 950c9e34811..d21b285984d 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -26,6 +26,15 @@ #include "BattlefieldMgr.h" #include "Opcodes.h" +enum BFLeaveReason +{ + BF_LEAVE_REASON_CLOSE = 0x00000001, + //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used) + //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used) + BF_LEAVE_REASON_EXITED = 0x00000008, + BF_LEAVE_REASON_LOW_LEVEL = 0x00000010, +}; + //This send to player windows for invite player to join the war //Param1:(BattleId) the BattleId of Bf //Param2:(ZoneId) the zone where the battle is (4197 for wg) @@ -84,7 +93,7 @@ void WorldSession::SendBfEntered(uint32 BattleId) SendPacket(&data); } -void WorldSession::SendBfLeaveMessage(uint32 BattleId, uint8 reason) +void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason) { WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7); data << uint32(BattleId); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 413d0a586a3..6678ead6b7e 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -792,7 +792,7 @@ class WorldSession void SendBfInvitePlayerToQueue(uint32 BattleId); void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false); void SendBfEntered(uint32 BattleId); - void SendBfLeaveMessage(uint32 BattleId, uint8 reason = 8); + void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED); void HandleBfQueueInviteResponse(WorldPacket &recv_data); void HandleBfEntryInviteResponse(WorldPacket &recv_data); void HandleBfExitRequest(WorldPacket &recv_data); -- cgit v1.2.3 From dd05f1dcd278a2a50880d10a5df1549b4afbcc55 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Feb 2012 16:32:51 -0500 Subject: fix crash with groups, added enum for battlfield leave reasons --- src/server/game/Battlefield/Battlefield.cpp | 14 +++----------- src/server/game/Battlefield/BattlefieldHandler.cpp | 11 +---------- src/server/game/Server/WorldSession.h | 10 ++++++++++ 3 files changed, 14 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 6a5ca0b5c02..aa9cc34a115 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -103,17 +103,9 @@ void Battlefield::HandlePlayerLeaveZone(Player *plr, uint32 /*zone */ ) { m_PlayersInWar[plr->GetTeamId()].erase(plr->GetGUID()); plr->GetSession()->SendBfLeaveMessage(m_BattleId); - if (Group* group = GetGroupPlayer(plr->GetGUID(), plr->GetTeamId())) // remove from raid group if player is member - { - // I think that now is not a hack - if (!group->RemoveMember(plr->GetGUID())) // group was disbanded - { - m_Groups[plr->GetTeamId()].erase(group->GetGUID()); - group->SetBattlefieldGroup(NULL); - sGroupMgr->RemoveGroup(group); - delete group; - } - } + if (Group* group = plr->GetGroup()) // remove from raid group if player is member + group->RemoveMember(plr->GetGUID()); + OnPlayerLeaveWar(plr); //For scripting } } diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index d21b285984d..7785fd3bff5 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -26,15 +26,6 @@ #include "BattlefieldMgr.h" #include "Opcodes.h" -enum BFLeaveReason -{ - BF_LEAVE_REASON_CLOSE = 0x00000001, - //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used) - //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used) - BF_LEAVE_REASON_EXITED = 0x00000008, - BF_LEAVE_REASON_LOW_LEVEL = 0x00000010, -}; - //This send to player windows for invite player to join the war //Param1:(BattleId) the BattleId of Bf //Param2:(ZoneId) the zone where the battle is (4197 for wg) @@ -97,7 +88,7 @@ void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason) { WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7); data << uint32(BattleId); - data << uint8(reason);//byte Reason (1=close invite,8="exited",10="to low level") + data << uint8(reason);//byte Reason data << uint8(2);//byte BattleStatus data << uint8(0);//bool Relocated SendPacket(&data); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 6678ead6b7e..8bddd63170d 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -125,6 +125,16 @@ enum PartyResult ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30 }; + +enum BFLeaveReason +{ + BF_LEAVE_REASON_CLOSE = 0x00000001, + //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used) + //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used) + BF_LEAVE_REASON_EXITED = 0x00000008, + BF_LEAVE_REASON_LOW_LEVEL = 0x00000010, +}; + enum ChatRestrictionType { ERR_CHAT_RESTRICTED = 0, -- cgit v1.2.3 From 4c3692cc368d6217c095020a10a5b209b8dd4277 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Feb 2012 17:18:51 -0500 Subject: Battlefield/Wintergrasp/Scripts: removed a few unneeded casts. --- src/server/game/Battlefield/Battlefield.cpp | 2 +- src/server/scripts/Northrend/wintergrasp.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index aa9cc34a115..dab41b5c4b6 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -30,9 +30,9 @@ #include "GridNotifiersImpl.h" #include "CellImpl.h" #include "CreatureTextMgr.h" - #include "GroupMgr.h" + Battlefield::Battlefield() { m_Timer = 0; diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 4533f40ad8c..d7565fcfaf3 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -63,7 +63,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(1); if (!BfWG) return true; @@ -91,7 +91,7 @@ class npc_wg_demolisher_engineer : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(1); if (!BfWG) return true; @@ -132,7 +132,7 @@ class npc_wg_spirit_guide : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { GraveYardVect gy = BfWG->GetGraveYardVect(); @@ -154,7 +154,7 @@ class npc_wg_spirit_guide : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { GraveYardVect gy = BfWG->GetGraveYardVect(); @@ -183,7 +183,7 @@ class npc_wg_queue : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { @@ -214,7 +214,7 @@ class npc_wg_queue : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (BfWG->IsWarTime()) @@ -302,7 +302,7 @@ class npc_wg_quest_giver : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (pCreature->isQuestGiver()) -- cgit v1.2.3 From c580ec24a712390e55ac1c0be086aa73d349a7d2 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Tue, 28 Feb 2012 22:07:35 -0300 Subject: BF/Wintergrasp: Removed uneeded check , it has been performed on every tick update. It is already handled by the aura system. Furthermore, the aura is correctly added to the spirits using creature_template_addon, the statements for this are already in Template_update.sql --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 33 ---------------------- src/server/game/Battlefield/Zones/BattlefieldWG.h | 6 ---- 2 files changed, 39 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 823691a60f3..2638014b037 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -221,23 +221,6 @@ bool BattlefieldWG::Update(uint32 diff) else m_saveTimer -= diff; - for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr) - if (Player* player = sObjectAccessor->FindPlayer(*itr)) - { - if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) - { - const WorldSafeLocsEntry *graveyard = GetClosestGraveYard(player); - if (graveyard) - { - if (player->GetDistance2d(graveyard->x, graveyard->y) > 10.0f) - { - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - m_PlayersIsSpellImu.erase(player->GetGUID()); - } - } - } - } - if (m_BattlefieldActive) { for (uint8 team = 0; team < 2; ++team) @@ -268,22 +251,6 @@ bool BattlefieldWG::Update(uint32 diff) return m_return; } -void BattlefieldWG::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) -{ - Battlefield::AddPlayerToResurrectQueue(npc_guid, player_guid); - if (IsWarTime()) - { - if (Player* player = sObjectAccessor->FindPlayer(player_guid)) - { - if (!player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) - { - player->CastSpell(player, SPELL_SPIRITUAL_IMMUNITY, true); - m_PlayersIsSpellImu.insert(player->GetGUID()); - } - } - } -} - void BattlefieldWG::OnBattleStart() { // Spawn titan relic diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 4c7afcdaeeb..da16421df7f 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -365,11 +365,6 @@ class BattlefieldWG : public Battlefield void DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 incrementNumber = 1); - /** - * \brief called when a player is die, for add him to resurrect queue - */ - void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); - /** * \brief Called when battlefield is setup, at server start */ @@ -425,7 +420,6 @@ class BattlefieldWG : public Battlefield GameObjectSet DefenderPortalList; GameObjectSet m_KeepGameObject[2]; GuidSet m_vehicles[2]; - GuidSet m_PlayersIsSpellImu; // Player is dead uint32 m_tenacityStack; uint32 m_saveTimer; }; -- cgit v1.2.3 From 82b49c7b84c5b6e8a14eceed1ee54d1a71d396c0 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Wed, 29 Feb 2012 14:36:34 -0300 Subject: BF/Wintergrasp: Restored functionality to OnCreatureCreate function, which was out of date. --- src/server/game/Battlefield/Battlefield.h | 398 +++++++++++++++++++++ .../game/Battlefield/Zones/BattlefieldWG.cpp | 88 +++-- src/server/game/Battlefield/Zones/BattlefieldWG.h | 11 +- 3 files changed, 460 insertions(+), 37 deletions(-) create mode 100644 src/server/game/Battlefield/Battlefield.h (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h new file mode 100644 index 00000000000..7617538285f --- /dev/null +++ b/src/server/game/Battlefield/Battlefield.h @@ -0,0 +1,398 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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 . + */ + +#ifndef BATTLEFIELD_H_ +#define BATTLEFIELD_H_ + +#include "Utilities/Util.h" +#include "SharedDefines.h" +#include "ZoneScript.h" +#include "WorldPacket.h" +#include "GameObject.h" +#include "Battleground.h" + +enum BattlefieldTypes +{ + BATTLEFIELD_WG, // Wintergrasp + BATTLEFIELD_TB, // Tol Barad (cataclysm) +}; + +enum BattlefieldIDs +{ + BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle +}; + +enum BattlefieldObjectiveStates +{ + BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL = 0, + BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE, + BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE, + BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE, + BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE, + BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE, + BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE, +}; + +enum BattlefieldSounds +{ + BF_HORDE_WINS = 8454, + BF_ALLIANCE_WINS = 8455, + BF_START = 3439 +}; + +enum BattlefieldTimers +{ + BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000 +}; + +// some class predefs +class Player; +class GameObject; +class WorldPacket; +class Creature; +class Unit; + +class Battlefield; +class BfGraveYard; + +typedef std::set < uint64 > GuidSet; +typedef std::vector < BfGraveYard * >GraveYardVect; +typedef std::map < uint64, uint32 > PlayerTimerMap; + +class BfCapturePoint +{ +public: + BfCapturePoint(Battlefield * bf); + + virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {} + + // send world state update to all players present + void SendUpdateWorldState(uint32 field, uint32 value); + + // send kill notify to players in the controlling faction + void SendObjectiveComplete(uint32 id, uint64 guid); + + // used when player is activated/inactivated in the area + virtual bool HandlePlayerEnter(Player * plr); + virtual void HandlePlayerLeave(Player * plr); + //virtual void HandlePlayerActivityChanged(Player * plr); + + // checks if player is in range of a capture credit marker + bool IsInsideObjective(Player * plr) const; + + // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. + virtual bool Update(uint32 diff); + virtual void ChangeTeam(TeamId /*oldTeam */ ) {} + virtual void SendChangePhase(); + + bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o); + GameObject *GetCapturePointGo() { return m_capturePoint; } + + TeamId GetTeamId() {return m_team;} +protected: + bool DelCapturePoint(); + + // active players in the area of the objective, 0 - alliance, 1 - horde + GuidSet m_activePlayers[2]; + + // total shift needed to capture the objective + float m_maxValue; + float m_minValue; + + // maximum speed of capture + float m_maxSpeed; + + // the status of the objective + float m_value; + TeamId m_team; + + // objective states + BattlefieldObjectiveStates m_OldState; + BattlefieldObjectiveStates m_State; + + // neutral value on capture bar + uint32 m_neutralValuePct; + + // pointer to the Battlefield this objective belongs to + Battlefield *m_Bf; + uint32 m_capturePointEntry; + GameObject *m_capturePoint; +}; + +class BfGraveYard +{ +public: + BfGraveYard(Battlefield *Bf); + + // method for change who control the graveyard + void ChangeControl(TeamId team); + TeamId GetControlTeamId() { return m_ControlTeam; } + + // use for found the nearest graveyard + float GetDistance(Player * plr); + void Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy); + void AddPlayer(uint64 player_guid); + void RemovePlayer(uint64 player_guid); + + void Resurrect(); + void RelocateDeadPlayers(); + + bool HasNpc(uint64 guid) { return (m_SpiritGuide[0]->GetGUID() == guid || m_SpiritGuide[1]->GetGUID() == guid); } + bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } + uint32 GetGraveYardId() { return m_GraveyardId; } + +protected: + + TeamId m_ControlTeam; + uint32 m_GraveyardId; + Creature *m_SpiritGuide[2]; + GuidSet m_ResurrectQueue; + Battlefield *m_Bf; +}; + +class Battlefield:public ZoneScript +{ + friend class BattlefieldMgr; + + public: + /// Constructor + Battlefield(); + /// Destructor + virtual ~Battlefield(); + + /// typedef of map witch store capturepoint and the associate gameobject entry + typedef std::map < uint32 /*lowguid */ , BfCapturePoint * >BfCapturePointMap; + + /// Call this to init the Battlefield + virtual bool SetupBattlefield() { return true; } + + /// Generate packet which contain all worldstatedata of area + virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {} + + /// Update data of a worldstate to all players present in zone + void SendUpdateWorldState(uint32 field, uint32 value); + + /** + * \brief Called every time for update bf data and time + * -Update timer for start/end battle + * -Invite player in zone to queue x minutes before start (x = m_StartGroupingTimer) + * -Kick Afk players + * \param diff : time ellapsed since last call (in ms) + */ + virtual bool Update(uint32 diff); + + /// Invite all player in zone, to join the queue, called x minutes before battle start in Update() + void InvitePlayerInZoneToQueue(); + /// Invite all player in queue to join battle on battle start + void InvitePlayerInQueueToWar(); + /// Invite all player in zone to join battle on battle start + void InvitePlayerInZoneToWar(); + + /// Called when a Unit is kill in battlefield zone + virtual void HandleKill(Player * /*killer */ , Unit * /*killed */ ) {}; + + uint32 GetTypeId() { return m_TypeId; } + uint32 GetZoneId() { return m_ZoneId; } + + void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0); + + /// Return true if battle is start, false if battle is not started + bool IsWarTime() { return m_BattlefieldActive; } + + /// Enable or Disable battlefield + void SetEnable(bool enable) { m_enable = enable; } + /// Return if battlefield is enable + bool GetEnable() { return m_enable; } + + /** + * \brief Kick player from battlefield and teleport him to kick-point location + * \param guid : guid of player who must be kick + */ + void KickPlayerFromBf(uint64 guid); + + /// Called when player (plr) enter in zone + void HandlePlayerEnterZone(Player * plr, uint32 zone); + /// Called when player (plr) leave the zone + void HandlePlayerLeaveZone(Player * plr, uint32 zone); + + // All-purpose data storage 64 bit + virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; } + virtual void SetData64(uint32 DataId, uint64 Value) { m_Data64[DataId] = Value; } + + // All-purpose data storage 32 bit + virtual uint32 GetData(uint32 DataId) { return m_Data32[DataId]; } + virtual void SetData(uint32 DataId, uint32 Value) { m_Data32[DataId] = Value; } + + // Battlefield - generic methods + TeamId GetDefenderTeam() { return m_DefenderTeam; } + TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); } + void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; } + + // Group methods + /** + * \brief Find a not full battlefield group, if there is no, create one + * \param TeamId : Id of player team for who we search a group (plr->GetTeamId()) + */ + Group *GetFreeBfRaid(TeamId TeamId); + /// Return battlefield group where player is. + Group *GetGroupPlayer(uint64 guid, TeamId TeamId); + /// Force player to join a battlefield group + bool AddOrSetPlayerToCorrectBfGroup(Player * plr); + + // Graveyard methods + // Find which graveyard the player must be teleported to to be resurrected by spiritguide + WorldSafeLocsEntry const *GetClosestGraveYard(Player * plr); + + virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); + void RemovePlayerFromResurrectQueue(uint64 player_guid); + void SetGraveyardNumber(uint32 number) { m_GraveYardList.resize(number); } + BfGraveYard *GetGraveYardById(uint32 id); + + // Misc methods + Creature *SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); + Creature *SpawnCreature(uint32 entry, Position pos, TeamId team); + GameObject *SpawnGameObject(uint32 entry, float x, float y, float z, float o); + + // Script-methods + + /// Called on start + virtual void OnBattleStart() {}; + /// Called at the end of battle + virtual void OnBattleEnd(bool /*endbytimer */ ) {}; + /// Called x minutes before battle start when player in zone are invite to join queue + virtual void OnStartGrouping() {}; + /// Called when a player accept to join the battle + virtual void OnPlayerJoinWar(Player * /*plr */ ) {}; + /// Called when a player leave the battle + virtual void OnPlayerLeaveWar(Player * /*plr */ ) {}; + /// Called when a player leave battlefield zone + virtual void OnPlayerLeaveZone(Player * /*plr */ ) {}; + /// Called when a player enter in battlefield zone + virtual void OnPlayerEnterZone(Player * /*plr */ ) {}; + + WorldPacket BuildWarningAnnPacket(std::string msg); + void SendWarningToAllInZone(uint32 entry); + //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED + void SendWarningToPlayer(Player * plr, uint32 entry); + + void PlayerAcceptInviteToQueue(Player * plr); + void PlayerAcceptInviteToWar(Player * plr); + uint32 GetBattleId() { return m_BattleId; } + void AskToLeaveQueue(Player * plr); + + virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement */ , Player * /*player */ , uint8 /*incrementNumber = 1 */ ) {}; + + /// Send all worldstate data to all player in zone. + virtual void SendInitWorldStatesToAll() {}; + + /// Return if we can use mount in battlefield + bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not + bool IncrementQuest(Player * player, uint32 quest, bool complete = false); + void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid); + + void StartBattle(); + void EndBattle(bool endbytimer); + + void HideNpc(Creature * p_Creature); + void ShowNpc(Creature * p_Creature, bool p_Aggressive); + + GraveYardVect GetGraveYardVect() { return m_GraveYardList; } + + uint32 GetTimer() { return m_Timer; } + void SetTimer(uint32 timer) { m_Timer = timer; } + + void PlaySoundToAll(uint32 SoundID); + + void InvitePlayerToQueue(Player * plr); + void InvitePlayerToWar(Player * plr); + + void InitStalker(uint32 entry, float x, float y, float z, float o); + +protected: + uint64 StalkerGuid; + uint32 m_Timer; // Global timer for event + bool m_enable; + bool m_BattlefieldActive; + TeamId m_DefenderTeam; + + // the map of the objectives belonging to this outdoorpvp + BfCapturePointMap m_capturePoints; + + // the set of player + GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone + GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue + GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat + PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT]; + PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT]; + + //Variables that must exist for each battlefield + uint32 m_TypeId; // See enum BattlefieldTypes + uint32 m_BattleId; // BattleID (for packet) + uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197 + uint32 m_MapId; // MapId where is Battlefield + uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield + uint32 m_MinPlayer; // Minimum number of player for Battlefield start + uint32 m_MinLevel; // Required level to participate at Battlefield + uint32 m_BattleTime; // Length of a battle + uint32 m_NoWarBattleTime; // Time between two battles + uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle. + uint32 m_TimeForAcceptInvite; + uint32 m_uiKickDontAcceptTimer; + WorldLocation KickPosition; // Position where player is teleport if they switch to afk during battle or if they dont accept invitation + + uint32 m_uiKickAfkTimer; // Timer for check Afk in war + + //Graveyard variables + GraveYardVect m_GraveYardList; // Vector witch contain the different GY of the battle + uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec + + uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle + bool m_StartGrouping; // bool for know if all players in area has been invited + + GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group + + std::vector < uint64 > m_Data64; + std::vector < uint32 > m_Data32; + + void KickAfk(); + // use for switch off all worldstate for client + virtual void SendRemoveWorldStates(Player * /*plr */ ) {} + + // use for send a packet for all player list + void BroadcastPacketZone(WorldPacket & data) const; + void BroadcastPacketQueue(WorldPacket & data) const; + void BroadcastPacketWar(WorldPacket & data) const; + + //CapturePoint system + void AddCapturePoint(BfCapturePoint * cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; } + + BfCapturePoint *GetCapturePoint(uint32 lowguid) const + { + Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); + if (itr != m_capturePoints.end()) + return itr->second; + return NULL; + } + + void RegisterZone(uint32 zoneid); + bool HasPlayer(Player * plr) const; + void TeamCastSpell(TeamId team, int32 spellId); + +}; + +#endif diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 2638014b037..cc4b4711b62 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -578,7 +578,7 @@ void BattlefieldWG::OnStartGrouping() SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); } -void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add) +void BattlefieldWG::OnCreatureCreate(Creature *creature) { if (IsWarTime()) { @@ -597,49 +597,37 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add) else return; - if (add) + if (team == TEAM_HORDE) { - if (team == TEAM_HORDE) + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) - { - creature->AddAura(SPELL_HORDE_FLAG, creature); - m_vehicles[team].insert(creature->GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); - return; - } + creature->AddAura(SPELL_HORDE_FLAG, creature); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); } else { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) - { - creature->AddAura(SPELL_ALLIANCE_FLAG, creature); - m_vehicles[team].insert(creature->GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); - return; - } + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; } } else { - m_vehicles[team].erase(creature->GetGUID()); - if (team == TEAM_HORDE) - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--; + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) + { + creature->AddAura(SPELL_ALLIANCE_FLAG, creature); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); + } else - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--; - UpdateVehicleCountWG(); + { + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; + } } break; } @@ -647,6 +635,38 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add) } } +void BattlefieldWG::OnCreatureRemove(Creature* creature) +{ + if (IsWarTime()) + { + switch (creature->GetEntry()) + { + case 28312: + case 32627: + case 27881: + case 28094: + { + uint8 team; + if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) + team = TEAM_ALLIANCE; + else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) + team = TEAM_HORDE; + else + return; + + m_vehicles[team].erase(creature->GetGUID()); + if (team == TEAM_HORDE) + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--; + else + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--; + UpdateVehicleCountWG(); + + break; + } + } + } +} + // Called when player kill a unit in wg zone void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index da16421df7f..71a729f8ba7 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -338,11 +338,16 @@ class BattlefieldWG : public Battlefield bool Update(uint32 diff); /** - * \brief Called when a creature is spawn or remove from WG + * \brief Called when a creature is created * -Update vehicle count - * \param add : true > creature is spawn false > creature is remove */ - void OnCreatureCreate(Creature *creature, bool add); + void OnCreatureCreate(Creature *creature); + + /** + * \brief Called when a creature is removed + * -Update vehicle count + */ + void OnCreatureRemove(Creature* creature); /** * \brief Called when a wall/tower is broken -- cgit v1.2.3 From 3478f3e7b791c57e98be1496c3c96e97457c8e88 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Thu, 1 Mar 2012 02:03:52 -0300 Subject: BF/Wintergrasp: Now graveyards use db spawned spirits. --- src/server/game/Battlefield/Battlefield.cpp | 37 ++++++--------- src/server/game/Battlefield/Battlefield.h | 18 ++++++-- .../game/Battlefield/Zones/BattlefieldWG.cpp | 54 ++++++++++++++++++++-- src/server/game/Battlefield/Zones/BattlefieldWG.h | 16 ++++++- 4 files changed, 96 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index dab41b5c4b6..2e9e4607eec 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -717,30 +717,22 @@ BfGraveYard::BfGraveYard(Battlefield *Bf) m_ResurrectQueue.clear(); } -void BfGraveYard::Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy) +void BfGraveYard::Initialize(TeamId startcontrol, uint32 gy) { m_ControlTeam = startcontrol; - if (Creature* cre = m_Bf->SpawnCreature(horde_entry, x, y, z, o, TEAM_HORDE)) - { - m_SpiritGuide[TEAM_HORDE] = cre; - m_SpiritGuide[TEAM_HORDE]->SetReactState(REACT_PASSIVE); - if (m_ControlTeam == TEAM_ALLIANCE) - m_SpiritGuide[TEAM_HORDE]->SetVisible(false); - } - else - sLog->outError("BfGraveYard::Init can't spawn horde spiritguide %u", horde_entry); + m_GraveyardId = gy; +} - if (Creature* cre = m_Bf->SpawnCreature(alliance_entry, x, y, z, o, TEAM_ALLIANCE)) +void BfGraveYard::SetSpirit(Creature* spirit, TeamId team) +{ + if (!spirit) { - m_SpiritGuide[TEAM_ALLIANCE] = cre; - m_SpiritGuide[TEAM_ALLIANCE]->SetReactState(REACT_PASSIVE); - if (m_ControlTeam == TEAM_HORDE) - m_SpiritGuide[TEAM_ALLIANCE]->SetVisible(false); + sLog->outError(": Invalid Spirit."); + return; } - else - sLog->outError("BfGraveYard::Init can't spawn alliance spiritguide %u", alliance_entry); - m_GraveyardId = gy; + m_SpiritGuide[team] = spirit->GetGUID(); + spirit->SetReactState(REACT_PASSIVE); } float BfGraveYard::GetDistance(Player *plr) @@ -782,8 +774,8 @@ void BfGraveYard::Resurrect() // Check player isinworld and player is on good graveyard if (plr->IsInWorld()) - if (m_SpiritGuide[m_ControlTeam]) - m_SpiritGuide[m_ControlTeam]->CastSpell(m_SpiritGuide[m_ControlTeam], SPELL_SPIRIT_HEAL, true); + if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam])) + spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true); // Resurect player plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); @@ -801,10 +793,11 @@ void BfGraveYard::Resurrect() void BfGraveYard::ChangeControl(TeamId team) { // Guide switching - if (m_SpiritGuide[1 - team]) + // Note: Visiblity changes are made by phasing + /*if (m_SpiritGuide[1 - team]) m_SpiritGuide[1 - team]->SetVisible(false); if (m_SpiritGuide[team]) - m_SpiritGuide[team]->SetVisible(true); + m_SpiritGuide[team]->SetVisible(true);*/ m_ControlTeam = team; // Teleport to other graveyard, player witch were on this graveyard diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 7617538285f..77c9aa42c5b 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -145,14 +145,26 @@ public: // use for found the nearest graveyard float GetDistance(Player * plr); - void Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy); + void Initialize(TeamId startcontrol, uint32 gy); + void SetSpirit(Creature* spirit, TeamId team); void AddPlayer(uint64 player_guid); void RemovePlayer(uint64 player_guid); void Resurrect(); void RelocateDeadPlayers(); - bool HasNpc(uint64 guid) { return (m_SpiritGuide[0]->GetGUID() == guid || m_SpiritGuide[1]->GetGUID() == guid); } + bool HasNpc(uint64 guid) + { + // npcs could not be loaded in the map yet. + if (!m_SpiritGuide[0] || !m_SpiritGuide[1]) + return false; + + if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) || + !sObjectAccessor->FindUnit(m_SpiritGuide[1])) + return false; + + return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid); + } bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } uint32 GetGraveYardId() { return m_GraveyardId; } @@ -160,7 +172,7 @@ protected: TeamId m_ControlTeam; uint32 m_GraveyardId; - Creature *m_SpiritGuide[2]; + uint64 m_SpiritGuide[2]; GuidSet m_ResurrectQueue; Battlefield *m_Bf; }; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index cc4b4711b62..fdca7c0c520 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -88,10 +88,13 @@ bool BattlefieldWG::SetupBattlefield() for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++) { BfGraveYardWG *gy = new BfGraveYardWG(this); - if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) // When between games, the graveyard is controlled by the defending team - gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, m_DefenderTeam, WGGraveYard[i].gyid); + + // When between games, the graveyard is controlled by the defending team + if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) + gy->Initialize(m_DefenderTeam, WGGraveYard[i].gyid); else - gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + gy->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + gy->SetTextId(WGGraveYard[i].textid); m_GraveYardList[i] = gy; } @@ -578,8 +581,53 @@ void BattlefieldWG::OnStartGrouping() SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); } +uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) +{ + uint8 graveyardId = 0; + + switch (areaId) + { + case AREA_WINTERGRASP_FORTRESS: + return BATTLEFIELD_WG_GY_KEEP; + case AREA_THE_SUNKEN_RING: + return BATTLEFIELD_WG_GY_WORKSHOP_NE; + case AREA_THE_BROKEN_TEMPLATE: + return BATTLEFIELD_WG_GY_WORKSHOP_NW; + case AREA_WESTPARK_WORKSHOP: + return BATTLEFIELD_WG_GY_WORKSHOP_SW; + case AREA_EASTPARK_WORKSHOP: + return BATTLEFIELD_WG_GY_WORKSHOP_SE; + case AREA_WINTERGRASP: + return BATTLEFIELD_WG_GY_ALLIANCE; + case AREA_THE_CHILLED_QUAGMIRE: + return BATTLEFIELD_WG_GY_HORDE; + default: + sLog->outError(": Unexpected Area Id %u", areaId); + break; + } + + return graveyardId; +} + void BattlefieldWG::OnCreatureCreate(Creature *creature) { + // Accessing to db spawned creatures + switch (creature->GetEntry()) + { + // Alliance Spirit + case NPC_DWARVEN_SPIRIT_GUIDE: + // Horde Spirit + case NPC_TAUNKA_SPIRIT_GUIDE: + { + TeamId teamId = creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE; + uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId()); + if (m_GraveYardList[graveyardId]) + m_GraveYardList[graveyardId]->SetSpirit(creature, teamId); + } + break; + } + + // untested code - not sure if it is valid. if (IsWarTime()) { switch (creature->GetEntry()) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 71a729f8ba7..d95b1bdab85 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -142,6 +142,18 @@ enum eWGWorldStates BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, }; + +enum WGAreaIds +{ + AREA_WINTERGRASP_FORTRESS = 4575, + AREA_THE_SUNKEN_RING = 4538, + AREA_THE_BROKEN_TEMPLATE = 4539, + AREA_WESTPARK_WORKSHOP = 4611, + AREA_EASTPARK_WORKSHOP = 4612, + AREA_WINTERGRASP = 4197, + AREA_THE_CHILLED_QUAGMIRE = 4589, +}; + /*######################### *####### Graveyards ######* #########################*/ @@ -157,7 +169,7 @@ class BfGraveYardWG : public BfGraveYard uint32 m_GossipTextId; }; -enum eWGGraveyardId +enum WGGraveyardId { BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GY_WORKSHOP_NW, @@ -414,6 +426,8 @@ class BattlefieldWG : public Battlefield void UpdateTenacity(); void ProcessEvent(WorldObject *obj, uint32 eventId); + // returns the graveyardId in the specified area. + uint8 GetSpiritGraveyardId(uint32 areaId); protected: bool m_CanClickOnOrb; GameObject* m_relic; -- cgit v1.2.3 From efcfdc4c397b12ddd0613cae74568e5df895c341 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Thu, 1 Mar 2012 19:27:00 -0300 Subject: BF/Wintergrasp: It's not necessary to remove Spell Spiritual Immunity manually. --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index fdca7c0c520..b04b63d0312 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -862,7 +862,6 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); @@ -883,7 +882,6 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); @@ -903,7 +901,6 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); -- cgit v1.2.3 From 1f6eec4754f3fd8b6c74d19140010f4c057f0ddf Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Fri, 2 Mar 2012 15:23:07 -0300 Subject: BF/Wintergrasp: Implemented better support for Wintergrasp phasing. It has been done by checking player's distance to the Caputre Point on every tick. Now it is performed using spell_area. P.D: Reverted my last commit, it was wrong (my apologies) --- Wintergrasp_temp/Spells.sql | 52 ++++++++++++++++++++++ Wintergrasp_temp/Spells.txt | 29 ------------ .../game/Battlefield/Zones/BattlefieldWG.cpp | 34 ++++++++------ src/server/game/Battlefield/Zones/BattlefieldWG.h | 2 + src/server/game/Spells/SpellMgr.cpp | 22 +++++++++ 5 files changed, 97 insertions(+), 42 deletions(-) create mode 100644 Wintergrasp_temp/Spells.sql delete mode 100644 Wintergrasp_temp/Spells.txt (limited to 'src') diff --git a/Wintergrasp_temp/Spells.sql b/Wintergrasp_temp/Spells.sql new file mode 100644 index 00000000000..91719f47e4b --- /dev/null +++ b/Wintergrasp_temp/Spells.sql @@ -0,0 +1,52 @@ +SET @SPELL_HORDE := 56618; +SET @SPELL_ALLIANCE := 56617; + +SET @AREA_SUNKEN_RING := 4538; +SET @AREA_BROKEN_TEMPLE := 4539; +SET @AREA_W_WORKSHOP := 4611; +SET @AREA_E_WORKSHOP := 4612; + +DELETE FROM `spell_area` WHERE `spell` IN (@SPELL_HORDE, @SPELL_ALLIANCE); +INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES +(@SPELL_HORDE, @AREA_SUNKEN_RING, 1), +(@SPELL_ALLIANCE, @AREA_SUNKEN_RING, 1), +(@SPELL_HORDE, @AREA_BROKEN_TEMPLE, 1), +(@SPELL_ALLIANCE, @AREA_BROKEN_TEMPLE, 1), +(@SPELL_HORDE, @AREA_W_WORKSHOP, 1), +(@SPELL_ALLIANCE, @AREA_W_WORKSHOP, 1), +(@SPELL_HORDE, @AREA_E_WORKSHOP, 1), +(@SPELL_ALLIANCE, @AREA_E_WORKSHOP, 1); + +/* + +Spell 56617 "Alliance Controls Factory Phase Shift" Adds Phase 32 +Spell 56618 "Horde Controls Factory Phase Shift" Adds Phase 16 + +Spell 55773 "Horde Control Phase Shift" Adds Phase 64 +Spell 55774 "Alliance Control Phase Shift" Adds Phase 128 + +Spell 58045 "Essence of Wintergrasp" Adds Phase 256 + +Spell 37795 "Recruit" Gained when joining WG battle + +Spell 74411 "Battleground - Dampening" Gained when joining WG battle + +Spell 61409 "Build Siege Vehicle (Force)" is cast by npc 30400 "Goblin Mechanic " on player +Spell 56664 "Build Catapult (Force)" is cast by npc 30499 "Gnomish Engineer " on player +Spell 56662 "Build Siege Vehicle (Force)" is cast by npc 30499 "Gnomish Engineer " on player + +Spell 50398 "Riding Trainer Advertisement" is cast by npc 30869 "Arzo Safeflight " on self + +Wintergrasp Vehicle On spawn entries: 28312,27881,28094,32627 +set x,y,z,o to nearest trigger entry: 23472 +make player cast 60968 on vehicle +aura 14267 on self if player is horde +aura 14268 on self if player is alliance + +Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns): +61178 (Grab Passenger) (Catapult, Siege Engine... NOT tower cannons) +56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons) +14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons) +14267 (Horde Flag) + +*/ diff --git a/Wintergrasp_temp/Spells.txt b/Wintergrasp_temp/Spells.txt deleted file mode 100644 index 583e46db04e..00000000000 --- a/Wintergrasp_temp/Spells.txt +++ /dev/null @@ -1,29 +0,0 @@ -Spell 56617 "Alliance Controls Factory Phase Shift" Adds Phase 32 -Spell 56618 "Horde Controls Factory Phase Shift" Adds Phase 16 - -Spell 55773 "Horde Control Phase Shift" Adds Phase 64 -Spell 55774 "Alliance Control Phase Shift" Adds Phase 128 - -Spell 58045 "Essence of Wintergrasp" Adds Phase 256 - -Spell 37795 "Recruit" Gained when joining WG battle - -Spell 74411 "Battleground - Dampening" Gained when joining WG battle - -Spell 61409 "Build Siege Vehicle (Force)" is cast by npc 30400 "Goblin Mechanic " on player -Spell 56664 "Build Catapult (Force)" is cast by npc 30499 "Gnomish Engineer " on player -Spell 56662 "Build Siege Vehicle (Force)" is cast by npc 30499 "Gnomish Engineer " on player - -Spell 50398 "Riding Trainer Advertisement" is cast by npc 30869 "Arzo Safeflight " on self - -Wintergrasp Vehicle On spawn entries: 28312,27881,28094,32627 -set x,y,z,o to nearest trigger entry: 23472 -make player cast 60968 on vehicle -aura 14267 on self if player is horde -aura 14268 on self if player is alliance - -Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns): -61178 (Grab Passenger) (Catapult, Siege Engine... NOT tower cannons) -56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons) -14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons) -14267 (Horde Flag) \ No newline at end of file diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index b04b63d0312..3e64894a8ed 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -238,19 +238,6 @@ bool BattlefieldWG::Update(uint32 diff) } - for (uint8 team = 0; team < 2; ++team) - for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectAccessor->FindPlayer(*itr)) - for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr) - { - if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150 - { - player->AddAura((*cp_itr).second->GetTeamId() == TEAM_HORDE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT, player); - player->RemoveAurasDueToSpell((*cp_itr).second->GetTeamId() == TEAM_ALLIANCE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); - break; - } - } - return m_return; } @@ -862,6 +849,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); @@ -882,6 +870,7 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); @@ -901,6 +890,7 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); @@ -913,6 +903,24 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player) SendInitWorldStatesTo(player); } +uint32 BattlefieldWG::GetData(uint32 data) +{ + switch (data) + { + // Used to determine when the phasing spells must be casted + // See: SpellArea::IsFitToRequirements + case AREA_THE_SUNKEN_RING: + case AREA_THE_BROKEN_TEMPLATE: + case AREA_WESTPARK_WORKSHOP: + case AREA_EASTPARK_WORKSHOP: + // Graveyards and Workshops are controlled by the same team. + if (m_GraveYardList[GetSpiritGraveyardId(data)]) + return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); + } + + return 0; +} + // Method sending worldsate to player WorldPacket BattlefieldWG::BuildInitWorldStates() { diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index d95b1bdab85..94210dd3fd3 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -428,6 +428,8 @@ class BattlefieldWG : public Battlefield // returns the graveyardId in the specified area. uint8 GetSpiritGraveyardId(uint32 areaId); + + uint32 GetData(uint32 data); protected: bool m_CanClickOnOrb; GameObject* m_relic; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 93bb15d844b..1d929d00215 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -30,6 +30,8 @@ #include "CreatureAI.h" #include "MapManager.h" #include "BattlegroundIC.h" +#include "BattlefieldWG.h" +#include "BattlefieldMgr.h" bool IsPrimaryProfessionSkill(uint32 skill) { @@ -1145,6 +1147,26 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return false; } + case 56618: // Horde Controls Factory Phase Shift + case 56617: // Alliance Controls Factory Phase Shift + { + if (!player) + return false; + + Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()); + + if (!bf || bf->GetTypeId() != BATTLEFIELD_WG) + return false; + + // team that controls the workshop in the specified area + uint32 team = bf->GetData(newArea); + + if (team == TEAM_HORDE) + return spellId == 56618; + else if (team == TEAM_ALLIANCE) + return spellId == 56617; + } + break; } return true; -- cgit v1.2.3 From d7a7a9800b734f71074da84338ba29a93009a198 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Fri, 2 Mar 2012 22:00:26 -0300 Subject: Battlefield: Make sBattlefieldMgr a pointer. By Subv. --- src/server/game/Battlefield/Battlefield.cpp | 2 +- src/server/game/Battlefield/BattlefieldHandler.cpp | 6 +- src/server/game/Battlefield/BattlefieldMgr.h | 79 +++++++++ src/server/game/Entities/Object/Object.cpp | 8 + src/server/game/Entities/Player/Player.cpp | 10 +- src/server/game/Entities/Unit/Unit.cpp | 5 + src/server/game/Handlers/MiscHandler.cpp | 53 ++++++ src/server/game/Spells/Auras/SpellAuraEffects.cpp | 4 + src/server/game/Spells/Spell.cpp | 1 + src/server/game/Spells/SpellMgr.cpp | 4 +- src/server/game/World/World.cpp | 7 + src/server/scripts/Commands/cs_bf.cpp | 180 +++++++++++++++++++++ src/server/scripts/Northrend/wintergrasp.cpp | 14 +- 13 files changed, 359 insertions(+), 14 deletions(-) create mode 100644 src/server/game/Battlefield/BattlefieldMgr.h create mode 100644 src/server/scripts/Commands/cs_bf.cpp (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 2e9e4607eec..f9c4e4736d4 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -494,7 +494,7 @@ void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) void Battlefield::RegisterZone(uint32 zoneId) { - sBattlefieldMgr.AddZone(zoneId, this); + sBattlefieldMgr->AddZone(zoneId, this); } void Battlefield::HideNpc(Creature *p_Creature) diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 7785fd3bff5..0b26ae8dc55 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -102,7 +102,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data) recv_data >> BattleId >> Accepted; sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); - Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -120,7 +120,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data) recv_data >> BattleId >> Accepted; sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); - Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -142,7 +142,7 @@ void WorldSession::HandleBfExitRequest(WorldPacket & recv_data) recv_data >> BattleId; sLog->outError("HandleBfExitRequest: BattleID:%u ", BattleId); - Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h new file mode 100644 index 00000000000..a447d787be7 --- /dev/null +++ b/src/server/game/Battlefield/BattlefieldMgr.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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 . + */ + +#ifndef BATTLEFIELD_MGR_H_ +#define BATTLEFIELD_MGR_H_ + +#include "Battlefield.h" +#include "ace/Singleton.h" + +class Player; +class GameObject; +class Creature; +class ZoneScript; +struct GossipMenuItems; + +// class to handle player enter / leave / areatrigger / GO use events +class BattlefieldMgr +{ + public: + // ctor + BattlefieldMgr(); + // dtor + ~BattlefieldMgr(); + + // create battlefield events + void InitBattlefield(); + // called when a player enters an battlefield area + void HandlePlayerEnterZone(Player * plr, uint32 areaflag); + // called when player leaves an battlefield area + void HandlePlayerLeaveZone(Player * plr, uint32 areaflag); + // called when player resurrects + void HandlePlayerResurrects(Player * plr, uint32 areaflag); + // return assigned battlefield + Battlefield *GetBattlefieldToZoneId(uint32 zoneid); + Battlefield *GetBattlefieldByBattleId(uint32 battleid); + + ZoneScript *GetZoneScript(uint32 zoneId); + + void AddZone(uint32 zoneid, Battlefield * handle); + + void Update(uint32 diff); + + void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid); + + bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso); + + void HandleDropFlag(Player * plr, uint32 spellId); + + typedef std::vector < Battlefield * >BattlefieldSet; + typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap; + private: + // contains all initiated battlefield events + // used when initing / cleaning up + BattlefieldSet m_BattlefieldSet; + // maps the zone ids to an battlefield event + // used in player event handling + BattlefieldMap m_BattlefieldMap; + // update interval + uint32 m_UpdateTimer; +}; + +#define sBattlefieldMgr ACE_Singleton::instance() + +#endif diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index b910fee951b..b265648d0c4 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2329,9 +2329,17 @@ void WorldObject::SetZoneScript() if (map->IsDungeon()) m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript(); else if (!map->IsBattlegroundOrArena()) + { + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); } } + m_zoneScript = bf; + else + m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); + } + } +} TempSummon* WorldObject::SummonCreature(uint32 entry, const Position &pos, TempSummonType spwtype, uint32 duration, uint32 /*vehId*/) const { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2814b7dba64..2cb38d615ac 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2405,6 +2405,7 @@ void Player::RemoveFromWorld() StopCastingBindSight(); UnsummonPetTemporaryIfAny(); sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); + sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); } ///- Do not add/remove the player from the object storage @@ -5493,7 +5494,12 @@ void Player::RepopAtGraveyard() if (Battleground* bg = GetBattleground()) ClosestGrave = bg->GetClosestGraveYard(this); else - ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); + { + if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) + ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this); + else + ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); + } // stop countdown until repop m_deathTimer = 0; @@ -7413,6 +7419,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) { sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone); + sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); + sBattlefieldMgr->HandlePlayerEnterZone(this, newZone); SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange... } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d65d717c236..5e94ea3146a 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15675,9 +15675,14 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh... // handle player kill only if not suicide (spirit of redemption for example) if (player && this != victim) + { if (OutdoorPvP* pvp = player->GetOutdoorPvP()) pvp->HandleKill(player, victim); + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId())) + bf->HandleKill(player, victim); + } + //if (victim->GetTypeId() == TYPEID_PLAYER) // if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP()) // pvp->HandlePlayerActivityChangedpVictim->ToPlayer(); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 02b0ef9fc05..26b41a62928 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -1687,11 +1687,64 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) SendPacket(&data); } +//Battlefield and Battleground +void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->SendAreaSpiritHealerQueryOpcode(_player,guid); +} + +void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); +} + void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/) { if (_player->isInFlight()) return; + if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + { + // bf->PlayerAskToLeave(_player); FIXME + return; + } + AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId()); if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2)) return; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 610cd7d1533..e8675d52b2d 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5016,8 +5016,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool case 2584: // Waiting to Resurrect // Waiting to resurrect spell cancel, we must remove player from resurrect queue if (target->GetTypeId() == TYPEID_PLAYER) + { if (Battleground* bg = target->ToPlayer()->GetBattleground()) bg->RemovePlayerFromResurrectQueue(target->GetGUID()); + if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId())) + bf->RemovePlayerFromResurrectQueue(target->GetGUID()); + } break; case 36730: // Flame Strike { diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 1dedf8ba916..5281eb16f0c 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5442,6 +5442,7 @@ SpellCastResult Spell::CheckCast(bool strict) // allow always ghost flight spells if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive()) { + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId()); if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId())) if (pArea->flags & AREA_FLAG_NO_FLY_ZONE) return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 1d929d00215..9545a03a9f4 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1127,7 +1127,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 if (!player) return false; - Battlefield* Bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()); if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY))) return false; break; @@ -1153,7 +1153,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 if (!player) return false; - Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()); if (!bf || bf->GetTypeId() != BATTLEFIELD_WG) return false; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index c0da783da71..c4ff906bc35 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1729,6 +1729,10 @@ void World::SetInitialWorldSettings() sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System"); sOutdoorPvPMgr->InitOutdoorPvP(); + ///- Initialize Battlefield + sLog->outString("Starting Battlefield System"); + sBattlefieldMgr->InitBattlefield(); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); sMapMgr->LoadTransports(); @@ -1993,6 +1997,9 @@ void World::Update(uint32 diff) sOutdoorPvPMgr->Update(diff); RecordTimeDiff("UpdateOutdoorPvPMgr"); + sBattlefieldMgr->Update(diff); + RecordTimeDiff("BattlefieldMgr"); + ///- Delete all characters which have been deleted X days before if (m_timers[WUPDATE_DELETECHARS].Passed()) { diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp new file mode 100644 index 00000000000..4eee7c391b0 --- /dev/null +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2008-2011 TrinityCore + * + * 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 . + */ + +/* ScriptData +Name: bf_commandscript +%Complete: 100 +Comment: All bf related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "BattlefieldMgr.h" + +class bf_commandscript : public CommandScript +{ +public: + bf_commandscript() : CommandScript("bf_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand battlefieldcommandTable[] = + { + { "start", SEC_ADMINISTRATOR, false, &HandleBattlefieldStart, "", NULL }, + { "stop", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnd, "", NULL }, + { "switch", SEC_ADMINISTRATOR, false, &HandleBattlefieldSwitch, "", NULL }, + { "timer", SEC_ADMINISTRATOR, false, &HandleBattlefieldTimer, "", NULL }, + { "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "bf", SEC_ADMINISTRATOR, false, NULL, "", battlefieldcommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleBattlefieldStart(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + + battleid = atoi(battleid_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + bf->StartBattle(); + + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp (Command start used)"); + + return true; + } + + static bool HandleBattlefieldEnd(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + + battleid = atoi(battleid_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + bf->EndBattle(true); + + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp (Command stop used)"); + + return true; + } + + static bool HandleBattlefieldEnable(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + + battleid = atoi(battleid_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + if (bf->GetEnable()) + { + bf->SetEnable(false); + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp is disabled"); + } + else + { + bf->SetEnable(true); + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp is enabled"); + } + + return true; + } + + static bool HandleBattlefieldSwitch(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + + battleid = atoi(battleid_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + bf->EndBattle(false); + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp (Command switch used)"); + + return true; + } + + static bool HandleBattlefieldTimer(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + uint32 time = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + char* time_str = strtok(NULL, " "); + if (!time_str) + return false; + + battleid = atoi(battleid_str); + + time = atoi(time_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + bf->SetTimer(time * IN_MILLISECONDS); + bf->SendInitWorldStatesToAll(); + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)"); + + return true; + } +}; + +void AddSC_bf_commandscript() +{ + new bf_commandscript(); +} diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index d7565fcfaf3..936be459f9b 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -63,7 +63,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); if (!BfWG) return true; @@ -91,7 +91,7 @@ class npc_wg_demolisher_engineer : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); if (!BfWG) return true; @@ -132,7 +132,7 @@ class npc_wg_spirit_guide : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { GraveYardVect gy = BfWG->GetGraveYardVect(); @@ -154,7 +154,7 @@ class npc_wg_spirit_guide : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { GraveYardVect gy = BfWG->GetGraveYardVect(); @@ -183,7 +183,7 @@ class npc_wg_queue : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { @@ -214,7 +214,7 @@ class npc_wg_queue : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (BfWG->IsWarTime()) @@ -302,7 +302,7 @@ class npc_wg_quest_giver : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (pCreature->isQuestGiver()) -- cgit v1.2.3 From 27bfafe0e15ab07b98f3684c6f3ae98100cab1c2 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Sun, 4 Mar 2012 01:24:00 -0300 Subject: BF/Wintergrasp: Removed harcoded Workshops related spawns, db data is used now. --- Wintergrasp_temp/Spawns.sql | 10 + src/server/game/Battlefield/Battlefield.cpp | 48 +-- src/server/game/Battlefield/Battlefield.h | 4 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 103 ++++--- src/server/game/Battlefield/Zones/BattlefieldWG.h | 327 +++++++-------------- 5 files changed, 213 insertions(+), 279 deletions(-) (limited to 'src') diff --git a/Wintergrasp_temp/Spawns.sql b/Wintergrasp_temp/Spawns.sql index ab061598df7..3464ed3ee0a 100644 --- a/Wintergrasp_temp/Spawns.sql +++ b/Wintergrasp_temp/Spawns.sql @@ -1,3 +1,13 @@ +-- Before pushing to master check if guids are free. +-- Spawns Workshop Capture Points +SET @GUID := 4594; +DELETE FROM gameobject WHERE guid IN (@GUID+1,@GUID+2,@GUID+3,@GUID+4); +INSERT INTO gameobject (guid,id,position_x,position_y,position_z,orientation,map) VALUES +(@GUID+1, 190475, 4949.344238, 2432.585693, 320.176971, 1.386214, 571), -- ne +(@GUID+2, 190487, 4948.524414, 3342.337891, 376.875366, 4.400566, 571), -- nw +(@GUID+3, 194959, 4398.076660, 2356.503662, 376.190491, 0.525406, 571), -- se +(@GUID+4, 194962, 4390.776367, 3304.094482, 372.429077, 6.097023, 571); -- sw + -- EVERYTHING UNDER HERE IS WIP /* SET @OGUID := XXXXX; diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index f9c4e4736d4..b0bf1a41669 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -944,40 +944,40 @@ void BfCapturePoint::SendChangePhase() SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); } -bool BfCapturePoint::SetCapturePointData(uint32 entry, uint32 /*map */ , float x, float y, float z, float o) +bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) { - sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", entry); + ASSERT(capturePoint); + + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry()); + + m_capturePoint = capturePoint; // check info existence - GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); + GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(capturePoint->GetEntry()); if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { - sLog->outError("OutdoorPvP: GO %u is not capture point!", entry); + sLog->outError("OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); return false; } - m_capturePoint = m_Bf->SpawnGameObject(entry, x, y, z, o); - if (m_capturePoint) + + // get the needed values from goinfo + m_maxValue = goinfo->capturePoint.maxTime; + m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60); + m_neutralValuePct = goinfo->capturePoint.neutralPercent; + m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100; + m_capturePointEntry = capturePoint->GetEntry(); + if (m_team == TEAM_ALLIANCE) { - // get the needed values from goinfo - m_maxValue = goinfo->capturePoint.maxTime; - m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60); - m_neutralValuePct = goinfo->capturePoint.neutralPercent; - m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100; - m_capturePointEntry = entry; - if (m_team == TEAM_ALLIANCE) - { - m_value = m_maxValue; - m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE; - } - else - { - m_value = -m_maxValue; - m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE; - } - return true; + m_value = m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE; + } + else + { + m_value = -m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE; } - return false; + return true; } bool BfCapturePoint::DelCapturePoint() diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 77c9aa42c5b..ba34e07a4e4 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -100,8 +100,8 @@ public: virtual void ChangeTeam(TeamId /*oldTeam */ ) {} virtual void SendChangePhase(); - bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o); - GameObject *GetCapturePointGo() { return m_capturePoint; } + bool SetCapturePointData(GameObject* capturePoint); + GameObject* GetCapturePointGo() { return m_capturePoint; } TeamId GetTeamId() {return m_team;} protected: diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 3e64894a8ed..4c39f75938c 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -99,37 +99,21 @@ bool BattlefieldWG::SetupBattlefield() m_GraveYardList[i] = gy; } + // Spawn workshop creatures and gameobjects for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++) { - BfWGWorkShopData *ws = new BfWGWorkShopData(this); // Create new object - // Init:setup variable - ws->Init(WGWorkShopDataBase[i].worldstate, WGWorkShopDataBase[i].type, WGWorkShopDataBase[i].nameid); - // Spawn associate npc on this point (Guard/Engineer) - for (uint8 c = 0; c < WGWorkShopDataBase[i].nbcreature; c++) - ws->AddCreature(WGWorkShopDataBase[i].CreatureData[c]); - - // Spawn associate gameobject on this point (Horde/Alliance flags) - for (uint8 g = 0; g < WGWorkShopDataBase[i].nbgob; g++) - ws->AddGameObject(WGWorkShopDataBase[i].GameObjectData[g]); - - // Create PvPCapturePoint - if (WGWorkShopDataBase[i].type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - { - ws->ChangeControl(GetAttackerTeam(), true); // Update control of this point - // Create Object - BfCapturePointWG *workshop = new BfCapturePointWG(this, GetAttackerTeam()); - // Spawn gameobject associate (see in OnGameObjectCreate, of OutdoorPvP for see association) - workshop->SetCapturePointData(WGWorkShopDataBase[i].CapturePoint.entryh, 571, - WGWorkShopDataBase[i].CapturePoint.x, WGWorkShopDataBase[i].CapturePoint.y, WGWorkShopDataBase[i].CapturePoint.z, 0); - workshop->LinkToWorkShop(ws); // Link our point to the capture point (for faction changement) - AddCapturePoint(workshop); // Add this capture point to list for update this (view in Update() of OutdoorPvP) - } + WGWorkshop* workshop = new WGWorkshop(this, i); + if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + workshop->ChangeControl(GetAttackerTeam(), true); else - ws->ChangeControl(GetDefenderTeam(), true); // Update control of this point (Keep workshop= to deffender team) + workshop->ChangeControl(GetDefenderTeam(), true); + + //Note: Capture point is added once the gameobject is created. - WorkShopList.insert(ws); + WorkshopsList.insert(workshop); } + // Spawning npc in keep for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++) { @@ -285,7 +269,7 @@ void BattlefieldWG::OnBattleStart() m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF] = 0; // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) - for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { if (*itr) (*itr)->UpdateGraveYardAndWorkshop(); @@ -320,13 +304,13 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = 0; m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = 0; - for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { - if (BfWGWorkShopData* workshop = *itr) + if (WGWorkshop* workshop = (*itr)) { - if (workshop->m_TeamControl == TEAM_ALLIANCE) + if (workshop->teamControl == TEAM_ALLIANCE) m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4; - else if (workshop->m_TeamControl == TEAM_HORDE) + else if (workshop->teamControl == TEAM_HORDE) m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] + 4; } } @@ -408,7 +392,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) // Saving data for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) (*itr)->Save(); - for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) (*itr)->Save(); uint32 WinHonor = 0; @@ -702,6 +686,52 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature) } } +void BattlefieldWG::OnGameObjectCreate(GameObject* go) +{ + bool isWorkshop = false; + uint8 workshopId = 0; + + switch (go->GetEntry()) + { + case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE: + isWorkshop = true; + workshopId = BATTLEFIELD_WG_WORKSHOP_NE; + break; + case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW: + isWorkshop = true; + workshopId = BATTLEFIELD_WG_WORKSHOP_NW; + break; + case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE: + isWorkshop = true; + workshopId = BATTLEFIELD_WG_WORKSHOP_SE; + break; + case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW: + isWorkshop = true; + workshopId = BATTLEFIELD_WG_WORKSHOP_SW; + break; + + } + + if (isWorkshop) + { + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) + { + if (WGWorkshop* workshop = (*itr)) + { + if (workshop->workshopId == workshopId) + { + BfCapturePointWG* capturePoint = new BfCapturePointWG(this, GetAttackerTeam()); + + capturePoint->SetCapturePointData(go); + capturePoint->LinkToWorkShop(workshop); + AddCapturePoint(capturePoint); + break; + } + } + } + } +} + // Called when player kill a unit in wg zone void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { @@ -924,12 +954,12 @@ uint32 BattlefieldWG::GetData(uint32 data) // Method sending worldsate to player WorldPacket BattlefieldWG::BuildInitWorldStates() { - WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkShopList.size() * 8))); + WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8))); data << uint32(m_MapId); data << uint32(m_ZoneId); data << uint32(0); - data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkShopList.size()); + data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkshopsList.size()); data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam()); data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam()); @@ -948,9 +978,12 @@ WorldPacket BattlefieldWG::BuildInitWorldStates() { data << (*itr)->m_WorldState << (*itr)->m_State; } - for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { - data << (*itr)->m_WorldState << (*itr)->m_State; + if (!*itr) + continue; + + data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state; } return data; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 94210dd3fd3..9d70d0b5ce4 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -36,11 +36,11 @@ class BattlefieldWG; class BfCapturePointWG; struct BfWGGameObjectBuilding; -struct BfWGWorkShopData; +struct WGWorkshop; typedef std::setGameObjectSet; typedef std::set GameObjectBuilding; -typedef std::set WorkShop; +typedef std::set Workshop; //typedef std::set CapturePointSet; unused ? typedef std::set GroupSet; @@ -260,9 +260,9 @@ const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = { class BfCapturePointWG : public BfCapturePoint { public: - BfCapturePointWG(BattlefieldWG *bf, TeamId control); + BfCapturePointWG(BattlefieldWG* bf, TeamId control); - void LinkToWorkShop(BfWGWorkShopData *ws) + void LinkToWorkShop(WGWorkshop* ws) { m_WorkShop = ws; } @@ -274,7 +274,7 @@ class BfCapturePointWG : public BfCapturePoint } protected: - BfWGWorkShopData *m_WorkShop; + WGWorkshop *m_WorkShop; }; /*######################### @@ -361,6 +361,8 @@ class BattlefieldWG : public Battlefield */ void OnCreatureRemove(Creature* creature); + void OnGameObjectCreate(GameObject* go); + /** * \brief Called when a wall/tower is broken * -Update quest @@ -436,7 +438,7 @@ class BattlefieldWG : public Battlefield GameObjectBuilding BuildingsInZone; GuidSet KeepCreature[2]; GuidSet OutsideCreature[2]; - WorkShop WorkShopList; + Workshop WorkshopsList; GuidSet CanonList; GameObjectSet DefenderPortalList; GameObjectSet m_KeepGameObject[2]; @@ -471,7 +473,7 @@ enum eWGGameObjectState BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY, }; -enum eWGWorkShopType +enum WGWorkshopId { BATTLEFIELD_WG_WORKSHOP_NE, BATTLEFIELD_WG_WORKSHOP_NW, @@ -481,6 +483,15 @@ enum eWGWorkShopType BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, }; +enum WGWorldstate +{ + WORLDSTATE_WORKSHOP_NE = 3701, + WORLDSTATE_WORKSHOP_NW = 3700, + WORLDSTATE_WORKSHOP_SE = 3703, + WORLDSTATE_WORKSHOP_SW = 3702, + WORLDSTATE_WORKSHOP_K_W = 3698, + WORLDSTATE_WORKSHOP_K_E = 3699 +}; enum eWGTeamControl { BATTLEFIELD_WG_TEAM_ALLIANCE, @@ -518,7 +529,7 @@ enum eWGText // *INDENT-ON* }; -enum eWGObject +enum WGObject { // *INDENT-OFF* BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE = 190475, @@ -1100,219 +1111,29 @@ const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] = // *****************WorkShop Data & Element***************** // ********************************************************* -struct BfWGWorkShopDataBase +#define WG_MAX_WORKSHOP 6 + +struct WGWorkshopData { - uint32 entry; + uint8 id; uint32 worldstate; - uint32 type; - uint32 nameid; - BfWGObjectPosition CapturePoint; - uint8 nbcreature; - BfWGObjectPosition CreatureData[10]; - uint8 nbgob; - BfWGObjectPosition GameObjectData[10]; + uint32 text; }; -// 6 engineer per faction in sql / 6 engineer per faction in header -#define WG_MAX_WORKSHOP 6 -const BfWGWorkShopDataBase WGWorkShopDataBase[WG_MAX_WORKSHOP] = { - { - 192031, - 3701, - BATTLEFIELD_WG_WORKSHOP_NE, - BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE, - { 4949.344238f, 2432.585693f, 320.176971f, 1.386214f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE }, - 1, - { - { 4939.759766f, 2389.060059f, 326.153015f, 3.263770f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }, - 6, - { - { 4778.189f, 2438.060f, 345.644f, -2.940f, 192280, 192274 }, - { 5024.569f, 2532.750f, 344.023f, -1.937f, 192280, 192274 }, - { 4811.399f, 2441.899f, 358.207f, -2.003f, 192435, 192406 }, - { 4805.669f, 2407.479f, 358.191f, 1.780f, 192435, 192406 }, - { 5004.350f, 2486.360f, 358.449f, 2.172f, 192435, 192406 }, - { 4983.279f, 2503.090f, 358.177f, -0.427f, 192435, 192406 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192030, - 3700, - BATTLEFIELD_WG_WORKSHOP_NW, - BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW, - { 4948.524414f, 3342.337891f, 376.875366f, 4.400566f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW }, - 1, - { - { 4964.890137f, 3383.060059f, 382.911011f, 6.126110f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }, - 4, - { - { 5006.339f, 3280.399f, 371.162f, 2.225f, 192280, 192274 }, - { 5041.609f, 3294.399f, 382.149f, -1.631f, 192434, 192406 }, - { 4857.970f, 3335.439f, 368.881f, -2.945f, 192280, 192274 }, - { 4855.629f, 3297.620f, 376.739f, -3.132f, 192435, 192406 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192033, - 3703, - BATTLEFIELD_WG_WORKSHOP_SE, - BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE, - { 4398.076660f, 2356.503662f, 376.190491f, 0.525406f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE }, - 9, - { - { 4417.919922f, 2331.239990f, 370.919006f, 5.846850f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4418.609863f, 2355.290039f, 372.490997f, 6.021390f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4391.669922f, 2300.610107f, 374.743011f, 4.921830f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4349.120117f, 2299.280029f, 374.743011f, 4.904380f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4333.549805f, 2333.909912f, 376.156006f, 0.973007f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4413.430176f, 2393.449951f, 376.359985f, 1.064650f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4388.129883f, 2411.979980f, 374.743011f, 1.640610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4349.540039f, 2411.260010f, 374.743011f, 2.059490f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4357.669922f, 2357.989990f, 382.006989f, 1.675520f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 } - }, - 2, - { - { 4417.250f, 2301.139f, 377.213f, 0.026f, 192435, 192406 }, - { 4417.939f, 2324.810f, 371.576f, 3.080f, 192280, 192274 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192032, - 3702, - BATTLEFIELD_WG_WORKSHOP_SW, - BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW, - { 4390.776367f, 3304.094482f, 372.429077f, 6.097023f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW }, - 9, - { - { 4425.290039f, 3291.510010f, 370.773987f, 0.122173f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4424.609863f, 3321.100098f, 369.800995f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4392.399902f, 3354.610107f, 369.597992f, 1.570800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4370.979980f, 3355.020020f, 371.196991f, 1.675520f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4394.660156f, 3231.989990f, 369.721985f, 4.625120f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4366.979980f, 3233.560059f, 371.584991f, 4.939280f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4337.029785f, 3261.659912f, 373.524994f, 3.263770f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4323.779785f, 3287.100098f, 378.894989f, 2.862340f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4354.149902f, 3312.820068f, 378.045990f, 1.675520f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 } - }, - 3, - { - { 4438.299f, 3361.080f, 371.567f, -0.017f, 192435, 192406 }, - { 4448.169f, 3235.629f, 370.411f, -1.562f, 192435, 192406 }, - { 4424.149f, 3286.540f, 371.545f, 3.124f, 192280, 192274 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192028, - 3698, - BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, - 0, - { 0, 0, 0, 0, 0, 0 }, - 1, - { - { 5392.910156f, 2975.260010f, 415.222992f, 4.555310f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }, - 0, - { - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192029, - 3699, - BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, - 0, - { 0, 0, 0, 0, 0, 0 }, - 1, - { - { 5391.609863f, 2707.719971f, 415.050995f, 4.555310f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }, - 0, - { - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - } + +const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] = +{ + // NE + {BATTLEFIELD_WG_WORKSHOP_NE, WORLDSTATE_WORKSHOP_NE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE}, + // NW + {BATTLEFIELD_WG_WORKSHOP_NW, WORLDSTATE_WORKSHOP_NW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW}, + // SE + {BATTLEFIELD_WG_WORKSHOP_SE, WORLDSTATE_WORKSHOP_SE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE}, + // SW + {BATTLEFIELD_WG_WORKSHOP_SW, WORLDSTATE_WORKSHOP_SW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW}, + // KEEP WEST - It can't be taken, so it doesn't have a textid + {BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, WORLDSTATE_WORKSHOP_K_W, NULL}, + // KEEP EAST - It can't be taken, so it doesn't have a textid + {BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, WORLDSTATE_WORKSHOP_K_E, NULL} }; // ******************************************************************** @@ -1771,6 +1592,76 @@ struct BfWGGameObjectBuilding } }; +struct WGWorkshop +{ + // pointer to the battlefield that the workshop belongs to + BattlefieldWG* bf; + // id of the workshop, useful to retrieve data of the WorkshopsData array + uint8 workshopId; + // team that controls the node + uint8 teamControl; + // for worldstate + uint32 state; + + WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId) + { + ASSERT(bf); + ASSERT(_workshopId < WG_MAX_WORKSHOP); + + bf = _bf; + workshopId = _workshopId; + } + + void ChangeControl(uint8 team, bool init /* for first call in setup */ ) + { + switch (team) + { + case BATTLEFIELD_WG_TEAM_NEUTRAL: + { + // Send warning message to all player to inform a faction attack to a workshop + // alliance / horde attacking a workshop + bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1); + break; + } + case BATTLEFIELD_WG_TEAM_ALLIANCE: + case BATTLEFIELD_WG_TEAM_HORDE: + { + // Updating worldstate + state = team == BATTLEFIELD_WG_TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT; + bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state); + + // Warning message + if (!init) // workshop taken - alliance + bf->SendWarningToAllInZone(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text+1); + + // Found associate graveyard and update it + if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (bf->GetGraveYardById(workshopId)) + bf->GetGraveYardById(workshopId)->ChangeControl(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE); + + teamControl = team; + break; + } + } + + if (!init) + bf->UpdateCounterVehicle(false); + } + + void UpdateGraveYardAndWorkshop() + { + if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + bf->GetGraveYardById(workshopId)->ChangeControl(TeamId(teamControl)); + else + ChangeControl(bf->GetDefenderTeam(), true); + } + + void Save() + { + sWorld->setWorldState(WorkshopsData[workshopId].worldstate, state); + } +}; + // Structure for the 6 workshop struct BfWGWorkShopData { -- cgit v1.2.3 From ce17607595a0fd83a0ed95bbccd132c5a5738598 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Sun, 4 Mar 2012 13:29:05 -0300 Subject: BF/Battlefield: Small improvement, thanks to Subv. --- src/server/game/Battlefield/Battlefield.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index b0bf1a41669..501351f2e4d 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -953,8 +953,8 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) m_capturePoint = capturePoint; // check info existence - GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(capturePoint->GetEntry()); - if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) + GameObjectTemplate const* goinfo = capturePoint->GetGOInfo(); + if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { sLog->outError("OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); return false; -- cgit v1.2.3 From f9c9622f86b963dbd7cf57d6dc73577797f11fd8 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 4 Mar 2012 13:01:50 -0500 Subject: Battlefields/WG: Refactored duplicated code --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 59 +++++----------------- src/server/game/Battlefield/Zones/BattlefieldWG.h | 6 ++- 2 files changed, 18 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 4c39f75938c..6fafbf823e9 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -452,18 +452,10 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (uint8 team = 0; team < 2; ++team) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - { if (Player* player = sObjectAccessor->FindPlayer(*itr)) - { - player->RemoveAura(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_RECRUIT); - player->RemoveAurasDueToSpell(SPELL_CORPORAL); - player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); - player->RemoveAurasDueToSpell(SPELL_TENACITY); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - } - } - m_PlayersInWar[team].clear(); + RemoveAurasFromPlayer(player); + + m_PlayersInWar[team].clear(); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) { @@ -826,7 +818,7 @@ void BattlefieldWG::PromotePlayer(Player* killer) } } -void BattlefieldWG::OnPlayerJoinWar(Player* player) +void BattlefieldWG::RemoveAurasFromPlayer(Player* player) { player->RemoveAurasDueToSpell(SPELL_RECRUIT); player->RemoveAurasDueToSpell(SPELL_CORPORAL); @@ -835,6 +827,12 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player) player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); +} + +void BattlefieldWG::OnPlayerJoinWar(Player* player) +{ + RemoveAurasFromPlayer(player); player->CastSpell(player, SPELL_RECRUIT, true); @@ -875,15 +873,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) { if (player->GetVehicle()) // Remove vehicle of player if he go out. player->GetVehicle()->Dismiss(); - player->RemoveAurasDueToSpell(SPELL_RECRUIT); - player->RemoveAurasDueToSpell(SPELL_CORPORAL); - player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - player->RemoveAurasDueToSpell(SPELL_TENACITY); - player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); - player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + RemoveAurasFromPlayer(player); } player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); @@ -893,18 +883,9 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) void BattlefieldWG::OnPlayerLeaveZone(Player* player) { - player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); if (!m_BattlefieldActive) - { - player->RemoveAurasDueToSpell(SPELL_RECRUIT); - player->RemoveAurasDueToSpell(SPELL_CORPORAL); - player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - player->RemoveAurasDueToSpell(SPELL_TENACITY); - player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - } + RemoveAurasFromPlayer(player); + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); @@ -913,20 +894,8 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) void BattlefieldWG::OnPlayerEnterZone(Player* player) { - player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); if (!m_BattlefieldActive) - { - player->RemoveAurasDueToSpell(SPELL_RECRUIT); - player->RemoveAurasDueToSpell(SPELL_CORPORAL); - player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - player->RemoveAurasDueToSpell(SPELL_TENACITY); - player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - if (player->GetTeamId() == GetDefenderTeam()) - player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); - } + RemoveAurasFromPlayer(player); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); // Send worldstate to player diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 9d70d0b5ce4..e46bf2b7e5b 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -383,6 +383,8 @@ class BattlefieldWG : public Battlefield void AddBrokenTower(TeamId team); void DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 incrementNumber = 1); + + void RemoveAurasFromPlayer(Player* player); /** * \brief Called when battlefield is setup, at server start @@ -390,13 +392,13 @@ class BattlefieldWG : public Battlefield bool SetupBattlefield(); /// Return pointer to relic object - GameObject *GetRelic() + GameObject* GetRelic() { return m_relic; } /// Define relic object - void SetRelic(GameObject * relic) + void SetRelic(GameObject* relic) { m_relic = relic; } -- cgit v1.2.3 From 29343947e9da820d19b3f003c3551caa38bfe927 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:34:19 -0500 Subject: Core/Battlefield: attempt to fix crashes. please test and confirm --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/game/Battlefield/Zones/BattlefieldWG.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6fafbf823e9..7a3a1514671 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -321,7 +321,7 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) void BattlefieldWG::OnBattleEnd(bool endbytimer) { // Remove relic - if (m_relic) + if (m_relic && m_relic->isSpawned()) m_relic->RemoveFromWorld(); m_relic = NULL; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index e46bf2b7e5b..b5f4ffe8ad7 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1607,7 +1607,7 @@ struct WGWorkshop WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId) { - ASSERT(bf); + ASSERT(_bf); ASSERT(_workshopId < WG_MAX_WORKSHOP); bf = _bf; -- cgit v1.2.3 From e9323b2c2def116360b987532ae7634fcd116122 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:37:05 -0500 Subject: Core/Battlefield: revert part of previous commit and correctly fix .bf stop crashing --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/scripts/Commands/cs_bf.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 7a3a1514671..6fafbf823e9 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -321,7 +321,7 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) void BattlefieldWG::OnBattleEnd(bool endbytimer) { // Remove relic - if (m_relic && m_relic->isSpawned()) + if (m_relic) m_relic->RemoveFromWorld(); m_relic = NULL; diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index 4eee7c391b0..750550353ec 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -83,7 +83,7 @@ public: Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); - if (!bf) + if (!bf || !bf->IsWarTime()) return false; bf->EndBattle(true); -- cgit v1.2.3 From 00f88588380f5372cb66e31b67dae56e9da44de5 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:39:28 -0500 Subject: Core/Battlefield: attempt to correctly fix again. --- src/server/game/Battlefield/Battlefield.cpp | 2 ++ src/server/scripts/Commands/cs_bf.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 501351f2e4d..e55000df320 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -327,6 +327,8 @@ void Battlefield::StartBattle() void Battlefield::EndBattle(bool endbytimer) { + if (!m_BattlefieldActive) + return false; m_BattlefieldActive = false; m_StartGrouping = false; diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index 750550353ec..d410ae890f9 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -61,7 +61,7 @@ public: Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); - if (!bf) + if (!bf || bf->) return false; bf->StartBattle(); @@ -83,7 +83,7 @@ public: Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); - if (!bf || !bf->IsWarTime()) + if (!bf) return false; bf->EndBattle(true); -- cgit v1.2.3 From 7491926e0c800c71a6ee409129b4eb71190339cf Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:45:44 -0500 Subject: Core/Battlefield: fix stupid mistakes. sorry! --- src/server/game/Battlefield/Battlefield.cpp | 3 ++- src/server/scripts/Commands/cs_bf.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index e55000df320..3b1036ef3bd 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -328,7 +328,8 @@ void Battlefield::StartBattle() void Battlefield::EndBattle(bool endbytimer) { if (!m_BattlefieldActive) - return false; + return; + m_BattlefieldActive = false; m_StartGrouping = false; diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index d410ae890f9..4eee7c391b0 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -61,7 +61,7 @@ public: Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); - if (!bf || bf->) + if (!bf) return false; bf->StartBattle(); -- cgit v1.2.3 From 07c8eec9634cbb992c8ac3da8b6cd56c66262e66 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:51:04 -0500 Subject: Core/Battlefield: remove handling for aura application when entering water. handled by liquid data. --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6fafbf823e9..6d04ab7874c 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -208,20 +208,6 @@ bool BattlefieldWG::Update(uint32 diff) else m_saveTimer -= diff; - if (m_BattlefieldActive) - { - for (uint8 team = 0; team < 2; ++team) - for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - { - if (unit->IsInWater() && !unit->HasAura(SPELL_WINTERGRASP_WATER)) - unit->AddAura(SPELL_WINTERGRASP_WATER, unit); - if (!unit->IsInWater() && unit->HasAura(SPELL_WINTERGRASP_WATER)) - unit->RemoveAurasDueToSpell(SPELL_WINTERGRASP_WATER); - } - - } - return m_return; } -- cgit v1.2.3 From b04ad4401d986a8f7fb0a1b0928d67cbda86dd64 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 10:14:02 -0500 Subject: Core/Battlefield: Cleaned up all incrementquest functions as this is a hacky way to do it --- src/server/game/Battlefield/Battlefield.cpp | 39 ---------------------- src/server/game/Battlefield/Battlefield.h | 1 - .../game/Battlefield/Zones/BattlefieldWG.cpp | 17 ++-------- 3 files changed, 3 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 3b1036ef3bd..009a1974422 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -668,45 +668,6 @@ void Battlefield::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64 &guid pl->GetSession()->SendPacket(&data); } -bool Battlefield::IncrementQuest(Player *player, uint32 quest, bool complete) -{ - if (!player) - return false; - - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest); - if (!pQuest || player->GetQuestStatus(quest) == QUEST_STATUS_NONE) - return false; - - if (complete) - { - player->CompleteQuest(quest); - return true; - } - else - { - for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - { - int32 creature = pQuest->RequiredNpcOrGo[i]; - if (uint32 spell_id = pQuest->RequiredSpellCast[i]) - { - player->CastedCreatureOrGO(creature, 0, spell_id); - return true; - } - else if (creature > 0) - { - player->KilledMonsterCredit(creature, 0); - return true; - } - else if (creature < 0) - { - player->CastedCreatureOrGO(creature, 0, 0); - return true; - } - } - } - return false; -} - //-------------------- //-BfGraveYard Method- //-------------------- diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index ba34e07a4e4..9f3bcb18f53 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -314,7 +314,6 @@ class Battlefield:public ZoneScript /// Return if we can use mount in battlefield bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not - bool IncrementQuest(Player * player, uint32 quest, bool complete = false); void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid); void StartBattle(); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6d04ab7874c..bd8a51c13f8 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -410,7 +410,6 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) player->RewardHonor(NULL, 1, WinHonor); RewardMarkOfHonor(player, 2); } - IncrementQuest(player, WGQuest[player->GetTeamId()][1], true); // Send Wintergrasp victory achievement DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); // Award achievement for succeeding in Wintergrasp in 10 minutes or less @@ -719,8 +718,6 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) bool again = false; if (victim->GetTypeId() == TYPEID_PLAYER) { - IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); - IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr) { if (Player* player = sObjectAccessor->FindPlayer(*itr)) @@ -739,12 +736,6 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (victim->GetEntry() == creature->GetEntry() && !again) { again = true; - for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) - { - if (Player* player = sObjectAccessor->FindPlayer(*iter)) - if (player->GetDistance2d(killer) < 40) - IncrementQuest(player, WGQuest[player->GetTeamId()][0]); - } } } } @@ -759,8 +750,6 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (victim->GetEntry() == creature->GetEntry() && !again) { again = true; - IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); - IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) { if (Player* player = sObjectAccessor->FindPlayer(*iter)) @@ -960,14 +949,15 @@ void BattlefieldWG::SendInitWorldStatesToAll() void BattlefieldWG::BrokenWallOrTower(TeamId team) { - if (team == GetDefenderTeam()) +// might be some use for this in the future. old code commented out below. KL +/* if (team == GetDefenderTeam()) { for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { if (Player* player = sObjectAccessor->FindPlayer(*itr)) IncrementQuest(player, WGQuest[player->GetTeamId()][2], true); } - } + }*/ } // Called when a tower is broke void BattlefieldWG::AddBrokenTower(TeamId team) @@ -989,7 +979,6 @@ void BattlefieldWG::AddBrokenTower(TeamId team) if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); - IncrementQuest(player, WGQuest[player->GetTeamId()][3], true); DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); } // If the threw south tower is destroy -- cgit v1.2.3 From 547bb4757539aab76771061b9a25fdf7785978ed Mon Sep 17 00:00:00 2001 From: thomas33 Date: Mon, 12 Mar 2012 15:07:27 +0100 Subject: Core/Battlefield: plr -> player --- src/server/game/Battlefield/Battlefield.cpp | 272 ++++++++++----------- src/server/game/Battlefield/Battlefield.h | 48 ++-- src/server/game/Battlefield/BattlefieldHandler.cpp | 2 +- src/server/game/Battlefield/BattlefieldMgr.cpp | 143 +++++++++++ src/server/game/Battlefield/BattlefieldMgr.h | 8 +- src/server/game/Battlefield/Zones/BattlefieldWG.h | 20 +- 6 files changed, 318 insertions(+), 175 deletions(-) create mode 100644 src/server/game/Battlefield/BattlefieldMgr.cpp (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 009a1974422..085be81c98f 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -63,62 +63,62 @@ Battlefield::~Battlefield() { } -void Battlefield::HandlePlayerEnterZone(Player *plr, uint32 /*zone */ ) +void Battlefield::HandlePlayerEnterZone(Player *player, uint32 /*zone */ ) { //If battle is start, // if it not fully > invite player to join the war // if it fully > announce to player that BF is full and kick after few second if he dont leave if (IsWarTime()) { - if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) //Not fully + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) //Not fully { - InvitePlayerToWar(plr); + InvitePlayerToWar(player); } else //Full { //TODO:Send packet for announce it to player - m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; - InvitePlayerToQueue(plr); + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; + InvitePlayerToQueue(player); } } else { //If time left is <15 minutes invite player to join queue if (m_Timer <= m_StartGroupingTimer) - InvitePlayerToQueue(plr); + InvitePlayerToQueue(player); } //Add player in list of player in zone - m_players[plr->GetTeamId()].insert(plr->GetGUID()); - OnPlayerEnterZone(plr); //for scripting + m_players[player->GetTeamId()].insert(player->GetGUID()); + OnPlayerEnterZone(player); //for scripting } //Called when a player leave the zone -void Battlefield::HandlePlayerLeaveZone(Player *plr, uint32 /*zone */ ) +void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ ) { if (IsWarTime()) { //if player is in war list - if (m_PlayersInWar[plr->GetTeamId()].find(plr->GetGUID()) != m_PlayersInWar[plr->GetTeamId()].end()) + if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end()) { - m_PlayersInWar[plr->GetTeamId()].erase(plr->GetGUID()); - plr->GetSession()->SendBfLeaveMessage(m_BattleId); - if (Group* group = plr->GetGroup()) // remove from raid group if player is member - group->RemoveMember(plr->GetGUID()); + m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID()); + player->GetSession()->SendBfLeaveMessage(m_BattleId); + if (Group* group = player->GetGroup()) // remove from raid group if player is member + group->RemoveMember(player->GetGUID()); - OnPlayerLeaveWar(plr); //For scripting + OnPlayerLeaveWar(player); //For scripting } } for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - itr->second->HandlePlayerLeave(plr); - - m_InvitedPlayers[plr->GetTeamId()].erase(plr->GetGUID()); - m_PlayersWillBeKick[plr->GetTeamId()].erase(plr->GetGUID()); - m_players[plr->GetTeamId()].erase(plr->GetGUID()); - SendRemoveWorldStates(plr); - RemovePlayerFromResurrectQueue(plr->GetGUID()); - OnPlayerLeaveZone(plr); //For scripting + itr->second->HandlePlayerLeave(player); + + m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID()); + m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID()); + m_players[player->GetTeamId()].erase(player->GetGUID()); + SendRemoveWorldStates(player); + RemovePlayerFromResurrectQueue(player->GetGUID()); + OnPlayerLeaveZone(player); //For scripting } bool Battlefield::Update(uint32 diff) @@ -196,17 +196,17 @@ void Battlefield::InvitePlayerInZoneToQueue() { for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - InvitePlayerToQueue(plr); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + InvitePlayerToQueue(player); } -void Battlefield::InvitePlayerToQueue(Player *plr) +void Battlefield::InvitePlayerToQueue(Player *player) { - if (m_PlayersInQueue[plr->GetTeamId()].count(plr->GetGUID())) + if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID())) return; - if (m_PlayersInQueue[plr->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[plr->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer) - plr->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); + if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[player->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer) + player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); } void Battlefield::InvitePlayerInQueueToWar() @@ -215,10 +215,10 @@ void Battlefield::InvitePlayerInQueueToWar() { for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) { - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) - InvitePlayerToWar(plr); + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) + InvitePlayerToWar(player); else { //Full @@ -234,49 +234,49 @@ void Battlefield::InvitePlayerInZoneToWar() for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) + if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID())) continue; - if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) - InvitePlayerToWar(plr); + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) + InvitePlayerToWar(player); else { //full - m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; } } } } -void Battlefield::InvitePlayerToWar(Player *plr) +void Battlefield::InvitePlayerToWar(Player *player) { - if (!plr) + if (!player) return; // TODO : needed ? - if (plr->isInFlight()) + if (player->isInFlight()) return; - if (plr->InArena() || plr->GetBattleground()) + if (player->InArena() || player->GetBattleground()) { - m_PlayersInQueue[plr->GetTeamId()].erase(plr->GetGUID()); + m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID()); return; } - if (plr->getLevel() < m_MinLevel) + if (player->getLevel() < m_MinLevel) { - if (m_PlayersWillBeKick[plr->GetTeamId()].count(plr->GetGUID()) == 0) - m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0) + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; return; } //Check if player is not already in war - if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) + if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID())) return; - m_PlayersWillBeKick[plr->GetTeamId()].erase(plr->GetGUID()); - m_InvitedPlayers[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + m_TimeForAcceptInvite; - plr->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite); + m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID()); + m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite; + player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite); } void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) @@ -291,16 +291,16 @@ void Battlefield::KickAfk() { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - if (plr->isAFK()) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + if (player->isAFK()) KickPlayerFromBf(*itr); } void Battlefield::KickPlayerFromBf(uint64 guid) { - if (Player* plr = sObjectAccessor->FindPlayer(guid)) - if (plr->GetZoneId() == GetZoneId()) - plr->TeleportTo(KickPosition); + if (Player* player = sObjectAccessor->FindPlayer(guid)) + if (player->GetZoneId() == GetZoneId()) + player->TeleportTo(KickPosition); } void Battlefield::StartBattle() @@ -358,47 +358,47 @@ void Battlefield::PlaySoundToAll(uint32 SoundID) for (int team = 0; team < BG_TEAMS_COUNT; team++) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) { - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->GetSession()->SendPacket(&data); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } } -bool Battlefield::HasPlayer(Player *plr) const +bool Battlefield::HasPlayer(Player *player) const { - return m_players[plr->GetTeamId()].find(plr->GetGUID()) != m_players[plr->GetTeamId()].end(); + return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end(); } // Called in WorldSession::HandleBfQueueInviteResponse -void Battlefield::PlayerAcceptInviteToQueue(Player *plr) +void Battlefield::PlayerAcceptInviteToQueue(Player *player) { // Add player in queueVenez - m_PlayersInQueue[plr->GetTeamId()].insert(plr->GetGUID()); + m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID()); // Send notification - plr->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId); + player->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId); } // Called in WorldSession::HandleBfExitRequest -void Battlefield::AskToLeaveQueue(Player *plr) +void Battlefield::AskToLeaveQueue(Player *player) { // Remove player from queue - m_PlayersInQueue[plr->GetTeamId()].erase(plr->GetGUID()); + m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID()); } // Called in WorldSession::HandleBfEntryInviteResponse -void Battlefield::PlayerAcceptInviteToWar(Player *plr) +void Battlefield::PlayerAcceptInviteToWar(Player *player) { if (!IsWarTime()) return; - if (AddOrSetPlayerToCorrectBfGroup(plr)) + if (AddOrSetPlayerToCorrectBfGroup(player)) { - plr->GetSession()->SendBfEntered(m_BattleId); - m_PlayersInWar[plr->GetTeamId()].insert(plr->GetGUID()); - m_InvitedPlayers[plr->GetTeamId()].erase(plr->GetGUID()); + player->GetSession()->SendBfEntered(m_BattleId); + m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID()); + m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID()); //Remove player AFK - if (plr->isAFK()) - plr->ToggleAFK(); + if (player->isAFK()) + player->ToggleAFK(); - OnPlayerJoinWar(plr); //for scripting + OnPlayerJoinWar(player); //for scripting } } @@ -406,36 +406,36 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId) { if (spellId > 0) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->CastSpell(plr, (uint32) spellId, true); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->CastSpell(player, (uint32) spellId, true); else for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->RemoveAuraFromStack((uint32) - spellId); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->RemoveAuraFromStack((uint32) - spellId); } void Battlefield::BroadcastPacketZone(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->GetSession()->SendPacket(&data); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } void Battlefield::BroadcastPacketQueue(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->GetSession()->SendPacket(&data); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } void Battlefield::BroadcastPacketWar(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->GetSession()->SendPacket(&data); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg) @@ -477,22 +477,22 @@ void Battlefield::SendWarningToAllInZone(uint32 entry) WorldPacket data = BuildWarningAnnPacket(msg); BroadcastPacketWar(data); }*/ -void Battlefield::SendWarningToPlayer(Player *plr, uint32 entry) +void Battlefield::SendWarningToPlayer(Player *player, uint32 entry) { - if (!plr) + if (!player) return; if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) if (Creature* stalker = unit->ToCreature()) - sCreatureTextMgr->SendChat(stalker, (uint8)entry, plr->GetGUID()); + sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID()); } void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) { for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->SendUpdateWorldState(field, value); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->SendUpdateWorldState(field, value); } void Battlefield::RegisterZone(uint32 zoneId) @@ -550,30 +550,30 @@ Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) return NULL; } -bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *plr) +bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player) { - if (!plr->IsInWorld()) + if (!player->IsInWorld()) return false; - if (Group* group = plr->GetGroup()) - group->RemoveMember(plr->GetGUID()); + if (Group* group = player->GetGroup()) + group->RemoveMember(player->GetGUID()); - Group* group = GetFreeBfRaid(plr->GetTeamId()); + Group* group = GetFreeBfRaid(player->GetTeamId()); if (!group) { group = new Group; group->SetBattlefieldGroup(this); - group->Create(plr); + group->Create(player); sGroupMgr->AddGroup(group); - m_Groups[plr->GetTeamId()].insert(group->GetGUID()); + m_Groups[player->GetTeamId()].insert(group->GetGUID()); } - else if (group->IsMember(plr->GetGUID())) + else if (group->IsMember(player->GetGUID())) { - uint8 subgroup = group->GetMemberGroup(plr->GetGUID()); - plr->SetBattlegroundOrBattlefieldRaid(group, subgroup); + uint8 subgroup = group->GetMemberGroup(player->GetGUID()); + player->SetBattlegroundOrBattlefieldRaid(group, subgroup); } else - group->AddMember(plr); + group->AddMember(player); return true; } @@ -601,7 +601,7 @@ BfGraveYard *Battlefield::GetGraveYardById(uint32 id) return NULL; } -WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *plr) +WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *player) { BfGraveYard* closestGY = NULL; float maxdist = -1; @@ -609,10 +609,10 @@ WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *plr) { if (m_GraveYardList[i]) { - if (m_GraveYardList[i]->GetControlTeamId() != plr->GetTeamId()) + if (m_GraveYardList[i]->GetControlTeamId() != player->GetTeamId()) continue; - float dist = m_GraveYardList[i]->GetDistance(plr); + float dist = m_GraveYardList[i]->GetDistance(player); if (dist < maxdist || maxdist < 0) { closestGY = m_GraveYardList[i]; @@ -699,10 +699,10 @@ void BfGraveYard::SetSpirit(Creature* spirit, TeamId team) spirit->SetReactState(REACT_PASSIVE); } -float BfGraveYard::GetDistance(Player *plr) +float BfGraveYard::GetDistance(Player *player) { const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); - return plr->GetDistance2d(ws->x, ws->y); + return player->GetDistance2d(ws->x, ws->y); } void BfGraveYard::AddPlayer(uint64 player_guid) @@ -711,8 +711,8 @@ void BfGraveYard::AddPlayer(uint64 player_guid) { m_ResurrectQueue.insert(player_guid); - if (Player* plr = sObjectAccessor->FindPlayer(player_guid)) - plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); + if (Player* player = sObjectAccessor->FindPlayer(player_guid)) + player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true); } } @@ -720,8 +720,8 @@ void BfGraveYard::RemovePlayer(uint64 player_guid) { m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid)); - if (Player* plr = sObjectAccessor->FindPlayer(player_guid)) - plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); + if (Player* player = sObjectAccessor->FindPlayer(player_guid)) + player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); } void BfGraveYard::Resurrect() @@ -732,22 +732,22 @@ void BfGraveYard::Resurrect() for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { // Get player object from his guid - Player* plr = sObjectAccessor->FindPlayer(*itr); - if (!plr) + Player* player = sObjectAccessor->FindPlayer(*itr); + if (!player) continue; // Check player isinworld and player is on good graveyard - if (plr->IsInWorld()) + if (player->IsInWorld()) if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam])) spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true); // Resurect player - plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); - plr->ResurrectPlayer(1.0f); - plr->CastSpell(plr, 6962, true); - plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true); + player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true); + player->ResurrectPlayer(1.0f); + player->CastSpell(player, 6962, true); + player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true); - sObjectAccessor->ConvertCorpseForPlayer(plr->GetGUID()); + sObjectAccessor->ConvertCorpseForPlayer(player->GetGUID()); } m_ResurrectQueue.clear(); @@ -773,17 +773,17 @@ void BfGraveYard::RelocateDeadPlayers() WorldSafeLocsEntry const* ClosestGrave = NULL; for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { - Player* plr = sObjectAccessor->FindPlayer(*itr); - if (!plr) + Player* player = sObjectAccessor->FindPlayer(*itr); + if (!player) continue; if (ClosestGrave) - plr->TeleportTo(plr->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); else { - ClosestGrave = m_Bf->GetClosestGraveYard(plr); + ClosestGrave = m_Bf->GetClosestGraveYard(player); if (ClosestGrave) - plr->TeleportTo(plr->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); } } } @@ -877,22 +877,22 @@ BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL) m_maxSpeed = 0; } -bool BfCapturePoint::HandlePlayerEnter(Player *plr) +bool BfCapturePoint::HandlePlayerEnter(Player *player) { if (m_capturePoint) { - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); + 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[plr->GetTeamId()].insert(plr->GetGUID()).second; + return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second; } -void BfCapturePoint::HandlePlayerLeave(Player *plr) +void BfCapturePoint::HandlePlayerLeave(Player *player) { if (m_capturePoint) - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); - m_activePlayers[plr->GetTeamId()].erase(plr->GetGUID()); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); + m_activePlayers[player->GetTeamId()].erase(player->GetGUID()); } void BfCapturePoint::SendChangePhase() @@ -965,9 +965,9 @@ bool BfCapturePoint::Update(uint32 diff) for (uint8 team = 0; team < 2; ++team) for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) - HandlePlayerLeave(plr); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) + HandlePlayerLeave(player); std::list < Player * >players; Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius); @@ -1069,8 +1069,8 @@ void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) { for (uint8 team = 0; team < 2; ++team) for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->SendUpdateWorldState(field, value); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->SendUpdateWorldState(field, value); } void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) @@ -1090,11 +1090,11 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) // send to all players present in the area for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->KilledMonsterCredit(id, guid); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->KilledMonsterCredit(id, guid); } -bool BfCapturePoint::IsInsideObjective(Player *plr) const +bool BfCapturePoint::IsInsideObjective(Player *player) const { - return m_activePlayers[plr->GetTeamId()].find(plr->GetGUID()) != m_activePlayers[plr->GetTeamId()].end(); + return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end(); } diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 9f3bcb18f53..e14a09e29ea 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -88,12 +88,12 @@ public: void SendObjectiveComplete(uint32 id, uint64 guid); // used when player is activated/inactivated in the area - virtual bool HandlePlayerEnter(Player * plr); - virtual void HandlePlayerLeave(Player * plr); - //virtual void HandlePlayerActivityChanged(Player * plr); + virtual bool HandlePlayerEnter(Player * player); + virtual void HandlePlayerLeave(Player * player); + //virtual void HandlePlayerActivityChanged(Player * player); // checks if player is in range of a capture credit marker - bool IsInsideObjective(Player * plr) const; + bool IsInsideObjective(Player * player) const; // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. virtual bool Update(uint32 diff); @@ -144,7 +144,7 @@ public: TeamId GetControlTeamId() { return m_ControlTeam; } // use for found the nearest graveyard - float GetDistance(Player * plr); + float GetDistance(Player * player); void Initialize(TeamId startcontrol, uint32 gy); void SetSpirit(Creature* spirit, TeamId team); void AddPlayer(uint64 player_guid); @@ -237,10 +237,10 @@ class Battlefield:public ZoneScript */ void KickPlayerFromBf(uint64 guid); - /// Called when player (plr) enter in zone - void HandlePlayerEnterZone(Player * plr, uint32 zone); - /// Called when player (plr) leave the zone - void HandlePlayerLeaveZone(Player * plr, uint32 zone); + /// Called when player (player) enter in zone + void HandlePlayerEnterZone(Player * player, uint32 zone); + /// Called when player (player) leave the zone + void HandlePlayerLeaveZone(Player * player, uint32 zone); // All-purpose data storage 64 bit virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; } @@ -258,17 +258,17 @@ class Battlefield:public ZoneScript // Group methods /** * \brief Find a not full battlefield group, if there is no, create one - * \param TeamId : Id of player team for who we search a group (plr->GetTeamId()) + * \param TeamId : Id of player team for who we search a group (player->GetTeamId()) */ Group *GetFreeBfRaid(TeamId TeamId); /// Return battlefield group where player is. Group *GetGroupPlayer(uint64 guid, TeamId TeamId); /// Force player to join a battlefield group - bool AddOrSetPlayerToCorrectBfGroup(Player * plr); + bool AddOrSetPlayerToCorrectBfGroup(Player * player); // Graveyard methods // Find which graveyard the player must be teleported to to be resurrected by spiritguide - WorldSafeLocsEntry const *GetClosestGraveYard(Player * plr); + WorldSafeLocsEntry const *GetClosestGraveYard(Player * player); virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); void RemovePlayerFromResurrectQueue(uint64 player_guid); @@ -289,23 +289,23 @@ class Battlefield:public ZoneScript /// Called x minutes before battle start when player in zone are invite to join queue virtual void OnStartGrouping() {}; /// Called when a player accept to join the battle - virtual void OnPlayerJoinWar(Player * /*plr */ ) {}; + virtual void OnPlayerJoinWar(Player * /*player */ ) {}; /// Called when a player leave the battle - virtual void OnPlayerLeaveWar(Player * /*plr */ ) {}; + virtual void OnPlayerLeaveWar(Player * /*player */ ) {}; /// Called when a player leave battlefield zone - virtual void OnPlayerLeaveZone(Player * /*plr */ ) {}; + virtual void OnPlayerLeaveZone(Player * /*player */ ) {}; /// Called when a player enter in battlefield zone - virtual void OnPlayerEnterZone(Player * /*plr */ ) {}; + virtual void OnPlayerEnterZone(Player * /*player */ ) {}; WorldPacket BuildWarningAnnPacket(std::string msg); void SendWarningToAllInZone(uint32 entry); //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED - void SendWarningToPlayer(Player * plr, uint32 entry); + void SendWarningToPlayer(Player * player, uint32 entry); - void PlayerAcceptInviteToQueue(Player * plr); - void PlayerAcceptInviteToWar(Player * plr); + void PlayerAcceptInviteToQueue(Player * player); + void PlayerAcceptInviteToWar(Player * player); uint32 GetBattleId() { return m_BattleId; } - void AskToLeaveQueue(Player * plr); + void AskToLeaveQueue(Player * player); virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement */ , Player * /*player */ , uint8 /*incrementNumber = 1 */ ) {}; @@ -329,8 +329,8 @@ class Battlefield:public ZoneScript void PlaySoundToAll(uint32 SoundID); - void InvitePlayerToQueue(Player * plr); - void InvitePlayerToWar(Player * plr); + void InvitePlayerToQueue(Player * player); + void InvitePlayerToWar(Player * player); void InitStalker(uint32 entry, float x, float y, float z, float o); @@ -382,7 +382,7 @@ protected: void KickAfk(); // use for switch off all worldstate for client - virtual void SendRemoveWorldStates(Player * /*plr */ ) {} + virtual void SendRemoveWorldStates(Player * /*player */ ) {} // use for send a packet for all player list void BroadcastPacketZone(WorldPacket & data) const; @@ -401,7 +401,7 @@ protected: } void RegisterZone(uint32 zoneid); - bool HasPlayer(Player * plr) const; + bool HasPlayer(Player * player) const; void TeamCastSpell(TeamId team, int32 spellId); }; diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 0b26ae8dc55..7f7613b3950 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -75,7 +75,7 @@ void WorldSession::SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool //Param1:(BattleId) the BattleId of Bf void WorldSession::SendBfEntered(uint32 BattleId) { -// m_PlayerInWar[plr->GetTeamId()].insert(plr->GetGUID()); +// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID()); WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7); data << uint32(BattleId); data << uint8(1); //unk diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp new file mode 100644 index 00000000000..095ec4fd18a --- /dev/null +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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 . + */ + +#include "BattlefieldMgr.h" +#include "Zones/BattlefieldWG.h" +#include "ObjectMgr.h" +#include "Player.h" + +BattlefieldMgr::BattlefieldMgr() +{ + m_UpdateTimer = 0; + //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr"); +} + +BattlefieldMgr::~BattlefieldMgr() +{ + //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr"); + for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) + delete *itr; +} + +void BattlefieldMgr::InitBattlefield() +{ + Battlefield* pBf = new BattlefieldWG; + // respawn, init variables + if (!pBf->SetupBattlefield()) + { + sLog->outString(); + sLog->outString("Battlefield : Wintergrasp init failed."); + delete pBf; + } + else + { + m_BattlefieldSet.push_back(pBf); + sLog->outString(); + sLog->outString("Battlefield : Wintergrasp successfully initiated."); + } + + /* For Cataclysm: Tol Barad + pBf = new BattlefieldTB; + // respawn, init variables + if(!pBf->SetupBattlefield()) + { + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed."); + delete pBf; + } + else + { + m_BattlefieldSet.push_back(pBf); + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated."); + } */ +} + +void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle) +{ + m_BattlefieldMap[zoneid] = handle; +} + +void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid) +{ + BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid); + if (itr == m_BattlefieldMap.end()) + return; + + if (itr->second->HasPlayer(player)) + return; + if (itr->second->GetEnable() == false) + return; + itr->second->HandlePlayerEnterZone(player, zoneid); + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); +} + +void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid) +{ + BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid); + if (itr == m_BattlefieldMap.end()) + return; + + // teleport: remove once in removefromworld, once in updatezone + if (!itr->second->HasPlayer(player)) + return; + itr->second->HandlePlayerLeaveZone(player, zoneid); + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); +} + +Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid) +{ + BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid); + if (itr == m_BattlefieldMap.end()) + { + // no handle for this zone, return + return NULL; + } + if (itr->second->GetEnable() == false) + return NULL; + return itr->second; +} + +Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid) +{ + for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) + { + if ((*itr)->GetBattleId() == battleid) + return (*itr); + } + return NULL; +} + +void BattlefieldMgr::Update(uint32 diff) +{ + m_UpdateTimer += diff; + if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL) + { + for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) + if ((*itr)->GetEnable()) + (*itr)->Update(m_UpdateTimer); + m_UpdateTimer = 0; + } +} + +ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId) +{ + BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId); + if (itr != m_BattlefieldMap.end()) + return itr->second; + else + return NULL; +} diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h index a447d787be7..4ee37e424fd 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.h +++ b/src/server/game/Battlefield/BattlefieldMgr.h @@ -40,11 +40,11 @@ class BattlefieldMgr // create battlefield events void InitBattlefield(); // called when a player enters an battlefield area - void HandlePlayerEnterZone(Player * plr, uint32 areaflag); + void HandlePlayerEnterZone(Player * player, uint32 areaflag); // called when player leaves an battlefield area - void HandlePlayerLeaveZone(Player * plr, uint32 areaflag); + void HandlePlayerLeaveZone(Player * player, uint32 areaflag); // called when player resurrects - void HandlePlayerResurrects(Player * plr, uint32 areaflag); + void HandlePlayerResurrects(Player * player, uint32 areaflag); // return assigned battlefield Battlefield *GetBattlefieldToZoneId(uint32 zoneid); Battlefield *GetBattlefieldByBattleId(uint32 battleid); @@ -59,7 +59,7 @@ class BattlefieldMgr bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso); - void HandleDropFlag(Player * plr, uint32 spellId); + void HandleDropFlag(Player * player, uint32 spellId); typedef std::vector < Battlefield * >BattlefieldSet; typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index b5f4ffe8ad7..4ec448fe3e5 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -315,30 +315,30 @@ class BattlefieldWG : public Battlefield * -Teleport if it needed * -Update worldstate * -Update tenacity - * \param plr: Player who accept invite + * \param player: Player who accept invite */ - void OnPlayerJoinWar(Player *plr); + void OnPlayerJoinWar(Player *player); /** * \brief Called when player leave battle * -Update player aura - * \param plr : Player who leave battle + * \param player : Player who leave battle */ - void OnPlayerLeaveWar(Player *plr); + void OnPlayerLeaveWar(Player *player); /** * \brief Called when player leave WG zone - * \param plr : Player who leave zone + * \param player : Player who leave zone */ - void OnPlayerLeaveZone(Player *plr); + void OnPlayerLeaveZone(Player *player); /** * \brief Called when player enter in WG zone * -Update aura * -Update worldstate - * \param plr : Player who leave zone + * \param player : Player who leave zone */ - void OnPlayerEnterZone(Player *plr); + void OnPlayerEnterZone(Player *player); /** * \brief Called for update battlefield data @@ -415,13 +415,13 @@ class BattlefieldWG : public Battlefield m_CanClickOnOrb = allow; } - void RewardMarkOfHonor(Player *plr, uint32 count); + void RewardMarkOfHonor(Player *player, uint32 count); void UpdateVehicleCountWG(); void UpdateCounterVehicle(bool init); WorldPacket BuildInitWorldStates(); - void SendInitWorldStatesTo(Player * plr); + void SendInitWorldStatesTo(Player * player); void SendInitWorldStatesToAll(); void HandleKill(Player *killer, Unit *victim); -- cgit v1.2.3 From 2a4b976e411727ebb361e8994f688579af791360 Mon Sep 17 00:00:00 2001 From: thomas33 Date: Mon, 12 Mar 2012 17:39:33 +0100 Subject: Core/Battlefield: pPlayer -> player --- src/server/scripts/Northrend/wintergrasp.cpp | 114 +++++++++++++-------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 936be459f9b..ea73a2abe48 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -58,10 +58,10 @@ class npc_wg_demolisher_engineer : public CreatureScript { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + player->PrepareQuestMenu(pCreature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); @@ -71,25 +71,25 @@ class npc_wg_demolisher_engineer : public CreatureScript if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) { - if (pPlayer->HasAura(SPELL_CORPORAL)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - else if (pPlayer->HasAura(SPELL_LIEUTENANT)) + if (player->HasAura(SPELL_CORPORAL)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + else if (player->HasAura(SPELL_LIEUTENANT)) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); } } else - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } - bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender */ , uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender */ , uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); + player->CLOSE_GOSSIP_MENU(); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); @@ -102,13 +102,13 @@ class npc_wg_demolisher_engineer : public CreatureScript switch (uiAction - GOSSIP_ACTION_INFO_DEF) { case 0: - pPlayer->CastSpell(pPlayer, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); break; case 1: - pPlayer->CastSpell(pPlayer, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, pCreature->GetGUID()); break; case 2: - pPlayer->CastSpell(pPlayer, pPlayer->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, pCreature->GetGUID()); break; } //spell 49899 Emote : 406 from sniff @@ -127,10 +127,10 @@ class npc_wg_spirit_guide : public CreatureScript { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + player->PrepareQuestMenu(pCreature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -138,21 +138,21 @@ class npc_wg_spirit_guide : public CreatureScript GraveYardVect gy = BfWG->GetGraveYardVect(); for (uint8 i = 0; i < gy.size(); i++) { - if (gy[i]->GetControlTeamId() == pPlayer->GetTeamId()) + if (gy[i]->GetControlTeamId() == player->GetTeamId()) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN, + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i); } } } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } - bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); + player->CLOSE_GOSSIP_MENU(); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -160,10 +160,10 @@ class npc_wg_spirit_guide : public CreatureScript GraveYardVect gy = BfWG->GetGraveYardVect(); for (uint8 i = 0; i < gy.size(); i++) { - if (uiAction - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == pPlayer->GetTeamId()) + if (uiAction - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) { WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId()); - pPlayer->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); + player->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); } } } @@ -178,10 +178,10 @@ class npc_wg_queue : public CreatureScript { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + player->PrepareQuestMenu(pCreature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -189,43 +189,43 @@ class npc_wg_queue : public CreatureScript if (BfWG->IsWarTime()) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); } else { uint32 uiTime = BfWG->GetTimer() / 1000; - pPlayer->SendUpdateWorldState(4354, time(NULL) + uiTime); + player->SendUpdateWorldState(4354, time(NULL) + uiTime); if (uiTime < 15 * MINUTE) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); } else { - pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); } } } return true; } - bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 /*uiAction */ ) + bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 /*uiAction */ ) { - pPlayer->CLOSE_GOSSIP_MENU(); + player->CLOSE_GOSSIP_MENU(); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (BfWG->IsWarTime()) { - BfWG->InvitePlayerToWar(pPlayer); + BfWG->InvitePlayerToWar(player); } else { uint32 uiTime = BfWG->GetTimer() / 1000; if (uiTime < 15 * MINUTE) - BfWG->InvitePlayerToQueue(pPlayer); + BfWG->InvitePlayerToQueue(player); } } return true; @@ -297,10 +297,10 @@ class npc_wg_quest_giver : public CreatureScript { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + player->PrepareQuestMenu(pCreature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -311,14 +311,14 @@ class npc_wg_quest_giver : public CreatureScript QuestRelations* pObjectQR = sObjectMgr->GetCreatureQuestRelationMap(); QuestRelations* pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); - QuestMenu & qm = pPlayer->PlayerTalkClass->GetQuestMenu(); + QuestMenu & qm = player->PlayerTalkClass->GetQuestMenu(); qm.ClearMenu(); for (QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i) { uint32 quest_id = i->second; - QuestStatus status = pPlayer->GetQuestStatus(quest_id); - if (status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) + QuestStatus status = player->GetQuestStatus(quest_id); + if (status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id)) qm.AddMenuItem(quest_id, 4); else if (status == QUEST_STATUS_INCOMPLETE) qm.AddMenuItem(quest_id, 4); @@ -342,11 +342,11 @@ class npc_wg_quest_giver : public CreatureScript case 13223: if (BfWG->GetAttackerTeam() == TEAM_HORDE) { - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -360,11 +360,11 @@ class npc_wg_quest_giver : public CreatureScript case 13185: if (BfWG->GetDefenderTeam() == TEAM_HORDE) { - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -376,11 +376,11 @@ class npc_wg_quest_giver : public CreatureScript case 13195: if (BfWG->GetAttackerTeam() == TEAM_ALLIANCE) { - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -393,26 +393,26 @@ class npc_wg_quest_giver : public CreatureScript case 13156: if (BfWG->GetDefenderTeam() == TEAM_ALLIANCE) { - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); } break; default: - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); break; } } } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } return true; -- cgit v1.2.3 From 7b0a7ef4f3d9d50160143b7cb3a68c00d17eeb4a Mon Sep 17 00:00:00 2001 From: thomas33 Date: Tue, 13 Mar 2012 14:59:26 +0100 Subject: Core/Battlefield: cleanup --- src/server/scripts/Northrend/wintergrasp.cpp | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index ea73a2abe48..0925a97356a 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -87,7 +87,7 @@ class npc_wg_demolisher_engineer : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender */ , uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -99,7 +99,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) { - switch (uiAction - GOSSIP_ACTION_INFO_DEF) + switch (action - GOSSIP_ACTION_INFO_DEF) { case 0: player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); @@ -150,7 +150,7 @@ class npc_wg_spirit_guide : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -160,7 +160,7 @@ class npc_wg_spirit_guide : public CreatureScript GraveYardVect gy = BfWG->GetGraveYardVect(); for (uint8 i = 0; i < gy.size(); i++) { - if (uiAction - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) + if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) { WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId()); player->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); @@ -210,7 +210,7 @@ class npc_wg_queue : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 /*uiAction */ ) + bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*sender */ , uint32 /*action */ ) { player->CLOSE_GOSSIP_MENU(); @@ -327,8 +327,8 @@ class npc_wg_quest_giver : public CreatureScript for (QuestRelations::const_iterator i = pObjectQR->lower_bound(pObject->GetEntry()); i != pObjectQR->upper_bound(pObject->GetEntry()); ++i) { uint32 quest_id = i->second; - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); - if (!pQuest) + Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); + if (!quest) continue; switch (quest_id) @@ -344,9 +344,9 @@ class npc_wg_quest_giver : public CreatureScript { QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -362,9 +362,9 @@ class npc_wg_quest_giver : public CreatureScript { QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -378,9 +378,9 @@ class npc_wg_quest_giver : public CreatureScript { QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -395,18 +395,18 @@ class npc_wg_quest_giver : public CreatureScript { QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); } break; default: QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); break; } -- cgit v1.2.3 From c44a723ca082e9bfa37e6560c9badfc8f0003787 Mon Sep 17 00:00:00 2001 From: thomas33 Date: Tue, 13 Mar 2012 16:19:20 +0100 Subject: Core/Battlefield: more cleanup --- src/server/scripts/Northrend/wintergrasp.cpp | 70 ++++++++++++++-------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 0925a97356a..345f2f6898b 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -58,18 +58,18 @@ class npc_wg_demolisher_engineer : public CreatureScript { } - bool OnGossipHello(Player* player, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* creature) { - if (pCreature->isQuestGiver()) - player->PrepareQuestMenu(pCreature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); if (!BfWG) return true; - if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > - BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > + BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) { if (player->HasAura(SPELL_CORPORAL)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); @@ -83,11 +83,11 @@ class npc_wg_demolisher_engineer : public CreatureScript else player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*sender */ , uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -96,24 +96,24 @@ class npc_wg_demolisher_engineer : public CreatureScript if (!BfWG) return true; - if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > - BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > + BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) { switch (action - GOSSIP_ACTION_INFO_DEF) { case 0: - player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, creature->GetGUID()); break; case 1: - player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, creature->GetGUID()); break; case 2: - player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, creature->GetGUID()); break; } //spell 49899 Emote : 406 from sniff //INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0'); - if (Creature* creature = pCreature->FindNearestCreature(27852, 30.0f, true)) + if (Creature* creature = creature->FindNearestCreature(27852, 30.0f, true)) creature->CastSpell(creature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); } return true; @@ -127,10 +127,10 @@ class npc_wg_spirit_guide : public CreatureScript { } - bool OnGossipHello(Player* player, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* creature) { - if (pCreature->isQuestGiver()) - player->PrepareQuestMenu(pCreature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -146,11 +146,11 @@ class npc_wg_spirit_guide : public CreatureScript } } - player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*sender */ , uint32 action) + bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -178,10 +178,10 @@ class npc_wg_queue : public CreatureScript { } - bool OnGossipHello(Player* player, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* creature) { - if (pCreature->isQuestGiver()) - player->PrepareQuestMenu(pCreature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -190,7 +190,7 @@ class npc_wg_queue : public CreatureScript if (BfWG->IsWarTime()) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); } else { @@ -199,18 +199,18 @@ class npc_wg_queue : public CreatureScript if (uiTime < 15 * MINUTE) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID()); } else { - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID()); } } } return true; } - bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*sender */ , uint32 /*action */ ) + bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action */ ) { player->CLOSE_GOSSIP_MENU(); @@ -297,24 +297,24 @@ class npc_wg_quest_giver : public CreatureScript { } - bool OnGossipHello(Player* player, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* creature) { - if (pCreature->isQuestGiver()) - player->PrepareQuestMenu(pCreature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { - if (pCreature->isQuestGiver()) + if (creature->isQuestGiver()) { - Object* pObject = (Object *) pCreature; - QuestRelations* pObjectQR = sObjectMgr->GetCreatureQuestRelationMap(); - QuestRelations* pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); + Object* object = (Object *) creature; + QuestRelations* objectQR = sObjectMgr->GetCreatureQuestRelationMap(); + QuestRelations* objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); QuestMenu & qm = player->PlayerTalkClass->GetQuestMenu(); qm.ClearMenu(); - for (QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i) + for (QuestRelations::const_iterator i = objectQIR->lower_bound(object->GetEntry()); i != objectQIR->upper_bound(object->GetEntry()); ++i) { uint32 quest_id = i->second; QuestStatus status = player->GetQuestStatus(quest_id); @@ -324,7 +324,7 @@ class npc_wg_quest_giver : public CreatureScript qm.AddMenuItem(quest_id, 4); } - for (QuestRelations::const_iterator i = pObjectQR->lower_bound(pObject->GetEntry()); i != pObjectQR->upper_bound(pObject->GetEntry()); ++i) + for (QuestRelations::const_iterator i = objectQR->lower_bound(object->GetEntry()); i != objectQR->upper_bound(object->GetEntry()); ++i) { uint32 quest_id = i->second; Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); @@ -412,7 +412,7 @@ class npc_wg_quest_giver : public CreatureScript } } } - player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } return true; -- cgit v1.2.3 From 7988edda1ce7e40e8d313923eaf6af8dc553e390 Mon Sep 17 00:00:00 2001 From: thomas33 Date: Wed, 14 Mar 2012 00:04:34 +0100 Subject: Core/Battlefield: Cleanup --- src/server/game/Battlefield/Battlefield.cpp | 18 +++++++++--------- src/server/scripts/Northrend/wintergrasp.cpp | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 085be81c98f..e72be15f68d 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -810,15 +810,15 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl } //Create creature - Creature* pCreature = new Creature; - if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) + Creature* creature = new Creature; + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { sLog->outError("Can't create creature entry: %u", entry); - delete pCreature; + delete creature; return NULL; } - pCreature->SetHomePosition(x, y, z, o); + creature->SetHomePosition(x, y, z, o); CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) @@ -827,14 +827,14 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl return NULL; } // force using DB speeds -- do we really need this? - pCreature->SetSpeed(MOVE_WALK, cinfo->speed_walk); - pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run); + creature->SetSpeed(MOVE_WALK, cinfo->speed_walk); + creature->SetSpeed(MOVE_RUN, cinfo->speed_run); // Set creature in world - map->AddToMap(pCreature); - pCreature->setActive(true); + map->AddToMap(creature); + creature->setActive(true); - return pCreature; + return creature; } // Method for spawning gameobject on map diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 345f2f6898b..fd09edd7b55 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -253,23 +253,23 @@ class go_wg_vehicle_teleporter : public GameObjectScript if (uiCheckTimer <= diff) { for (uint8 i = 0; i < 4; i++) - if (Creature* pVehicle = go->FindNearestCreature(Vehicules[i], 3.0f, true)) - if (!pVehicle->HasAura(SPELL_VEHICLE_TELEPORT)) + if (Creature* vehicle = go->FindNearestCreature(Vehicules[i], 3.0f, true)) + if (!vehicle->HasAura(SPELL_VEHICLE_TELEPORT)) { - if (pVehicle->GetVehicle()) + if (vehicle->GetVehicle()) { - if (Unit* player = pVehicle->GetVehicle()->GetPassenger(0)) + if (Unit* player = vehicle->GetVehicle()->GetPassenger(0)) { uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION); uint32 plfaction = player->getFaction(); if (gofaction == plfaction) { - pVehicle->CastSpell(pVehicle, SPELL_VEHICLE_TELEPORT, true); - if (Creature* TargetTeleport = pVehicle->FindNearestCreature(23472, 100.0f, true)) + vehicle->CastSpell(vehicle, SPELL_VEHICLE_TELEPORT, true); + if (Creature* TargetTeleport = vehicle->FindNearestCreature(23472, 100.0f, true)) { float x, y, z, o; TargetTeleport->GetPosition(x, y, z, o); - pVehicle->GetVehicle()->TeleportVehicle(x, y, z, o); + vehicle->GetVehicle()->TeleportVehicle(x, y, z, o); } } } -- cgit v1.2.3 From 6639347d37197e618118e45c9c706ebab35dd20d Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 14 Mar 2012 10:18:59 -0300 Subject: Core/Battlefield: Fix build. closes #5707 --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index bd8a51c13f8..6fcd48efd19 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -482,7 +482,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) // ***************************************************** void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 /*incrementNumber */ ) { - AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement); + AchievementEntry const* AE = sAchievementStore.LookupEntry(achievement); switch (achievement) { -- cgit v1.2.3 From 5ec5bc1721ecd1e09544769f4c950a3d42d815f6 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 17 Mar 2012 20:52:31 -0500 Subject: Battlefields/Wintergrasp: Fixed a crash when leaving a capture point. Fixed the worldstate counters Signed-off-by: Subv --- src/server/game/Battlefield/Battlefield.cpp | 37 ++++++++++++++++------ src/server/game/Battlefield/Battlefield.h | 4 +-- .../game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/game/Battlefield/Zones/BattlefieldWG.h | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index e72be15f68d..5e1e530dbdb 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -888,11 +888,18 @@ bool BfCapturePoint::HandlePlayerEnter(Player *player) return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second; } -void BfCapturePoint::HandlePlayerLeave(Player *player) +GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* plr) { if (m_capturePoint) - player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); - m_activePlayers[player->GetTeamId()].erase(player->GetGUID()); + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); + + GuidSet::iterator current = m_activePlayers[plr->GetTeamId()].find(plr->GetGUID()); + + if (current == m_activePlayers[plr->GetTeamId()].end()) + return current; // return end() + + m_activePlayers[plr->GetTeamId()].erase(current++); + return current; } void BfCapturePoint::SendChangePhase() @@ -964,17 +971,27 @@ bool BfCapturePoint::Update(uint32 diff) float radius = m_capturePoint->GetGOInfo()->capturePoint.radius; for (uint8 team = 0; team < 2; ++team) - for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* player = sObjectAccessor->FindPlayer(*itr)) - if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) - HandlePlayerLeave(player); + { + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();) + { + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + { + if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) + itr = HandlePlayerLeave(plr); + else + ++itr; + } + else + ++itr; + } + } - std::list < Player * >players; + std::list players; Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius); - Trinity::PlayerListSearcher < Trinity::AnyPlayerInObjectRangeCheck > searcher(m_capturePoint, players, checker); + Trinity::PlayerListSearcher searcher(m_capturePoint, players, checker); m_capturePoint->VisitNearbyWorldObject(radius, searcher); - for (std::list < Player * >::iterator itr = players.begin(); itr != players.end(); ++itr) + for (std::list::iterator itr = players.begin(); itr != players.end(); ++itr) if ((*itr)->IsOutdoorPvPActive()) if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second) HandlePlayerEnter(*itr); diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index e14a09e29ea..928e77c22b9 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -88,8 +88,8 @@ public: void SendObjectiveComplete(uint32 id, uint64 guid); // used when player is activated/inactivated in the area - virtual bool HandlePlayerEnter(Player * player); - virtual void HandlePlayerLeave(Player * player); + virtual bool HandlePlayerEnter(Player* player); + virtual GuidSet::iterator HandlePlayerLeave(Player* player); //virtual void HandlePlayerActivityChanged(Player * player); // checks if player is in range of a capture credit marker diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6fcd48efd19..cb9a1ac795d 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -892,7 +892,7 @@ uint32 BattlefieldWG::GetData(uint32 data) return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); } - return 0; + return Battlefield::GetData(data); } // Method sending worldsate to player diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 4ec448fe3e5..a7d1d185c8d 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -28,7 +28,7 @@ const uint32 VehNumWorldState[2] = { 3680, 3490 }; const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; const uint32 ClockWorldState[2] = { 3781, 4354 }; -const uint32 WintergraspFaction[3] = { 1732, 1735, 35 }; +const uint32 WintergraspFaction[3] = { 1, 116, 35 }; const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; -- cgit v1.2.3 From b700f545c553957f49741909e2ba0fdbd01a203c Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 20 Mar 2012 12:16:44 -0400 Subject: Core/Battlefield: fix issues with vehicles. return correct vehicle data when using getdata. small cleanups. codestyle --- src/server/game/Battlefield/Battlefield.h | 2 +- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 3 +++ src/server/game/Scripting/ScriptLoader.cpp | 2 ++ src/server/scripts/Northrend/wintergrasp.cpp | 13 ++++++++----- 4 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 928e77c22b9..2bc7ccca408 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -177,7 +177,7 @@ protected: Battlefield *m_Bf; }; -class Battlefield:public ZoneScript +class Battlefield : public ZoneScript { friend class BattlefieldMgr; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index cb9a1ac795d..2068741b4e5 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -890,6 +890,9 @@ uint32 BattlefieldWG::GetData(uint32 data) // Graveyards and Workshops are controlled by the same team. if (m_GraveYardList[GetSpiritGraveyardId(data)]) return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); + default: + if (m_Data32[data]) + return m_Data32[data]; } return Battlefield::GetData(data); diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 319fd1eb702..0c6948160eb 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -508,6 +508,7 @@ void AddSC_howling_fjord(); void AddSC_icecrown(); void AddSC_sholazar_basin(); void AddSC_storm_peaks(); +void AddSC_wintergrasp(); void AddSC_zuldrak(); void AddSC_crystalsong_forest(); void AddSC_isle_of_conquest(); @@ -1224,6 +1225,7 @@ void AddNorthrendScripts() AddSC_icecrown(); AddSC_sholazar_basin(); AddSC_storm_peaks(); + AddSC_wintergrasp(); AddSC_zuldrak(); AddSC_crystalsong_forest(); AddSC_isle_of_conquest(); diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index fd09edd7b55..d8ecd042fcc 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -38,7 +38,7 @@ enum eWGqueuenpctext WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507, }; -enum eWGdata +enum WGscriptdata { // engineer spells SPELL_BUILD_CATAPULT = 56663, @@ -49,6 +49,9 @@ enum eWGdata // teleporter spells SPELL_VEHICLE_TELEPORT = 49759, + + // npcs + NPC_ROBOTIC_ARMS = 27852, }; class npc_wg_demolisher_engineer : public CreatureScript @@ -63,7 +66,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (!BfWG) return true; @@ -91,7 +94,7 @@ class npc_wg_demolisher_engineer : public CreatureScript { player->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (!BfWG) return true; @@ -113,8 +116,8 @@ class npc_wg_demolisher_engineer : public CreatureScript } //spell 49899 Emote : 406 from sniff //INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0'); - if (Creature* creature = creature->FindNearestCreature(27852, 30.0f, true)) - creature->CastSpell(creature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); + if (Creature* mechCreature = creature->FindNearestCreature(NPC_ROBOTIC_ARMS, 30.0f, true)) + creature->CastSpell(mechCreature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); } return true; } -- cgit v1.2.3 From 9c5b1b2bb6e2f633a6302438054c357ab04cf177 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 21 Mar 2012 08:53:46 -0400 Subject: Core/Battlefield: Correctly cast the teleport spell (data from sniffs). codestyle cleanup --- src/server/scripts/Northrend/wintergrasp.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index d8ecd042fcc..eb7b5dfefd7 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -52,6 +52,7 @@ enum WGscriptdata // npcs NPC_ROBOTIC_ARMS = 27852, + NPC_WORLD_TRIGGER_WG = 23472, }; class npc_wg_demolisher_engineer : public CreatureScript @@ -256,28 +257,20 @@ class go_wg_vehicle_teleporter : public GameObjectScript if (uiCheckTimer <= diff) { for (uint8 i = 0; i < 4; i++) - if (Creature* vehicle = go->FindNearestCreature(Vehicules[i], 3.0f, true)) - if (!vehicle->HasAura(SPELL_VEHICLE_TELEPORT)) - { - if (vehicle->GetVehicle()) - { - if (Unit* player = vehicle->GetVehicle()->GetPassenger(0)) + if (Creature* vehicleCreature = go->FindNearestCreature(Vehicules[i], 3.0f, true)) + if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT)) + if (Vehicle* vehicle = vehicleCreature->GetVehicle()) + if (Unit* passenger = vehicle->GetPassenger(0)) { uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION); - uint32 plfaction = player->getFaction(); + uint32 plfaction = passenger->getFaction(); if (gofaction == plfaction) { - vehicle->CastSpell(vehicle, SPELL_VEHICLE_TELEPORT, true); - if (Creature* TargetTeleport = vehicle->FindNearestCreature(23472, 100.0f, true)) - { - float x, y, z, o; - TargetTeleport->GetPosition(x, y, z, o); - vehicle->GetVehicle()->TeleportVehicle(x, y, z, o); - } + if (Creature teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) + teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); } } - } - } + uiCheckTimer = 1000; } else -- cgit v1.2.3 From d31902d85874d5c5f85bf590ceafb881934750c4 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 21 Mar 2012 09:26:07 -0400 Subject: Core/Battlefield: Fix issue with previous commit. codestyle cleanup and attempt to fix vehicle issues with worldstates. --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 32 ++++++++++++++-------- src/server/scripts/Northrend/wintergrasp.cpp | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 2068741b4e5..fac3b9cd04f 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -31,6 +31,14 @@ enum WGBfData BATTLEFIELD_WG_MAPID = 571, // Northrend }; +enum WGVehicles +{ + NPC_WG_SEIGE_ENGINE_ALLIANCE = 28312, + NPC_WG_SEIGE_ENGINE_HORDE = 32627, + NPC_WG_DEMOLISHER = 28094, + NPC_WG_CATAPULT = 27881, +}; + bool BattlefieldWG::SetupBattlefield() { InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); @@ -580,10 +588,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature) { switch (creature->GetEntry()) { - case 28312: - case 32627: - case 27881: - case 28094: + case NPC_WG_SEIGE_ENGINE_ALLIANCE: + case NPC_WG_SEIGE_ENGINE_HORDE: + case NPC_WG_CATAPULT: + case NPC_WG_DEMOLISHER: { uint8 team; if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) @@ -595,10 +603,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature) if (team == TEAM_HORDE) { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { - creature->AddAura(SPELL_HORDE_FLAG, creature); + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; + creature->CastSpell(creature, SPELL_HORDE_FLAG, true); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -611,10 +619,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature) } else { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) { - creature->AddAura(SPELL_ALLIANCE_FLAG, creature); + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; + creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -637,10 +645,10 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature) { switch (creature->GetEntry()) { - case 28312: - case 32627: - case 27881: - case 28094: + case NPC_WG_SEIGE_ENGINE_ALLIANCE: + case NPC_WG_SEIGE_ENGINE_HORDE: + case NPC_WG_CATAPULT: + case NPC_WG_DEMOLISHER: { uint8 team; if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index eb7b5dfefd7..c7c6cc3725e 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -266,7 +266,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript uint32 plfaction = passenger->getFaction(); if (gofaction == plfaction) { - if (Creature teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) + if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); } } -- cgit v1.2.3 From 094f98d3a955009a3f800e2b53ff62261a191f68 Mon Sep 17 00:00:00 2001 From: Warpten Date: Wed, 21 Mar 2012 18:52:07 +0100 Subject: Battlefield/Wintergrasp: * Use correct spells on losing and winning factions * Enums renaming, lowerCamelCase wherever applicable * Rename some methods and class attributes for them to sound more English and less Engrish or even Frenglish (\o/) * Use correct spells when trying to build mechanical units at the Workshops. --- src/server/game/Battlefield/Battlefield.cpp | 397 ++++++------ src/server/game/Battlefield/Battlefield.h | 633 ++++++++++--------- src/server/game/Battlefield/BattlefieldHandler.cpp | 4 +- src/server/game/Battlefield/BattlefieldMgr.cpp | 9 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 591 ++++++++---------- src/server/game/Battlefield/Zones/BattlefieldWG.h | 684 ++++++++++----------- src/server/game/Globals/ObjectMgr.h | 5 - src/server/game/Server/WorldSession.h | 2 +- src/server/scripts/Commands/cs_bf.cpp | 6 +- src/server/scripts/Northrend/wintergrasp.cpp | 565 +++++++++-------- 10 files changed, 1430 insertions(+), 1466 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 5e1e530dbdb..2ad6b244058 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -32,12 +32,11 @@ #include "CreatureTextMgr.h" #include "GroupMgr.h" - Battlefield::Battlefield() { m_Timer = 0; - m_enable = true; - m_BattlefieldActive = false; + m_IsEnabled = true; + m_isActive = false; m_DefenderTeam = TEAM_NEUTRAL; m_TypeId = 0; @@ -51,7 +50,7 @@ Battlefield::Battlefield() m_TimeForAcceptInvite = 20; m_uiKickDontAcceptTimer = 1000; - m_uiKickAfkTimer = 1000; + m_uiKickAfkPlayersTimer = 1000; m_LastResurectTimer = 30 * IN_MILLISECONDS; m_StartGroupingTimer = 0; @@ -63,50 +62,49 @@ Battlefield::~Battlefield() { } -void Battlefield::HandlePlayerEnterZone(Player *player, uint32 /*zone */ ) +// Called when a player enters the zone +void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/) { - //If battle is start, - // if it not fully > invite player to join the war - // if it fully > announce to player that BF is full and kick after few second if he dont leave + // If battle is started, + // If not full of players > invite player to join the war + // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave if (IsWarTime()) { - if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) //Not fully - { + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces InvitePlayerToWar(player); - } - else //Full + else // No more vacant places { - //TODO:Send packet for announce it to player + // TODO: Send a packet to announce it to player m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; InvitePlayerToQueue(player); } } else { - //If time left is <15 minutes invite player to join queue + // If time left is < 15 minutes invite player to join queue if (m_Timer <= m_StartGroupingTimer) InvitePlayerToQueue(player); } - //Add player in list of player in zone + // Add player in the list of player in zone m_players[player->GetTeamId()].insert(player->GetGUID()); - OnPlayerEnterZone(player); //for scripting + OnPlayerEnterZone(player); } -//Called when a player leave the zone -void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ ) +// Called when a player leave the zone +void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/) { if (IsWarTime()) { - //if player is in war list + // If the player is participating to the battle if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end()) { m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID()); player->GetSession()->SendBfLeaveMessage(m_BattleId); - if (Group* group = player->GetGroup()) // remove from raid group if player is member + if (Group* group = player->GetGroup()) // Remove the player from the raid group group->RemoveMember(player->GetGUID()); - OnPlayerLeaveWar(player); //For scripting + OnPlayerLeaveWar(player); } } @@ -118,55 +116,54 @@ void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ ) m_players[player->GetTeamId()].erase(player->GetGUID()); SendRemoveWorldStates(player); RemovePlayerFromResurrectQueue(player->GetGUID()); - OnPlayerLeaveZone(player); //For scripting + OnPlayerLeaveZone(player); } bool Battlefield::Update(uint32 diff) { - //When global timer is end if (m_Timer <= diff) { - //Here end of battle by timer + // Battlefield ends on time if (IsWarTime()) EndBattle(true); - //Start of battle - else + else // Time to start a new battle! StartBattle(); } else m_Timer -= diff; - //Some times before battle start invite player to queue + // Invite players a few minutes before the battle's beginning if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer) { m_StartGrouping = true; - InvitePlayerInZoneToQueue(); - OnStartGrouping(); // for scripting + InvitePlayersInZoneToQueue(); + OnStartGrouping(); } bool objective_changed = false; if (IsWarTime()) { - if (m_uiKickAfkTimer <= diff) + if (m_uiKickAfkPlayersTimer <= diff) { - m_uiKickAfkTimer = 1000; - KickAfk(); + m_uiKickAfkPlayersTimer = 1000; + KickAfkPlayers(); } else - m_uiKickAfkTimer -= diff; + m_uiKickAfkPlayersTimer -= diff; - //Here kick player witch dont have accept invitation to join the war when time is end (time of windows) + // Kick players who chose not to accept invitation to the battle if (m_uiKickDontAcceptTimer <= diff) { for (int team = 0; team < 2; team++) for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++) if ((*itr).second <= time(NULL)) - KickPlayerFromBf((*itr).first); - InvitePlayerInZoneToWar(); + KickPlayerFromBattlefield((*itr).first); + + InvitePlayersInZoneToWar(); for (int team = 0; team < 2; team++) for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++) if ((*itr).second <= time(NULL)) - KickPlayerFromBf((*itr).first); + KickPlayerFromBattlefield((*itr).first); m_uiKickDontAcceptTimer = 1000; } @@ -181,9 +178,9 @@ bool Battlefield::Update(uint32 diff) if (m_LastResurectTimer <= diff) { - for (uint8 i = 0; i < m_GraveYardList.size(); i++) - if (GetGraveYardById(i)) - m_GraveYardList[i]->Resurrect(); + for (uint8 i = 0; i < m_GraveyardList.size(); i++) + if (GetGraveyardById(i)) + m_GraveyardList[i]->Resurrect(); m_LastResurectTimer = RESURRECTION_INTERVAL; } else @@ -192,7 +189,7 @@ bool Battlefield::Update(uint32 diff) return objective_changed; } -void Battlefield::InvitePlayerInZoneToQueue() +void Battlefield::InvitePlayersInZoneToQueue() { for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) @@ -200,16 +197,16 @@ void Battlefield::InvitePlayerInZoneToQueue() InvitePlayerToQueue(player); } -void Battlefield::InvitePlayerToQueue(Player *player) +void Battlefield::InvitePlayerToQueue(Player* player) { if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID())) return; - if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[player->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer) + if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer) player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); } -void Battlefield::InvitePlayerInQueueToWar() +void Battlefield::InvitePlayersInQueueToWar() { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) { @@ -229,7 +226,7 @@ void Battlefield::InvitePlayerInQueueToWar() } } -void Battlefield::InvitePlayerInZoneToWar() +void Battlefield::InvitePlayersInZoneToWar() { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) @@ -240,16 +237,13 @@ void Battlefield::InvitePlayerInZoneToWar() continue; if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) InvitePlayerToWar(player); - else - { - //full + else // Battlefield is full of players m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; - } } } } -void Battlefield::InvitePlayerToWar(Player *player) +void Battlefield::InvitePlayerToWar(Player* player) { if (!player) return; @@ -264,13 +258,15 @@ void Battlefield::InvitePlayerToWar(Player *player) return; } + // If the player does not match minimal level requirements for the battlefield, kick him if (player->getLevel() < m_MinLevel) { if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0) m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; return; } - //Check if player is not already in war + + // Check if player is not already in war if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID())) return; @@ -287,16 +283,16 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); } -void Battlefield::KickAfk() +void Battlefield::KickAfkPlayers() { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->isAFK()) - KickPlayerFromBf(*itr); + KickPlayerFromBattlefield(*itr); } -void Battlefield::KickPlayerFromBf(uint64 guid) +void Battlefield::KickPlayerFromBattlefield(uint64 guid) { if (Player* player = sObjectAccessor->FindPlayer(guid)) if (player->GetZoneId() == GetZoneId()) @@ -305,7 +301,7 @@ void Battlefield::KickPlayerFromBf(uint64 guid) void Battlefield::StartBattle() { - if (m_BattlefieldActive) + if (m_isActive) return; for (int team = 0; team < BG_TEAMS_COUNT; team++) @@ -315,41 +311,41 @@ void Battlefield::StartBattle() } m_Timer = m_BattleTime; - m_BattlefieldActive = true; + m_isActive = true; - InvitePlayerInZoneToWar(); - InvitePlayerInQueueToWar(); + InvitePlayersInZoneToWar(); + InvitePlayersInQueueToWar(); - PlaySoundToAll(BF_START); + DoPlaySoundToAll(BF_START); OnBattleStart(); } -void Battlefield::EndBattle(bool endbytimer) +void Battlefield::EndBattle(bool endByTimer) { - if (!m_BattlefieldActive) + if (!m_isActive) return; - m_BattlefieldActive = false; + m_isActive = false; m_StartGrouping = false; - if (!endbytimer) + if (!endByTimer) SetDefenderTeam(GetAttackerTeam()); if (GetDefenderTeam() == TEAM_ALLIANCE) - PlaySoundToAll(BF_ALLIANCE_WINS); // alliance wins sound + DoPlaySoundToAll(BF_ALLIANCE_WINS); else - PlaySoundToAll(BF_HORDE_WINS); // horde wins sound + DoPlaySoundToAll(BF_HORDE_WINS); - OnBattleEnd(endbytimer); + OnBattleEnd(endByTimer); - // reset bf timer + // Reset battlefield timer m_Timer = m_NoWarBattleTime; SendInitWorldStatesToAll(); } -void Battlefield::PlaySoundToAll(uint32 SoundID) +void Battlefield::DoPlaySoundToAll(uint32 SoundID) { WorldPacket data; data.Initialize(SMSG_PLAY_SOUND, 4); @@ -357,34 +353,33 @@ void Battlefield::PlaySoundToAll(uint32 SoundID) for (int team = 0; team < BG_TEAMS_COUNT; team++) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - { if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->GetSession()->SendPacket(&data); - } } -bool Battlefield::HasPlayer(Player *player) const +bool Battlefield::HasPlayer(Player* player) const { return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end(); } // Called in WorldSession::HandleBfQueueInviteResponse -void Battlefield::PlayerAcceptInviteToQueue(Player *player) +void Battlefield::PlayerAcceptInviteToQueue(Player* player) { - // Add player in queueVenez + // Add player in queue m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID()); // Send notification - player->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId); + player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId); } + // Called in WorldSession::HandleBfExitRequest -void Battlefield::AskToLeaveQueue(Player *player) +void Battlefield::AskToLeaveQueue(Player* player) { // Remove player from queue m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID()); } // Called in WorldSession::HandleBfEntryInviteResponse -void Battlefield::PlayerAcceptInviteToWar(Player *player) +void Battlefield::PlayerAcceptInviteToWar(Player* player) { if (!IsWarTime()) return; @@ -394,7 +389,7 @@ void Battlefield::PlayerAcceptInviteToWar(Player *player) player->GetSession()->SendBfEntered(m_BattleId); m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID()); m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID()); - //Remove player AFK + if (player->isAFK()) player->ToggleAFK(); @@ -407,14 +402,14 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId) if (spellId > 0) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) - player->CastSpell(player, (uint32) spellId, true); + player->CastSpell(player, uint32(spellId), true); else for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) - player->RemoveAuraFromStack((uint32) - spellId); + player->RemoveAuraFromStack(uint32(-spellId)); } -void Battlefield::BroadcastPacketZone(WorldPacket & data) const +void Battlefield::BroadcastPacketToZone(WorldPacket& data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) @@ -422,7 +417,7 @@ void Battlefield::BroadcastPacketZone(WorldPacket & data) const player->GetSession()->SendPacket(&data); } -void Battlefield::BroadcastPacketQueue(WorldPacket & data) const +void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) @@ -430,7 +425,7 @@ void Battlefield::BroadcastPacketQueue(WorldPacket & data) const player->GetSession()->SendPacket(&data); } -void Battlefield::BroadcastPacketWar(WorldPacket & data) const +void Battlefield::BroadcastPacketToWar(WorldPacket& data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) @@ -477,14 +472,13 @@ void Battlefield::SendWarningToAllInZone(uint32 entry) WorldPacket data = BuildWarningAnnPacket(msg); BroadcastPacketWar(data); }*/ -void Battlefield::SendWarningToPlayer(Player *player, uint32 entry) -{ - if (!player) - return; - if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) - if (Creature* stalker = unit->ToCreature()) - sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID()); +void Battlefield::SendWarningToPlayer(Player* player, uint32 entry) +{ + if (player) + if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) + if (Creature* stalker = unit->ToCreature()) + sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID()); } void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) @@ -500,38 +494,37 @@ void Battlefield::RegisterZone(uint32 zoneId) sBattlefieldMgr->AddZone(zoneId, this); } -void Battlefield::HideNpc(Creature *p_Creature) +void Battlefield::HideNpc(Creature* creature) { - p_Creature->CombatStop(); - p_Creature->SetReactState(REACT_PASSIVE); - p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - p_Creature->SetPhaseMask(2, true); - p_Creature->DisappearAndDie(); - p_Creature->SetVisible(false); + creature->CombatStop(); + creature->SetReactState(REACT_PASSIVE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + creature->SetPhaseMask(2, true); + creature->DisappearAndDie(); + creature->SetVisible(false); } -void Battlefield::ShowNpc(Creature *p_Creature, bool p_Aggressive) +void Battlefield::ShowNpc(Creature* creature, bool aggressive) { - p_Creature->SetPhaseMask(1, true); - p_Creature->SetVisible(true); - p_Creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - if (!p_Creature->isAlive()) - p_Creature->Respawn(true); - if (p_Aggressive) - p_Creature->SetReactState(REACT_AGGRESSIVE); + creature->SetPhaseMask(1, true); + creature->SetVisible(true); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + if (!creature->isAlive()) + creature->Respawn(true); + if (aggressive) + creature->SetReactState(REACT_AGGRESSIVE); else { - p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - p_Creature->SetReactState(REACT_PASSIVE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + creature->SetReactState(REACT_PASSIVE); } } -//***************************************************** -//*******************Group System********************** -//***************************************************** -Group *Battlefield::GetFreeBfRaid(TeamId TeamId) +// **************************************************** +// ******************* Group System ******************* +// **************************************************** +Group* Battlefield::GetFreeBfRaid(TeamId TeamId) { - //if found free group we return it for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) if (!group->IsFull()) @@ -540,7 +533,7 @@ Group *Battlefield::GetFreeBfRaid(TeamId TeamId) return NULL; } -Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) +Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) { for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) @@ -550,7 +543,7 @@ Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) return NULL; } -bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player) +bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player) { if (!player->IsInWorld()) return false; @@ -583,97 +576,97 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player) //***************************************************** //***************Spirit Guide System******************* //***************************************************** + //-------------------- //-Battlefield Method- //-------------------- -BfGraveYard *Battlefield::GetGraveYardById(uint32 id) +BfGraveyard* Battlefield::GetGraveyardById(uint32 id) { - if (id < m_GraveYardList.size()) + if (id < m_GraveyardList.size()) { - if (m_GraveYardList[id]) - return m_GraveYardList[id]; + if (m_GraveyardList[id]) + return m_GraveyardList[id]; else - sLog->outError("Battlefield::GetGraveYardById Id:%u not existed", id); + sLog->outError("Battlefield::GetGraveyardById Id:%u not existed", id); } else - sLog->outError("Battlefield::GetGraveYardById Id:%u cant be found", id); + sLog->outError("Battlefield::GetGraveyardById Id:%u cant be found", id); return NULL; } -WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *player) +WorldSafeLocsEntry const * Battlefield::GetClosestGraveYard(Player* player) { - BfGraveYard* closestGY = NULL; + BfGraveyard* closestGY = NULL; float maxdist = -1; - for (uint8 i = 0; i < m_GraveYardList.size(); i++) + for (uint8 i = 0; i < m_GraveyardList.size(); i++) { - if (m_GraveYardList[i]) + if (m_GraveyardList[i]) { - if (m_GraveYardList[i]->GetControlTeamId() != player->GetTeamId()) + if (m_GraveyardList[i]->GetControlTeamId() != player->GetTeamId()) continue; - float dist = m_GraveYardList[i]->GetDistance(player); + float dist = m_GraveyardList[i]->GetDistance(player); if (dist < maxdist || maxdist < 0) { - closestGY = m_GraveYardList[i]; + closestGY = m_GraveyardList[i]; maxdist = dist; } } } if (closestGY) - return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveYardId()); + return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveyardId()); return NULL; } -void Battlefield::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) +void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid) { - for (uint8 i = 0; i < m_GraveYardList.size(); i++) + for (uint8 i = 0; i < m_GraveyardList.size(); i++) { - if (!m_GraveYardList[i]) + if (!m_GraveyardList[i]) continue; - if (m_GraveYardList[i]->HasNpc(npc_guid)) + if (m_GraveyardList[i]->HasNpc(npcGuid)) { - m_GraveYardList[i]->AddPlayer(player_guid); + m_GraveyardList[i]->AddPlayer(playerGuid); break; } } } -void Battlefield::RemovePlayerFromResurrectQueue(uint64 player_guid) +void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid) { - for (uint8 i = 0; i < m_GraveYardList.size(); i++) + for (uint8 i = 0; i < m_GraveyardList.size(); i++) { - if (!m_GraveYardList[i]) + if (!m_GraveyardList[i]) continue; - if (m_GraveYardList[i]->HasPlayer(player_guid)) + if (m_GraveyardList[i]->HasPlayer(playerGuid)) { - m_GraveYardList[i]->RemovePlayer(player_guid); + m_GraveyardList[i]->RemovePlayer(playerGuid); break; } } } -void Battlefield::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64 &guid) +void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid) { - sLog->outError("SendAreaSpiritHealerQueryOpcode"); WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); uint32 time = m_LastResurectTimer; // resurrect every 30 seconds data << guid << time; - ASSERT(pl && pl->GetSession()); - pl->GetSession()->SendPacket(&data); + ASSERT(player && player->GetSession()); + player->GetSession()->SendPacket(&data); } -//-------------------- -//-BfGraveYard Method- -//-------------------- -BfGraveYard::BfGraveYard(Battlefield *Bf) +// ---------------------- +// - BfGraveyard Method - +// ---------------------- +BfGraveyard::BfGraveyard(Battlefield* battlefield) { - m_Bf = Bf; + m_Bf = battlefield; m_GraveyardId = 0; m_ControlTeam = TEAM_NEUTRAL; m_SpiritGuide[0] = NULL; @@ -681,17 +674,17 @@ BfGraveYard::BfGraveYard(Battlefield *Bf) m_ResurrectQueue.clear(); } -void BfGraveYard::Initialize(TeamId startcontrol, uint32 gy) +void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId) { - m_ControlTeam = startcontrol; - m_GraveyardId = gy; + m_ControlTeam = startControl; + m_GraveyardId = graveyardId; } -void BfGraveYard::SetSpirit(Creature* spirit, TeamId team) +void BfGraveyard::SetSpirit(Creature* spirit, TeamId team) { if (!spirit) { - sLog->outError(": Invalid Spirit."); + sLog->outError("BfGraveyard::SetSpirit: Invalid Spirit."); return; } @@ -699,32 +692,32 @@ void BfGraveYard::SetSpirit(Creature* spirit, TeamId team) spirit->SetReactState(REACT_PASSIVE); } -float BfGraveYard::GetDistance(Player *player) +float BfGraveyard::GetDistance(Player* player) { - const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); - return player->GetDistance2d(ws->x, ws->y); + const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); + return player->GetDistance2d(safeLoc->x, safeLoc->y); } -void BfGraveYard::AddPlayer(uint64 player_guid) +void BfGraveyard::AddPlayer(uint64 playerGuid) { - if (!m_ResurrectQueue.count(player_guid)) + if (!m_ResurrectQueue.count(playerGuid)) { - m_ResurrectQueue.insert(player_guid); + m_ResurrectQueue.insert(playerGuid); - if (Player* player = sObjectAccessor->FindPlayer(player_guid)) + if (Player* player = sObjectAccessor->FindPlayer(playerGuid)) player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true); } } -void BfGraveYard::RemovePlayer(uint64 player_guid) +void BfGraveyard::RemovePlayer(uint64 playerGuid) { - m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid)); + m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid)); - if (Player* player = sObjectAccessor->FindPlayer(player_guid)) + if (Player* player = sObjectAccessor->FindPlayer(playerGuid)) player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); } -void BfGraveYard::Resurrect() +void BfGraveyard::Resurrect() { if (m_ResurrectQueue.empty()) return; @@ -736,7 +729,7 @@ void BfGraveYard::Resurrect() if (!player) continue; - // Check player isinworld and player is on good graveyard + // Check if the player is in world and on the good graveyard if (player->IsInWorld()) if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam])) spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true); @@ -754,7 +747,7 @@ void BfGraveYard::Resurrect() } // For changing graveyard control -void BfGraveYard::ChangeControl(TeamId team) +void BfGraveyard::GiveControlTo(TeamId team) { // Guide switching // Note: Visiblity changes are made by phasing @@ -768,52 +761,51 @@ void BfGraveYard::ChangeControl(TeamId team) RelocateDeadPlayers(); } -void BfGraveYard::RelocateDeadPlayers() +void BfGraveyard::RelocateDeadPlayers() { - WorldSafeLocsEntry const* ClosestGrave = NULL; + WorldSafeLocsEntry const* closestGrave = NULL; for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { Player* player = sObjectAccessor->FindPlayer(*itr); if (!player) continue; - if (ClosestGrave) - player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); + if (closestGrave) + player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation()); else { - ClosestGrave = m_Bf->GetClosestGraveYard(player); - if (ClosestGrave) - player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); + closestGrave = m_Bf->GetClosestGraveYard(player); + if (closestGrave) + player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation()); } } } -//***************End Spirit Guide system*************** +// ******************************************************* +// *************** End Spirit Guide system *************** +// ******************************************************* +// ********************** Misc *************************** +// ******************************************************* -//***************************************************** -//**********************Misc*************************** -//***************************************************** -//Method for spawn creature on map -Creature *Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team) +Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team) { return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team); } -Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team) +Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team) { //Get map object Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId)); if (!map) { - sLog->outError("Can't create creature entry: %u map not found", entry); + sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); return 0; } - //Create creature Creature* creature = new Creature; if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { - sLog->outError("Can't create creature entry: %u", entry); + sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; return NULL; } @@ -823,7 +815,7 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - sLog->outErrorDb("Battleground::AddCreature: entry %u does not exist.", entry); + sLog->outErrorDb("Battlefield::SpawnCreature: entry %u does not exist.", entry); return NULL; } // force using DB speeds -- do we really need this? @@ -838,10 +830,10 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl } // Method for spawning gameobject on map -GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o) +GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o) { // Get map object - Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(571)); + Map* map = const_cast(sMapMgr->CreateBaseMap(571)); // *vomits* if (!map) return 0; @@ -849,23 +841,24 @@ GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z GameObject* go = new GameObject; if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY)) { - sLog->outErrorDb("Gameobject template %u not found in database! Battleground not created!", entry); - sLog->outError("Cannot create gameobject template %u! Battleground not created!", entry); + sLog->outErrorDb("Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); + sLog->outError("Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); delete go; return NULL; } - // Add in the world + // Add to world map->AddToMap(go); go->setActive(true); + return go; } -//***************************************************** -//*******************CapturePoint********************** -//***************************************************** +// ******************************************************* +// ******************* CapturePoint ********************** +// ******************************************************* -BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL) +BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(NULL) { m_team = TEAM_NEUTRAL; m_value = 0; @@ -877,28 +870,28 @@ BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL) m_maxSpeed = 0; } -bool BfCapturePoint::HandlePlayerEnter(Player *player) +bool BfCapturePoint::HandlePlayerEnter(Player* player) { if (m_capturePoint) { player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); - player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); + 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->GetGUID()).second; } -GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* plr) +GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player) { if (m_capturePoint) - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); - GuidSet::iterator current = m_activePlayers[plr->GetTeamId()].find(plr->GetGUID()); + GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID()); - if (current == m_activePlayers[plr->GetTeamId()].end()) + if (current == m_activePlayers[player->GetTeamId()].end()) return current; // return end() - m_activePlayers[plr->GetTeamId()].erase(current++); + m_activePlayers[player->GetTeamId()].erase(current++); return current; } @@ -974,10 +967,10 @@ bool BfCapturePoint::Update(uint32 diff) { for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();) { - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) - itr = HandlePlayerLeave(plr); + if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) + itr = HandlePlayerLeave(player); else ++itr; } @@ -1111,7 +1104,7 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) player->KilledMonsterCredit(id, guid); } -bool BfCapturePoint::IsInsideObjective(Player *player) const +bool BfCapturePoint::IsInsideObjective(Player* player) const { return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end(); } diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 2bc7ccca408..217d6d62a26 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -68,342 +68,363 @@ class Creature; class Unit; class Battlefield; -class BfGraveYard; +class BfGraveyard; -typedef std::set < uint64 > GuidSet; -typedef std::vector < BfGraveYard * >GraveYardVect; -typedef std::map < uint64, uint32 > PlayerTimerMap; +typedef std::set GuidSet; +typedef std::vector GraveyardVect; +typedef std::map PlayerTimerMap; class BfCapturePoint { -public: - BfCapturePoint(Battlefield * bf); + public: + BfCapturePoint(Battlefield* bf); - virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {} + virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} - // send world state update to all players present - void SendUpdateWorldState(uint32 field, uint32 value); + // Send world state update to all players present + void SendUpdateWorldState(uint32 field, uint32 value); - // send kill notify to players in the controlling faction - void SendObjectiveComplete(uint32 id, uint64 guid); + // Send kill notify to players in the controlling faction + void SendObjectiveComplete(uint32 id, uint64 guid); - // used when player is activated/inactivated in the area - virtual bool HandlePlayerEnter(Player* player); - virtual GuidSet::iterator HandlePlayerLeave(Player* player); - //virtual void HandlePlayerActivityChanged(Player * player); + // Used when player is activated/inactivated in the area + virtual bool HandlePlayerEnter(Player* player); + virtual GuidSet::iterator HandlePlayerLeave(Player* player); + //virtual void HandlePlayerActivityChanged(Player* player); - // checks if player is in range of a capture credit marker - bool IsInsideObjective(Player * player) const; + // Checks if player is in range of a capture credit marker + bool IsInsideObjective(Player* player) const; - // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. - virtual bool Update(uint32 diff); - virtual void ChangeTeam(TeamId /*oldTeam */ ) {} - virtual void SendChangePhase(); + // Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. + virtual bool Update(uint32 diff); + virtual void ChangeTeam(TeamId /*oldTeam*/) {} + virtual void SendChangePhase(); - bool SetCapturePointData(GameObject* capturePoint); - GameObject* GetCapturePointGo() { return m_capturePoint; } + bool SetCapturePointData(GameObject* capturePoint); + GameObject* GetCapturePointGo() { return m_capturePoint; } - TeamId GetTeamId() {return m_team;} -protected: - bool DelCapturePoint(); + TeamId GetTeamId() { return m_team; } + protected: + bool DelCapturePoint(); - // active players in the area of the objective, 0 - alliance, 1 - horde - GuidSet m_activePlayers[2]; + // active Players in the area of the objective, 0 - alliance, 1 - horde + GuidSet m_activePlayers[2]; - // total shift needed to capture the objective - float m_maxValue; - float m_minValue; + // Total shift needed to capture the objective + float m_maxValue; + float m_minValue; - // maximum speed of capture - float m_maxSpeed; + // Maximum speed of capture + float m_maxSpeed; - // the status of the objective - float m_value; - TeamId m_team; + // The status of the objective + float m_value; + TeamId m_team; - // objective states - BattlefieldObjectiveStates m_OldState; - BattlefieldObjectiveStates m_State; + // Objective states + BattlefieldObjectiveStates m_OldState; + BattlefieldObjectiveStates m_State; - // neutral value on capture bar - uint32 m_neutralValuePct; + // Neutral value on capture bar + uint32 m_neutralValuePct; - // pointer to the Battlefield this objective belongs to - Battlefield *m_Bf; - uint32 m_capturePointEntry; - GameObject *m_capturePoint; + // Pointer to the Battlefield this objective belongs to + Battlefield* m_Bf; + + // Capture point entry + uint32 m_capturePointEntry; + + // Gameobject related to that capture point + GameObject* m_capturePoint; }; -class BfGraveYard +class BfGraveyard { -public: - BfGraveYard(Battlefield *Bf); - - // method for change who control the graveyard - void ChangeControl(TeamId team); - TeamId GetControlTeamId() { return m_ControlTeam; } - - // use for found the nearest graveyard - float GetDistance(Player * player); - void Initialize(TeamId startcontrol, uint32 gy); - void SetSpirit(Creature* spirit, TeamId team); - void AddPlayer(uint64 player_guid); - void RemovePlayer(uint64 player_guid); - - void Resurrect(); - void RelocateDeadPlayers(); - - bool HasNpc(uint64 guid) - { - // npcs could not be loaded in the map yet. - if (!m_SpiritGuide[0] || !m_SpiritGuide[1]) - return false; - - if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) || - !sObjectAccessor->FindUnit(m_SpiritGuide[1])) - return false; - - return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid); - } - bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } - uint32 GetGraveYardId() { return m_GraveyardId; } - -protected: - - TeamId m_ControlTeam; - uint32 m_GraveyardId; - uint64 m_SpiritGuide[2]; - GuidSet m_ResurrectQueue; - Battlefield *m_Bf; + public: + BfGraveyard(Battlefield* Bf); + + // Method to changing who controls the graveyard + void GiveControlTo(TeamId team); + TeamId GetControlTeamId() { return m_ControlTeam; } + + // Find the nearest graveyard to a player + float GetDistance(Player* player); + + // Initialize the graveyard + void Initialize(TeamId startcontrol, uint32 gy); + + // Set spirit service for the graveyard + void SetSpirit(Creature* spirit, TeamId team); + + // Add a player to the graveyard + void AddPlayer(uint64 player_guid); + + // Remove a player from the graveyard + void RemovePlayer(uint64 player_guid); + + // Resurrect players + void Resurrect(); + + // Move players waiting to that graveyard on the nearest one + void RelocateDeadPlayers(); + + // Check if this graveyard has a spirit guide + bool HasNpc(uint64 guid) + { + if (!m_SpiritGuide[0] || !m_SpiritGuide[1]) + return false; + + if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) || + !sObjectAccessor->FindUnit(m_SpiritGuide[1])) + return false; + + return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid); + } + + // Check if a player is in this graveyard's ressurect queue + bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } + + // Get the graveyard's ID. + uint32 GetGraveyardId() { return m_GraveyardId; } + + protected: + TeamId m_ControlTeam; + uint32 m_GraveyardId; + uint64 m_SpiritGuide[2]; + GuidSet m_ResurrectQueue; + Battlefield* m_Bf; }; class Battlefield : public ZoneScript { friend class BattlefieldMgr; - public: - /// Constructor - Battlefield(); - /// Destructor - virtual ~Battlefield(); - - /// typedef of map witch store capturepoint and the associate gameobject entry - typedef std::map < uint32 /*lowguid */ , BfCapturePoint * >BfCapturePointMap; - - /// Call this to init the Battlefield - virtual bool SetupBattlefield() { return true; } - - /// Generate packet which contain all worldstatedata of area - virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {} - - /// Update data of a worldstate to all players present in zone - void SendUpdateWorldState(uint32 field, uint32 value); - - /** - * \brief Called every time for update bf data and time - * -Update timer for start/end battle - * -Invite player in zone to queue x minutes before start (x = m_StartGroupingTimer) - * -Kick Afk players - * \param diff : time ellapsed since last call (in ms) - */ - virtual bool Update(uint32 diff); - - /// Invite all player in zone, to join the queue, called x minutes before battle start in Update() - void InvitePlayerInZoneToQueue(); - /// Invite all player in queue to join battle on battle start - void InvitePlayerInQueueToWar(); - /// Invite all player in zone to join battle on battle start - void InvitePlayerInZoneToWar(); - - /// Called when a Unit is kill in battlefield zone - virtual void HandleKill(Player * /*killer */ , Unit * /*killed */ ) {}; - - uint32 GetTypeId() { return m_TypeId; } - uint32 GetZoneId() { return m_ZoneId; } - - void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0); - - /// Return true if battle is start, false if battle is not started - bool IsWarTime() { return m_BattlefieldActive; } - - /// Enable or Disable battlefield - void SetEnable(bool enable) { m_enable = enable; } - /// Return if battlefield is enable - bool GetEnable() { return m_enable; } - - /** - * \brief Kick player from battlefield and teleport him to kick-point location - * \param guid : guid of player who must be kick - */ - void KickPlayerFromBf(uint64 guid); - - /// Called when player (player) enter in zone - void HandlePlayerEnterZone(Player * player, uint32 zone); - /// Called when player (player) leave the zone - void HandlePlayerLeaveZone(Player * player, uint32 zone); - - // All-purpose data storage 64 bit - virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; } - virtual void SetData64(uint32 DataId, uint64 Value) { m_Data64[DataId] = Value; } - - // All-purpose data storage 32 bit - virtual uint32 GetData(uint32 DataId) { return m_Data32[DataId]; } - virtual void SetData(uint32 DataId, uint32 Value) { m_Data32[DataId] = Value; } - - // Battlefield - generic methods - TeamId GetDefenderTeam() { return m_DefenderTeam; } - TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); } - void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; } - - // Group methods - /** - * \brief Find a not full battlefield group, if there is no, create one - * \param TeamId : Id of player team for who we search a group (player->GetTeamId()) - */ - Group *GetFreeBfRaid(TeamId TeamId); - /// Return battlefield group where player is. - Group *GetGroupPlayer(uint64 guid, TeamId TeamId); - /// Force player to join a battlefield group - bool AddOrSetPlayerToCorrectBfGroup(Player * player); - - // Graveyard methods - // Find which graveyard the player must be teleported to to be resurrected by spiritguide - WorldSafeLocsEntry const *GetClosestGraveYard(Player * player); - - virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); - void RemovePlayerFromResurrectQueue(uint64 player_guid); - void SetGraveyardNumber(uint32 number) { m_GraveYardList.resize(number); } - BfGraveYard *GetGraveYardById(uint32 id); - - // Misc methods - Creature *SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); - Creature *SpawnCreature(uint32 entry, Position pos, TeamId team); - GameObject *SpawnGameObject(uint32 entry, float x, float y, float z, float o); - - // Script-methods - - /// Called on start - virtual void OnBattleStart() {}; - /// Called at the end of battle - virtual void OnBattleEnd(bool /*endbytimer */ ) {}; - /// Called x minutes before battle start when player in zone are invite to join queue - virtual void OnStartGrouping() {}; - /// Called when a player accept to join the battle - virtual void OnPlayerJoinWar(Player * /*player */ ) {}; - /// Called when a player leave the battle - virtual void OnPlayerLeaveWar(Player * /*player */ ) {}; - /// Called when a player leave battlefield zone - virtual void OnPlayerLeaveZone(Player * /*player */ ) {}; - /// Called when a player enter in battlefield zone - virtual void OnPlayerEnterZone(Player * /*player */ ) {}; - - WorldPacket BuildWarningAnnPacket(std::string msg); - void SendWarningToAllInZone(uint32 entry); - //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED - void SendWarningToPlayer(Player * player, uint32 entry); - - void PlayerAcceptInviteToQueue(Player * player); - void PlayerAcceptInviteToWar(Player * player); - uint32 GetBattleId() { return m_BattleId; } - void AskToLeaveQueue(Player * player); - - virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement */ , Player * /*player */ , uint8 /*incrementNumber = 1 */ ) {}; - - /// Send all worldstate data to all player in zone. - virtual void SendInitWorldStatesToAll() {}; - - /// Return if we can use mount in battlefield - bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not - void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid); - - void StartBattle(); - void EndBattle(bool endbytimer); - - void HideNpc(Creature * p_Creature); - void ShowNpc(Creature * p_Creature, bool p_Aggressive); - - GraveYardVect GetGraveYardVect() { return m_GraveYardList; } - - uint32 GetTimer() { return m_Timer; } - void SetTimer(uint32 timer) { m_Timer = timer; } - - void PlaySoundToAll(uint32 SoundID); - - void InvitePlayerToQueue(Player * player); - void InvitePlayerToWar(Player * player); - - void InitStalker(uint32 entry, float x, float y, float z, float o); - -protected: - uint64 StalkerGuid; - uint32 m_Timer; // Global timer for event - bool m_enable; - bool m_BattlefieldActive; - TeamId m_DefenderTeam; - - // the map of the objectives belonging to this outdoorpvp - BfCapturePointMap m_capturePoints; - - // the set of player - GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone - GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue - GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat - PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT]; - PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT]; - - //Variables that must exist for each battlefield - uint32 m_TypeId; // See enum BattlefieldTypes - uint32 m_BattleId; // BattleID (for packet) - uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197 - uint32 m_MapId; // MapId where is Battlefield - uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield - uint32 m_MinPlayer; // Minimum number of player for Battlefield start - uint32 m_MinLevel; // Required level to participate at Battlefield - uint32 m_BattleTime; // Length of a battle - uint32 m_NoWarBattleTime; // Time between two battles - uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle. - uint32 m_TimeForAcceptInvite; - uint32 m_uiKickDontAcceptTimer; - WorldLocation KickPosition; // Position where player is teleport if they switch to afk during battle or if they dont accept invitation - - uint32 m_uiKickAfkTimer; // Timer for check Afk in war - - //Graveyard variables - GraveYardVect m_GraveYardList; // Vector witch contain the different GY of the battle - uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec - - uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle - bool m_StartGrouping; // bool for know if all players in area has been invited - - GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group - - std::vector < uint64 > m_Data64; - std::vector < uint32 > m_Data32; - - void KickAfk(); - // use for switch off all worldstate for client - virtual void SendRemoveWorldStates(Player * /*player */ ) {} - - // use for send a packet for all player list - void BroadcastPacketZone(WorldPacket & data) const; - void BroadcastPacketQueue(WorldPacket & data) const; - void BroadcastPacketWar(WorldPacket & data) const; - - //CapturePoint system - void AddCapturePoint(BfCapturePoint * cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; } - - BfCapturePoint *GetCapturePoint(uint32 lowguid) const - { - Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); - if (itr != m_capturePoints.end()) - return itr->second; - return NULL; - } + public: + /// Constructor + Battlefield(); + /// Destructor + virtual ~Battlefield(); + + /// typedef of map witch store capturepoint and the associate gameobject entry + typedef std::map BfCapturePointMap; + + /// Call this to init the Battlefield + virtual bool SetupBattlefield() { return true; } + + /// Generate packet which contain all worldstatedata of area + virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} + + /// Update data of a worldstate to all players present in zone + void SendUpdateWorldState(uint32 field, uint32 value); + + /** + * \brief Called every time for update bf data and time + * - Update timer for start/end battle + * - Invite player in zone to queue m_StartGroupingTimer minutes before start + * - Kick Afk players + * \param diff : time ellapsed since last call (in ms) + */ + virtual bool Update(uint32 diff); + + /// Invite all players in zone to join the queue, called x minutes before battle start in Update() + void InvitePlayersInZoneToQueue(); + /// Invite all players in queue to join battle on battle start + void InvitePlayersInQueueToWar(); + /// Invite all players in zone to join battle on battle start + void InvitePlayersInZoneToWar(); + + /// Called when a Unit is kill in battlefield zone + virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {}; + + uint32 GetTypeId() { return m_TypeId; } + uint32 GetZoneId() { return m_ZoneId; } + + void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0); + + /// Return true if battle is start, false if battle is not started + bool IsWarTime() { return m_isActive; } + + /// Enable or Disable battlefield + void ToggleBattlefield(bool enable) { m_IsEnabled = enable; } + /// Return if battlefield is enable + bool IsEnabled() { return m_IsEnabled; } + + /** + * \brief Kick player from battlefield and teleport him to kick-point location + * \param guid : guid of player who must be kick + */ + void KickPlayerFromBattlefield(uint64 guid); + + /// Called when player (player) enter in zone + void HandlePlayerEnterZone(Player* player, uint32 zone); + /// Called when player (player) leave the zone + void HandlePlayerLeaveZone(Player* player, uint32 zone); + + // All-purpose data storage 64 bit + virtual uint64 GetData64(uint32 dataId) { return m_Data64[dataId]; } + virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; } + + // All-purpose data storage 32 bit + virtual uint32 GetData(uint32 dataId) { return m_Data32[dataId]; } + virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; } + virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; } + + // Battlefield - generic methods + TeamId GetDefenderTeam() { return m_DefenderTeam; } + TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); } + TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); } + void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; } + + // Group methods + /** + * \brief Find a not full battlefield group, if there is no, create one + * \param TeamId : Id of player team for who we search a group (player->GetTeamId()) + */ + Group* GetFreeBfRaid(TeamId TeamId); + /// Return battlefield group where player is. + Group* GetGroupPlayer(uint64 guid, TeamId TeamId); + /// Force player to join a battlefield group + bool AddOrSetPlayerToCorrectBfGroup(Player* player); + + // Graveyard methods + // Find which graveyard the player must be teleported to to be resurrected by spiritguide + WorldSafeLocsEntry const * GetClosestGraveYard(Player* player); + + virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); + void RemovePlayerFromResurrectQueue(uint64 player_guid); + void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); } + BfGraveyard* GetGraveyardById(uint32 id); + + // Misc methods + Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); + Creature* SpawnCreature(uint32 entry, Position pos, TeamId team); + GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o); + + // Script-methods + + /// Called on start + virtual void OnBattleStart() {}; + /// Called at the end of battle + virtual void OnBattleEnd(bool /*endByTimer*/) {}; + /// Called x minutes before battle start when player in zone are invite to join queue + virtual void OnStartGrouping() {}; + /// Called when a player accept to join the battle + virtual void OnPlayerJoinWar(Player* /*player*/) {}; + /// Called when a player leave the battle + virtual void OnPlayerLeaveWar(Player* /*player*/) {}; + /// Called when a player leave battlefield zone + virtual void OnPlayerLeaveZone(Player* /*player*/) {}; + /// Called when a player enter in battlefield zone + virtual void OnPlayerEnterZone(Player* /*player*/) {}; + + WorldPacket BuildWarningAnnPacket(std::string msg); + void SendWarningToAllInZone(uint32 entry); + //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED + void SendWarningToPlayer(Player* player, uint32 entry); + + void PlayerAcceptInviteToQueue(Player* player); + void PlayerAcceptInviteToWar(Player* player); + uint32 GetBattleId() { return m_BattleId; } + void AskToLeaveQueue(Player* player); + + virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {}; + + /// Send all worldstate data to all player in zone. + virtual void SendInitWorldStatesToAll() {}; + + /// Return if we can use mount in battlefield + bool CanFlyIn() { return !m_isActive; } + + void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid); + + void StartBattle(); + void EndBattle(bool endByTimer); + + void HideNpc(Creature* creature); + void ShowNpc(Creature* creature, bool aggressive); + + GraveyardVect GetGraveyardVector() { return m_GraveyardList; } + + uint32 GetTimer() { return m_Timer; } + void SetTimer(uint32 timer) { m_Timer = timer; } + + void DoPlaySoundToAll(uint32 SoundID); + + void InvitePlayerToQueue(Player* player); + void InvitePlayerToWar(Player* player); + + void InitStalker(uint32 entry, float x, float y, float z, float o); + + protected: + uint64 StalkerGuid; + uint32 m_Timer; // Global timer for event + bool m_IsEnabled; + bool m_isActive; + TeamId m_DefenderTeam; + + // Map of the objectives belonging to this OutdoorPvP + BfCapturePointMap m_capturePoints; + + // Players info maps + GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone + GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue + GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat + PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT]; + PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT]; + + // Variables that must exist for each battlefield + uint32 m_TypeId; // See enum BattlefieldTypes + uint32 m_BattleId; // BattleID (for packet) + uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197 + uint32 m_MapId; // MapId where is Battlefield + uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield + uint32 m_MinPlayer; // Minimum number of player for Battlefield start + uint32 m_MinLevel; // Required level to participate at Battlefield + uint32 m_BattleTime; // Length of a battle + uint32 m_NoWarBattleTime; // Time between two battles + uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle. + uint32 m_TimeForAcceptInvite; + uint32 m_uiKickDontAcceptTimer; + WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation + + uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war + + // Graveyard variables + GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle + uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec + + uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle + bool m_StartGrouping; // bool for know if all players in area has been invited + + GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group + + std::vector m_Data64; + std::vector m_Data32; + + void KickAfkPlayers(); + + // use for switch off all worldstate for client + virtual void SendRemoveWorldStates(Player* /*player*/) {} + + // use for send a packet for all player list + void BroadcastPacketToZone(WorldPacket& data) const; + void BroadcastPacketToQueue(WorldPacket& data) const; + void BroadcastPacketToWar(WorldPacket& data) const; + + // CapturePoint system + void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; } - void RegisterZone(uint32 zoneid); - bool HasPlayer(Player * player) const; - void TeamCastSpell(TeamId team, int32 spellId); + BfCapturePoint* GetCapturePoint(uint32 lowguid) const + { + Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); + if (itr != m_capturePoints.end()) + return itr->second; + return NULL; + } + void RegisterZone(uint32 zoneid); + bool HasPlayer(Player* player) const; + void TeamCastSpell(TeamId team, int32 spellId); }; #endif diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 7f7613b3950..e10c5c136d9 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -60,7 +60,7 @@ void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId) //Param2:(ZoneId) the zone where the battle is (4197 for wg) //Param3:(CanQueue) if able to queue //Param4:(Full) on log in is full -void WorldSession::SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full) +void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full) { WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11); data << uint32(BattleId); @@ -132,7 +132,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data) else { if (_player->GetZoneId() == Bf->GetZoneId()) - Bf->KickPlayerFromBf(_player->GetGUID()); + Bf->KickPlayerFromBattlefield(_player->GetGUID()); } } diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 095ec4fd18a..9f821871c2b 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -77,10 +77,9 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid) if (itr == m_BattlefieldMap.end()) return; - if (itr->second->HasPlayer(player)) - return; - if (itr->second->GetEnable() == false) + if (itr->second->HasPlayer(player) || !itr->second->IsEnabled()) return; + itr->second->HandlePlayerEnterZone(player, zoneid); sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); } @@ -106,7 +105,7 @@ Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid) // no handle for this zone, return return NULL; } - if (itr->second->GetEnable() == false) + if (!itr->second->IsEnabled()) return NULL; return itr->second; } @@ -127,7 +126,7 @@ void BattlefieldMgr::Update(uint32 diff) if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL) { for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) - if ((*itr)->GetEnable()) + if ((*itr)->IsEnabled()) (*itr)->Update(m_UpdateTimer); m_UpdateTimer = 0; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index fac3b9cd04f..decc22105a4 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -25,7 +25,7 @@ #include "SpellAuras.h" #include "Vehicle.h" -enum WGBfData +enum WintergrastData { BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp BATTLEFIELD_WG_MAPID = 571, // Northrend @@ -49,7 +49,7 @@ bool BattlefieldWG::SetupBattlefield() m_MapId = BATTLEFIELD_WG_MAPID; m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX); - m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); + m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL); m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS; @@ -72,39 +72,39 @@ bool BattlefieldWG::SetupBattlefield() m_saveTimer = 60000; // Init GraveYards - SetGraveyardNumber(BATTLEFIELD_WG_GY_MAX); + SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX); // Load from db if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0) && (sWorld->getWorldState(ClockWorldState[0]) == 0)) { - sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, false); - sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, urand(0, 1)); - sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false)); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1))); + sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime)); } - m_BattlefieldActive = sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE); + m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE)); m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER)); - + m_Timer = sWorld->getWorldState(ClockWorldState[0]); - if (m_BattlefieldActive) + if (m_isActive) { - m_BattlefieldActive = false; + m_isActive = false; m_Timer = m_RestartAfterCrash; } - for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++) + for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++) { - BfGraveYardWG *gy = new BfGraveYardWG(this); + BfGraveyardWG* graveyard = new BfGraveyardWG(this); // When between games, the graveyard is controlled by the defending team if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) - gy->Initialize(m_DefenderTeam, WGGraveYard[i].gyid); + graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid); else - gy->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); - gy->SetTextId(WGGraveYard[i].textid); - m_GraveYardList[i] = gy; + graveyard->SetTextId(WGGraveYard[i].textid); + m_GraveyardList[i] = graveyard; } @@ -113,61 +113,68 @@ bool BattlefieldWG::SetupBattlefield() { WGWorkshop* workshop = new WGWorkshop(this, i); if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - workshop->ChangeControl(GetAttackerTeam(), true); + workshop->GiveControlTo(GetAttackerTeam(), true); else - workshop->ChangeControl(GetDefenderTeam(), true); - - //Note: Capture point is added once the gameobject is created. + workshop->GiveControlTo(GetDefenderTeam(), true); + // Note: Capture point is added once the gameobject is created. WorkshopsList.insert(workshop); } - // Spawning npc in keep + // Spawn NPCs in the defender's keep, both Horde and Alliance for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++) { // Horde npc - if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE)) + if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE)) KeepCreature[TEAM_HORDE].insert(creature->GetGUID()); // Alliance npc - if (Creature* creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE)) + if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE)) KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); } - // Hide keep npc + + // Hide NPCs from the Attacker's team in the keep for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); - // Spawn out of keep npc - // Horde npc + + // Spawn Horde NPCs outside the keep for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++) - if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) + if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) OutsideCreature[TEAM_HORDE].insert(creature->GetGUID()); - // Alliance npc + + // Spawn Alliance NPCs outside the keep for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++) - if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) + if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); - // Hide outside npc + + // Hide units outside the keep that are defenders for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); + + // Spawn turrets and hide them per default for (uint8 i = 0; i < WG_MAX_TURRET; i++) { - if (Creature* creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0))) + Position towerCannonPos; + WGTurret[i].GetPosition(&towerCannonPos); + if (Creature* creature = SpawnCreature(NPC_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE)) { CanonList.insert(creature->GetGUID()); HideNpc(creature); } } - // Spawning Buiding + + // Spawn all gameobjects for (uint8 i = 0; i < WG_MAX_OBJ; i++) { - GameObject* go = - SpawnGameObject(WGGameObjectBuillding[i].entry, WGGameObjectBuillding[i].x, WGGameObjectBuillding[i].y, WGGameObjectBuillding[i].z, WGGameObjectBuillding[i].o); - BfWGGameObjectBuilding *b = new BfWGGameObjectBuilding(this); - b->Init(go, WGGameObjectBuillding[i].type, WGGameObjectBuillding[i].WorldState, WGGameObjectBuillding[i].nameid); + GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o); + BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this); + b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId); BuildingsInZone.insert(b); } + // Spawning portal defender for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++) { @@ -176,15 +183,15 @@ bool BattlefieldWG::SetupBattlefield() go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]); } - // Spawn banner in keep + // Spawn banners in the keep for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++) { - if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) + if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryHorde, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) { go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY); m_KeepGameObject[1].insert(go); } - if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) + if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryAlliance, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) { go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); m_KeepGameObject[0].insert(go); @@ -208,7 +215,7 @@ bool BattlefieldWG::Update(uint32 diff) bool m_return = Battlefield::Update(diff); if (m_saveTimer <= diff) { - sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_BattlefieldActive); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_isActive); sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam); sWorld->setWorldState(ClockWorldState[0], m_Timer); m_saveTimer = 60 * IN_MILLISECONDS; @@ -222,13 +229,13 @@ bool BattlefieldWG::Update(uint32 diff) void BattlefieldWG::OnBattleStart() { // Spawn titan relic - m_relic = SpawnGameObject(BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC, 5440.0f, 2840.8f, 430.43f, 0); - if (m_relic) + m_titansRelic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0); + if (m_titansRelic) { // Update faction of relic, only attacker can click on - m_relic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]); + m_titansRelic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]); // Set in use (not allow to click on before last door is broken) - m_relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } else sLog->outError("WG: Failed to spawn titan relic."); @@ -257,17 +264,15 @@ void BattlefieldWG::OnBattleStart() } } - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] = 0; - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] = 0; - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT] = 0; - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF] = 0; + SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0); + SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0); + SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0); + SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0); // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) - { if (*itr) - (*itr)->UpdateGraveYardAndWorkshop(); - } + (*itr)->UpdateGraveyardAndWorkshop(); for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) @@ -292,32 +297,32 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) { if (init) { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H] = 0; - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A] = 0; + SetData(BATTLEFIELD_WG_DATA_VEHICLE_H, 0); + SetData(BATTLEFIELD_WG_DATA_VEHICLE_A, 0); } - m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = 0; - m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = 0; + SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 0); + SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 0); for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { if (WGWorkshop* workshop = (*itr)) { if (workshop->teamControl == TEAM_ALLIANCE) - m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4; + UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 4); else if (workshop->teamControl == TEAM_HORDE) - m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] + 4; + UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 4); } } UpdateVehicleCountWG(); } -void BattlefieldWG::OnBattleEnd(bool endbytimer) +void BattlefieldWG::OnBattleEnd(bool endByTimer) { // Remove relic - if (m_relic) - m_relic->RemoveFromWorld(); - m_relic = NULL; + if (m_titansRelic) + m_titansRelic->RemoveFromWorld(); + m_titansRelic = NULL; // Remove turret for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) @@ -326,52 +331,42 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { if (Creature* creature = unit->ToCreature()) { - if (!endbytimer) + if (!endByTimer) creature->setFaction(WintergraspFaction[GetDefenderTeam()]); HideNpc(creature); } } } - // If endbytimer is false, battle is end by clicking on relic - if (!endbytimer) + if (!endByTimer) // One player triggered the relic { // Change all npc in keep for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); - } + for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) ShowNpc(creature, true); - } + // Change all npc out of keep for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); - } + for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) ShowNpc(creature, true); - } } // Update all graveyard, control is to defender when no wartime for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++) - { - if (GetGraveYardById(i)) - { - GetGraveYardById(i)->ChangeControl(GetDefenderTeam()); - } - } + if (BfGraveyard* graveyard = GetGraveyardById(i)) + graveyard->GiveControlTo(GetDefenderTeam()); for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr) (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); @@ -389,58 +384,23 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) (*itr)->Save(); - uint32 WinHonor = 0; - uint32 LossHonor = 0; - - if (!endbytimer) - { - WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]; - LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]; - } - else - { - WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]; - LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]; - } - for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) { if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); - if (player->HasAura(SPELL_LIEUTENANT)) - { - player->RewardHonor(NULL, 1, WinHonor); - RewardMarkOfHonor(player, 3); - } - else if (player->HasAura(SPELL_CORPORAL)) - { - player->RewardHonor(NULL, 1, WinHonor); - RewardMarkOfHonor(player, 2); - } + player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true); + player->CastSpell(player, SPELL_VICTORY_REWARD, true); // Send Wintergrasp victory achievement DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); // Award achievement for succeeding in Wintergrasp in 10 minutes or less - if (!endbytimer && GetTimer() <= 10000) + if (!endByTimer && GetTimer() <= 10000) DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player); } } + for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) - { if (Player* player = sObjectAccessor->FindPlayer(*itr)) - { - if (player->HasAura(SPELL_LIEUTENANT)) - { - player->RewardHonor(NULL, 1, LossHonor); - RewardMarkOfHonor(player, 1); - } - else if (player->HasAura(SPELL_CORPORAL)) - { - player->RewardHonor(NULL, 1, LossHonor); - RewardMarkOfHonor(player, 1); - } - } - } + player->CastSpell(player, SPELL_DEFEAT_REWARD, true); for (uint8 team = 0; team < 2; ++team) { @@ -448,19 +408,18 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) if (Player* player = sObjectAccessor->FindPlayer(*itr)) RemoveAurasFromPlayer(player); - m_PlayersInWar[team].clear(); + m_PlayersInWar[team].clear(); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) if (creature->IsVehicle()) creature->GetVehicleKit()->Dismiss(); - } + m_vehicles[team].clear(); } - if (!endbytimer) + if (!endByTimer) { for (uint8 team = 0; team < 2; ++team) { @@ -475,72 +434,45 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) } } - if (!endbytimer) - { // win alli/horde + if (!endByTimer) // win alli/horde SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1); - } - else - { // defend alli/horde + else // defend alli/horde SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1); - } } -// ***************************************************** -// *******************Reward System********************* -// ***************************************************** -void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 /*incrementNumber */ ) +// ******************************************************* +// ******************* Reward System ********************* +// ******************************************************* +void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 /*incrementNumber*/) { - AchievementEntry const* AE = sAchievementStore.LookupEntry(achievement); + AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievement); + + if (!achievementEntry) + return; switch (achievement) { case ACHIEVEMENTS_WIN_WG_100: - { - // player->GetAchievementMgr().UpdateAchievementCriteria(); - } + { + // player->GetAchievementMgr().UpdateAchievementCriteria(); + } default: - { - if (player) - player->CompletedAchievement(AE); - } + { + if (player) + player->CompletedAchievement(achievementEntry); break; + } } } -void BattlefieldWG::RewardMarkOfHonor(Player* player, uint32 count) -{ - // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens - if (count == 0) - return; - - ItemPosCountVec dest; - uint32 no_space_count = 0; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count); - - if (msg == EQUIP_ERR_ITEM_NOT_FOUND) - { - return; - } - - if (msg != EQUIP_ERR_OK) // convert to possible store amount - count -= no_space_count; - - if (count != 0 && !dest.empty()) // can add some - if (Item * item = player->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0)) - player->SendNewItem(item, count, true, false); -} - void BattlefieldWG::OnStartGrouping() { - // Warn SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); } uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) { - uint8 graveyardId = 0; - switch (areaId) { case AREA_WINTERGRASP_FORTRESS: @@ -558,29 +490,27 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) case AREA_THE_CHILLED_QUAGMIRE: return BATTLEFIELD_WG_GY_HORDE; default: - sLog->outError(": Unexpected Area Id %u", areaId); + sLog->outError("BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); break; } - return graveyardId; + return 0; } -void BattlefieldWG::OnCreatureCreate(Creature *creature) +void BattlefieldWG::OnCreatureCreate(Creature* creature) { // Accessing to db spawned creatures switch (creature->GetEntry()) { - // Alliance Spirit case NPC_DWARVEN_SPIRIT_GUIDE: - // Horde Spirit case NPC_TAUNKA_SPIRIT_GUIDE: - { - TeamId teamId = creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE; - uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId()); - if (m_GraveYardList[graveyardId]) - m_GraveYardList[graveyardId]->SetSpirit(creature, teamId); - } + { + TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE); + uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId()); + if (m_GraveyardList[graveyardId]) + m_GraveyardList[graveyardId]->SetSpirit(creature, teamId); break; + } } // untested code - not sure if it is valid. @@ -588,53 +518,53 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature) { switch (creature->GetEntry()) { - case NPC_WG_SEIGE_ENGINE_ALLIANCE: - case NPC_WG_SEIGE_ENGINE_HORDE: - case NPC_WG_CATAPULT: - case NPC_WG_DEMOLISHER: + case NPC_WINTERGRASP_SIEGE_ENGINE_1: + case NPC_WINTERGRASP_SIEGE_ENGINE_2: + case NPC_WINTERGRASP_CATAPULT: + case NPC_WINTERGRASP_DEMOLISHER: + { + uint8 team; + if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) + team = TEAM_ALLIANCE; + else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) + team = TEAM_HORDE; + else + return; + + if (team == TEAM_HORDE) { - uint8 team; - if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) - team = TEAM_ALLIANCE; - else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) - team = TEAM_HORDE; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) + { + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1); + creature->CastSpell(creature, SPELL_HORDE_FLAG, true); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); + } else + { + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); return; - - if (team == TEAM_HORDE) + } + } + else + { + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) { - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) - { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; - creature->CastSpell(creature, SPELL_HORDE_FLAG, true); - m_vehicles[team].insert(creature->GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); - return; - } + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1); + creature->CastSpell(creature, SPELL_HORDE_FLAG, true); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); } else { - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) - { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; - creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true); - m_vehicles[team].insert(creature->GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); - return; - } + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; } - break; } + break; + } } } } @@ -645,28 +575,28 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature) { switch (creature->GetEntry()) { - case NPC_WG_SEIGE_ENGINE_ALLIANCE: - case NPC_WG_SEIGE_ENGINE_HORDE: - case NPC_WG_CATAPULT: - case NPC_WG_DEMOLISHER: - { - uint8 team; - if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) - team = TEAM_ALLIANCE; - else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) - team = TEAM_HORDE; - else - return; - - m_vehicles[team].erase(creature->GetGUID()); - if (team == TEAM_HORDE) - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--; - else - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--; - UpdateVehicleCountWG(); - - break; - } + case NPC_WINTERGRASP_SIEGE_ENGINE_1: + case NPC_WINTERGRASP_SIEGE_ENGINE_2: + case NPC_WINTERGRASP_CATAPULT: + case NPC_WINTERGRASP_DEMOLISHER: + { + uint8 team; + if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) + team = TEAM_ALLIANCE; + else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) + team = TEAM_HORDE; + else + return; + + m_vehicles[team].erase(creature->GetGUID()); + if (team == TEAM_HORDE) + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1); + else + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1); + UpdateVehicleCountWG(); + + break; + } } } } @@ -678,40 +608,40 @@ void BattlefieldWG::OnGameObjectCreate(GameObject* go) switch (go->GetEntry()) { - case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE: + case GO_WINTERGRASP_FACTORY_BANNER_NE: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_NE; break; - case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW: + case GO_WINTERGRASP_FACTORY_BANNER_NW: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_NW; break; - case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE: + case GO_WINTERGRASP_FACTORY_BANNER_SE: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_SE; break; - case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW: + case GO_WINTERGRASP_FACTORY_BANNER_SW: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_SW; break; } - if (isWorkshop) + if (!isWorkshop) + return; + + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { - for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) + if (WGWorkshop* workshop = (*itr)) { - if (WGWorkshop* workshop = (*itr)) + if (workshop->workshopId == workshopId) { - if (workshop->workshopId == workshopId) - { - BfCapturePointWG* capturePoint = new BfCapturePointWG(this, GetAttackerTeam()); + WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam()); - capturePoint->SetCapturePointData(go); - capturePoint->LinkToWorkShop(workshop); - AddCapturePoint(capturePoint); - break; - } + capturePoint->SetCapturePointData(go); + capturePoint->LinkToWorkshop(workshop); + AddCapturePoint(capturePoint); + break; } } } @@ -727,29 +657,20 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (victim->GetTypeId() == TYPEID_PLAYER) { for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr) - { if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); - } return; } - for (GuidSet::const_iterator itr = m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); - itr != m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) - { + + for (GuidSet::const_iterator itr = m_vehicles[GetOtherTeam(killer->GetTeamId())].begin(); itr != m_vehicles[GetOtherTeam(killer->GetTeamId())].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - { if (Creature* creature = unit->ToCreature()) - { if (victim->GetEntry() == creature->GetEntry() && !again) - { again = true; - } - } - } - } - for (GuidSet::const_iterator itr = KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); - itr != KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) + + for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killer->GetTeamId())].begin(); + itr != KeepCreature[GetOtherTeam(killer->GetTeamId())].end(); ++itr) { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { @@ -759,11 +680,9 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { again = true; for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) - { if (Player* player = sObjectAccessor->FindPlayer(*iter)) - if (player->GetDistance2d(killer) < 40) + if (player->GetDistance2d(killer) < 40.0f) PromotePlayer(player); - } } } } @@ -774,12 +693,12 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) // Update rank for player void BattlefieldWG::PromotePlayer(Player* killer) { - if (!m_BattlefieldActive) + if (!m_isActive) return; // Updating rank of player if (Aura* aur = killer->GetAura(SPELL_RECRUIT)) { - if (aur->GetStackAmount() >= 5) // 7 or more TODO: + if (aur->GetStackAmount() >= 5) { killer->RemoveAura(SPELL_RECRUIT); killer->CastSpell(killer, SPELL_CORPORAL, true); @@ -790,7 +709,7 @@ void BattlefieldWG::PromotePlayer(Player* killer) } else if (Aura* aur = killer->GetAura(SPELL_CORPORAL)) { - if (aur->GetStackAmount() >= 5) // 7 or more TODO: + if (aur->GetStackAmount() >= 5) { killer->RemoveAura(SPELL_CORPORAL); killer->CastSpell(killer, SPELL_LIEUTENANT, true); @@ -822,9 +741,7 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player) if (player->GetZoneId() != m_ZoneId) { if (player->GetTeamId() == GetDefenderTeam()) - { player->TeleportTo(571, 5345, 2842, 410, 3.14f); - } else { if (player->GetTeamId() == TEAM_HORDE) @@ -838,13 +755,13 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player) if (player->GetTeamId() == GetAttackerTeam()) { - if (3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) - player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); + if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) < 3) + player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT)); } else { - if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) - player->SetAuraStack(SPELL_TOWER_CONTROL, player, m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); + if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0) + player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT)); } SendInitWorldStatesTo(player); } @@ -858,6 +775,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) player->GetVehicle()->Dismiss(); RemoveAurasFromPlayer(player); } + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); @@ -866,7 +784,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) void BattlefieldWG::OnPlayerLeaveZone(Player* player) { - if (!m_BattlefieldActive) + if (!m_isActive) RemoveAurasFromPlayer(player); player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); @@ -877,7 +795,7 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) void BattlefieldWG::OnPlayerEnterZone(Player* player) { - if (!m_BattlefieldActive) + if (!m_isActive) RemoveAurasFromPlayer(player); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); @@ -896,11 +814,8 @@ uint32 BattlefieldWG::GetData(uint32 data) case AREA_WESTPARK_WORKSHOP: case AREA_EASTPARK_WORKSHOP: // Graveyards and Workshops are controlled by the same team. - if (m_GraveYardList[GetSpiritGraveyardId(data)]) - return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); - default: - if (m_Data32[data]) - return m_Data32[data]; + if (m_GraveyardList[GetSpiritGraveyardId(data)]) + return m_GraveyardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); } return Battlefield::GetData(data); @@ -918,8 +833,8 @@ WorldPacket BattlefieldWG::BuildInitWorldStates() data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam()); data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam()); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); - data << uint32(3710) << uint32(IsWarTime()? 1 : 0); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); // Note: cleanup these two, their names look awkward + data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime()? 1 : 0); for (uint32 i = 0; i < 2; ++i) data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000)); @@ -930,20 +845,16 @@ WorldPacket BattlefieldWG::BuildInitWorldStates() data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) - { data << (*itr)->m_WorldState << (*itr)->m_State; - } + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) - { - if (!*itr) - continue; + if (*itr) + data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state; - data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state; - } return data; } -void BattlefieldWG::SendInitWorldStatesTo(Player *player) +void BattlefieldWG::SendInitWorldStatesTo(Player* player) { WorldPacket data = BuildInitWorldStates(); player->GetSession()->SendPacket(&data); @@ -970,47 +881,44 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) } }*/ } + // Called when a tower is broke -void BattlefieldWG::AddBrokenTower(TeamId team) +void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team) { // Destroy an attack tower if (team == GetAttackerTeam()) { // Update counter - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]--; - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]++; + UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, -1); + UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 1); - // Remove buff stack + // Remove buff stack on attackers for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->RemoveAuraFromStack(SPELL_TOWER_CONTROL); - // Add buff stack + // Add buff stack to defenders for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); } - // If the threw south tower is destroy - if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] == 3) + + // If all three south towers are destroyed (ie. all attack towers), remove ten minutes from battle time + if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) == 3) { - // Remove 10 minutes to battle time if (int32(m_Timer - 600000) < 0) - { m_Timer = 0; - } else - { m_Timer -= 600000; - } SendInitWorldStatesToAll(); } } else { - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]--; - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF]++; + UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, -1); + UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 1); } } @@ -1025,13 +933,12 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) return; // On click on titan relic - if (go->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC) + if (go->GetEntry() == GO_WINTERGRASP_TITAN_S_RELIC) { - // Check that the door is break - if (m_CanClickOnOrb) + if (CanInteractWithRelic()) EndBattle(false); - else // if door is not break, respawn relic. - m_relic->SetRespawnTime(RESPAWN_IMMEDIATELY); + else + GetRelic()->SetRespawnTime(RESPAWN_IMMEDIATELY); } // if destroy or damage event, search the wall/tower and update worldstate/send warning message @@ -1051,40 +958,36 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) } // Called when a tower is damaged, used for honor reward calcul -void BattlefieldWG::AddDamagedTower(TeamId team) +void BattlefieldWG::UpdateDamagedTowerCount(TeamId team) { if (team == GetAttackerTeam()) - { - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]++; - } + UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1); else - { - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]++; - } + UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 1); } // Update vehicle count WorldState to player void BattlefieldWG::UpdateVehicleCountWG() { - SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); - SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); } void BattlefieldWG::UpdateTenacity() { TeamId team = TEAM_NEUTRAL; - uint32 allianceNum = m_PlayersInWar[TEAM_ALLIANCE].size(); - uint32 hordeNum = m_PlayersInWar[TEAM_HORDE].size(); + uint32 alliancePlayers = m_PlayersInWar[TEAM_ALLIANCE].size(); + uint32 hordePlayers = m_PlayersInWar[TEAM_HORDE].size(); int32 newStack = 0; - if (allianceNum && hordeNum) + if (alliancePlayers && hordePlayers) { - if (allianceNum < hordeNum) - newStack = int32((float (hordeNum) / float (allianceNum) - 1) *4); // positive, should cast on alliance - else if (allianceNum > hordeNum) - newStack = int32((1 - float (allianceNum) / float (hordeNum)) *4); // negative, should cast on horde + if (alliancePlayers < hordePlayers) + newStack = int32((float(hordePlayers / alliancePlayers) - 1) * 4); // positive, should cast on alliance + else if (alliancePlayers > hordePlayers) + newStack = int32((1 - float(alliancePlayers / hordePlayers)) * 4); // negative, should cast on horde } if (newStack == int32(m_tenacityStack)) @@ -1121,13 +1024,17 @@ void BattlefieldWG::UpdateTenacity() newStack = 20; uint32 buff_honor = SPELL_GREATEST_HONOR; - buff_honor = (newStack < 15) ? (uint32) SPELL_GREATER_HONOR : buff_honor; - buff_honor = (newStack < 10) ? (uint32) SPELL_GREAT_HONOR : buff_honor; - buff_honor = (newStack < 5) ? 0 : buff_honor; + if (newStack < 15) + buff_honor = SPELL_GREATER_HONOR; + if (newStack < 10) + buff_honor = SPELL_GREAT_HONOR; + if (newStack < 5) + buff_honor = 0; for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->SetAuraStack(SPELL_TENACITY, player, newStack); + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) @@ -1137,27 +1044,27 @@ void BattlefieldWG::UpdateTenacity() { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) - player->AddAura(buff_honor, player); + player->CastSpell(player, buff_honor, true); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) - creature->AddAura(buff_honor, creature); + creature->CastSpell(creature, buff_honor, true); } } } -void BfCapturePointWG::ChangeTeam(TeamId /*oldTeam */ ) +WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl) : BfCapturePoint(battlefield) { - m_WorkShop->ChangeControl(m_team, false); + m_Bf = battlefield; + m_team = teamInControl; } -BfCapturePointWG::BfCapturePointWG(BattlefieldWG* bf, TeamId control) : BfCapturePoint(bf) +void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/) { - m_Bf = bf; - m_team = control; + m_Workshop->GiveControlTo(m_team, false); } -BfGraveYardWG::BfGraveYardWG(BattlefieldWG* bf) : BfGraveYard(bf) +BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield) { - m_Bf = bf; + m_Bf = battlefield; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index a7d1d185c8d..b2356e61d64 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -23,38 +23,30 @@ #include "WorldPacket.h" #include "World.h" #include "Group.h" +#include "GroupMgr.h" #include "Battlefield.h" const uint32 VehNumWorldState[2] = { 3680, 3490 }; const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; const uint32 ClockWorldState[2] = { 3781, 4354 }; const uint32 WintergraspFaction[3] = { 1, 116, 35 }; - const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; class BattlefieldWG; -class BfCapturePointWG; +class WintergraspCapturePoint; struct BfWGGameObjectBuilding; struct WGWorkshop; -typedef std::setGameObjectSet; -typedef std::set GameObjectBuilding; +typedef std::set GameObjectSet; +typedef std::set GameObjectBuilding; typedef std::set Workshop; -//typedef std::set CapturePointSet; unused ? -typedef std::set GroupSet; - -enum eWGItem -{ -// *INDENT-OFF* - WG_MARK_OF_HONOR = 43589, -// *INDENT-ON* -}; +typedef std::set GroupSet; +//typedef std::set CapturePointSet; unused ? -enum eWGSpell +enum WintergraspSpells { -// *INDENT-OFF* - // AWartime auras + // Wartime auras SPELL_RECRUIT = 37795, SPELL_CORPORAL = 33280, SPELL_LIEUTENANT = 55629, @@ -93,11 +85,9 @@ enum eWGSpell SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64 SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128 - -// *INDENT-ON* }; -enum eWGData32 +enum WintergraspData { BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, @@ -110,9 +100,8 @@ enum eWGData32 BATTLEFIELD_WG_DATA_MAX, }; -enum WB_ACHIEVEMENTS +enum WintergraspAchievements { -// *INDENT-OFF* ACHIEVEMENTS_WIN_WG = 1717, ACHIEVEMENTS_WIN_WG_100 = 1718, // todo ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo @@ -129,10 +118,9 @@ enum WB_ACHIEVEMENTS ACHIEVEMENTS_WG_RANGER = 2199, // todo ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo ACHIEVEMENTS_WG_MASTER_H = 2776, // todo -// *INDENT-ON* }; -enum eWGWorldStates +enum WintergraspWorldStates { BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490, BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491, @@ -141,9 +129,10 @@ enum eWGWorldStates BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801, BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, + BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE = 3710, }; -enum WGAreaIds +enum WintergraspAreaIds { AREA_WINTERGRASP_FORTRESS = 4575, AREA_THE_SUNKEN_RING = 4538, @@ -155,18 +144,18 @@ enum WGAreaIds }; /*######################### -*####### Graveyards ######* -#########################*/ + *####### Graveyards ###### + *#########################*/ -class BfGraveYardWG : public BfGraveYard +class BfGraveyardWG : public BfGraveyard { - public: - BfGraveYardWG(BattlefieldWG *Bf); + public: + BfGraveyardWG(BattlefieldWG *Bf); - void SetTextId(uint32 textid) { m_GossipTextId = textid; } - uint32 GetTextId() { return m_GossipTextId; } - protected: - uint32 m_GossipTextId; + void SetTextId(uint32 textid) { m_GossipTextId = textid; } + uint32 GetTextId() { return m_GossipTextId; } + protected: + uint32 m_GossipTextId; }; enum WGGraveyardId @@ -178,12 +167,11 @@ enum WGGraveyardId BATTLEFIELD_WG_GY_KEEP, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_GY_ALLIANCE, - BATTLEFIELD_WG_GY_MAX, + BATTLEFIELD_WG_GRAVEYARD_MAX, }; enum eWGGossipText { -// *INDENT-OFF* BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504, @@ -191,12 +179,10 @@ enum eWGGossipText BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500, BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506, -// *INDENT-ON* }; -enum eWGNpc +enum WintergraspNpcs { -// *INDENT-OFF* BATTLEFIELD_WG_NPC_GUARD_H = 30739, BATTLEFIELD_WG_NPC_GUARD_A = 30740, BATTLEFIELD_WG_NPC_STALKER = 15214, @@ -223,7 +209,13 @@ enum eWGNpc NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp -// *INDENT-ON* + NPC_TOWER_CANNON = 28366, + + NPC_WINTERGRASP_SIEGE_ENGINE_1 = 28312, + NPC_WINTERGRASP_SIEGE_ENGINE_2 = 32627, + NPC_WINTERGRASP_CATAPULT = 27881, + NPC_WINTERGRASP_DEMOLISHER = 28094, + NPC_WINTERGRASP_TOWER_CANNON = 28366, }; struct BfWGCoordGY @@ -243,7 +235,7 @@ const uint32 WGQuest[2][6] = { { 13185, 13183, 13223, 13539, 13178, 13180 }, }; // 7 in sql, 7 in header -const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = { +const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = { { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL }, { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL }, { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL }, @@ -253,136 +245,132 @@ const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = { { 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE }, }; -/*######################### -* BfCapturePointWG * -#########################*/ +/* ######################### * + * WintergraspCapturePoint * + * ######################### */ -class BfCapturePointWG : public BfCapturePoint +class WintergraspCapturePoint : public BfCapturePoint { public: - BfCapturePointWG(BattlefieldWG* bf, TeamId control); + WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl); - void LinkToWorkShop(WGWorkshop* ws) - { - m_WorkShop = ws; - } + void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; } void ChangeTeam(TeamId oldteam); - TeamId GetTeam() const - { - return m_team; - } + TeamId GetTeam() const { return m_team; } protected: - WGWorkshop *m_WorkShop; + WGWorkshop* m_Workshop; }; -/*######################### -* WinterGrasp Battlefield * -#########################*/ +/* ######################### * + * WinterGrasp Battlefield * + * ######################### */ class BattlefieldWG : public Battlefield { public: /** * \brief Called when the battle start - * -Spawn relic and turret - * -Rebuild tower and wall - * -Invite player to war + * - Spawn relic and turret + * - Rebuild tower and wall + * - Invite player to war */ void OnBattleStart(); /** * \brief Called when battle end - * -Remove relic and turret - * -Change banner/npc in keep if it needed - * -Saving battlestate - * -Reward honor/mark to player - * -Remove vehicle - * \param endbytimer : true if battle end when timer is at 00:00, false if battle end by clicking on relic + * - Remove relic and turret + * - Change banner/npc in keep if it needed + * - Saving battlestate + * - Reward honor/mark to player + * - Remove vehicle + * \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic */ - void OnBattleEnd(bool endbytimer); + void OnBattleEnd(bool endByTimer); /** - * \brief Called when grouping start (15 minutes before battlestart) - * -Invite all player in zone to join queue + * \brief Called when grouping starts (15 minutes before battlestart) + * - Invite all player in zone to join queue */ void OnStartGrouping(); /** * \brief Called when player accept invite to join battle - * -Update aura - * -Teleport if it needed - * -Update worldstate - * -Update tenacity - * \param player: Player who accept invite + * - Update aura + * - Teleport if it needed + * - Update worldstate + * - Update tenacity + * \param player: Player who accepted invite */ - void OnPlayerJoinWar(Player *player); + void OnPlayerJoinWar(Player* player); /** - * \brief Called when player leave battle - * -Update player aura - * \param player : Player who leave battle + * \brief Called when player left the battle + * - Update player aura + * \param player : Player who left the battle */ - void OnPlayerLeaveWar(Player *player); + void OnPlayerLeaveWar(Player* player); /** - * \brief Called when player leave WG zone - * \param player : Player who leave zone + * \brief Called when player left the WG zone + * \param player : Player who left the zone */ - void OnPlayerLeaveZone(Player *player); + void OnPlayerLeaveZone(Player* player); /** - * \brief Called when player enter in WG zone - * -Update aura - * -Update worldstate - * \param player : Player who leave zone + * \brief Called when player enters in WG zone + * - Update aura + * - Update worldstate + * \param player : Player who enters the zone */ - void OnPlayerEnterZone(Player *player); + void OnPlayerEnterZone(Player* player); /** * \brief Called for update battlefield data - * -Save battle timer in database every minutes - * -Update imunity aura from graveyard - * -Update water aura, if player is in water (HACK) - * \param diff : time ellapsed since the last call (in ms) + * - Save battle timer in database every minutes + * - Update imunity aura from graveyard + * \param diff : time elapsed since the last call (in ms) */ bool Update(uint32 diff); /** * \brief Called when a creature is created - * -Update vehicle count + * - Update vehicle count */ - void OnCreatureCreate(Creature *creature); + void OnCreatureCreate(Creature* creature); - /** + /** * \brief Called when a creature is removed - * -Update vehicle count + * - Update vehicle count */ void OnCreatureRemove(Creature* creature); + /** + * \brief Called when a gameobject is created + */ void OnGameObjectCreate(GameObject* go); /** * \brief Called when a wall/tower is broken - * -Update quest + * - Update quest */ void BrokenWallOrTower(TeamId team); /** * \brief Called when a tower is damaged - * -Update tower count (for reward calcul) + * - Update tower count (for reward calcul) */ - void AddDamagedTower(TeamId team); + void UpdateDamagedTowerCount(TeamId team); /** * \brief Called when tower is broken - * -Update tower buff - * -check if three south tower is down for remove 10 minutes to wg + * - Update tower buff + * - check if three south tower is down for remove 10 minutes to wg */ - void AddBrokenTower(TeamId team); + void UpdatedDestroyedTowerCount(TeamId team); - void DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 incrementNumber = 1); + void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1); void RemoveAurasFromPlayer(Player* player); @@ -392,40 +380,26 @@ class BattlefieldWG : public Battlefield bool SetupBattlefield(); /// Return pointer to relic object - GameObject* GetRelic() - { - return m_relic; - } + GameObject* GetRelic() { return m_titansRelic; } /// Define relic object - void SetRelic(GameObject* relic) - { - m_relic = relic; - } + void SetRelic(GameObject* relic) { m_titansRelic = relic; } - /// Say if player can click or not on orb (last door broken) - bool CanClickOnOrb() - { - return m_CanClickOnOrb; - } + /// Check if players can interact with the relic (Only if the last door has been broken) + bool CanInteractWithRelic() { return m_isRelicInteractible; } - /// Define if player can click or not on orb (if last door broken) - void AllowToClickOnOrb(bool allow) - { - m_CanClickOnOrb = allow; - } - - void RewardMarkOfHonor(Player *player, uint32 count); + /// Define if player can interact with the relic + void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; } void UpdateVehicleCountWG(); void UpdateCounterVehicle(bool init); WorldPacket BuildInitWorldStates(); - void SendInitWorldStatesTo(Player * player); + void SendInitWorldStatesTo(Player* player); void SendInitWorldStatesToAll(); - void HandleKill(Player *killer, Unit *victim); - void PromotePlayer(Player *killer); + void HandleKill(Player* killer, Unit* victim); + void PromotePlayer(Player* killer); void UpdateTenacity(); void ProcessEvent(WorldObject *obj, uint32 eventId); @@ -435,23 +409,35 @@ class BattlefieldWG : public Battlefield uint32 GetData(uint32 data); protected: - bool m_CanClickOnOrb; - GameObject* m_relic; - GameObjectBuilding BuildingsInZone; - GuidSet KeepCreature[2]; - GuidSet OutsideCreature[2]; + bool m_isRelicInteractible; + Workshop WorkshopsList; - GuidSet CanonList; + GameObjectSet DefenderPortalList; GameObjectSet m_KeepGameObject[2]; + GameObjectBuilding BuildingsInZone; + GuidSet m_vehicles[2]; + GuidSet CanonList; + GuidSet KeepCreature[2]; + GuidSet OutsideCreature[2]; + uint32 m_tenacityStack; uint32 m_saveTimer; + + GameObject* m_titansRelic; }; -#define NORTHREND_WINTERGRASP 4197 +const uint32 NORTHREND_WINTERGRASP = 4197; +const uint8 WG_MAX_OBJ = 32; +const uint8 WG_KEEPGAMEOBJECT_MAX = 44; +const uint8 WG_MAX_TURRET = 15; +const uint8 WG_MAX_KEEP_NPC = 39; +const uint8 WG_MAX_OUTSIDE_NPC = 14; +const uint8 WG_OUTSIDE_ALLIANCE_NPC = 7; +const uint8 WG_MAX_TELEPORTER = 12; -enum eWGGameObjectBuildingType +enum WintergraspGameObjectBuildingType { BATTLEFIELD_WG_OBJECTTYPE_DOOR, BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC, @@ -461,7 +447,7 @@ enum eWGGameObjectBuildingType BATTLEFIELD_WG_OBJECTTYPE_TOWER, }; -enum eWGGameObjectState +enum WintergraspGameObjectState { BATTLEFIELD_WG_OBJECTSTATE_NONE, BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT, @@ -475,7 +461,7 @@ enum eWGGameObjectState BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY, }; -enum WGWorkshopId +enum WintergraspWorkshopIds { BATTLEFIELD_WG_WORKSHOP_NE, BATTLEFIELD_WG_WORKSHOP_NW, @@ -485,7 +471,7 @@ enum WGWorkshopId BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, }; -enum WGWorldstate +enum WintergraspWorldstates { WORLDSTATE_WORKSHOP_NE = 3701, WORLDSTATE_WORKSHOP_NW = 3700, @@ -494,6 +480,7 @@ enum WGWorldstate WORLDSTATE_WORKSHOP_K_W = 3698, WORLDSTATE_WORKSHOP_K_E = 3699 }; + enum eWGTeamControl { BATTLEFIELD_WG_TEAM_ALLIANCE, @@ -504,7 +491,6 @@ enum eWGTeamControl // TODO: Handle this with creature_text ? enum eWGText { -// *INDENT-OFF* BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053, @@ -528,34 +514,42 @@ enum eWGText BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071, BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068, BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072, -// *INDENT-ON* }; -enum WGObject +enum WintergraspGameObject { -// *INDENT-OFF* - BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE = 190475, - BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW = 190487, - BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE = 194959, - BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW = 194962, - BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC = 192829, -// *INDENT-ON* + GO_WINTERGRASP_FACTORY_BANNER_NE = 190475, + GO_WINTERGRASP_FACTORY_BANNER_NW = 190487, + GO_WINTERGRASP_FACTORY_BANNER_SE = 194959, + GO_WINTERGRASP_FACTORY_BANNER_SW = 194962, + + GO_WINTERGRASP_TITAN_S_RELIC = 192829, + + GO_WINTERGRASP_FORTRESS_TOWER_1 = 190221, + GO_WINTERGRASP_FORTRESS_TOWER_2 = 190373, + GO_WINTERGRASP_FORTRESS_TOWER_3 = 190377, + GO_WINTERGRASP_FORTRESS_TOWER_4 = 190378, + + GO_WINTERGRASP_SHADOWSIGHT_TOWER = 190356, + GO_WINTERGRASP_WINTER_S_EDGE_TOWER = 190357, + GO_WINTERGRASP_FLAMEWATCH_TOWER = 190358, }; -struct BfWGObjectPosition + +struct WintergraspObjectPositionData { float x; float y; float z; float o; - uint32 entryh; - uint32 entrya; + uint32 entryHorde; + uint32 entryAlliance; }; -// ********************************************************* -// ************Destructible (Wall,Tower..)****************** -// ********************************************************* +// ***************************************************** +// ************ Destructible (Wall,Tower..) ************ +// ***************************************************** -struct BfWGBuildingSpawnData +struct WintergraspBuildingSpawnData { uint32 entry; uint32 WorldState; @@ -564,13 +558,12 @@ struct BfWGBuildingSpawnData float z; float o; uint32 type; - uint32 nameid; + uint32 nameId; }; -#define WG_MAX_OBJ 32 -const BfWGBuildingSpawnData WGGameObjectBuillding[WG_MAX_OBJ] = { +const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = { // Wall (Not spawned in db) - // Entry WS X Y Z O type NameID + // Entry WS X Y Z O type NameID { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, { 190220, 3750, 5331.26f, 3047.1f, 407.923f, 0.052359f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, { 191795, 3764, 5385.84f, 2909.49f, 409.713f, 0.00872f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, @@ -660,8 +653,7 @@ const BfWGBuildingSpawnData WGGameObjectBuillding[WG_MAX_OBJ] = { // 192357 : 1 in sql, 1 in header // 192350 : 1 in sql, 1 in header // 192351 : 1 in sql, 1 in header -#define WG_KEEPGAMEOBJECT_MAX 44 -const BfWGObjectPosition WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { +const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect @@ -708,42 +700,31 @@ const BfWGObjectPosition WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect }; -// Keep turret -struct BfWGTurretPos -{ - float x; - float y; - float z; - float o; -}; - -#define WG_MAX_TURRET 15 -const BfWGTurretPos WGTurret[WG_MAX_TURRET] = { - { 5391.19f, 3060.8f, 419.616f, 1.69557f }, - { 5266.75f, 2976.5f, 421.067f, 3.20354f }, - { 5234.86f, 2948.8f, 420.88f, 1.61311f }, - { 5323.05f, 2923.7f, 421.645f, 1.5817f }, +const Position WGTurret[WG_MAX_TURRET] = { + { 5391.19f, 3060.8f, 419.616f, 1.69557f }, + { 5266.75f, 2976.5f, 421.067f, 3.20354f }, + { 5234.86f, 2948.8f, 420.88f, 1.61311f }, + { 5323.05f, 2923.7f, 421.645f, 1.5817f }, { 5363.82f, 2923.87f, 421.709f, 1.60527f }, { 5264.04f, 2861.34f, 421.587f, 3.21142f }, { 5264.68f, 2819.78f, 421.656f, 3.15645f }, { 5322.16f, 2756.69f, 421.646f, 4.69978f }, { 5363.78f, 2756.77f, 421.629f, 4.78226f }, - { 5236.2f, 2732.68f, 421.649f, 4.72336f }, - { 5265.02f, 2704.63f, 421.7f, 3.12507f }, + { 5236.2f, 2732.68f, 421.649f, 4.72336f }, + { 5265.02f, 2704.63f, 421.7f, 3.12507f }, { 5350.87f, 2616.03f, 421.243f, 4.72729f }, - { 5390.95f, 2615.5f, 421.126f, 4.6409f }, - { 5148.8f, 2820.24f, 421.621f, 3.16043f }, - { 5147.98f, 2861.93f, 421.63f, 3.18792f }, + { 5390.95f, 2615.5f, 421.126f, 4.6409f }, + { 5148.8f, 2820.24f, 421.621f, 3.16043f }, + { 5147.98f, 2861.93f, 421.63f, 3.18792f }, }; - // Here there is all npc keeper spawn point -#define WG_MAX_KEEP_NPC 39 -const BfWGObjectPosition WGKeepNPC[WG_MAX_KEEP_NPC] = { +const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] = +{ // X Y Z O horde alliance // North East { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard - { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Plumembrase + { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Blazefeather { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard // North @@ -789,9 +770,7 @@ const BfWGObjectPosition WGKeepNPC[WG_MAX_KEEP_NPC] = { { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard }; -#define WG_MAX_OUTSIDE_NPC 14 -#define WG_OUTSIDE_ALLIANCE_NPC 7 -const BfWGObjectPosition WGOutsideNPC[WG_MAX_OUTSIDE_NPC] = +const WintergraspObjectPositionData WGOutsideNPC[WG_MAX_OUTSIDE_NPC] = { { 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 }, { 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 }, @@ -809,17 +788,16 @@ const BfWGObjectPosition WGOutsideNPC[WG_MAX_OUTSIDE_NPC] = { 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, }; -struct BfWGWGTeleporterData +struct WintergraspTeleporterData { - uint32 entry; // gameobject entry + uint32 entry; float x; float y; float z; float o; }; -#define WG_MAX_TELEPORTER 12 -const BfWGWGTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] = +const WintergraspTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] = { // Player teleporter { 190763, 5153.41f, 2901.35f, 409.191f, -0.069f }, @@ -841,23 +819,23 @@ const BfWGWGTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] = // **********Tower Element(GameObject,Creature)************* // ********************************************************* -struct BfWGTowerData +struct WintergraspTowerData { - uint32 towerentry; // Gameobject id of tower + uint32 towerEntry; // Gameobject id of tower uint8 nbObject; // Number of gameobjects spawned on this point - BfWGObjectPosition GameObject[6]; // Gameobject position and entry (Horde/Alliance) + WintergraspObjectPositionData GameObject[6]; // Gameobject position and entry (Horde/Alliance) // Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage? uint8 nbCreatureBottom; - BfWGObjectPosition CreatureBottom[9]; + WintergraspObjectPositionData CreatureBottom[9]; uint8 nbCreatureTop; - BfWGObjectPosition CreatureTop[5]; + WintergraspObjectPositionData CreatureTop[5]; }; -#define WG_MAX_ATTACKTOWERS 3 +uint8 const WG_MAX_ATTACKTOWERS = 3; // 192414 : 0 in sql, 1 in header // 192278 : 0 in sql, 3 in header -const BfWGTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { +const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { // West tower { 190356, @@ -961,18 +939,18 @@ const BfWGTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { }, }; -struct BfWGTurretData +struct WintergraspTowerCannonData { - uint32 towerentry; - uint8 nbTurretBottom; - BfWGTurretPos TurretBottom[5]; + uint32 towerEntry; + uint8 nbTowerCannonBottom; + Position TowerCannonBottom[5]; uint8 nbTurretTop; - BfWGTurretPos TurretTop[5]; + Position TurretTop[5]; }; -#define WG_MAX_TOWERTURRET 7 +const uint8 WG_MAX_TOWER_CANNON = 7; -const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] = +const WintergraspTowerCannonData TowerCannon[WG_MAX_TOWER_CANNON] = { { 190221, @@ -1113,7 +1091,7 @@ const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] = // *****************WorkShop Data & Element***************** // ********************************************************* -#define WG_MAX_WORKSHOP 6 +uint8 const WG_MAX_WORKSHOP = 6; struct WGWorkshopData { @@ -1162,7 +1140,7 @@ struct BfWGGameObjectBuilding BattlefieldWG *m_WG; // Linked gameobject - GameObject *m_Build; + GameObject* m_Build; // eWGGameObjectBuildingType uint32 m_Type; @@ -1182,7 +1160,7 @@ struct BfWGGameObjectBuilding // Creature associations GuidSet m_CreatureBottomList[2]; GuidSet m_CreatureTopList[2]; - GuidSet m_TurretBottomList; + GuidSet m_TowerCannonBottomList; GuidSet m_TurretTopList; void Rebuild() @@ -1235,9 +1213,9 @@ struct BfWGGameObjectBuilding m_WG->HideNpc(creature); if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER) - m_WG->AddDamagedTower(m_WG->GetDefenderTeam()); + m_WG->UpdateDamagedTowerCount(m_WG->GetDefenderTeam()); else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER) - m_WG->AddDamagedTower(m_WG->GetAttackerTeam()); + m_WG->UpdateDamagedTowerCount(m_WG->GetAttackerTeam()); } // Called when associated gameobject is destroyed @@ -1256,14 +1234,14 @@ struct BfWGGameObjectBuilding // Inform the global wintergrasp script of the destruction of this object case BATTLEFIELD_WG_OBJECTTYPE_TOWER: case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: - m_WG->AddBrokenTower(TeamId(m_Team)); + m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team)); break; case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: - m_WG->AllowToClickOnOrb(true); + m_WG->SetRelicInteractible(true); if (m_WG->GetRelic()) m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); else - sLog->outError("BATTLEFIELD: WG: Relic cant be clickable"); + sLog->outError("BattlefieldWG: Relic not found."); break; } @@ -1323,58 +1301,58 @@ struct BfWGGameObjectBuilding int32 towerid = -1; switch (go->GetEntry()) { - case 190221: + case GO_WINTERGRASP_FORTRESS_TOWER_1: towerid = 0; break; - case 190373: + case GO_WINTERGRASP_FORTRESS_TOWER_2: towerid = 1; break; - case 190377: + case GO_WINTERGRASP_FORTRESS_TOWER_3: towerid = 2; break; - case 190378: + case GO_WINTERGRASP_FORTRESS_TOWER_4: towerid = 3; break; - case 190356: + case GO_WINTERGRASP_SHADOWSIGHT_TOWER: towerid = 4; break; - case 190357: + case GO_WINTERGRASP_WINTER_S_EDGE_TOWER: towerid = 5; break; - case 190358: + case GO_WINTERGRASP_FLAMEWATCH_TOWER: towerid = 6; break; } - if (towerid > 3) + if (towerid > 3) // Attacker towers { // Spawn associate gameobjects for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++) { - BfWGObjectPosition gob = AttackTowers[towerid - 4].GameObject[i]; - if (GameObject *go = m_WG->SpawnGameObject(gob.entryh, gob.x, gob.y, gob.z, gob.o)) + WintergraspObjectPositionData gobData = AttackTowers[towerid - 4].GameObject[i]; + if (GameObject* go = m_WG->SpawnGameObject(gobData.entryHorde, gobData.x, gobData.y, gobData.z, gobData.o)) m_GameObjectList[TEAM_HORDE].insert(go); - if (GameObject *go = m_WG->SpawnGameObject(gob.entrya, gob.x, gob.y, gob.z, gob.o)) + if (GameObject* go = m_WG->SpawnGameObject(gobData.entryAlliance, gobData.x, gobData.y, gobData.z, gobData.o)) m_GameObjectList[TEAM_ALLIANCE].insert(go); } // Spawn associate npc bottom for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++) { - BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureBottom[i]; - if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE)) + WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureBottom[i]; + if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE)) m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID()); - if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE)) + if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE)) m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID()); } // Spawn associate npc top for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++) { - BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureTop[i]; - if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE)) + WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureTop[i]; + if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE)) m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID()); - if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE)) + if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE)) m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID()); } } @@ -1382,58 +1360,52 @@ struct BfWGGameObjectBuilding if (towerid >= 0) { // Spawn Turret bottom - for (uint8 i = 0; i < TowerTurret[towerid].nbTurretBottom; i++) + for (uint8 i = 0; i < TowerCannon[towerid].nbTowerCannonBottom; i++) { - BfWGTurretPos turretpos = TowerTurret[towerid].TurretBottom[i]; - if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0))) + Position turretPos; + TowerCannon[towerid].TowerCannonBottom[i].GetPosition(&turretPos); + if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, turretPos, TEAM_ALLIANCE)) { - m_TurretBottomList.insert(turret->GetGUID()); + m_TowerCannonBottomList.insert(turret->GetGUID()); switch (go->GetEntry()) { - case 190221: - case 190373: - case 190377: - case 190378: - { - turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } + case GO_WINTERGRASP_FORTRESS_TOWER_1: + case GO_WINTERGRASP_FORTRESS_TOWER_2: + case GO_WINTERGRASP_FORTRESS_TOWER_3: + case GO_WINTERGRASP_FORTRESS_TOWER_4: + turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + case GO_WINTERGRASP_SHADOWSIGHT_TOWER: + case GO_WINTERGRASP_WINTER_S_EDGE_TOWER: + case GO_WINTERGRASP_FLAMEWATCH_TOWER: + turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; } m_WG->HideNpc(turret); } } // Spawn Turret top - for (uint8 i = 0; i < TowerTurret[towerid].nbTurretTop; i++) + for (uint8 i = 0; i < TowerCannon[towerid].nbTurretTop; i++) { - BfWGTurretPos turretpos = TowerTurret[towerid].TurretTop[i]; - if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0))) + Position towerCannonPos; + TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos); + if (Creature *turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0))) { m_TurretTopList.insert(turret->GetGUID()); switch (go->GetEntry()) { - case 190221: - case 190373: - case 190377: - case 190378: - { - turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } + case GO_WINTERGRASP_FORTRESS_TOWER_1: + case GO_WINTERGRASP_FORTRESS_TOWER_2: + case GO_WINTERGRASP_FORTRESS_TOWER_3: + case GO_WINTERGRASP_FORTRESS_TOWER_4: + turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + case GO_WINTERGRASP_SHADOWSIGHT_TOWER: + case GO_WINTERGRASP_WINTER_S_EDGE_TOWER: + case GO_WINTERGRASP_FLAMEWATCH_TOWER: + turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; } m_WG->HideNpc(turret); } @@ -1473,7 +1445,7 @@ struct BfWGGameObjectBuilding void UpdateTurretAttack(bool disable) { - for (GuidSet::const_iterator itr = m_TurretBottomList.begin(); itr != m_TurretBottomList.end(); ++itr) + for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr) { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { @@ -1607,14 +1579,13 @@ struct WGWorkshop WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId) { - ASSERT(_bf); - ASSERT(_workshopId < WG_MAX_WORKSHOP); + ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP); bf = _bf; workshopId = _workshopId; } - void ChangeControl(uint8 team, bool init /* for first call in setup */ ) + void GiveControlTo(uint8 team, bool init /* for first call in setup*/) { switch (team) { @@ -1638,8 +1609,8 @@ struct WGWorkshop // Found associate graveyard and update it if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - if (bf->GetGraveYardById(workshopId)) - bf->GetGraveYardById(workshopId)->ChangeControl(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE); + if (bf->GetGraveyardById(workshopId)) + bf->GetGraveyardById(workshopId)->GiveControlTo(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE); teamControl = team; break; @@ -1650,12 +1621,12 @@ struct WGWorkshop bf->UpdateCounterVehicle(false); } - void UpdateGraveYardAndWorkshop() + void UpdateGraveyardAndWorkshop() { if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - bf->GetGraveYardById(workshopId)->ChangeControl(TeamId(teamControl)); + bf->GetGraveyardById(workshopId)->GiveControlTo(TeamId(teamControl)); else - ChangeControl(bf->GetDefenderTeam(), true); + GiveControlTo(bf->GetDefenderTeam(), true); } void Save() @@ -1665,9 +1636,9 @@ struct WGWorkshop }; // Structure for the 6 workshop -struct BfWGWorkShopData +struct WintergraspWorkshopData { - BattlefieldWG* m_WG; // Object du joug + BattlefieldWG* m_WG; // Pointer to wintergrasp GameObject* m_Build; uint32 m_Type; uint32 m_State; // For worldstate @@ -1677,7 +1648,7 @@ struct BfWGWorkShopData GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message - BfWGWorkShopData(BattlefieldWG * WG) + WintergraspWorkshopData(BattlefieldWG * WG) { m_WG = WG; m_Build = NULL; @@ -1689,22 +1660,21 @@ struct BfWGWorkShopData } // Spawning associate creature and store them - void AddCreature(BfWGObjectPosition obj) + void AddCreature(WintergraspObjectPositionData obj) { - if (Creature *creature = m_WG->SpawnCreature(obj.entryh, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE)) + if (Creature* creature = m_WG->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE)) m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID()); - if (Creature *creature = m_WG->SpawnCreature(obj.entrya, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE)) + if (Creature* creature = m_WG->SpawnCreature(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE)) m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID()); - } // Spawning Associate gameobject and store them - void AddGameObject(BfWGObjectPosition obj) + void AddGameObject(WintergraspObjectPositionData obj) { - if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryh, obj.x, obj.y, obj.z, obj.o)) + if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o)) m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject); - if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entrya, obj.x, obj.y, obj.z, obj.o)) + if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o)) m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject); } @@ -1717,105 +1687,105 @@ struct BfWGWorkShopData } // Called on change faction in CapturePoint class - void ChangeControl(uint8 team, bool init /* for first call in setup */ ) + void GiveControlTo(uint8 team, bool init /* for first call in setup*/) { switch (team) { case BATTLEFIELD_WG_TEAM_NEUTRAL: - { - // Send warning message to all player for inform a faction attack a workshop - // alliance / horde attacking workshop - m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1); - break; - } + { + // Send warning message to all player for inform a faction attack a workshop + // alliance / horde attacking workshop + m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1); + break; + } case BATTLEFIELD_WG_TEAM_ALLIANCE: - { - // Show Alliance creature - for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - m_WG->ShowNpc(creature, creature->GetEntry() != 30499); - - // Hide Horde creature - for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - m_WG->HideNpc(creature); + { + // Show Alliance creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) + m_WG->ShowNpc(creature, creature->GetEntry() != 30499); + + // Hide Horde creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) + m_WG->HideNpc(creature); - // Show Alliance gameobject - for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + // Show Alliance gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); - // Hide Horde gameobject - for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + // Hide Horde gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); - // Updating worldstate - m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT; - m_WG->SendUpdateWorldState(m_WorldState, m_State); + // Updating worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT; + m_WG->SendUpdateWorldState(m_WorldState, m_State); - // Warning message - if (!init) // workshop taken - alliance - m_WG->SendWarningToAllInZone(m_NameId); + // Warning message + if (!init) // workshop taken - alliance + m_WG->SendWarningToAllInZone(m_NameId); - // Found associate graveyard and update it - if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - if (m_WG && m_WG->GetGraveYardById(m_Type)) - m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_ALLIANCE); + // Found associate graveyard and update it + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (m_WG && m_WG->GetGraveyardById(m_Type)) + m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_ALLIANCE); - m_TeamControl = team; - break; - } + m_TeamControl = team; + break; + } case BATTLEFIELD_WG_TEAM_HORDE: - { - // Show Horde creature - for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - m_WG->ShowNpc(creature, creature->GetEntry() != 30400); - - // Hide Alliance creature - for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - m_WG->HideNpc(creature); + { + // Show Horde creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) + m_WG->ShowNpc(creature, creature->GetEntry() != 30400); + + // Hide Alliance creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) + m_WG->HideNpc(creature); - // Hide Alliance gameobject - for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + // Hide Alliance gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); - // Show Horde gameobject - for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + // Show Horde gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); - // Update worlstate - m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT; - m_WG->SendUpdateWorldState(m_WorldState, m_State); + // Update worlstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT; + m_WG->SendUpdateWorldState(m_WorldState, m_State); - // Warning message - if (!init) // workshop taken - horde - m_WG->SendWarningToAllInZone(m_NameId + 1); + // Warning message + if (!init) // workshop taken - horde + m_WG->SendWarningToAllInZone(m_NameId + 1); - // Update graveyard control - if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - if (m_WG && m_WG->GetGraveYardById(m_Type)) - m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_HORDE); + // Update graveyard control + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (m_WG && m_WG->GetGraveyardById(m_Type)) + m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_HORDE); - m_TeamControl = team; - break; - } + m_TeamControl = team; + break; + } } if (!init) m_WG->UpdateCounterVehicle(false); } - void UpdateGraveYardAndWorkshop() + void UpdateGraveyardAndWorkshop() { if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - m_WG->GetGraveYardById(m_Type)->ChangeControl(TeamId(m_TeamControl)); + m_WG->GetGraveyardById(m_Type)->GiveControlTo(TeamId(m_TeamControl)); else - ChangeControl(m_WG->GetDefenderTeam(), true); + GiveControlTo(m_WG->GetDefenderTeam(), true); } void Save() diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 044bf7fb32e..da0d37cf27a 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -821,11 +821,6 @@ class ObjectMgr return &_creatureQuestRelations; } - QuestRelations* GetCreatureQuestInvolvedRelation() - { - return &_creatureQuestInvolvedRelations; - } - QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry) { return _creatureQuestRelations.equal_range(creature_entry); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 8bddd63170d..98a8f3e5641 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -800,7 +800,7 @@ class WorldSession // Battlefield void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time); void SendBfInvitePlayerToQueue(uint32 BattleId); - void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false); + void SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false); void SendBfEntered(uint32 BattleId); void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED); void HandleBfQueueInviteResponse(WorldPacket &recv_data); diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index 4eee7c391b0..7284e6ad6b7 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -108,15 +108,15 @@ public: if (!bf) return false; - if (bf->GetEnable()) + if (bf->IsEnabled()) { - bf->SetEnable(false); + bf->ToggleBattlefield(false); if (battleid == 1) handler->SendGlobalGMSysMessage("Wintergrasp is disabled"); } else { - bf->SetEnable(true); + bf->ToggleBattlefield(true); if (battleid == 1) handler->SendGlobalGMSysMessage("Wintergrasp is enabled"); } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index c7c6cc3725e..787531b496f 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -38,372 +38,414 @@ enum eWGqueuenpctext WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507, }; -enum WGscriptdata +enum Spells { - // engineer spells - SPELL_BUILD_CATAPULT = 56663, - SPELL_BUILD_DEMOLISHER = 56575, - SPELL_BUILD_SIEGE_ENGINE = 61408, - SPELL_BUILD_SIEGE_ENGINE2 = 56661, // does it's really needed here? - SPELL_ACTIVATE_ROBOTIC_ARMS = 49899, - - // teleporter spells - SPELL_VEHICLE_TELEPORT = 49759, - - // npcs - NPC_ROBOTIC_ARMS = 27852, - NPC_WORLD_TRIGGER_WG = 23472, + // Demolisher engineers spells + SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 = 61409, // + SPELL_BUILD_SIEGE_VEHICLE_FORCE_2 = 56662, // Which faction uses which ? + SPELL_BUILD_CATAPULT_FORCE = 56664, + SPELL_BUILD_DEMOLISHER_FORCE = 56659, + SPELL_ACTIVATE_CONTROL_ARMS = 49899, + + SPELL_VEHICLE_TELEPORT = 49759, + + // Spirit guide + SPELL_CHANNEL_SPIRIT_HEAL = 22011, }; -class npc_wg_demolisher_engineer : public CreatureScript +enum CreatureIds { - public: - npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") - { - } + NPC_GOBLIN_MECHANIC = 30400, + NPC_GNOMISH_ENGINEER = 30499, - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + NPC_WINTERGRASP_CONTROL_ARMS = 27852, - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23742, +}; - if (!BfWG) - return true; +enum QuestIds +{ + QUEST_BONES_AND_ARROWS_HORDE_ATT = 13193, + QUEST_JINXING_THE_WALLS_HORDE_ATT = 13202, + QUEST_SLAY_THEM_ALL_HORDE_ATT = 13180, + QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT = 13200, + QUEST_HEALING_WITH_ROSES_HORDE_ATT = 13201, + QUEST_DEFEND_THE_SIEGE_HORDE_ATT = 13223, + + QUEST_BONES_AND_ARROWS_HORDE_DEF = 13199, + QUEST_WARDING_THE_WALLS_HORDE_DEF = 13192, + QUEST_SLAY_THEM_ALL_HORDE_DEF = 13178, + QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF = 13191, + QUEST_HEALING_WITH_ROSES_HORDE_DEF = 13194, + QUEST_TOPPLING_THE_TOWERS_HORDE_DEF = 13539, + QUEST_STOP_THE_SIEGE_HORDE_DEF = 13185, + + QUEST_BONES_AND_ARROWS_ALLIANCE_ATT = 13196, + QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT = 13198, + QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT = 13179, + QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT = 13222, + QUEST_A_RARE_HERB_ALLIANCE_ATT = 13195, + + QUEST_BONES_AND_ARROWS_ALLIANCE_DEF = 13154, + QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF = 13153, + QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF = 13177, + QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF = 13538, + QUEST_STOP_THE_SIEGE_ALLIANCE_DEF = 13186, + QUEST_A_RARE_HERB_ALLIANCE_DEF = 13156, +}; + +uint8 const MAX_WINTERGRASP_VEHICLES = 4; + +uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = { + NPC_WINTERGRASP_CATAPULT, + NPC_WINTERGRASP_DEMOLISHER, + NPC_WINTERGRASP_SIEGE_ENGINE_1, + NPC_WINTERGRASP_SIEGE_ENGINE_2 +}; + +class npc_wg_demolisher_engineer : public CreatureScript +{ + public: + npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") { } - if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > - BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + bool OnGossipHello(Player* player, Creature* creature) { - if (player->HasAura(SPELL_CORPORAL)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - else if (player->HasAura(SPELL_LIEUTENANT)) + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(1); + + if (canBuild(creature)) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + if (player->HasAura(SPELL_CORPORAL)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + else if (player->HasAura(SPELL_LIEUTENANT)) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + } } - } - else - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + else + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action) - { - player->CLOSE_GOSSIP_MENU(); + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action) + { + player->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* wintergrasp= sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (!BfWG) + if (canBuild(creature)) + { + switch (action - GOSSIP_ACTION_INFO_DEF) + { + case 0: + creature->CastSpell(player, SPELL_BUILD_CATAPULT_FORCE, true); + break; + case 1: + creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true); + break; + case 2: + creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 : SPELL_BUILD_SIEGE_VEHICLE_FORCE_2, true); + break; + } + if (Creature* controlArms = creature->FindNearestCreature(NPC_WINTERGRASP_CONTROL_ARMS, 30.0f, true)) + creature->CastSpell(controlArms, SPELL_ACTIVATE_CONTROL_ARMS, true); + } return true; + } - if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > - BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + private: + bool canBuild(Creature* creature) { - switch (action - GOSSIP_ACTION_INFO_DEF) + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + + if (!wintergrasp) + return false; + switch (creature->GetEntry()) { - case 0: - player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, creature->GetGUID()); - break; - case 1: - player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, creature->GetGUID()); - break; - case 2: - player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, creature->GetGUID()); - break; + case NPC_GOBLIN_MECHANIC: + return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + case NPC_GNOMISH_ENGINEER: + return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + default: + return false; } - //spell 49899 Emote : 406 from sniff - //INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0'); - if (Creature* mechCreature = creature->FindNearestCreature(NPC_ROBOTIC_ARMS, 30.0f, true)) - creature->CastSpell(mechCreature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); } - return true; - } }; class npc_wg_spirit_guide : public CreatureScript { - public: - npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") - { - } + public: + npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + bool OnGossipHello(Player* player, Creature* creature) + { + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return true; - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + GraveyardVect graveyard = wintergrasp->GetGraveyardVector(); + for (uint8 i = 0; i < graveyard.size(); i++) + if (graveyard[i]->GetControlTeamId() == player->GetTeamId()) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i); + + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action) { - GraveYardVect gy = BfWG->GetGraveYardVect(); - for (uint8 i = 0; i < gy.size(); i++) + player->CLOSE_GOSSIP_MENU(); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (wintergrasp) { - if (gy[i]->GetControlTeamId() == player->GetTeamId()) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN, - GOSSIP_ACTION_INFO_DEF + i); - } + GraveyardVect gy = wintergrasp->GetGraveyardVector(); + for (uint8 i = 0; i < gy.size(); i++) + if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) + if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveyardId())) + player->TeleportTo(safeLoc->map_id, safeLoc->x, safeLoc->y, safeLoc->z, 0); } + return true; } - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } - - bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action) - { - player->CLOSE_GOSSIP_MENU(); - - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + struct npc_wg_spirit_guideAI : public ScriptedAI { - GraveYardVect gy = BfWG->GetGraveYardVect(); - for (uint8 i = 0; i < gy.size(); i++) + npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) + { } + + void UpdateAI(const uint32 /* diff */) { - if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) - { - WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId()); - player->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); - } + if (!me->HasUnitState(UNIT_STATE_CASTING)) + DoCast(me, SPELL_CHANNEL_SPIRIT_HEAL); } + }; + + CreatureAI *GetAI(Creature* creature) const + { + return new npc_wg_spirit_guideAI(creature); } - return true; - } }; class npc_wg_queue : public CreatureScript { - public: - npc_wg_queue() : CreatureScript("npc_wg_queue") - { - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + public: + npc_wg_queue() : CreatureScript("npc_wg_queue") { } - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + bool OnGossipHello(Player* player, Creature* creature) { + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return true; - if (BfWG->IsWarTime()) + if (wintergrasp->IsWarTime()) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); + player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); } else { - uint32 uiTime = BfWG->GetTimer() / 1000; - player->SendUpdateWorldState(4354, time(NULL) + uiTime); - if (uiTime < 15 * MINUTE) + uint32 timer = wintergrasp->GetTimer() / 1000; + player->SendUpdateWorldState(4354, time(NULL) + timer); + if (timer < 15 * MINUTE) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID()); + player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID()); } else - { - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID()); - } + player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID()); } + return true; } - return true; - } - - bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action */ ) - { - player->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action*/) { - if (BfWG->IsWarTime()) - { - BfWG->InvitePlayerToWar(player); - } + player->CLOSE_GOSSIP_MENU(); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return true; + + if (wintergrasp->IsWarTime()) + wintergrasp->InvitePlayerToWar(player); else { - uint32 uiTime = BfWG->GetTimer() / 1000; - if (uiTime < 15 * MINUTE) - BfWG->InvitePlayerToQueue(player); + uint32 timer = wintergrasp->GetTimer() / 1000; + if (timer < 15 * MINUTE) + wintergrasp->InvitePlayerToQueue(player); } + return true; } - return true; - } }; -const uint32 Vehicules[4] = { 32627, 28312, 28094, 27881 }; - class go_wg_vehicle_teleporter : public GameObjectScript { - public: - go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") - { - } + public: + go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") { } - struct go_wg_vehicle_teleporterAI : public GameObjectAI - { - go_wg_vehicle_teleporterAI(GameObject* g) : GameObjectAI(g) + struct go_wg_vehicle_teleporterAI : public GameObjectAI { - uiCheckTimer = 1000; - } + go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject), + _checkTimer(1000) + { } - void UpdateAI(const uint32 diff) - { - if (uiCheckTimer <= diff) + void UpdateAI(const uint32 diff) { - for (uint8 i = 0; i < 4; i++) - if (Creature* vehicleCreature = go->FindNearestCreature(Vehicules[i], 3.0f, true)) - if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT)) - if (Vehicle* vehicle = vehicleCreature->GetVehicle()) - if (Unit* passenger = vehicle->GetPassenger(0)) - { - uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION); - uint32 plfaction = passenger->getFaction(); - if (gofaction == plfaction) - { - if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) - teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); - } - } - - uiCheckTimer = 1000; + if (_checkTimer <= diff) + { + // Tabulation madness in the hole! + for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++) + if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true)) + if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT)) + if (Vehicle* vehicle = vehicleCreature->GetVehicle()) + if (Unit* passenger = vehicle->GetPassenger(0)) + if (go->GetUInt32Value(GAMEOBJECT_FACTION) == passenger->getFaction()) + if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true)) + teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); + + _checkTimer = 1000; + } + else _checkTimer -= diff; } - else - uiCheckTimer -= diff; - } - private: - uint32 uiCheckTimer; - }; + private: + uint32 _checkTimer; + }; - GameObjectAI *GetAI(GameObject* go) const - { - return new go_wg_vehicle_teleporterAI(go); - } + GameObjectAI* GetAI(GameObject* go) const + { + return new go_wg_vehicle_teleporterAI(go); + } }; class npc_wg_quest_giver : public CreatureScript { - public: - npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") - { - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + public: + npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") { } - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + bool OnGossipHello(Player* player, Creature* creature) { + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return true; + if (creature->isQuestGiver()) { - Object* object = (Object *) creature; - QuestRelations* objectQR = sObjectMgr->GetCreatureQuestRelationMap(); - QuestRelations* objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); + QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); + QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); - QuestMenu & qm = player->PlayerTalkClass->GetQuestMenu(); + QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu(); qm.ClearMenu(); - for (QuestRelations::const_iterator i = objectQIR->lower_bound(object->GetEntry()); i != objectQIR->upper_bound(object->GetEntry()); ++i) + for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i) { uint32 quest_id = i->second; QuestStatus status = player->GetQuestStatus(quest_id); - if (status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id)) + if (status == QUEST_STATUS_COMPLETE) qm.AddMenuItem(quest_id, 4); else if (status == QUEST_STATUS_INCOMPLETE) qm.AddMenuItem(quest_id, 4); + //else if (status == QUEST_STATUS_AVAILABLE) + // qm.AddMenuItem(quest_id, 2); } - for (QuestRelations::const_iterator i = objectQR->lower_bound(object->GetEntry()); i != objectQR->upper_bound(object->GetEntry()); ++i) + for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i) { - uint32 quest_id = i->second; - Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); + uint32 questId = i->second; + Quest const* quest = sObjectMgr->GetQuestTemplate(questId); if (!quest) continue; - switch (quest_id) + switch (questId) { // Horde attacker - case 13193: - case 13202: - case 13180: - case 13200: - case 13201: - case 13223: - if (BfWG->GetAttackerTeam() == TEAM_HORDE) + case QUEST_BONES_AND_ARROWS_HORDE_ATT: + case QUEST_JINXING_THE_WALLS_HORDE_ATT: + case QUEST_SLAY_THEM_ALL_HORDE_ATT: + case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT: + case QUEST_HEALING_WITH_ROSES_HORDE_ATT: + case QUEST_DEFEND_THE_SIEGE_HORDE_ATT: + if (wintergrasp->GetAttackerTeam() == TEAM_HORDE) { - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); } break; // Horde defender - case 13199: - case 13192: - case 13178: - case 13191: - case 13194: - case 13539: - case 13185: - if (BfWG->GetDefenderTeam() == TEAM_HORDE) + case QUEST_BONES_AND_ARROWS_HORDE_DEF: + case QUEST_WARDING_THE_WALLS_HORDE_DEF: + case QUEST_SLAY_THEM_ALL_HORDE_DEF: + case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF: + case QUEST_HEALING_WITH_ROSES_HORDE_DEF: + case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF: + case QUEST_STOP_THE_SIEGE_HORDE_DEF: + if (wintergrasp->GetDefenderTeam() == TEAM_HORDE) { - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); } break; // Alliance attacker - case 13196: - case 13198: - case 13179: - case 13222: - case 13195: - if (BfWG->GetAttackerTeam() == TEAM_ALLIANCE) + case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT: + case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT: + case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT: + case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT: + case QUEST_A_RARE_HERB_ALLIANCE_ATT: + if (wintergrasp->GetAttackerTeam() == TEAM_ALLIANCE) { - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); } break; // Alliance defender - case 13154: - case 13153: - case 13177: - case 13538: - case 13186: - case 13156: - if (BfWG->GetDefenderTeam() == TEAM_ALLIANCE) + case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF: + case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF: + case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF: + case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF: + case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF: + case QUEST_A_RARE_HERB_ALLIANCE_DEF: + if (wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE) { - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); } break; default: - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); break; } } @@ -411,8 +453,43 @@ class npc_wg_quest_giver : public CreatureScript player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - return true; - } +}; + +class spell_wintergrasp_force_building : public SpellScriptLoader +{ + public: + spell_wintergrasp_force_building() : SpellScriptLoader("spell_wintergrasp_force_building") { } + + class spell_wintergrasp_force_building_SpellScript : public SpellScript + { + PrepareSpellScript(spell_wintergrasp_force_building_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_1) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_2)) + return false; + return true; + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_force_building_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_wintergrasp_force_building_SpellScript(); + } }; class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript @@ -444,7 +521,9 @@ void AddSC_wintergrasp() new npc_wg_queue(); new npc_wg_spirit_guide(); new npc_wg_demolisher_engineer(); - new go_wg_vehicle_teleporter(); new npc_wg_quest_giver(); new achievement_wg_didnt_stand_a_chance(); + new spell_wintergrasp_force_building(); + + new go_wg_vehicle_teleporter(); } -- cgit v1.2.3 From 17e2c3a800bbb284680fd275cbafd96b03b9da23 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 23 Mar 2012 07:52:18 -0400 Subject: Core/Battlefield: cleanup a magic number --- src/server/scripts/Northrend/wintergrasp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 787531b496f..ff21f34d1e2 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -113,7 +113,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(1); + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (canBuild(creature)) { -- cgit v1.2.3 From 9dd3789719352cc45521a57325e51676f84f5b43 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 26 Mar 2012 10:46:31 -0400 Subject: Core/Battlefield: correct wintergrasp faction for horde (thx kirkita), added grab passenger spell as per sniffs. --- Wintergrasp_temp/Scriptnames.sql | 3 ++- .../game/Battlefield/Zones/BattlefieldWG.cpp | 2 ++ src/server/game/Battlefield/Zones/BattlefieldWG.h | 3 ++- src/server/scripts/Northrend/wintergrasp.cpp | 30 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/Wintergrasp_temp/Scriptnames.sql b/Wintergrasp_temp/Scriptnames.sql index ecf817e10d6..38e9a60e5b1 100644 --- a/Wintergrasp_temp/Scriptnames.sql +++ b/Wintergrasp_temp/Scriptnames.sql @@ -13,10 +13,11 @@ UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` -- Wintergrasp vehicle teleport GO script UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter -DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899); +DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899, 61178); INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (61409, 'spell_wintergrasp_force_building'), (56659, 'spell_wintergrasp_force_building'), (56662, 'spell_wintergrasp_force_building'), (56664, 'spell_wintergrasp_force_building'), (49899, 'spell_wintergrasp_force_building'); +(61178, 'spell_wintergrasp_grab_passenger'); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index decc22105a4..caac130eccf 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -563,6 +563,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) return; } } + if (creature->GetOwner()) + creature->CastSpell(creature->GetOwner(),SPELL_GRAB_PASSENGER,true); break; } } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index b2356e61d64..c711010bafd 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -29,7 +29,7 @@ const uint32 VehNumWorldState[2] = { 3680, 3490 }; const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; const uint32 ClockWorldState[2] = { 3781, 4354 }; -const uint32 WintergraspFaction[3] = { 1, 116, 35 }; +const uint32 WintergraspFaction[3] = { 1, 2, 35 }; const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; class BattlefieldWG; @@ -59,6 +59,7 @@ enum WintergraspSpells SPELL_GREATEST_HONOR = 58557, SPELL_ALLIANCE_FLAG = 14268, SPELL_HORDE_FLAG = 14267, + SPELL_GRAB_PASSENGER = 61178, // Reward spells SPELL_VICTORY_REWARD = 56902, diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index ff21f34d1e2..d765e3363af 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -492,6 +492,33 @@ class spell_wintergrasp_force_building : public SpellScriptLoader } }; +class spell_wintergrasp_grab_passenger : public SpellScriptLoader +{ + public: + spell_wintergrasp_grab_passenger() : SpellScriptLoader("spell_wintergrasp_grab_passenger") { } + + class spell_wintergrasp_grab_passenger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_wintergrasp_grab_passenger_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + if (Player* target = GetHitPlayer()) + GetCaster()->GetVehicleKit()->AddPassenger(target); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_grab_passenger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_wintergrasp_grab_passenger_SpellScript(); + } +}; + class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript { public: @@ -516,6 +543,8 @@ public: } }; + + void AddSC_wintergrasp() { new npc_wg_queue(); @@ -524,6 +553,7 @@ void AddSC_wintergrasp() new npc_wg_quest_giver(); new achievement_wg_didnt_stand_a_chance(); new spell_wintergrasp_force_building(); + new spell_wintergrasp_grab_passenger(); new go_wg_vehicle_teleporter(); } -- cgit v1.2.3 From aa0ff294d2eeb910ef8e5b337a5b447e6d5a801a Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 26 Mar 2012 11:52:39 -0400 Subject: Core/Battlefield: Correct previous commit --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/scripts/Northrend/wintergrasp.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index caac130eccf..ce215590822 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -564,7 +564,7 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) } } if (creature->GetOwner()) - creature->CastSpell(creature->GetOwner(),SPELL_GRAB_PASSENGER,true); + creature->CastSpell(creature->GetOwner(), SPELL_GRAB_PASSENGER, true); break; } } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index d765e3363af..b4aa92b893e 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -501,10 +501,10 @@ class spell_wintergrasp_grab_passenger : public SpellScriptLoader { PrepareSpellScript(spell_wintergrasp_grab_passenger_SpellScript); - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { if (Player* target = GetHitPlayer()) - GetCaster()->GetVehicleKit()->AddPassenger(target); + target->EnterVehicle(GetCaster()); } void Register() -- cgit v1.2.3 From 81ba249c790362e76e32a692bde794c2ff7bfb02 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 28 Mar 2012 08:49:01 -0400 Subject: Core/Battlefield: correct siege vehicle faction types. attempt to fix vehicle creation cast time. --- src/server/scripts/Northrend/wintergrasp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index b4aa92b893e..d4cc8519dab 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -41,8 +41,8 @@ enum eWGqueuenpctext enum Spells { // Demolisher engineers spells - SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 = 61409, // - SPELL_BUILD_SIEGE_VEHICLE_FORCE_2 = 56662, // Which faction uses which ? + SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE = 61409, + SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE = 56662, SPELL_BUILD_CATAPULT_FORCE = 56664, SPELL_BUILD_DEMOLISHER_FORCE = 56659, SPELL_ACTIVATE_CONTROL_ARMS = 49899, @@ -150,7 +150,7 @@ class npc_wg_demolisher_engineer : public CreatureScript creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true); break; case 2: - creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 : SPELL_BUILD_SIEGE_VEHICLE_FORCE_2, true); + creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE : SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE, true); break; } if (Creature* controlArms = creature->FindNearestCreature(NPC_WINTERGRASP_CONTROL_ARMS, 30.0f, true)) @@ -477,7 +477,7 @@ class spell_wintergrasp_force_building : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), true); + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false); } void Register() -- cgit v1.2.3 From 483f0a6a4e4bf30a567987e81ab17ec8201f29bc Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 28 Mar 2012 11:32:57 -0400 Subject: Core/Battlefield: attempt to fix vehicle counter when vehicle is killed. finish correcting alliance/horde siege engine --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 54 +++++++++++++++------- src/server/game/Battlefield/Zones/BattlefieldWG.h | 7 ++- src/server/scripts/Northrend/wintergrasp.cpp | 8 ++-- 3 files changed, 47 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index ce215590822..6dbedf1aceb 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -518,8 +518,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) { switch (creature->GetEntry()) { - case NPC_WINTERGRASP_SIEGE_ENGINE_1: - case NPC_WINTERGRASP_SIEGE_ENGINE_2: + case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE: + case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE: case NPC_WINTERGRASP_CATAPULT: case NPC_WINTERGRASP_DEMOLISHER: { @@ -573,12 +573,13 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) void BattlefieldWG::OnCreatureRemove(Creature* creature) { +/* possibly can be used later if (IsWarTime()) { switch (creature->GetEntry()) { - case NPC_WINTERGRASP_SIEGE_ENGINE_1: - case NPC_WINTERGRASP_SIEGE_ENGINE_2: + case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE: + case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE: case NPC_WINTERGRASP_CATAPULT: case NPC_WINTERGRASP_DEMOLISHER: { @@ -600,7 +601,7 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature) break; } } - } + }*/ } void BattlefieldWG::OnGameObjectCreate(GameObject* go) @@ -656,23 +657,19 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) return; bool again = false; + TeamId killerTeam = killer->GetTeamId(); + if (victim->GetTypeId() == TYPEID_PLAYER) { - for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr) + for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); return; - } + } - for (GuidSet::const_iterator itr = m_vehicles[GetOtherTeam(killer->GetTeamId())].begin(); itr != m_vehicles[GetOtherTeam(killer->GetTeamId())].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - if (victim->GetEntry() == creature->GetEntry() && !again) - again = true; - - for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killer->GetTeamId())].begin(); - itr != KeepCreature[GetOtherTeam(killer->GetTeamId())].end(); ++itr) + for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin(); + itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr) { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { @@ -681,7 +678,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (victim->GetEntry() == creature->GetEntry() && !again) { again = true; - for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) + for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter) if (Player* player = sObjectAccessor->FindPlayer(*iter)) if (player->GetDistance2d(killer) < 40.0f) PromotePlayer(player); @@ -692,6 +689,31 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) // TODO:Recent PvP activity worldstate } +bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle) +{ + for (uint32 itr = 0; itr < 2; ++itr) + { + if (m_vehicles[itr].find(vehicle->GetGUID()) != m_vehicles[itr].end()) + { + m_vehicles[itr].erase(vehicle->GetGUID()); + if (itr == WintergraspFaction[TEAM_HORDE]) + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1); + else + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1); + return true; + } + } + return false; +} + +void BattlefieldWG::OnUnitDeath(Unit* unit) +{ + if (IsWarTime()) + if (unit->IsVehicle()) + if (FindAndRemoveVehicleFromList(unit)) + UpdateVehicleCountWG(); +} + // Update rank for player void BattlefieldWG::PromotePlayer(Player* killer) { diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index c711010bafd..f62d2d962f8 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -212,8 +212,8 @@ enum WintergraspNpcs NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp NPC_TOWER_CANNON = 28366, - NPC_WINTERGRASP_SIEGE_ENGINE_1 = 28312, - NPC_WINTERGRASP_SIEGE_ENGINE_2 = 32627, + NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312, + NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627, NPC_WINTERGRASP_CATAPULT = 27881, NPC_WINTERGRASP_DEMOLISHER = 28094, NPC_WINTERGRASP_TOWER_CANNON = 28366, @@ -400,11 +400,14 @@ class BattlefieldWG : public Battlefield void SendInitWorldStatesToAll(); void HandleKill(Player* killer, Unit* victim); + void OnUnitDeath(Unit* unit); void PromotePlayer(Player* killer); void UpdateTenacity(); void ProcessEvent(WorldObject *obj, uint32 eventId); + bool FindAndRemoveVehicleFromList(Unit* vehicle); + // returns the graveyardId in the specified area. uint8 GetSpiritGraveyardId(uint32 areaId); diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index d4cc8519dab..db10e00f13d 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -99,8 +99,8 @@ uint8 const MAX_WINTERGRASP_VEHICLES = 4; uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = { NPC_WINTERGRASP_CATAPULT, NPC_WINTERGRASP_DEMOLISHER, - NPC_WINTERGRASP_SIEGE_ENGINE_1, - NPC_WINTERGRASP_SIEGE_ENGINE_2 + NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE, + NPC_WINTERGRASP_SIEGE_ENGINE_HORDE }; class npc_wg_demolisher_engineer : public CreatureScript @@ -468,8 +468,8 @@ class spell_wintergrasp_force_building : public SpellScriptLoader { if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE) || !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE) - || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_1) - || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_2)) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE)) return false; return true; } -- cgit v1.2.3 From 2d45e260120445eaef310beed6cdd640919643cb Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 28 Mar 2012 17:24:45 -0400 Subject: Core/Battlefield: codystyle/whitespace cleanup. fix a stupid typo. attempt to get team using the vehicle creator instead of the vehicle --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 38 ++++++++++------------ 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6dbedf1aceb..b98e3b52e83 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -85,7 +85,7 @@ bool BattlefieldWG::SetupBattlefield() m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE)); m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER)); - + m_Timer = sWorld->getWorldState(ClockWorldState[0]); if (m_isActive) { @@ -142,18 +142,18 @@ bool BattlefieldWG::SetupBattlefield() for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++) if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) OutsideCreature[TEAM_HORDE].insert(creature->GetGUID()); - + // Spawn Alliance NPCs outside the keep for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++) if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); - + // Hide units outside the keep that are defenders for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); - + // Spawn turrets and hide them per default for (uint8 i = 0; i < WG_MAX_TURRET; i++) { @@ -523,17 +523,14 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) case NPC_WINTERGRASP_CATAPULT: case NPC_WINTERGRASP_DEMOLISHER: { - uint8 team; - if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) - team = TEAM_ALLIANCE; - else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) - team = TEAM_HORDE; - else + if (!creature->GetCreatorGUID() || !sObjectAccessor->FindPlayer(creature->GetCreatorGUID())) return; + Player* creator = sObjectAccessor->FindPlayer(creature->GetCreatorGUID()); + TeamId team = creator->GetTeamId(); if (team == TEAM_HORDE) { - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1); creature->CastSpell(creature, SPELL_HORDE_FLAG, true); @@ -543,28 +540,29 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) else { creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); + creature->RemoveFromWorld(); return; } } else { - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1); - creature->CastSpell(creature, SPELL_HORDE_FLAG, true); + creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } else { creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); + creature->RemoveFromWorld(); return; } } - if (creature->GetOwner()) - creature->CastSpell(creature->GetOwner(), SPELL_GRAB_PASSENGER, true); + + if (creature->GetCreatorGUID() && sObjectAccessor->FindUnit(creature->GetCreatorGUID())) + creature->CastSpell(sObjectAccessor->FindUnit(creature->GetCreatorGUID()), SPELL_GRAB_PASSENGER, true); break; } } @@ -666,7 +664,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); return; - } + } for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin(); itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr) @@ -698,7 +696,7 @@ bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle) m_vehicles[itr].erase(vehicle->GetGUID()); if (itr == WintergraspFaction[TEAM_HORDE]) UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1); - else + else UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1); return true; } @@ -810,7 +808,7 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) { if (!m_isActive) RemoveAurasFromPlayer(player); - + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); -- cgit v1.2.3 From d6de7dec342d8e6f1dd316b18341e61705a55053 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 3 Apr 2012 13:49:51 -0400 Subject: Core/Battlefield: few more updates to wintergrasp vehicle stuff. --- Wintergrasp_temp/Template_update.sql | 18 +++++++++--------- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 13 +++++++++---- src/server/scripts/Northrend/wintergrasp.cpp | 3 ++- 3 files changed, 20 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/Template_update.sql index 84df0017b06..6bae79da4bd 100644 --- a/Wintergrasp_temp/Template_update.sql +++ b/Wintergrasp_temp/Template_update.sql @@ -20,13 +20,13 @@ UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4 WHERE `entry`=311 UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?) UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216 WHERE `entry`=28366; -- Wintergrasp Tower Cannon -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=32629; -- Wintergrasp Siege Turret -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=28319; -- Wintergrasp Siege Turret -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=32627; -- Wintergrasp Siege Engine -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28312; -- Wintergrasp Siege Engine -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28094; -- Wintergrasp Demolisher -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; -- Wintergrasp Catapult +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216 WHERE `entry`=28366; -- Wintergrasp Tower Cannon +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=32629; -- Wintergrasp Siege Turret +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=28319; -- Wintergrasp Siege Turret +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=32627; -- Wintergrasp Siege Engine +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28312; -- Wintergrasp Siege Engine +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28094; -- Wintergrasp Demolisher +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; -- Wintergrasp Catapult UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder @@ -61,8 +61,8 @@ INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote` (32296,27245,0,1,0, NULL), -- Stone Guard Mukar (39173,29261,0,1,0, NULL), -- Champion Ros'slai (30740,0,0,257,375, NULL), -- Valiance Expedition Champion -(32629,0,0,257,0, NULL), -- Wintergrasp Siege Turret -(28319,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(32629,0,0,257,0,46598), -- Wintergrasp Siege Turret +(28319,0,0,257,0,46598), -- Wintergrasp Siege Turret (28366,0,0,257,0, NULL), -- Wintergrasp Tower Cannon (32627,0,0,257,0, NULL), -- Wintergrasp Siege Engine (28312,0,0,257,0, NULL), -- Wintergrasp Siege Engine diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index b98e3b52e83..8c68ee3f17e 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -524,7 +524,11 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) case NPC_WINTERGRASP_DEMOLISHER: { if (!creature->GetCreatorGUID() || !sObjectAccessor->FindPlayer(creature->GetCreatorGUID())) + { + creature->setDeathState(DEAD); + creature->RemoveFromWorld(); return; + } Player* creator = sObjectAccessor->FindPlayer(creature->GetCreatorGUID()); TeamId team = creator->GetTeamId(); @@ -533,7 +537,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1); - creature->CastSpell(creature, SPELL_HORDE_FLAG, true); + creature->AddAura(SPELL_HORDE_FLAG, creature); + creature->setFaction(creator->getFaction()); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -549,7 +554,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1); - creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true); + creature->AddAura(SPELL_ALLIANCE_FLAG,creature); + creature->setFaction(creator->getFaction()); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -561,8 +567,7 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) } } - if (creature->GetCreatorGUID() && sObjectAccessor->FindUnit(creature->GetCreatorGUID())) - creature->CastSpell(sObjectAccessor->FindUnit(creature->GetCreatorGUID()), SPELL_GRAB_PASSENGER, true); + creature->CastSpell(creator, SPELL_GRAB_PASSENGER, true); break; } } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index db10e00f13d..61646d0cc16 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -46,6 +46,7 @@ enum Spells SPELL_BUILD_CATAPULT_FORCE = 56664, SPELL_BUILD_DEMOLISHER_FORCE = 56659, SPELL_ACTIVATE_CONTROL_ARMS = 49899, + SPELL_RIDE_WG_VEHICLE = 60968, SPELL_VEHICLE_TELEPORT = 49759, @@ -504,7 +505,7 @@ class spell_wintergrasp_grab_passenger : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { if (Player* target = GetHitPlayer()) - target->EnterVehicle(GetCaster()); + target->CastSpell(GetCaster(), SPELL_RIDE_WG_VEHICLE, true); } void Register() -- cgit v1.2.3 From 87c50a4ec3b0b952cb8ebd185432f7c33ac05ff9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 9 Apr 2012 12:47:39 -0400 Subject: Core/Battlefield: specify correct npc for vehicle teleportations. --- src/server/scripts/Northrend/wintergrasp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 61646d0cc16..41bb5f3f54b 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -56,12 +56,12 @@ enum Spells enum CreatureIds { - NPC_GOBLIN_MECHANIC = 30400, - NPC_GNOMISH_ENGINEER = 30499, + NPC_GOBLIN_MECHANIC = 30400, + NPC_GNOMISH_ENGINEER = 30499, - NPC_WINTERGRASP_CONTROL_ARMS = 27852, + NPC_WINTERGRASP_CONTROL_ARMS = 27852, - NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23742, + NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23472, }; enum QuestIds -- cgit v1.2.3 From e4bf9d5cd459624ec65e1dd8e691ca72d8ce63f2 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 17 Apr 2012 09:16:56 -0400 Subject: cleanup merge and some unneeded selects in functions --- src/server/game/Battlefield/Zones/BattlefieldWG.h | 108 +++++++--------------- src/server/game/Scripting/ScriptMgr.cpp | 8 -- src/server/scripts/Northrend/wintergrasp.cpp | 2 +- 3 files changed, 34 insertions(+), 84 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index f62d2d962f8..53c051a03d2 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -372,7 +372,7 @@ class BattlefieldWG : public Battlefield void UpdatedDestroyedTowerCount(TeamId team); void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1); - + void RemoveAurasFromPlayer(Player* player); /** @@ -1458,48 +1458,27 @@ struct BfWGGameObjectBuilding if (m_Build) { if (disable) - { - switch (m_Build->GetEntry()) - { - case 190221: - case 190373: - case 190377: - case 190378: - { - creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } - } m_WG->HideNpc(creature); - } else + m_WG->ShowNpc(creature, true); + + switch (m_Build->GetEntry()) { - switch (m_Build->GetEntry()) + case 190221: + case 190373: + case 190377: + case 190378: { - case 190221: - case 190373: - case 190377: - case 190378: - { - creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; } - m_WG->ShowNpc(creature, true); } } } @@ -1515,48 +1494,27 @@ struct BfWGGameObjectBuilding if (m_Build) { if (disable) + m_WG->HideNpc(creature); + else + m_WG->ShowNpc(creature, true); + + switch (m_Build->GetEntry()) { - switch (m_Build->GetEntry()) + case 190221: + case 190373: + case 190377: + case 190378: { - case 190221: - case 190373: - case 190377: - case 190378: - { - creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; } - m_WG->HideNpc(creature); - } - else - { - switch (m_Build->GetEntry()) + case 190356: + case 190357: + case 190358: { - case 190221: - case 190373: - case 190377: - case 190378: - { - creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; } - m_WG->ShowNpc(creature, true); } } } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 98675f118e1..2d7d86b5f73 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -972,14 +972,6 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd return tmpscript->OnDummyEffect(caster, spellId, effIndex, target); } -GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) -{ - ASSERT(go); - - GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); - return tmpscript->GetAI(go); -} - bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger) { ASSERT(player); diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 41bb5f3f54b..66a79a4be22 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -301,7 +301,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript _checkTimer(1000) { } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 diff) { if (_checkTimer <= diff) { -- cgit v1.2.3 From 8dfbff7b15225e04ec0ca660847fd848ee506259 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 6 Aug 2012 13:12:30 -0400 Subject: fix build --- src/server/game/Battlefield/Battlefield.cpp | 22 +++++++++++----------- src/server/game/Battlefield/BattlefieldHandler.cpp | 6 +++--- src/server/game/Battlefield/BattlefieldMgr.cpp | 6 ++---- .../game/Battlefield/Zones/BattlefieldWG.cpp | 4 ++-- src/server/game/Battlefield/Zones/BattlefieldWG.h | 2 +- src/server/game/World/World.cpp | 2 +- 6 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 2ad6b244058..ec4acbec9ed 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -280,7 +280,7 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL)) StalkerGuid = creature->GetGUID(); else - sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); } void Battlefield::KickAfkPlayers() @@ -587,10 +587,10 @@ BfGraveyard* Battlefield::GetGraveyardById(uint32 id) if (m_GraveyardList[id]) return m_GraveyardList[id]; else - sLog->outError("Battlefield::GetGraveyardById Id:%u not existed", id); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::GetGraveyardById Id:%u not existed", id); } else - sLog->outError("Battlefield::GetGraveyardById Id:%u cant be found", id); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::GetGraveyardById Id:%u cant be found", id); return NULL; } @@ -684,7 +684,7 @@ void BfGraveyard::SetSpirit(Creature* spirit, TeamId team) { if (!spirit) { - sLog->outError("BfGraveyard::SetSpirit: Invalid Spirit."); + sLog->outError(LOG_FILTER_GENERAL, "BfGraveyard::SetSpirit: Invalid Spirit."); return; } @@ -798,14 +798,14 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId)); if (!map) { - sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); return 0; } Creature* creature = new Creature; if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { - sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u", entry); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; return NULL; } @@ -815,7 +815,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - sLog->outErrorDb("Battlefield::SpawnCreature: entry %u does not exist.", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: entry %u does not exist.", entry); return NULL; } // force using DB speeds -- do we really need this? @@ -841,8 +841,8 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z GameObject* go = new GameObject; if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY)) { - sLog->outErrorDb("Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); - sLog->outError("Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); delete go; return NULL; } @@ -920,7 +920,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) GameObjectTemplate const* goinfo = capturePoint->GetGOInfo(); if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { - sLog->outError("OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); return false; } @@ -1066,7 +1066,7 @@ bool BfCapturePoint::Update(uint32 diff) if (m_OldState != m_State) { - //sLog->outError("%u->%u", m_OldState, m_State); + //sLog->outError(LOG_FILTER_GENERAL, "%u->%u", m_OldState, m_State); if (oldTeam != m_team) ChangeTeam(oldTeam); return true; diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index e10c5c136d9..09c6f18f796 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -101,7 +101,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data) uint8 Accepted; recv_data >> BattleId >> Accepted; - sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -119,7 +119,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data) uint8 Accepted; recv_data >> BattleId >> Accepted; - sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -141,7 +141,7 @@ void WorldSession::HandleBfExitRequest(WorldPacket & recv_data) uint32 BattleId; recv_data >> BattleId; - sLog->outError("HandleBfExitRequest: BattleID:%u ", BattleId); + sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 9f821871c2b..6122b25e8e8 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -40,15 +40,13 @@ void BattlefieldMgr::InitBattlefield() // respawn, init variables if (!pBf->SetupBattlefield()) { - sLog->outString(); - sLog->outString("Battlefield : Wintergrasp init failed."); + sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp init failed."); delete pBf; } else { m_BattlefieldSet.push_back(pBf); - sLog->outString(); - sLog->outString("Battlefield : Wintergrasp successfully initiated."); + sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp successfully initiated."); } /* For Cataclysm: Tol Barad diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 8c68ee3f17e..c57f2bf0597 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -238,7 +238,7 @@ void BattlefieldWG::OnBattleStart() m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } else - sLog->outError("WG: Failed to spawn titan relic."); + sLog->outError(LOG_FILTER_GENERAL, "WG: Failed to spawn titan relic."); // Update tower visibility and update faction @@ -490,7 +490,7 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) case AREA_THE_CHILLED_QUAGMIRE: return BATTLEFIELD_WG_GY_HORDE; default: - sLog->outError("BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); + sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); break; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 53c051a03d2..738d82135d2 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1245,7 +1245,7 @@ struct BfWGGameObjectBuilding if (m_WG->GetRelic()) m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); else - sLog->outError("BattlefieldWG: Relic not found."); + sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG: Relic not found."); break; } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index c4ff906bc35..b6e9ee1651d 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1730,7 +1730,7 @@ void World::SetInitialWorldSettings() sOutdoorPvPMgr->InitOutdoorPvP(); ///- Initialize Battlefield - sLog->outString("Starting Battlefield System"); + sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battlefield System"); sBattlefieldMgr->InitBattlefield(); sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); -- cgit v1.2.3 From e56ff2e93a6d62ef1bcf68f2faf95a845b19bdb9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 8 Aug 2012 09:29:43 -0400 Subject: Core/Battlefield: fix crash (thx joschiwald) closes #6726 --- src/server/game/Battlefield/Battlefield.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index ec4acbec9ed..eb74c53ccb3 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -202,7 +202,7 @@ void Battlefield::InvitePlayerToQueue(Player* player) if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID())) return; - if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer) + if (m_PlayersInQueue[player->GetTeamId()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer) player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); } -- cgit v1.2.3 From c428675048d2b6833ac055d7c5ed5d8f7659f667 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 20 Aug 2012 14:11:38 -0400 Subject: Cmake: fix cmake file for use with wintergrasp --- src/server/game/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index a83e77e6632..68ae2d8ea38 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -17,6 +17,7 @@ file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h) file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h) file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h) file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h) +file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h) file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h) file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h) file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h) @@ -68,6 +69,7 @@ set(game_STAT_SRCS ${sources_Addons} ${sources_AI} ${sources_AuctionHouse} + ${sources_Battlefield} ${sources_Battlegrounds} ${sources_Calendar} ${sources_Chat} @@ -136,6 +138,8 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI ${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts ${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse + ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield + ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones ${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds ${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds/Zones ${CMAKE_CURRENT_SOURCE_DIR}/Calendar -- cgit v1.2.3 From b9f60fe56c86914c15f3a3064f9b8b91ea166012 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 20 Aug 2012 16:23:24 -0400 Subject: Core/Wintergrasp: finish implementation for battlefields. this is highly experimental enable at you're own risk. will almost definatly cause issues with the wintergrasp patch floating around --- src/server/game/Battlefield/Battlefield.cpp | 2 +- src/server/game/Entities/Object/Object.cpp | 5 +-- src/server/game/Entities/Player/Player.cpp | 2 + src/server/game/Entities/Unit/Unit.cpp | 2 + src/server/game/Groups/Group.cpp | 12 +++++- src/server/game/Groups/Group.h | 5 +++ src/server/game/Handlers/BattleGroundHandler.cpp | 49 +++++++++++++++++++++++ src/server/game/Handlers/MiscHandler.cpp | 49 +---------------------- src/server/game/Scripting/ScriptMgr.cpp | 8 ++++ src/server/game/Server/WorldSession.h | 1 + src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 + src/server/game/Spells/Spell.cpp | 2 + src/server/game/World/World.cpp | 1 + src/server/game/World/World.h | 7 ++++ src/server/scripts/CMakeLists.txt | 2 + src/server/scripts/Northrend/CMakeLists.txt | 1 + src/server/scripts/Northrend/wintergrasp.cpp | 3 +- 17 files changed, 100 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index eb74c53ccb3..cdb8e1999fe 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -563,7 +563,7 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player) else if (group->IsMember(player->GetGUID())) { uint8 subgroup = group->GetMemberGroup(player->GetGUID()); - player->SetBattlegroundOrBattlefieldRaid(group, subgroup); + player->SetBattlegroundRaid(group, subgroup); } else group->AddMember(player); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index b265648d0c4..9138dcedc27 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -48,6 +48,8 @@ #include "MovementPacketBuilder.h" #include "DynamicTree.h" #include "Group.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" uint32 GuidHigh2TypeId(uint32 guid_hi) { @@ -2331,9 +2333,6 @@ void WorldObject::SetZoneScript() else if (!map->IsBattlegroundOrArena()) { if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) - m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); - } -} m_zoneScript = bf; else m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2cb38d615ac..1dcdfa9d8b4 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -74,6 +74,8 @@ #include "InstanceScript.h" #include #include "AccountMgr.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5e94ea3146a..3f088c556f6 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -57,6 +57,8 @@ #include "MoveSpline.h" #include "ConditionMgr.h" #include "UpdateFieldFlags.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" #include diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 5ace6da2f44..c270597d15b 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -59,7 +59,7 @@ Loot* Roll::getLoot() Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL), m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL), -m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), +m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0) { for (uint8 i = 0; i < TARGETICONCOUNT; ++i) @@ -2149,6 +2149,11 @@ bool Group::isBGGroup() const return m_bgGroup != NULL; } +bool Group::isBFGroup() const +{ + return m_bfGroup != NULL; +} + bool Group::IsCreated() const { return GetMembersCount() > 0; @@ -2250,6 +2255,11 @@ void Group::SetBattlegroundGroup(Battleground* bg) m_bgGroup = bg; } +void Group::SetBattlefieldGroup(Battlefield *bg) +{ + m_bfGroup = bg; +} + void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag) { // Assistants, main assistants and main tanks are only available in raid groups diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index e5f174c4230..41f5cd0de5f 100755 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -26,6 +26,8 @@ #include "QueryResult.h" #include "SharedDefines.h" #include "Player.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" class Creature; class GroupReference; @@ -205,6 +207,7 @@ class Group bool isLFGGroup() const; bool isRaidGroup() const; bool isBGGroup() const; + bool isBFGroup() const; bool IsCreated() const; uint64 GetLeaderGUID() const; uint64 GetGUID() const; @@ -241,6 +244,7 @@ class Group void ConvertToRaid(); void SetBattlegroundGroup(Battleground* bg); + void SetBattlefieldGroup(Battlefield *bf); GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); void ChangeMembersGroup(uint64 guid, uint8 group); @@ -324,6 +328,7 @@ class Group Difficulty m_dungeonDifficulty; Difficulty m_raidDifficulty; Battleground* m_bgGroup; + Battlefield* m_bfGroup; uint64 m_targetIcons[TARGETICONCOUNT]; LootMethod m_lootMethod; ItemQualities m_lootThreshold; diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 475c1c42fca..b47eaf52064 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -34,6 +34,8 @@ #include "Opcodes.h" #include "DisableMgr.h" #include "Group.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data) { @@ -565,6 +567,53 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/) } } +void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->SendAreaSpiritHealerQueryOpcode(_player,guid); +} + +void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); +} + + void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 26b41a62928..bb0ca39fa37 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -52,6 +52,8 @@ #include "Group.h" #include "AccountMgr.h" #include "Spell.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { @@ -1687,53 +1689,6 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) SendPacket(&data); } -//Battlefield and Battleground -void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); - - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) - bf->SendAreaSpiritHealerQueryOpcode(_player,guid); -} - -void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); - - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) - bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); -} - void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/) { if (_player->isInFlight()) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 2d7d86b5f73..61d8711fd71 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -723,6 +723,14 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd return tmpscript->OnDummyEffect(caster, spellId, effIndex, target); } +GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) +{ + ASSERT(go); + + GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); + return tmpscript->GetAI(go); +} + bool ScriptMgr::OnQuestAccept(Player* player, Item* item, Quest const* quest) { ASSERT(player); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 98a8f3e5641..40485e2fa3b 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -933,6 +933,7 @@ class WorldSession void HandleEjectPassenger(WorldPacket& data); void HandleEnterPlayerVehicle(WorldPacket& data); void HandleUpdateProjectilePosition(WorldPacket& recvPacket); + void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); private: void InitializeQueryCallbackParameters(); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index e8675d52b2d..f6cd5008b3c 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -36,6 +36,8 @@ #include "CellImpl.h" #include "ScriptMgr.h" #include "Vehicle.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" class Aura; // diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 5281eb16f0c..be92a86f958 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -53,6 +53,8 @@ #include "SpellScript.h" #include "InstanceScript.h" #include "SpellInfo.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS]; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index b6e9ee1651d..d860530d97d 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -77,6 +77,7 @@ #include "WardenCheckMgr.h" #include "Warden.h" #include "CalendarMgr.h" +#include "BattlefieldMgr.h" ACE_Atomic_Op World::m_stopEvent = false; uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE; diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index f0dbc3c84ad..a6cdd4742f6 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -164,6 +164,7 @@ enum WorldBoolConfigs CONFIG_QUEST_IGNORE_AUTO_ACCEPT, CONFIG_QUEST_IGNORE_AUTO_COMPLETE, CONFIG_WARDEN_ENABLED, + CONFIG_WINTERGRASP_ENABLE, BOOL_CONFIG_VALUE_COUNT }; @@ -318,6 +319,12 @@ enum WorldIntConfigs CONFIG_WARDEN_CLIENT_BAN_DURATION, CONFIG_WARDEN_NUM_MEM_CHECKS, CONFIG_WARDEN_NUM_OTHER_CHECKS, + CONFIG_WINTERGRASP_PLR_MAX, + CONFIG_WINTERGRASP_PLR_MIN, + CONFIG_WINTERGRASP_PLR_MIN_LVL, + CONFIG_WINTERGRASP_BATTLETIME, + CONFIG_WINTERGRASP_NOBATTLETIME, + CONFIG_WINTERGRASP_RESTART_AFTER_CRASH, INT_CONFIG_VALUE_COUNT }; diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index 792fdeb3e7b..f148ae2b3ee 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -80,6 +80,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI ${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts ${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse + ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield + ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones ${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds ${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones ${CMAKE_SOURCE_DIR}/src/server/game/Calendar diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index 3502e7fb104..dd8dd17c947 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -10,6 +10,7 @@ set(scripts_STAT_SRCS ${scripts_STAT_SRCS} + Northrend/wintergrasp.cpp Northrend/isle_of_conquest.cpp Northrend/storm_peaks.cpp Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 66a79a4be22..eba5b7f69d4 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -21,6 +21,7 @@ #include "WorldSession.h" #include "ObjectMgr.h" #include "Vehicle.h" +#include "GameObjectAI.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." @@ -323,7 +324,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript uint32 _checkTimer; }; - GameObjectAI* GetAI(GameObject* go) const + GameObjectAI* GetGameObjectAI(GameObject* go) const { return new go_wg_vehicle_teleporterAI(go); } -- cgit v1.2.3 From 9a59dcb285d26bf9dc2724d95ab73e27f697ec07 Mon Sep 17 00:00:00 2001 From: Faq Date: Mon, 20 Aug 2012 23:35:44 +0300 Subject: Core/Questhandler: Fix qsharing. Thnx Chaplain for idea --- src/server/game/Handlers/QuestHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 7492edb35fe..db18f2a01c9 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -122,7 +122,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) // no or incorrect quest giver if (!object || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) || - (object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId))) + (object->GetTypeId() == TYPEID_PLAYER && object != _player && !object->ToPlayer()->CanShareQuest(questId))) { _player->PlayerTalkClass->SendCloseGossip(); _player->SetDivider(0); @@ -582,7 +582,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) continue; } - player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true); + player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true); player->SetDivider(_player->GetGUID()); } } -- cgit v1.2.3 From 16a0813c1b9871c53157bc1fc15612af578b2684 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 20 Aug 2012 22:48:26 +0200 Subject: Fix non PCH build --- src/server/game/Battlefield/Battlefield.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 217d6d62a26..5fa8d6b1bc8 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -25,6 +25,7 @@ #include "WorldPacket.h" #include "GameObject.h" #include "Battleground.h" +#include "ObjectAccessor.h" enum BattlefieldTypes { -- cgit v1.2.3 From 9e0907874e3f461aa5650f7122af880301025b7f Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 20 Aug 2012 21:54:36 +0100 Subject: Core: Fix 4 warnings / SQL: Rename two SQL files --- sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql | 4 ---- sql/updates/world/2011_07_05_00_world_disables.sql | 1 - sql/updates/world/2012_08_20_08_world_achievement_criteria_data.sql | 4 ++++ sql/updates/world/2012_08_20_09_world_disables.sql | 1 + src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 4 ++-- src/tools/vmap4_extractor/mpq_libmpq04.h | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql delete mode 100644 sql/updates/world/2011_07_05_00_world_disables.sql create mode 100644 sql/updates/world/2012_08_20_08_world_achievement_criteria_data.sql create mode 100644 sql/updates/world/2012_08_20_09_world_disables.sql (limited to 'src') diff --git a/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql b/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql deleted file mode 100644 index fa995e7804f..00000000000 --- a/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql +++ /dev/null @@ -1,4 +0,0 @@ -DELETE FROM `achievement_criteria_data` WHERE criteria_id = 7703; -INSERT INTO `achievement_criteria_data` VALUES -(7703, 6, 4197, 0, ''), -(7703, 11, 0, 0, 'achievement_wg_didnt_stand_a_chance'); diff --git a/sql/updates/world/2011_07_05_00_world_disables.sql b/sql/updates/world/2011_07_05_00_world_disables.sql deleted file mode 100644 index fa5010b669f..00000000000 --- a/sql/updates/world/2011_07_05_00_world_disables.sql +++ /dev/null @@ -1 +0,0 @@ -DELETE FROM `disables` WHERE `entry` = 7703 AND `sourceType` = 4; diff --git a/sql/updates/world/2012_08_20_08_world_achievement_criteria_data.sql b/sql/updates/world/2012_08_20_08_world_achievement_criteria_data.sql new file mode 100644 index 00000000000..fa995e7804f --- /dev/null +++ b/sql/updates/world/2012_08_20_08_world_achievement_criteria_data.sql @@ -0,0 +1,4 @@ +DELETE FROM `achievement_criteria_data` WHERE criteria_id = 7703; +INSERT INTO `achievement_criteria_data` VALUES +(7703, 6, 4197, 0, ''), +(7703, 11, 0, 0, 'achievement_wg_didnt_stand_a_chance'); diff --git a/sql/updates/world/2012_08_20_09_world_disables.sql b/sql/updates/world/2012_08_20_09_world_disables.sql new file mode 100644 index 00000000000..fa5010b669f --- /dev/null +++ b/sql/updates/world/2012_08_20_09_world_disables.sql @@ -0,0 +1 @@ +DELETE FROM `disables` WHERE `entry` = 7703 AND `sourceType` = 4; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index c57f2bf0597..48d6b59d007 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -574,7 +574,7 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) } } -void BattlefieldWG::OnCreatureRemove(Creature* creature) +void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/) { /* possibly can be used later if (IsWarTime()) @@ -896,7 +896,7 @@ void BattlefieldWG::SendInitWorldStatesToAll() player->GetSession()->SendPacket(&data); } -void BattlefieldWG::BrokenWallOrTower(TeamId team) +void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/) { // might be some use for this in the future. old code commented out below. KL /* if (team == GetDefenderTeam()) diff --git a/src/tools/vmap4_extractor/mpq_libmpq04.h b/src/tools/vmap4_extractor/mpq_libmpq04.h index ed51022de78..89f715e9e87 100644 --- a/src/tools/vmap4_extractor/mpq_libmpq04.h +++ b/src/tools/vmap4_extractor/mpq_libmpq04.h @@ -24,7 +24,7 @@ public: void close(); void GetFileListTo(vector& filelist) { - uint32 filenum; + uint32_t filenum; if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; libmpq__off_t size, transferred; libmpq__file_unpacked_size(mpq_a, filenum, &size); @@ -60,8 +60,8 @@ class MPQFile libmpq__off_t pointer,size; // disable copying - MPQFile(const MPQFile &f) {} - void operator=(const MPQFile &f) {} + MPQFile(const MPQFile& /*f*/) {} + void operator=(const MPQFile& /*f*/) {} public: MPQFile(const char* filename); // filenames are not case sensitive -- cgit v1.2.3 From 9df6c4dd70a167fb8a52dd440bacf765609fcd6b Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 20 Aug 2012 23:12:31 +0200 Subject: Fix more non PCH build --- src/server/scripts/Northrend/wintergrasp.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index eba5b7f69d4..99152050a1b 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -22,6 +22,7 @@ #include "ObjectMgr.h" #include "Vehicle.h" #include "GameObjectAI.h" +#include "ScriptedGossip.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." -- cgit v1.2.3 From d11e71b098740d1a14b60f380cde13600b7ae564 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 20 Aug 2012 23:37:33 +0200 Subject: Fix more non PCH build and code style --- src/server/game/Battlefield/Zones/BattlefieldWG.h | 8 +++++--- src/server/scripts/Northrend/wintergrasp.cpp | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 738d82135d2..97807eb989c 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -171,7 +171,7 @@ enum WGGraveyardId BATTLEFIELD_WG_GRAVEYARD_MAX, }; -enum eWGGossipText +enum WGGossipText { BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502, @@ -231,12 +231,14 @@ struct BfWGCoordGY TeamId startcontrol; }; -const uint32 WGQuest[2][6] = { +uint32 const WGQuest[2][6] = +{ { 13186, 13181, 13222, 13538, 13177, 13179 }, { 13185, 13183, 13223, 13539, 13178, 13180 }, }; // 7 in sql, 7 in header -const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = { +BfWGCoordGY const WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = +{ { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL }, { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL }, { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL }, diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 99152050a1b..37994e40b63 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -22,14 +22,16 @@ #include "ObjectMgr.h" #include "Vehicle.h" #include "GameObjectAI.h" +#include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "SpellScript.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." #define GOSSIP_HELLO_DEMO3 "Build siege engine." #define GOSSIP_HELLO_DEMO4 "I cannot build more!" -enum eWGqueuenpctext +enum WGqueuenpctext { WG_NPCQUEUE_TEXT_H_NOWAR = 14775, WG_NPCQUEUE_TEXT_H_QUEUE = 14790, @@ -99,7 +101,8 @@ enum QuestIds uint8 const MAX_WINTERGRASP_VEHICLES = 4; -uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = { +uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = +{ NPC_WINTERGRASP_CATAPULT, NPC_WINTERGRASP_DEMOLISHER, NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE, @@ -136,7 +139,7 @@ class npc_wg_demolisher_engineer : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */, uint32 action) { player->CLOSE_GOSSIP_MENU(); -- cgit v1.2.3 From 542521a026031764ddd98518e7f5bdab91bc0ebb Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 20 Aug 2012 23:42:33 +0100 Subject: Scripts/Achievements: Remove a duplicated achievement script --- src/server/scripts/World/achievement_scripts.cpp | 25 ------------------------ 1 file changed, 25 deletions(-) (limited to 'src') diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index 3dc737f0c95..60572ee3e6a 100755 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -235,30 +235,6 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript } }; -class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript -{ -public: - achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { } - - bool OnCheck(Player* source, Unit* target) - { - if (!target) - return false; - - if (Player* victim = target->ToPlayer()) - { - if (!victim->IsMounted()) - return false; - - if (Vehicle* vehicle = source->GetVehicle()) - if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon - return true; - } - - return false; - } -}; - class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript { public: @@ -344,7 +320,6 @@ void AddSC_achievement_scripts() new achievement_bg_ic_mowed_down(); new achievement_bg_sa_artillery(); new achievement_sickly_gazelle(); - new achievement_wg_didnt_stand_a_chance(); new achievement_everything_counts(); new achievement_bg_av_perfection(); new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2); -- cgit v1.2.3 From a84ac50f1cdfc45c30cdbcd25d8bd2416393e7a0 Mon Sep 17 00:00:00 2001 From: Stalker-Riddick Date: Tue, 21 Aug 2012 15:19:23 +0100 Subject: Core/Scripts: Improvements to Trial of the Crusader *Fixed creature_text errors. *Icehowl now works properly *Fixed waypoints so creatures don't enter the arena through the wall, Lich King now spawns at a proper place, after you start a new fight corpse of a the previous boss despawns (chest also after you start valkyries). Closes #7415 --- .../world/2012_08_16_00_world_creature_template.sql | 3 +++ .../TrialOfTheCrusader/boss_anubarak_trial.cpp | 12 ++++++------ .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 14 +++++++------- .../TrialOfTheCrusader/boss_northrend_beasts.cpp | 16 +++++++++++++--- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 6 +++--- .../instance_trial_of_the_crusader.cpp | 11 +++++++++++ .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 2 +- .../TrialOfTheCrusader/trial_of_the_crusader.h | 4 ++-- 8 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 sql/updates/world/2012_08_16_00_world_creature_template.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_16_00_world_creature_template.sql b/sql/updates/world/2012_08_16_00_world_creature_template.sql new file mode 100644 index 00000000000..732f647d7b7 --- /dev/null +++ b/sql/updates/world/2012_08_16_00_world_creature_template.sql @@ -0,0 +1,3 @@ +-- Added trigger flags to triggers +UPDATE `creature_template` SET `flags_extra` = flags_extra | 128 WHERE `entry` = 34862; +UPDATE `creature_template` SET `unit_flags` = unit_flags | 256 WHERE `entry` = 34862; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 1019deac106..89fdcc7f725 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -207,7 +207,7 @@ public: { if (!m_bIntro) { - DoScriptText(SAY_INTRO, me); + Talk(SAY_INTRO); m_bIntro = false; } } @@ -225,7 +225,7 @@ public: void JustDied(Unit* /*killer*/) { Summons.DespawnAll(); - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(TYPE_ANUBARAK, DONE); } @@ -242,7 +242,7 @@ public: break; case NPC_SPIKE: summoned->CombatStart(target); - DoScriptText(EMOTE_SPIKE, me, target); + Talk(EMOTE_SPIKE, target->GetGUID()); break; } Summons.Summon(summoned); @@ -260,7 +260,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetInCombatWithZone(); if (instance) @@ -405,8 +405,8 @@ public: { m_bReachedPhase3 = true; DoCastAOE(SPELL_LEECHING_SWARM); - DoScriptText(EMOTE_LEECHING_SWARM, me); - DoScriptText(SAY_LEECHING_SWARM, me); + Talk(EMOTE_LEECHING_SWARM); + Talk(SAY_LEECHING_SWARM); } if (m_uiBerserkTimer <= uiDiff && !me->HasAura(SPELL_BERSERK)) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index f9e2080895a..10f7150351e 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -161,7 +161,7 @@ public: void JustDied(Unit* /*killer*/) { Summons.DespawnAll(); - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(TYPE_JARAXXUS, DONE); } @@ -176,7 +176,7 @@ public: me->SetInCombatWithZone(); if (instance) instance->SetData(TYPE_JARAXXUS, IN_PROGRESS); - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 uiDiff) @@ -186,8 +186,8 @@ public: if (m_uiSummonInfernalEruptionTimer <= uiDiff) { - DoScriptText(EMOTE_INFERNAL_ERUPTION, me); - DoScriptText(SAY_INFERNAL_ERUPTION, me); + Talk(EMOTE_INFERNAL_ERUPTION); + Talk(SAY_INFERNAL_ERUPTION); DoCast(SPELL_INFERNAL_ERUPTION); m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS; } else m_uiSummonInfernalEruptionTimer -= uiDiff; @@ -217,8 +217,8 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true)) { - DoScriptText(EMOTE_INCINERATE, me, target); - DoScriptText(SAY_INCINERATE, me); + Talk(EMOTE_INCINERATE, target->GetGUID()); + Talk(SAY_INCINERATE); DoCast(target, SPELL_INCINERATE_FLESH); } m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); @@ -234,7 +234,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true)) { - DoScriptText(EMOTE_LEGION_FLAME, me, target); + Talk(EMOTE_LEGION_FLAME, target->GetGUID()); DoCast(target, SPELL_LEGION_FLAME); } m_uiLegionFlameTimer = 30*IN_MILLISECONDS; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 8dd4f7dad3e..506467be8a5 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -905,6 +905,8 @@ public: if (m_uiMassiveCrashTimer <= diff) { me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room + SetCombatMovement(false); + me->AttackStop(); m_uiStage = 7; //Invalid (Do nothing more than move) m_uiMassiveCrashTimer = 30*IN_MILLISECONDS; } else m_uiMassiveCrashTimer -= diff; @@ -913,22 +915,28 @@ public: break; case 1: DoCastAOE(SPELL_MASSIVE_CRASH); + me->StopMoving(); + me->AttackStop(); m_uiStage = 2; break; case 2: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) { + me->StopMoving(); + me->AttackStop(); m_uiTrampleTargetGUID = target->GetGUID(); me->SetTarget(m_uiTrampleTargetGUID); m_bTrampleCasted = false; - SetCombatMovement(false); - me->GetMotionMaster()->MoveIdle(); + //SetCombatMovement(false); + //me->GetMotionMaster()->MoveIdle(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_uiTrampleTimer = 4*IN_MILLISECONDS; m_uiStage = 3; } else m_uiStage = 6; break; case 3: + me->StopMoving(); + me->AttackStop(); if (m_uiTrampleTimer <= diff) { if (Unit* target = Unit::GetPlayer(*me, m_uiTrampleTargetGUID)) @@ -941,12 +949,14 @@ public: me->GetMotionMaster()->MoveJump(2*me->GetPositionX()-m_fTrampleTargetX, 2*me->GetPositionY()-m_fTrampleTargetY, me->GetPositionZ(), - 10.0f, 20.0f); // 2: Hop Backwards + 20.0f, 30.0f); // 2: Hop Backwards m_uiStage = 7; //Invalid (Do nothing more than move) } else m_uiStage = 6; } else m_uiTrampleTimer -= diff; break; case 4: + me->StopMoving(); + me->AttackStop(); Talk(EMOTE_TRAMPLE_START, m_uiTrampleTargetGUID); me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1); me->SetTarget(0); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 203e49420be..a65eaebbc0c 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -254,7 +254,7 @@ struct boss_twin_baseAI : public ScriptedAI void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) { if (Creature* pSister = GetSister()) @@ -296,7 +296,7 @@ struct boss_twin_baseAI : public ScriptedAI instance->SetData(TYPE_VALKIRIES, IN_PROGRESS); } - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); DoCast(me, m_uiSurgeSpellId); } @@ -384,7 +384,7 @@ struct boss_twin_baseAI : public ScriptedAI if (!m_bIsBerserk && m_uiBerserkTimer <= uiDiff) { DoCast(me, SPELL_BERSERK); - DoScriptText(SAY_BERSERK, me); + Talk(SAY_BERSERK); m_bIsBerserk = true; } else diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 3fb76ea52dc..9767126371b 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -244,10 +244,18 @@ class instance_trial_of_the_crusader : public InstanceMapScript switch (type) { case TYPE_JARAXXUS: + // Cleanup Icehowl + if (Creature* icehowl = instance->GetCreature(IcehowlGUID)) + icehowl->DespawnOrUnsummon(); if (data == DONE) EventStage = 2000; break; case TYPE_CRUSADERS: + // Cleanup Jaraxxus + if (Creature* jaraxxus = instance->GetCreature(JaraxxusGUID)) + jaraxxus->DespawnOrUnsummon(); + if (Creature* fizzlebang = instance->GetCreature(FizzlebangGUID)) + fizzlebang->DespawnOrUnsummon(); switch (data) { case IN_PROGRESS: @@ -267,6 +275,9 @@ class instance_trial_of_the_crusader : public InstanceMapScript } break; case TYPE_VALKIRIES: + // Cleanup chest + if (GameObject* cache = instance->GetGameObject(CrusadersCacheGUID)) + cache->Delete(); switch (data) { case FAIL: 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 7064368f090..37d08484f0b 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -789,7 +789,7 @@ class npc_tirion_toc : public CreatureScript case 5005: m_uiUpdateTimer = 8000; instance->SetData(TYPE_EVENT, 5010); - me->SummonCreature(NPC_LICH_KING_1, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5); + me->SummonCreature(NPC_LICH_KING_1, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5); break; case 5020: Talk(SAY_STAGE_4_03); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index f361c3521d1..ba230551b24 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -53,8 +53,8 @@ const Position ToCCommonLoc[]= {563.833008f, 195.244995f, 394.585561f, 0}, // 5 - Center {573.5f, 180.5f, 395.14f, 0}, // 6 Move 0 Right {553.5f, 180.5f, 395.14f, 0}, // 7 Move 0 Left - {585.5f, 170.0f, 395.14f, 0}, // 8 Move 1 Right - {545.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left + {573.0f, 170.0f, 395.14f, 0}, // 8 Move 1 Right + {555.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left {563.8f, 216.1f, 395.1f, 0}, // 10 Behind the door {575.042358f, 195.260727f, 395.137146f, 0}, // 5 -- cgit v1.2.3 From e2ffa4188460c8a33a24f40a82f299f53708cace Mon Sep 17 00:00:00 2001 From: Faq Date: Tue, 21 Aug 2012 15:24:00 +0100 Subject: Core/Spells: Fix Librams/Idol Libram of Light http://wotlk.openwow.com/?item=23006 Libram of Divinity http://wotlk.openwow.com/?item=23201 Blessed Book of Nagrand http://wotlk.openwow.com/?item=25644 Idol of the Flourishing Life http://wotlk.openwow.com/?item=46138 Libram of the Lightbringer http://wotlk.openwow.com/?item=28296 Libram of Tolerance http://wotlk.openwow.com/?item=40268 Libram of the Resolute http://wotlk.openwow.com/?item=45436 Closes #7271 Closes #6020 --- src/server/game/Spells/SpellMgr.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 9545a03a9f4..5493f1a2649 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3243,6 +3243,22 @@ void SpellMgr::LoadDbcDataCorrections() // this needs research on modifier applying rules, does not seem to be in Attributes fields spellInfo->EffectSpellClassMask[0] = flag96(0x00000040, 0x00000000, 0x00000000); break; + case 64949: // Idol of the Flourishing Life + spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x00000000, 0x02000000, 0x00000000); + spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER; + break; + case 34231: // Libram of the Lightbringer + case 60792: // Libram of Tolerance + case 64956: // Libram of the Resolute + spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x80000000, 0x00000000, 0x00000000); + spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER; + break; + case 28851: // Libram of Light + case 28853: // Libram of Divinity + case 32403: // Blessed Book of Nagrand + spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x40000000, 0x00000000, 0x00000000); + spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER; + break; case 45602: // Ride Carpet spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)" break; -- cgit v1.2.3 From 129e0e2f4937cf16cbdff4c331f3a598108e1116 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 21 Aug 2012 16:30:47 +0200 Subject: Core/Misc: Add missing cmake for cs_bf.cpp --- src/server/scripts/Commands/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index bd439c2c473..d5ebeab3b8a 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -13,6 +13,7 @@ set(scripts_STAT_SRCS Commands/cs_account.cpp Commands/cs_achievement.cpp Commands/cs_ban.cpp + Commands/cs_bf.cpp Commands/cs_cast.cpp Commands/cs_character.cpp Commands/cs_debug.cpp -- cgit v1.2.3 From d22c82332bd01921889dff9a3aa583ae32368e41 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 21 Aug 2012 16:56:01 +0200 Subject: Core/Misc: * Add missing script loader for bf commandscript (thx Geodar) * Add missing Wintergrasp worldserver config --- src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/worldserver/worldserver.conf.dist | 57 ++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) (limited to 'src') diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 0c6948160eb..9d983542fea 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -47,6 +47,7 @@ void AddSC_SmartSCripts(); void AddSC_account_commandscript(); void AddSC_achievement_commandscript(); void AddSC_ban_commandscript(); +void AddSC_bf_commandscript(); void AddSC_cast_commandscript(); void AddSC_character_commandscript(); void AddSC_debug_commandscript(); @@ -662,6 +663,7 @@ void AddCommandScripts() AddSC_account_commandscript(); AddSC_achievement_commandscript(); AddSC_ban_commandscript(); + AddSC_bf_commandscript(); AddSC_cast_commandscript(); AddSC_character_commandscript(); AddSC_debug_commandscript(); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 133fdff3dd0..7724f9af081 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -20,6 +20,7 @@ # SERVER RATES # AUTO BROADCAST # BATTLEGROUND CONFIG +# BATTLEFIELD CONFIG # ARENA CONFIG # NETWORK CONFIG # CONSOLE AND REMOTE ACCESS @@ -2183,6 +2184,62 @@ Battleground.Random.ResetHour = 6 # ################################################################################################### +################################################################################################### +# BATTLEFILED CONFIG +# +# Wintergrasp.Enable +# Description: Enable the Wintergrasp battlefield. +# Default: 0 - (Disabled) +# 1 - (Enabled, Experimental as of still being in development) + +Wintergrasp.Enable = 0 + +# +# Wintergrasp.PlayerMax +# Description: Maximum number of players allowed in Wintergrasp. +# Default: 100 + +Wintergrasp.PlayerMax = 100 + +# +# Wintergrasp.PlayerMin +# Description: Minimum number of players required for Wintergrasp. +# Default: 0 + +Wintergrasp.PlayerMin = 0 + +# +# Wintergrasp.PlayerMinLvl +# Description: Required character level for the Wintergrasp battle. +# Default: 77 + +Wintergrasp.PlayerMinLvl = 77 + +# +# Wintergrasp.BattleTimer +# Description: Time (in minutes) for the Wintergrasp battle to last. +# Default: 30 + +Wintergrasp.BattleTimer = 30 + +# +# Wintergrasp.NoBattleTimer +# Description: Time (in minutes) between Wintergrasp battles. +# Default: 150 + +Wintergrasp.NoBattleTimer = 150 + +# +# Wintergrasp.CrashRestartTimer +# Description: Time (in minutes) to delay the restart of Wintergrasp if the world server +# crashed during a running battle. +# Default: 10 + +Wintergrasp.CrashRestartTimer = 10 + +# +################################################################################################### + ################################################################################################### # ARENA CONFIG # -- cgit v1.2.3 From 7ccd254fdc3911f75f67c23da62576e32f936ac1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 21 Aug 2012 17:45:10 +0200 Subject: Scripts/Commands: Added .quest reward command - this will reward player's quest, similar to finishing it at quest ender, requires quest to be completed, rewards all items and first choice item (if quest has choice rewards) --- sql/updates/world/2012_08_21_01_world_command.sql | 3 +++ src/server/scripts/Commands/cs_quest.cpp | 33 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 sql/updates/world/2012_08_21_01_world_command.sql (limited to 'src') diff --git a/sql/updates/world/2012_08_21_01_world_command.sql b/sql/updates/world/2012_08_21_01_world_command.sql new file mode 100644 index 00000000000..df833d2d246 --- /dev/null +++ b/sql/updates/world/2012_08_21_01_world_command.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE name='quest reward'; +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('quest reward',3,'Syntax: .quest reward #questId\n\n\Grants quest reward to selected player and removes quest from his log (quest must be in completed state).'); diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 2472a29e595..b17b18a65d2 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -38,6 +38,7 @@ public: { "add", SEC_ADMINISTRATOR, false, &HandleQuestAdd, "", NULL }, { "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL }, { "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL }, + { "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = @@ -244,6 +245,38 @@ public: player->CompleteQuest(entry); return true; } + + static bool HandleQuestReward(ChatHandler* handler, char const* args) + { + Player* player = handler->getSelectedPlayer(); + if (!player) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + // .quest reward #entry + // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r + char* cId = handler->extractKeyFromLink((char*)args, "Hquest"); + if (!cId) + return false; + + uint32 entry = atol(cId); + + Quest const* quest = sObjectMgr->GetQuestTemplate(entry); + + // If player doesn't have the quest + if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE) + { + handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry); + handler->SetSentErrorMessage(true); + return false; + } + + player->RewardQuest(quest, 0, player); + return true; + } }; void AddSC_quest_commandscript() -- cgit v1.2.3 From 7dc26c7ff7a9dd7987866d75cd990fdeb5817a40 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 21 Aug 2012 18:20:42 +0200 Subject: Core/Misc: Warning fixes --- src/server/authserver/Main.cpp | 16 +++++++++++----- src/server/scripts/Commands/cs_quest.cpp | 2 +- src/server/worldserver/Master.cpp | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index f5a3c7cf7e1..b938706a0be 100755 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -141,10 +141,16 @@ extern int main(int argc, char **argv) // Launch the listening network socket RealmAcceptor acceptor; - uint16 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724); + int32 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724); + if (rmport < 0 || rmport > 0xFFFF) + { + sLog->outError(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)"); + return 1; + } + std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0"); - ACE_INET_Addr bind_addr(rmport, bind_ip.c_str()); + ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str()); if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) { @@ -238,14 +244,14 @@ bool StartDB() return false; } - uint8 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1); + int32 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1); if (worker_threads < 1 || worker_threads > 32) { sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); worker_threads = 1; } - uint8 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1); + int32 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1); if (synch_threads < 1 || synch_threads > 32) { sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); @@ -253,7 +259,7 @@ bool StartDB() } // NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever. - if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads)) + if (!LoginDatabase.Open(dbstring.c_str(), uint8(worker_threads), uint8(synch_threads))) { sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot connect to database"); return false; diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index b17b18a65d2..7e489a5781e 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -78,7 +78,7 @@ public: // check item starting quest (it can work incorrectly if added without item in inventory) ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore(); - ItemTemplateContainer::const_iterator result = find_if (itc->begin(), itc->end(), Finder(entry, &ItemTemplate::StartQuest)); + ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder(entry, &ItemTemplate::StartQuest)); if (result != itc->end()) { diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 48e07c727b4..7587a9d1904 100755 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -240,7 +240,7 @@ int Master::Run() if (ConfigMgr::GetBoolDefault("SOAP.Enabled", false)) { TCSoapRunnable* runnable = new TCSoapRunnable(); - runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), ConfigMgr::GetIntDefault("SOAP.Port", 7878)); + runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(ConfigMgr::GetIntDefault("SOAP.Port", 7878))); soap_thread = new ACE_Based::Thread(runnable); } -- cgit v1.2.3 From 9f8ea0da1e7489f3b4cbfc46202909cbb0532637 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 21 Aug 2012 19:40:21 +0200 Subject: Core/Battlefield: * Update Logs filter * Fix typo in worldserver config (thx filo) * Fix some code style --- src/server/game/Battlefield/Battlefield.cpp | 16 +++++----- .../game/Battlefield/Zones/BattlefieldWG.cpp | 4 +-- src/server/game/Battlefield/Zones/BattlefieldWG.h | 5 ++-- src/server/scripts/Northrend/wintergrasp.cpp | 35 ++++++++++------------ src/server/worldserver/worldserver.conf.dist | 2 +- 5 files changed, 29 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index cdb8e1999fe..227686342dd 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -263,7 +263,7 @@ void Battlefield::InvitePlayerToWar(Player* player) { if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0) m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; - return; + return; } // Check if player is not already in war @@ -280,7 +280,7 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL)) StalkerGuid = creature->GetGUID(); else - sLog->outError(LOG_FILTER_GENERAL, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); } void Battlefield::KickAfkPlayers() @@ -587,10 +587,10 @@ BfGraveyard* Battlefield::GetGraveyardById(uint32 id) if (m_GraveyardList[id]) return m_GraveyardList[id]; else - sLog->outError(LOG_FILTER_GENERAL, "Battlefield::GetGraveyardById Id:%u not existed", id); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u not existed", id); } else - sLog->outError(LOG_FILTER_GENERAL, "Battlefield::GetGraveyardById Id:%u cant be found", id); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u cant be found", id); return NULL; } @@ -684,7 +684,7 @@ void BfGraveyard::SetSpirit(Creature* spirit, TeamId team) { if (!spirit) { - sLog->outError(LOG_FILTER_GENERAL, "BfGraveyard::SetSpirit: Invalid Spirit."); + sLog->outError(LOG_FILTER_BATTLEFIELD, "BfGraveyard::SetSpirit: Invalid Spirit."); return; } @@ -798,14 +798,14 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId)); if (!map) { - sLog->outError(LOG_FILTER_GENERAL, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); return 0; } Creature* creature = new Creature; if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { - sLog->outError(LOG_FILTER_GENERAL, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; return NULL; } @@ -1066,7 +1066,7 @@ bool BfCapturePoint::Update(uint32 diff) if (m_OldState != m_State) { - //sLog->outError(LOG_FILTER_GENERAL, "%u->%u", m_OldState, m_State); + //sLog->outError(LOG_FILTER_BATTLEFIELD, "%u->%u", m_OldState, m_State); if (oldTeam != m_team) ChangeTeam(oldTeam); return true; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 48d6b59d007..8e58dcdc5c0 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -238,7 +238,7 @@ void BattlefieldWG::OnBattleStart() m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } else - sLog->outError(LOG_FILTER_GENERAL, "WG: Failed to spawn titan relic."); + sLog->outError(LOG_FILTER_BATTLEFIELD, "WG: Failed to spawn titan relic."); // Update tower visibility and update faction @@ -490,7 +490,7 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) case AREA_THE_CHILLED_QUAGMIRE: return BATTLEFIELD_WG_GY_HORDE; default: - sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); + sLog->outError(LOG_FILTER_BATTLEFIELD, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); break; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 97807eb989c..34912f0ddbc 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -151,7 +151,7 @@ enum WintergraspAreaIds class BfGraveyardWG : public BfGraveyard { public: - BfGraveyardWG(BattlefieldWG *Bf); + BfGraveyardWG(BattlefieldWG* Bf); void SetTextId(uint32 textid) { m_GossipTextId = textid; } uint32 GetTextId() { return m_GossipTextId; } @@ -841,7 +841,8 @@ struct WintergraspTowerData uint8 const WG_MAX_ATTACKTOWERS = 3; // 192414 : 0 in sql, 1 in header // 192278 : 0 in sql, 3 in header -const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { +const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = +{ // West tower { 190356, diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 37994e40b63..fc967acf9e2 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -139,7 +139,7 @@ class npc_wg_demolisher_engineer : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -207,7 +207,7 @@ class npc_wg_spirit_guide : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action) + bool OnGossipSelect(Player* player, Creature* /*creature*/ , uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -225,17 +225,16 @@ class npc_wg_spirit_guide : public CreatureScript struct npc_wg_spirit_guideAI : public ScriptedAI { - npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) - { } + npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) { } - void UpdateAI(const uint32 /* diff */) + void UpdateAI(uint32 const /*diff*/) { if (!me->HasUnitState(UNIT_STATE_CASTING)) DoCast(me, SPELL_CHANNEL_SPIRIT_HEAL); } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_wg_spirit_guideAI(creature); } @@ -258,7 +257,7 @@ class npc_wg_queue : public CreatureScript if (wintergrasp->IsWarTime()) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); + player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); } else { @@ -275,7 +274,7 @@ class npc_wg_queue : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action*/) + bool OnGossipSelect(Player* player, Creature* /*creature*/ , uint32 /*sender*/ , uint32 /*action*/) { player->CLOSE_GOSSIP_MENU(); @@ -302,9 +301,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript struct go_wg_vehicle_teleporterAI : public GameObjectAI { - go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject), - _checkTimer(1000) - { } + go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject), _checkTimer(1000) { } void UpdateAI(uint32 diff) { @@ -324,6 +321,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript } else _checkTimer -= diff; } + private: uint32 _checkTimer; }; @@ -358,12 +356,12 @@ class npc_wg_quest_giver : public CreatureScript for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i) { - uint32 quest_id = i->second; - QuestStatus status = player->GetQuestStatus(quest_id); + uint32 questId = i->second; + QuestStatus status = player->GetQuestStatus(questId); if (status == QUEST_STATUS_COMPLETE) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_INCOMPLETE) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); //else if (status == QUEST_STATUS_AVAILABLE) // qm.AddMenuItem(quest_id, 2); } @@ -549,17 +547,14 @@ public: } }; - - void AddSC_wintergrasp() { new npc_wg_queue(); new npc_wg_spirit_guide(); new npc_wg_demolisher_engineer(); + new go_wg_vehicle_teleporter(); new npc_wg_quest_giver(); - new achievement_wg_didnt_stand_a_chance(); new spell_wintergrasp_force_building(); new spell_wintergrasp_grab_passenger(); - - new go_wg_vehicle_teleporter(); + new achievement_wg_didnt_stand_a_chance(); } diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 7724f9af081..f1ca090a6ec 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2185,7 +2185,7 @@ Battleground.Random.ResetHour = 6 ################################################################################################### ################################################################################################### -# BATTLEFILED CONFIG +# BATTLEFIELD CONFIG # # Wintergrasp.Enable # Description: Enable the Wintergrasp battlefield. -- cgit v1.2.3 From 910755bbb3455abc7ef1c04387d79babe05c212f Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 21 Aug 2012 20:17:20 +0200 Subject: Core/Battlefield: Fix more codestyle --- src/server/game/Battlefield/Battlefield.cpp | 2 +- src/server/game/Battlefield/Zones/BattlefieldWG.h | 83 ++++++++++++----------- src/server/game/World/World.cpp | 2 +- 3 files changed, 45 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 227686342dd..7a09420acb6 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -263,7 +263,7 @@ void Battlefield::InvitePlayerToWar(Player* player) { if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0) m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; - return; + return; } // Check if player is not already in war diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 34912f0ddbc..924ff1ad454 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -26,11 +26,11 @@ #include "GroupMgr.h" #include "Battlefield.h" -const uint32 VehNumWorldState[2] = { 3680, 3490 }; -const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; -const uint32 ClockWorldState[2] = { 3781, 4354 }; -const uint32 WintergraspFaction[3] = { 1, 2, 35 }; -const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; +uint32 const VehNumWorldState[2] = { 3680, 3490 }; +uint32 const MaxVehNumWorldState[2] = { 3681, 3491 }; +uint32 const ClockWorldState[2] = { 3781, 4354 }; +uint32 const WintergraspFaction[3] = { 1, 2, 35 }; +float const WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; class BattlefieldWG; class WintergraspCapturePoint; @@ -81,11 +81,11 @@ enum WintergraspSpells SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730, // Phasing spells - SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618,// ADDS PHASE 16 - SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617,// ADDS PHASE 32 + SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618, // ADDS PHASE 16 + SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617, // ADDS PHASE 32 - SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64 - SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128 + SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773, // ADDS PHASE 64 + SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774, // ADDS PHASE 128 }; enum WintergraspData @@ -189,9 +189,9 @@ enum WintergraspNpcs BATTLEFIELD_WG_NPC_STALKER = 15214, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102, - BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296,// - BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101,// - BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173,// + BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296, // + BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101, // + BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173, // BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH = 31091, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH = 31151, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106, @@ -199,17 +199,17 @@ enum WintergraspNpcs BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052, - BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294,// - BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051,// - BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172,// + BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294, // + BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051, // + BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172, // BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH = 31036, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS = 31153, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109, - NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp - NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp + NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp + NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp NPC_TOWER_CANNON = 28366, NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312, @@ -434,14 +434,14 @@ class BattlefieldWG : public Battlefield GameObject* m_titansRelic; }; -const uint32 NORTHREND_WINTERGRASP = 4197; -const uint8 WG_MAX_OBJ = 32; -const uint8 WG_KEEPGAMEOBJECT_MAX = 44; -const uint8 WG_MAX_TURRET = 15; -const uint8 WG_MAX_KEEP_NPC = 39; -const uint8 WG_MAX_OUTSIDE_NPC = 14; -const uint8 WG_OUTSIDE_ALLIANCE_NPC = 7; -const uint8 WG_MAX_TELEPORTER = 12; +uint32 const NORTHREND_WINTERGRASP = 4197; +uint8 const WG_MAX_OBJ = 32; +uint8 const WG_KEEPGAMEOBJECT_MAX = 44; +uint8 const WG_MAX_TURRET = 15; +uint8 const WG_MAX_KEEP_NPC = 39; +uint8 const WG_MAX_OUTSIDE_NPC = 14; +uint8 const WG_OUTSIDE_ALLIANCE_NPC = 7; +uint8 const WG_MAX_TELEPORTER = 12; enum WintergraspGameObjectBuildingType { @@ -479,15 +479,15 @@ enum WintergraspWorkshopIds enum WintergraspWorldstates { - WORLDSTATE_WORKSHOP_NE = 3701, - WORLDSTATE_WORKSHOP_NW = 3700, - WORLDSTATE_WORKSHOP_SE = 3703, - WORLDSTATE_WORKSHOP_SW = 3702, - WORLDSTATE_WORKSHOP_K_W = 3698, - WORLDSTATE_WORKSHOP_K_E = 3699 + WORLDSTATE_WORKSHOP_NE = 3701, + WORLDSTATE_WORKSHOP_NW = 3700, + WORLDSTATE_WORKSHOP_SE = 3703, + WORLDSTATE_WORKSHOP_SW = 3702, + WORLDSTATE_WORKSHOP_K_W = 3698, + WORLDSTATE_WORKSHOP_K_E = 3699 }; -enum eWGTeamControl +enum WintergraspTeamControl { BATTLEFIELD_WG_TEAM_ALLIANCE, BATTLEFIELD_WG_TEAM_HORDE, @@ -495,7 +495,7 @@ enum eWGTeamControl }; // TODO: Handle this with creature_text ? -enum eWGText +enum WintergraspText { BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052, @@ -567,7 +567,8 @@ struct WintergraspBuildingSpawnData uint32 nameId; }; -const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = { +const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = +{ // Wall (Not spawned in db) // Entry WS X Y Z O type NameID { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, @@ -659,7 +660,8 @@ const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = { // 192357 : 1 in sql, 1 in header // 192350 : 1 in sql, 1 in header // 192351 : 1 in sql, 1 in header -const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { +const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = +{ { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect @@ -706,7 +708,8 @@ const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect }; -const Position WGTurret[WG_MAX_TURRET] = { +const Position WGTurret[WG_MAX_TURRET] = +{ { 5391.19f, 3060.8f, 419.616f, 1.69557f }, { 5266.75f, 2976.5f, 421.067f, 3.20354f }, { 5234.86f, 2948.8f, 420.88f, 1.61311f }, @@ -1129,7 +1132,7 @@ const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] = // Structure for different buildings that can be destroyed during battle struct BfWGGameObjectBuilding { - BfWGGameObjectBuilding(BattlefieldWG *WG) + BfWGGameObjectBuilding(BattlefieldWG* WG) { m_WG = WG; m_Team = 0; @@ -1144,7 +1147,7 @@ struct BfWGGameObjectBuilding uint8 m_Team; // WG object - BattlefieldWG *m_WG; + BattlefieldWG* m_WG; // Linked gameobject GameObject* m_Build; @@ -1255,7 +1258,7 @@ struct BfWGGameObjectBuilding m_WG->BrokenWallOrTower(TeamId(m_Team)); } - void Init(GameObject *go, uint32 type, uint32 worldstate, uint32 nameid) + void Init(GameObject* go, uint32 type, uint32 worldstate, uint32 nameid) { // GameObject associated to object m_Build = go; @@ -1613,7 +1616,7 @@ struct WintergraspWorkshopData GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message - WintergraspWorkshopData(BattlefieldWG * WG) + WintergraspWorkshopData(BattlefieldWG* WG) { m_WG = WG; m_Build = NULL; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index d860530d97d..f3ff4d79d4a 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1731,7 +1731,7 @@ void World::SetInitialWorldSettings() sOutdoorPvPMgr->InitOutdoorPvP(); ///- Initialize Battlefield - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battlefield System"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battlefield System"); sBattlefieldMgr->InitBattlefield(); sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); -- cgit v1.2.3 From 984493108bf27b2be76d72efea6c3926aec8dc05 Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 21 Aug 2012 22:12:55 +0200 Subject: Core/Logging: Fix incorrect error level for some warden messages Core/Logging: Fix incorrect filter type for many network messages Core/Logging: Use OPCODE filter type for network messages related to wrong packets --- src/server/authserver/authserver.conf.dist | 4 +- src/server/game/Achievements/AchievementMgr.cpp | 4 +- src/server/game/Battlegrounds/ArenaTeam.cpp | 2 +- src/server/game/Handlers/AuctionHouseHandler.cpp | 4 +- src/server/game/Handlers/MailHandler.cpp | 6 +- src/server/game/Server/Protocol/Opcodes.h | 8 +++ src/server/game/Server/WorldSession.cpp | 79 ++++++++++---------- src/server/game/Server/WorldSession.h | 4 +- src/server/game/Server/WorldSocket.cpp | 91 +++++++++++------------- src/server/game/Warden/Warden.cpp | 5 +- src/server/game/Warden/WardenMac.cpp | 4 +- src/server/game/Warden/WardenWin.cpp | 16 ++--- src/server/scripts/Commands/cs_ban.cpp | 4 +- src/server/worldserver/worldserver.conf.dist | 4 +- 14 files changed, 112 insertions(+), 123 deletions(-) (limited to 'src') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 9a4beca9bf6..ee7e5970155 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -205,8 +205,8 @@ LoginDatabase.WorkerThreads = 1 # w - (Overwrite) # -Appender.Console=1,2,6 -Appender.Auth=2,2,7,Auth.log,w +Appender.Console=1,2,0 +Appender.Auth=2,2,0,Auth.log,w # LogLevel # 0 - (Disabled) diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index c607132dfe1..506495469d3 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -391,14 +391,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un Map* map = source->GetMap(); if (!map->IsDungeon()) { - sLog->outError(LOG_FILTER_SQL, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u", + sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u", ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); return false; } InstanceScript* instance = ((InstanceMap*)map)->GetInstanceScript(); if (!instance) { - sLog->outError(LOG_FILTER_SQL, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script", + sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script", ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); return false; } diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index b9ddabcf254..61b15bdd182 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -343,7 +343,7 @@ 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()); diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 10a130536c9..2ebcbce0661 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -247,7 +247,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)", - GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount()); + GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount()); } AH->item_guidlow = item->GetGUIDLow(); @@ -293,7 +293,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)", - GetPlayerName(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount()); + GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount()); } AH->item_guidlow = newItem->GetGUIDLow(); diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 2cf27140720..ae04444a118 100755 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -264,7 +264,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)", - GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account); + GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account); } item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable @@ -284,7 +284,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)", - GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account); + GetPlayerName().c_str(), GetAccountId(), money, receiver.c_str(), rc_account); } } @@ -479,7 +479,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data) sender_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN); } sLog->outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)", - GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId); + GetPlayerName().c_str(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId); } else if (!receive) sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(sender_guid); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 65e7b3597ce..d5b9dff4a89 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -1385,5 +1385,13 @@ inline const char* LookupOpcodeName(uint16 id) return "Received unknown opcode, it's more than max!"; return opcodeTable[id].name; } + +inline std::string GetOpcodeNameForLogging(uint16 opcode) +{ + std::ostringstream ss; + ss << '[' << LookupOpcodeName(opcode) << " 0x" << std::hex << std::uppercase << opcode << std::nouppercase << " (" << std::dec << opcode << ")]"; + return ss.str().c_str(); +} + #endif /// @} diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 118b0d68d5d..6a2c7e64446 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -137,16 +137,29 @@ WorldSession::~WorldSession() LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query } -void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const -{ - sLog->outError(LOG_FILTER_GENERAL, "Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt to crash server?), skipped", - GetAccountId(), LookupOpcodeName(packet.GetOpcode()), packet.GetOpcode(), packet.size(), size); -} - /// Get the player name -char const* WorldSession::GetPlayerName() const -{ - return GetPlayer() ? GetPlayer()->GetName() : ""; +std::string WorldSession::GetPlayerName(bool simple /* = true */) const + { + std::string name = "[Player: "; + uint32 guidLow = 0; + + if (Player* player = GetPlayer()) + { + name.append(player->GetName()); + guidLow = player->GetGUIDLow(); + } + else + name.append(""); + + if (!simple) + { + std::ostringstream ss; + ss << " (Guid: " << guidLow << ", Account: " << GetAccountId() << ")"; + name.append(ss.str()); + } + + name.append("]"); + return name; } /// Get player guid if available. Use for logging purposes only @@ -208,16 +221,15 @@ void WorldSession::QueuePacket(WorldPacket* new_packet) /// Logging helper for unexpected opcodes void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s", - GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "", - LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), status, 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()); } /// Logging helper for unexpected opcodes void WorldSession::LogUnprocessedTail(WorldPacket* packet) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)", - LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), uint32(packet->rpos()), uint32(packet->wpos())); + 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()); packet->print_storage(); } @@ -250,7 +262,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) { if (packet->GetOpcode() >= NUM_MSG_TYPES) { - sLog->outError(LOG_FILTER_GENERAL, "SESSION: received non-existed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); + sLog->outError(LOG_FILTER_OPCODES, "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() + , GetPlayerName(false).c_str()); sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet)); } else @@ -275,10 +288,9 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) deletePacket = false; QueuePacket(packet); //! Log - sLog->outDebug(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s (0x%.4X) with with status STATUS_LOGGEDIN. " - "Player is currently not in world yet.", opHandle.name, packet->GetOpcode()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s with with status STATUS_LOGGEDIN. " + "Player is currently not in world yet.", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()); } - } else if (_player->IsInWorld()) { @@ -334,14 +346,12 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) LogUnprocessedTail(packet); break; case STATUS_NEVER: - sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)", - GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "", - LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); + sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() + , GetPlayerName(false).c_str()); break; case STATUS_UNHANDLED: - sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not handled opcode %s (0x%.4X)", - GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "", - LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); + sLog->outDebug(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() + , GetPlayerName(false).c_str()); break; } } @@ -349,7 +359,6 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) { sLog->outError(LOG_FILTER_GENERAL, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); - sLog->outTrace(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); packet->hexlike(); } } @@ -607,30 +616,26 @@ const char *WorldSession::GetTrinityString(int32 entry) const void WorldSession::Handle_NULL(WorldPacket& recvPacket) { - sLog->outError(LOG_FILTER_GENERAL, "SESSION: received unhandled opcode %s (0x%.4X)", - LookupOpcodeName(recvPacket.GetOpcode()), - recvPacket.GetOpcode()); + sLog->outError(LOG_FILTER_OPCODES, "Received unhandled opcode %s from %s" + , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str()); } void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket) { - sLog->outError(LOG_FILTER_GENERAL, "SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", - LookupOpcodeName(recvPacket.GetOpcode()), - recvPacket.GetOpcode()); + 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()); } void WorldSession::Handle_ServerSide(WorldPacket& recvPacket) { - sLog->outError(LOG_FILTER_GENERAL, "SESSION: received server-side opcode %s (0x%.4X)", - LookupOpcodeName(recvPacket.GetOpcode()), - recvPacket.GetOpcode()); + sLog->outError(LOG_FILTER_OPCODES, "Received server-side opcode %s from %s" + , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str()); } void WorldSession::Handle_Deprecated(WorldPacket& recvPacket) { - sLog->outError(LOG_FILTER_GENERAL, "SESSION: received deprecated opcode %s (0x%.4X)", - LookupOpcodeName(recvPacket.GetOpcode()), - recvPacket.GetOpcode()); + sLog->outError(LOG_FILTER_OPCODES, "Received deprecated opcode %s from %s" + , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str()); } void WorldSession::SendAuthWaitQue(uint32 position) diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 40485e2fa3b..0aa14eb78a8 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -233,8 +233,6 @@ class WorldSession bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; } bool PlayerRecentlyLoggedOut() const { return m_playerRecentlyLogout; } - void SizeError(WorldPacket const& packet, uint32 size) const; - void ReadAddonsInfo(WorldPacket& data); void SendAddonsInfo(); @@ -256,7 +254,7 @@ class WorldSession AccountTypes GetSecurity() const { return _security; } uint32 GetAccountId() const { return _accountId; } Player* GetPlayer() const { return _player; } - char const* GetPlayerName() const; + std::string GetPlayerName(bool simple = true) const; uint32 GetGuidLow() const; void SetSecurity(AccountTypes security) { _security = security; } std::string const& GetRemoteAddress() { return m_Address; } diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index ed960fd9693..92455f8edfe 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -193,7 +193,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct) if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::SendPacket enqueue_tail failed"); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::SendPacket enqueue_tail failed"); mb->release(); return -1; } @@ -236,7 +236,7 @@ int WorldSocket::open (void *a) if (peer().get_remote_addr(remote_addr) == -1) { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -261,7 +261,7 @@ int WorldSocket::open (void *a) // Register with ACE Reactor if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -297,14 +297,14 @@ int WorldSocket::handle_input (ACE_HANDLE) return Update(); // interesting line, isn't it ? } - sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); errno = ECONNRESET; return -1; } case 0: { - sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::handle_input: Peer has closed connection"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer has closed connection"); errno = ECONNRESET; return -1; @@ -373,7 +373,7 @@ int WorldSocket::handle_output_queue (GuardType& g) if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::handle_output_queue dequeue_head"); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue dequeue_head"); return -1; } @@ -408,7 +408,7 @@ int WorldSocket::handle_output_queue (GuardType& g) if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::handle_output_queue enqueue_head"); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue enqueue_head"); mblk->release(); return -1; } @@ -480,7 +480,7 @@ int WorldSocket::handle_input_header (void) if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240)) { Player* _player = m_Session ? m_Session->GetPlayer() : NULL; - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", + 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() : "", @@ -586,7 +586,7 @@ int WorldSocket::handle_input_missing_data (void) // hope this is not hack, as proper m_RecvWPct is asserted around if (!m_RecvWPct) { - sLog->outError(LOG_FILTER_GENERAL, "Forcing close on input m_RecvWPct = NULL"); + sLog->outError(LOG_FILTER_NETWORKIO, "Forcing close on input m_RecvWPct = NULL"); errno = EINVAL; return -1; } @@ -632,7 +632,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g) (this, ACE_Event_Handler::WRITE_MASK) == -1) { // would be good to store errno from reactor with errno guard - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::cancel_wakeup_output"); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::cancel_wakeup_output"); return -1; } @@ -651,7 +651,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g) if (reactor()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::schedule_wakeup_output"); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::schedule_wakeup_output"); return -1; } @@ -683,51 +683,44 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) case CMSG_AUTH_SESSION: if (m_Session) { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again"); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerName(false).c_str()); return -1; } sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct)); return HandleAuthSession (*new_pct); case CMSG_KEEP_ALIVE: - sLog->outDebug(LOG_FILTER_GENERAL, "CMSG_KEEP_ALIVE, size: " UI64FMTD, uint64(new_pct->size())); + sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", GetOpcodeNameForLogging(opcode).c_str()); sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct)); return 0; default: { ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); - if (m_Session != NULL) + if (!m_Session) { - // Our Idle timer will reset on any non PING opcodes. - // Catches people idling on the login screen and any lingering ingame connections. - m_Session->ResetTimeOutTime(); - - // OK, give the packet to WorldSession - aptr.release(); - // WARNINIG here we call it with locks held. - // Its possible to cause deadlock if QueuePacket calls back - m_Session->QueuePacket (new_pct); - return 0; - } - else - { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); + sLog->outError(LOG_FILTER_NETWORKIO, "ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); return -1; } + + // Our Idle timer will reset on any non PING opcodes. + // Catches people idling on the login screen and any lingering ingame connections. + m_Session->ResetTimeOutTime(); + + // OK, give the packet to WorldSession + aptr.release(); + // WARNINIG here we call it with locks held. + // Its possible to cause deadlock if QueuePacket calls back + m_Session->QueuePacket(new_pct); + return 0; } } } catch (ByteBufferException &) { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", opcode, GetRemoteAddress().c_str(), m_Session ? int32(m_Session->GetAccountId()) : -1); - if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_DEBUG)) - { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); - new_pct->hexlike(); - } - + new_pct->hexlike(); return -1; } @@ -758,7 +751,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8(AUTH_REJECT); SendPacket(packet); - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); return -1; } @@ -772,7 +765,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) recvPacket >> unk4; recvPacket.read(digest, 20); - sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", + sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", BuiltNumberClient, unk2, account.c_str(), @@ -794,7 +787,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) SendPacket(packet); - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); return -1; } @@ -814,7 +807,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) const char* sStr = s.AsHexStr(); //Must be freed by OPENSSL_free() const char* vStr = v.AsHexStr(); //Must be freed by OPENSSL_free() - sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s", + sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s", sStr, vStr); @@ -830,7 +823,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8 (AUTH_FAILED); SendPacket(packet); - sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); return -1; } } @@ -894,7 +887,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8 (AUTH_BANNED); SendPacket(packet); - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); return -1; } @@ -908,7 +901,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) SendPacket(packet); - sLog->outInfo(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); + sLog->outInfo(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); return -1; } @@ -932,11 +925,11 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) SendPacket(packet); - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); return -1; } - sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", + sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", account.c_str(), address.c_str()); @@ -1012,12 +1005,8 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity())) { - Player* _player = m_Session->GetPlayer(); - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)", - m_Session->GetAccountId(), - _player ? _player->GetGUIDLow() : 0, - _player ? _player->GetName() : "", - GetRemoteAddress().c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)", + m_Session->GetPlayerName(false).c_str(), GetRemoteAddress().c_str()); return -1; } @@ -1035,7 +1024,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) m_Session->SetLatency (latency); else { - sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandlePing: peer sent CMSG_PING, " + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: peer sent CMSG_PING, " "but is not authenticated or got recently kicked, " " address = %s", GetRemoteAddress().c_str()); diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 06f11cfaa2c..d651fbd4ce1 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -105,9 +105,8 @@ void Warden::Update() // Kick player if client response delays more than set in config if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS) { - sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u, latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client", - _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), - secsToTimeString(maxClientResponseDelay, true).c_str()); + 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->KickPlayer(); } else diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 96b71912421..9c90662105a 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -152,9 +152,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff) // Verify key if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0) { - sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed"); - sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s", - _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); return; } diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 7aea6794e01..20f09ec5bda 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -156,9 +156,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff) // Verify key if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0) { - sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed"); - sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s", - _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); return; } @@ -343,9 +341,7 @@ void WardenWin::HandleData(ByteBuffer &buff) if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length)) { buff.rpos(buff.wpos()); - sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM FAIL"); - sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed checksum. Action: %s", - _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); return; } @@ -356,9 +352,7 @@ void WardenWin::HandleData(ByteBuffer &buff) // TODO: test it. if (result == 0x00) { - sLog->outDebug(LOG_FILTER_WARDEN, "TIMING CHECK FAIL result 0x00"); - sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed timing check. Action: %s", - _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); return; } @@ -500,9 +494,7 @@ void WardenWin::HandleData(ByteBuffer &buff) if (checkFailed > 0) { WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed); - - sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed Warden check %u. Action: %s", - _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), checkFailed, Penalty(check).c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerName(false).c_str(), checkFailed, Penalty(check).c_str()); } // Set hold off timer, minimum timer should at least be 1 second diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp index b84a7e5544a..bfb52d342e1 100644 --- a/src/server/scripts/Commands/cs_ban.cpp +++ b/src/server/scripts/Commands/cs_ban.cpp @@ -107,7 +107,7 @@ public: return false; } - switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "")) + switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "")) { case BAN_SUCCESS: { @@ -183,7 +183,7 @@ public: break; } - switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "")) + switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "")) { case BAN_SUCCESS: if (atoi(durationStr) > 0) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index f1ca090a6ec..d671e5781fe 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2708,7 +2708,7 @@ Appender.GM=2,2,0,GM.log Appender.DBErrors=2,2,0,DBErrors.log Appender.Char=2,2,0,Char.log,w Appender.RA=2,2,0,RA.log -Appender.Warden=2,2,0,Warden.log +Appender.Warden=2,4,0,Warden.log Appender.Chat=2,2,0,Chat.log Appender.CharDump=2,2,0,%s.log Appender.Arenas=2,2,0,Arena.log @@ -2792,7 +2792,7 @@ Logger.Chat=22,3,Chat Logger.DBErrors=26,5,Console Server DBErrors Logger.GM=27,3,Console Server GM Logger.RA=28,3,RA -Logger.Warden=29,3,Warden +Logger.Warden=29,4,Warden Logger.WorldServer=31,3,Console Server Logger.Character=34,3,Char Logger.Arenas=35,3,Arenas -- cgit v1.2.3 From 6891fe6248ca0016fdb520bc8db2a1929c299c67 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 21 Aug 2012 23:01:24 +0200 Subject: Core/Battlefield: Add missing stuff for wintergrasp --- src/server/game/AI/CoreAI/GameObjectAI.h | 5 ++ src/server/game/AI/CreatureAISelector.cpp | 5 ++ src/server/game/Battlefield/Battlefield.cpp | 2 +- src/server/game/Battlegrounds/Battleground.cpp | 2 +- src/server/game/Entities/GameObject/GameObject.cpp | 9 +++- src/server/game/Entities/GameObject/GameObject.h | 1 + src/server/game/Entities/Object/Object.cpp | 7 ++- src/server/game/Entities/Player/Player.cpp | 13 +++-- src/server/game/Entities/Player/Player.h | 6 +-- src/server/game/Entities/Vehicle/Vehicle.h | 4 ++ src/server/game/Globals/ObjectAccessor.h | 1 + src/server/game/Groups/Group.cpp | 62 +++++++++++----------- src/server/game/Groups/Group.h | 2 +- src/server/game/Handlers/BattleGroundHandler.cpp | 49 ----------------- src/server/game/Handlers/MiscHandler.cpp | 47 ++++++++++++++++ src/server/game/Scripting/ScriptMgr.cpp | 16 +++--- src/server/game/Server/Protocol/Opcodes.cpp | 6 +-- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 3 +- src/server/game/Spells/Spell.cpp | 4 +- src/server/game/Spells/SpellEffects.cpp | 1 + 20 files changed, 139 insertions(+), 106 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index fbc8675cc47..6dfea9ac158 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -39,6 +39,11 @@ class GameObjectAI virtual void Reset() {}; + // Pass parameters between AI + virtual void DoAction(const int32 /*param = 0 */) {} + virtual void SetGUID(const uint64& /*guid*/, int32 /*id = 0 */) {} + virtual uint64 GetGUID(int32 /*id = 0 */) { return 0; } + static int Permissible(GameObject const* go); virtual bool GossipHello(Player* /*player*/) { return false; } diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 2d69f1e0243..4ccaa174e67 100755 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -137,6 +137,11 @@ namespace FactorySelector ai_factory = ai_registry.GetRegistryItem(go->GetAIName()); + // scriptname in db + if (!ai_factory) + if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go)) + return scriptedAI; + //future goAI types go here std::string ainame = (ai_factory == NULL || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key(); diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 7a09420acb6..d159580d189 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -563,7 +563,7 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player) else if (group->IsMember(player->GetGUID())) { uint8 subgroup = group->GetMemberGroup(player->GetGUID()); - player->SetBattlegroundRaid(group, subgroup); + player->SetBattlegroundOrBattlefieldRaid(group, subgroup); } else group->AddMember(player); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index cf767a2986e..eb5f3459edf 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1213,7 +1213,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team) if (group->IsMember(playerGuid)) { uint8 subgroup = group->GetMemberGroup(playerGuid); - player->SetBattlegroundRaid(group, subgroup); + player->SetBattlegroundOrBattlefieldRaid(group, subgroup); } else { diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index bebed9ce0bd..08518217e26 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -854,6 +854,13 @@ bool GameObject::IsDynTransport() const return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause); } +bool GameObject::IsDestructibleBuilding() const +{ + GameObjectTemplate const* gInfo = GetGOInfo(); + if (!gInfo) return false; + return gInfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING; +} + Unit* GameObject::GetOwner() const { return ObjectAccessor::GetUnit(*this, GetOwnerGUID()); @@ -870,7 +877,7 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const if (WorldObject::IsAlwaysVisibleFor(seer)) return true; - if (IsTransport()) + if (IsTransport() || IsDestructibleBuilding()) return true; if (!seer) diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index a8035043543..eb2fa8f1a0e 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -632,6 +632,7 @@ class GameObject : public WorldObject, public GridObject bool IsTransport() const; bool IsDynTransport() const; + bool IsDestructibleBuilding() const; uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 9138dcedc27..2e4ad07f86d 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2335,7 +2335,12 @@ void WorldObject::SetZoneScript() if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) m_zoneScript = bf; else - m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); + { + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) + m_zoneScript = bf; + else + m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); + } } } } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 1dcdfa9d8b4..f463a62e9fa 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5500,7 +5500,12 @@ void Player::RepopAtGraveyard() if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this); else - ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); + { + if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) + ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this); + else + ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); + } } // stop countdown until repop @@ -7570,7 +7575,7 @@ void Player::CheckDuelDistance(time_t currTime) bool Player::IsOutdoorPvPActive() { - return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && (IsPvP() || sWorld->IsPvPRealm()) && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight(); + return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && IsPvP() && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight(); } void Player::DuelComplete(DuelCompleteType type) @@ -23310,7 +23315,7 @@ bool Player::isUsingLfg() return sLFGMgr->GetState(guid) != LFG_STATE_NONE; } -void Player::SetBattlegroundRaid(Group* group, int8 subgroup) +void Player::SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup) { //we must move references from m_group to m_originalGroup SetOriginalGroup(GetGroup(), GetSubGroup()); @@ -23320,7 +23325,7 @@ void Player::SetBattlegroundRaid(Group* group, int8 subgroup) m_group.setSubGroup((uint8)subgroup); } -void Player::RemoveFromBattlegroundRaid() +void Player::RemoveFromBattlegroundOrBattlefieldRaid() { //remove existing reference m_group.unlink(); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 271bf2b22f8..358eebb7548 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2417,9 +2417,9 @@ class Player : public Unit, public GridObject Player* GetNextRandomRaidMember(float radius); PartyResult CanUninviteFromGroup() const; - // Battleground Group System - void SetBattlegroundRaid(Group* group, int8 subgroup = -1); - void RemoveFromBattlegroundRaid(); + // Battleground / Battlefield Group System + void SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup = -1); + void RemoveFromBattlegroundOrBattlefieldRaid(); Group* GetOriginalGroup() { return m_originalGroup.getTarget(); } GroupReference& GetOriginalGroupRef() { return m_originalGroup; } uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); } diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index 213be5a21fe..95fc2364256 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -25,6 +25,8 @@ struct VehicleEntry; class Unit; +typedef std::set GuidSet; + class Vehicle { public: @@ -53,6 +55,7 @@ class Vehicle void RelocatePassengers(float x, float y, float z, float ang); void RemoveAllPassengers(); void Dismiss(); + void TeleportVehicle(float x, float y, float z, float ang); bool IsVehicleInUse() { return Seats.begin() != Seats.end(); } SeatMap Seats; @@ -65,6 +68,7 @@ class Vehicle Unit* _me; VehicleEntry const* _vehicleInfo; + GuidSet vehiclePlayers; uint32 _usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players }; diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 5b31c6bfff4..0a1b41eb292 100755 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -191,6 +191,7 @@ class ObjectAccessor // ACCESS LIKE THAT IS NOT THREAD SAFE static Pet* FindPet(uint64); static Player* FindPlayer(uint64); + static Creature* FindCreature(uint64); static Unit* FindUnit(uint64); static Player* FindPlayerByName(const char* name); diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index c270597d15b..eae865592df 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -104,7 +104,7 @@ bool Group::Create(Player* leader) m_leaderGuid = leaderGuid; m_leaderName = leader->GetName(); - m_groupType = isBGGroup() ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL; + m_groupType = (isBGGroup() || isBFGroup()) ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL; if (m_groupType & GROUPTYPE_RAID) _initRaidSubGroupsCounter(); @@ -116,7 +116,7 @@ bool Group::Create(Player* leader) m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL; m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { m_dungeonDifficulty = leader->GetDungeonDifficulty(); m_raidDifficulty = leader->GetRaidDifficulty(); @@ -232,7 +232,7 @@ void Group::ConvertToLFG() { m_groupType = GroupType(m_groupType | GROUPTYPE_LFG | GROUPTYPE_UNK1); m_lootMethod = NEED_BEFORE_GREED; - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE); @@ -251,7 +251,7 @@ void Group::ConvertToRaid() _initRaidSubGroupsCounter(); - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE); @@ -274,7 +274,7 @@ bool Group::AddInvite(Player* player) if (!player || player->GetGroupInvite()) return false; Group* group = player->GetGroup(); - if (group && group->isBGGroup()) + if (group && (group->isBGGroup() || group->isBFGroup())) group = player->GetOriginalGroup(); if (group) return false; @@ -371,8 +371,8 @@ bool Group::AddMember(Player* player) if (player) { player->SetGroupInvite(NULL); - if (player->GetGroup() && isBGGroup()) //if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() - player->SetBattlegroundRaid(this, subGroup); + if (player->GetGroup() && (isBGGroup() || isBFGroup())) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() + player->SetBattlegroundOrBattlefieldRaid(this, subGroup); else if (player->GetGroup()) //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup() player->SetOriginalGroup(this, subGroup); else //if player is not in group, then call set group @@ -391,7 +391,7 @@ bool Group::AddMember(Player* player) } // insert into the table if we're not a battleground group - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER); @@ -410,7 +410,7 @@ bool Group::AddMember(Player* player) if (player) { - if (!IsLeader(player->GetGUID()) && !isBGGroup()) + if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup()) { // reset the new member's instances, unless he is currently in one of them // including raid/heroic instances that they are not permanently bound to! @@ -496,15 +496,15 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK) return m_memberSlots.size(); - // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group) - if (GetMembersCount() > ((isBGGroup() || isLFGGroup()) ? 1u : 2u)) + // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group) + if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u)) { Player* player = ObjectAccessor::FindPlayer(guid); if (player) { // Battleground group handling - if (isBGGroup()) - player->RemoveFromBattlegroundRaid(); + if (isBGGroup() || isBFGroup()) + player->RemoveFromBattlegroundOrBattlefieldRaid(); else // Regular group { @@ -535,13 +535,13 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV } // Remove player from group in DB - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER); - - stmt->setUInt32(0, GUID_LOPART(guid)); - - CharacterDatabase.Execute(stmt); - - DelinkMember(guid); + if (!isBGGroup() && !isBFGroup()) + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER); + stmt->setUInt32(0, GUID_LOPART(guid)); + CharacterDatabase.Execute(stmt); + DelinkMember(guid); + } // Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline if ((player && player->GetSkillValue(SKILL_ENCHANTING)) || !player) @@ -632,7 +632,7 @@ void Group::ChangeLeader(uint64 guid) sScriptMgr->OnGroupChangeLeader(this, m_leaderGuid, guid); - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { // Remove the groups permanent instance bindings for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) @@ -692,8 +692,8 @@ void Group::Disband(bool hideDestroy /* = false */) //we cannot call _removeMember because it would invalidate member iterator //if we are removing player from battleground raid - if (isBGGroup()) - player->RemoveFromBattlegroundRaid(); + if (isBGGroup() || isBFGroup()) + player->RemoveFromBattlegroundOrBattlefieldRaid(); else { //we can remove player who is in battleground from his original group @@ -737,7 +737,7 @@ void Group::Disband(bool hideDestroy /* = false */) RemoveAllInvites(); - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -1507,7 +1507,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot) Player* member = ObjectAccessor::FindPlayer(citr->guid); uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE; - onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0); + onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0); data << citr->name; data << uint64(citr->guid); // guid @@ -1598,7 +1598,7 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group) SubGroupCounterIncrease(group); - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP); @@ -1649,7 +1649,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group) SubGroupCounterDecrease(prevSubGroup); // Preserve new sub group in database for non-raid groups - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP); @@ -1844,7 +1844,7 @@ void Roll::targetObjectBuildLink() void Group::SetDungeonDifficulty(Difficulty difficulty) { m_dungeonDifficulty = difficulty; - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY); @@ -1868,7 +1868,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty) void Group::SetRaidDifficulty(Difficulty difficulty) { m_raidDifficulty = difficulty; - if (!isBGGroup()) + if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY); @@ -1904,7 +1904,7 @@ bool Group::InCombatToInstance(uint32 instanceId) void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) { - if (isBGGroup()) + if (isBGGroup() || isBFGroup()) return; // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND @@ -2019,7 +2019,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry) InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, bool load) { - if (!save || isBGGroup()) + if (!save || isBGGroup() || isBFGroup()) return NULL; InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()]; diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 41f5cd0de5f..de622a16301 100755 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -244,7 +244,7 @@ class Group void ConvertToRaid(); void SetBattlegroundGroup(Battleground* bg); - void SetBattlefieldGroup(Battlefield *bf); + void SetBattlefieldGroup(Battlefield* bf); GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); void ChangeMembersGroup(uint64 guid, uint8 group); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index b47eaf52064..475c1c42fca 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -34,8 +34,6 @@ #include "Opcodes.h" #include "DisableMgr.h" #include "Group.h" -#include "Battlefield.h" -#include "BattlefieldMgr.h" void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data) { @@ -567,53 +565,6 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/) } } -void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); - - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) - bf->SendAreaSpiritHealerQueryOpcode(_player,guid); -} - -void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); - - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) - bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); -} - - void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index bb0ca39fa37..80caee7d896 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -52,6 +52,7 @@ #include "Group.h" #include "AccountMgr.h" #include "Spell.h" +#include "BattlegroundMgr.h" #include "Battlefield.h" #include "BattlefieldMgr.h" @@ -1688,6 +1689,52 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) data << uint32(PhaseShift); SendPacket(&data); } +// Battlefield and Battleground +void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->SendAreaSpiritHealerQueryOpcode(_player,guid); +} + +void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); +} void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/) { diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 61d8711fd71..47ce6c17b28 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -723,14 +723,6 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd return tmpscript->OnDummyEffect(caster, spellId, effIndex, target); } -GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) -{ - ASSERT(go); - - GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); - return tmpscript->GetAI(go); -} - bool ScriptMgr::OnQuestAccept(Player* player, Item* item, Quest const* quest) { ASSERT(player); @@ -861,6 +853,14 @@ CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature) return tmpscript->GetAI(creature); } +GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* gameobject) +{ + ASSERT(gameobject); + + GET_SCRIPT_RET(GameObjectScript, gameobject->GetScriptId(), tmpscript, NULL); + return tmpscript->GetAI(gameobject); +} + void ScriptMgr::OnCreatureUpdate(Creature* creature, uint32 diff) { ASSERT(creature); diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 8fb8ea0298b..a229d3ed536 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1273,15 +1273,15 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4DC*/ { "SMSG_PVP_QUEUE_STATS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x4DD*/ { "CMSG_SET_PAID_SERVICE_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x4DE*/ { "SMSG_BATTLEFIELD_MGR_ENTRY_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfEntryInviteResponse }, /*0x4E0*/ { "SMSG_BATTLEFIELD_MGR_ENTERED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x4E1*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfQueueInviteResponse }, /*0x4E3*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x4E4*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x4E5*/ { "SMSG_BATTLEFIELD_MGR_EJECT_PENDING", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x4E6*/ { "SMSG_BATTLEFIELD_MGR_EJECTED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfExitRequest }, /*0x4E8*/ { "SMSG_BATTLEFIELD_MGR_STATE_CHANGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x4E9*/ { "CMSG_BATTLEFIELD_MANAGER_ADVANCE_STATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x4EA*/ { "CMSG_BATTLEFIELD_MANAGER_SET_NEXT_TRANSITION_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index f6cd5008b3c..b83e44d6a73 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5021,7 +5021,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool { if (Battleground* bg = target->ToPlayer()->GetBattleground()) bg->RemovePlayerFromResurrectQueue(target->GetGUID()); - if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId())) + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId())) bf->RemovePlayerFromResurrectQueue(target->GetGUID()); } break; @@ -5060,6 +5060,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->CastSpell((Unit*)NULL, GetAmount(), true, NULL, this); break; case 58600: // Restricted Flight Area + case 58730: // Restricted Flight Area if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) target->CastSpell(target, 58601, true); break; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index be92a86f958..6376ff6e50b 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5445,8 +5445,8 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive()) { Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId()); - if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId())) - if (pArea->flags & AREA_FLAG_NO_FLY_ZONE) + if (AreaTableEntry const* area = GetAreaEntryByAreaID(m_originalCaster->GetAreaId())) + if (area->flags & AREA_FLAG_NO_FLY_ZONE || (Bf && !Bf->CanFlyIn())) return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE; } break; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index d30f6e593dd..11356e8b155 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -6196,6 +6196,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex) case 58730: // Restricted Flight Area case 58600: // Restricted Flight Area unitTarget->ToPlayer()->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE); + unitTarget->PlayDirectSound(9417); // Fel Reaver sound break; } -- cgit v1.2.3 From 13ba61ab6912a5b7c04bf19fb64ea94f0f0714b5 Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 21 Aug 2012 23:13:05 +0200 Subject: Core/Logging: Disable all LOG_FILTER_OPCODES related messages by default --- src/server/worldserver/worldserver.conf.dist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index d671e5781fe..a3ba270b4bd 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2800,6 +2800,7 @@ Logger.SQLDriver=36,5,SQLDriver Logger.SQLDev=37,3,SQLDev Logger.CharDump=38,3,CharDump Logger.Load=40,3,Console Server +Logger.Opcodes=41,6,Console Server # # Loggers @@ -2807,5 +2808,5 @@ Logger.Load=40,3,Console Server # (Using spaces as separator). # Default: "Root Chat DBErrors GM RA Warden Character Load" -Loggers=Root Chat DBErrors GM RA Warden Character Load WorldServer +Loggers=Root Chat DBErrors GM RA Warden Character Load WorldServer Opcodes -- cgit v1.2.3 From 92d28bc98cc17487dc85ebffab975307bb7668d4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 22 Aug 2012 14:24:15 +0200 Subject: Core/Groups: Fixed update packet sent to group members on new member join --- src/server/game/Groups/Group.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index eae865592df..fda04effbf5 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -465,7 +465,11 @@ bool Group::AddMember(Player* player) UpdateData newData; WorldPacket newDataPacket; player->BuildValuesUpdateBlockForPlayer(&newData, member); - member->SendDirectMessage(&newDataPacket); + if (newData.HasData()) + { + newData.BuildPacket(&newDataPacket); + member->SendDirectMessage(&newDataPacket); + } } } } -- cgit v1.2.3 From ad26178c3b5c393594c7038fb44a98e9cd9e7733 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 22 Aug 2012 18:21:12 +0200 Subject: Core/Battlefield: Fix vehicle count --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 8e58dcdc5c0..634b1bb2cea 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -523,13 +523,13 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) case NPC_WINTERGRASP_CATAPULT: case NPC_WINTERGRASP_DEMOLISHER: { - if (!creature->GetCreatorGUID() || !sObjectAccessor->FindPlayer(creature->GetCreatorGUID())) + if (!creature->ToTempSummon()->GetSummonerGUID() || !sObjectAccessor->FindPlayer(creature->ToTempSummon()->GetSummonerGUID())) { creature->setDeathState(DEAD); creature->RemoveFromWorld(); return; } - Player* creator = sObjectAccessor->FindPlayer(creature->GetCreatorGUID()); + Player* creator = sObjectAccessor->FindPlayer(creature->ToTempSummon()->GetSummonerGUID()); TeamId team = creator->GetTeamId(); if (team == TEAM_HORDE) @@ -554,7 +554,7 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1); - creature->AddAura(SPELL_ALLIANCE_FLAG,creature); + creature->AddAura(SPELL_ALLIANCE_FLAG, creature); creature->setFaction(creator->getFaction()); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); @@ -699,10 +699,10 @@ bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle) if (m_vehicles[itr].find(vehicle->GetGUID()) != m_vehicles[itr].end()) { m_vehicles[itr].erase(vehicle->GetGUID()); - if (itr == WintergraspFaction[TEAM_HORDE]) - UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1); + if (itr == TEAM_HORDE) + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1); else - UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1); + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1); return true; } } -- cgit v1.2.3 From 85ed0e32a9b2b029c1db3cf1a914b3940cf72b9b Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Aug 2012 13:08:57 -0400 Subject: Core/Wintergrasp: fix possible crash when rebuild hits non rebuildable buildings --- src/server/game/Battlefield/Zones/BattlefieldWG.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 924ff1ad454..be062704b52 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1192,11 +1192,14 @@ struct BfWGGameObjectBuilding } // Rebuild gameobject - m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); + if (m_Build->IsDestructibleBuilding()) + { + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); - // Update worldstate - m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); - m_WG->SendUpdateWorldState(m_WorldState, m_State); + // Update worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); + m_WG->SendUpdateWorldState(m_WorldState, m_State); + } UpdateCreatureAndGo(); m_Build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]); } -- cgit v1.2.3