diff options
Diffstat (limited to 'src/server/scripts')
96 files changed, 4276 insertions, 785 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index cf2816c985e..c347648abab 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -119,7 +119,7 @@ public: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); if (handler->GetSession()) { - sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", + TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); } @@ -283,7 +283,7 @@ public: else { handler->PSendSysMessage("[IP2NATION] Table empty"); - sLog->outDebug(LOG_FILTER_AUTHSERVER, "[IP2NATION] Table empty"); + TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[IP2NATION] Table empty"); } } else if (param == "off") @@ -362,7 +362,7 @@ public: { handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); handler->SetSentErrorMessage(true); - sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password.", + TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); return false; @@ -380,7 +380,7 @@ public: { case AOR_OK: handler->SendSysMessage(LANG_COMMAND_PASSWORD); - sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.", + TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); break; @@ -482,7 +482,7 @@ public: char* arg3 = strtok(NULL, " "); bool isAccountNameGiven = true; - if (arg1 && !arg3) + if (!arg3) { if (!handler->getSelectedPlayer()) return false; diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index fdcf88177a9..e51052bc18f 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -320,7 +320,7 @@ public: // check online security if (handler->HasLowerSecurity(target, 0)) return false; - + playerOldName = target->GetName(); } else @@ -345,7 +345,7 @@ public: handler->SetSentErrorMessage(true); return false; } - + if (WorldSession* session = handler->GetSession()) { if (!session->HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(newName)) diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 400e35b705b..4719a460c4f 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -411,11 +411,11 @@ public: } else { - sLog->outError(LOG_FILTER_GENERAL, "Sending opcode that has unknown type '%s'", type.c_str()); + TC_LOG_ERROR(LOG_FILTER_GENERAL, "Sending opcode that has unknown type '%s'", type.c_str()); break; } } - sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending opcode %u", data.GetOpcode()); + TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Sending opcode %u", data.GetOpcode()); data.hexlike(); player->GetSession()->SendPacket(&data); handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName().c_str()); @@ -1328,7 +1328,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - sLog->outInfo(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + TC_LOG_INFO(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/scripts/Commands/cs_deserter.cpp b/src/server/scripts/Commands/cs_deserter.cpp index 3850456fcb3..ef2cd7b45b9 100644 --- a/src/server/scripts/Commands/cs_deserter.cpp +++ b/src/server/scripts/Commands/cs_deserter.cpp @@ -45,20 +45,20 @@ public: ChatCommand* GetCommands() const { - static ChatCommand deserterInstanceCommandTable[] = + static ChatCommand deserterInstanceCommandTable[] = { { "add", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceAdd, "", NULL }, { "remove", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceRemove, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; - static ChatCommand deserterBGCommandTable[] = + static ChatCommand deserterBGCommandTable[] = { { "add", SEC_ADMINISTRATOR, false, &HandleDeserterBGAdd, "", NULL }, { "remove", SEC_ADMINISTRATOR, false, &HandleDeserterBGRemove, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; - static ChatCommand deserterCommandTable[] = + static ChatCommand deserterCommandTable[] = { { "instance", SEC_ADMINISTRATOR, false, NULL, "", deserterInstanceCommandTable }, { "bg", SEC_ADMINISTRATOR, false, NULL, "", deserterBGCommandTable }, diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 12fd4250eb8..18dee2ea324 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -136,7 +136,7 @@ public: if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) { // report to DB errors log as in loading case - sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId); + TC_LOG_ERROR(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_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 81608ebd458..6b8ce7732c5 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -518,7 +518,7 @@ public: uint32 copp = (money % GOLD) % SILVER; std::string receiverStr = handler->playerLink(receiver); std::string senderStr = handler->playerLink(sender); - handler->PSendSysMessage(LANG_LIST_MAIL_INFO_1 , messageId, subject.c_str(),gold, silv, copp); + handler->PSendSysMessage(LANG_LIST_MAIL_INFO_1, messageId, subject.c_str(), gold, silv, copp); handler->PSendSysMessage(LANG_LIST_MAIL_INFO_2, senderStr.c_str(), senderId, receiverStr.c_str(), receiverId); handler->PSendSysMessage(LANG_LIST_MAIL_INFO_3, TimeToTimestampStr(deliverTime).c_str(), TimeToTimestampStr(expireTime).c_str()); if (hasItem == 1) @@ -541,7 +541,7 @@ public: uint32 item_entry = fields[0].GetUInt32(); uint32 item_count = fields[1].GetUInt32(); QueryResult result4; - result4 = WorldDatabase.PQuery("SELECT name,quality FROM item_template WHERE entry = '%u'", item_entry); + result4 = WorldDatabase.PQuery("SELECT name, quality FROM item_template WHERE entry = '%u'", item_entry); Field* fields1 = result4->Fetch(); std::string item_name = fields1[0].GetString(); int item_quality = fields1[1].GetUInt8(); diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 2130e61cb47..b014eb895be 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -962,12 +962,7 @@ public: uint32 id = atoi((char*)args); - bool found = false; - uint32 count = 0; - uint32 maxResults = 1; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); - if (spellInfo) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id)) { int locale = handler->GetSessionDbcLocale(); std::string name = spellInfo->SpellName[locale]; @@ -977,14 +972,6 @@ public: return true; } - 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); @@ -1028,13 +1015,8 @@ public: ss << handler->GetTrinityString(LANG_ACTIVE); handler->SendSysMessage(ss.str().c_str()); - - if (!found) - found = true; - } } - - if (!found) + else handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND); return true; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 9fa143673ca..5e4acbb2ba5 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1071,9 +1071,7 @@ public: Player* player = handler->GetSession()->GetPlayer(); uint32 zone_id = player->GetZoneId(); - WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard( - player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); - + WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); if (graveyard) { uint32 graveyardId = graveyard->ID; @@ -1103,14 +1101,12 @@ public: { std::string team_name; - if (team == 0) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (team == HORDE) + 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)) + if (!team) handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); else handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); @@ -1235,7 +1231,7 @@ public: if (!playerTarget) playerTarget = player; - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count); ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); if (!itemTemplate) @@ -1314,7 +1310,7 @@ public: if (!playerTarget) playerTarget = player; - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); bool found = false; ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); @@ -2042,6 +2038,70 @@ public: if (!*args) return false; + char* str = strtok((char*)args, " "); + + if (strcmp(str, "go") == 0) + { + char* guidStr = strtok(NULL, " "); + if (!guidStr) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + int32 guid = atoi(guidStr); + if (!guid) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + char* damageStr = strtok(NULL, " "); + if (!damageStr) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + int32 damage = atoi(damageStr); + if (!damage) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + if (Player* player = handler->GetSession()->GetPlayer()) + { + GameObject* go = NULL; + + if (GameObjectData const* goData = sObjectMgr->GetGOData(guid)) + go = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guid, goData->id); + + if (!go) + { + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guid); + handler->SetSentErrorMessage(true); + return false; + } + + if (!go->IsDestructibleBuilding()) + { + handler->SendSysMessage(LANG_INVALID_GAMEOBJECT_TYPE); + handler->SetSentErrorMessage(true); + return false; + } + + go->ModifyHealth(-damage, player); + handler->PSendSysMessage(LANG_GAMEOBJECT_DAMAGED, go->GetName().c_str(), guid, -damage, go->GetGOValue()->Building.Health); + } + + return true; + } + Unit* target = handler->getSelectedUnit(); if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) { @@ -2080,7 +2140,7 @@ public: return true; } - uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; + uint32 school = atoi((char*)schoolStr); if (school >= MAX_SPELL_SCHOOL) return false; @@ -2458,7 +2518,7 @@ public: if (!pet->InitStatsForLevel(creatureTarget->getLevel())) { - sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + TC_LOG_ERROR(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_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 79cd0deb75e..300b39fc389 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -95,14 +95,14 @@ public: path.SetUseStraightPath(useStraightPath); bool result = path.CalculatePath(x, y, z); - PointsArray const& pointPath = path.GetPath(); + Movement::PointsArray const& pointPath = path.GetPath(); handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str()); handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : "SmoothPath"); - handler->PSendSysMessage("Result: %s - Length: "SIZEFMTD" - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType()); + handler->PSendSysMessage("Result: %s - Length: " SIZEFMTD " - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType()); - Vector3 start = path.GetStartPosition(); - Vector3 end = path.GetEndPosition(); - Vector3 actualEnd = path.GetActualEndPosition(); + G3D::Vector3 const &start = path.GetStartPosition(); + G3D::Vector3 const &end = path.GetEndPosition(); + G3D::Vector3 const &actualEnd = path.GetActualEndPosition(); handler->PSendSysMessage("StartPosition (%.3f, %.3f, %.3f)", start.x, start.y, start.z); handler->PSendSysMessage("EndPosition (%.3f, %.3f, %.3f)", end.x, end.y, end.z); @@ -128,7 +128,7 @@ public: int32 gy = 32 - player->GetPositionY() / SIZE_OF_GRIDS; handler->PSendSysMessage("%03u%02i%02i.mmtile", player->GetMapId(), gy, gx); - handler->PSendSysMessage("gridloc [%i,%i]", gx, gy); + handler->PSendSysMessage("gridloc [%i, %i]", gx, gy); // calculate navmesh tile location dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()); @@ -148,7 +148,7 @@ public: int32 tilex = int32((y - min[0]) / SIZE_OF_GRIDS); int32 tiley = int32((x - min[2]) / SIZE_OF_GRIDS); - handler->PSendSysMessage("Calc [%02i,%02i]", tilex, tiley); + handler->PSendSysMessage("Calc [%02i, %02i]", tilex, tiley); // navmesh poly -> navmesh tile location dtQueryFilter filter = dtQueryFilter(); @@ -156,16 +156,16 @@ public: navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, NULL); if (polyRef == INVALID_POLYREF) - handler->PSendSysMessage("Dt [??,??] (invalid poly, probably no tile loaded)"); + handler->PSendSysMessage("Dt [??, ??] (invalid poly, probably no tile loaded)"); else { dtMeshTile const* tile; dtPoly const* poly; navmesh->getTileAndPolyByRef(polyRef, &tile, &poly); if (tile) - handler->PSendSysMessage("Dt [%02i,%02i]", tile->header->x, tile->header->y); + handler->PSendSysMessage("Dt [%02i, %02i]", tile->header->x, tile->header->y); else - handler->PSendSysMessage("Dt [??,??] (no tile loaded)"); + handler->PSendSysMessage("Dt [??, ??] (no tile loaded)"); } return true; @@ -190,7 +190,7 @@ public: if (!tile || !tile->header) continue; - handler->PSendSysMessage("[%02i,%02i]", tile->header->x, tile->header->y); + handler->PSendSysMessage("[%02i, %02i]", tile->header->x, tile->header->y); } return true; @@ -264,7 +264,7 @@ public: if (!creatureList.empty()) { - handler->PSendSysMessage("Found "SIZEFMTD" Creatures.", creatureList.size()); + handler->PSendSysMessage("Found " SIZEFMTD " Creatures.", creatureList.size()); uint32 paths = 0; uint32 uStartTime = getMSTime(); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 7219615736e..ff4ef587fad 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -203,7 +203,7 @@ public: target->SetMaxPower(POWER_ENERGY, energym); target->SetPower(POWER_ENERGY, energy); - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); return true; } @@ -309,24 +309,14 @@ public: if (!pfactionid) { - if (target) - { - uint32 factionid = target->getFaction(); - uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS); - uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); - uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); - handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag); - } + uint32 factionid = target->getFaction(); + uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS); + uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); + uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); + handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag); return true; } - if (!target) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - uint32 factionid = atoi(pfactionid); uint32 flag; @@ -340,7 +330,7 @@ public: uint32 npcflag; if (!pnpcflag) - npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); + npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); else npcflag = atoi(pnpcflag); @@ -348,7 +338,7 @@ public: uint32 dyflag; if (!pdyflag) - dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); + dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); else dyflag = atoi(pdyflag); @@ -1019,7 +1009,7 @@ public: { int32 newmoney = int32(targetMoney) + moneyToAdd; - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney); if (newmoney <= 0) { handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str()); @@ -1054,7 +1044,7 @@ public: target->ModifyMoney(moneyToAdd); } - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney()); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney()); return true; } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 79a74b0823d..43c9b294419 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -252,7 +252,7 @@ public: return false; } - uint32 vendor_entry = vendor ? vendor->GetEntry() : 0; + uint32 vendor_entry = vendor->GetEntry(); if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer())) { @@ -889,7 +889,7 @@ public: if (dontdel_str) { - //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: All 3 params are set"); + //TC_LOG_ERROR(LOG_FILTER_GENERAL, "DEBUG: All 3 params are set"); // All 3 params are set // GUID @@ -897,7 +897,7 @@ public: // doNotDEL if (stricmp(dontdel_str, "NODEL") == 0) { - //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: doNotDelete = true;"); + //TC_LOG_ERROR(LOG_FILTER_GENERAL, "DEBUG: doNotDelete = true;"); doNotDelete = true; } } @@ -906,10 +906,10 @@ public: // Only 2 params - but maybe NODEL is set if (type_str) { - sLog->outError(LOG_FILTER_GENERAL, "DEBUG: Only 2 params "); + TC_LOG_ERROR(LOG_FILTER_GENERAL, "DEBUG: Only 2 params "); if (stricmp(type_str, "NODEL") == 0) { - //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: type_str, NODEL "); + //TC_LOG_ERROR(LOG_FILTER_GENERAL, "DEBUG: type_str, NODEL "); doNotDelete = true; type_str = NULL; } diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp index 604218c2e68..667815ce16c 100644 --- a/src/server/scripts/Commands/cs_rbac.cpp +++ b/src/server/scripts/Commands/cs_rbac.cpp @@ -32,6 +32,12 @@ EndScriptData */ struct RBACCommandData
{
RBACCommandData(): id(0), realmId(0), rbac(NULL), needDelete(false) { }
+ ~RBACCommandData()
+ {
+ if (needDelete)
+ delete rbac;
+ }
+
uint32 id;
int32 realmId;
RBACData* rbac;
@@ -230,8 +236,7 @@ public: break;
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -266,8 +271,7 @@ public: break;
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -295,8 +299,7 @@ public: }
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -335,8 +338,7 @@ public: break;
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -375,8 +377,7 @@ public: break;
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -411,8 +412,7 @@ public: break;
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -453,8 +453,7 @@ public: }
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -493,8 +492,7 @@ public: break;
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -533,8 +531,7 @@ public: break;
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -569,8 +566,7 @@ public: break;
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -613,8 +609,7 @@ public: }
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
@@ -643,8 +638,7 @@ public: }
}
- if (command->needDelete)
- delete command;
+ delete command;
return true;
}
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 7aee1139868..5351f3edda0 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -225,7 +225,7 @@ public: static bool HandleReloadAllLootCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables..."); LoadLootTables(); handler->SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded."); sConditionMgr->LoadConditions(true); @@ -248,7 +248,7 @@ public: HandleReloadQuestPOICommand(handler, "a"); HandleReloadQuestTemplateCommand(handler, "a"); - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quests Relations..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Quests Relations..."); sObjectMgr->LoadQuestRelations(); handler->SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded."); return true; @@ -263,7 +263,7 @@ public: return false; } - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts..."); HandleReloadEventScriptsCommand(handler, "a"); HandleReloadSpellScriptsCommand(handler, "a"); handler->SendGlobalGMSysMessage("DB tables `*_scripts` reloaded."); @@ -332,7 +332,7 @@ public: static bool HandleReloadConfigCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading config settings..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading config settings..."); sWorld->LoadConfigSettings(true); sMapMgr->InitializeVisibilityDistanceInfo(); handler->SendGlobalGMSysMessage("World config settings reloaded."); @@ -341,7 +341,7 @@ public: static bool HandleReloadAccessRequirementCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Access Requirement definitions..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Access Requirement definitions..."); sObjectMgr->LoadAccessRequirements(); handler->SendGlobalGMSysMessage("DB table `access_requirement` reloaded."); return true; @@ -349,7 +349,7 @@ public: static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Additional Achievement Criteria Data..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Additional Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); handler->SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded."); return true; @@ -357,7 +357,7 @@ public: static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Achievement Reward Data..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Achievement Reward Data..."); sAchievementMgr->LoadRewards(); handler->SendGlobalGMSysMessage("DB table `achievement_reward` reloaded."); return true; @@ -365,7 +365,7 @@ public: static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Tavern Area Triggers..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded."); return true; @@ -373,7 +373,7 @@ public: static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading AreaTrigger teleport definitions..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading AreaTrigger teleport definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); handler->SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded."); return true; @@ -381,7 +381,7 @@ public: static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Autobroadcasts..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Autobroadcasts..."); sWorld->LoadAutobroadcasts(); handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded."); return true; @@ -396,7 +396,7 @@ public: static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading creature award reputation definitions..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading creature award reputation definitions..."); sObjectMgr->LoadReputationOnKill(); handler->SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded."); return true; @@ -404,7 +404,7 @@ public: static bool HandleReloadCreatureSummonGroupsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Reloading creature summon groups..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading creature summon groups..."); sObjectMgr->LoadTempSummons(); handler->SendGlobalGMSysMessage("DB table `creature_summon_groups` reloaded."); return true; @@ -438,7 +438,7 @@ public: continue; } - sLog->outInfo(LOG_FILTER_GENERAL, "Reloading creature template entry %u", entry); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading creature template entry %u", entry); Field* fields = result->Fetch(); @@ -534,7 +534,7 @@ public: static bool HandleReloadCreatureQuestRelationsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questrelation`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questrelation`)"); sObjectMgr->LoadCreatureQuestRelations(); handler->SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded."); return true; @@ -542,7 +542,7 @@ public: static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Linked Respawns... (`creature_linked_respawn`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Linked Respawns... (`creature_linked_respawn`)"); sObjectMgr->LoadLinkedRespawn(); handler->SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded."); return true; @@ -550,7 +550,7 @@ public: static bool HandleReloadCreatureQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_involvedrelation`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_involvedrelation`)"); sObjectMgr->LoadCreatureInvolvedRelations(); handler->SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded."); return true; @@ -558,7 +558,7 @@ public: static bool HandleReloadGossipMenuCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table!"); sObjectMgr->LoadGossipMenu(); handler->SendGlobalGMSysMessage("DB table `gossip_menu` reloaded."); sConditionMgr->LoadConditions(true); @@ -567,7 +567,7 @@ public: static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table!"); sObjectMgr->LoadGossipMenuItems(); handler->SendGlobalGMSysMessage("DB table `gossip_menu_option` reloaded."); sConditionMgr->LoadConditions(true); @@ -576,7 +576,7 @@ public: static bool HandleReloadGOQuestRelationsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questrelation`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questrelation`)"); sObjectMgr->LoadGameobjectQuestRelations(); handler->SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded."); return true; @@ -584,7 +584,7 @@ public: static bool HandleReloadGOQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_involvedrelation`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_involvedrelation`)"); sObjectMgr->LoadGameobjectInvolvedRelations(); handler->SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded."); return true; @@ -592,7 +592,7 @@ public: static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Area Triggers..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded."); return true; @@ -600,12 +600,12 @@ public: static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Templates..."); + TC_LOG_INFO(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->outInfo(LOG_FILTER_GENERAL, "Re-Loading GameObjects for quests..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); handler->SendGlobalGMSysMessage("Data GameObjects for quests reloaded."); return true; @@ -613,7 +613,7 @@ public: static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`creature_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`creature_loot_template`)"); LoadLootTemplates_Creature(); LootTemplates_Creature.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded."); @@ -623,7 +623,7 @@ public: static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`disenchant_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`disenchant_loot_template`)"); LoadLootTemplates_Disenchant(); LootTemplates_Disenchant.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded."); @@ -633,7 +633,7 @@ public: static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`fishing_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`fishing_loot_template`)"); LoadLootTemplates_Fishing(); LootTemplates_Fishing.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded."); @@ -643,7 +643,7 @@ public: static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`gameobject_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`gameobject_loot_template`)"); LoadLootTemplates_Gameobject(); LootTemplates_Gameobject.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded."); @@ -653,7 +653,7 @@ public: static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`item_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`item_loot_template`)"); LoadLootTemplates_Item(); LootTemplates_Item.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `item_loot_template` reloaded."); @@ -663,7 +663,7 @@ public: static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`milling_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`milling_loot_template`)"); LoadLootTemplates_Milling(); LootTemplates_Milling.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded."); @@ -673,7 +673,7 @@ public: static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); LoadLootTemplates_Pickpocketing(); LootTemplates_Pickpocketing.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded."); @@ -683,7 +683,7 @@ public: static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`prospecting_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`prospecting_loot_template`)"); LoadLootTemplates_Prospecting(); LootTemplates_Prospecting.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded."); @@ -693,7 +693,7 @@ public: static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`mail_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`mail_loot_template`)"); LoadLootTemplates_Mail(); LootTemplates_Mail.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `mail_loot_template` reloaded."); @@ -703,7 +703,7 @@ public: static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`reference_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`reference_loot_template`)"); LoadLootTemplates_Reference(); handler->SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded."); sConditionMgr->LoadConditions(true); @@ -712,7 +712,7 @@ public: static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`skinning_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`skinning_loot_template`)"); LoadLootTemplates_Skinning(); LootTemplates_Skinning.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded."); @@ -722,7 +722,7 @@ public: static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`spell_loot_template`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`spell_loot_template`)"); LoadLootTemplates_Spell(); LootTemplates_Spell.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded."); @@ -732,7 +732,7 @@ public: static bool HandleReloadTrinityStringCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading trinity_string Table!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading trinity_string Table!"); sObjectMgr->LoadTrinityStrings(); handler->SendGlobalGMSysMessage("DB table `trinity_string` reloaded."); return true; @@ -747,7 +747,7 @@ public: return false; } - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading warden_action Table!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading warden_action Table!"); sWardenCheckMgr->LoadWardenOverrides(); handler->SendGlobalGMSysMessage("DB table `warden_action` reloaded."); return true; @@ -755,7 +755,7 @@ public: static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_trainer` Table!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `npc_trainer` Table!"); sObjectMgr->LoadTrainerSpell(); handler->SendGlobalGMSysMessage("DB table `npc_trainer` reloaded."); return true; @@ -763,7 +763,7 @@ public: static bool HandleReloadNpcVendorCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_vendor` Table!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `npc_vendor` Table!"); sObjectMgr->LoadVendors(); handler->SendGlobalGMSysMessage("DB table `npc_vendor` reloaded."); return true; @@ -771,7 +771,7 @@ public: static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `points_of_interest` Table!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `points_of_interest` Table!"); sObjectMgr->LoadPointsOfInterest(); handler->SendGlobalGMSysMessage("DB table `points_of_interest` reloaded."); return true; @@ -779,7 +779,7 @@ public: static bool HandleReloadQuestPOICommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest POI ..." ); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Quest POI ..." ); sObjectMgr->LoadQuestPOI(); handler->SendGlobalGMSysMessage("DB Table `quest_poi` and `quest_poi_points` reloaded."); return true; @@ -787,7 +787,7 @@ public: static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_spellclick_spells` Table!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `npc_spellclick_spells` Table!"); sObjectMgr->LoadNPCSpellClickSpells(); handler->SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded."); return true; @@ -795,7 +795,7 @@ public: static bool HandleReloadReservedNameCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames... (`reserved_name`)"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading ReservedNames... (`reserved_name`)"); sObjectMgr->LoadReservedPlayersNames(); handler->SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded."); return true; @@ -803,7 +803,7 @@ public: static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_reward_rate` Table!" ); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `reputation_reward_rate` Table!" ); sObjectMgr->LoadReputationRewardRate(); handler->SendGlobalSysMessage("DB table `reputation_reward_rate` reloaded."); return true; @@ -811,7 +811,7 @@ public: static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_spillover_template` Table!" ); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `reputation_spillover_template` Table!" ); sObjectMgr->LoadReputationSpilloverTemplate(); handler->SendGlobalSysMessage("DB table `reputation_spillover_template` reloaded."); return true; @@ -819,7 +819,7 @@ public: static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Discovery Table..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); handler->SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded."); return true; @@ -827,7 +827,7 @@ public: static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Extra Item Table..."); + TC_LOG_INFO(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; @@ -835,7 +835,7 @@ public: static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Fishing base level requirements..."); + TC_LOG_INFO(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; @@ -843,7 +843,7 @@ public: static bool HandleReloadSpellAreaCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading SpellArea Data..."); + TC_LOG_INFO(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; @@ -851,7 +851,7 @@ public: static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Required Data... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Required Data... "); sSpellMgr->LoadSpellRequired(); handler->SendGlobalGMSysMessage("DB table `spell_required` reloaded."); return true; @@ -859,7 +859,7 @@ public: static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Groups..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Groups..."); sSpellMgr->LoadSpellGroups(); handler->SendGlobalGMSysMessage("DB table `spell_group` (spell groups) reloaded."); return true; @@ -867,7 +867,7 @@ public: static bool HandleReloadSpellLearnSpellCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Learn Spells..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Learn Spells..."); sSpellMgr->LoadSpellLearnSpells(); handler->SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded."); return true; @@ -875,7 +875,7 @@ public: static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Linked Spells..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Linked Spells..."); sSpellMgr->LoadSpellLinked(); handler->SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded."); return true; @@ -883,7 +883,7 @@ public: static bool HandleReloadSpellProcEventCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc Event conditions..."); + TC_LOG_INFO(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; @@ -891,7 +891,7 @@ public: static bool HandleReloadSpellProcsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc conditions and data..."); + TC_LOG_INFO(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; @@ -899,7 +899,7 @@ public: static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Bonus Data..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); handler->SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); return true; @@ -907,7 +907,7 @@ public: static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell target coordinates..."); + TC_LOG_INFO(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; @@ -915,7 +915,7 @@ public: static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Aggro Spells Definitions..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); handler->SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded."); return true; @@ -923,7 +923,7 @@ public: static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Group Stack Rules..."); + TC_LOG_INFO(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; @@ -931,7 +931,7 @@ public: static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell pet auras..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); handler->SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded."); return true; @@ -939,7 +939,7 @@ public: static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Page Texts..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Page Texts..."); sObjectMgr->LoadPageTexts(); handler->SendGlobalGMSysMessage("DB table `page_texts` reloaded."); return true; @@ -947,7 +947,7 @@ public: static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item Random Enchantments Table..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); handler->SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded."); return true; @@ -955,7 +955,7 @@ public: static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Item set names..."); sObjectMgr->LoadItemSetNames(); handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded."); return true; @@ -971,7 +971,7 @@ public: } if (*args != 'a') - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `event_scripts`..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts from `event_scripts`..."); sObjectMgr->LoadEventScripts(); @@ -991,7 +991,7 @@ public: } if (*args != 'a') - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `waypoint_scripts`..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts from `waypoint_scripts`..."); sObjectMgr->LoadWaypointScripts(); @@ -1004,7 +1004,7 @@ public: static bool HandleReloadWpCommand(ChatHandler* handler, const char* args) { if (*args != 'a') - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Waypoints data from 'waypoints_data'"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Waypoints data from 'waypoints_data'"); sWaypointMgr->Load(); @@ -1017,7 +1017,7 @@ public: static bool HandleReloadEventAITextsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Texts from `creature_ai_texts`..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Texts from `creature_ai_texts`..."); sEventAIMgr->LoadCreatureEventAI_Texts(); handler->SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded."); return true; @@ -1025,7 +1025,7 @@ public: static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`..."); sEventAIMgr->LoadCreatureEventAI_Scripts(); handler->SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded."); return true; @@ -1041,7 +1041,7 @@ public: } if (*args != 'a') - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `spell_scripts`..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts from `spell_scripts`..."); sObjectMgr->LoadSpellScripts(); @@ -1053,7 +1053,7 @@ public: static bool HandleReloadDbScriptStringCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Script strings from `db_script_string`..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Script strings from `db_script_string`..."); sObjectMgr->LoadDbScriptStrings(); handler->SendGlobalGMSysMessage("DB table `db_script_string` reloaded."); return true; @@ -1061,7 +1061,7 @@ public: static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Graveyard-zone links..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Graveyard-zone links..."); sObjectMgr->LoadGraveyardZones(); @@ -1072,7 +1072,7 @@ public: static bool HandleReloadGameTeleCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Game Tele coordinates..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Game Tele coordinates..."); sObjectMgr->LoadGameTele(); @@ -1083,9 +1083,9 @@ public: static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading disables table..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading disables table..."); DisableMgr::LoadDisables(); - sLog->outInfo(LOG_FILTER_GENERAL, "Checking quest disables..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Checking quest disables..."); DisableMgr::CheckQuestDisables(); handler->SendGlobalGMSysMessage("DB table `disables` reloaded."); return true; @@ -1093,7 +1093,7 @@ public: static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Achievement Reward Data..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Achievement Reward Data..."); sAchievementMgr->LoadRewardLocales(); handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded."); return true; @@ -1101,7 +1101,7 @@ public: static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading lfg dungeon rewards..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading lfg dungeon rewards..."); sLFGMgr->LoadRewards(); handler->SendGlobalGMSysMessage("DB table `lfg_dungeon_rewards` reloaded."); return true; @@ -1109,7 +1109,7 @@ public: static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature ..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Creature ..."); sObjectMgr->LoadCreatureLocales(); handler->SendGlobalGMSysMessage("DB table `locales_creature` reloaded."); return true; @@ -1117,7 +1117,7 @@ public: static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature Texts..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Creature Texts..."); sCreatureTextMgr->LoadCreatureTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded."); return true; @@ -1125,7 +1125,7 @@ public: static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gameobject ... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Gameobject ... "); sObjectMgr->LoadGameObjectLocales(); handler->SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded."); return true; @@ -1133,7 +1133,7 @@ public: static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gossip Menu Option ... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Gossip Menu Option ... "); sObjectMgr->LoadGossipMenuItemsLocales(); handler->SendGlobalGMSysMessage("DB table `locales_gossip_menu_option` reloaded."); return true; @@ -1141,7 +1141,7 @@ public: static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item ... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Item ... "); sObjectMgr->LoadItemLocales(); handler->SendGlobalGMSysMessage("DB table `locales_item` reloaded."); return true; @@ -1149,7 +1149,7 @@ public: static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item set name... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Item set name... "); sObjectMgr->LoadItemSetNameLocales(); handler->SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded."); return true; @@ -1157,7 +1157,7 @@ public: static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales NPC Text ... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales NPC Text ... "); sObjectMgr->LoadNpcTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded."); return true; @@ -1165,7 +1165,7 @@ public: static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Page Text ... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Page Text ... "); sObjectMgr->LoadPageTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_page_text` reloaded."); return true; @@ -1173,7 +1173,7 @@ public: static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Points Of Interest ... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Points Of Interest ... "); sObjectMgr->LoadPointOfInterestLocales(); handler->SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded."); return true; @@ -1181,7 +1181,7 @@ public: static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Quest ... "); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Quest ... "); sObjectMgr->LoadQuestLocales(); handler->SendGlobalGMSysMessage("DB table `locales_quest` reloaded."); return true; @@ -1189,7 +1189,7 @@ public: static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Player level dependent mail rewards..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); handler->SendGlobalGMSysMessage("DB table `mail_level_reward` reloaded."); return true; @@ -1198,7 +1198,7 @@ public: static bool HandleReloadAuctionsCommand(ChatHandler* handler, const char* /*args*/) { ///- Reload dynamic data tables from the database - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Auctions..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Auctions..."); sAuctionMgr->LoadAuctionItems(); sAuctionMgr->LoadAuctions(); handler->SendGlobalGMSysMessage("Auctions reloaded."); @@ -1207,7 +1207,7 @@ public: static bool HandleReloadConditions(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Conditions..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Conditions..."); sConditionMgr->LoadConditions(true); handler->SendGlobalGMSysMessage("Conditions reloaded."); return true; @@ -1215,7 +1215,7 @@ public: static bool HandleReloadCreatureText(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Creature Texts..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); handler->SendGlobalGMSysMessage("Creature Texts reloaded."); return true; @@ -1223,7 +1223,7 @@ public: static bool HandleReloadSmartScripts(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Smart Scripts..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Smart Scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); handler->SendGlobalGMSysMessage("Smart Scripts reloaded."); return true; @@ -1231,7 +1231,7 @@ public: static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_accessory table..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading vehicle_accessory table..."); sObjectMgr->LoadVehicleAccessories(); handler->SendGlobalGMSysMessage("Vehicle accessories reloaded."); return true; @@ -1239,7 +1239,7 @@ public: static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_template_accessory table..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading vehicle_template_accessory table..."); sObjectMgr->LoadVehicleTemplateAccessories(); handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded."); return true; @@ -1247,7 +1247,7 @@ public: static bool HandleReloadRBACCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Reloading RBAC tables..."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading RBAC tables..."); sAccountMgr->LoadRBAC(); sWorld->ReloadRBAC(); handler->SendGlobalGMSysMessage("RBAC data reloaded."); diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 44d97ee2221..b0f57a3f609 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -92,7 +92,7 @@ public: ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass()); if (!classEntry) { - sLog->outError(LOG_FILTER_GENERAL, "Class %u not found in DBC (Wrong DBC files?)", player->getClass()); + TC_LOG_ERROR(LOG_FILTER_GENERAL, "Class %u not found in DBC (Wrong DBC files?)", player->getClass()); return false; } diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index bb48e94f744..b7a89ceb325 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -796,7 +796,7 @@ public: if (show == "info") { // Check if the user did specify a visual waypoint - if (target->GetEntry() != VISUAL_WAYPOINT) + if (target && target->GetEntry() != VISUAL_WAYPOINT) { handler->PSendSysMessage(LANG_WAYPOINT_VP_SELECT); handler->SetSentErrorMessage(true); diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index d0c0ded2267..905c0c5997d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -211,7 +211,7 @@ public: { instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me); instance->SetData(TYPE_RING_OF_LAW, DONE); - sLog->outDebug(LOG_FILTER_TSCR, "npc_grimstone: event reached end and set complete."); + TC_LOG_DEBUG(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 f9506a9a551..c748533565b 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, "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data); + TC_LOG_DEBUG(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, "Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); + TC_LOG_DEBUG(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 8a781b48e90..087a1a032bb 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -365,7 +365,7 @@ public: Nefarian->setFaction(103); NefarianGUID = Nefarian->GetGUID(); } - else sLog->outError(LOG_FILTER_TSCR, "Blackwing Lair: Unable to spawn nefarian properly."); + else TC_LOG_ERROR(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 06389fbbf25..d1659a07851 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -1231,7 +1231,7 @@ public: } } - sLog->outError(LOG_FILTER_TSCR, "boss_romuloAI: DamageTaken reach end of code, that should not happen."); + TC_LOG_ERROR(LOG_FILTER_TSCR, "boss_romuloAI: DamageTaken reach end of code, that should not happen."); } void EnterCombat(Unit* /*who*/) @@ -1476,7 +1476,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama if (Phase == PHASE_ROMULO) { - sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); damage = 0; return; } @@ -1510,7 +1510,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama return; } } - sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: DamageTaken reach end of code, that should not happen."); + TC_LOG_ERROR(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 b8525dd0181..8514503a952 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -230,7 +230,7 @@ public: void PrepareEncounter() { - sLog->outDebug(LOG_FILTER_TSCR, "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); + TC_LOG_DEBUG(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->outInfo(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID()); + TC_LOG_INFO(LOG_FILTER_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->outInfo(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID()); + TC_LOG_INFO(LOG_FILTER_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->outInfo(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID()); + TC_LOG_INFO(LOG_FILTER_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 6857a5eafac..208971f85dd 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h @@ -62,5 +62,5 @@ enum OperaEvents EVENT_RAJ = 3 }; -#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()); +#define ERROR_INST_DATA(a) TC_LOG_ERROR(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 bd5f57f8af0..5040aaafc4d 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -84,7 +84,7 @@ public: { instance->SetData64(DATA_FEL_CRYSTAL, i); uint64 guid = instance->GetData64(DATA_FEL_CRYSTAL); - sLog->outDebug(LOG_FILTER_TSCR, "Selin: Adding Fel Crystal " UI64FMTD " to list", guid); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Selin: Adding Fel Crystal " UI64FMTD " to list", guid); Crystals.push_back(guid); } } @@ -125,7 +125,7 @@ public: // Set Inst data for encounter instance->SetData(DATA_SELIN_EVENT, NOT_STARTED); - } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); + } else TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); DrainLifeTimer = urand(3000, 7000); DrainManaTimer = DrainLifeTimer + 5000; @@ -225,7 +225,7 @@ public: else { // Make an error message in case something weird happened here - sLog->outError(LOG_FILTER_TSCR, "Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); DrainingCrystal = false; } } @@ -360,7 +360,7 @@ public: } } } - } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); + } else TC_LOG_ERROR(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 9bfcfc4e0f4..2350cd8f581 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -296,7 +296,7 @@ public: case DATA_FEL_CRYSTAL: if (FelCrystals.size() < felCristalIndex) { - sLog->outError(LOG_FILTER_TSCR, "Magisters Terrace: No Fel Crystals loaded in Inst Data"); + TC_LOG_ERROR(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 c479e4ef432..fdbbcaf8216 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -180,7 +180,7 @@ public: anchorGUID = anchor->GetGUID(); } else - sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find anchor!"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find anchor!"); float dist = 99.0f; GameObject* prison = NULL; @@ -200,7 +200,7 @@ public: if (prison) prison->ResetDoorOrButton(); else - sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find prison!"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find prison!"); } break; case PHASE_TO_EQUIP: @@ -211,7 +211,7 @@ public: else { me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ()); - //sLog->outDebug(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); + //TC_LOG_DEBUG(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); phase = PHASE_EQUIPING; wait_timer = 0; } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp index 97b8e0334ee..3585debb1c2 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp @@ -146,49 +146,51 @@ class boss_kirtonos_the_herald : public CreatureScript { events.Update(diff); - while (uint32 eventId = events.ExecuteEvent() && !UpdateVictim()) + if (!UpdateVictim()) { - switch (eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case INTRO_1: - me->GetMotionMaster()->MovePath(KIRTONOS_PATH, false); - break; - case INTRO_2: - me->GetMotionMaster()->MovePoint(0, PosMove[0]); - events.ScheduleEvent(INTRO_3, 1000); - break; - case INTRO_3: - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) - gate->SetGoState(GO_STATE_READY); - me->SetFacingTo(0.01745329f); - events.ScheduleEvent(INTRO_4, 3000); - break; - case INTRO_4: - if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD))) - brazier->SetGoState(GO_STATE_READY); - me->SetWalk(true); - me->SetDisableGravity(false); - DoCast(me, SPELL_KIRTONOS_TRANSFORM); - me->SetCanFly(false); - events.ScheduleEvent(INTRO_5, 1000); - break; - case INTRO_5: - me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->SetReactState(REACT_AGGRESSIVE); - events.ScheduleEvent(INTRO_6, 5000); - break; - case INTRO_6: - me->GetMotionMaster()->MovePoint(0, PosMove[1]); - break; - default: - break; + switch (eventId) + { + case INTRO_1: + me->GetMotionMaster()->MovePath(KIRTONOS_PATH, false); + break; + case INTRO_2: + me->GetMotionMaster()->MovePoint(0, PosMove[0]); + events.ScheduleEvent(INTRO_3, 1000); + break; + case INTRO_3: + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) + gate->SetGoState(GO_STATE_READY); + me->SetFacingTo(0.01745329f); + events.ScheduleEvent(INTRO_4, 3000); + break; + case INTRO_4: + if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD))) + brazier->SetGoState(GO_STATE_READY); + me->SetWalk(true); + me->SetDisableGravity(false); + DoCast(me, SPELL_KIRTONOS_TRANSFORM); + me->SetCanFly(false); + events.ScheduleEvent(INTRO_5, 1000); + break; + case INTRO_5: + me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + events.ScheduleEvent(INTRO_6, 5000); + break; + case INTRO_6: + me->GetMotionMaster()->MovePoint(0, PosMove[1]); + break; + default: + break; + } } - } - if (!UpdateVictim()) return; + } if (me->HasUnitState(UNIT_STATE_CASTING)) return; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index c3244c63de6..bd92617fe84 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -107,7 +107,7 @@ class instance_stratholme : public InstanceMapScript return true; } - sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Cannot open slaugther square yet."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Cannot open slaugther square yet."); return false; } @@ -225,7 +225,7 @@ class instance_stratholme : public InstanceMapScript break; EncounterState[0] = data; events.ScheduleEvent(EVENT_BARON_RUN, 2700000); - sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Baron run in progress."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Baron run in progress."); break; case FAIL: DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM); @@ -283,10 +283,10 @@ class instance_stratholme : public InstanceMapScript //UpdateGoState(ziggurat4GUID, 0, true); if (Creature* pBaron = instance->GetCreature(baronGUID)) pBaron->SummonCreature(NPC_RAMSTEIN, 4032.84f, -3390.24f, 119.73f, 4.71f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000); - sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Ramstein spawned."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Ramstein spawned."); } else - sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: %u Abomnation left to kill.", count); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: %u Abomnation left to kill.", count); } if (data == NOT_STARTED) @@ -295,7 +295,7 @@ class instance_stratholme : public InstanceMapScript if (data == DONE) { events.ScheduleEvent(EVENT_SLAUGHTER_SQUARE, 60000); - sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Slaugther event will continue in 1 minute."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Slaugther event will continue in 1 minute."); } EncounterState[4] = data; break; @@ -431,7 +431,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, "Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN)); + TC_LOG_DEBUG(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)) @@ -441,7 +441,7 @@ class instance_stratholme : public InstanceMapScript HandleGameObject(ziggurat4GUID, true); HandleGameObject(ziggurat5GUID, true); - sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); + TC_LOG_DEBUG(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 d81c001889a..24c9a692a84 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -167,7 +167,7 @@ public: else { //Madrigosa not found, end intro - sLog->outError(LOG_FILTER_TSCR, "Madrigosa was not found"); + TC_LOG_ERROR(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 f6c9b79bbc1..9e312ef8f94 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -264,7 +264,7 @@ public: } else { - sLog->outError(LOG_FILTER_TSCR, "Didn't find Shathrowar. Kalecgos event reseted."); + TC_LOG_ERROR(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 9b95f4bb7c5..499644ed250 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -746,7 +746,7 @@ public: if (pRandomPlayer) DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false); else - sLog->outError(LOG_FILTER_TSCR, "try to cast SPELL_LEGION_LIGHTNING on invalid target"); + TC_LOG_ERROR(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; @@ -1404,7 +1404,7 @@ public: DoMeleeAttackIfReady(); break; } - sLog->outDebug(LOG_FILTER_TSCR, "Sinister-Timer"); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Sinister-Timer"); for (uint8 i = 0; i < 3; ++i) uiTimer[i] -= diff; } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 57699a34e17..cc3f48b72df 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -136,7 +136,7 @@ public: } } else - sLog->outDebug(LOG_FILTER_TSCR, "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); + TC_LOG_DEBUG(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 75e044a3c5e..81d47148b23 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -247,7 +247,7 @@ class boss_janalai : public CreatureScript cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange()); } - //sLog->outError(LOG_FILTER_TSCR, "Eggs %d at middle", templist.size()); + //TC_LOG_ERROR(LOG_FILTER_TSCR, "Eggs %d at middle", templist.size()); if (templist.empty()) return false; @@ -533,7 +533,7 @@ class mob_janalai_hatcher : public CreatureScript cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); } - //sLog->outError(LOG_FILTER_TSCR, "Eggs %d at %d", templist.size(), side); + //TC_LOG_ERROR(LOG_FILTER_TSCR, "Eggs %d at %d", templist.size(), side); for (std::list<Creature*>::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 f61861ebb62..44b1732f1a9 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -218,17 +218,17 @@ class instance_zulaman : public InstanceMapScript return; std::istringstream ss(load); - //sLog->outError(LOG_FILTER_TSCR, "Zul'aman loaded, %s.", ss.str().c_str()); + //TC_LOG_ERROR(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(LOG_FILTER_TSCR, "Zul'aman loaded, %d %d %d.", data1, data2, data3); + //TC_LOG_ERROR(LOG_FILTER_TSCR, "Zul'aman loaded, %d %d %d.", data1, data2, data3); if (dataHead == 'S') { BossKilled = data1; ChestLooted = data2; QuestMinute = data3; - } else sLog->outError(LOG_FILTER_TSCR, "Zul'aman: corrupted save data."); + } else TC_LOG_ERROR(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 97eeb385e15..6fe0934191e 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -222,7 +222,7 @@ class boss_arlokk : public CreatureScript break; case EVENT_MARK_OF_ARLOKK: { - Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1,3), 0.0f, false, -SPELL_MARK_OF_ARLOKK); + Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1, 3), 0.0f, false, -SPELL_MARK_OF_ARLOKK); if (!target) target = me->getVictim(); if (target) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp index e930d864940..fe9c0be49aa 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp @@ -36,9 +36,9 @@ enum Spells enum Events { - EVENT_FROSTBREATH = 0, - EVENT_MASSIVEGEYSER = 1, - EVENT_SLAM = 2 + EVENT_FROSTBREATH = 1, + EVENT_MASSIVEGEYSER = 2, + EVENT_SLAM = 3 }; class boss_gahzranka : public CreatureScript // gahzranka diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp index af8303e63e4..c0362397dd5 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp @@ -35,8 +35,8 @@ enum Spells enum Events { - EVENT_AVATAR = 0, - EVENT_GROUND_TREMOR = 1 + EVENT_AVATAR = 1, + EVENT_GROUND_TREMOR = 2 }; class boss_grilek : public CreatureScript // grilek diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index f9fe338d918..18b1bc21ea3 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -51,17 +51,17 @@ enum Spells enum Events { - EVENT_BLOOD_SIPHON = 0, - EVENT_CORRUPTED_BLOOD = 1, - EVENT_CAUSE_INSANITY = 2, // Spell needs scripting. Event disabled - EVENT_WILL_OF_HAKKAR = 3, - EVENT_ENRAGE = 4, + EVENT_BLOOD_SIPHON = 1, + EVENT_CORRUPTED_BLOOD = 2, + EVENT_CAUSE_INSANITY = 3, // Spell needs scripting. Event disabled + EVENT_WILL_OF_HAKKAR = 4, + EVENT_ENRAGE = 5, // The Aspects of all High Priests events - EVENT_ASPECT_OF_JEKLIK = 5, - EVENT_ASPECT_OF_VENOXIS = 6, - EVENT_ASPECT_OF_MARLI = 7, - EVENT_ASPECT_OF_THEKAL = 8, - EVENT_ASPECT_OF_ARLOKK = 9 + EVENT_ASPECT_OF_JEKLIK = 6, + EVENT_ASPECT_OF_VENOXIS = 7, + EVENT_ASPECT_OF_MARLI = 8, + EVENT_ASPECT_OF_THEKAL = 9, + EVENT_ASPECT_OF_ARLOKK = 10 }; class boss_hakkar : public CreatureScript diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp index b2282ba85da..e92d3266c45 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp @@ -35,9 +35,9 @@ enum Spells enum Events { - EVENT_MANABURN = 0, - EVENT_SLEEP = 1, - EVENT_ILLUSIONS = 2 + EVENT_MANABURN = 1, + EVENT_SLEEP = 2, + EVENT_ILLUSIONS = 3 }; class boss_hazzarah : public CreatureScript diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 166acc13f58..7566c1b2e11 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -48,11 +48,11 @@ enum Spells enum Events { - EVENT_BRAINWASHTOTEM = 0, - EVENT_POWERFULLHEALINGWARD = 1, - EVENT_HEX = 2, - EVENT_DELUSIONSOFJINDO = 3, - EVENT_TELEPORT = 4 + EVENT_BRAINWASHTOTEM = 1, + EVENT_POWERFULLHEALINGWARD = 2, + EVENT_HEX = 3, + EVENT_DELUSIONSOFJINDO = 4, + EVENT_TELEPORT = 5 }; Position const TeleportLoc = {-11583.7783f, -1249.4278f, 77.5471f, 4.745f}; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index bd7b7a8798c..9a94ab02348 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -409,7 +409,7 @@ class spell_threatening_gaze : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - if(Unit* target = GetTarget()) + if (Unit* target = GetTarget()) if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH) caster->CastSpell(target, SPELL_WATCH_CHARGE); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index b1200c2899e..a35e18bee96 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -48,13 +48,13 @@ enum Spells enum Events { - EVENT_SPAWN_START_SPIDERS = 0, // Phase 1 - EVENT_POISON_VOLLEY = 1, // Phase All - EVENT_SPAWN_SPIDER = 2, // Phase All - EVENT_CHARGE_PLAYER = 3, // Phase 3 - EVENT_ASPECT_OF_MARLI = 4, // Phase 2 - EVENT_TRANSFORM = 5, // Phase 2 - EVENT_TRANSFORM_BACK = 6 // Phase 3 + EVENT_SPAWN_START_SPIDERS = 1, // Phase 1 + EVENT_POISON_VOLLEY = 2, // Phase All + EVENT_SPAWN_SPIDER = 3, // Phase All + EVENT_CHARGE_PLAYER = 4, // Phase 3 + EVENT_ASPECT_OF_MARLI = 5, // Phase 2 + EVENT_TRANSFORM = 6, // Phase 2 + EVENT_TRANSFORM_BACK = 7 // Phase 3 }; enum Phases @@ -153,57 +153,54 @@ class boss_marli : public CreatureScript events.ScheduleEvent(EVENT_SPAWN_SPIDER, urand(12000, 17000)); break; case EVENT_TRANSFORM: - { - Talk(SAY_TRANSFORM); - DoCast(me, SPELL_SPIDER_FORM); - const CreatureTemplate* cinfo = me->GetCreatureTemplate(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); - me->UpdateDamagePhysical(BASE_ATTACK); - DoCast(me->getVictim(), SPELL_ENVOLWINGWEB); - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(), -100); - events.ScheduleEvent(EVENT_CHARGE_PLAYER, 1500, 0, PHASE_THREE); - events.ScheduleEvent(EVENT_TRANSFORM_BACK, 25000, 0, PHASE_THREE); - events.SetPhase(PHASE_THREE); - break; - } + { + Talk(SAY_TRANSFORM); + DoCast(me, SPELL_SPIDER_FORM); + CreatureTemplate const* cinfo = me->GetCreatureTemplate(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); + me->UpdateDamagePhysical(BASE_ATTACK); + DoCast(me->getVictim(), SPELL_ENVOLWINGWEB); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(), -100); + events.ScheduleEvent(EVENT_CHARGE_PLAYER, 1500, 0, PHASE_THREE); + events.ScheduleEvent(EVENT_TRANSFORM_BACK, 25000, 0, PHASE_THREE); + events.SetPhase(PHASE_THREE); + break; + } case EVENT_CHARGE_PLAYER: + { + Unit* target = NULL; + int i = 0; + while (i++ < 3) // max 3 tries to get a random target with power_mana { - Unit* target = NULL; - int i = 0; - while (i < 3) // max 3 tries to get a random target with power_mana - { - ++i; - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); // not aggro leader - if (target && target->getPowerType() == POWER_MANA) - i = 3; - } - if (target) - { - DoCast(target, SPELL_CHARGE); - //me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); - //me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1); - AttackStart(target); - } - events.ScheduleEvent(EVENT_CHARGE_PLAYER, 8000, 0, PHASE_THREE); - break; + target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); // not aggro leader + if (target && target->getPowerType() == POWER_MANA) + break; } - case EVENT_TRANSFORM_BACK: + if (target) { - me->SetDisplayId(MODEL_MARLI); - const CreatureTemplate* cinfo = me->GetCreatureTemplate(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); - me->UpdateDamagePhysical(BASE_ATTACK); - events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO); - events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO); - events.ScheduleEvent(EVENT_POISON_VOLLEY, 15000); - events.ScheduleEvent(EVENT_SPAWN_SPIDER, 30000); - events.ScheduleEvent(EVENT_TRANSFORM, urand(35000, 60000), 0, PHASE_TWO); - events.SetPhase(PHASE_TWO); - break; + DoCast(target, SPELL_CHARGE); + AttackStart(target); } + events.ScheduleEvent(EVENT_CHARGE_PLAYER, 8000, 0, PHASE_THREE); + break; + } + case EVENT_TRANSFORM_BACK: + { + me->SetDisplayId(MODEL_MARLI); + CreatureTemplate const* cinfo = me->GetCreatureTemplate(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); + me->UpdateDamagePhysical(BASE_ATTACK); + events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO); + events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO); + events.ScheduleEvent(EVENT_POISON_VOLLEY, 15000); + events.ScheduleEvent(EVENT_SPAWN_SPIDER, 30000); + events.ScheduleEvent(EVENT_TRANSFORM, urand(35000, 60000), 0, PHASE_TWO); + events.SetPhase(PHASE_TWO); + break; + } default: break; } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index f115daf0fb0..0b859b18777 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -59,15 +59,15 @@ enum Spells enum Events { - EVENT_MORTALCLEAVE = 0, // Phase 1 - EVENT_SILENCE = 1, // Phase 1 - EVENT_CHECK_TIMER = 2, // Phase 1 - EVENT_RESURRECT_TIMER = 3, // Phase 1 - EVENT_FRENZY = 4, // Phase 2 - EVENT_FORCEPUNCH = 5, // Phase 2 - EVENT_SPELL_CHARGE = 6, // Phase 2 - EVENT_ENRAGE = 7, // Phase 2 - EVENT_SUMMONTIGERS = 8 // Phase 2 + EVENT_MORTALCLEAVE = 1, // Phase 1 + EVENT_SILENCE = 2, // Phase 1 + EVENT_CHECK_TIMER = 3, // Phase 1 + EVENT_RESURRECT_TIMER = 4, // Phase 1 + EVENT_FRENZY = 5, // Phase 2 + EVENT_FORCEPUNCH = 6, // Phase 2 + EVENT_SPELL_CHARGE = 7, // Phase 2 + EVENT_ENRAGE = 8, // Phase 2 + EVENT_SUMMONTIGERS = 9 // Phase 2 }; enum Phases diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp index 945303f3d10..6fb1c682a38 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp @@ -35,8 +35,8 @@ enum Spells enum Events { - EVENT_LIGHTNINGCLOUD = 0, - EVENT_LIGHTNINGWAVE = 1 + EVENT_LIGHTNINGCLOUD = 1, + EVENT_LIGHTNINGWAVE = 2 }; class boss_wushoolay : public CreatureScript diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp index 80e47dbbf08..a0daf31ced9 100644 --- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp @@ -255,7 +255,7 @@ public: void UpdateAI(uint32 diff) { - //sLog->outInfo(LOG_FILTER_TSCR, "DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); + //TC_LOG_INFO(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 97a4f364109..c3a56e7a2cb 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -82,19 +82,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->outInfo(LOG_FILTER_GENERAL, "Caster just finished preparing the spell (cast bar has expired)"); + TC_LOG_INFO(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->outInfo(LOG_FILTER_GENERAL, "Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects"); } void HandleAfterCast() { - sLog->outInfo(LOG_FILTER_GENERAL, "All immediate Actions for the spell are finished now"); + TC_LOG_INFO(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); @@ -112,7 +112,7 @@ class spell_ex_5581 : public SpellScriptLoader void HandleDummyLaunch(SpellEffIndex /*effIndex*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id); } void HandleDummyLaunchTarget(SpellEffIndex /*effIndex*/) @@ -121,17 +121,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->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID); + TC_LOG_INFO(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->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id); } void HandleDummyHitTarget(SpellEffIndex /*effIndex*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "SPELL_EFFECT_DUMMY is hits it's target!"); + TC_LOG_INFO(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); @@ -139,23 +139,23 @@ class spell_ex_5581 : public SpellScriptLoader void HandleBeforeHit() { - sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to hit target!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell is about to hit target!"); } void HandleOnHit() { - sLog->outInfo(LOG_FILTER_GENERAL, "Spell just hit target!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell just hit target!"); } void HandleAfterHit() { - sLog->outInfo(LOG_FILTER_GENERAL, "Spell just finished hitting target!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell just finished hitting target!"); } void FilterTargets(std::list<Unit*>& /*targetList*/) { // usually you want this call for Area Target spells - sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to add targets from targetList to final targets!"); + TC_LOG_INFO(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 @@ -230,20 +230,20 @@ class spell_ex_66244 : public SpellScriptLoader void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect is about to be applied on target!"); + TC_LOG_INFO(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->outInfo(LOG_FILTER_GENERAL, "Aura Effect is about to be removed from target!"); + TC_LOG_INFO(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->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been applied on target!"); + TC_LOG_INFO(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); @@ -251,7 +251,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been just removed from target!"); + TC_LOG_INFO(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) @@ -263,7 +263,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { - sLog->outInfo(LOG_FILTER_GENERAL, "Perioidic Aura Effect is does a tick on target!"); + TC_LOG_INFO(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); @@ -271,14 +271,14 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectPeriodicUpdate(AuraEffect* aurEff) { - sLog->outInfo(LOG_FILTER_GENERAL, "Perioidic Aura Effect is now updated!"); + TC_LOG_INFO(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->outInfo(LOG_FILTER_GENERAL, "Amount of Aura Effect is being calculated now!"); + TC_LOG_INFO(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 @@ -287,7 +287,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectCalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { - sLog->outInfo(LOG_FILTER_GENERAL, "Periodic data of Aura Effect is being calculated now!"); + TC_LOG_INFO(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; @@ -295,7 +295,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectCalcSpellMod(AuraEffect const* /*aurEff*/, SpellModifier*& spellMod) { - sLog->outInfo(LOG_FILTER_GENERAL, "SpellMod data of Aura Effect is being calculated now!"); + TC_LOG_INFO(LOG_FILTER_GENERAL, "SpellMod data of Aura Effect is being calculated now!"); // we don't want spellmod for example if (spellMod) { @@ -368,14 +368,14 @@ class spell_ex_absorb_aura : public SpellScriptLoader void HandleOnEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - sLog->outInfo(LOG_FILTER_GENERAL, "Our aura is now absorbing damage done to us!"); + TC_LOG_INFO(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->outInfo(LOG_FILTER_GENERAL, "Our aura has absorbed %u damage!", absorbAmount); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Our aura has absorbed %u damage!", absorbAmount); } // function registering @@ -404,7 +404,7 @@ class spell_ex_463 : public SpellScriptLoader bool CheckAreaTarget(Unit* target) { - sLog->outInfo(LOG_FILTER_GENERAL, "Area aura checks if unit is a valid target for it!"); + TC_LOG_INFO(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 5e7c52a8ff3..1544ceee857 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -72,7 +72,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF: ai->Debug = !ai->Debug; - sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled"); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled"); break; } return true; @@ -149,7 +149,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF: ai->Debug = !ai->Debug; - sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled"); + TC_LOG_DEBUG(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 a7d4a7087f8..a624cd4a4f7 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(LOG_FILTER_TSCR, ERROR_INST_DATA); + } else TC_LOG_ERROR(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(LOG_FILTER_TSCR, ERROR_INST_DATA); + TC_LOG_ERROR(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, "HyjalAI: debug mode is enabled. Next Wave in 15 seconds"); + TC_LOG_DEBUG(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(LOG_FILTER_TSCR, ERROR_INST_DATA); + else TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); return 0; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 630c379e71e..87a09749724 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -773,7 +773,7 @@ public: void JustSummoned(Creature* summon) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true); - if (target && summon) + if (target) summon->Attack(target, false); summons.Summon(summon); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 7854322b0c6..fb2c1b3e47d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -276,7 +276,7 @@ public: break; } - sLog->outDebug(LOG_FILTER_TSCR, "Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data); + TC_LOG_DEBUG(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 69054727e4a..8159b53741e 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -331,7 +331,7 @@ public: uint32 entry = 0; entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; - sLog->outDebug(LOG_FILTER_TSCR, "npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry); ++mRiftWaveCount; @@ -356,7 +356,7 @@ public: if (me->IsNonMeleeSpellCasted(false)) return; - sLog->outDebug(LOG_FILTER_TSCR, "npc_time_rift: not casting anylonger, i need to die."); + TC_LOG_DEBUG(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 78b655bb73b..37b39b3a938 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -196,7 +196,7 @@ public: { if (data == IN_PROGRESS) { - sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Starting event."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Dark Portal: Starting event."); InitWorldState(); m_auiEncounter[1] = IN_PROGRESS; NextPortal_Timer = 15000; @@ -205,7 +205,7 @@ public: if (data == DONE) { //this may be completed further out in the post-event - sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Event completed."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Dark Portal: Event completed."); Map::PlayerList const& players = instance->GetPlayers(); if (!players.isEmpty()) @@ -270,7 +270,7 @@ public: if (entry == RIFT_BOSS) entry = RandRiftBoss(); - sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Summoning rift boss entry %u.", entry); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Dark Portal: Summoning rift boss entry %u.", entry); Position pos; me->GetRandomNearPosition(pos, 10.0f); @@ -281,7 +281,7 @@ public: if (Creature* summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000)) return summon; - sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: What just happened there? No boss, no loot, no fun..."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Dark Portal: What just happened there? No boss, no loot, no fun..."); return NULL; } @@ -294,7 +294,7 @@ public: if (tmp >= CurrentRiftId) ++tmp; - sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).", tmp, CurrentRiftId); + TC_LOG_DEBUG(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 b69b8b38945..05ce40f500b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -86,7 +86,7 @@ public: } } - sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); return NULL; } @@ -126,7 +126,7 @@ public: if (!player) { - sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); return; } @@ -142,7 +142,7 @@ public: ++mBarrelCount; DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount); - sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount); m_auiEncounter[0] = IN_PROGRESS; @@ -163,7 +163,7 @@ public: { ++mThrallEventCount; m_auiEncounter[1] = NOT_STARTED; - sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); + TC_LOG_DEBUG(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; @@ -176,29 +176,29 @@ public: m_auiEncounter[3] = data; m_auiEncounter[4] = data; m_auiEncounter[5] = data; - sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); + TC_LOG_DEBUG(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, "Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data); + TC_LOG_DEBUG(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, "Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data); + TC_LOG_DEBUG(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, "Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data); + TC_LOG_DEBUG(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, "Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data); + TC_LOG_DEBUG(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, "Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data); + TC_LOG_DEBUG(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 e661ce42198..b374ed47d55 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -65,7 +65,7 @@ public: return player; } } - sLog->outDebug(LOG_FILTER_TSCR, "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); return NULL; } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index aec78581514..397d20e92f9 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -34,13 +34,13 @@ enum Spells enum Events { - EVENT_STINGER_SPRAY = 0, - EVENT_POISON_STINGER = 1, - EVENT_SUMMON_SWARMER = 2, - EVENT_SWARMER_ATTACK = 3, - EVENT_PARALYZE = 4, - EVENT_LASH = 5, - EVENT_TRASH = 6 + EVENT_STINGER_SPRAY = 1, + EVENT_POISON_STINGER = 2, + EVENT_SUMMON_SWARMER = 3, + EVENT_SWARMER_ATTACK = 4, + EVENT_PARALYZE = 5, + EVENT_LASH = 6, + EVENT_TRASH = 7 }; enum Emotes diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index 0ad077aaa4e..5da6606f05f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -42,11 +42,11 @@ enum Spells enum Events { - EVENT_DISMEMBER = 0, - EVENT_GATHERING_SPEED = 1, - EVENT_FULL_SPEED = 2, - EVENT_CREEPING_PLAGUE = 3, - EVENT_RESPAWN_EGG = 4 + EVENT_DISMEMBER = 1, + EVENT_GATHERING_SPEED = 2, + EVENT_FULL_SPEED = 3, + EVENT_CREEPING_PLAGUE = 4, + EVENT_RESPAWN_EGG = 5 }; enum Phases diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index e6460c00ab6..cd1f5c1befa 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -162,7 +162,7 @@ public: { instance = creature->GetInstanceScript(); if (!instance) - sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI"); SetCombatMovement(false); } @@ -470,7 +470,7 @@ public: instance = creature->GetInstanceScript(); if (!instance) - sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI"); } InstanceScript* instance; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 79bc0c5accf..901438409a4 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -40,10 +40,10 @@ enum Spells enum Events { - EVENT_ARCANE_EXPLOSION = 0, - EVENT_FULLFILMENT = 1, - EVENT_BLINK = 2, - EVENT_EARTH_SHOCK = 3 + EVENT_ARCANE_EXPLOSION = 1, + EVENT_FULLFILMENT = 2, + EVENT_BLINK = 3, + EVENT_EARTH_SHOCK = 4 }; uint32 const BlinkSpells[3] = { 4801, 8195, 20449 }; diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index 5b6993dfef0..cb5c36e4412 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -553,7 +553,7 @@ public: } } else - sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: FlagList is empty!"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "SD2 ERROR: FlagList is empty!"); } void UpdateAI(uint32 diff) diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index 0e858c20d26..3a82a1f9a55 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -61,8 +61,8 @@ enum HauntingWitchHill NPC_RISEN_SPIRIT = 23554, // Events - EVENT_CONSUME_FLESH = 0, - EVENT_INTANGIBLE_PRESENCE = 1, + EVENT_CONSUME_FLESH = 1, + EVENT_INTANGIBLE_PRESENCE = 2, }; class mobs_risen_husk_spirit : public CreatureScript diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index 2b68c0a2cb6..6458047bb60 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -154,14 +154,14 @@ struct DialogueEntry class DialogueHelper { public: - // The array MUST be terminated by {0,0,0} + // The array MUST be terminated by {0, 0, 0} DialogueHelper(DialogueEntry const* dialogueArray) : _dialogueArray(dialogueArray), _currentEntry(NULL), _actionTimer(0), _isFirstSide(true) {} - // The array MUST be terminated by {0,0,0,0,0} + // The array MUST be terminated by {0, 0, 0, 0, 0} /// Function to initialize the dialogue helper for instances. If not used with instances, GetSpeakerByEntry MUST be overwritten to obtain the speakers /// Set if take first entries or second entries @@ -182,9 +182,7 @@ public: } if (!found) - { return; - } DoNextDialogueStep(); } @@ -210,7 +208,7 @@ private: void DoNextDialogueStep() { // Last Dialogue Entry done? - if (_currentEntry && !_currentEntry->TextEntry) + if (!_currentEntry || !_currentEntry->TextEntry) { _actionTimer = 0; return; @@ -400,7 +398,7 @@ public: void WaypointReached(uint32 pointId) { - switch(pointId) + switch (pointId) { case 3: Talk(SAY_ENTER_OWL_THICKET); @@ -439,7 +437,7 @@ public: SetEscortPaused(true); DoSummonPriestess(); Talk(SAY_RANSHALLA_ALTAR_2); - events.ScheduleEvent(EVENT_RESUME,2000); + events.ScheduleEvent(EVENT_RESUME, 2000); break; case 44: // Stop the escort and turn towards the altar diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index 1da1e4ab178..674c35836a2 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -26,7 +26,7 @@ set(scripts_STAT_SRCS 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 + Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp Northrend/Ulduar/Ulduar/boss_hodir.cpp Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp 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 172423187e1..1f461c8c285 100644 --- 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 @@ -366,7 +366,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript if (type < MAX_ENCOUNTERS) { - sLog->outInfo(LOG_FILTER_TSCR, "[ToCr] BossState(type %u) %u = state %u;", type, GetBossState(type), state); + TC_LOG_INFO(LOG_FILTER_TSCR, "[ToCr] BossState(type %u) %u = state %u;", type, GetBossState(type), state); if (state == FAIL) { if (instance->IsHeroic()) 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 a68ea1025d5..090ebbca69d 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -149,6 +149,9 @@ class npc_announcer_toc10 : public CreatureScript } } + if (i >= NUM_MESSAGES) + return false; + player->SEND_GOSSIP_MENU(_GossipMessage[i].msgnum, creature->GetGUID()); return true; } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 451992b1d91..2ce913e56fd 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(LOG_FILTER_TSCR, "Script Gothik: cannot summon triggers!"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "Script Gothik: cannot summon triggers!"); EnterEvadeMode(); return; } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index 3e44fe9eba4..9e369fa83bb 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -33,10 +33,10 @@ enum Spells enum Events { - EVENT_BERSERK = 0, - EVENT_CLOUD = 1, - EVENT_INJECT = 2, - EVENT_SPRAY = 3 + EVENT_BERSERK = 1, + EVENT_CLOUD = 2, + EVENT_INJECT = 3, + EVENT_SPRAY = 4 }; enum CreatureId @@ -46,7 +46,8 @@ enum CreatureId class boss_grobbulus : public CreatureScript { -public: boss_grobbulus() : CreatureScript("boss_grobbulus") { } +public: + boss_grobbulus() : CreatureScript("boss_grobbulus") { } CreatureAI* GetAI(Creature* creature) const { diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index d861343116f..b85c24a22eb 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -754,7 +754,7 @@ public: void UpdateAI(uint32 diff) { - if (!UpdateVictim() && _phase != PHASE_NOT_STARTED && _phase != PHASE_TWO) + if (!instance || (!UpdateVictim() && _phase != PHASE_NOT_STARTED && _phase != PHASE_TWO)) return; events.Update(diff); @@ -854,7 +854,7 @@ public: } } - if (_arcaneReinforcements && instance) + if (_arcaneReinforcements) { for (uint8 rangeDisks = 0; rangeDisks < (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 5); rangeDisks++) { diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 1f8ba3edade..71ef0cbe3ce 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -110,103 +110,107 @@ class npc_verdisa_beglaristrasz_eternos : public CreatureScript public: npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { } - InstanceScript* instance; - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch (creature->GetEntry()) { - case NPC_VERDISA: //Verdisa - switch (action) + case NPC_VERDISA: //Verdisa { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, creature->GetGUID()); - } - else + switch (action) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, creature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(player)) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, creature->GetGUID()); + } + else + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, creature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + player->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); + player->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, creature->GetGUID()); + break; } break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, creature->GetGUID()); - break; - } - break; - case NPC_BELGARISTRASZ: //Belgaristrasz - switch (action) + case NPC_BELGARISTRASZ: //Belgaristrasz { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) + switch (action) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, creature->GetGUID()); - } - else - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, creature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(player)) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, creature->GetGUID()); + } + else + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, creature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + player->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); + player->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, creature->GetGUID()); + break; } break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, creature->GetGUID()); - break; } - break; - case NPC_ETERNOS: //Eternos - switch (action) + case NPC_ETERNOS: //Eternos { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, creature->GetGUID()); - } - else + switch (action) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, creature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(player)) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, creature->GetGUID()); + } + else + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, creature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + player->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); + player->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, creature->GetGUID()); + break; } break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, creature->GetGUID()); - break; } - break; } return true; @@ -235,15 +239,15 @@ public: void MovementInform(uint32 /*type*/, uint32 id) { + if (id) + return; + // When Belgaristraz finish his moving say grateful text if (me->GetEntry() == NPC_BELGARISTRASZ) - if (id == 0) - { - Talk(SAY_BELGARISTRASZ); - } + Talk(SAY_BELGARISTRASZ); + // The gossip flag should activate when Drakos die and not from DB - if (id == 0) - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp new file mode 100644 index 00000000000..105b4757066 --- /dev/null +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -0,0 +1,3221 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "PassiveAI.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" +#include "MoveSplineInit.h" +#include "CreatureTextMgr.h" +#include "ulduar.h" + +enum Yells +{ + // Sara + SAY_SARA_ULDUAR_SCREAM_1 = 0, // screams randomly in a whole instance, unused on retail + SAY_SARA_ULDUAR_SCREAM_2 = 1, // screams randomly in a whole instance, unused on retail + SAY_SARA_AGGRO = 2, + SAY_SARA_FERVOR_HIT = 3, + SAY_SARA_BLESSING_HIT = 4, + SAY_SARA_KILL = 5, + SAY_SARA_TRANSFORM_1 = 6, + SAY_SARA_TRANSFORM_2 = 7, + SAY_SARA_TRANSFORM_3 = 8, + SAY_SARA_TRANSFORM_4 = 9, + SAY_SARA_DEATH_RAY = 10, + SAY_SARA_PSYCHOSIS_HIT = 11, + + // Yogg-Saron + SAY_YOGG_SARON_SPAWN = 0, + SAY_YOGG_SARON_MADNESS = 1, + EMOTE_YOGG_SARON_MADNESS = 2, + SAY_YOGG_SARON_PHASE_3 = 3, + SAY_YOGG_SARON_DEAFENING_ROAR = 4, + EMOTE_YOGG_SARON_DEAFENING_ROAR = 5, + SAY_YOGG_SARON_DEATH = 6, + EMOTE_YOGG_SARON_EMPOWERING_SHADOWS = 7, + EMOTE_YOGG_SARON_EXTINGUISH_ALL_LIFE = 8, + + // Voice of Yogg-Saron + WHISPER_VOICE_PHASE_1_WIPE = 0, + WHISPER_VOICE_INSANE = 1, + + // Brain of Yogg-Saron + EMOTE_BRAIN_ILLUSION_SHATTERED = 0, + + // Ominous Cloud + EMOTE_OMINOUS_CLOUD_PLAYER_TOUCH = 0, + + // Keepers + SAY_KEEPER_CHOSEN_1 = 0, + SAY_KEEPER_CHOSEN_2 = 1, + + // Yogg-Saron illusions + SAY_STORMWIND_ROLEPLAY_4 = 0, + SAY_STORMWIND_ROLEPLAY_7 = 1, + SAY_ICECROWN_ROLEPLAY_5 = 2, + SAY_ICECROWN_ROLEPLAY_6 = 3, + SAY_CHAMBER_ROLEPLAY_5 = 4, + + // Neltharion + SAY_CHAMBER_ROLEPLAY_1 = 0, + SAY_CHAMBER_ROLEPLAY_3 = 1, + + // Ysera + SAY_CHAMBER_ROLEPLAY_2 = 0, + + // Malygos + SAY_CHAMBER_ROLEPLAY_4 = 0, + + // Immolated Champion + SAY_ICECROWN_ROLEPLAY_1 = 0, + SAY_ICECROWN_ROLEPLAY_3 = 1, + + // The Lich King + SAY_ICECROWN_ROLEPLAY_2 = 0, + SAY_ICECROWN_ROLEPLAY_4 = 1, + + // Garona + SAY_STORMWIND_ROLEPLAY_1 = 0, + SAY_STORMWIND_ROLEPLAY_2 = 1, + SAY_STORMWIND_ROLEPLAY_3 = 2, + SAY_STORMWIND_ROLEPLAY_6 = 3, + + // King Llane + SAY_STORMWIND_ROLEPLAY_5 = 0, +}; + +enum Spells +{ + // Voice of Yogg-Saron + SPELL_SUMMON_GUARDIAN_2 = 62978, + SPELL_SANITY_PERIODIC = 63786, + SPELL_SANITY = 63050, + SPELL_INSANE_PERIODIC = 64554, + SPELL_INSANE = 63120, + //SPELL_CLEAR_INSANE = 63122, // when it should be casted? + SPELL_CONSTRICTOR_TENTACLE = 64132, + SPELL_CRUSHER_TENTACLE_SUMMON = 64139, + SPELL_CORRUPTOR_TENTACLE_SUMMON = 64143, + SPELL_IMMORTAL_GUARDIAN = 64158, + + // Sara + SPELL_SARAS_FERVOR = 63138, + SPELL_SARAS_FERVOR_TARGET_SELECTOR = 63747, + SPELL_SARAS_BLESSING = 63134, + SPELL_SARAS_BLESSING_TARGET_SELECTOR = 63745, + SPELL_SARAS_ANGER = 63147, + SPELL_SARAS_ANGER_TARGET_SELECTOR = 63744, + SPELL_FULL_HEAL = 43978, + SPELL_PHASE_2_TRANSFORM = 65157, + SPELL_SHADOWY_BARRIER_SARA = 64775, + SPELL_RIDE_YOGG_SARON_VEHICLE = 61791, + SPELL_PSYCHOSIS = 63795, + SPELL_MALADY_OF_THE_MIND = 63830, + SPELL_BRAIN_LINK = 63802, + SPELL_BRAIN_LINK_DAMAGE = 63803, // red beam + SPELL_BRAIN_LINK_NO_DAMAGE = 63804, // yellow beam + SPELL_DEATH_RAY = 63891, + + // Ominous Cloud + SPELL_OMINOUS_CLOUD_VISUAL = 63084, + SPELL_SUMMON_GUARDIAN_1 = 63031, + + // Guardian of Yogg-Saron + SPELL_DARK_VOLLEY = 63038, + SPELL_SHADOW_NOVA = 62714, + SPELL_SHADOW_NOVA_2 = 65719, + + // Yogg-Saron + SPELL_EXTINGUISH_ALL_LIFE = 64166, + SPELL_SHADOWY_BARRIER_YOGG = 63894, + SPELL_KNOCK_AWAY = 64022, + SPELL_PHASE_3_TRANSFORM = 63895, + SPELL_DEAFENING_ROAR = 64189, + SPELL_LUNATIC_GAZE = 64163, + SPELL_LUNATIC_GAZE_DAMAGE = 64164, + SPELL_SHADOW_BEACON = 64465, + + // Brain of Yogg-Saron + SPELL_MATCH_HEALTH = 64066, + SPELL_MATCH_HEALTH_2 = 64069, + SPELL_INDUCE_MADNESS = 64059, + SPELL_BRAIN_HURT_VISUAL = 64361, + SPELL_SHATTERED_ILLUSION = 64173, + SPELL_SHATTERED_ILLUSION_REMOVE = 65238, + + // Tentacles + SPELL_ERUPT = 64144, + SPELL_TENTACLE_VOID_ZONE = 64017, // used by Corruptor Tentacle and Crusher Tentacle only + + // Crusher Tentacle + SPELL_DIMINISH_POWER = 64145, + SPELL_DIMINSH_POWER = 64148, + SPELL_FOCUSED_ANGER = 57688, + SPELL_CRUSH = 64146, + //SPELL_CRUSH_2 = 65201, // triggered by SPELL_CRUSH, basepoints of SPELL_MALADY_OF_THE_MIND + + // Constrictor Tentacle + SPELL_TENTACLE_VOID_ZONE_2 = 64384, + SPELL_LUNGE = 64131, + + // Corruptor Tentacle + SPELL_APATHY = 64156, + SPELL_BLACK_PLAGUE = 64153, + SPELL_CURSE_OF_DOOM = 64157, + SPELL_DRAINING_POISON = 64152, + + // Immortal Guardian + SPELL_EMPOWERING_SHADOWS = 64468, + SPELL_EMPOWERED = 64161, + SPELL_EMPOWERED_BUFF = 65294, + SPELL_WEAKENED = 64162, + SPELL_DRAIN_LIFE = 64159, + SPELL_RECENTLY_SPAWNED = 64497, + SPELL_SIMPLE_TELEPORT = 64195, + + // Keepers at Observation Ring + SPELL_TELEPORT = 62940, + + // Keepers + SPELL_SIMPLE_TELEPORT_KEEPERS = 12980, + SPELL_KEEPER_ACTIVE = 62647, + + // Mimiron + SPELL_SPEED_OF_INVENTION = 62671, + SPELL_DESTABILIZATION_MATRIX = 65206, + + // Freya + SPELL_RESILIENCE_OF_NATURE = 62670, + SPELL_SANITY_WELL_SUMMON = 64170, + + // Sanity Well + SPELL_SANITY_WELL_VISUAL = 63288, + SPELL_SANITY_WELL = 64169, + + // Thorim + SPELL_FURY_OF_THE_STORM = 62702, + SPELL_TITANIC_STORM = 64171, + + // Hodir + SPELL_FORTITUDE_OF_FROST = 62650, + SPELL_HODIRS_PROTECTIVE_GAZE = 64174, + SPELL_FLASH_FREEZE_VISUAL = 64176, + + // Death Orb + SPELL_DEATH_RAY_ORIGIN_VISUAL = 63893, + + // Death Ray + SPELL_DEATH_RAY_WARNING_VISUAL = 63882, + SPELL_DEATH_RAY_PERIODIC = 63883, + SPELL_DEATH_RAY_DAMAGE_VISUAL = 63886, + + // Laughing Skull + SPELL_LUNATIC_GAZE_SKULL = 64167, + + // Descend Into Madness + SPELL_TELEPORT_PORTAL_VISUAL = 64416, + + // Illusions + SPELL_GRIM_REPRISAL = 63305, + SPELL_GRIM_REPRISAL_DAMAGE = 64039, + + // Suit of Armor + SPELL_NONDESCRIPT_1 = 64013, + + // Dragon Consorts & Deathsworn Zealot + SPELL_NONDESCRIPT_2 = 64010, + + // Garona + SPELL_ASSASSINATE = 64063, + + // King Llane + SPELL_PERMANENT_FEIGN_DEATH = 29266, + + // The Lich King + SPELL_DEATHGRASP = 63037, + + // Turned Champion + SPELL_VERTEX_COLOR_BLACK = 39662, + + // Player self cast spells + SPELL_MALADY_OF_THE_MIND_JUMP = 63881, + SPELL_ILLUSION_ROOM = 63988, + SPELL_HATE_TO_ZERO = 63984, + SPELL_TELEPORT_BACK_TO_MAIN_ROOM = 63992, + SPELL_INSANE_VISUAL = 64464, + SPELL_CONSTRICTOR_TENTACLE_SUMMON = 64133, + SPELL_SQUEEZE = 64125, + SPELL_FLASH_FREEZE = 64175, + SPELL_LOW_SANITY_SCREEN_EFFECT = 63752, + + SPELL_IN_THE_MAWS_OF_THE_OLD_GOD = 64184, +}; + +enum Phases +{ + PHASE_ONE = 1, + PHASE_TRANSFORM = 2, + PHASE_TWO = 3, + PHASE_THREE = 4, +}; + +enum Events +{ + // Voice of Yogg-Saron + EVENT_LOCK_DOOR = 1, + EVENT_SUMMON_GUARDIAN_OF_YOGG_SARON = 2, + EVENT_SUMMON_CORRUPTOR_TENTACLE = 3, + EVENT_SUMMON_CONSTRICTOR_TENTACLE = 4, + EVENT_SUMMON_CRUSHER_TENTACLE = 5, + EVENT_ILLUSION = 6, + EVENT_SUMMON_IMMORTAL_GUARDIAN = 7, + EVENT_EXTINGUISH_ALL_LIFE = 8, // handled by Voice, timer starts at the beginning of the fight (Yogg-Saron is not spawned at this moment) + + // Sara + EVENT_SARAS_FERVOR = 9, + EVENT_SARAS_BLESSING = 10, + EVENT_SARAS_ANGER = 11, + EVENT_TRANSFORM_1 = 12, + EVENT_TRANSFORM_2 = 13, + EVENT_TRANSFORM_3 = 14, + EVENT_TRANSFORM_4 = 15, + EVENT_PSYCHOSIS = 16, + EVENT_MALADY_OF_THE_MIND = 17, + EVENT_BRAIN_LINK = 18, + EVENT_DEATH_RAY = 19, + + // Tentacles + EVENT_DIMINISH_POWER = 20, + EVENT_CAST_RANDOM_SPELL = 21, + + // Yogg-Saron + EVENT_YELL_BOW_DOWN = 22, + EVENT_SHADOW_BEACON = 23, + EVENT_LUNATIC_GAZE = 24, + EVENT_DEAFENING_ROAR = 25, // only on 25-man with 0-3 keepers active (Hard Mode) + + // Guardian of Yogg-Saron + EVENT_DARK_VOLLEY = 26, + + // Immortal Guardian + EVENT_DRAIN_LIFE = 27, + + // Keepers + EVENT_DESTABILIZATION_MATRIX = 28, + EVENT_HODIRS_PROTECTIVE_GAZE = 29, + + // Chamber Illusion + EVENT_CHAMBER_ROLEPLAY_1 = 30, + EVENT_CHAMBER_ROLEPLAY_2 = 31, + EVENT_CHAMBER_ROLEPLAY_3 = 32, + EVENT_CHAMBER_ROLEPLAY_4 = 33, + EVENT_CHAMBER_ROLEPLAY_5 = 34, + + // Icecrown Illusion + EVENT_ICECROWN_ROLEPLAY_1 = 35, + EVENT_ICECROWN_ROLEPLAY_2 = 36, + EVENT_ICECROWN_ROLEPLAY_3 = 37, + EVENT_ICECROWN_ROLEPLAY_4 = 38, + EVENT_ICECROWN_ROLEPLAY_5 = 39, + EVENT_ICECROWN_ROLEPLAY_6 = 40, + + // Stormwind Illusion + EVENT_STORMWIND_ROLEPLAY_1 = 41, + EVENT_STORMWIND_ROLEPLAY_2 = 42, + EVENT_STORMWIND_ROLEPLAY_3 = 43, + EVENT_STORMWIND_ROLEPLAY_4 = 44, + EVENT_STORMWIND_ROLEPLAY_5 = 45, + EVENT_STORMWIND_ROLEPLAY_6 = 46, + EVENT_STORMWIND_ROLEPLAY_7 = 47, +}; + +enum EventGroups +{ + EVENT_GROUP_SUMMON_TENTACLES = 1, +}; + +enum Actions +{ + ACTION_PHASE_TRANSFORM = 0, + ACTION_PHASE_TWO = 1, + ACTION_PHASE_THREE = 2, + ACTION_INDUCE_MADNESS = 3, + ACTION_SANITY_WELLS = 4, + ACTION_FLASH_FREEZE = 5, + ACTION_TENTACLE_KILLED = 6, + ACTION_START_ROLEPLAY = 8, + ACTION_TOGGLE_SHATTERED_ILLUSION = 9, +}; + +enum CreatureGroups +{ + CREATURE_GROUP_CLOUDS = 0, + CREATURE_GROUP_PORTALS_10 = 1, + CREATURE_GROUP_PORTALS_25 = 2, +}; + +Position const YoggSaronSpawnPos = {1980.43f, -25.7708f, 324.9724f, 3.141593f}; +Position const ObservationRingKeepersPos[4] = +{ + {1945.682f, 33.34201f, 411.4408f, 5.270895f}, // Freya + {1945.761f, -81.52171f, 411.4407f, 1.029744f}, // Hodir + {2028.822f, -65.73573f, 411.4426f, 2.460914f}, // Thorim + {2028.766f, 17.42014f, 411.4446f, 3.857178f}, // Mimiron +}; +Position const YSKeepersPos[4] = +{ + {2036.873f, 25.42513f, 338.4984f, 3.909538f}, // Freya + {1939.045f, -90.87457f, 338.5426f, 0.994837f}, // Hodir + {1939.148f, 42.49035f, 338.5427f, 5.235988f}, // Thorim + {2036.658f, -73.58822f, 338.4985f, 2.460914f}, // Mimiron +}; +Position const IllusionsMiscPos[2] = +{ + {1928.793f, 65.03109f, 242.3763f, 0.0f}, // Garona end position + {1912.324f, -155.7967f, 239.9896f, 0.0f}, // Saurfang end position +}; + +enum MiscData +{ + ACHIEV_TIMED_START_EVENT = 21001, + SOUND_LUNATIC_GAZE = 15757, +}; + +class StartAttackEvent : public BasicEvent +{ + public: + StartAttackEvent(Creature* summoner, Creature* owner) + : _summoner(summoner), _owner(owner) + { + } + + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->SetReactState(REACT_AGGRESSIVE); + if (Unit* target = _summoner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 300.0f)) + _owner->AI()->AttackStart(target); + return true; + } + + private: + Creature* _summoner; + Creature* _owner; +}; + +class boss_voice_of_yogg_saron : public CreatureScript +{ + public: + boss_voice_of_yogg_saron() : CreatureScript("boss_voice_of_yogg_saron") { } + + struct boss_voice_of_yogg_saronAI : public BossAI + { + boss_voice_of_yogg_saronAI(Creature* creature) : BossAI(creature, BOSS_YOGG_SARON) + { + SetCombatMovement(false); + } + + void MoveInLineOfSight(Unit* who) + { + // TODO: MoveInLineOfSight doesn't work for such a big distance + if (who->GetTypeId() == TYPEID_PLAYER && me->GetDistance2d(who) < 99.0f && !me->isInCombat()) + me->SetInCombatWithZone(); + } + + void EnterEvadeMode() + { + BossAI::EnterEvadeMode(); + + for (uint8 i = DATA_SARA; i <= DATA_MIMIRON_YS; ++i) + if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) + creature->AI()->EnterEvadeMode(); + + // not sure, spoken by Sara (sound), regarding to wowwiki Voice whispers it + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->getSource()) + { + if (events.IsInPhase(PHASE_ONE)) + Talk(WHISPER_VOICE_PHASE_1_WIPE, player->GetGUID()); + + player->RemoveAurasDueToSpell(SPELL_SANITY); + player->RemoveAurasDueToSpell(SPELL_INSANE); + } + } + + void Reset() + { + _Reset(); + events.SetPhase(PHASE_ONE); + + instance->SetData(DATA_DRIVE_ME_CRAZY, uint32(true)); + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + + _guardiansCount = 0; + _guardianTimer = 20000; + _illusionShattered = false; + + bool clockwise = false; + std::list<TempSummon*> clouds; + me->SummonCreatureGroup(CREATURE_GROUP_CLOUDS, &clouds); + clouds.sort(Trinity::ObjectDistanceOrderPred(me, true)); + for (std::list<TempSummon*>::const_iterator itr = clouds.begin(); itr != clouds.end(); ++itr) + { + (*itr)->AI()->DoAction(int32(clockwise)); + clockwise = !clockwise; + } + } + + void EnterCombat(Unit* /*who*/) + { + if (Creature* sara = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARA))) + sara->SetInCombatWith(me); + + for (uint8 i = DATA_FREYA_YS; i <= DATA_MIMIRON_YS; ++i) + if (Creature* keeper = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) + keeper->SetInCombatWith(me); + + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + + me->CastCustomSpell(SPELL_SUMMON_GUARDIAN_2, SPELLVALUE_MAX_TARGETS, 1); + DoCast(me, SPELL_SANITY_PERIODIC); + + events.ScheduleEvent(EVENT_LOCK_DOOR, 15000); + events.ScheduleEvent(EVENT_SUMMON_GUARDIAN_OF_YOGG_SARON, _guardianTimer, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_EXTINGUISH_ALL_LIFE, 900000); // 15 minutes + } + + void JustDied(Unit* killer) + { + // don't despawn Yogg-Saron's corpse, remove him from SummonList! + if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON))) + summons.Despawn(yogg); + + BossAI::JustDied(killer); + } + + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + // don't summon tentacles when illusion is shattered, delay them + if (_illusionShattered) + events.DelayEvents(diff, EVENT_GROUP_SUMMON_TENTACLES); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_LOCK_DOOR: + DoCast(me, SPELL_INSANE_PERIODIC); + instance->SetBossState(BOSS_YOGG_SARON, IN_PROGRESS); + break; + case EVENT_EXTINGUISH_ALL_LIFE: + if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON))) + { + yogg->AI()->Talk(EMOTE_YOGG_SARON_EXTINGUISH_ALL_LIFE, me->GetGUID()); + yogg->CastSpell((Unit*)NULL, SPELL_EXTINGUISH_ALL_LIFE, true); + } + events.ScheduleEvent(EVENT_EXTINGUISH_ALL_LIFE, 10000); // cast it again after a short while, players can survive + break; + case EVENT_SUMMON_GUARDIAN_OF_YOGG_SARON: + me->CastCustomSpell(SPELL_SUMMON_GUARDIAN_2, SPELLVALUE_MAX_TARGETS, 1); + ++_guardiansCount; + if (_guardiansCount <= 6 && _guardiansCount % 3 == 0) + _guardianTimer -= 5000; + events.ScheduleEvent(EVENT_SUMMON_GUARDIAN_OF_YOGG_SARON, _guardianTimer, 0, PHASE_ONE); + break; + case EVENT_SUMMON_CORRUPTOR_TENTACLE: + DoCastAOE(SPELL_CORRUPTOR_TENTACLE_SUMMON); + events.ScheduleEvent(EVENT_SUMMON_CORRUPTOR_TENTACLE, 30000, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); + break; + case EVENT_SUMMON_CONSTRICTOR_TENTACLE: + me->CastCustomSpell(SPELL_CONSTRICTOR_TENTACLE, SPELLVALUE_MAX_TARGETS, 1); + events.ScheduleEvent(EVENT_SUMMON_CONSTRICTOR_TENTACLE, 25000, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); + break; + case EVENT_SUMMON_CRUSHER_TENTACLE: + DoCastAOE(SPELL_CRUSHER_TENTACLE_SUMMON); + events.ScheduleEvent(EVENT_SUMMON_CRUSHER_TENTACLE, 60000, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); + break; + case EVENT_ILLUSION: + { + if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON))) + { + yogg->AI()->Talk(EMOTE_YOGG_SARON_MADNESS); + yogg->AI()->Talk(SAY_YOGG_SARON_MADNESS); + } + + me->SummonCreatureGroup(CREATURE_GROUP_PORTALS_10); + if (me->GetMap()->Is25ManRaid()) + me->SummonCreatureGroup(CREATURE_GROUP_PORTALS_25); + + uint8 illusion = urand(CHAMBER_ILLUSION, STORMWIND_ILLUSION); + instance->SetData(DATA_ILLUSION, illusion); + + if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRAIN_OF_YOGG_SARON))) + brain->AI()->DoAction(ACTION_INDUCE_MADNESS); + events.ScheduleEvent(EVENT_ILLUSION, 80000, 0, PHASE_TWO); // wowwiki says 80 secs, wowhead says something about 90 secs + break; + } + case EVENT_SUMMON_IMMORTAL_GUARDIAN: + DoCastAOE(SPELL_IMMORTAL_GUARDIAN); + events.ScheduleEvent(EVENT_SUMMON_IMMORTAL_GUARDIAN, 15000, 0, PHASE_THREE); + break; + default: + break; + } + } + } + + void DoAction(int32 action) + { + switch (action) + { + case ACTION_PHASE_TRANSFORM: + events.SetPhase(PHASE_TRANSFORM); + summons.DespawnEntry(NPC_OMINOUS_CLOUD); + break; + case ACTION_PHASE_TWO: + events.SetPhase(PHASE_TWO); + me->SummonCreature(NPC_YOGG_SARON, YoggSaronSpawnPos); + if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRAIN_OF_YOGG_SARON))) + brain->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_SUMMON_CORRUPTOR_TENTACLE, 1, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); + events.ScheduleEvent(EVENT_SUMMON_CONSTRICTOR_TENTACLE, 1, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); + events.ScheduleEvent(EVENT_SUMMON_CRUSHER_TENTACLE, 1, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); + events.ScheduleEvent(EVENT_ILLUSION, 60000, 0, PHASE_TWO); + break; + case ACTION_TOGGLE_SHATTERED_ILLUSION: + _illusionShattered = !_illusionShattered; + break; + case ACTION_PHASE_THREE: + events.SetPhase(PHASE_THREE); + events.ScheduleEvent(EVENT_SUMMON_IMMORTAL_GUARDIAN, 1000, 0, PHASE_THREE); + break; + default: + break; + } + } + + void JustSummoned(Creature* summon) + { + switch (summon->GetEntry()) + { + case NPC_GUARDIAN_OF_YOGG_SARON: + summon->m_Events.AddEvent(new StartAttackEvent(me, summon), summon->m_Events.CalculateTime(1000)); + break; + case NPC_YOGG_SARON: + summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); + break; + case NPC_CONSTRICTOR_TENTACLE: + summon->CastSpell(summon, SPELL_LUNGE, true); + break; + case NPC_CRUSHER_TENTACLE: + case NPC_CORRUPTOR_TENTACLE: + summon->SetReactState(REACT_PASSIVE); + summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); + summon->m_Events.AddEvent(new StartAttackEvent(me, summon), summon->m_Events.CalculateTime(5000)); + break; + case NPC_DESCEND_INTO_MADNESS: + summon->CastSpell(summon, SPELL_TELEPORT_PORTAL_VISUAL, true); + break; + case NPC_IMMORTAL_GUARDIAN: + summon->CastSpell(summon, SPELL_SIMPLE_TELEPORT, true); + break; + } + + BossAI::JustSummoned(summon); + } + + private: + uint8 _guardiansCount; + uint32 _guardianTimer; + bool _illusionShattered; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<boss_voice_of_yogg_saronAI>(creature); + } +}; + +class boss_sara : public CreatureScript +{ + public: + boss_sara() : CreatureScript("boss_sara") { } + + struct boss_saraAI : public ScriptedAI + { + boss_saraAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } + + uint64 GetLinkedPlayerGUID(uint64 guid) const + { + std::map<uint64, uint64>::const_iterator itr = _linkData.find(guid); + if (itr != _linkData.end()) + return itr->second; + + return 0; + } + + void SetLinkBetween(uint64 player1, uint64 player2) + { + _linkData[player1] = player2; + _linkData[player2] = player1; + } + + // called once for each target on aura remove + void RemoveLinkFrom(uint64 player1) + { + _linkData.erase(player1); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (_events.IsInPhase(PHASE_ONE) && damage >= me->GetHealth()) + { + damage = 0; + + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + voice->AI()->DoAction(ACTION_PHASE_TRANSFORM); + + Talk(SAY_SARA_TRANSFORM_1); + _events.SetPhase(PHASE_TRANSFORM); + _events.ScheduleEvent(EVENT_TRANSFORM_1, 4700, 0, PHASE_TRANSFORM); + _events.ScheduleEvent(EVENT_TRANSFORM_2, 9500, 0, PHASE_TRANSFORM); + _events.ScheduleEvent(EVENT_TRANSFORM_3, 14300, 0, PHASE_TRANSFORM); + _events.ScheduleEvent(EVENT_TRANSFORM_4, 14500, 0, PHASE_TRANSFORM); + } + } + + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) + { + if (!roll_chance_i(30) || _events.IsInPhase(PHASE_TRANSFORM)) + return; + + switch (spell->Id) + { + case SPELL_SARAS_FERVOR: + Talk(SAY_SARA_FERVOR_HIT); + break; + case SPELL_SARAS_BLESSING: + Talk(SAY_SARA_BLESSING_HIT); + break; + case SPELL_PSYCHOSIS: + Talk(SAY_SARA_PSYCHOSIS_HIT); + break; + default: + break; + } + } + + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode()) + Talk(SAY_SARA_KILL); + } + + void EnterCombat(Unit* /*who*/) + { + Talk(SAY_SARA_AGGRO); + _events.ScheduleEvent(EVENT_SARAS_FERVOR, 5000, 0, PHASE_ONE); + _events.ScheduleEvent(EVENT_SARAS_BLESSING, urand(10000, 30000), 0, PHASE_ONE); + _events.ScheduleEvent(EVENT_SARAS_ANGER, urand(15000, 25000), 0, PHASE_ONE); + } + + void Reset() + { + me->RemoveAllAuras(); + me->SetReactState(REACT_PASSIVE); + me->setFaction(35); + _events.Reset(); + _events.SetPhase(PHASE_ONE); + } + + void UpdateAI(uint32 diff) + { + if (!me->isInCombat()) + return; + + if (me->HasAura(SPELL_SHATTERED_ILLUSION)) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SARAS_FERVOR: + me->CastCustomSpell(SPELL_SARAS_FERVOR_TARGET_SELECTOR, SPELLVALUE_MAX_TARGETS, 1); + _events.ScheduleEvent(EVENT_SARAS_FERVOR, 6000, 0, PHASE_ONE); + break; + case EVENT_SARAS_ANGER: + me->CastCustomSpell(SPELL_SARAS_ANGER_TARGET_SELECTOR, SPELLVALUE_MAX_TARGETS, 1); + _events.ScheduleEvent(EVENT_SARAS_ANGER, urand(6000, 8000), 0, PHASE_ONE); + break; + case EVENT_SARAS_BLESSING: + me->CastCustomSpell(SPELL_SARAS_BLESSING_TARGET_SELECTOR, SPELLVALUE_MAX_TARGETS, 1); + _events.ScheduleEvent(EVENT_SARAS_BLESSING, urand(6000, 30000), 0, PHASE_ONE); + break; + case EVENT_TRANSFORM_1: + Talk(SAY_SARA_TRANSFORM_2); + break; + case EVENT_TRANSFORM_2: + Talk(SAY_SARA_TRANSFORM_3); + break; + case EVENT_TRANSFORM_3: + Talk(SAY_SARA_TRANSFORM_4); + DoCast(me, SPELL_FULL_HEAL); + me->setFaction(16); + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + voice->AI()->DoAction(ACTION_PHASE_TWO); + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MIMIRON_YS))) + mimiron->AI()->DoAction(ACTION_PHASE_TWO); + break; + case EVENT_TRANSFORM_4: + DoCast(me, SPELL_PHASE_2_TRANSFORM); + if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_YOGG_SARON))) + DoCast(yogg, SPELL_RIDE_YOGG_SARON_VEHICLE); + DoCast(me, SPELL_SHADOWY_BARRIER_SARA); + _events.SetPhase(PHASE_TWO); + _events.ScheduleEvent(EVENT_DEATH_RAY, 20000, 0, PHASE_TWO); // almost never casted at scheduled time, why? + _events.ScheduleEvent(EVENT_MALADY_OF_THE_MIND, 18000, 0, PHASE_TWO); + _events.ScheduleEvent(EVENT_PSYCHOSIS, 1, 0, PHASE_TWO); + _events.ScheduleEvent(EVENT_BRAIN_LINK, 23000, 0, PHASE_TWO); + break; + case EVENT_DEATH_RAY: + DoCast(me, SPELL_DEATH_RAY); + _events.ScheduleEvent(EVENT_DEATH_RAY, 21000, 0, PHASE_TWO); + break; + case EVENT_MALADY_OF_THE_MIND: + me->CastCustomSpell(SPELL_MALADY_OF_THE_MIND, SPELLVALUE_MAX_TARGETS, 1); + _events.ScheduleEvent(EVENT_MALADY_OF_THE_MIND, urand(18000, 25000), 0, PHASE_TWO); + break; + case EVENT_PSYCHOSIS: + me->CastCustomSpell(SPELL_PSYCHOSIS, SPELLVALUE_MAX_TARGETS, 1); + _events.ScheduleEvent(EVENT_PSYCHOSIS, 4000, 0, PHASE_TWO); + break; + case EVENT_BRAIN_LINK: + me->CastCustomSpell(SPELL_BRAIN_LINK, SPELLVALUE_MAX_TARGETS, 2); + _events.ScheduleEvent(EVENT_BRAIN_LINK, urand(23000, 26000), 0, PHASE_TWO); + break; + default: + break; + } + } + } + + void JustSummoned(Creature* summon) + { + summon->SetReactState(REACT_PASSIVE); + + switch (summon->GetEntry()) + { + case NPC_DEATH_ORB: + Talk(SAY_SARA_DEATH_RAY); + summon->CastSpell(summon, SPELL_DEATH_RAY_ORIGIN_VISUAL); + for (uint8 i = 0; i < 4; ++i) + { + Position pos; + float radius = frand(25.0f, 50.0f); + float angle = frand(0.0f, 2.0f * M_PI); + pos.m_positionX = YoggSaronSpawnPos.GetPositionX() + radius * cosf(angle); + pos.m_positionY = YoggSaronSpawnPos.GetPositionY() + radius * sinf(angle); + pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), YoggSaronSpawnPos.GetPositionZ() + 5.0f); + me->SummonCreature(NPC_DEATH_RAY, pos, TEMPSUMMON_TIMED_DESPAWN, 20000); + } + break; + case NPC_DEATH_RAY: + summon->CastSpell(summon, SPELL_DEATH_RAY_WARNING_VISUAL); + break; + } + + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + voice->AI()->JustSummoned(summon); + } + + void DoAction(int32 action) + { + switch (action) + { + case ACTION_PHASE_THREE: // Sara does nothing in phase 3 + _events.SetPhase(PHASE_THREE); + break; + default: + break; + } + } + + private: + EventMap _events; + InstanceScript* _instance; + std::map<uint64, uint64> _linkData; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<boss_saraAI>(creature); + } +}; + +class boss_yogg_saron : public CreatureScript +{ + public: + boss_yogg_saron() : CreatureScript("boss_yogg_saron") { } + + struct boss_yogg_saronAI : public PassiveAI + { + boss_yogg_saronAI(Creature* creature) : PassiveAI(creature), _instance(creature->GetInstanceScript()) { } + + void Reset() + { + _events.Reset(); + _events.SetPhase(PHASE_TWO); + _events.ScheduleEvent(EVENT_YELL_BOW_DOWN, 3000, 0, PHASE_TWO); + DoCast(me, SPELL_SHADOWY_BARRIER_YOGG); + DoCast(me, SPELL_KNOCK_AWAY); + + me->ResetLootMode(); + switch (_instance->GetData(DATA_KEEPERS_COUNT)) + { + case 0: + me->AddLootMode(LOOT_MODE_HARD_MODE_4); + case 1: + me->AddLootMode(LOOT_MODE_HARD_MODE_3); + case 2: + me->AddLootMode(LOOT_MODE_HARD_MODE_2); + case 3: + me->AddLootMode(LOOT_MODE_HARD_MODE_1); + } + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_IN_THE_MAWS_OF_THE_OLD_GOD) + me->AddLootMode(32); + } + + void JustDied(Unit* /*killer*/) + { + Talk(SAY_YOGG_SARON_DEATH); + + if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + me->Kill(creature); + + for (uint8 i = DATA_SARA; i <= DATA_BRAIN_OF_YOGG_SARON; ++i) + if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(i))) + creature->DisappearAndDie(); + + for (uint8 i = DATA_FREYA_YS; i <= DATA_MIMIRON_YS; ++i) + if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(i))) + creature->AI()->EnterEvadeMode(); + + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->getSource()) + { + player->RemoveAurasDueToSpell(SPELL_SANITY); + player->RemoveAurasDueToSpell(SPELL_INSANE); + } + } + + void UpdateAI(uint32 diff) + { + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_YELL_BOW_DOWN: + Talk(SAY_YOGG_SARON_SPAWN); + break; + case EVENT_SHADOW_BEACON: + DoCastAOE(SPELL_SHADOW_BEACON); + Talk(EMOTE_YOGG_SARON_EMPOWERING_SHADOWS); + _events.ScheduleEvent(EVENT_SHADOW_BEACON, 45000, 0, PHASE_THREE); + break; + case EVENT_LUNATIC_GAZE: + DoCast(me, SPELL_LUNATIC_GAZE); + sCreatureTextMgr->SendSound(me, SOUND_LUNATIC_GAZE, CHAT_MSG_MONSTER_YELL, 0, TEXT_RANGE_NORMAL, TEAM_OTHER, false); + _events.ScheduleEvent(EVENT_LUNATIC_GAZE, 12000, 0, PHASE_THREE); + break; + case EVENT_DEAFENING_ROAR: + DoCastAOE(SPELL_DEAFENING_ROAR); + Talk(SAY_YOGG_SARON_DEAFENING_ROAR); + Talk(EMOTE_YOGG_SARON_DEAFENING_ROAR); + _events.ScheduleEvent(EVENT_DEAFENING_ROAR, urand(20000, 25000), 0, PHASE_THREE); // timer guessed + break; + default: + break; + } + } + } + + void DoAction(int32 action) + { + switch (action) + { + case ACTION_PHASE_THREE: + _events.SetPhase(PHASE_THREE); + _events.ScheduleEvent(EVENT_SHADOW_BEACON, 45000, 0, PHASE_THREE); + _events.ScheduleEvent(EVENT_LUNATIC_GAZE, 12000, 0, PHASE_THREE); + if (me->GetMap()->Is25ManRaid() && _instance->GetData(DATA_KEEPERS_COUNT) < 4) + _events.ScheduleEvent(EVENT_DEAFENING_ROAR, urand(20000, 25000), 0, PHASE_THREE); // timer guessed + Talk(SAY_YOGG_SARON_PHASE_3); + DoCast(me, SPELL_PHASE_3_TRANSFORM); + me->RemoveAurasDueToSpell(SPELL_SHADOWY_BARRIER_YOGG); + break; + default: + break; + } + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<boss_yogg_saronAI>(creature); + } +}; + +class boss_brain_of_yogg_saron : public CreatureScript +{ + public: + boss_brain_of_yogg_saron() : CreatureScript("boss_brain_of_yogg_saron") { } + + struct boss_brain_of_yogg_saronAI : public PassiveAI + { + boss_brain_of_yogg_saronAI(Creature* creature) : PassiveAI(creature), _instance(creature->GetInstanceScript()), _summons(creature) { } + + void Reset() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_MATCH_HEALTH); + _summons.DespawnAll(); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (me->HealthBelowPctDamaged(30, damage) && !me->HasAura(SPELL_BRAIN_HURT_VISUAL)) + { + me->RemoveAllAuras(); + me->InterruptNonMeleeSpells(true); + DoCastAOE(SPELL_SHATTERED_ILLUSION_REMOVE, true); + DoCast(me, SPELL_MATCH_HEALTH_2, true); // it doesn't seem to hit Yogg-Saron here + DoCast(me, SPELL_BRAIN_HURT_VISUAL, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + voice->AI()->DoAction(ACTION_PHASE_THREE); + if (Creature* sara = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SARA))) + sara->AI()->DoAction(ACTION_PHASE_THREE); + if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_YOGG_SARON))) + yogg->AI()->DoAction(ACTION_PHASE_THREE); + + for (uint8 i = DATA_THORIM_YS; i <= DATA_MIMIRON_YS; ++i) + if (Creature* keeper = ObjectAccessor::GetCreature(*me, _instance->GetData64(i))) + keeper->AI()->DoAction(ACTION_PHASE_THREE); + } + } + + void UpdateAI(uint32 /*diff*/) { } + + void DoAction(int32 action) + { + switch (action) + { + case ACTION_INDUCE_MADNESS: + { + _tentaclesKilled = 0; + + me->SummonCreatureGroup(_instance->GetData(DATA_ILLUSION)); + + // make sure doors won't be opened + for (uint32 i = GO_BRAIN_ROOM_DOOR_1; i <= GO_BRAIN_ROOM_DOOR_3; ++i) + _instance->HandleGameObject(_instance->GetData64(i), false); + + DoCastAOE(SPELL_INDUCE_MADNESS); + break; + } + case ACTION_TENTACLE_KILLED: + { + uint8 illusion = _instance->GetData(DATA_ILLUSION); + if (++_tentaclesKilled >= (illusion == ICECROWN_ILLUSION ? 9 : 8)) + { + sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA); + _summons.DespawnAll(); + DoCastAOE(SPELL_SHATTERED_ILLUSION, true); + _instance->HandleGameObject(_instance->GetData64(GO_BRAIN_ROOM_DOOR_1 + illusion), true); + + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + voice->AI()->DoAction(ACTION_TOGGLE_SHATTERED_ILLUSION); + } + break; + } + default: + break; + } + } + + void JustSummoned(Creature* summon) + { + _summons.Summon(summon); + } + + private: + InstanceScript* _instance; + SummonList _summons; + uint8 _tentaclesKilled; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<boss_brain_of_yogg_saronAI>(creature); + } +}; + +class npc_ominous_cloud : public CreatureScript +{ + public: + npc_ominous_cloud() : CreatureScript("npc_ominous_cloud") { } + + struct npc_ominous_cloudAI : public PassiveAI + { + npc_ominous_cloudAI(Creature* creature) : PassiveAI(creature) { } + + void Reset() + { + DoCast(me, SPELL_OMINOUS_CLOUD_VISUAL); + } + + void FillCirclePath(Position const& centerPos, float radius, float z, Movement::PointsArray& path, bool clockwise) + { + float step = clockwise ? -M_PI / 8.0f : M_PI / 8.0f; + float angle = centerPos.GetAngle(me->GetPositionX(), me->GetPositionY()); + + for (uint8 i = 0; i < 16; angle += step, ++i) + { + G3D::Vector3 point; + point.x = centerPos.GetPositionX() + radius * cosf(angle); + point.y = centerPos.GetPositionY() + radius * sinf(angle); + point.z = me->GetMap()->GetHeight(me->GetPhaseMask(), point.x, point.y, z + 5.0f); + path.push_back(point); + } + } + + void UpdateAI(uint32 /*diff*/) { } + + void DoAction(int32 action) + { + Movement::MoveSplineInit init(me); + FillCirclePath(YoggSaronSpawnPos, me->GetDistance2d(YoggSaronSpawnPos.GetPositionX(), YoggSaronSpawnPos.GetPositionY()), me->GetPositionZ(), init.Path(), action); + init.SetWalk(true); + init.SetCyclic(); + init.Launch(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_ominous_cloudAI>(creature); + } +}; + +class npc_guardian_of_yogg_saron : public CreatureScript +{ + public: + npc_guardian_of_yogg_saron() : CreatureScript("npc_guardian_of_yogg_saron") { } + + struct npc_guardian_of_yogg_saronAI : public ScriptedAI + { + npc_guardian_of_yogg_saronAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } + + void JustDied(Unit* /*killer*/) + { + DoCastAOE(SPELL_SHADOW_NOVA); + DoCastAOE(SPELL_SHADOW_NOVA_2); + } + + void Reset() + { + _events.ScheduleEvent(EVENT_DARK_VOLLEY, urand(10000, 15000)); + } + + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DARK_VOLLEY: + DoCastAOE(SPELL_DARK_VOLLEY); + _events.ScheduleEvent(EVENT_DARK_VOLLEY, urand(10000, 15000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + void IsSummonedBy(Unit* summoner) + { + if (summoner->GetEntry() != NPC_OMINOUS_CLOUD) + return; + + // Guardian can be summoned both by Voice of Yogg-Saron and by Ominous Cloud + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + voice->AI()->JustSummoned(me); + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_guardian_of_yogg_saronAI>(creature); + } +}; + +class npc_corruptor_tentacle : public CreatureScript +{ + public: + npc_corruptor_tentacle() : CreatureScript("npc_corruptor_tentacle") { } + + struct npc_corruptor_tentacleAI : public ScriptedAI + { + npc_corruptor_tentacleAI(Creature* creature) : ScriptedAI(creature) + { + SetCombatMovement(false); + } + + void Reset() + { + DoCast(me, SPELL_TENTACLE_VOID_ZONE); + DoCastAOE(SPELL_ERUPT); + _events.ScheduleEvent(EVENT_CAST_RANDOM_SPELL, 1); + } + + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->HasAura(SPELL_SHATTERED_ILLUSION)) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CAST_RANDOM_SPELL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(target, RAND(SPELL_BLACK_PLAGUE, SPELL_CURSE_OF_DOOM, SPELL_APATHY, SPELL_DRAINING_POISON)); + _events.ScheduleEvent(EVENT_CAST_RANDOM_SPELL, 3000); + break; + default: + break; + } + } + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_corruptor_tentacleAI>(creature); + } +}; + +class npc_constrictor_tentacle : public CreatureScript +{ + public: + npc_constrictor_tentacle() : CreatureScript("npc_constrictor_tentacle") { } + + struct npc_constrictor_tentacleAI : public ScriptedAI + { + npc_constrictor_tentacleAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + { + SetCombatMovement(false); + } + + void Reset() + { + DoCast(me, SPELL_TENTACLE_VOID_ZONE_2); + DoCastAOE(SPELL_ERUPT); + } + + void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) + { + if (!apply) + passenger->RemoveAurasDueToSpell(SPELL_SQUEEZE); + } + + void UpdateAI(uint32 /*diff*/) + { + UpdateVictim(); + } + + void IsSummonedBy(Unit* /*summoner*/) + { + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + voice->AI()->JustSummoned(me); + } + + private: + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_constrictor_tentacleAI>(creature); + } +}; + +class npc_crusher_tentacle : public CreatureScript +{ + public: + npc_crusher_tentacle() : CreatureScript("npc_crusher_tentacle") { } + + struct npc_crusher_tentacleAI : public ScriptedAI + { + npc_crusher_tentacleAI(Creature* creature) : ScriptedAI(creature) + { + SetCombatMovement(false); + } + + void Reset() + { + DoCast(me, SPELL_CRUSH); + DoCast(me, SPELL_TENTACLE_VOID_ZONE); + DoCast(me, SPELL_DIMINSH_POWER); + DoCast(me, SPELL_FOCUSED_ANGER); + DoCastAOE(SPELL_ERUPT); + + _events.ScheduleEvent(EVENT_DIMINISH_POWER, urand(6000, 8000)); + } + + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->HasAura(SPELL_SHATTERED_ILLUSION) || me->HasUnitState(UNIT_STATE_CASTING)) + return; + + // update timers when the Diminish Power is not being channeled so the next one + // is not cast immediately after interrupt + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DIMINISH_POWER: + DoCast(SPELL_DIMINISH_POWER); + _events.ScheduleEvent(EVENT_DIMINISH_POWER, urand(20000, 30000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_crusher_tentacleAI>(creature); + } +}; + +class npc_influence_tentacle : public CreatureScript +{ + public: + npc_influence_tentacle() : CreatureScript("npc_influence_tentacle") { } + + struct npc_influence_tentacleAI : public PassiveAI + { + npc_influence_tentacleAI(Creature* creature) : PassiveAI(creature), _instance(creature->GetInstanceScript()) { } + + void Reset() + { + DoCast(me, me->GetEntry() == NPC_SUIT_OF_ARMOR ? SPELL_NONDESCRIPT_1 : SPELL_NONDESCRIPT_2); + } + + void JustDied(Unit* /*killer*/) + { + if (Creature* brain = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_BRAIN_OF_YOGG_SARON))) + brain->AI()->DoAction(ACTION_TENTACLE_KILLED); + } + + void UpdateAI(uint32 /*diff*/) { } + + private: + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_influence_tentacleAI>(creature); + } +}; + +typedef boss_sara::boss_saraAI SaraAI; + +class npc_descend_into_madness : public CreatureScript +{ + public: + npc_descend_into_madness() : CreatureScript("npc_descend_into_madness") { } + + struct npc_descend_into_madnessAI : public PassiveAI + { + npc_descend_into_madnessAI(Creature* creature) : PassiveAI(creature), _instance(creature->GetInstanceScript()) { } + + void OnSpellClick(Unit* clicker) + { + clicker->RemoveAurasDueToSpell(SPELL_BRAIN_LINK); + me->DespawnOrUnsummon(); + } + + void UpdateAI(uint32 /*diff*/) { } + + private: + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_descend_into_madnessAI>(creature); + } +}; + +class npc_immortal_guardian : public CreatureScript +{ + public: + npc_immortal_guardian() : CreatureScript("npc_immortal_guardian") { } + + struct npc_immortal_guardianAI : public ScriptedAI + { + npc_immortal_guardianAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() + { + DoCast(me, SPELL_EMPOWERED); + DoCast(me, SPELL_RECENTLY_SPAWNED); + _events.ScheduleEvent(EVENT_DRAIN_LIFE, urand(3000, 13000)); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (me->HealthBelowPctDamaged(1, damage)) + damage = me->GetHealth() - me->CountPctFromMaxHealth(1); // or set immune to damage? should be done here or in SPELL_WEAKENED spell script? + } + + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DRAIN_LIFE: + DoCast(SPELL_DRAIN_LIFE); + _events.ScheduleEvent(EVENT_DRAIN_LIFE, urand(20000, 30000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_immortal_guardianAI>(creature); + } +}; + +class npc_observation_ring_keeper : public CreatureScript +{ + public: + npc_observation_ring_keeper() : CreatureScript("npc_observation_ring_keeper") { } + + struct npc_observation_ring_keeperAI : public ScriptedAI + { + npc_observation_ring_keeperAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() + { + DoCast(SPELL_SIMPLE_TELEPORT_KEEPERS); // not visible here + DoCast(SPELL_KEEPER_ACTIVE); + } + + void sGossipSelect(Player* player, uint32 sender, uint32 /*action*/) + { + if (sender != 10333) + return; + + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->DespawnOrUnsummon(2000); + DoCast(SPELL_TELEPORT); + Talk(SAY_KEEPER_CHOSEN_1, player->GetGUID()); + Talk(SAY_KEEPER_CHOSEN_2, player->GetGUID()); + + switch (me->GetEntry()) + { + case NPC_FREYA_OBSERVATION_RING: + me->SummonCreature(NPC_FREYA_YS, YSKeepersPos[0]); + break; + case NPC_HODIR_OBSERVATION_RING: + me->SummonCreature(NPC_HODIR_YS, YSKeepersPos[1]); + break; + case NPC_THORIM_OBSERVATION_RING: + me->SummonCreature(NPC_THORIM_YS, YSKeepersPos[2]); + break; + case NPC_MIMIRON_OBSERVATION_RING: + me->SummonCreature(NPC_MIMIRON_YS, YSKeepersPos[3]); + break; + } + } + + void UpdateAI(uint32 /*diff*/) { } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_observation_ring_keeperAI>(creature); + } +}; + +class npc_yogg_saron_keeper : public CreatureScript +{ + public: + npc_yogg_saron_keeper() : CreatureScript("npc_yogg_saron_keeper") { } + + struct npc_yogg_saron_keeperAI : public ScriptedAI + { + npc_yogg_saron_keeperAI(Creature* creature) : ScriptedAI(creature) { } + + void IsSummonedBy(Unit* /*summoner*/) + { + DoCast(SPELL_SIMPLE_TELEPORT_KEEPERS); + } + + void Reset() + { + _events.Reset(); + _events.SetPhase(PHASE_ONE); + me->SetReactState(REACT_PASSIVE); + me->RemoveAllAuras(); + + DoCast(SPELL_KEEPER_ACTIVE); // can we skip removing this aura somehow? + + if (me->GetEntry() == NPC_FREYA_YS) + { + std::list<Creature*> wells; + GetCreatureListWithEntryInGrid(wells, me, NPC_SANITY_WELL, 200.0f); + for (std::list<Creature*>::const_iterator itr = wells.begin(); itr != wells.end(); ++itr) + { + (*itr)->RemoveAurasDueToSpell(SPELL_SANITY_WELL); + (*itr)->RemoveAurasDueToSpell(SPELL_SANITY_WELL_VISUAL); + } + } + } + + void EnterCombat(Unit* /*who*/) + { + switch (me->GetEntry()) + { + case NPC_FREYA_YS: + DoCast(SPELL_RESILIENCE_OF_NATURE); + DoCast(SPELL_SANITY_WELL_SUMMON); + break; + case NPC_HODIR_YS: + DoCast(SPELL_FORTITUDE_OF_FROST); + DoCast(SPELL_HODIRS_PROTECTIVE_GAZE); + break; + case NPC_THORIM_YS: + DoCast(SPELL_FURY_OF_THE_STORM); + break; + case NPC_MIMIRON_YS: + DoCast(SPELL_SPEED_OF_INVENTION); + break; + } + } + + void UpdateAI(uint32 diff) + { + if (!me->isInCombat()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DESTABILIZATION_MATRIX: + me->CastCustomSpell(SPELL_DESTABILIZATION_MATRIX, SPELLVALUE_MAX_TARGETS, 1); + _events.ScheduleEvent(EVENT_DESTABILIZATION_MATRIX, urand(15000, 25000), 0, PHASE_TWO); + break; + case EVENT_HODIRS_PROTECTIVE_GAZE: + DoCast(SPELL_HODIRS_PROTECTIVE_GAZE); + break; + } + } + } + + void DoAction(int32 action) + { + switch (action) + { + // setting the phases is only for Thorim and Mimiron + case ACTION_PHASE_TWO: + _events.SetPhase(PHASE_TWO); + _events.ScheduleEvent(EVENT_DESTABILIZATION_MATRIX, urand(5000, 15000), 0, PHASE_TWO); + break; + case ACTION_PHASE_THREE: + _events.SetPhase(PHASE_THREE); + if (me->GetEntry() == NPC_THORIM_YS) + DoCast(SPELL_TITANIC_STORM); + break; + case ACTION_SANITY_WELLS: + { + std::list<Creature*> wells; + GetCreatureListWithEntryInGrid(wells, me, NPC_SANITY_WELL, 200.0f); + for (std::list<Creature*>::const_iterator itr = wells.begin(); itr != wells.end(); ++itr) + { + (*itr)->CastSpell(*itr, SPELL_SANITY_WELL); + (*itr)->CastSpell(*itr, SPELL_SANITY_WELL_VISUAL); + } + break; + } + case ACTION_FLASH_FREEZE: + DoCast(SPELL_FLASH_FREEZE_VISUAL); + _events.ScheduleEvent(EVENT_HODIRS_PROTECTIVE_GAZE, urand(25000, 30000)); + break; + } + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_yogg_saron_keeperAI>(creature); + } +}; + +class npc_yogg_saron_illusions : public CreatureScript +{ + public: + npc_yogg_saron_illusions() : CreatureScript("npc_yogg_saron_illusions") { } + + struct npc_yogg_saron_illusionsAI : public ScriptedAI + { + npc_yogg_saron_illusionsAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } + + void IsSummonedBy(Unit* /*summoner*/) + { + switch (_instance->GetData(DATA_ILLUSION)) + { + case CHAMBER_ILLUSION: + // i think the first Talk should be delayed as in this moment + // players are too far away to be able to see it + if (Creature* neltharion = me->FindNearestCreature(NPC_NELTHARION, 50.0f)) + neltharion->AI()->Talk(SAY_CHAMBER_ROLEPLAY_1); + + _events.ScheduleEvent(EVENT_CHAMBER_ROLEPLAY_1, 16000); + _events.ScheduleEvent(EVENT_CHAMBER_ROLEPLAY_2, 22000); + _events.ScheduleEvent(EVENT_CHAMBER_ROLEPLAY_3, 28000); + _events.ScheduleEvent(EVENT_CHAMBER_ROLEPLAY_4, 36000); + break; + case ICECROWN_ILLUSION: + // same here + _events.ScheduleEvent(EVENT_ICECROWN_ROLEPLAY_1, 1000); + _events.ScheduleEvent(EVENT_ICECROWN_ROLEPLAY_2, 7500); + _events.ScheduleEvent(EVENT_ICECROWN_ROLEPLAY_3, 19500); + _events.ScheduleEvent(EVENT_ICECROWN_ROLEPLAY_4, 25500); + _events.ScheduleEvent(EVENT_ICECROWN_ROLEPLAY_5, 33000); + _events.ScheduleEvent(EVENT_ICECROWN_ROLEPLAY_6, 41300); + break; + case STORMWIND_ILLUSION: + _events.ScheduleEvent(EVENT_STORMWIND_ROLEPLAY_4, 33800); // "A thousand deaths..." + _events.ScheduleEvent(EVENT_STORMWIND_ROLEPLAY_5, 38850); + _events.ScheduleEvent(EVENT_STORMWIND_ROLEPLAY_7, 58750); + // TODO: use "or one murder." sound and split the text in DB + break; + } + } + + void UpdateAI(uint32 diff) + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CHAMBER_ROLEPLAY_1: + if (Creature* ysera = me->FindNearestCreature(NPC_YSERA, 50.0f)) + ysera->AI()->Talk(SAY_CHAMBER_ROLEPLAY_2); + break; + case EVENT_CHAMBER_ROLEPLAY_2: + if (Creature* neltharion = me->FindNearestCreature(NPC_NELTHARION, 50.0f)) + neltharion->AI()->Talk(SAY_CHAMBER_ROLEPLAY_3); + break; + case EVENT_CHAMBER_ROLEPLAY_3: + if (Creature* malygos = me->FindNearestCreature(NPC_MALYGOS, 50.0f)) + malygos->AI()->Talk(SAY_CHAMBER_ROLEPLAY_4); + break; + case EVENT_CHAMBER_ROLEPLAY_4: + Talk(SAY_CHAMBER_ROLEPLAY_5); + break; + case EVENT_ICECROWN_ROLEPLAY_1: + if (Creature* bolvar = me->FindNearestCreature(NPC_IMMOLATED_CHAMPION, 50.0f)) + { + bolvar->AI()->Talk(SAY_ICECROWN_ROLEPLAY_1); + + if (Creature* lichKing = me->FindNearestCreature(NPC_THE_LICH_KING, 50.0f)) + lichKing->CastSpell(bolvar, SPELL_DEATHGRASP); + } + break; + case EVENT_ICECROWN_ROLEPLAY_2: + if (Creature* lichKing = me->FindNearestCreature(NPC_THE_LICH_KING, 50.0f)) + lichKing->AI()->Talk(SAY_ICECROWN_ROLEPLAY_2); + break; + case EVENT_ICECROWN_ROLEPLAY_3: + if (Creature* bolvar = me->FindNearestCreature(NPC_IMMOLATED_CHAMPION, 50.0f)) + bolvar->AI()->Talk(SAY_ICECROWN_ROLEPLAY_3); + if (Creature* saurfang = me->FindNearestCreature(NPC_TURNED_CHAMPION, 50.0f)) + saurfang->AI()->DoAction(ACTION_START_ROLEPLAY); + break; + case EVENT_ICECROWN_ROLEPLAY_4: + if (Creature* lichKing = me->FindNearestCreature(NPC_THE_LICH_KING, 50.0f)) + lichKing->AI()->Talk(SAY_ICECROWN_ROLEPLAY_4); + break; + case EVENT_ICECROWN_ROLEPLAY_5: + Talk(SAY_ICECROWN_ROLEPLAY_5); + break; + case EVENT_ICECROWN_ROLEPLAY_6: + Talk(SAY_ICECROWN_ROLEPLAY_6); + break; + case EVENT_STORMWIND_ROLEPLAY_4: + Talk(SAY_STORMWIND_ROLEPLAY_4); + break; + case EVENT_STORMWIND_ROLEPLAY_5: + if (Creature* llane = me->FindNearestCreature(NPC_KING_LLANE, 50.0f)) + llane->AI()->Talk(SAY_STORMWIND_ROLEPLAY_5); + break; + case EVENT_STORMWIND_ROLEPLAY_7: + Talk(SAY_STORMWIND_ROLEPLAY_7); + break; + default: + break; + } + } + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_yogg_saron_illusionsAI>(creature); + } +}; + +class npc_garona : public CreatureScript +{ + public: + npc_garona() : CreatureScript("npc_garona") { } + + struct npc_garonaAI : public ScriptedAI + { + npc_garonaAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() + { + _events.Reset(); + + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(0, IllusionsMiscPos[0]); + + _events.ScheduleEvent(EVENT_STORMWIND_ROLEPLAY_1, 9250); + _events.ScheduleEvent(EVENT_STORMWIND_ROLEPLAY_2, 16700); + _events.ScheduleEvent(EVENT_STORMWIND_ROLEPLAY_3, 24150); + _events.ScheduleEvent(EVENT_STORMWIND_ROLEPLAY_6, 52700); + } + + void UpdateAI(uint32 diff) + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_STORMWIND_ROLEPLAY_1: + Talk(SAY_STORMWIND_ROLEPLAY_1); + break; + case EVENT_STORMWIND_ROLEPLAY_2: + Talk(SAY_STORMWIND_ROLEPLAY_2); + break; + case EVENT_STORMWIND_ROLEPLAY_3: + Talk(SAY_STORMWIND_ROLEPLAY_3); + break; + case EVENT_STORMWIND_ROLEPLAY_6: + Talk(SAY_STORMWIND_ROLEPLAY_6); + if (Creature* llane = me->FindNearestCreature(NPC_KING_LLANE, 50.0f)) + { + DoCast(SPELL_ASSASSINATE); + llane->CastSpell(llane, SPELL_PERMANENT_FEIGN_DEATH); + } + break; + default: + break; + } + } + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_garonaAI>(creature); + } +}; + +class npc_turned_champion : public CreatureScript +{ + public: + npc_turned_champion() : CreatureScript("npc_turned_champion") { } + + struct npc_turned_championAI : public ScriptedAI + { + npc_turned_championAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() + { + DoCast(SPELL_VERTEX_COLOR_BLACK); + } + + void MovementInform(uint32 type, uint32 pointId) + { + if (type != POINT_MOTION_TYPE || pointId != 0) + return; + + me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + } + + void DoAction(int32 action) + { + if (action != ACTION_START_ROLEPLAY) + return; + + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(0, IllusionsMiscPos[1]); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_turned_championAI>(creature); + } +}; + +class npc_laughing_skull : public CreatureScript +{ + public: + npc_laughing_skull() : CreatureScript("npc_laughing_skull") { } + + struct npc_laughing_skullAI : public ScriptedAI + { + npc_laughing_skullAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() + { + me->SetReactState(REACT_PASSIVE); + DoCast(me, SPELL_LUNATIC_GAZE_SKULL); + } + + // don't evade, otherwise the Lunatic Gaze aura is removed + void UpdateAI(uint32 /*diff*/) { } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_laughing_skullAI>(creature); + } +}; + +class spell_yogg_saron_target_selectors : public SpellScriptLoader // 63744, 63745, 63747, 65206 +{ + public: + spell_yogg_saron_target_selectors() : SpellScriptLoader("spell_yogg_saron_target_selectors") { } + + class spell_yogg_saron_target_selectors_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_target_selectors_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, uint32(GetEffectValue())); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_target_selectors_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_target_selectors_SpellScript(); + } +}; + +class SanityReduction : public SpellScript +{ + public: + SanityReduction() : SpellScript() { } + SanityReduction(uint8 stacks) : SpellScript(), _stacks(stacks) { } + + void RemoveSanity(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + if (Aura* sanity = target->GetAura(SPELL_SANITY)) + sanity->ModStackAmount(-int32(_stacks), AURA_REMOVE_BY_ENEMY_SPELL); + } + + protected: + uint8 _stacks; +}; + +class HighSanityTargetSelector +{ + public: + HighSanityTargetSelector() { } + + bool operator()(WorldObject* object) + { + if (Unit* unit = object->ToUnit()) + if (Aura* sanity = unit->GetAura(SPELL_SANITY)) + return sanity->GetStackAmount() <= 40; + return true; + } +}; + +class spell_yogg_saron_psychosis : public SpellScriptLoader // 63795, 65301 +{ + public: + spell_yogg_saron_psychosis() : SpellScriptLoader("spell_yogg_saron_psychosis") { } + + class spell_yogg_saron_psychosis_SpellScript : public SanityReduction + { + PrepareSpellScript(spell_yogg_saron_psychosis_SpellScript); + + bool Load() + { + _stacks = GetSpellInfo()->Id == SPELL_PSYCHOSIS ? 9 : 12; + return true; + } + + void FilterTargets(std::list<WorldObject*>& targets) + { + targets.remove_if(HighSanityTargetSelector()); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_ILLUSION_ROOM)); + } + + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_psychosis_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_psychosis_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_psychosis_SpellScript::RemoveSanity, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_psychosis_SpellScript(); + } +}; + +class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader // 63830, 63881 +{ + public: + spell_yogg_saron_malady_of_the_mind() : SpellScriptLoader("spell_yogg_saron_malady_of_the_mind") { } + + class spell_yogg_saron_malady_of_the_mind_SpellScript : public SanityReduction + { + public: + spell_yogg_saron_malady_of_the_mind_SpellScript() : SanityReduction(3) { } + + PrepareSpellScript(spell_yogg_saron_malady_of_the_mind_SpellScript); + + void FilterTargets(std::list<WorldObject*>& targets) + { + targets.remove_if(HighSanityTargetSelector()); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_ILLUSION_ROOM)); + } + + void Register() + { + if (m_scriptSpellId == SPELL_MALADY_OF_THE_MIND) + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_malady_of_the_mind_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_malady_of_the_mind_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_malady_of_the_mind_SpellScript::FilterTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); + } + + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_malady_of_the_mind_SpellScript::RemoveSanity, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + class spell_yogg_saron_malady_of_the_mind_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_malady_of_the_mind_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MALADY_OF_THE_MIND_JUMP)) + return false; + return true; + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + switch (GetTargetApplication()->GetRemoveMode()) + { + case AURA_REMOVE_BY_ENEMY_SPELL: + case AURA_REMOVE_BY_EXPIRE: + case AURA_REMOVE_BY_DEATH: + break; + default: + return; + } + + GetTarget()->CastSpell(GetTarget(), SPELL_MALADY_OF_THE_MIND_JUMP); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_malady_of_the_mind_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_MOD_FEAR, AURA_EFFECT_HANDLE_REAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_malady_of_the_mind_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_malady_of_the_mind_AuraScript(); + } +}; + +class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 +{ + public: + spell_yogg_saron_brain_link() : SpellScriptLoader("spell_yogg_saron_brain_link") { } + + class spell_yogg_saron_brain_link_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_brain_link_SpellScript); + + void FilterTargets(std::list<WorldObject*>& targets) + { + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_ILLUSION_ROOM)); + + if (targets.size() != 2) + { + targets.clear(); + return; + } + + if (SaraAI* ai = CAST_AI(SaraAI, GetCaster()->GetAI())) + ai->SetLinkBetween(targets.front()->GetGUID(), targets.back()->GetGUID()); + } + + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_brain_link_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + class spell_yogg_saron_brain_link_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_brain_link_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_BRAIN_LINK_DAMAGE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_BRAIN_LINK_NO_DAMAGE)) + return false; + return true; + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + if (SaraAI* ai = CAST_AI(SaraAI, caster->GetAI())) + { + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) + ai->RemoveLinkFrom(GetTarget()->GetGUID()); + else + { + if (Player* player = ObjectAccessor::GetPlayer(*GetTarget(), ai->GetLinkedPlayerGUID(GetTarget()->GetGUID()))) + { + ai->RemoveLinkFrom(GetTarget()->GetGUID()); + player->RemoveAurasDueToSpell(SPELL_BRAIN_LINK); + } + } + } + } + + void DummyTick(AuraEffect const* aurEff) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + SaraAI* ai = CAST_AI(SaraAI, caster->GetAI()); + if (!ai) + return; + + Player* linked = ObjectAccessor::GetPlayer(*GetTarget(), ai->GetLinkedPlayerGUID(GetTarget()->GetGUID())); + if (!linked) + return; + + GetTarget()->CastSpell(linked, (GetTarget()->GetDistance(linked) > (float)aurEff->GetAmount()) ? SPELL_BRAIN_LINK_DAMAGE : SPELL_BRAIN_LINK_NO_DAMAGE, true); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_brain_link_AuraScript::DummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_brain_link_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_brain_link_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_brain_link_AuraScript(); + } +}; + +class spell_yogg_saron_brain_link_damage : public SpellScriptLoader // 63803 +{ + public: + spell_yogg_saron_brain_link_damage() : SpellScriptLoader("spell_yogg_saron_brain_link_damage") { } + + class spell_yogg_saron_brain_link_damage_SpellScript : public SanityReduction + { + public: + spell_yogg_saron_brain_link_damage_SpellScript() : SanityReduction(2) { } + + PrepareSpellScript(spell_yogg_saron_brain_link_damage_SpellScript); + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_brain_link_damage_SpellScript::RemoveSanity, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_brain_link_damage_SpellScript(); + } +}; + +class spell_yogg_saron_boil_ominously : public SpellScriptLoader // 63030 +{ + public: + spell_yogg_saron_boil_ominously() : SpellScriptLoader("spell_yogg_saron_boil_ominously") { } + + class spell_yogg_saron_boil_ominously_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_boil_ominously_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_GUARDIAN_1)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + if (!target->HasAura(SPELL_FLASH_FREEZE) && !GetCaster()->HasAura(SPELL_SUMMON_GUARDIAN_1) && !GetCaster()->HasAura(SPELL_SUMMON_GUARDIAN_2)) + { + if (Creature* caster = GetCaster()->ToCreature()) + caster->AI()->Talk(EMOTE_OMINOUS_CLOUD_PLAYER_TOUCH, target->GetGUID()); + + GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_GUARDIAN_1, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_boil_ominously_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_boil_ominously_SpellScript(); + } +}; + +class spell_yogg_saron_shadow_beacon : public SpellScriptLoader // 64465 +{ + public: + spell_yogg_saron_shadow_beacon() : SpellScriptLoader("spell_yogg_saron_shadow_beacon") { } + + class spell_yogg_saron_shadow_beacon_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_shadow_beacon_AuraScript); + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Creature* target = GetTarget()->ToCreature()) + target->SetEntry(NPC_MARKED_IMMORTAL_GUARDIAN); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Creature* target = GetTarget()->ToCreature()) + target->SetEntry(NPC_IMMORTAL_GUARDIAN); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_yogg_saron_shadow_beacon_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_shadow_beacon_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_shadow_beacon_AuraScript(); + } +}; + +class spell_yogg_saron_empowering_shadows_range_check : public SpellScriptLoader // 64466 +{ + public: + spell_yogg_saron_empowering_shadows_range_check() : SpellScriptLoader("spell_yogg_saron_empowering_shadows_range_check") { } + + class spell_yogg_saron_empowering_shadows_range_check_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_empowering_shadows_range_check_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + target->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_empowering_shadows_range_check_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_empowering_shadows_range_check_SpellScript(); + } +}; + +class spell_yogg_saron_empowering_shadows_missile : public SpellScriptLoader // 64467 +{ + public: + spell_yogg_saron_empowering_shadows_missile() : SpellScriptLoader("spell_yogg_saron_empowering_shadows_missile") { } + + class spell_yogg_saron_empowering_shadows_missile_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_empowering_shadows_missile_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_EMPOWERING_SHADOWS)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + target->CastSpell((Unit*)NULL, SPELL_EMPOWERING_SHADOWS, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_empowering_shadows_missile_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_empowering_shadows_missile_SpellScript(); + } +}; + +// it works, but is it scripted correctly? why is it aura with 2500ms duration? +class spell_yogg_saron_constrictor_tentacle : public SpellScriptLoader // 64132 +{ + public: + spell_yogg_saron_constrictor_tentacle() : SpellScriptLoader("spell_yogg_saron_constrictor_tentacle") { } + + class spell_yogg_saron_constrictor_tentacle_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_constrictor_tentacle_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_CONSTRICTOR_TENTACLE_SUMMON)) + return false; + return true; + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastSpell(GetTarget(), SPELL_CONSTRICTOR_TENTACLE_SUMMON); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_yogg_saron_constrictor_tentacle_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_constrictor_tentacle_AuraScript(); + } +}; + +class spell_yogg_saron_lunge : public SpellScriptLoader // 64131 +{ + public: + spell_yogg_saron_lunge() : SpellScriptLoader("spell_yogg_saron_lunge") { } + + class spell_yogg_saron_lunge_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_lunge_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SQUEEZE)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->CastSpell(target, SPELL_SQUEEZE, true); + target->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_lunge_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_lunge_SpellScript(); + } +}; + +class spell_yogg_saron_squeeze : public SpellScriptLoader // 64125 +{ + public: + spell_yogg_saron_squeeze() : SpellScriptLoader("spell_yogg_saron_squeeze") { } + + class spell_yogg_saron_squeeze_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_squeeze_AuraScript); + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* vehicle = GetTarget()->GetVehicleBase()) + if (vehicle->isAlive()) + vehicle->Kill(vehicle); // should tentacle die or just release its target? + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_squeeze_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_squeeze_AuraScript(); + } +}; + +class spell_yogg_saron_diminsh_power : public SpellScriptLoader // 64148 +{ + public: + spell_yogg_saron_diminsh_power() : SpellScriptLoader("spell_yogg_saron_diminsh_power") { } + + class spell_yogg_saron_diminsh_power_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_diminsh_power_AuraScript); + + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + if (Spell* spell = GetTarget()->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (spell->getState() == SPELL_STATE_CASTING) + GetTarget()->InterruptSpell(CURRENT_CHANNELED_SPELL); + } + + void Register() + { + OnEffectProc += AuraEffectProcFn(spell_yogg_saron_diminsh_power_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_diminsh_power_AuraScript(); + } +}; + +// not sure about SPELL_WEAKENED part, where should it be handled? +class spell_yogg_saron_empowered : public SpellScriptLoader // 64161 +{ + public: + spell_yogg_saron_empowered() : SpellScriptLoader("spell_yogg_saron_empowered") { } + + class spell_yogg_saron_empowered_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_empowered_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_EMPOWERED_BUFF)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_WEAKENED)) + return false; + return true; + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastCustomSpell(SPELL_EMPOWERED_BUFF, SPELLVALUE_AURA_STACK, 9, GetTarget(), TRIGGERED_FULL_MASK); + } + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + Unit* target = GetTarget(); + float stack = ceil((target->GetHealthPct() / 10) - 1); + target->RemoveAurasDueToSpell(SPELL_EMPOWERED_BUFF); + + if (stack) + { + target->RemoveAurasDueToSpell(SPELL_WEAKENED); + target->CastCustomSpell(SPELL_EMPOWERED_BUFF, SPELLVALUE_AURA_STACK, stack, target, TRIGGERED_FULL_MASK); + } + else if (!target->HealthAbovePct(1) && !target->HasAura(SPELL_WEAKENED)) + target->CastSpell(target, SPELL_WEAKENED, true); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_yogg_saron_empowered_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_empowered_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_empowered_AuraScript(); + } +}; + +class spell_yogg_saron_match_health : public SpellScriptLoader // 64069 +{ + public: + spell_yogg_saron_match_health() : SpellScriptLoader("spell_yogg_saron_match_health") { } + + class spell_yogg_saron_match_health_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_match_health_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + target->SetHealth(target->CountPctFromMaxHealth((int32)GetCaster()->GetHealthPct())); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_match_health_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_match_health_SpellScript(); + } +}; + +class spell_yogg_saron_shattered_illusion : public SpellScriptLoader // 65238 +{ + public: + spell_yogg_saron_shattered_illusion() : SpellScriptLoader("spell_yogg_saron_shattered_illusion") { } + + class spell_yogg_saron_shattered_illusion_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_shattered_illusion_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + target->RemoveAurasDueToSpell(uint32(GetEffectValue())); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_shattered_illusion_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_shattered_illusion_SpellScript(); + } +}; + +class spell_yogg_saron_death_ray_warning_visual : public SpellScriptLoader // 63882 +{ + public: + spell_yogg_saron_death_ray_warning_visual() : SpellScriptLoader("spell_yogg_saron_death_ray_warning_visual") { } + + class spell_yogg_saron_death_ray_warning_visual_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_death_ray_warning_visual_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_RAY_PERIODIC)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_RAY_DAMAGE_VISUAL)) + return false; + return true; + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + caster->CastSpell(caster, SPELL_DEATH_RAY_PERIODIC, true); + caster->CastSpell((Unit*)NULL, SPELL_DEATH_RAY_DAMAGE_VISUAL, true); + // TODO: set better movement + caster->GetMotionMaster()->MoveConfused(); + } + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_death_ray_warning_visual_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_death_ray_warning_visual_AuraScript(); + } +}; + +class spell_yogg_saron_cancel_illusion_room_aura : public SpellScriptLoader // 63993 +{ + public: + spell_yogg_saron_cancel_illusion_room_aura() : SpellScriptLoader("spell_yogg_saron_cancel_illusion_room_aura") { } + + class spell_yogg_saron_cancel_illusion_room_aura_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_cancel_illusion_room_aura_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_TELEPORT_BACK_TO_MAIN_ROOM)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->CastSpell(target, SPELL_TELEPORT_BACK_TO_MAIN_ROOM); + target->RemoveAurasDueToSpell(uint32(GetEffectValue())); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_cancel_illusion_room_aura_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_cancel_illusion_room_aura_SpellScript(); + } +}; + +class spell_yogg_saron_nondescript : public SpellScriptLoader // 64010, 64013 +{ + public: + spell_yogg_saron_nondescript() : SpellScriptLoader("spell_yogg_saron_nondescript") { } + + class spell_yogg_saron_nondescript_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_nondescript_AuraScript); + + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_nondescript_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_nondescript_AuraScript(); + } +}; + +class spell_yogg_saron_revealed_tentacle : public SpellScriptLoader // 64012 +{ + public: + spell_yogg_saron_revealed_tentacle() : SpellScriptLoader("spell_yogg_saron_revealed_tentacle") { } + + class spell_yogg_saron_revealed_tentacle_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_revealed_tentacle_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_TENTACLE_VOID_ZONE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_GRIM_REPRISAL)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Creature* caster = GetCaster()->ToCreature()) + { + caster->CastSpell(caster, SPELL_TENTACLE_VOID_ZONE, true); + caster->CastSpell(caster, SPELL_GRIM_REPRISAL, true); + caster->UpdateEntry(NPC_INFLUENCE_TENTACLE, 0, caster->GetCreatureData()); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_revealed_tentacle_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_revealed_tentacle_SpellScript(); + } +}; + +class spell_yogg_saron_grim_reprisal : public SpellScriptLoader // 63305 +{ + public: + spell_yogg_saron_grim_reprisal() : SpellScriptLoader("spell_yogg_saron_grim_reprisal") { } + + class spell_yogg_saron_grim_reprisal_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_grim_reprisal_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_GRIM_REPRISAL_DAMAGE)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + int32 damage = CalculatePct(int32(eventInfo.GetDamageInfo()->GetDamage()), 60); + GetTarget()->CastCustomSpell(SPELL_GRIM_REPRISAL_DAMAGE, SPELLVALUE_BASE_POINT0, damage, eventInfo.GetDamageInfo()->GetAttacker(), true, NULL, aurEff); + } + + void Register() + { + OnEffectProc += AuraEffectProcFn(spell_yogg_saron_grim_reprisal_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_grim_reprisal_AuraScript(); + } +}; + +class spell_yogg_saron_induce_madness : public SpellScriptLoader // 64059 +{ + public: + spell_yogg_saron_induce_madness() : SpellScriptLoader("spell_yogg_saron_induce_madness") { } + + class spell_yogg_saron_induce_madness_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_induce_madness_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_TELEPORT_BACK_TO_MAIN_ROOM)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SHATTERED_ILLUSION_REMOVE)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->CastSpell(target, SPELL_TELEPORT_BACK_TO_MAIN_ROOM); + target->RemoveAurasDueToSpell(SPELL_SANITY, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); + target->RemoveAurasDueToSpell(uint32(GetEffectValue())); + } + } + + void ClearShatteredIllusion() + { + GetCaster()->CastSpell((Unit*)NULL, SPELL_SHATTERED_ILLUSION_REMOVE); + + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + if (Creature* voice = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + voice->AI()->DoAction(ACTION_TOGGLE_SHATTERED_ILLUSION); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_induce_madness_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + AfterCast += SpellCastFn(spell_yogg_saron_induce_madness_SpellScript::ClearShatteredIllusion); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_induce_madness_SpellScript(); + } +}; + +class spell_yogg_saron_sanity : public SpellScriptLoader // 63050 +{ + public: + spell_yogg_saron_sanity() : SpellScriptLoader("spell_yogg_saron_sanity") { } + + class spell_yogg_saron_sanity_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_sanity_SpellScript); + + // don't target players outside of room or handle it in SPELL_INSANE_PERIODIC? + + void ModSanityStacks() + { + GetSpell()->SetSpellValue(SPELLVALUE_AURA_STACK, 100); + } + + void Register() + { + BeforeCast += SpellCastFn(spell_yogg_saron_sanity_SpellScript::ModSanityStacks); + } + }; + + class spell_yogg_saron_sanity_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_sanity_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_LOW_SANITY_SCREEN_EFFECT)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_INSANE)) + return false; + return true; + } + + void DummyTick(AuraEffect const* /*aurEff*/) + { + if (GetTarget()->HasAura(SPELL_SANITY_WELL)) + ModStackAmount(20); + + if (GetStackAmount() <= 40 && !GetTarget()->HasAura(SPELL_LOW_SANITY_SCREEN_EFFECT)) + GetTarget()->CastSpell(GetTarget(), SPELL_LOW_SANITY_SCREEN_EFFECT, true); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) + return; + + if (InstanceScript* instance = GetTarget()->GetInstanceScript()) + instance->SetData(DATA_DRIVE_ME_CRAZY, uint32(false)); + + GetTarget()->RemoveAurasDueToSpell(SPELL_BRAIN_LINK); + + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), SPELL_INSANE, true); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_sanity_AuraScript::DummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_sanity_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_sanity_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_sanity_AuraScript(); + } +}; + +class spell_yogg_saron_insane : public SpellScriptLoader // 63120 +{ + public: + spell_yogg_saron_insane() : SpellScriptLoader("spell_yogg_saron_insane") { } + + class spell_yogg_saron_insane_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_insane_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_INSANE_VISUAL)) + return false; + return true; + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (Creature* yogg = caster->ToCreature()) + yogg->AI()->Talk(WHISPER_VOICE_INSANE, GetTarget()->GetGUID()); + + GetTarget()->CastSpell(GetTarget(), SPELL_INSANE_VISUAL, true); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetTarget()->isAlive()) + GetTarget()->Kill(GetTarget()); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_yogg_saron_insane_AuraScript::OnApply, EFFECT_0, SPELL_AURA_AOE_CHARM, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_insane_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_AOE_CHARM, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_insane_AuraScript(); + } +}; + +class spell_yogg_saron_insane_periodic : public SpellScriptLoader // 64555 +{ + public: + spell_yogg_saron_insane_periodic() : SpellScriptLoader("spell_yogg_saron_insane_periodic") { } + + class spell_yogg_saron_insane_periodic_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_insane_periodic_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, uint32(GetEffectValue()), true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_insane_periodic_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_insane_periodic_SpellScript(); + } +}; + +class LunaticGazeTargetSelector +{ + public: + LunaticGazeTargetSelector(Unit* caster) : _caster(caster) { } + + bool operator()(WorldObject* object) + { + return !object->HasInArc(static_cast<float>(M_PI), _caster); + } + + private: + Unit* _caster; +}; + +class spell_yogg_saron_lunatic_gaze : public SpellScriptLoader // 64164, 64168 +{ + public: + spell_yogg_saron_lunatic_gaze() : SpellScriptLoader("spell_yogg_saron_lunatic_gaze") { } + + class spell_yogg_saron_lunatic_gaze_SpellScript : public SanityReduction + { + PrepareSpellScript(spell_yogg_saron_lunatic_gaze_SpellScript); + + bool Load() + { + _stacks = GetSpellInfo()->Id == SPELL_LUNATIC_GAZE_DAMAGE ? 4 : 2; + return true; + } + + void FilterTargets(std::list<WorldObject*>& targets) + { + targets.remove_if(LunaticGazeTargetSelector(GetCaster())); + } + + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_lunatic_gaze_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_lunatic_gaze_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_lunatic_gaze_SpellScript::RemoveSanity, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_lunatic_gaze_SpellScript(); + } +}; + +class spell_yogg_saron_keeper_aura : public SpellScriptLoader // 62650, 62670, 62671, 62702 +{ + public: + spell_yogg_saron_keeper_aura() : SpellScriptLoader("spell_yogg_saron_keeper_aura") { } + + class spell_yogg_saron_keeper_aura_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_keeper_aura_AuraScript); + + bool CanApply(Unit* target) + { + if (target->GetTypeId() != TYPEID_PLAYER && target != GetCaster()) + return false; + return true; + } + + void Register() + { + DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_yogg_saron_keeper_aura_AuraScript::CanApply); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_keeper_aura_AuraScript(); + } +}; + +class spell_yogg_saron_hate_to_zero : public SpellScriptLoader // 63984 +{ + public: + spell_yogg_saron_hate_to_zero() : SpellScriptLoader("spell_yogg_saron_hate_to_zero") { } + + class spell_yogg_saron_hate_to_zero_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_hate_to_zero_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + if (target->CanHaveThreatList()) + target->getThreatManager().modifyThreatPercent(GetCaster(), -100); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_hate_to_zero_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_hate_to_zero_SpellScript(); + } +}; + +class spell_yogg_saron_in_the_maws_of_the_old_god : public SpellScriptLoader // 64184 +{ + public: + spell_yogg_saron_in_the_maws_of_the_old_god() : SpellScriptLoader("spell_yogg_saron_in_the_maws_of_the_old_god") { } + + class spell_yogg_saron_in_the_maws_of_the_old_god_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_in_the_maws_of_the_old_god_SpellScript); + + SpellCastResult CheckRequirement() + { + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + if (Creature* yogg = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(BOSS_YOGG_SARON))) + if (yogg->FindCurrentSpellBySpellId(SPELL_DEAFENING_ROAR)) + { + if (GetCaster()->GetDistance(yogg) > 20.0f) + return SPELL_FAILED_OUT_OF_RANGE; + else + return SPELL_CAST_OK; + } + + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_yogg_saron_in_the_maws_of_the_old_god_SpellScript::CheckRequirement); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_in_the_maws_of_the_old_god_SpellScript(); + } +}; + +class spell_yogg_saron_titanic_storm : public SpellScriptLoader // 64172 +{ + public: + spell_yogg_saron_titanic_storm() : SpellScriptLoader("spell_yogg_saron_titanic_storm") { } + + class spell_yogg_saron_titanic_storm_SpellScript : public SpellScript + { + PrepareSpellScript(spell_yogg_saron_titanic_storm_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + GetCaster()->Kill(target); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_titanic_storm_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_yogg_saron_titanic_storm_SpellScript(); + } +}; + +class spell_yogg_saron_hodirs_protective_gaze : public SpellScriptLoader // 64174 +{ + public: + spell_yogg_saron_hodirs_protective_gaze() : SpellScriptLoader("spell_yogg_saron_hodirs_protective_gaze") { } + + class spell_yogg_saron_hodirs_protective_gaze_AuraScript : public AuraScript + { + PrepareAuraScript(spell_yogg_saron_hodirs_protective_gaze_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_FLASH_FREEZE)) + return false; + return true; + } + + bool CanApply(Unit* target) + { + if (target->GetTypeId() != TYPEID_PLAYER && target != GetCaster()) + return false; + return true; + } + + void OnAbsorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount) + { + if (dmgInfo.GetDamage() >= GetTarget()->GetHealth()) + { + absorbAmount = dmgInfo.GetDamage(); + // or absorbAmount = dmgInfo.GetDamage() - GetTarget()->GetHealth() + 1 + GetTarget()->CastSpell(GetTarget(), SPELL_FLASH_FREEZE, true); + } + else + PreventDefaultAction(); + } + + void Register() + { + DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_yogg_saron_hodirs_protective_gaze_AuraScript::CanApply); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_yogg_saron_hodirs_protective_gaze_AuraScript::OnAbsorb, EFFECT_0); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_yogg_saron_hodirs_protective_gaze_AuraScript(); + } +}; + +void AddSC_boss_yogg_saron() +{ + new boss_voice_of_yogg_saron(); + new boss_sara(); + new boss_yogg_saron(); + new boss_brain_of_yogg_saron(); + new npc_ominous_cloud(); + new npc_guardian_of_yogg_saron(); + new npc_corruptor_tentacle(); + new npc_constrictor_tentacle(); + new npc_crusher_tentacle(); + new npc_influence_tentacle(); + new npc_descend_into_madness(); + new npc_immortal_guardian(); + new npc_observation_ring_keeper(); + new npc_yogg_saron_keeper(); + new npc_yogg_saron_illusions(); + new npc_garona(); + new npc_turned_champion(); + new npc_laughing_skull(); + new spell_yogg_saron_target_selectors(); + new spell_yogg_saron_psychosis(); + new spell_yogg_saron_malady_of_the_mind(); + new spell_yogg_saron_brain_link(); + new spell_yogg_saron_brain_link_damage(); + new spell_yogg_saron_boil_ominously(); + new spell_yogg_saron_shadow_beacon(); + new spell_yogg_saron_empowering_shadows_range_check(); + new spell_yogg_saron_empowering_shadows_missile(); + new spell_yogg_saron_constrictor_tentacle(); + new spell_yogg_saron_lunge(); + new spell_yogg_saron_squeeze(); + new spell_yogg_saron_diminsh_power(); + new spell_yogg_saron_empowered(); + new spell_yogg_saron_match_health(); + new spell_yogg_saron_shattered_illusion(); + new spell_yogg_saron_death_ray_warning_visual(); + new spell_yogg_saron_cancel_illusion_room_aura(); + new spell_yogg_saron_nondescript(); + new spell_yogg_saron_revealed_tentacle(); + new spell_yogg_saron_grim_reprisal(); + new spell_yogg_saron_induce_madness(); + new spell_yogg_saron_sanity(); + new spell_yogg_saron_insane(); + new spell_yogg_saron_insane_periodic(); + new spell_yogg_saron_lunatic_gaze(); + new spell_yogg_saron_keeper_aura(); + new spell_yogg_saron_hate_to_zero(); + new spell_yogg_saron_in_the_maws_of_the_old_god(); + new spell_yogg_saron_titanic_storm(); + new spell_yogg_saron_hodirs_protective_gaze(); +} diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp deleted file mode 100644 index 4bcb1b9e584..00000000000 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "ScriptMgr.h" -#include "ulduar.h" - -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_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 - SPELL_MALADY_OF_THE_MIND = 63830, // Target Self - SPELL_DEATH_RAY = 63891, // Target Self - SPELL_BRAIN_LINK = 63802, // Target Self -}; - -enum YoggSaron_Yells -{ -}; - -enum -{ - ACHIEV_TIMED_START_EVENT = 21001, -}; -//not in scriptloader yet just to remove warning boss_yoggsaron.obj : warning LNK4221: no public symbols found; archive member will be inaccessible -void AddSC_boss_yoggsaron() -{ -} diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 125f66497bf..421d0ecf3c9 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -24,14 +24,15 @@ 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 }, - {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 }, + {GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S }, + {GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S }, + {GO_YOGG_SARON_DOOR, BOSS_YOGG_SARON, 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 }, }; MinionData const minionData[] = @@ -56,7 +57,6 @@ class instance_ulduar : public InstanceMapScript uint64 IgnisGUID; uint64 RazorscaleGUID; uint64 RazorscaleController; - uint64 RazorHarpoonGUIDs[4]; uint64 ExpeditionCommanderGUID; uint64 XT002GUID; uint64 XTToyPileGUIDs[4]; @@ -67,14 +67,18 @@ class instance_ulduar : public InstanceMapScript uint64 HodirGUID; uint64 ThorimGUID; uint64 FreyaGUID; - uint64 KeeperGUIDs[3]; + uint64 ElderGUIDs[3]; uint64 VezaxGUID; uint64 YoggSaronGUID; + uint64 VoiceOfYoggSaronGUID; + uint64 SaraGUID; + uint64 BrainOfYoggSaronGUID; uint64 AlgalonGUID; - uint64 LeviathanGateGUID; - uint64 VezaxDoorGUID; + uint64 BrannBronzebeardAlgGUID; // GameObjects + uint64 LeviathanGateGUID; + uint64 RazorHarpoonGUIDs[4]; uint64 KologarnChestGUID; uint64 KologarnBridgeGUID; uint64 KologarnDoorGUID; @@ -84,11 +88,13 @@ class instance_ulduar : public InstanceMapScript uint64 HodirDoorGUID; uint64 HodirIceDoorGUID; uint64 ArchivumDoorGUID; + uint64 VezaxDoorGUID; + uint64 BrainRoomDoorGUIDs[3]; + uint64 KeeperGUIDs[4]; uint64 AlgalonSigilDoorGUID[3]; uint64 AlgalonFloorGUID[2]; uint64 AlgalonUniverseGUID; uint64 AlgalonTrapdoorGUID; - uint64 BrannBronzebeardAlgGUID; uint64 GiftOfTheObserverGUID; // Miscellaneous @@ -96,8 +102,11 @@ class instance_ulduar : public InstanceMapScript uint32 HodirRareCacheData; uint32 ColossusData; uint8 elderCount; + uint8 illusion; + uint8 keepersCount; bool conSpeedAtory; bool Unbroken; + bool IsDriveMeCrazyEligible; std::set<uint64> mRubbleSpawns; @@ -119,6 +128,9 @@ class instance_ulduar : public InstanceMapScript FreyaGUID = 0; VezaxGUID = 0; YoggSaronGUID = 0; + VoiceOfYoggSaronGUID = 0; + SaraGUID = 0; + BrainOfYoggSaronGUID = 0; AlgalonGUID = 0; KologarnChestGUID = 0; KologarnBridgeGUID = 0; @@ -141,6 +153,8 @@ class instance_ulduar : public InstanceMapScript HodirRareCacheData = 0; ColossusData = 0; elderCount = 0; + illusion = 0; + keepersCount = 0; conSpeedAtory = false; Unbroken = true; _algalonSummoned = false; @@ -151,7 +165,11 @@ class instance_ulduar : public InstanceMapScript memset(XTToyPileGUIDs, 0, sizeof(XTToyPileGUIDs)); memset(AssemblyGUIDs, 0, sizeof(AssemblyGUIDs)); memset(RazorHarpoonGUIDs, 0, sizeof(RazorHarpoonGUIDs)); + memset(ElderGUIDs, 0, sizeof(ElderGUIDs)); + memset(BrainRoomDoorGUIDs, 0, sizeof(BrainRoomDoorGUIDs)); memset(KeeperGUIDs, 0, sizeof(KeeperGUIDs)); + memset(_summonObservationRingKeeper, false, sizeof(_summonObservationRingKeeper)); + memset(_summonYSKeeper, false, sizeof(_summonYSKeeper)); } void FillInitialWorldStates(WorldPacket& packet) @@ -174,6 +192,38 @@ class instance_ulduar : public InstanceMapScript else algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } + + // Keepers at Observation Ring + if (GetBossState(BOSS_FREYA) == DONE && _summonObservationRingKeeper[0] && !KeeperGUIDs[0]) + { + _summonObservationRingKeeper[0] = false; + instance->SummonCreature(NPC_FREYA_OBSERVATION_RING, ObservationRingKeepersPos[0]); + } + if (GetBossState(BOSS_HODIR) == DONE && _summonObservationRingKeeper[1] && !KeeperGUIDs[1]) + { + _summonObservationRingKeeper[1] = false; + instance->SummonCreature(NPC_HODIR_OBSERVATION_RING, ObservationRingKeepersPos[1]); + } + if (GetBossState(BOSS_THORIM) == DONE && _summonObservationRingKeeper[2] && !KeeperGUIDs[2]) + { + _summonObservationRingKeeper[2] = false; + instance->SummonCreature(NPC_THORIM_OBSERVATION_RING, ObservationRingKeepersPos[2]); + } + if (GetBossState(BOSS_MIMIRON) == DONE && _summonObservationRingKeeper[3] && !KeeperGUIDs[3]) + { + _summonObservationRingKeeper[3] = false; + instance->SummonCreature(NPC_MIMIRON_OBSERVATION_RING, ObservationRingKeepersPos[3]); + } + + // Keepers in Yogg-Saron's room + if (_summonYSKeeper[0]) + instance->SummonCreature(NPC_FREYA_YS, YSKeepersPos[0]); + if (_summonYSKeeper[1]) + instance->SummonCreature(NPC_HODIR_YS, YSKeepersPos[1]); + if (_summonYSKeeper[2]) + instance->SummonCreature(NPC_THORIM_YS, YSKeepersPos[2]); + if (_summonYSKeeper[3]) + instance->SummonCreature(NPC_MIMIRON_YS, YSKeepersPos[3]); } void OnCreatureCreate(Creature* creature) @@ -194,6 +244,8 @@ class instance_ulduar : public InstanceMapScript case NPC_IGNIS: IgnisGUID = creature->GetGUID(); break; + + // Razorscale case NPC_RAZORSCALE: RazorscaleGUID = creature->GetGUID(); break; @@ -203,6 +255,8 @@ class instance_ulduar : public InstanceMapScript case NPC_EXPEDITION_COMMANDER: ExpeditionCommanderGUID = creature->GetGUID(); break; + + // XT-002 Deconstructor case NPC_XT002: XT002GUID = creature->GetGUID(); break; @@ -229,24 +283,6 @@ class instance_ulduar : public InstanceMapScript AddMinion(creature, true); break; - // Freya's Keeper - case NPC_IRONBRANCH: - KeeperGUIDs[0] = creature->GetGUID(); - if (GetBossState(BOSS_FREYA) == DONE) - creature->DespawnOrUnsummon(); - break; - case NPC_BRIGHTLEAF: - KeeperGUIDs[1] = creature->GetGUID(); - if (GetBossState(BOSS_FREYA) == DONE) - creature->DespawnOrUnsummon(); - break; - case NPC_STONEBARK: - KeeperGUIDs[2] = creature->GetGUID(); - if (GetBossState(BOSS_FREYA) == DONE) - creature->DespawnOrUnsummon(); - break; - - // Kologarn case NPC_KOLOGARN: KologarnGUID = creature->GetGUID(); break; @@ -256,25 +292,11 @@ class instance_ulduar : public InstanceMapScript case NPC_MIMIRON: MimironGUID = creature->GetGUID(); break; + + // Hodir case NPC_HODIR: HodirGUID = creature->GetGUID(); break; - case NPC_THORIM: - ThorimGUID = creature->GetGUID(); - break; - case NPC_FREYA: - FreyaGUID = creature->GetGUID(); - break; - case NPC_VEZAX: - VezaxGUID = creature->GetGUID(); - break; - case NPC_YOGGSARON: - YoggSaronGUID = creature->GetGUID(); - break; - case NPC_ALGALON: - AlgalonGUID = creature->GetGUID(); - break; - // Hodir's Helper NPCs case NPC_EIVI_NIGHTFEATHER: if (TeamInInstance == HORDE) creature->UpdateEntry(NPC_TOR_GREYCLOUD, HORDE); @@ -307,6 +329,80 @@ class instance_ulduar : public InstanceMapScript if (TeamInInstance == HORDE) creature->UpdateEntry(NPC_BATTLE_PRIEST_GINA, HORDE); break; + + case NPC_THORIM: + ThorimGUID = creature->GetGUID(); + break; + + // Freya + case NPC_FREYA: + FreyaGUID = creature->GetGUID(); + break; + case NPC_IRONBRANCH: + ElderGUIDs[0] = creature->GetGUID(); + if (GetBossState(BOSS_FREYA) == DONE) + creature->DespawnOrUnsummon(); + break; + case NPC_BRIGHTLEAF: + ElderGUIDs[1] = creature->GetGUID(); + if (GetBossState(BOSS_FREYA) == DONE) + creature->DespawnOrUnsummon(); + break; + case NPC_STONEBARK: + ElderGUIDs[2] = creature->GetGUID(); + if (GetBossState(BOSS_FREYA) == DONE) + creature->DespawnOrUnsummon(); + break; + + case NPC_VEZAX: + VezaxGUID = creature->GetGUID(); + break; + + // Yogg-Saron + case NPC_YOGG_SARON: + YoggSaronGUID = creature->GetGUID(); + break; + case NPC_VOICE_OF_YOGG_SARON: + VoiceOfYoggSaronGUID = creature->GetGUID(); + break; + case NPC_BRAIN_OF_YOGG_SARON: + BrainOfYoggSaronGUID = creature->GetGUID(); + break; + case NPC_SARA: + SaraGUID = creature->GetGUID(); + break; + case NPC_FREYA_YS: + KeeperGUIDs[0] = creature->GetGUID(); + _summonYSKeeper[0] = false; + SaveToDB(); + ++keepersCount; + break; + case NPC_HODIR_YS: + KeeperGUIDs[1] = creature->GetGUID(); + _summonYSKeeper[1] = false; + SaveToDB(); + ++keepersCount; + break; + case NPC_THORIM_YS: + KeeperGUIDs[2] = creature->GetGUID(); + _summonYSKeeper[2] = false; + SaveToDB(); + ++keepersCount; + break; + case NPC_MIMIRON_YS: + KeeperGUIDs[3] = creature->GetGUID(); + _summonYSKeeper[3] = false; + SaveToDB(); + ++keepersCount; + break; + case NPC_SANITY_WELL: + creature->SetReactState(REACT_PASSIVE); + break; + + // Algalon + case NPC_ALGALON: + AlgalonGUID = creature->GetGUID(); + break; case NPC_BRANN_BRONZBEARD_ALG: BrannBronzebeardAlgGUID = creature->GetGUID(); break; @@ -418,6 +514,18 @@ class instance_ulduar : public InstanceMapScript if (GetBossState(BOSS_ASSEMBLY_OF_IRON) != DONE) HandleGameObject(ArchivumDoorGUID, false); break; + case GO_YOGG_SARON_DOOR: + AddDoor(gameObject, true); + break; + case GO_BRAIN_ROOM_DOOR_1: + BrainRoomDoorGUIDs[0] = gameObject->GetGUID(); + break; + case GO_BRAIN_ROOM_DOOR_2: + BrainRoomDoorGUIDs[1] = gameObject->GetGUID(); + break; + case GO_BRAIN_ROOM_DOOR_3: + BrainRoomDoorGUIDs[2] = gameObject->GetGUID(); + break; case GO_CELESTIAL_PLANETARIUM_ACCESS_10: case GO_CELESTIAL_PLANETARIUM_ACCESS_25: if (_algalonSummoned) @@ -509,27 +617,36 @@ 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) { - switch (eventId) - { - case EVENT_TOWER_OF_STORM_DESTROYED: + case EVENT_TOWER_OF_STORM_DESTROYED: + if (FlameLeviathan && FlameLeviathan->isAlive()) FlameLeviathan->AI()->DoAction(ACTION_TOWER_OF_STORM_DESTROYED); - break; - case EVENT_TOWER_OF_FROST_DESTROYED: + break; + case EVENT_TOWER_OF_FROST_DESTROYED: + if (FlameLeviathan && FlameLeviathan->isAlive()) FlameLeviathan->AI()->DoAction(ACTION_TOWER_OF_FROST_DESTROYED); - break; - case EVENT_TOWER_OF_FLAMES_DESTROYED: + break; + case EVENT_TOWER_OF_FLAMES_DESTROYED: + if (FlameLeviathan && FlameLeviathan->isAlive()) FlameLeviathan->AI()->DoAction(ACTION_TOWER_OF_FLAMES_DESTROYED); - break; - case EVENT_TOWER_OF_LIFE_DESTROYED: + break; + case EVENT_TOWER_OF_LIFE_DESTROYED: + if (FlameLeviathan && FlameLeviathan->isAlive()) FlameLeviathan->AI()->DoAction(ACTION_TOWER_OF_LIFE_DESTROYED); - break; - } + break; + case EVENT_ACTIVATE_SANITY_WELL: + if (Creature* freya = instance->GetCreature(KeeperGUIDs[0])) + freya->AI()->DoAction(4/*ACTION_SANITY_WELLS*/); + break; + case EVENT_HODIRS_PROTECTIVE_GAZE_PROC: + if (Creature* hodir = instance->GetCreature(KeeperGUIDs[1])) + hodir->AI()->DoAction(5/*ACTION_FLASH_FREEZE*/); + break; } } - bool SetBossState(uint32 type, EncounterState state) { if (!InstanceScript::SetBossState(type, state)) @@ -542,8 +659,14 @@ class instance_ulduar : public InstanceMapScript case BOSS_RAZORSCALE: case BOSS_XT002: case BOSS_AURIAYA: + break; case BOSS_MIMIRON: + if (state == DONE) + instance->SummonCreature(NPC_MIMIRON_OBSERVATION_RING, ObservationRingKeepersPos[3]); + break; case BOSS_FREYA: + if (state == DONE) + instance->SummonCreature(NPC_FREYA_OBSERVATION_RING, ObservationRingKeepersPos[0]); break; case BOSS_ASSEMBLY_OF_IRON: if (state == DONE) @@ -553,7 +676,7 @@ class instance_ulduar : public InstanceMapScript if (state == DONE) HandleGameObject(VezaxDoorGUID, true); break; - case BOSS_YOGGSARON: + case BOSS_YOGG_SARON: break; case BOSS_KOLOGARN: if (state == DONE) @@ -576,12 +699,18 @@ class instance_ulduar : public InstanceMapScript HodirChest->SetRespawnTime(HodirChest->GetRespawnDelay()); HandleGameObject(HodirDoorGUID, true); HandleGameObject(HodirIceDoorGUID, true); + + instance->SummonCreature(NPC_HODIR_OBSERVATION_RING, ObservationRingKeepersPos[1]); } break; case BOSS_THORIM: if (state == DONE) + { if (GameObject* gameObject = instance->GetGameObject(ThorimChestGUID)) gameObject->SetRespawnTime(gameObject->GetRespawnDelay()); + + instance->SummonCreature(NPC_THORIM_OBSERVATION_RING, ObservationRingKeepersPos[2]); + } break; case BOSS_ALGALON: if (state == DONE) @@ -661,6 +790,12 @@ class instance_ulduar : public InstanceMapScript case DATA_UNBROKEN: Unbroken = bool(data); break; + case DATA_ILLUSION: + illusion = data; + break; + case DATA_DRIVE_ME_CRAZY: + IsDriveMeCrazyEligible = data ? true : false; + break; case EVENT_DESPAWN_ALGALON: DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1); DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60); @@ -688,10 +823,24 @@ class instance_ulduar : public InstanceMapScript return LeviathanGUID; case BOSS_IGNIS: return IgnisGUID; + + // Razorscale case BOSS_RAZORSCALE: return RazorscaleGUID; case DATA_RAZORSCALE_CONTROL: return RazorscaleController; + case DATA_EXPEDITION_COMMANDER: + return ExpeditionCommanderGUID; + case GO_RAZOR_HARPOON_1: + return RazorHarpoonGUIDs[0]; + case GO_RAZOR_HARPOON_2: + return RazorHarpoonGUIDs[1]; + case GO_RAZOR_HARPOON_3: + return RazorHarpoonGUIDs[2]; + case GO_RAZOR_HARPOON_4: + return RazorHarpoonGUIDs[3]; + + // XT-002 Deconstructor case BOSS_XT002: return XT002GUID; case DATA_TOY_PILE_0: @@ -699,6 +848,15 @@ class instance_ulduar : public InstanceMapScript case DATA_TOY_PILE_2: case DATA_TOY_PILE_3: return XTToyPileGUIDs[data - DATA_TOY_PILE_0]; + + // Assembly of Iron + case DATA_STEELBREAKER: + return AssemblyGUIDs[0]; + case DATA_MOLGEIM: + return AssemblyGUIDs[1]; + case DATA_BRUNDIR: + return AssemblyGUIDs[2]; + case BOSS_KOLOGARN: return KologarnGUID; case BOSS_AURIAYA: @@ -709,42 +867,47 @@ class instance_ulduar : public InstanceMapScript return HodirGUID; case BOSS_THORIM: return ThorimGUID; + + // Freya case BOSS_FREYA: return FreyaGUID; + case BOSS_BRIGHTLEAF: + return ElderGUIDs[0]; + case BOSS_IRONBRANCH: + return ElderGUIDs[1]; + case BOSS_STONEBARK: + return ElderGUIDs[2]; + case BOSS_VEZAX: return VezaxGUID; - case BOSS_YOGGSARON: - return YoggSaronGUID; - case BOSS_ALGALON: - return AlgalonGUID; - // Razorscale expedition commander - case DATA_EXPEDITION_COMMANDER: - return ExpeditionCommanderGUID; - case GO_RAZOR_HARPOON_1: - return RazorHarpoonGUIDs[0]; - case GO_RAZOR_HARPOON_2: - return RazorHarpoonGUIDs[1]; - case GO_RAZOR_HARPOON_3: - return RazorHarpoonGUIDs[2]; - case GO_RAZOR_HARPOON_4: - return RazorHarpoonGUIDs[3]; - - // Assembly of Iron - case DATA_STEELBREAKER: - return AssemblyGUIDs[0]; - case DATA_MOLGEIM: - return AssemblyGUIDs[1]; - case DATA_BRUNDIR: - return AssemblyGUIDs[2]; - - // Freya's Keepers - case BOSS_BRIGHTLEAF: + // Yogg-Saron + case BOSS_YOGG_SARON: + return YoggSaronGUID; + case DATA_VOICE_OF_YOGG_SARON: + return VoiceOfYoggSaronGUID; + case DATA_BRAIN_OF_YOGG_SARON: + return BrainOfYoggSaronGUID; + case DATA_SARA: + return SaraGUID; + case GO_BRAIN_ROOM_DOOR_1: + return BrainRoomDoorGUIDs[0]; + case GO_BRAIN_ROOM_DOOR_2: + return BrainRoomDoorGUIDs[1]; + case GO_BRAIN_ROOM_DOOR_3: + return BrainRoomDoorGUIDs[2]; + case DATA_FREYA_YS: return KeeperGUIDs[0]; - case BOSS_IRONBRANCH: + case DATA_HODIR_YS: return KeeperGUIDs[1]; - case BOSS_STONEBARK: + case DATA_THORIM_YS: return KeeperGUIDs[2]; + case DATA_MIMIRON_YS: + return KeeperGUIDs[3]; + + // Algalon + case BOSS_ALGALON: + return AlgalonGUID; case DATA_SIGILDOOR_01: return AlgalonSigilDoorGUID[0]; case DATA_SIGILDOOR_02: @@ -776,6 +939,10 @@ class instance_ulduar : public InstanceMapScript return HodirRareCacheData; case DATA_UNBROKEN: return uint32(Unbroken); + case DATA_ILLUSION: + return illusion; + case DATA_KEEPERS_COUNT: + return keepersCount; default: break; } @@ -789,6 +956,30 @@ class instance_ulduar : public InstanceMapScript { case CRITERIA_HERALD_OF_TITANS: return _maxArmorItemLevel <= MAX_HERALD_ARMOR_ITEMLEVEL && _maxWeaponItemLevel <= MAX_HERALD_WEAPON_ITEMLEVEL; + case CRITERIA_WAITS_DREAMING_STORMWIND_25: + case CRITERIA_WAITS_DREAMING_STORMWIND_10: + return illusion == STORMWIND_ILLUSION; + case CRITERIA_WAITS_DREAMING_CHAMBER_25: + case CRITERIA_WAITS_DREAMING_CHAMBER_10: + return illusion == CHAMBER_ILLUSION; + case CRITERIA_WAITS_DREAMING_ICECROWN_25: + case CRITERIA_WAITS_DREAMING_ICECROWN_10: + return illusion == ICECROWN_ILLUSION; + case CRITERIA_DRIVE_ME_CRAZY_10: + case CRITERIA_DRIVE_ME_CRAZY_25: + return IsDriveMeCrazyEligible; + case CRITERIA_THREE_LIGHTS_IN_THE_DARKNESS_10: + case CRITERIA_THREE_LIGHTS_IN_THE_DARKNESS_25: + return keepersCount <= 3; + case CRITERIA_TWO_LIGHTS_IN_THE_DARKNESS_10: + case CRITERIA_TWO_LIGHTS_IN_THE_DARKNESS_25: + return keepersCount <= 2; + case CRITERIA_ONE_LIGHT_IN_THE_DARKNESS_10: + case CRITERIA_ONE_LIGHT_IN_THE_DARKNESS_25: + return keepersCount <= 1; + case CRITERIA_ALONE_IN_THE_DARKNESS_10: + case CRITERIA_ALONE_IN_THE_DARKNESS_25: + return keepersCount == 0; } return false; @@ -801,6 +992,9 @@ class instance_ulduar : public InstanceMapScript std::ostringstream saveStream; saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS) << ' ' << _algalonTimer << ' ' << (_algalonSummoned ? 1 : 0); + for (uint8 i = 0; i < 4; ++i) + saveStream << ' ' << (KeeperGUIDs[i] ? 1 : 0); + OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); } @@ -851,6 +1045,21 @@ class instance_ulduar : public InstanceMapScript DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, _algalonTimer); } } + + for (uint8 i = 0; i < 4; ++i) + { + loadStream >> tempState; + _summonYSKeeper[i] = tempState != 0; + } + + if (GetBossState(BOSS_FREYA) == DONE && !_summonYSKeeper[0]) + _summonObservationRingKeeper[0] = true; + if (GetBossState(BOSS_HODIR) == DONE && !_summonYSKeeper[1]) + _summonObservationRingKeeper[1] = true; + if (GetBossState(BOSS_THORIM) == DONE && !_summonYSKeeper[2]) + _summonObservationRingKeeper[2] = true; + if (GetBossState(BOSS_MIMIRON) == DONE && !_summonYSKeeper[3]) + _summonObservationRingKeeper[3] = true; } OUT_LOAD_INST_DATA_COMPLETE; @@ -889,6 +1098,8 @@ class instance_ulduar : public InstanceMapScript uint32 _algalonTimer; bool _summonAlgalon; bool _algalonSummoned; + bool _summonObservationRingKeeper[4]; + bool _summonYSKeeper[4]; uint32 _maxArmorItemLevel; uint32 _maxWeaponItemLevel; }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index 08fd95d0e26..612be3b71e8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -21,6 +21,8 @@ #include "ObjectMgr.h" #define UlduarScriptName "instance_ulduar" +extern Position const ObservationRingKeepersPos[4]; +extern Position const YSKeepersPos[4]; extern Position const AlgalonLandPos; enum UlduarBosses @@ -42,7 +44,7 @@ enum UlduarBosses BOSS_IRONBRANCH = 12, BOSS_STONEBARK = 13, BOSS_VEZAX = 14, - BOSS_YOGGSARON = 15, + BOSS_YOGG_SARON = 15, BOSS_ALGALON = 16, }; @@ -74,7 +76,7 @@ enum UlduarNPCs NPC_THORIM = 32865, NPC_FREYA = 32906, NPC_VEZAX = 33271, - NPC_YOGGSARON = 33288, + NPC_YOGG_SARON = 33288, NPC_ALGALON = 32871, // Mimiron @@ -115,6 +117,39 @@ enum UlduarNPCs NPC_NATURES_BLADE = 33527, NPC_GUARDIAN_OF_LIFE = 33528, + // Yogg-Saron + NPC_SARA = 33134, + NPC_GUARDIAN_OF_YOGG_SARON = 33136, + NPC_HODIR_OBSERVATION_RING = 33213, + NPC_FREYA_OBSERVATION_RING = 33241, + NPC_THORIM_OBSERVATION_RING = 33242, + NPC_MIMIRON_OBSERVATION_RING = 33244, + NPC_VOICE_OF_YOGG_SARON = 33280, + NPC_OMINOUS_CLOUD = 33292, + NPC_FREYA_YS = 33410, + NPC_HODIR_YS = 33411, + NPC_MIMIRON_YS = 33412, + NPC_THORIM_YS = 33413, + NPC_SUIT_OF_ARMOR = 33433, + NPC_KING_LLANE = 33437, + NPC_THE_LICH_KING = 33441, + NPC_IMMOLATED_CHAMPION = 33442, + NPC_YSERA = 33495, + NPC_NELTHARION = 33523, + NPC_MALYGOS = 33535, + NPC_DEATH_RAY = 33881, + NPC_DEATH_ORB = 33882, + NPC_BRAIN_OF_YOGG_SARON = 33890, + NPC_INFLUENCE_TENTACLE = 33943, + NPC_TURNED_CHAMPION = 33962, + NPC_CRUSHER_TENTACLE = 33966, + NPC_CONSTRICTOR_TENTACLE = 33983, + NPC_CORRUPTOR_TENTACLE = 33985, + NPC_IMMORTAL_GUARDIAN = 33988, + NPC_SANITY_WELL = 33991, + NPC_DESCEND_INTO_MADNESS = 34072, + NPC_MARKED_IMMORTAL_GUARDIAN = 36064, + // Algalon the Observer NPC_BRANN_BRONZBEARD_ALG = 34064, NPC_AZEROTH = 34246, @@ -155,6 +190,12 @@ enum UlduarGameObjects GO_HODIR_ICE_DOOR = 194441, GO_ARCHIVUM_DOOR = 194556, + // Yogg-Saron + GO_YOGG_SARON_DOOR = 194773, + GO_BRAIN_ROOM_DOOR_1 = 194635, + GO_BRAIN_ROOM_DOOR_2 = 194636, + GO_BRAIN_ROOM_DOOR_3 = 194637, + // Algalon the Observer GO_CELESTIAL_PLANETARIUM_ACCESS_10 = 194628, GO_CELESTIAL_PLANETARIUM_ACCESS_25 = 194752, @@ -169,12 +210,18 @@ enum UlduarGameObjects GO_GIFT_OF_THE_OBSERVER_25 = 194822, }; -enum LeviathanData +enum EventIds { EVENT_TOWER_OF_STORM_DESTROYED = 21031, EVENT_TOWER_OF_FROST_DESTROYED = 21032, EVENT_TOWER_OF_FLAMES_DESTROYED = 21033, EVENT_TOWER_OF_LIFE_DESTROYED = 21030, + EVENT_ACTIVATE_SANITY_WELL = 21432, + EVENT_HODIRS_PROTECTIVE_GAZE_PROC = 21437, +}; + +enum LeviathanActions +{ ACTION_TOWER_OF_STORM_DESTROYED = 1, ACTION_TOWER_OF_FROST_DESTROYED = 2, ACTION_TOWER_OF_FLAMES_DESTROYED = 3, @@ -184,14 +231,30 @@ enum LeviathanData enum UlduarAchievementCriteriaIds { - CRITERIA_CON_SPEED_ATORY = 21597, - CRITERIA_DISARMED = 21687, - CRITERIA_HERALD_OF_TITANS = 10678, + CRITERIA_CON_SPEED_ATORY = 21597, + CRITERIA_DISARMED = 21687, + CRITERIA_WAITS_DREAMING_STORMWIND_25 = 10321, + CRITERIA_WAITS_DREAMING_CHAMBER_25 = 10322, + CRITERIA_WAITS_DREAMING_ICECROWN_25 = 10323, + CRITERIA_WAITS_DREAMING_STORMWIND_10 = 10324, + CRITERIA_WAITS_DREAMING_CHAMBER_10 = 10325, + CRITERIA_WAITS_DREAMING_ICECROWN_10 = 10326, + CRITERIA_DRIVE_ME_CRAZY_10 = 10185, + CRITERIA_DRIVE_ME_CRAZY_25 = 10296, + CRITERIA_THREE_LIGHTS_IN_THE_DARKNESS_10 = 10410, + CRITERIA_THREE_LIGHTS_IN_THE_DARKNESS_25 = 10414, + CRITERIA_TWO_LIGHTS_IN_THE_DARKNESS_10 = 10388, + CRITERIA_TWO_LIGHTS_IN_THE_DARKNESS_25 = 10415, + CRITERIA_ONE_LIGHT_IN_THE_DARKNESS_10 = 10409, + CRITERIA_ONE_LIGHT_IN_THE_DARKNESS_25 = 10416, + CRITERIA_ALONE_IN_THE_DARKNESS_10 = 10412, + CRITERIA_ALONE_IN_THE_DARKNESS_25 = 10417, + CRITERIA_HERALD_OF_TITANS = 10678, }; enum UlduarData { - // Collosus (Leviathan) + // Colossus (Leviathan) DATA_COLOSSUS = 20, // Razorscale @@ -212,6 +275,18 @@ enum UlduarData // Hodir DATA_HODIR_RARE_CACHE, + // Yogg-Saron + DATA_VOICE_OF_YOGG_SARON, + DATA_SARA, + DATA_BRAIN_OF_YOGG_SARON, + DATA_FREYA_YS, + DATA_HODIR_YS, + DATA_THORIM_YS, + DATA_MIMIRON_YS, + DATA_ILLUSION, + DATA_DRIVE_ME_CRAZY, + DATA_KEEPERS_COUNT, + // Algalon the Observer DATA_ALGALON_SUMMON_STATE, DATA_SIGILDOOR_01, @@ -245,6 +320,13 @@ enum UlduarEvents ACTION_INIT_ALGALON = 6, }; +enum YoggSaronIllusions +{ + CHAMBER_ILLUSION = 0, + ICECROWN_ILLUSION = 1, + STORMWIND_ILLUSION = 2, +}; + template<class AI> CreatureAI* GetUlduarAI(Creature* creature) { 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 30521d0d275..562aa5a3848 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -121,7 +121,7 @@ public: } } - sLog->outDebug(LOG_FILTER_TSCR, "Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); return NULL; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index 2b1d850ab25..8e726c10fca 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -23,6 +23,7 @@ SDComment: SDCategory: Script Data End */ +#include <algorithm> #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "utgarde_pinnacle.h" @@ -105,20 +106,25 @@ public: uint32 uiWaitingTimer; Phase currentPhase; uint8 AddCount; - bool DoneAdds[4]; + Phase Sequence[4]; InstanceScript* instance; void Reset() { + /// There is a good reason to store them like this, we are going to shuffle the order. + for (uint32 i = PHASE_FRENZIED_WORGEN; i < PHASE_GORTOK_PALEHOOF; ++i) + Sequence[i] = Phase(i); + + /// This ensures a random order and only executes each phase once. + std::random_shuffle(Sequence, Sequence + PHASE_GORTOK_PALEHOOF); + uiArcingSmashTimer = 15000; uiImpaleTimer = 12000; uiWhiteringRoarTimer = 10000; me->GetMotionMaster()->MoveTargetedHome(); - for (uint32 i = 0; i < 4; i++) - DoneAdds[i] = false; AddCount = 0; currentPhase = PHASE_NONE; @@ -235,26 +241,7 @@ public: if (AddCount >= DUNGEON_MODE(2, 4)) move = PHASE_GORTOK_PALEHOOF; else - { - //select random not yet defeated add - uint8 next = urand(0, 3); - for (uint8 i = 0; i < 16; i++) - { - if (!DoneAdds[i % 4]) - { - if (next == 0) - { - move = (Phase)(i % 4); - break; - } - else if (next > 0) - --next; - } - } - ++AddCount; - DoneAdds[move] = true; - move = (Phase)(move % 4); - } + move = Sequence[AddCount++]; //send orb to summon spot Creature* pOrb = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_ORB) : 0); if (pOrb && pOrb->isAlive()) diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 70b500166c9..0447d70b502 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -921,7 +921,7 @@ class npc_frostbrood_skytalon : public CreatureScript if (id == POINT_GRAB_DECOY) if (TempSummon* summon = me->ToTempSummon()) if (Unit* summoner = summon->GetSummoner()) - DoCast(summoner, SPELL_GRAB); + DoCast(summoner, SPELL_GRAB); } void UpdateAI(uint32 diff) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index 55bb61b8c42..0ffab435a9c 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -62,6 +62,8 @@ OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType ty OutdoorPvPHP::OutdoorPvPHP() { m_TypeId = OUTDOOR_PVP_HP; + m_AllianceTowersControlled = 0; + m_HordeTowersControlled = 0; } bool OutdoorPvPHP::SetupOutdoorPvP() diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index bd6fd96451f..fe3489b4a7e 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -27,6 +27,7 @@ OutdoorPvPNA::OutdoorPvPNA() { m_TypeId = OUTDOOR_PVP_NA; + m_obj = NULL; } void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed) @@ -216,8 +217,8 @@ bool OutdoorPvPNA::SetupOutdoorPvP() m_obj = new OPvPCapturePointNA(this); if (!m_obj) return false; - AddCapturePoint(m_obj); + AddCapturePoint(m_obj); return true; } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index bd8b6cfd982..98b0ee5c5f4 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -28,6 +28,17 @@ OutdoorPvPTF::OutdoorPvPTF() { m_TypeId = OUTDOOR_PVP_TF; + + m_IsLocked = false; + m_LockTimer = TF_LOCK_TIME; + m_LockTimerUpdate = 0; + + m_AllianceTowersControlled = 0; + m_HordeTowersControlled = 0; + + hours_left = 6; + second_digit = 0; + first_digit = 0; } OPvPCapturePointTF::OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType type) 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 f65f42762c1..c850761f518 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, "Shadow Labyrinth: counting %u Fel Overseers.", m_uiFelOverseerCount); + TC_LOG_DEBUG(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(LOG_FILTER_TSCR, "Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE"); + TC_LOG_ERROR(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, "Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount); else { m_auiEncounter[1] = DONE; - sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: TYPE_OVERSEER == DONE"); + TC_LOG_DEBUG(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 5d18026c1ca..2048270f285 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(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)"); + TC_LOG_ERROR(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 9860cf0385a..79b8213fff3 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -326,7 +326,7 @@ public: GridSearcherSucceeded = true; } } - } else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly"); + } else TC_LOG_ERROR(LOG_FILTER_TSCR, "SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly"); } } @@ -344,13 +344,13 @@ public: if (reseting) return; - sLog->outDebug(LOG_FILTER_TSCR, "Increasing Death Count for Shade of Akama encounter"); + TC_LOG_DEBUG(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(LOG_FILTER_TSCR, "SD2 ERROR: Shade of Akama - attempt to remove guid " UI64FMTD " from Sorcerers list but list is already empty", guid); + TC_LOG_ERROR(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); } } @@ -402,17 +402,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, "Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID()); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID()); } } - else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy"); + else TC_LOG_ERROR(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(LOG_FILTER_TSCR, "SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy"); return; } @@ -538,7 +538,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(LOG_FILTER_TSCR, "SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama."); + else TC_LOG_ERROR(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*/) @@ -546,7 +546,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(LOG_FILTER_TSCR, "SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama."); + else TC_LOG_ERROR(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 57b7d484004..100f23c72af 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -161,7 +161,7 @@ public: Council[1] = instance->GetData64(DATA_VERASDARKSHADOW); Council[2] = instance->GetData64(DATA_LADYMALANDE); Council[3] = instance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); - } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); + } else TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); } void EnterCombat(Unit* /*who*/) {} @@ -407,7 +407,7 @@ struct boss_illidari_councilAI : public ScriptedAI } else { - sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); + TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); EnterEvadeMode(); return; } @@ -455,7 +455,7 @@ struct boss_illidari_councilAI : public ScriptedAI { if (!instance) { - sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); + TC_LOG_ERROR(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 6694d93e5d7..8883b563975 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -139,7 +139,7 @@ public: } } - sLog->outDebug(LOG_FILTER_TSCR, "Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); + TC_LOG_DEBUG(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 744888afbd4..f536f1af45b 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, "Instance Steamvault: Access panel used."); + TC_LOG_DEBUG(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, "Instance Steamvault: Access panel used."); + TC_LOG_DEBUG(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 477ec70ba86..b1d780c18ca 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, "Instance Ramparts: SetData received for type %u with data %u", uiType, uiData); + TC_LOG_DEBUG(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 a6497e6a373..e30f153b39f 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -362,7 +362,7 @@ class boss_kaelthas : public CreatureScript if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3]) { - sLog->outError(LOG_FILTER_TSCR, "Kael'Thas One or more advisors missing, Skipping Phases 1-3"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "Kael'Thas One or more advisors missing, Skipping Phases 1-3"); Talk(SAY_PHASE4_INTRO2); @@ -689,7 +689,7 @@ class boss_kaelthas : public CreatureScript Advisor = Unit::GetCreature(*me, m_auiAdvisorGuid[i]); if (!Advisor) - sLog->outError(LOG_FILTER_TSCR, "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); + TC_LOG_ERROR(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); } @@ -782,7 +782,7 @@ class boss_kaelthas : public CreatureScript if (me->getThreatManager().getThreatList().size() >= 2) for (uint32 i = 0; i < 3; ++i) { - sLog->outDebug(LOG_FILTER_TSCR, "Kael'Thas mind control not supported."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "Kael'Thas mind control not supported."); //DoCast(unit, SPELL_MIND_CONTROL); } 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 2b597be8a9f..18ea83f7121 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp @@ -45,9 +45,9 @@ enum Spells enum Events { - EVENT_STREAM_OF_MACHINE_FLUID = 0, - EVENT_SAW_BLADE = 1, - EVENT_SHADOW_POWER = 2 + EVENT_STREAM_OF_MACHINE_FLUID = 1, + EVENT_SAW_BLADE = 2, + EVENT_SHADOW_POWER = 3 }; class boss_gatewatcher_gyrokill : public CreatureScript 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 902fb8e76b3..ce1322088e2 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp @@ -52,11 +52,11 @@ enum Spells enum Events { - EVENT_FROST_ATTACK = 0, - EVENT_ARCANE_BLAST = 1, - EVENT_DRAGONS_BREATH = 2, - EVENT_KNOCKBACK = 3, - EVENT_SOLARBURN = 4 + EVENT_FROST_ATTACK = 1, + EVENT_ARCANE_BLAST = 2, + EVENT_DRAGONS_BREATH = 3, + EVENT_KNOCKBACK = 4, + EVENT_SOLARBURN = 5 }; class boss_nethermancer_sepethrea : public CreatureScript 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 65cd195fb80..d179e47b942 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 @@ -54,11 +54,11 @@ enum Spells enum Events { - EVENT_SUMMON = 0, - EVENT_MANA_TAP = 1, - EVENT_ARCANE_TORRENT = 2, - EVENT_DOMINATION = 3, - EVENT_ARCANE_EXPLOSION = 4 + EVENT_SUMMON = 1, + EVENT_MANA_TAP = 2, + EVENT_ARCANE_TORRENT = 3, + EVENT_DOMINATION = 4, + EVENT_ARCANE_EXPLOSION = 5 }; enum Creatures diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index e950547ac30..48e0243bf0e 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_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(LOG_FILTER_TSCR, "TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player."); + TC_LOG_ERROR(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/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index c0adddd51fc..7af36d381e8 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -502,7 +502,7 @@ public: return true; } - sLog->outDebug(LOG_FILTER_TSCR, "npc_commander_dawnforge event already in progress, need to wait."); + TC_LOG_DEBUG(LOG_FILTER_TSCR, "npc_commander_dawnforge event already in progress, need to wait."); return false; } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 60f641d9054..c60f4f07821 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3531,7 +3531,7 @@ class spell_gen_orc_disguise : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || + if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE)) return false; return true; diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index f6391c80d63..7a5f0c9fd5b 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -213,7 +213,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]); if (!spellInfo) { - sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); + TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); continue; } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index a9a4b2d749a..7b2e5c02bfa 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -161,7 +161,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader rank = 2; break; default: - sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); + TC_LOG_ERROR(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 d2d78aa81cc..16550dc69ea 100644 --- 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->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_SAY: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SAY] Player %s says (language %u): %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[SAY] Player %s says (language %u): %s", player->GetName().c_str(), lang, msg.c_str()); break; case CHAT_MSG_EMOTE: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[TEXTEMOTE] Player %s emotes: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[TEXTEMOTE] Player %s emotes: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_YELL: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[YELL] Player %s yells (language %u): %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[YELL] Player %s yells (language %u): %s", player->GetName().c_str(), 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->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[WHISPER] Player %s tells %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[WHISPER] Player %s tells %s: %s", player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells %s: %s", player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str()); } @@ -73,52 +73,52 @@ public: { case CHAT_MSG_PARTY: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Player %s tells group with leader %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Player %s tells group with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells group with leader %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells group with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_PARTY_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Leader %s tells group: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Leader %s tells group: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_RAID: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Player %s tells raid with leader %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Player %s tells raid with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells raid with leader %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells raid with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_RAID_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s tells raid: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s tells raid: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_RAID_WARNING: if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s warns raid with: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s warns raid with: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_BATTLEGROUND: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Player %s tells battleground with leader %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Player %s tells battleground with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells battleground with leader %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells battleground with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_BATTLEGROUND_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Leader player %s tells battleground: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Leader player %s tells battleground: %s", player->GetName().c_str(), msg.c_str()); break; } @@ -130,16 +130,16 @@ public: { case CHAT_MSG_GUILD: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[GUILD] Player %s tells guild %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[GUILD] Player %s tells guild %s: %s", player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends to guild %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends to guild %s: %s", player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); break; case CHAT_MSG_OFFICER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[OFFICER] Player %s tells guild %s officers: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[OFFICER] Player %s tells guild %s officers: %s", player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); break; } @@ -154,10 +154,10 @@ public: channel->HasFlag(CHANNEL_FLAG_LFG)); if (sWorld->getBoolConfig(CONFIG_CHATLOG_SYSCHAN) && isSystem) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SYSCHAN] Player %s tells channel %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[SYSCHAN] Player %s tells channel %s: %s", player->GetName().c_str(), channel->GetName().c_str(), msg.c_str()); else if (sWorld->getBoolConfig(CONFIG_CHATLOG_CHANNEL)) - sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[CHANNEL] Player %s tells channel %s: %s", + TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[CHANNEL] Player %s tells channel %s: %s", player->GetName().c_str(), channel ? channel->GetName().c_str() : "<unknown>", msg.c_str()); } }; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index f57b6b8942c..3634209cc8f 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -334,7 +334,7 @@ public: if (Spell) creature->CastSpell(player, Spell, false); else - sLog->outError(LOG_FILTER_TSCR, "go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction()); + TC_LOG_ERROR(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 89c768d65ba..0933d092f1f 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -247,7 +247,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, "player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry()); + TC_LOG_DEBUG(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 0ac766c37f9..56841fcdaa1 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -142,14 +142,14 @@ public: } if (!SpawnAssoc) - 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()); + TC_LOG_ERROR(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->outError(LOG_FILTER_SQL, "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); + TC_LOG_ERROR(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; } @@ -169,7 +169,7 @@ public: SpawnedGUID = summoned->GetGUID(); else { - sLog->outError(LOG_FILTER_SQL, "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); + TC_LOG_ERROR(LOG_FILTER_SQL, "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); SpawnAssoc = NULL; } @@ -852,7 +852,7 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff) patientEntry = HordeSoldierId[rand() % 3]; break; default: - sLog->outError(LOG_FILTER_TSCR, "Invalid entry for Triage doctor. Please check your database"); + TC_LOG_ERROR(LOG_FILTER_TSCR, "Invalid entry for Triage doctor. Please check your database"); return; } @@ -1751,7 +1751,7 @@ public: { me->HandleEmoteCommand(emote); Unit* owner = me->GetOwner(); - if (emote != TEXT_EMOTE_KISS || owner || owner->GetTypeId() != TYPEID_PLAYER || + if (emote != TEXT_EMOTE_KISS || !owner || owner->GetTypeId() != TYPEID_PLAYER || owner->ToPlayer()->GetTeam() != player->GetTeam()) { return; |
