diff options
Diffstat (limited to 'src/server/scripts')
86 files changed, 845 insertions, 1137 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 80dd2dc366a..ae3250ad7b7 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -473,7 +473,7 @@ public: LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u' AND (RealmID = '%d' OR RealmID = '-1')", targetAccountId, realmID); if (gm != 0) - LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', '%d')", targetAccountId, gm, realmID); + LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', '%d')", targetAccountId, gm, gmRealmID); handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); return true; diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 2a352e92d01..ab077af0863 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -117,8 +117,8 @@ public: bool first = true; bool footer = false; - ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true); - HashMapHolder<Player>::MapType& m = sObjectAccessor->GetPlayers(); + TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock()); + HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { AccountTypes itrSec = itr->second->GetSession()->GetSecurity(); diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp index 2a270527fb8..bafaae465ef 100644 --- a/src/server/scripts/Commands/cs_gps.cpp +++ b/src/server/scripts/Commands/cs_gps.cpp @@ -43,16 +43,16 @@ public: return commandTable; } - static bool HandleGPSCommand(ChatHandler* handler, const char *args) + static bool HandleGPSCommand(ChatHandler* handler, char const* args) { - WorldObject* obj = NULL; + WorldObject* object = NULL; if (*args) { uint64 guid = handler->extractGuidFromLink((char*)args); if (guid) - obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); + object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); - if (!obj) + if (!object) { handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); handler->SetSentErrorMessage(true); @@ -61,71 +61,73 @@ public: } else { - obj = handler->getSelectedUnit(); + object = handler->getSelectedUnit(); - if (!obj) + if (!object) { handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); handler->SetSentErrorMessage(true); return false; } } - CellPair cell_val = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - Cell cell(cell_val); - uint32 zone_id, area_id; - obj->GetZoneAndAreaId(zone_id, area_id); + CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); + Cell cell(cellCoord); - MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId()); - AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id); + uint32 zoneId, areaId; + object->GetZoneAndAreaId(zoneId, areaId); - float zone_x = obj->GetPositionX(); - float zone_y = obj->GetPositionY(); + MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); + AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); - Map2ZoneCoordinates(zone_x, zone_y, zone_id); + float zoneX = object->GetPositionX(); + float zoneY = object->GetPositionY(); - Map const* map = obj->GetMap(); - float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT); - float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()); + Map2ZoneCoordinates(zoneX, zoneY, zoneId); - GridPair p = Trinity::ComputeGridPair(obj->GetPositionX(), obj->GetPositionY()); + Map const* map = object->GetMap(); + float groundZ = map->GetHeight(object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); + float floorZ = map->GetHeight(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); + + GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); // 63? WHY? - int gx = 63 - p.x_coord; - int gy = 63 - p.y_coord; + int gridX = 63 - gridCoord.x_coord; + int gridY = 63 - gridCoord.y_coord; - uint32 have_map = Map::ExistMap(obj->GetMapId(), gx, gy) ? 1 : 0; - uint32 have_vmap = Map::ExistVMap(obj->GetMapId(), gx, gy) ? 1 : 0; + uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; + uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - if (have_vmap) + if (haveVMap) { - if (map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ())) + if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) handler->PSendSysMessage("You are outdoors"); else handler->PSendSysMessage("You are indoors"); } - else handler->PSendSysMessage("no VMAP available for area info"); + else + handler->PSendSysMessage("no VMAP available for area info"); handler->PSendSysMessage(LANG_MAP_POSITION, - obj->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"), - zone_id, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"), - area_id, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"), - obj->GetPhaseMask(), - obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(), - cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(), - zone_x, zone_y, ground_z, floor_z, have_map, have_vmap); - - LiquidData liquid_status; - ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status); - if (res) - { - handler->PSendSysMessage(LANG_LIQUID_STATUS, liquid_status.level, liquid_status.depth_level, liquid_status.type, res); - } + object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"), + zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"), + areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"), + object->GetPhaseMask(), + object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), + cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), + zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); + + LiquidData liquidStatus; + ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); + + if (status) + handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.type, status); + return true; } - static bool HandleWPGPSCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp index 6f44000017d..f6c6d89c0b7 100644 --- a/src/server/scripts/Commands/cs_honor.cpp +++ b/src/server/scripts/Commands/cs_honor.cpp @@ -39,12 +39,14 @@ public: { "", SEC_GAMEMASTER, false, &HandleHonorAddCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; + static ChatCommand honorCommandTable[] = { { "add", SEC_GAMEMASTER, false, NULL, "", honorAddCommandTable }, { "update", SEC_GAMEMASTER, false, &HandleHonorUpdateCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; + static ChatCommand commandTable[] = { { "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable }, @@ -52,7 +54,8 @@ public: }; return commandTable; } - static bool HandleHonorAddCommand(ChatHandler* handler, const char* args) + + static bool HandleHonorAddCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -73,7 +76,8 @@ public: target->RewardHonor(NULL, 1, amount); return true; } - static bool HandleHonorAddKillCommand(ChatHandler* handler, const char* /*args*/) + + static bool HandleHonorAddKillCommand(ChatHandler* handler, char const* /*args*/) { Unit* target = handler->getSelectedUnit(); if (!target) @@ -90,7 +94,8 @@ public: handler->GetSession()->GetPlayer()->RewardHonor(target, 1); return true; } - static bool HandleHonorUpdateCommand(ChatHandler* handler, const char* /*args*/) + + static bool HandleHonorUpdateCommand(ChatHandler* handler, char const* /*args*/) { Player* target = handler->getSelectedPlayer(); if (!target) diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index 9eb315b0b6a..d03291d6d5d 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -37,28 +37,29 @@ public: { static ChatCommand learnAllMyCommandTable[] = { - { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL }, - { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL }, - { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL }, - { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL }, + { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL }, + { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL }, + { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; + static ChatCommand learnAllCommandTable[] = { - { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable }, - { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL }, - { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL }, - { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL }, - { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL }, - { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable }, + { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL }, + { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL }, + { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL }, + { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL }, + { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand learnCommandTable[] = { - { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable }, - { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable }, + { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = @@ -68,7 +69,8 @@ public: }; return commandTable; } - static bool HandleLearnCommand(ChatHandler* handler, const char* args) + + static bool HandleLearnCommand(ChatHandler* handler, char const* args) { Player* targetPlayer = handler->getSelectedPlayer(); @@ -84,8 +86,8 @@ public: if (!spell || !sSpellMgr->GetSpellInfo(spell)) return false; - char const* allStr = strtok(NULL, " "); - bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false; + char const* all = strtok(NULL, " "); + bool allRanks = all ? (strncmp(all, "all", strlen(all)) == 0) : false; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell); if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer())) @@ -110,14 +112,14 @@ public: else targetPlayer->learnSpell(spell, false); - uint32 first_spell = sSpellMgr->GetFirstSpellInChain(spell); - if (GetTalentSpellCost(first_spell)) + uint32 firstSpell = sSpellMgr->GetFirstSpellInChain(spell); + if (GetTalentSpellCost(firstSpell)) targetPlayer->SendTalentsInfoData(false); return true; } - static bool HandleLearnAllGMCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleLearnAllGMCommand(ChatHandler* handler, char const* /*args*/) { for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) { @@ -135,19 +137,19 @@ public: return true; } - static bool HandleLearnAllMyClassCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleLearnAllMyClassCommand(ChatHandler* handler, char const* /*args*/) { HandleLearnAllMySpellsCommand(handler, ""); HandleLearnAllMyTalentsCommand(handler, ""); return true; } - static bool HandleLearnAllMySpellsCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleLearnAllMySpellsCommand(ChatHandler* handler, char const* /*args*/) { - ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(handler->GetSession()->GetPlayer()->getClass()); - if (!clsEntry) + ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(handler->GetSession()->GetPlayer()->getClass()); + if (!classEntry) return true; - uint32 family = clsEntry->spellfamily; + uint32 family = classEntry->spellfamily; for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) { @@ -172,8 +174,8 @@ public: continue; // skip spells with first rank learned as talent (and all talents then also) - uint32 first_rank = sSpellMgr->GetFirstSpellInChain(spellInfo->Id); - if (GetTalentSpellCost(first_rank) > 0) + uint32 firstRank = sSpellMgr->GetFirstSpellInChain(spellInfo->Id); + if (GetTalentSpellCost(firstRank) > 0) continue; // skip broken spells @@ -187,7 +189,7 @@ public: return true; } - static bool HandleLearnAllMyTalentsCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleLearnAllMyTalentsCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); uint32 classMask = player->getClassMask(); @@ -207,7 +209,7 @@ public: // search highest talent rank uint32 spellId = 0; - for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank) + for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank) { if (talentInfo->RankID[rank] != 0) { @@ -234,7 +236,7 @@ public: return true; } - static bool HandleLearnAllMyPetTalentsCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleLearnAllMyPetTalentsCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); @@ -246,23 +248,23 @@ public: return false; } - CreatureTemplate const* ci = pet->GetCreatureInfo(); - if (!ci) + CreatureTemplate const* creatureInfo = pet->GetCreatureInfo(); + if (!creatureInfo) { handler->SendSysMessage(LANG_WRONG_PET_TYPE); handler->SetSentErrorMessage(true); return false; } - CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family); - if (!pet_family) + CreatureFamilyEntry const* petFamily = sCreatureFamilyStore.LookupEntry(creatureInfo->family); + if (!petFamily) { handler->SendSysMessage(LANG_WRONG_PET_TYPE); handler->SetSentErrorMessage(true); return false; } - if (pet_family->petTalentType < 0) // not hunter pet + if (petFamily->petTalentType < 0) // not hunter pet { handler->SendSysMessage(LANG_WRONG_PET_TYPE); handler->SetSentErrorMessage(true); @@ -280,30 +282,30 @@ public: continue; // prevent learn talent for different family (cheating) - if (((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask) == 0) + if (((1 << petFamily->petTalentType) & talentTabInfo->petTalentMask) == 0) continue; // search highest talent rank - uint32 spellid = 0; + uint32 spellId = 0; for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank) { if (talentInfo->RankID[rank] != 0) { - spellid = talentInfo->RankID[rank]; + spellId = talentInfo->RankID[rank]; break; } } - if (!spellid) // ??? none spells in talent + if (!spellId) // ??? none spells in talent continue; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false)) continue; // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree) - pet->learnSpellHighRank(spellid); + pet->learnSpellHighRank(spellId); } pet->SetFreeTalentPoints(0); @@ -312,7 +314,7 @@ public: return true; } - static bool HandleLearnAllLangCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleLearnAllLangCommand(ChatHandler* handler, char const* /*args*/) { // skipping UNIVERSAL language (0) for (uint8 i = 1; i < LANGUAGES_COUNT; ++i) @@ -322,7 +324,7 @@ public: return true; } - static bool HandleLearnAllDefaultCommand(ChatHandler* handler, const char* args) + static bool HandleLearnAllDefaultCommand(ChatHandler* handler, char const* args) { Player* target; if (!handler->extractPlayerTarget((char*)args, &target)) @@ -335,9 +337,8 @@ public: return true; } - static bool HandleLearnAllCraftsCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleLearnAllCraftsCommand(ChatHandler* handler, char const* /*args*/) { - for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i); @@ -355,7 +356,7 @@ public: return true; } - static bool HandleLearnAllRecipesCommand(ChatHandler* handler, const char* args) + static bool HandleLearnAllRecipesCommand(ChatHandler* handler, char const* args) { // Learns all recipes of specified profession and sets skill to max // Example: .learn all_recipes enchanting @@ -370,13 +371,13 @@ public: if (!*args) return false; - std::wstring wnamepart; + std::wstring namePart; - if (!Utf8toWStr(args, wnamepart)) + if (!Utf8toWStr(args, namePart)) return false; // converting string that we try to find to lower case - wstrToLower(wnamepart); + wstrToLower(namePart); std::string name; @@ -392,29 +393,29 @@ public: !skillInfo->canLink) // only prof with recipes have set continue; - int loc = handler->GetSessionDbcLocale(); - name = skillInfo->name[loc]; + int locale = handler->GetSessionDbcLocale(); + name = skillInfo->name[locale]; if (name.empty()) continue; - if (!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, namePart)) { - loc = 0; - for (; loc < TOTAL_LOCALES; ++loc) + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) { - if (loc == handler->GetSessionDbcLocale()) + if (locale == handler->GetSessionDbcLocale()) continue; - name = skillInfo->name[loc]; + name = skillInfo->name[locale]; if (name.empty()) continue; - if (Utf8FitTo(name, wnamepart)) + if (Utf8FitTo(name, namePart)) break; } } - if (loc < TOTAL_LOCALES) + if (locale < TOTAL_LOCALES) { targetSkillInfo = skillInfo; break; @@ -431,7 +432,8 @@ public: handler->PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); return true; } - static void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id) + + static void HandleLearnSkillRecipesHelper(Player* player, uint32 skillId) { uint32 classmask = player->getClassMask(); @@ -442,7 +444,7 @@ public: continue; // wrong skill - if (skillLine->skillId != skill_id) + if (skillLine->skillId != skillId) continue; // not high rank diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 0fecfa83221..20d0994b911 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -155,7 +155,7 @@ public: } //add item in vendorlist - static bool HandleNpcAddVendorItemCommand(ChatHandler* handler, const char* args) + static bool HandleNpcAddVendorItemCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -168,7 +168,11 @@ public: return false; } - uint32 itemId = atol(pitem); + int32 item_int = atol(pitem); + if (item_int <= 0) + return false; + + uint32 itemId = item_int; char* fmaxcount = strtok(NULL, " "); //add maxcount, default: 0 uint32 maxcount = 0; diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 31d8cd3c8f2..3d437e473f7 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -128,13 +128,13 @@ public: // remove all quest entries for 'entry' from quest log for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) { - uint32 quest = player->GetQuestSlotQuestId(slot); - if (quest == entry) + uint32 logQuest = player->GetQuestSlotQuestId(slot); + if (logQuest == entry) { player->SetQuestSlot(slot, 0); // we ignore unequippable quest items in this case, its' still be equipped - player->TakeQuestSourceItem(quest, false); + player->TakeQuestSourceItem(logQuest, false); } } @@ -176,8 +176,8 @@ public: // Add quest items for quests that require items for (uint8 x = 0; x < QUEST_ITEM_OBJECTIVES_COUNT; ++x) { - uint32 id = quest->ReqItemId[x]; - uint32 count = quest->ReqItemCount[x]; + uint32 id = quest->RequiredItemId[x]; + uint32 count = quest->RequiredItemCount[x]; if (!id || !count) continue; @@ -195,10 +195,10 @@ public: // All creature/GO slain/casted (not required, but otherwise it will display "Creature slain 0/10") for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { - int32 creature = quest->ReqCreatureOrGOId[i]; - uint32 creaturecount = quest->ReqCreatureOrGOCount[i]; + int32 creature = quest->RequiredNpcOrGo[i]; + uint32 creaturecount = quest->RequiredNpcOrGoCount[i]; - if (uint32 spell_id = quest->ReqSpell[i]) + if (uint32 spell_id = quest->RequiredSpellCast[i]) { for (uint16 z = 0; z < creaturecount; ++z) player->CastedCreatureOrGO(creature, 0, spell_id); diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 17c076f903c..ef4ddf17476 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -125,6 +125,29 @@ public: if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) return false; + if (strcmp(teleStr, "$home") == 0) // References target's homebind + { + if (target) + target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation()); + else + { + QueryResult resultDB = CharacterDatabase.PQuery("SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = %u", target_guid); + if (resultDB) + { + Field* fieldsDB = resultDB->Fetch(); + uint32 mapId = fieldsDB[0].GetUInt32(); + uint32 zoneId = fieldsDB[1].GetUInt32(); + float posX = fieldsDB[2].GetFloat(); + float posY = fieldsDB[3].GetFloat(); + float posZ = fieldsDB[4].GetFloat(); + + Player::SavePositionInDB(mapId, posX, posY, posZ, 0, zoneId, target_guid); + } + } + + return true; + } + // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r GameTele const* tele = handler->extractGameTeleFromLink(teleStr); if (!tele) @@ -187,8 +210,8 @@ public: if (!*args) return false; - Player* player = handler->getSelectedPlayer(); - if (!player) + Player* target = handler->getSelectedPlayer(); + if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); handler->SetSentErrorMessage(true); @@ -196,7 +219,7 @@ public: } // check online security - if (handler->HasLowerSecurity(player, 0)) + if (handler->HasLowerSecurity(target, 0)) return false; // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r @@ -216,9 +239,9 @@ public: return false; } - std::string nameLink = handler->GetNameLink(player); + std::string nameLink = handler->GetNameLink(target); - Group* grp = player->GetGroup(); + Group* grp = target->GetGroup(); if (!grp) { handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); @@ -228,38 +251,38 @@ public: for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pl = itr->getSource(); + Player* player = itr->getSource(); - if (!pl || !pl->GetSession()) + if (!player || !player->GetSession()) continue; // check online security - if (handler->HasLowerSecurity(pl, 0)) + if (handler->HasLowerSecurity(player, 0)) return false; - std::string plNameLink = handler->GetNameLink(pl); + std::string plNameLink = handler->GetNameLink(player); - if (pl->IsBeingTeleported()) + if (player->IsBeingTeleported()) { handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); continue; } handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str()); - if (handler->needReportToTarget(pl)) - (ChatHandler(pl)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str()); + if (handler->needReportToTarget(player)) + (ChatHandler(player)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str()); // stop flight if need - if (pl->isInFlight()) + if (player->isInFlight()) { - pl->GetMotionMaster()->MovementExpired(); - pl->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - pl->SaveRecallPosition(); + player->SaveRecallPosition(); - pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); + player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); } return true; diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 75904764f23..ebeb7b8f4f4 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -480,55 +480,43 @@ public: } // The visual waypoint - Creature* wpCreature = NULL; wpGuid = target->GetGUIDLow(); - // Did the user select a visual spawnpoint? - if (wpGuid) - wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); - // attempt check creature existence by DB data - else - { - handler->PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, wpGuid); - return false; - } // User did select a visual waypoint? + // Check the creature - if (wpCreature->GetEntry() == VISUAL_WAYPOINT) - { - QueryResult result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); + QueryResult result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); + if (!result) + { + handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow()); + // Select waypoint number from database + // Since we compare float values, we have to deal with + // some difficulties. + // Here we search for all waypoints that only differ in one from 1 thousand + // (0.001) - There is no other way to compare C++ floats with mySQL floats + // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html + const char* maxDIFF = "0.01"; + result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)", + target->GetPositionX(), maxDIFF, target->GetPositionY(), maxDIFF, target->GetPositionZ(), maxDIFF); if (!result) { - handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow()); - // Select waypoint number from database - // Since we compare float values, we have to deal with - // some difficulties. - // Here we search for all waypoints that only differ in one from 1 thousand - // (0.001) - There is no other way to compare C++ floats with mySQL floats - // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html - const char* maxDIFF = "0.01"; - result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)", - wpCreature->GetPositionX(), maxDIFF, wpCreature->GetPositionY(), maxDIFF, wpCreature->GetPositionZ(), maxDIFF); - if (!result) - { - handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid); - return true; - } - } - - do - { - Field* fields = result->Fetch(); - pathid = fields[0].GetUInt32(); - point = fields[1].GetUInt32(); + handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid); + return true; } - while (result->NextRow()); + } - // We have the waypoint number and the GUID of the "master npc" - // Text is enclosed in "<>", all other arguments not - arg_str = strtok((char*)NULL, " "); + do + { + Field* fields = result->Fetch(); + pathid = fields[0].GetUInt32(); + point = fields[1].GetUInt32(); } + while (result->NextRow()); + + // We have the waypoint number and the GUID of the "master npc" + // Text is enclosed in "<>", all other arguments not + arg_str = strtok((char*)NULL, " "); // Check for argument if (show != "del" && show != "move" && arg_str == NULL) @@ -795,7 +783,7 @@ public: if (target) { wpCreature->SetDisplayId(target->GetDisplayId()); - wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point); } } @@ -842,7 +830,7 @@ public: if (target) { creature->SetDisplayId(target->GetDisplayId()); - creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); } return true; @@ -858,7 +846,7 @@ public: else Maxpoint = 0; - result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z FROM waypoint_data WHERE point ='%u' AND id = '%u'", Maxpoint, pathid); + result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE point ='%u' AND id = '%u'", Maxpoint, pathid); if (!result) { handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid); @@ -866,13 +854,13 @@ public: return false; } Field* fields = result->Fetch(); - float x = fields[0].GetFloat(); - float y = fields[1].GetFloat(); - float z = fields[2].GetFloat(); + float x = fields[0].GetFloat(); + float y = fields[1].GetFloat(); + float z = fields[2].GetFloat(); + float o = fields[3].GetFloat(); uint32 id = VISUAL_WAYPOINT; Player* chr = handler->GetSession()->GetPlayer(); - float o = chr->GetOrientation(); Map* map = chr->GetMap(); Creature* creature = new Creature; @@ -890,7 +878,7 @@ public: if (target) { creature->SetDisplayId(target->GetDisplayId()); - creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); } return true; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 2bcfab80056..aa0fee873e1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -136,9 +136,9 @@ public: { uint8 r = rand()%4; uint8 pos[3]; - pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0); - pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1)); - pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0) + pos[RED_PORTAL] = ((r % 2) ? (r > 1 ? 2 : 1) : 0); + pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1)); + pos[BLUE_PORTAL] = (r > 1 ? 1 : 2); // Blue Portal not on the left side (0) for (int i=0; i<3; ++i) if (Creature* portal = me->SummonCreature(PortalID[i], PortalCoord[pos[i]][0], PortalCoord[pos[i]][1], PortalCoord[pos[i]][2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000)) diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 719c42c0a57..55254a3b8ee 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -201,7 +201,8 @@ public: //object already removed, not exist if (!pAdd) { - if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) + pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (pAdd) m_auiLackeyGUID[j] = pAdd->GetGUID(); } ++j; diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp index 592e0054fa4..4bc3da16651 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp @@ -110,7 +110,7 @@ class boss_ragnaros : public CreatureScript void KilledUnit(Unit* /*victim*/) { - if (urand(0, 99 < 25)) + if (urand(0, 99) < 25) DoScriptText(SAY_KILL, me); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index aea25af87bf..18316d67cd4 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -497,9 +497,9 @@ public: SetEscortPaused(bOnHold); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 wpId) { - switch (i) + switch (wpId) { case 0: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); @@ -1173,8 +1173,8 @@ public: temp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) - temp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him + if (Creature* lktemp = Unit::GetCreature(*me, uiLichKingGUID)) + lktemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him } JumpToNextStep(1500); break; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp index a61b88a990d..a6bb95995be 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp @@ -51,7 +51,9 @@ public: phase = 0; me->GetPosition(x, y, z); - z += 4; x -= 3.5; y -= 5; + z += 4.0f; + x -= 3.5f; + y -= 5.0f; me->GetMotionMaster()->Clear(false); me->SetPosition(x, y, z, 0.0f); } @@ -78,7 +80,9 @@ public: break; case 1: player->GetClosePoint(x, y, z, me->GetObjectSize()); - z += 2.5; x -= 2; y -= 1.5; + z += 2.5f; + x -= 2.0f; + y -= 1.5f; me->GetMotionMaster()->MovePoint(0, x, y, z); me->SetTarget(player->GetGUID()); me->SetVisible(true); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 9afbeaa0172..c9ab9084d22 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -504,15 +504,14 @@ public: Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) { Map* map = me->GetMap(); - if (!map->IsDungeon()) return NULL; + if (!map->IsDungeon()) + return NULL; Map::PlayerList const &PlayerList = map->GetPlayers(); - Map::PlayerList::const_iterator i; - if (PlayerList.isEmpty()) return NULL; + if (PlayerList.isEmpty()) + return NULL; std::list<Player*> temp; - std::list<Player*>::const_iterator j; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() && me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) @@ -520,7 +519,7 @@ public: if (!temp.empty()) { - j = temp.begin(); + std::list<Player*>::const_iterator j = temp.begin(); advance(j, rand()%temp.size()); return (*j); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 3b788c72cd8..d0ea617b734 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -102,7 +102,7 @@ public: { if (m_instance) { - if (m_instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED)) + if (m_instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) != NOT_STARTED) m_instance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL); } } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 4de719d684e..4e3f3899b35 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -484,15 +484,14 @@ public: float x, y, z; me->GetPosition(x, y, z); - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(me, entry, 100); Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index b29a0c491cc..ca853d5684e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -662,11 +662,13 @@ public: { float x, y, z; Unit* target = NULL; - for (uint8 z = 0; z < 6; ++z) + for (uint8 i = 0; i < 6; ++i) { target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0))break; + if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0)) + break; } + if (target) { target->GetPosition(x, y, z); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index fd11b4a4985..7c14845f060 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -330,14 +330,14 @@ public: else { DarkFiend = false; - for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(CREATURE_DARK_FIENDS, DarkFiends[i][0], DarkFiends[i][1], DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + for (uint8 j = 0; j < 8; ++j) + me->SummonCreature(CREATURE_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0); Timer[TIMER_DARKNESS] = 42000; } break; case TIMER_HUMANOIDES: - for (uint8 i = 0; i < 6; ++i) - me->SummonCreature(uint32(Humanoides[i][0]), Humanoides[i][1], Humanoides[i][2], Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0); + for (uint8 j = 0; j < 6; ++j) + me->SummonCreature(uint32(Humanoides[j][0]), Humanoides[j][1], Humanoides[j][2], Humanoides[j][3], Humanoides[j][4], TEMPSUMMON_CORPSE_DESPAWN, 0); Timer[TIMER_HUMANOIDES] = 60000; break; case TIMER_PHASE: diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index ba2d638d45f..413897c94e8 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -189,22 +189,21 @@ class boss_akilzon : public CreatureScript for (uint8 i = 2; i < StormCount; ++i) bp0 *= 2; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Unit*> tempUnitMap; { - Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, 999); + Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, SIZE_OF_GRIDS); Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); - cell.Visit(p, world_unit_searcher, *(me->GetMap())); - cell.Visit(p, grid_unit_searcher, *(me->GetMap())); + cell.Visit(p, world_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS); + cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS); } //dealdamege for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index d2ad81b4910..aea9e322583 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -233,9 +233,8 @@ class boss_janalai : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(me, MOB_EGG, 100); @@ -243,7 +242,7 @@ class boss_janalai : public CreatureScript TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange()); } //sLog->outError("Eggs %d at middle", templist.size()); @@ -267,9 +266,8 @@ class boss_janalai : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(me, MOB_FIRE_BOMB, 100); @@ -277,7 +275,7 @@ class boss_janalai : public CreatureScript TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange()); } for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) { @@ -519,9 +517,8 @@ class mob_janalai_hatcher : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(me, 23817, 50); @@ -529,7 +526,7 @@ class mob_janalai_hatcher : public CreatureScript TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); } //sLog->outError("Eggs %d at %d", templist.size(), side); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 17968766a5f..3ff465a3c1d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -162,9 +162,8 @@ class boss_nalorakk : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllFriendlyCreaturesInGrid check(me); @@ -172,7 +171,7 @@ class boss_nalorakk : public CreatureScript TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); } if (templist.empty()) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index f70c764f306..f45c943b0f1 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -91,9 +91,9 @@ class boss_mandokir : public CreatureScript MortalStrike_Timer = 1000; Check_Timer = 1000; - targetX = 0.0; - targetY = 0.0; - targetZ = 0.0; + targetX = 0.0f; + targetY = 0.0f; + targetZ = 0.0f; TargetInRange = 0; WatchTarget = 0; diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index 10b7066068b..d02cce3f17c 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -35,91 +35,6 @@ EndContentData */ #include "ScriptedEscortAI.h" /*###### -## npc_prospector_anvilward -######*/ - -#define GOSSIP_HELLO "I need a moment of your time, sir." -#define GOSSIP_SELECT "Why... yes, of course. I've something to show you right inside this building, Mr. Anvilward." - -enum eProspectorAnvilward -{ - SAY_ANVIL1 = -1000209, - SAY_ANVIL2 = -1000210, - QUEST_THE_DWARVEN_SPY = 8483, -}; - -class npc_prospector_anvilward : public CreatureScript -{ -public: - npc_prospector_anvilward() : CreatureScript("npc_prospector_anvilward") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(8240, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->CLOSE_GOSSIP_MENU(); - if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_anvilward::npc_prospector_anvilwardAI, creature->AI())) - pEscortAI->Start(true, false, player->GetGUID()); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (player->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - player->SEND_GOSSIP_MENU(8239, creature->GetGUID()); - return true; - } - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_prospector_anvilwardAI(creature); - } - - struct npc_prospector_anvilwardAI : public npc_escortAI - { - // CreatureAI functions - npc_prospector_anvilwardAI(Creature* c) : npc_escortAI(c) {} - - // Pure Virtual Functions - void WaypointReached(uint32 i) - { - Player* player = GetPlayerForEscort(); - - if (!player) - return; - - switch (i) - { - case 0: DoScriptText(SAY_ANVIL1, me, player); break; - case 5: DoScriptText(SAY_ANVIL2, me, player); break; - case 6: me->setFaction(24); break; - } - } - - void Reset() - { - me->RestoreFaction(); - } - - void JustDied(Unit* /*killer*/) - { - me->RestoreFaction(); - } - }; - -}; - -/*###### ## Quest 9686 Second Trial ######*/ @@ -711,7 +626,6 @@ public: void AddSC_eversong_woods() { - new npc_prospector_anvilward(); new npc_second_trial_controller(); new npc_second_trial_paladin(); new go_second_trial(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 6186369a3a0..187ff9b9dd7 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -459,7 +459,9 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0]+irand(-20, 20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+irand(-20, 20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2]+irand(-10, 10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); if (creature) CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true; - }else{//summon at gate + } + else + {//summon at gate creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_GARG_GATE][0]+irand(-10, 10), SpawnPointSpecial[SPAWN_GARG_GATE][1]+irand(-10, 10), SpawnPointSpecial[SPAWN_GARG_GATE][2]+irand(-10, 10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); } break; @@ -910,6 +912,7 @@ void hyjalAI::UpdateAI(const uint32 diff) DoMeleeAttackIfReady(); } + void hyjalAI::JustDied(Unit* /*killer*/) { if (IsDummy)return; @@ -932,23 +935,20 @@ void hyjalAI::JustDied(Unit* /*killer*/) instance->SetData(DATA_RESET_RAIDDAMAGE, 0);//reset damage on die } } + void hyjalAI::HideNearPos(float x, float y) { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); // First get all creatures. std::list<Creature*> creatures; Trinity::AllFriendlyCreaturesInGrid creature_check(me); Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check); - TypeContainerVisitor - <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, - GridTypeMapContainer> creature_visitor(creature_searcher); - // Get Creatures - cell.Visit(pair, creature_visitor, *(me->GetMap())); + TypeContainerVisitor <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher); + cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange()); if (!creatures.empty()) { @@ -959,18 +959,19 @@ void hyjalAI::HideNearPos(float x, float y) } } } + void hyjalAI::RespawnNearPos(float x, float y) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::RespawnDo u_do; Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(me, u_do); TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker); - cell.Visit(p, obj_worker, *me->GetMap()); + cell.Visit(p, obj_worker, *me->GetMap(), *me, me->GetGridActivationRange()); } + void hyjalAI::WaypointReached(uint32 i) { if (i == 1 || (i == 0 && me->GetEntry() == THRALL)) @@ -992,9 +993,8 @@ void hyjalAI::WaypointReached(uint32 i) } //do some talking //all alive guards walk near here - CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); // First get all creatures. @@ -1005,7 +1005,7 @@ void hyjalAI::WaypointReached(uint32 i) <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher); - cell.Visit(pair, creature_visitor, *(me->GetMap())); + cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange()); if (!creatures.empty()) { @@ -1034,9 +1034,8 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) { if (TeleportTimer <= diff) { - CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Creature*> creatures; @@ -1046,7 +1045,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher); - cell.Visit(pair, creature_visitor, *(me->GetMap())); + cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange()); if (!creatures.empty()) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 0e5233d6620..338f320dcc2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -205,9 +205,9 @@ public: { if (i->getSource()) { - WorldPacket data(SMSG_MESSAGECHAT, 200); - unit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID()); - i->getSource()->GetSession()->SendPacket(&data); + WorldPacket packet(SMSG_MESSAGECHAT, 200); + unit->BuildMonsterChat(&packet, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID()); + i->getSource()->GetSession()->SendPacket(&packet); WorldPacket data2(SMSG_PLAY_SOUND, 4); data2 << 10986; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 02f9435db49..82f16dd7784 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -579,13 +579,16 @@ public: { //After reset case 0: - if (Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f)) - uiJainaGUID = pJaina->GetGUID(); - else if (Unit* pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000)) + { + Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f); + if (!pJaina) + pJaina = pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000); + if (pJaina) uiJainaGUID = pJaina->GetGUID(); bStepping = false; JumpToNextStep(0); break; + } //After waypoint 0 case 1: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); @@ -829,9 +832,10 @@ public: case 37: if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) { - if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f)) - pZombie->UpdateEntry(NPC_ZOMBIE, 0); - else if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f)) + Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f); + if (!pZombie) + pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f); + if (pZombie) pZombie->UpdateEntry(NPC_ZOMBIE, 0); else //There's no one else to transform uiStep++; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 4cc1069b838..43265cb4430 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -680,12 +680,8 @@ public: //Place all units in threat list on outside of stomach Stomach_Map.clear(); - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) - { - //Outside stomach - Stomach_Map[(*i)->getUnitGuid()] = false; - } + for (std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) + Stomach_Map[(*i)->getUnitGuid()] = false; //Outside stomach //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h index e19054d2f46..e19054d2f46 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp index cde97f8d37b..cde97f8d37b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp index a2371fa0121..a2371fa0121 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index bc4d4ba5eea..bc4d4ba5eea 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index b2975797a02..b2975797a02 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 9a7dc2f2cc9..9a7dc2f2cc9 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp index 5ba11dd5353..5ba11dd5353 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index dea3d6eaede..605f3a11c8a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -118,7 +118,7 @@ public: return; float x=0.0f, y=0.0f, z=0.0f; - me->GetRespawnCoord(x, y, z); + me->GetRespawnPosition(x, y, z); if (uiCheckDistanceTimer <= uiDiff) uiCheckDistanceTimer = 5*IN_MILLISECONDS; diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index 63e714d17aa..53b47884e57 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -18,23 +18,23 @@ set(scripts_STAT_SRCS Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp Northrend/Ulduar/HallsOfLightning/boss_loken.cpp - Northrend/Ulduar/ulduar/boss_general_vezax.cpp - Northrend/Ulduar/ulduar/ulduar_teleporter.cpp - Northrend/Ulduar/ulduar/boss_thorim.cpp - Northrend/Ulduar/ulduar/boss_ignis.cpp - Northrend/Ulduar/ulduar/boss_algalon.cpp - Northrend/Ulduar/ulduar/instance_ulduar.cpp - Northrend/Ulduar/ulduar/boss_auriaya.cpp - Northrend/Ulduar/ulduar/boss_yoggsaron.cpp - Northrend/Ulduar/ulduar/boss_hodir.cpp - Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp - Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp - Northrend/Ulduar/ulduar/boss_xt002.cpp - Northrend/Ulduar/ulduar/boss_mimiron.cpp - Northrend/Ulduar/ulduar/ulduar.h - Northrend/Ulduar/ulduar/boss_freya.cpp - Northrend/Ulduar/ulduar/boss_razorscale.cpp - Northrend/Ulduar/ulduar/boss_kologarn.cpp + Northrend/Ulduar/Ulduar/boss_general_vezax.cpp + Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp + Northrend/Ulduar/Ulduar/boss_thorim.cpp + Northrend/Ulduar/Ulduar/boss_ignis.cpp + Northrend/Ulduar/Ulduar/boss_algalon.cpp + Northrend/Ulduar/Ulduar/instance_ulduar.cpp + Northrend/Ulduar/Ulduar/boss_auriaya.cpp + Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp + Northrend/Ulduar/Ulduar/boss_hodir.cpp + Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp + Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp + Northrend/Ulduar/Ulduar/boss_xt002.cpp + Northrend/Ulduar/Ulduar/boss_mimiron.cpp + Northrend/Ulduar/Ulduar/ulduar.h + Northrend/Ulduar/Ulduar/boss_freya.cpp + Northrend/Ulduar/Ulduar/boss_razorscale.cpp + Northrend/Ulduar/Ulduar/boss_kologarn.cpp Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp Northrend/Ulduar/HallsOfStone/halls_of_stone.h Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -142,13 +142,13 @@ set(scripts_STAT_SRCS Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp - Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp - Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp - Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp - Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp - Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp - Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp - Northrend/AzjolNerub/ahnkahet/ahnkahet.h + Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp + Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp + Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp + Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp + Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp + Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp + Northrend/AzjolNerub/Ahnkahet/ahnkahet.h Northrend/VioletHold/boss_zuramat.cpp Northrend/VioletHold/instance_violet_hold.cpp Northrend/VioletHold/boss_lavanthor.cpp diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index 2688005ee22..a1e906e214a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -221,10 +221,9 @@ public: { uiVehicle1GUID = pBoss->GetGUID(); uint64 uiGrandChampionBoss1 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* unit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss1 = unit->GetGUID(); + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss1 = unit->GetGUID(); if (instance) { instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID); @@ -237,10 +236,9 @@ public: { uiVehicle2GUID = pBoss->GetGUID(); uint64 uiGrandChampionBoss2 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* unit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss2 = unit->GetGUID(); + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss2 = unit->GetGUID(); if (instance) { instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID); @@ -253,10 +251,9 @@ public: { uiVehicle3GUID = pBoss->GetGUID(); uint64 uiGrandChampionBoss3 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* unit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss3 = unit->GetGUID(); + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss3 = unit->GetGUID(); if (instance) { instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 1ca1c69831c..be83c4d326a 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -284,7 +284,7 @@ public: if (m_uiPenetratingColdTimer <= uiDiff) { - me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5)); + me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5)); m_uiPenetratingColdTimer = 20*IN_MILLISECONDS; } else m_uiPenetratingColdTimer -= uiDiff; @@ -577,7 +577,7 @@ public: me->SetReactState(REACT_PASSIVE); me->SetFlying(true); me->SetDisplayId(25144); - me->SetSpeed(MOVE_RUN, 0.5, false); + me->SetSpeed(MOVE_RUN, 0.5f, false); me->GetMotionMaster()->MoveRandom(20.0f); DoCast(SPELL_FROST_SPHERE); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index ec573f75bc6..df166c1bf04 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -490,11 +490,14 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) - return; - if (m_instance && m_instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS) + { me->DespawnOrUnsummon(); + return; + } + + if (!UpdateVictim()) + return; if (m_uiShivanSlashTimer <= uiDiff) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index d4514dd547e..1ee7bcb4120 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -348,10 +348,10 @@ public: m_bTargetDied = true; me->GetMotionMaster()->MoveJump(gormok->GetPositionX(), gormok->GetPositionY(), gormok->GetPositionZ(), 15.0f, 15.0f); } - else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + else if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - m_uiTargetGUID = target->GetGUID(); - me->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 15.0f, 15.0f); + m_uiTargetGUID = target2->GetGUID(); + me->GetMotionMaster()->MoveJump(target2->GetPositionX(), target2->GetPositionY(), target2->GetPositionZ(), 15.0f, 15.0f); } } } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index adbe59555b6..68223f170c5 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -114,6 +114,8 @@ struct outroPosition { { 0, 0 }, { 0.0f, 0.0f, 0.0f, 0.0f } } }; +Position const CrucibleSummonPos = {5672.294f,2520.686f, 713.4386f, 0.9599311f}; + #define DATA_THREE_FACED 1 class boss_devourer_of_souls : public CreatureScript @@ -154,6 +156,8 @@ class boss_devourer_of_souls : public CreatureScript { DoScriptText(RAND(SAY_FACE_ANGER_AGGRO, SAY_FACE_DESIRE_AGGRO), me); + if (!me->FindNearestCreature(NPC_CRUCIBLE_OF_SOULS, 60)) // Prevent double spawn + instance->instance->SummonCreature(NPC_CRUCIBLE_OF_SOULS, CrucibleSummonPos); events.ScheduleEvent(EVENT_PHANTOM_BLAST, 5000); events.ScheduleEvent(EVENT_MIRRORED_SOUL, 8000); events.ScheduleEvent(EVENT_WELL_OF_SOULS, 30000); diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h index 85062cc2901..9f34e412847 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h @@ -46,5 +46,6 @@ enum Creatures NPC_CHAMPION_3_HORDE = 37588, NPC_CHAMPION_1_ALLIANCE = 37496, NPC_CHAMPION_2_ALLIANCE = 37497, + NPC_CRUCIBLE_OF_SOULS = 37094, }; #endif diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 7e417a840f2..f2b9fb704d5 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -52,6 +52,7 @@ enum Creatures enum ConstrictorSpells { SPELL_GRIP_OF_SLAD_RAN = 55093, + SPELL_SNAKE_WRAP = 55126, SPELL_VENOMOUS_BITE = 54987, H_SPELL_VENOMOUS_BITE = 58996 }; @@ -65,6 +66,8 @@ static Position SpawnLoc[]= {1716.76f, 635.159f, 129.282f, 0.191986f} }; +#define DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES 1 + class boss_slad_ran : public CreatureScript { public: @@ -89,6 +92,7 @@ public: uint8 uiPhase; + std::set<uint64> lWrappedPlayers; SummonList lSummons; InstanceScript* instance; @@ -100,6 +104,7 @@ public: uiVenomBoltTimer = 15*IN_MILLISECONDS; uiSpawnTimer = 5*IN_MILLISECONDS; uiPhase = 0; + lWrappedPlayers.clear(); lSummons.DespawnAll(); @@ -171,6 +176,7 @@ public: void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); + lSummons.DespawnAll(); if (instance) instance->SetData(DATA_SLAD_RAN_EVENT, DONE); @@ -186,6 +192,17 @@ public: summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); lSummons.Summon(summoned); } + + void SetGUID(uint64 guid, int32 type) + { + if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES) + lWrappedPlayers.insert(guid); + } + + bool WasWrapped(uint64 guid) + { + return lWrappedPlayers.count(guid); + } }; }; @@ -215,10 +232,26 @@ public: { if (!UpdateVictim()) return; + if (uiGripOfSladRanTimer <= diff) { - DoCast(me->getVictim(), SPELL_GRIP_OF_SLAD_RAN); - uiGripOfSladRanTimer = 5*IN_MILLISECONDS; + Unit* target = me->getVictim(); + + DoCast(target, SPELL_GRIP_OF_SLAD_RAN); + uiGripOfSladRanTimer = urand(3, 6)*IN_MILLISECONDS; + + Aura* grip = target->GetAura(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID()); + if (grip && grip->GetStackAmount() == 5) + { + target->RemoveAurasDueToSpell(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID()); + target->CastSpell(target, SPELL_SNAKE_WRAP, true); + + if (TempSummon* _me = me->ToTempSummon()) + if (Creature* sladran = _me->GetSummoner()->ToCreature()) + sladran->AI()->SetGUID(target->GetGUID() ,DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES); + + me->DespawnOrUnsummon(); + } } else uiGripOfSladRanTimer -= diff; } @@ -265,9 +298,28 @@ public: }; +class achievement_snakes_whyd_it_have_to_be_snakes : public AchievementCriteriaScript +{ + public: + achievement_snakes_whyd_it_have_to_be_snakes() : AchievementCriteriaScript("achievement_snakes_whyd_it_have_to_be_snakes") + { + } + + bool OnCheck(Player* player, Unit* target) + { + if (!target) + return false; + + if (boss_slad_ran::boss_slad_ranAI* sladRanAI = CAST_AI(boss_slad_ran::boss_slad_ranAI, target->GetAI())) + return !sladRanAI->WasWrapped(player->GetGUID()); + return false; + } +}; + void AddSC_boss_slad_ran() { new boss_slad_ran(); new mob_slad_ran_constrictor(); new mob_slad_ran_viper(); -} + new achievement_snakes_whyd_it_have_to_be_snakes(); +}
\ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index b117dadf045..fd693789064 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -291,6 +291,10 @@ class npc_stinky_icc : public CreatureScript _events.Reset(); _events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); _events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(3000, 7000)); + } + + void EnterCombat(Unit* /*target*/) + { DoCast(me, SPELL_PLAGUE_STENCH); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 9e4079a7a15..ae6f3feb57f 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -375,7 +375,7 @@ class boss_lady_deathwhisper : public CreatureScript { me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); - events.ScheduleEvent(EVENT_P2_SUMMON_WAVE, urand(30000, 60000), 0, PHASE_TWO); + events.ScheduleEvent(EVENT_P2_SUMMON_WAVE, 45000, 0, PHASE_TWO); } } } @@ -438,7 +438,7 @@ class boss_lady_deathwhisper : public CreatureScript case EVENT_DEATH_AND_DECAY: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) DoCast(target, SPELL_DEATH_AND_DECAY); - events.ScheduleEvent(EVENT_DEATH_AND_DECAY, urand(10000, 12000)); + events.ScheduleEvent(EVENT_DEATH_AND_DECAY, urand(22000, 30000)); break; case EVENT_DOMINATE_MIND_H: Talk(SAY_DOMINATE_MIND); @@ -449,7 +449,7 @@ class boss_lady_deathwhisper : public CreatureScript break; case EVENT_P1_SUMMON_WAVE: SummonWaveP1(); - events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, 60000, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, IsHeroic() ? 45000 : 60000, 0, PHASE_ONE); break; case EVENT_P1_SHADOW_BOLT: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) @@ -485,7 +485,7 @@ class boss_lady_deathwhisper : public CreatureScript break; case EVENT_P2_SUMMON_WAVE: SummonWaveP2(); - events.ScheduleEvent(EVENT_P2_SUMMON_WAVE, 60000, 0, PHASE_TWO); + events.ScheduleEvent(EVENT_P2_SUMMON_WAVE, 45000, 0, PHASE_TWO); break; case EVENT_BERSERK: DoCast(me, SPELL_BERSERK); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index dca53f1a5e7..29c3276467b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -242,6 +242,9 @@ class boss_sindragosa : public CreatureScript { if (action == ACTION_START_FROSTWYRM) { + if (TempSummon* summon = me->ToTempSummon()) + summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN); + instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 255); if (me->isDead()) return; @@ -968,10 +971,10 @@ class spell_sindragosa_s_fury : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()->isAlive()) + if (!GetHitUnit()->isAlive() || !_targetCount) return; - float resistance = float(GetHitUnit()->GetResistance(GetFirstSchoolInMask(SpellSchoolMask(GetSpellInfo()->SchoolMask)))); + float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask))); uint32 minResistFactor = uint32((resistance / (resistance + 510.0f))* 10.0f) * 2; uint32 randomResist = urand(0, (9 - minResistFactor) * 100)/100 + minResistFactor; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 1688624be91..2f4f225561c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -1227,7 +1227,7 @@ class npc_tirion_fordring_tft : public CreatureScript SetEquipmentSlots(true); // remove glow on ashbringer } - void sGossipSelect(Player* player, uint32 sender, uint32 action) + void sGossipSelect(Player* /*player*/, uint32 sender, uint32 action) { if (me->GetCreatureInfo()->GossipMenuId == sender && !action) { @@ -1335,7 +1335,7 @@ class npc_shambling_horror_icc : public CreatureScript void DamageTaken(Unit* /*attacker*/, uint32& damage) { - if (IsHeroic() && me->HealthBelowPctDamaged(20, damage)) + if (!_frenzied && IsHeroic() && me->HealthBelowPctDamaged(20, damage)) { _frenzied = true; DoCast(me, SPELL_FRENZY, true); @@ -1407,14 +1407,14 @@ class npc_raging_spirit : public CreatureScript DoCast(me, SPELL_BOSS_HITTIN_YA, true); } - void IsSummonedBy(Unit* summoner) + void IsSummonedBy(Unit* /*summoner*/) { // player is the spellcaster so register summon manually if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) lichKing->AI()->JustSummoned(me); } - void JustDied(Unit* killer) + void JustDied(Unit* /*killer*/) { if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) lichKing->AI()->SummonedCreatureDespawn(me); @@ -1931,7 +1931,7 @@ class npc_spirit_bomb : public CreatureScript { } - void IsSummonedBy(Unit* summoner) + void IsSummonedBy(Unit* /*summoner*/) { float destX, destY, destZ; me->GetPosition(destX, destY); @@ -1954,7 +1954,7 @@ class npc_spirit_bomb : public CreatureScript { } - void UpdateAI(uint32 const diff) + void UpdateAI(uint32 const /*diff*/) { UpdateVictim(); // no melee attacks @@ -1983,7 +1983,7 @@ class npc_broken_frostmourne : public CreatureScript _events.Reset(); } - void IsSummonedBy(Unit* summoner) + void IsSummonedBy(Unit* /*summoner*/) { _events.SetPhase(PHASE_OUTRO); _events.ScheduleEvent(EVENT_OUTRO_KNOCK_BACK, 3000, 0, PHASE_OUTRO); @@ -2087,7 +2087,6 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* newCaster = GetTarget(); switch (GetTargetApplication()->GetRemoveMode()) { case AURA_REMOVE_BY_ENEMY_SPELL: @@ -2250,7 +2249,7 @@ class spell_the_lich_king_shadow_trap_visual : public SpellScriptLoader { PrepareAuraScript(spell_the_lich_king_shadow_trap_visual_AuraScript); - void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_TRAP_AURA, TRIGGERED_NONE); @@ -2633,7 +2632,7 @@ class spell_the_lich_king_cast_back_to_caster : public SpellScriptLoader { PrepareSpellScript(spell_the_lich_king_cast_back_to_caster_SpellScript); - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 9c3c9156d63..96c061f4c98 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -683,7 +683,7 @@ public: // Note: summon must be done by trigger and not by KT. // Otherwise, they attack immediately as KT is in combat. - for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i) + for (uint8 i = 0; i < MAX_ABOMINATIONS; ++i) { if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i])) { @@ -692,7 +692,7 @@ public: sum->SetReactState(REACT_DEFENSIVE); } } - for (uint8 i = 0; i <= MAX_WASTES; ++i) + for (uint8 i = 0; i < MAX_WASTES; ++i) { if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i])) { @@ -701,7 +701,7 @@ public: sum->SetReactState(REACT_DEFENSIVE); } } - for (uint8 i = 0; i <= MAX_WEAVERS; ++i) + for (uint8 i = 0; i < MAX_WEAVERS; ++i) { if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i])) { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index 10f1b809694..3b87dea025c 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -91,7 +91,7 @@ public: _EnterCombat(); Enraged = false; DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me); - events.ScheduleEvent(EVENT_HATEFUL, 1200); + events.ScheduleEvent(EVENT_HATEFUL, 1000); events.ScheduleEvent(EVENT_BERSERK, 360000); if (instance) @@ -131,7 +131,7 @@ public: DoCast(pMostHPTarget, RAID_MODE(SPELL_HATEFUL_STRIKE, H_SPELL_HATEFUL_STRIKE), true); - events.ScheduleEvent(EVENT_HATEFUL, 1200); + events.ScheduleEvent(EVENT_HATEFUL, 1000); break; } case EVENT_BERSERK: @@ -140,7 +140,7 @@ public: events.ScheduleEvent(EVENT_SLIME, 2000); break; case EVENT_SLIME: - DoCast(me->getVictim(), SPELL_SLIME_BOLT); + DoCast(me->getVictim(), SPELL_SLIME_BOLT, true); events.ScheduleEvent(EVENT_SLIME, 2000); break; } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index d620289a72f..ed1bbd1971a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -271,14 +271,18 @@ public: break; } case EVENT_FLIGHT: - phase = PHASE_FLIGHT; - events.SetPhase(PHASE_FLIGHT); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(1, x, y, z); - return; + if (HealthAbovePct(10)) + { + phase = PHASE_FLIGHT; + events.SetPhase(PHASE_FLIGHT); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(1, x, y, z); + return; + } + break; } } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp index 3888cc43bc9..3888cc43bc9 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp index 2e2ca25385c..a8a4fad5e4e 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp @@ -56,8 +56,9 @@ enum AssemblySpells SPELL_CHAIN_LIGHTNING = 61879, SPELL_OVERLOAD = 61869, SPELL_LIGHTNING_WHIRL = 61915, - SPELL_LIGHTNING_TENDRILS = 61887, - SPELL_LIGHTNING_TENDRILS_SELF_VISUAL = 61883, + SPELL_LIGHTNING_TENDRILS_10M = 61887, + SPELL_LIGHTNING_TENDRILS_25M = 63486, + SPELL_LIGHTNING_TENDRILS_VISUAL = 61883, SPELL_STORMSHIELD = 64187, }; @@ -215,7 +216,6 @@ class boss_steelbreaker : public CreatureScript { _Reset(); phase = 0; - me->ResetLootMode(); me->RemoveAllAuras(); RespawnEncounter(instance, me); } @@ -342,7 +342,6 @@ class boss_runemaster_molgeim : public CreatureScript { _Reset(); phase = 0; - me->ResetLootMode(); me->RemoveAllAuras(); RespawnEncounter(instance, me); } @@ -575,9 +574,10 @@ class boss_stormcaller_brundir : public CreatureScript { _Reset(); phase = 0; - me->ResetLootMode(); me->RemoveAllAuras(); me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false); // Should be interruptable unless overridden by spell (Overload) + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default RespawnEncounter(instance, me); } @@ -609,6 +609,7 @@ class boss_stormcaller_brundir : public CreatureScript { DoCast(me, SPELL_STORMSHIELD); events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(50000, 60000)); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); // Apply immumity to stuns } break; @@ -677,10 +678,10 @@ class boss_stormcaller_brundir : public CreatureScript break; case EVENT_LIGHTNING_TENDRILS: DoScriptText(SAY_BRUNDIR_FLIGHT, me); - DoCast(SPELL_LIGHTNING_TENDRILS); + DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M)); + DoCast(SPELL_LIGHTNING_TENDRILS_VISUAL); me->AttackStop(); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - DoCast(SPELL_LIGHTNING_TENDRILS_SELF_VISUAL); + //me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->GetMotionMaster()->Initialize(); me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FINAL_FLIGHT_Z); events.DelayEvents(35000); @@ -707,11 +708,12 @@ class boss_stormcaller_brundir : public CreatureScript events.ScheduleEvent(EVENT_GROUND, 2500); break; case EVENT_GROUND: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS); - me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_SELF_VISUAL); + //me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->RemoveAurasDueToSpell(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M)); + me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_VISUAL); DoStartMovement(me->getVictim()); events.CancelEvent(EVENT_GROUND); + me->getThreatManager().resetAllAggro(); break; case EVENT_MOVE_POSITION: if (me->IsWithinMeleeRange(me->getVictim())) diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index bcc417c50cd..bcc417c50cd 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index ad79d1b56cc..ad79d1b56cc 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index f5a87431550..e7d8b070e53 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -282,7 +282,6 @@ class boss_freya : public CreatureScript uint32 deforestation[6][2]; uint32 elementalTimer[2]; uint32 diffTimer; - uint32 waveTime; uint8 trioWaveCount; uint8 trioWaveController; uint8 waveCount; @@ -291,14 +290,12 @@ class boss_freya : public CreatureScript bool checkElementalAlive[2]; bool trioDefeated[2]; - bool waveInProgress; bool random[3]; void Reset() { _Reset(); summons.clear(); - waveTime = 0; trioWaveCount = 0; trioWaveController = 0; waveCount = 0; @@ -315,7 +312,6 @@ class boss_freya : public CreatureScript checkElementalAlive[n] = true; trioDefeated[n] = false; } - waveInProgress = false; for (uint8 n = 0; n < 3; ++n) random[n] = false; } @@ -325,35 +321,12 @@ class boss_freya : public CreatureScript DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void DamageTaken(Unit* /*who*/, uint32& damage) + void DamageTaken(Unit* who, uint32& damage) { if (damage >= me->GetHealth()) { damage = 0; - DoScriptText(SAY_DEATH, me); - me->SetReactState(REACT_PASSIVE); - _JustDied(); - me->RemoveAllAuras(); - me->AttackStop(); - me->setFaction(35); - me->DeleteThreatList(); - me->CombatStop(true); - me->DespawnOrUnsummon(7500); - me->CastSpell(me, SPELL_KNOCK_ON_WOOD_CREDIT, true); - - Creature* Elder[3]; - for (uint8 n = 0; n < 3; ++n) - { - Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF + n)); - if (Elder[n] && Elder[n]->isAlive()) - { - Elder[n]->RemoveAllAuras(); - Elder[n]->AttackStop(); - Elder[n]->CombatStop(true); - Elder[n]->DeleteThreatList(); - Elder[n]->GetAI()->DoAction(ACTION_ELDER_FREYA_KILLED); - } - } + JustDied(who); } } @@ -462,8 +435,6 @@ class boss_freya : public CreatureScript events.ScheduleEvent(EVENT_UNSTABLE_ENERGY, urand(15000, 20000)); break; case EVENT_WAVE: - waveTime = 0; - waveInProgress = true; SpawnWave(); if (waveCount < 6) events.ScheduleEvent(EVENT_WAVE, WAVE_TIME); @@ -497,9 +468,6 @@ class boss_freya : public CreatureScript diffTimer += diff; // For getting time difference for Deforestation achievement - if (waveInProgress) - waveTime += diff; // Time from the last wave - // Elementals must be killed within 12 seconds of each other, or they will all revive and heal Creature* Elemental[3][2]; for (uint8 i = 0; i < 2; ++i) @@ -543,7 +511,6 @@ class boss_freya : public CreatureScript trioDefeated[i] = true; Elemental[n][i]->CastSpell(me, SPELL_REMOVE_10STACK, true); } - TimeCheck(); } } } @@ -633,9 +600,32 @@ class boss_freya : public CreatureScript /* 25N */ {62952, 62954, 62956, 62958} }; - who->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficulty()][elderCount], true); + me->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficulty()][elderCount], true); + DoScriptText(SAY_DEATH, me); + me->SetReactState(REACT_PASSIVE); _JustDied(); + me->RemoveAllAuras(); + me->AttackStop(); + me->setFaction(35); + me->DeleteThreatList(); + me->CombatStop(true); + me->DespawnOrUnsummon(7500); + me->CastSpell(me, SPELL_KNOCK_ON_WOOD_CREDIT, true); + + Creature* Elder[3]; + for (uint8 n = 0; n < 3; ++n) + { + Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF + n)); + if (Elder[n] && Elder[n]->isAlive()) + { + Elder[n]->RemoveAllAuras(); + Elder[n]->AttackStop(); + Elder[n]->CombatStop(true); + Elder[n]->DeleteThreatList(); + Elder[n]->GetAI()->DoAction(ACTION_ELDER_FREYA_KILLED); + } + } } void JustSummoned(Creature* summoned) @@ -653,6 +643,7 @@ class boss_freya : public CreatureScript break; case NPC_DETONATING_LASHER: case NPC_ANCIENT_CONSERVATOR: + default: summons.push_back(summoned->GetGUID()); break; } @@ -675,29 +666,14 @@ class boss_freya : public CreatureScript summoned->CastSpell(who, SPELL_DETONATE, true); summoned->ForcedDespawn(5000); summons.remove(summoned->GetGUID()); - TimeCheck(); break; case NPC_ANCIENT_CONSERVATOR: summoned->CastSpell(me, SPELL_REMOVE_25STACK, true); summoned->ForcedDespawn(5000); summons.remove(summoned->GetGUID()); - TimeCheck(); break; } } - - void TimeCheck() - { - if (waveCount >= 6) - return; - - waveInProgress = false; - uint32 timeDifference = WAVE_TIME - waveTime; - if (timeDifference <= TIME_DIFFERENCE) - events.RescheduleEvent(EVENT_WAVE, timeDifference); - else - events.RescheduleEvent(EVENT_WAVE, TIME_DIFFERENCE); - } }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 7d00c0e59fc..7d00c0e59fc 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index bb21da94bc5..bb21da94bc5 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index b8876ae577a..b8876ae577a 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 5da1c485986..5da1c485986 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index 11b7c54975e..11b7c54975e 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index 0e3a8926203..0e3a8926203 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index f993c419b8c..f993c419b8c 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index ae803b24642..ae803b24642 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index e4b21e1f66e..e4b21e1f66e 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 3c5697a7995..3c5697a7995 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index f11212d535e..f11212d535e 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp index 05b1e395d1e..05b1e395d1e 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 55211f3f047..dc2d34326a7 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -130,7 +130,7 @@ public: me->SetHealth(0); me->InterruptNonMeleeSpells(true); me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->GetMotionMaster()->MovementExpired(false); me->GetMotionMaster()->MoveIdle(); me->SetStandState(UNIT_STAND_STATE_DEAD); @@ -152,7 +152,7 @@ public: { bIsUndead = true; bEventInProgress = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->UpdateEntry(MOB_INGVAR_UNDEAD); me->SetInCombatWith(me->getVictim()); me->GetMotionMaster()->MoveChase(me->getVictim()); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 1b70de6244e..45534824860 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -48,7 +48,7 @@ enum Yells }; enum Creatures { - CREATURE_ARTHAS = 24266, // Image of Arthas + CREATURE_ARTHAS = 29280, // Image of Arthas CREATURE_SVALA_SORROWGRAVE = 26668, // Svala after transformation CREATURE_SVALA = 29281, // Svala before transformation CREATURE_RITUAL_CHANNELER = 27281 @@ -136,7 +136,6 @@ public: if (Creature* pArthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) { pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - pArthas->SetFloatValue(OBJECT_FIELD_SCALE_X, 5); uiArthasGUID = pArthas->GetGUID(); } } diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index 9c40fbb3f82..96f1cb49b84 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -2125,7 +2125,7 @@ public: { Quest const* qInfo = sObjectMgr->GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); if (qInfo) - CAST_PLR(killer)->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0], 0); + CAST_PLR(killer)->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0); } } }; diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index be9e9308f4f..8ff5a314dcc 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -70,8 +70,9 @@ public: return; Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself(); - - if (!player || player->isGameMaster() || player->IsBeingTeleported()) + + // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass + if (!player || player->isGameMaster() || player->IsBeingTeleported() || player->HasAura(70973) || player->HasAura(70971)) return; switch (me->GetEntry()) diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index b3f1fb1b8b0..6f9481ec226 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -98,8 +98,7 @@ public: me->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); break; case 28: - if (Player* player = GetPlayerForEscort()) - player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me); + player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me); // me->RestoreFaction(); DoScriptText(SAY_END_IRO, me); SetRun(false); diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index 5dab265617e..aa3b696f5fd 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -1219,9 +1219,9 @@ public: { if (uiMissleTimer <= uiDiff) { - DoCast(me, uiSpell); // this spell is not supported ... YET! + if (uiSpell) // Sometimes it is 0, why? + DoCast(me, uiSpell); // this spell (what spell) is not supported ... YET! uiMissleTimer = urand(2000, 7000); - } else uiMissleTimer -= uiDiff; } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index c081f0970f2..9b0a4a469ae 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -384,7 +384,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO int32 count = 10; uint32 itemid = 24538; // bomb id count - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount); if (msg != EQUIP_ERR_OK) // convert to possible store amount count -= noSpaceForCount; diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 7b0c8fc017e..a9f84016a04 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -193,7 +193,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!HasTaunted && me->IsWithinDistInMap(who, 150.0)) + if (!HasTaunted && me->IsWithinDistInMap(who, 150.0f)) { DoScriptText(SAY_INTRO, me); HasTaunted = true; 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 ce1f8739493..58585d0028e 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -641,7 +641,7 @@ public: void EnterCombat(Unit* /*who*/) {} - void BeginEvent(Player* pl) + void BeginEvent(Player* player) { if (!instance) return; @@ -662,7 +662,7 @@ public: me->CombatStart(Shade); Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); Shade->SetTarget(me->GetGUID()); - if (pl) Shade->AddThreat(pl, 1.0f); + if (player) Shade->AddThreat(player, 1.0f); DoZoneInCombat(Shade); EventBegun = true; } diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 1f603699060..6bf26e795ca 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -94,7 +94,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(rand()%2 ? SAY_SLAY1 : SAY_SLAY2, me); + DoScriptText(urand(0, 1) ? SAY_SLAY1 : SAY_SLAY2, me); events.DelayEvents(5000, GCD_YELL); } @@ -175,7 +175,7 @@ public: SpineTargetGUID = target->GetGUID(); //must let target summon, otherwise you cannot click the spine target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30); - DoScriptText(rand()%2 ? SAY_NEEDLE1 : SAY_NEEDLE2, me); + DoScriptText(urand(0, 1) ? SAY_NEEDLE1 : SAY_NEEDLE2, me); events.DelayEvents(1500, GCD_CAST); events.DelayEvents(15000, GCD_YELL); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index f69aa1f0757..f8ed96632df 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -234,7 +234,7 @@ public: { me->MonsterTextEmote(EMOTE_SPOUT, 0, true); me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRotate(20000, rand()%2 ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); + me->GetMotionMaster()->MoveRotate(20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); SpoutTimer = 45000; WhirlTimer = 20000;//whirl directly after spout RotTimer = 20000; diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index b639050320c..c556253ecf1 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -19,330 +19,20 @@ /* ScriptData SDName: Nagrand SD%Complete: 90 -SDComment: Quest support: 9849, 9868, 9918, 9874, 9991, 10107, 10108, 10044, 10172, 10646, 10085, 10987. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text) +SDComment: Quest support: 9868, 9874, 10044, 10172, 10085. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text) SDCategory: Nagrand EndScriptData */ /* ContentData -mob_shattered_rumbler -mob_lump -npc_altruis_the_sufferer npc_greatmother_geyah -npc_lantresor_of_the_blade npc_maghar_captive npc_creditmarker_visit_with_ancestors -mob_sparrowhawk EndContentData */ #include "ScriptPCH.h" #include "ScriptedEscortAI.h" /*###### -## mob_shattered_rumbler - this should be done with ACID -######*/ - -class mob_shattered_rumbler : public CreatureScript -{ -public: - mob_shattered_rumbler() : CreatureScript("mob_shattered_rumbler") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_shattered_rumblerAI (creature); - } - - struct mob_shattered_rumblerAI : public ScriptedAI - { - bool Spawn; - - mob_shattered_rumblerAI(Creature* c) : ScriptedAI(c) {} - - void Reset() - { - Spawn = false; - } - - void EnterCombat(Unit* /*who*/) {} - - void SpellHit(Unit* Hitter, const SpellInfo* Spellkind) - { - if (Spellkind->Id == 32001 && !Spawn) - { - float x = me->GetPositionX(); - float y = me->GetPositionY(); - float z = me->GetPositionZ(); - - Hitter->SummonCreature(18181, x+(0.7f * (rand()%30)), y+(rand()%5), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); - Hitter->SummonCreature(18181, x+(rand()%5), y-(rand()%5), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); - Hitter->SummonCreature(18181, x-(rand()%5), y+(0.5f *(rand()%60)), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); - me->setDeathState(CORPSE); - Spawn = true; - } - return; - } - }; - -}; - -/*###### -## mob_lump -######*/ - -#define SPELL_VISUAL_SLEEP 16093 -#define SPELL_SPEAR_THROW 32248 - -#define LUMP_SAY0 -1000190 -#define LUMP_SAY1 -1000191 - -#define LUMP_DEFEAT -1000192 - -#define GOSSIP_HL "I need answers, ogre!" -#define GOSSIP_SL1 "Why are Boulderfist out this far? You know that this is Kurenai territory." -#define GOSSIP_SL2 "And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar." -#define GOSSIP_SL3 "This means war, Lump! War I say!" - -class mob_lump : public CreatureScript -{ -public: - mob_lump() : CreatureScript("mob_lump") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(9353, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(9354, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(9355, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->SEND_GOSSIP_MENU(9356, creature->GetGUID()); - player->TalkedToCreature(18354, creature->GetGUID()); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (player->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - player->SEND_GOSSIP_MENU(9352, creature->GetGUID()); - - return true; - } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_lumpAI(creature); - } - - struct mob_lumpAI : public ScriptedAI - { - mob_lumpAI(Creature* c) : ScriptedAI(c) - { - bReset = false; - } - - uint32 Reset_Timer; - uint32 Spear_Throw_Timer; - bool bReset; - - void Reset() - { - Reset_Timer = 60000; - Spear_Throw_Timer = 2000; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit* done_by, uint32 & damage) - { - if (done_by->GetTypeId() == TYPEID_PLAYER && me->HealthBelowPctDamaged(30, damage)) - { - if (!bReset && CAST_PLR(done_by)->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) - { - //Take 0 damage - damage = 0; - - CAST_PLR(done_by)->AttackStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->setFaction(1080); //friendly - me->SetStandState(UNIT_STAND_STATE_SIT); - DoScriptText(LUMP_DEFEAT, me); - - bReset = true; - } - } - } - - void EnterCombat(Unit* /*who*/) - { - if (me->HasAura(SPELL_VISUAL_SLEEP)) - me->RemoveAura(SPELL_VISUAL_SLEEP); - - if (!me->IsStandState()) - me->SetStandState(UNIT_STAND_STATE_STAND); - - DoScriptText(RAND(LUMP_SAY0, LUMP_SAY1), me); - } - - void UpdateAI(const uint32 diff) - { - //check if we waiting for a reset - if (bReset) - { - if (Reset_Timer <= diff) - { - EnterEvadeMode(); - bReset = false; - me->setFaction(1711); //hostile - return; - } - else Reset_Timer -= diff; - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - //Spear_Throw_Timer - if (Spear_Throw_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SPEAR_THROW); - Spear_Throw_Timer = 20000; - } else Spear_Throw_Timer -= diff; - - DoMeleeAttackIfReady(); - } - }; - -}; - -/*###### -## npc_altruis_the_sufferer -######*/ - -#define GOSSIP_HATS1 "I see twisted steel and smell sundered earth." -#define GOSSIP_HATS2 "Well...?" -#define GOSSIP_HATS3 "[PH] Story about Illidan's Pupil" - -#define GOSSIP_SATS1 "Legion?" -#define GOSSIP_SATS2 "And now?" -#define GOSSIP_SATS3 "How do you see them now?" -#define GOSSIP_SATS4 "Forge camps?" -#define GOSSIP_SATS5 "Ok." -#define GOSSIP_SATS6 "[PH] Story done" - -class npc_altruis_the_sufferer : public CreatureScript -{ -public: - npc_altruis_the_sufferer() : CreatureScript("npc_altruis_the_sufferer") { } - - bool OnQuestAccept(Player* player, Creature* /*creature*/, Quest const* /*quest*/) - { - if (!player->GetQuestRewardStatus(9991)) //Survey the Land, q-id 9991 - { - player->CLOSE_GOSSIP_MENU(); - player->ActivateTaxiPathTo(532); //TaxiPath 532 - } - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+10: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - player->SEND_GOSSIP_MENU(9420, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - player->SEND_GOSSIP_MENU(9421, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+12: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - player->SEND_GOSSIP_MENU(9422, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+13: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - player->SEND_GOSSIP_MENU(9423, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+14: - player->SEND_GOSSIP_MENU(9424, creature->GetGUID()); - break; - - case GOSSIP_ACTION_INFO_DEF+20: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - player->SEND_GOSSIP_MENU(9427, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+21: - player->CLOSE_GOSSIP_MENU(); - player->AreaExploredOrEventHappens(9991); - break; - - case GOSSIP_ACTION_INFO_DEF+30: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31); - player->SEND_GOSSIP_MENU(384, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+31: - player->CLOSE_GOSSIP_MENU(); - player->AreaExploredOrEventHappens(10646); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - //gossip before obtaining Survey the Land - if (player->GetQuestStatus(9991) == QUEST_STATUS_NONE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10); - - //gossip when Survey the Land is incomplete (technically, after the flight) - if (player->GetQuestStatus(9991) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); - - //wowwiki.com/Varedis - if (player->GetQuestStatus(10646) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+30); - - player->SEND_GOSSIP_MENU(9419, creature->GetGUID()); - - return true; - } - -}; - -/*###### ## npc_greatmother_geyah ######*/ @@ -453,83 +143,6 @@ public: }; -/*###### -## npc_lantresor_of_the_blade -######*/ - -#define GOSSIP_HLB "I have killed many of your ogres, Lantresor. I have no fear." -#define GOSSIP_SLB1 "Should I know? You look like an orc to me." -#define GOSSIP_SLB2 "And the other half?" -#define GOSSIP_SLB3 "I have heard of your kind, but I never thought to see the day when I would meet a half-breed." -#define GOSSIP_SLB4 "My apologies. I did not mean to offend. I am here on behalf of my people." -#define GOSSIP_SLB5 "My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces." -#define GOSSIP_SLB6 "We will fight you until the end, then, Lantresor. We will not stand idly by as you pillage our towns and kill our people." -#define GOSSIP_SLB7 "What do I need to do?" - -class npc_lantresor_of_the_blade : public CreatureScript -{ -public: - npc_lantresor_of_the_blade() : CreatureScript("npc_lantresor_of_the_blade") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(9362, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(9363, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(9364, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->SEND_GOSSIP_MENU(9365, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - player->SEND_GOSSIP_MENU(9366, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->SEND_GOSSIP_MENU(9367, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - player->SEND_GOSSIP_MENU(9368, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - player->SEND_GOSSIP_MENU(9369, creature->GetGUID()); - if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE) - player->AreaExploredOrEventHappens(10107); - if (player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) - player->AreaExploredOrEventHappens(10108); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HLB, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - player->SEND_GOSSIP_MENU(9361, creature->GetGUID()); - - return true; - } - -}; - /*##### ## npc_maghar_captive #####*/ @@ -747,113 +360,9 @@ public: }; /*###### -## mob_sparrowhawk +## go_corkis_prison and npc_corki ######*/ -#define SPELL_SPARROWHAWK_NET 39810 -#define SPELL_ITEM_CAPTIVE_SPARROWHAWK 39812 - -class mob_sparrowhawk : public CreatureScript -{ -public: - mob_sparrowhawk() : CreatureScript("mob_sparrowhawk") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_sparrowhawkAI (creature); - } - - struct mob_sparrowhawkAI : public ScriptedAI - { - - mob_sparrowhawkAI(Creature* c) : ScriptedAI(c) {} - - uint32 Check_Timer; - uint64 PlayerGUID; - bool fleeing; - - void Reset() - { - me->RemoveAurasDueToSpell(SPELL_SPARROWHAWK_NET); - Check_Timer = 1000; - PlayerGUID = 0; - fleeing = false; - } - void AttackStart(Unit* who) - { - if (PlayerGUID) - return; - - ScriptedAI::AttackStart(who); - } - - void EnterCombat(Unit* /*who*/) {} - - void MoveInLineOfSight(Unit* who) - { - if (!who || PlayerGUID) - return; - - if (!PlayerGUID && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 30) && CAST_PLR(who)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) - { - PlayerGUID = who->GetGUID(); - return; - } - - ScriptedAI::MoveInLineOfSight(who); - } - - void UpdateAI(const uint32 diff) - { - if (Check_Timer <= diff) - { - if (PlayerGUID) - { - if (fleeing && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE) - fleeing = false; - - Player* player = Unit::GetPlayer(*me, PlayerGUID); - if (player && me->IsWithinDistInMap(player, 30)) - { - if (!fleeing) - { - me->DeleteThreatList(); - me->GetMotionMaster()->MoveFleeing(player); - fleeing = true; - } - } - else if (fleeing) - { - me->GetMotionMaster()->MovementExpired(false); - PlayerGUID = 0; - fleeing = false; - } - } - Check_Timer = 1000; - } else Check_Timer -= diff; - - if (PlayerGUID) - return; - - ScriptedAI::UpdateAI(diff); - } - - void SpellHit(Unit* caster, const SpellInfo* spell) - { - if (caster->GetTypeId() == TYPEID_PLAYER) - { - if (spell->Id == SPELL_SPARROWHAWK_NET && CAST_PLR(caster)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) - { - DoCast(caster, SPELL_ITEM_CAPTIVE_SPARROWHAWK, true); - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - } - return; - } - }; -}; - enum CorkiData { // first quest @@ -916,10 +425,6 @@ public: } }; -/*###### -## npc_corki -######*/ - class npc_corki : public CreatureScript { public: @@ -970,16 +475,237 @@ public: }; }; +/*##### +## npc_kurenai_captive +#####*/ + +enum KurenaiCaptive +{ + SAY_KUR_START = 0, + SAY_KUR_NO_ESCAPE = 1, + SAY_KUR_MORE = 2, + SAY_KUR_MORE_TWO = 3, + SAY_KUR_LIGHTNING = 4, + SAY_KUR_SHOCK = 5, + SAY_KUR_COMPLETE = 6, + + SPELL_KUR_CHAIN_LIGHTNING = 16006, + SPELL_KUR_EARTHBIND_TOTEM = 15786, + SPELL_KUR_FROST_SHOCK = 12548, + SPELL_KUR_HEALING_WAVE = 12491, + + QUEST_TOTEM_KARDASH_A = 9879, + + NPC_KUR_MURK_RAIDER = 18203, + NPC_KUR_MURK_BRUTE = 18211, + NPC_KUR_MURK_SCAVENGER = 18207, + NPC_KUR_MURK_PUTRIFIER = 18202, +}; + +static float kurenaiAmbushA[]= {-1568.805786f, 8533.873047f, 1.958f}; +static float kurenaiAmbushB[]= {-1491.554321f, 8506.483398f, 1.248f}; + +class npc_kurenai_captive : public CreatureScript +{ +public: + npc_kurenai_captive() : CreatureScript("npc_kurenai_captive") { } + + bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) + { + if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_A) + { + if (npc_kurenai_captiveAI* EscortAI = dynamic_cast<npc_kurenai_captiveAI*>(creature->AI())) + { + creature->SetStandState(UNIT_STAND_STATE_STAND); + EscortAI->Start(true, false, player->GetGUID(), quest); + DoScriptText(SAY_KUR_START, creature); + + creature->SummonCreature(NPC_KUR_MURK_RAIDER, kurenaiAmbushA[0]+2.5f, kurenaiAmbushA[1]-2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + creature->SummonCreature(NPC_KUR_MURK_BRUTE, kurenaiAmbushA[0]-2.5f, kurenaiAmbushA[1]+2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + creature->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushA[0], kurenaiAmbushA[1], kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + } + } + return true; + } + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_kurenai_captiveAI(creature); + } + + struct npc_kurenai_captiveAI : public npc_escortAI + { + npc_kurenai_captiveAI(Creature* creature) : npc_escortAI(creature) { } + + uint32 ChainLightningTimer; + uint32 HealTimer; + uint32 FrostShockTimer; + + void Reset() + { + ChainLightningTimer = 1000; + HealTimer = 0; + FrostShockTimer = 6000; + } + + void EnterCombat(Unit* /*who*/) + { + DoCast(me, SPELL_KUR_EARTHBIND_TOTEM, false); + } + + void JustDied(Unit* /*killer*/) + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (Player* player = GetPlayerForEscort()) + { + if (player->GetQuestStatus(QUEST_TOTEM_KARDASH_A) != QUEST_STATUS_COMPLETE) + player->FailQuest(QUEST_TOTEM_KARDASH_A); + } + } + + void WaypointReached(uint32 PointId) + { + switch(PointId) + { + case 3: + { + Talk(SAY_KUR_MORE); + + if (Creature* temp = me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0], kurenaiAmbushB[1], kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) + Talk(SAY_KUR_MORE_TWO); + + me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0]-2.5f, kurenaiAmbushB[1]-2.5f, kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushB[0]+2.5f, kurenaiAmbushB[1]+2.5f, kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushB[0]+2.5f, kurenaiAmbushB[1]-2.5f, kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + } + case 7: + { + Talk(SAY_KUR_COMPLETE); + + if (Player* player = GetPlayerForEscort()) + player->GroupEventHappens(QUEST_TOTEM_KARDASH_A, me); + + SetRun(); + break; + } + } + } + + void JustSummoned(Creature* summoned) + { + if (summoned->GetEntry() == NPC_KUR_MURK_BRUTE) + Talk(SAY_KUR_NO_ESCAPE); + + // This function is for when we summoned enemies to fight - so that does NOT mean we should make our totem count in this! + if (summoned->isTotem()) + return; + + summoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + summoned->AI()->AttackStart(me); + } + + void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) + { + if (spell->Id == SPELL_KUR_CHAIN_LIGHTNING) + { + if (rand()%30) + return; + + Talk(SAY_KUR_LIGHTNING); + } + + if (spell->Id == SPELL_KUR_FROST_SHOCK) + { + if (rand()%30) + return; + + Talk(SAY_KUR_SHOCK); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + if (ChainLightningTimer <= diff) + { + DoCast(me->getVictim(), SPELL_KUR_CHAIN_LIGHTNING); + ChainLightningTimer = urand(7000,14000); + } else ChainLightningTimer -= diff; + + if (HealthBelowPct(30)) + { + if (HealTimer <= diff) + { + DoCast(me, SPELL_KUR_HEALING_WAVE); + HealTimer = 5000; + } else HealTimer -= diff; + } + + if (FrostShockTimer <= diff) + { + DoCast(me->getVictim(), SPELL_KUR_FROST_SHOCK); + FrostShockTimer = urand(7500,15000); + } else FrostShockTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; +}; + +/*###### +## go_warmaul_prison +######*/ + +enum FindingTheSurvivorsData +{ + QUEST_FINDING_THE_SURVIVORS = 9948, + NPC_MAGHAR_PRISONER = 18428, + + SAY_FREE = 0, +}; + +class go_warmaul_prison : public GameObjectScript +{ + public: + go_warmaul_prison() : GameObjectScript("go_warmaul_prison") { } + + bool OnGossipHello(Player* player, GameObject* go) + { + if (player->GetQuestStatus(QUEST_FINDING_THE_SURVIVORS) != QUEST_STATUS_INCOMPLETE) + return false; + + if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f)) + { + if (prisoner) + { + go->UseDoorOrButton(); + if (player) + player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0); + + prisoner->AI()->Talk(SAY_FREE, player->GetGUID()); + prisoner->ForcedDespawn(6000); + } + } + return true; + } +}; + void AddSC_nagrand() { - new mob_shattered_rumbler(); - new mob_lump(); - new npc_altruis_the_sufferer(); new npc_greatmother_geyah(); - new npc_lantresor_of_the_blade(); new npc_maghar_captive(); new npc_creditmarker_visit_with_ancestors(); - new mob_sparrowhawk(); new npc_corki(); new go_corkis_prison(); + new npc_kurenai_captive(); + new go_warmaul_prison(); } diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index 31aea5ea576..610cf684a77 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -998,8 +998,7 @@ public: case 50: DoScriptText(SAY_WIL_END, me, player); - if (Player* player = GetPlayerForEscort()) - player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me); + player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me); break; } } diff --git a/src/server/scripts/Outland/shattrath_city.cpp b/src/server/scripts/Outland/shattrath_city.cpp index f2aa9fe5786..6ac60e2086b 100644 --- a/src/server/scripts/Outland/shattrath_city.cpp +++ b/src/server/scripts/Outland/shattrath_city.cpp @@ -369,7 +369,7 @@ public: { if (CAST_PLR(who)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) { - float Radius = 10.0; + float Radius = 10.0f; if (me->IsWithinDistInMap(who, Radius)) { Start(false, false, who->GetGUID()); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 6ae9577070e..3b2cc5f5e00 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -899,7 +899,6 @@ class spell_q9874_liquid_fire : public SpellScriptLoader }; }; - enum SalvagingLifesStength { NPC_SHARD_KILL_CREDIT = 29303, @@ -950,6 +949,7 @@ enum eBattleStandard { NPC_KING_OF_THE_MOUNTAINT_KC = 31766, }; + class spell_q13280_13283_plant_battle_standard: public SpellScriptLoader { public: @@ -978,6 +978,54 @@ public: } }; +enum ChumTheWaterSummons +{ + SUMMON_ANGRY_KVALDIR = 66737, + SUMMON_NORTH_SEA_MAKO = 66738, + SUMMON_NORTH_SEA_THRESHER = 66739, + SUMMON_NORTH_SEA_BLUE_SHARK = 66740 +}; + +class spell_q14112_14145_chum_the_water: public SpellScriptLoader +{ +public: + spell_q14112_14145_chum_the_water() : SpellScriptLoader("spell_q14112_14145_chum_the_water") { } + + class spell_q14112_14145_chum_the_water_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q14112_14145_chum_the_water_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR)) + return false; + if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO)) + return false; + if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER)) + return false; + if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, RAND(SUMMON_ANGRY_KVALDIR, SUMMON_NORTH_SEA_MAKO, SUMMON_NORTH_SEA_THRESHER, SUMMON_NORTH_SEA_BLUE_SHARK)); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q14112_14145_chum_the_water_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q14112_14145_chum_the_water_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -1001,4 +1049,5 @@ void AddSC_quest_spell_scripts() new spell_q9874_liquid_fire(); new spell_q12805_lifeblood_dummy(); new spell_q13280_13283_plant_battle_standard(); + new spell_q14112_14145_chum_the_water(); } diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index a9ed794ab45..517746dac55 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -24,14 +24,8 @@ SDCategory: Areatrigger EndScriptData */ /* ContentData -at_aldurthar_gate q13315/q13351 at_coilfang_waterfall 4591 at_legion_teleporter 4560 Teleporter TO Invasion Point: Cataclysm -at_ravenholdt -at_warsong_slaughterhouse -at_warsong_grainery -at_torp_farm -at_warsong_farms q11686 at_stormwright_shelf q12741 at_last_rites q12019 at_sholazar_waygate q12548 @@ -40,46 +34,6 @@ EndContentData */ #include "ScriptPCH.h" /*###### -## AreaTrigger_at_aldurthar_gate -######*/ - -enum eAldurtharGate -{ - TRIGGER_SOUTH = 5284, - - TRIGGER_CENTRAL = 5285, - TRIGGER_NORTH = 5286, - TRIGGER_NORTHWEST = 5287, - - NPC_SOUTH_GATE = 32195, - NPC_CENTRAL_GATE = 32196, - NPC_NORTH_GATE = 32197, - NPC_NORTHWEST_GATE = 32199 -}; - -class AreaTrigger_at_aldurthar_gate : public AreaTriggerScript -{ - public: - - AreaTrigger_at_aldurthar_gate() - : AreaTriggerScript("at_aldurthar_gate") - { - } - - bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) - { - switch (trigger->id) - { - case TRIGGER_SOUTH: player->KilledMonsterCredit(NPC_SOUTH_GATE, 0); break; - case TRIGGER_CENTRAL: player->KilledMonsterCredit(NPC_CENTRAL_GATE, 0); break; - case TRIGGER_NORTH: player->KilledMonsterCredit(NPC_NORTH_GATE, 0); break; - case TRIGGER_NORTHWEST: player->KilledMonsterCredit(NPC_NORTHWEST_GATE, 0); break; - } - return true; - } -}; - -/*###### ## at_coilfang_waterfall ######*/ @@ -151,71 +105,6 @@ class AreaTrigger_at_legion_teleporter : public AreaTriggerScript } }; -enum eRavenholdt -{ - QUEST_MANOR_RAVENHOLDT = 6681, - NPC_RAVENHOLDT = 13936 -}; - -class AreaTrigger_at_ravenholdt : public AreaTriggerScript -{ - public: - - AreaTrigger_at_ravenholdt() - : AreaTriggerScript("at_ravenholdt") - { - } - - bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) - { - if (player->GetQuestStatus(QUEST_MANOR_RAVENHOLDT) == QUEST_STATUS_INCOMPLETE) - player->KilledMonsterCredit(NPC_RAVENHOLDT, 0); - - return false; - } -}; - -/*###### -## at_warsong_farms -######*/ - -enum eWarsongFarms -{ - QUEST_THE_WARSONG_FARMS = 11686, - - NPC_CREDIT_SLAUGHTERHOUSE = 25672, - NPC_CREDIT_GRAINERY = 25669, - NPC_CREDIT_TORP_FARM = 25671, - - AT_SLAUGHTERHOUSE = 4873, - AT_GRAINERY = 4871, - AT_TORP_FARM = 4872 -}; - -class AreaTrigger_at_warsong_farms : public AreaTriggerScript -{ - public: - - AreaTrigger_at_warsong_farms() - : AreaTriggerScript("at_warsong_farms") - { - } - - bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) - { - if (!player->isDead() && player->GetQuestStatus(QUEST_THE_WARSONG_FARMS) == QUEST_STATUS_INCOMPLETE) - { - switch (trigger->id) - { - case AT_SLAUGHTERHOUSE: player->KilledMonsterCredit(NPC_CREDIT_SLAUGHTERHOUSE, 0); break; - case AT_GRAINERY: player->KilledMonsterCredit(NPC_CREDIT_GRAINERY, 0); break; - case AT_TORP_FARM: player->KilledMonsterCredit(NPC_CREDIT_TORP_FARM, 0); break; - } - } - return true; - } -}; - /*###### ## at_stormwright_shelf ######*/ @@ -370,11 +259,8 @@ class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript void AddSC_areatrigger_scripts() { - new AreaTrigger_at_aldurthar_gate(); new AreaTrigger_at_coilfang_waterfall(); new AreaTrigger_at_legion_teleporter(); - new AreaTrigger_at_ravenholdt(); - new AreaTrigger_at_warsong_farms(); new AreaTrigger_at_stormwright_shelf(); new AreaTrigger_at_scent_larkorwi(); new AreaTrigger_at_last_rites(); diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index cdeac03d76e..3bb969977b6 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -165,7 +165,7 @@ public: bool OnGossipHello(Player* player, GameObject* /*pGO*/) { - if (player->HasSkill(SKILL_ENGINERING) && player->GetBaseSkillValue(SKILL_ENGINERING) >= 300 && !player->HasSpell(22704)) + if (player->HasSkill(SKILL_ENGINEERING) && player->GetBaseSkillValue(SKILL_ENGINEERING) >= 300 && !player->HasSpell(22704)) { player->CastSpell(player, 22864, false); } @@ -1009,7 +1009,7 @@ public: if (qInfo) { //TODO: prisoner should help player for a short period of time - player->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0], 0); + player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0); pPrisoner->DisappearAndDie(); } return true; @@ -1176,14 +1176,79 @@ public: class go_massive_seaforium_charge : public GameObjectScript { -public: - go_massive_seaforium_charge() : GameObjectScript("go_massive_seaforium_charge") { } + public: + go_massive_seaforium_charge() : GameObjectScript("go_massive_seaforium_charge") { } - bool OnGossipHello(Player* /*player*/, GameObject* go) - { - go->SetLootState(GO_JUST_DEACTIVATED); - return true; - } + bool OnGossipHello(Player* /*player*/, GameObject* go) + { + go->SetLootState(GO_JUST_DEACTIVATED); + return true; + } +}; + +/*###### +## go_gjalerbron_cage +######*/ + +enum OfKeysAndCages +{ + QUEST_ALLIANCE_OF_KEYS_AND_CAGES = 11231, + QUEST_HORDE_OF_KEYS_AND_CAGES = 11265, + NPC_GJALERBRON_PRISONER = 24035, + SAY_FREE = 0, +}; + +class go_gjalerbron_cage : public GameObjectScript +{ + public: + go_gjalerbron_cage() : GameObjectScript("go_gjalerbron_cage") { } + + bool OnGossipHello(Player* player, GameObject* go) + { + if ((player->GetTeamId() == TEAM_ALLIANCE && player->GetQuestStatus(QUEST_ALLIANCE_OF_KEYS_AND_CAGES) == QUEST_STATUS_INCOMPLETE) || + (player->GetTeamId() == TEAM_HORDE && player->GetQuestStatus(QUEST_HORDE_OF_KEYS_AND_CAGES) == QUEST_STATUS_INCOMPLETE)) + { + if (Creature* prisoner = go->FindNearestCreature(NPC_GJALERBRON_PRISONER, 5.0f)) + { + go->UseDoorOrButton(); + + if (player) + player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, 0); + + prisoner->AI()->Talk(SAY_FREE); + prisoner->ForcedDespawn(6000); + } + } + return true; + } +}; + +/*######## +## go_large_gjalerbron_cage +#####*/ + +class go_large_gjalerbron_cage : public GameObjectScript +{ + public: + go_large_gjalerbron_cage() : GameObjectScript("go_large_gjalerbron_cage") { } + + bool OnGossipHello(Player* player, GameObject* go) + { + if ((player->GetTeamId() == TEAM_ALLIANCE && player->GetQuestStatus(QUEST_ALLIANCE_OF_KEYS_AND_CAGES) == QUEST_STATUS_INCOMPLETE) || + (player->GetTeamId() == TEAM_HORDE && player->GetQuestStatus(QUEST_HORDE_OF_KEYS_AND_CAGES) == QUEST_STATUS_INCOMPLETE)) + { + std::list<Creature*> prisonerList; + GetCreatureListWithEntryInGrid(prisonerList, go, NPC_GJALERBRON_PRISONER, INTERACTION_DISTANCE); + for (std::list<Creature*>::const_iterator itr = prisonerList.begin(); itr != prisonerList.end(); ++itr) + { + go->UseDoorOrButton(); + player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, (*itr)->GetGUID()); + (*itr)->ForcedDespawn(6000); + (*itr)->AI()->Talk(SAY_FREE); + } + } + return false; + } }; void AddSC_go_scripts() @@ -1224,4 +1289,6 @@ void AddSC_go_scripts() new go_amberpine_outhouse; new go_hive_pod; new go_massive_seaforium_charge; + new go_gjalerbron_cage; + new go_large_gjalerbron_cage; } diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 149e1e455aa..01f12086477 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -774,7 +774,7 @@ public: { bool res = false; npcTextId = textId; - if (player->GetBaseSkillValue(SKILL_ENGINERING) >= skillValue && player->HasSpell(reqSpellId)) + if (player->GetBaseSkillValue(SKILL_ENGINEERING) >= skillValue && player->HasSpell(reqSpellId)) { if (!player->HasSpell(spellId)) res = true; @@ -790,7 +790,7 @@ public: std::string gossipItem; bool canLearn = false; - if (player->HasSkill(SKILL_ENGINERING)) + if (player->HasSkill(SKILL_ENGINEERING)) { switch (creature->GetEntry()) { |