diff options
Diffstat (limited to 'src')
38 files changed, 880 insertions, 555 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index b7fa3940a20..78c22e74f44 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -183,6 +183,9 @@ void PetAI::UpdateAI(const uint32 diff) } } + if (spellInfo->HasEffect(SPELL_EFFECT_JUMP_DEST)) + continue; // Pets must only jump to target + // No enemy, check friendly if (!spellUsed) { @@ -266,6 +269,7 @@ void PetAI::UpdateAllies() //only pet and owner/not in group->ok if (m_AllySet.size() == 2 && !group) return; + //owner is in group; group members filled in already (no raid -> subgroupcount = whole count) if (group && !group->isRaidGroup() && m_AllySet.size() == (group->GetMembersCount() + 2)) return; @@ -578,11 +582,19 @@ void PetAI::ReceiveEmote(Player* player, uint32 emote) { case TEXT_EMOTE_COWER: if (me->isPet() && me->ToPet()->IsPetGhoul()) - me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + me->HandleEmoteCommand(/*EMOTE_ONESHOT_ROAR*/EMOTE_ONESHOT_OMNICAST_GHOUL); break; case TEXT_EMOTE_ANGRY: if (me->isPet() && me->ToPet()->IsPetGhoul()) - me->HandleEmoteCommand(EMOTE_ONESHOT_COWER); + me->HandleEmoteCommand(/*EMOTE_ONESHOT_COWER*/EMOTE_STATE_STUN); + break; + case TEXT_EMOTE_GLARE: + if (me->isPet() && me->ToPet()->IsPetGhoul()) + me->HandleEmoteCommand(EMOTE_STATE_STUN); + break; + case TEXT_EMOTE_SOOTHE: + if (me->isPet() && me->ToPet()->IsPetGhoul()) + me->HandleEmoteCommand(EMOTE_ONESHOT_OMNICAST_GHOUL); break; } } diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 2eab0e89fcd..8b31bb5c54d 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -29,17 +29,6 @@ class Quest; class Unit; struct AISpellInfoType; -// Default script texts -enum GeneralScriptTexts -{ - DEFAULT_TEXT = -1000000, - EMOTE_GENERIC_FRENZY_KILL = -1000001, - EMOTE_GENERIC_FRENZY = -1000002, - EMOTE_GENERIC_ENRAGED = -1000003, - EMOTE_GENERIC_BERSERK = -1000004, - EMOTE_GENERIC_BERSERK_RAID = -1000005 // RaidBossEmote version of the previous one -}; - //Selection method used by SelectTarget enum SelectAggroTarget { diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 4738d8f6f27..161c4a578ce 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -419,6 +419,8 @@ bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*itemEntry // we need to delete the entry, it is not referenced any more delete auction; + auction = NULL; + return wasInMap; } @@ -471,8 +473,8 @@ void AuctionHouseObject::Update() auction->DeleteFromDB(trans); CharacterDatabase.CommitTransaction(trans); - RemoveAuction(auction, itemEntry); sAuctionMgr->RemoveAItem(auction->itemGUIDLow); + RemoveAuction(auction, itemEntry); } while (result->NextRow()); } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 4600caa63e3..8d39e459187 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -411,6 +411,16 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) SetPvP(false); } + // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template + if (IsVehicle()) + { + if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player + { + setFaction(owner->getFaction()); // vehicles should have same as owner faction + owner->VehicleSpellInitialize(); + } + } + // trigger creature is always not selectable and can not be attacked if (isTrigger()) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3c58e9cb467..1fa6cbd9308 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12634,22 +12634,22 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) } } -void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check) +void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool unequip_check) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", item, count); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", itemEntry, count); uint32 remcount = 0; // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) { - if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { - if (pItem->GetEntry() == item && !pItem->IsInTrade()) + if (item->GetEntry() == itemEntry && !item->IsInTrade()) { - if (pItem->GetCount() + remcount <= count) + if (item->GetCount() + remcount <= count) { // all items in inventory can unequipped - remcount += pItem->GetCount(); + remcount += item->GetCount(); DestroyItem(INVENTORY_SLOT_BAG_0, i, update); if (remcount >= count) @@ -12657,11 +12657,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ } else { - ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); - pItem->SetCount(pItem->GetCount() - count + remcount); + ItemRemovedQuestCheck(item->GetEntry(), count - remcount); + item->SetCount(item->GetCount() - count + remcount); if (IsInWorld() && update) - pItem->SendUpdateToPlayer(this); - pItem->SetState(ITEM_CHANGED, this); + item->SendUpdateToPlayer(this); + item->SetState(ITEM_CHANGED, this); return; } } @@ -12670,14 +12670,14 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { - if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { - if (pItem->GetEntry() == item && !pItem->IsInTrade()) + if (item->GetEntry() == itemEntry && !item->IsInTrade()) { - if (pItem->GetCount() + remcount <= count) + if (item->GetCount() + remcount <= count) { // all keys can be unequipped - remcount += pItem->GetCount(); + remcount += item->GetCount(); DestroyItem(INVENTORY_SLOT_BAG_0, i, update); if (remcount >= count) @@ -12685,11 +12685,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ } else { - ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); - pItem->SetCount(pItem->GetCount() - count + remcount); + ItemRemovedQuestCheck(item->GetEntry(), count - remcount); + item->SetCount(item->GetCount() - count + remcount); if (IsInWorld() && update) - pItem->SendUpdateToPlayer(this); - pItem->SetState(ITEM_CHANGED, this); + item->SendUpdateToPlayer(this); + item->SetState(ITEM_CHANGED, this); return; } } @@ -12699,18 +12699,18 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ // in inventory bags for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { - if (Bag* pBag = GetBagByPos(i)) + if (Bag* bag = GetBagByPos(i)) { - for (uint32 j = 0; j < pBag->GetBagSize(); j++) + for (uint32 j = 0; j < bag->GetBagSize(); j++) { - if (Item* pItem = pBag->GetItemByPos(j)) + if (Item* item = bag->GetItemByPos(j)) { - if (pItem->GetEntry() == item && !pItem->IsInTrade()) + if (item->GetEntry() == itemEntry && !item->IsInTrade()) { // all items in bags can be unequipped - if (pItem->GetCount() + remcount <= count) + if (item->GetCount() + remcount <= count) { - remcount += pItem->GetCount(); + remcount += item->GetCount(); DestroyItem(i, j, update); if (remcount >= count) @@ -12718,11 +12718,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ } else { - ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); - pItem->SetCount(pItem->GetCount() - count + remcount); + ItemRemovedQuestCheck(item->GetEntry(), count - remcount); + item->SetCount(item->GetCount() - count + remcount); if (IsInWorld() && update) - pItem->SendUpdateToPlayer(this); - pItem->SetState(ITEM_CHANGED, this); + item->SendUpdateToPlayer(this); + item->SetState(ITEM_CHANGED, this); return; } } @@ -12734,15 +12734,15 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ // in equipment and bag list for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) { - if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { - if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade()) + if (item && item->GetEntry() == itemEntry && !item->IsInTrade()) { - if (pItem->GetCount() + remcount <= count) + if (item->GetCount() + remcount <= count) { if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK) { - remcount += pItem->GetCount(); + remcount += item->GetCount(); DestroyItem(INVENTORY_SLOT_BAG_0, i, update); if (remcount >= count) @@ -12751,16 +12751,78 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ } else { - ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); - pItem->SetCount(pItem->GetCount() - count + remcount); + ItemRemovedQuestCheck(item->GetEntry(), count - remcount); + item->SetCount(item->GetCount() - count + remcount); + if (IsInWorld() && update) + item->SendUpdateToPlayer(this); + item->SetState(ITEM_CHANGED, this); + return; + } + } + } + } + + // in bank + for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) + { + if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + { + if (item->GetEntry() == itemEntry && !item->IsInTrade()) + { + if (item->GetCount() + remcount <= count) + { + remcount += item->GetCount(); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); + if (remcount >= count) + return; + } + else + { + ItemRemovedQuestCheck(item->GetEntry(), count - remcount); + item->SetCount(item->GetCount() - count + remcount); if (IsInWorld() && update) - pItem->SendUpdateToPlayer(this); - pItem->SetState(ITEM_CHANGED, this); + item->SendUpdateToPlayer(this); + item->SetState(ITEM_CHANGED, this); return; } } } } + + // in bank bags + for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + { + if (Bag* bag = GetBagByPos(i)) + { + for (uint32 j = 0; j < bag->GetBagSize(); j++) + { + if (Item* item = bag->GetItemByPos(j)) + { + if (item->GetEntry() == itemEntry && !item->IsInTrade()) + { + // all items in bags can be unequipped + if (item->GetCount() + remcount <= count) + { + remcount += item->GetCount(); + DestroyItem(i, j, update); + + if (remcount >= count) + return; + } + else + { + ItemRemovedQuestCheck(item->GetEntry(), count - remcount); + item->SetCount(item->GetCount() - count + remcount); + if (IsInWorld() && update) + item->SendUpdateToPlayer(this); + item->SetState(ITEM_CHANGED, this); + return; + } + } + } + } + } + } } void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f1d421b916a..a5a36001855 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1038,6 +1038,9 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama break; } + // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations + sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage); + // Calculate absorb resist if (damage > 0) { @@ -1134,6 +1137,9 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType); damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType); + // Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations + sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage); + // Calculate armor reduction if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask))) { @@ -5566,37 +5572,28 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Shadow's Fate (Shadowmourne questline) case 71169: { - target = triggeredByAura->GetCaster(); - if (!target) - return false; - Player* player = target->ToPlayer(); - if (!player) - return false; - // not checking Infusion auras because its in targetAuraSpell of credit spell - if (player->GetQuestStatus(24749) == QUEST_STATUS_INCOMPLETE) // Unholy Infusion - { - if (GetEntry() != 36678) // Professor Putricide - return false; - CastSpell(target, 71518, true); // Quest Credit - return true; - } - else if (player->GetQuestStatus(24756) == QUEST_STATUS_INCOMPLETE) // Blood Infusion - { - if (GetEntry() != 37955) // Blood-Queen Lana'thel - return false; - CastSpell(target, 72934, true); // Quest Credit - return true; - } - else if (player->GetQuestStatus(24757) == QUEST_STATUS_INCOMPLETE) // Frost Infusion + uint32 spellId = 0; + + switch (GetEntry()) { - if (GetEntry() != 36853) // Sindragosa - return false; - CastSpell(target, 72289, true); // Quest Credit - return true; + case 36678: // NPC: Professor Putricide + spellId = 71518; // Spell: Unholy Infusion Credit + break; + case 37955: // NPC: Blood-Queen Lana'thel + spellId = 72934; // Spell: Quest Credit + break; + case 36853: // NPC: Sindragosa <Queen of the Frostbrood> + spellId = 72289; // Spell: Frost Infusion Quest Credit + break; + default: + break; } - else if (player->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) // A Feast of Souls - triggered_spell_id = 71203; - break; + if (spellId) + CastSpell((Unit*)NULL, spellId, true); + + CastSpell((Unit*)NULL, 71203, true); + + return true; } // Essence of the Blood Queen case 70871: @@ -9045,23 +9042,31 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg return false; Player* player = ToPlayer(); - if (player->GetQuestStatus(24749) == QUEST_STATUS_INCOMPLETE) // Unholy Infusion + if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) { - if (!player->HasAura(71516) || victim->GetEntry() != 36678) // Shadow Infusion && Professor Putricide - return false; - } - else if (player->GetQuestStatus(24756) == QUEST_STATUS_INCOMPLETE) // Blood Infusion - { - if (!player->HasAura(72154) || victim->GetEntry() != 37955) // Thirst Quenched && Blood-Queen Lana'thel + uint32 spellId = 0; + uint32 questId = 0; + switch (victim->GetEntry()) + { + case 36678: // NPC: Professor Putricide + questId = 24749; // Quest: Unholy Infusion + spellId = 71516; // Spell: Shadow Infusion + break; + case 37955: // NPC: Blood-Queen Lana'thel + questId = 24756; // Quest: Blood Infusion + spellId = 72154; // Spell: Thirst Quenched + break; + case 36853: // NPC: Sindragosa + questId = 24757; // Quest: Frost Infusion + spellId = 72290; // Spell: Frost-Imbued Blade + break; + default: return false; - } - else if (player->GetQuestStatus(24757) == QUEST_STATUS_INCOMPLETE) // Frost Infusion - { - if (!player->HasAura(72290) || victim->GetEntry() != 36853) // Frost-Imbued Blade && Sindragosa + } + + if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId)) return false; } - else if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) // A Feast of Souls - return false; if (victim->GetTypeId() != TYPEID_UNIT) return false; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 74423e2b362..70ac4aec4aa 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1658,7 +1658,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos) Creature* creature = new Creature; if (!creature->LoadCreatureFromDB(guid, map)) { - sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", guid); + sLog->outError(LOG_FILTER_GENERAL, "MoveCreData: Cannot add creature guid %u to map", guid); delete creature; return false; } @@ -1710,7 +1710,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float Creature* creature = new Creature; if (!creature->LoadCreatureFromDB(guid, map)) { - sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", entry); + sLog->outError(LOG_FILTER_GENERAL, "AddCreature: Cannot add creature entry %u to map", entry); delete creature; return 0; } @@ -1736,7 +1736,6 @@ void ObjectMgr::LoadGameobjects() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty."); - return; } diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 488dbfc9159..4f45044d5f7 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -378,14 +378,14 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); } -void MotionMaster::MoveFall(uint32 id/*=0*/) +void MotionMaster::MoveFall(uint32 id /*=0*/) { // use larger distance for vmap height search than in most other cases float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE); if (tz <= INVALID_HEIGHT) { sLog->outDebug(LOG_FILTER_GENERAL, "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", - _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ()); + _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); return; } diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index b794d45423b..08b1495eb33 100644 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -320,6 +320,7 @@ void AddSC_boss_ayamiss(); void AddSC_boss_ossirian(); void AddSC_instance_ruins_of_ahnqiraj(); void AddSC_boss_cthun(); //Temple of ahn'qiraj +void AddSC_boss_viscidus(); void AddSC_boss_fankriss(); void AddSC_boss_huhuran(); void AddSC_bug_trio(); @@ -954,6 +955,7 @@ void AddKalimdorScripts() AddSC_boss_ossirian(); AddSC_instance_ruins_of_ahnqiraj(); AddSC_boss_cthun(); //Temple of ahn'qiraj + AddSC_boss_viscidus(); AddSC_boss_fankriss(); AddSC_boss_huhuran(); AddSC_bug_trio(); diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 6682d3c11e3..401b0e1728b 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -160,83 +160,7 @@ class ScriptRegistry if (!V) \ return R; -void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) -{ - if (!pSource) - { - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i, invalid Source pointer.", iTextEntry); - return; - } - - if (iTextEntry >= 0) - { - sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); - return; - } - - const StringTextData* pData = sScriptSystemMgr->GetTextData(iTextEntry); - - if (!pData) - { - sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); - return; - } - - sLog->outDebug(LOG_FILTER_TSCR, "DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote); - - if (pData->uiSoundId) - { - if (sSoundEntriesStore.LookupEntry(pData->uiSoundId)) - pSource->SendPlaySound(pData->uiSoundId, false); - else - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); - } - - if (pData->uiEmote) - { - if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) - ((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote); - else - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId()); - } - - switch (pData->uiType) - { - case CHAT_TYPE_SAY: - pSource->MonsterSay(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_YELL: - pSource->MonsterYell(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_TEXT_EMOTE: - pSource->MonsterTextEmote(iTextEntry, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_BOSS_EMOTE: - pSource->MonsterTextEmote(iTextEntry, target ? target->GetGUID() : 0, true); - break; - case CHAT_TYPE_WHISPER: - { - if (target && target->GetTypeId() == TYPEID_PLAYER) - pSource->MonsterWhisper(iTextEntry, target->GetGUID()); - else - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); - - break; - } - case CHAT_TYPE_BOSS_WHISPER: - { - if (target && target->GetTypeId() == TYPEID_PLAYER) - pSource->MonsterWhisper(iTextEntry, target->GetGUID(), true); - else - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); - break; - } - case CHAT_TYPE_ZONE_YELL: - pSource->MonsterYellToZone(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0); - break; - } -} ScriptMgr::ScriptMgr() : _scriptCount(0), _scheduledScripts(0) @@ -293,14 +217,13 @@ void ScriptMgr::Unload() SCR_CLEAR(PlayerScript); SCR_CLEAR(GuildScript); SCR_CLEAR(GroupScript); + SCR_CLEAR(UnitScript); #undef SCR_CLEAR } void ScriptMgr::LoadDatabase() { - sScriptSystemMgr->LoadScriptTexts(); - sScriptSystemMgr->LoadScriptTextsCustom(); sScriptSystemMgr->LoadScriptWaypoints(); } @@ -1416,6 +1339,22 @@ void ScriptMgr::OnGroupDisband(Group* group) FOREACH_SCRIPT(GroupScript)->OnDisband(group); } +// Unit +void ScriptMgr::ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage) +{ + FOREACH_SCRIPT(UnitScript)->ModifyPeriodicDamageAurasTick(target, attacker, damage); +} + +void ScriptMgr::ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage) +{ + FOREACH_SCRIPT(UnitScript)->ModifyMeleeDamage(target, attacker, damage); +} + +void ScriptMgr::ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage) +{ + FOREACH_SCRIPT(UnitScript)->ModifySpellDamageTaken(target, attacker, damage); +} + SpellScriptLoader::SpellScriptLoader(const char* name) : ScriptObject(name) { @@ -1440,6 +1379,13 @@ FormulaScript::FormulaScript(const char* name) ScriptRegistry<FormulaScript>::AddScript(this); } +UnitScript::UnitScript(const char* name, bool addToScripts) + : ScriptObject(name) +{ + if (addToScripts) + ScriptRegistry<UnitScript>::AddScript(this); +} + WorldMapScript::WorldMapScript(const char* name, uint32 mapId) : ScriptObject(name), MapScript<Map>(mapId) { @@ -1474,7 +1420,7 @@ ItemScript::ItemScript(const char* name) } CreatureScript::CreatureScript(const char* name) - : ScriptObject(name) + : UnitScript(name, false) { ScriptRegistry<CreatureScript>::AddScript(this); } @@ -1552,7 +1498,7 @@ AchievementCriteriaScript::AchievementCriteriaScript(const char* name) } PlayerScript::PlayerScript(const char* name) - : ScriptObject(name) + : UnitScript(name, false) { ScriptRegistry<PlayerScript>::AddScript(this); } @@ -1598,6 +1544,7 @@ template class ScriptRegistry<AchievementCriteriaScript>; template class ScriptRegistry<PlayerScript>; template class ScriptRegistry<GuildScript>; template class ScriptRegistry<GroupScript>; +template class ScriptRegistry<UnitScript>; // Undefine utility macros. #undef GET_SCRIPT_RET diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 947be2b73fe..0f6fd5d018b 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -69,8 +69,6 @@ struct OutdoorPvPData; #define VISIBLE_RANGE 166.0f //MAX visible range (size of grid) -// Generic scripting text function. -void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL); /* TODO: Add more script type classes. @@ -394,7 +392,24 @@ class ItemScript : public ScriptObject virtual bool OnExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return false; } }; -class CreatureScript : public ScriptObject, public UpdatableScript<Creature> +class UnitScript : public ScriptObject +{ + protected: + + UnitScript(const char* name, bool addToScripts = true); + + public: + // Called when DoT's Tick Damage is being Dealt + virtual void ModifyPeriodicDamageAurasTick(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) { } + + // Called when Melee Damage is being Dealt + virtual void ModifyMeleeDamage(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) { } + + // Called when Spell Damage is being Dealt + virtual void ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, int32& /*damage*/) { } +}; + +class CreatureScript : public UnitScript, public UpdatableScript<Creature> { protected: @@ -656,7 +671,7 @@ class AchievementCriteriaScript : public ScriptObject virtual bool OnCheck(Player* source, Unit* target) = 0; }; -class PlayerScript : public ScriptObject +class PlayerScript : public UnitScript { protected: @@ -1033,6 +1048,12 @@ class ScriptMgr void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid); void OnGroupDisband(Group* group); + public: /* UnitScript */ + + void ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage); + void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage); + void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage); + public: /* Scheduled scripts */ uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; } diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 41b41b91808..ea1cf6b1994 100644 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -23,128 +23,6 @@ ScriptPointVector const SystemMgr::_empty; -void SystemMgr::LoadScriptTexts() -{ - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts..."); - LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2)); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts additional data..."); - uint32 oldMSTime = getMSTime(); - - // 0 1 2 3 - QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts"); - - if (!result) - { - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); - return; - } - - uint32 uiCount = 0; - - do - { - Field* pFields = result->Fetch(); - StringTextData temp; - - int32 iId = pFields[0].GetInt32(); - temp.uiSoundId = pFields[1].GetUInt32(); - temp.uiType = pFields[2].GetUInt8(); - temp.uiLanguage = pFields[3].GetUInt8(); - temp.uiEmote = pFields[4].GetUInt16(); - - if (iId >= 0) - { - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is not a negative value.", iId); - continue; - } - - if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2) - { - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId); - continue; - } - - if (temp.uiSoundId) - { - if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); - } - - if (!GetLanguageDescByID(temp.uiLanguage)) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage); - - if (temp.uiType > CHAT_TYPE_ZONE_YELL) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType); - - m_mTextDataMap[iId] = temp; - ++uiCount; - } - while (result->NextRow()); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); -} - -void SystemMgr::LoadScriptTextsCustom() -{ - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts..."); - LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3)); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts additional data..."); - - QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts"); - - if (!result) - { - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); - return; - } - - uint32 uiCount = 0; - - do - { - Field* pFields = result->Fetch(); - StringTextData temp; - - int32 iId = pFields[0].GetInt32(); - temp.uiSoundId = pFields[1].GetUInt32(); - temp.uiType = pFields[2].GetUInt8(); - temp.uiLanguage = pFields[3].GetUInt8(); - temp.uiEmote = pFields[4].GetUInt16(); - - if (iId >= 0) - { - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is not a negative value.", iId); - continue; - } - - if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3) - { - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId); - continue; - } - - if (temp.uiSoundId) - { - if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); - } - - if (!GetLanguageDescByID(temp.uiLanguage)) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage); - - if (temp.uiType > CHAT_TYPE_ZONE_YELL) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType); - - m_mTextDataMap[iId] = temp; - ++uiCount; - } - while (result->NextRow()); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Custom Texts data.", uiCount); -} - void SystemMgr::LoadScriptWaypoints() { uint32 oldMSTime = getMSTime(); diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index 4211a63b043..cc65d493f3e 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -46,14 +46,6 @@ struct ScriptPointMove typedef std::vector<ScriptPointMove> ScriptPointVector; -struct StringTextData -{ - uint32 uiSoundId; - uint8 uiType; - uint32 uiLanguage; - uint32 uiEmote; -}; - class SystemMgr { friend class ACE_Singleton<SystemMgr, ACE_Null_Mutex>; @@ -61,26 +53,11 @@ class SystemMgr ~SystemMgr() {} public: - //Maps and lists - typedef UNORDERED_MAP<int32, StringTextData> TextDataMap; typedef UNORDERED_MAP<uint32, ScriptPointVector> PointMoveMap; //Database - void LoadScriptTexts(); - void LoadScriptTextsCustom(); void LoadScriptWaypoints(); - //Retrive from storage - StringTextData const* GetTextData(int32 textId) const - { - TextDataMap::const_iterator itr = m_mTextDataMap.find(textId); - - if (itr == m_mTextDataMap.end()) - return NULL; - - return &itr->second; - } - ScriptPointVector const& GetPointMoveList(uint32 creatureEntry) const { PointMoveMap::const_iterator itr = m_mPointMoveMap.find(creatureEntry); @@ -92,7 +69,6 @@ class SystemMgr } protected: - TextDataMap m_mTextDataMap; //additional data for text strings PointMoveMap m_mPointMoveMap; //coordinates for waypoints private: diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index ae30cf72609..260091c9ed7 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -6169,6 +6169,9 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const // ignore non positive values (can be result apply spellmods to aura damage uint32 damage = std::max(GetAmount(), 0); + // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations + sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); + if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) { damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index a342388f583..0ec56dd17fd 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -35,7 +35,7 @@ void CharacterDatabaseCleaner::CleanDatabase() uint32 oldMSTime = getMSTime(); // check flags which clean ups are necessary - QueryResult result = CharacterDatabase.Query("SELECT value FROM worldstates WHERE entry = 20004"); + QueryResult result = CharacterDatabase.PQuery("SELECT value FROM worldstates WHERE entry = %d", WS_CLEANING_FLAGS); if (!result) return; @@ -60,12 +60,11 @@ void CharacterDatabaseCleaner::CleanDatabase() // NOTE: In order to have persistentFlags be set in worldstates for the next cleanup, // you need to define them at least once in worldstates. flags &= sWorld->getIntConfig(CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS); - CharacterDatabase.DirectPExecute("UPDATE worldstates SET value = %u WHERE entry = 20004", flags); + CharacterDatabase.DirectPExecute("UPDATE worldstates SET value = %u WHERE entry = %d", flags, WS_CLEANING_FLAGS); sWorld->SetCleaningFlags(flags); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - } void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32)) diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 1ac9b153dfd..c541945a1e4 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -471,8 +471,9 @@ enum WorldStates { WS_WEEKLY_QUEST_RESET_TIME = 20002, // Next weekly reset time WS_BG_DAILY_RESET_TIME = 20003, // Next daily BG reset time - WS_MONTHLY_QUEST_RESET_TIME = 20004, // Next monthly reset time + WS_CLEANING_FLAGS = 20004, // Cleaning Flags WS_GUILD_DAILY_RESET_TIME = 20006, // Next guild cap reset time + WS_MONTHLY_QUEST_RESET_TIME = 20007, // Next monthly reset time }; /// Storage class for commands issued for delayed execution diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 9269bbb07ee..a57b06a8ab0 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -306,6 +306,9 @@ public: { handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); handler->SetSentErrorMessage(true); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password.", + handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), + handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); return false; } @@ -321,6 +324,9 @@ public: { case AOR_OK: handler->SendSysMessage(LANG_COMMAND_PASSWORD); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.", + handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), + handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); break; case AOR_PASS_TOO_LONG: handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 73fefe210df..4a08801c972 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -32,10 +32,11 @@ enum Midnight SAY_MIDNIGHT_KILL = 0, SAY_APPEAR = 1, SAY_MOUNT = 2, - SAY_KILL = 3, - SAY_DISARMED = 4, - SAY_DEATH = 5, - SAY_RANDOM = 6, + + SAY_KILL = 0, + SAY_DISARMED = 1, + SAY_DEATH = 2, + SAY_RANDOM = 3, SPELL_SHADOWCLEAVE = 29832, SPELL_INTANGIBLE_PRESENCE = 29833, diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp index 56d07a49dc4..2e70081fe87 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp @@ -27,9 +27,9 @@ enum Spells enum Yells { - SAY_AGGRO = -1595045, - SAY_FAIL = -1595046, - SAY_DEATH = -1595047 + SAY_AGGRO = 0, + SAY_DEATH = 1, + SAY_FAIL = 2 }; class boss_infinite_corruptor : public CreatureScript @@ -59,11 +59,12 @@ public: void EnterCombat(Unit* /*who*/) { + Talk(SAY_AGGRO); if (instance) instance->SetData(DATA_INFINITE_EVENT, IN_PROGRESS); } - void UpdateAI(const uint32 /*diff*/) + void UpdateAI(uint32 const /*diff*/) { //Return since we have no target if (!UpdateVictim()) @@ -74,6 +75,7 @@ public: void JustDied(Unit* /*killer*/) { + Talk(SAY_DEATH); if (instance) instance->SetData(DATA_INFINITE_EVENT, DONE); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index 40d4d5d54b4..7dd395770db 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -29,7 +29,7 @@ EndScriptData */ enum Yells { - EMOTE_TARGET = -1509002 + EMOTE_TARGET = 0 }; class boss_buru : public CreatureScript diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index 4abbf99d4ef..5f5b958fb9b 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -21,8 +21,8 @@ enum Texts { - EMOTE_AGGRO = -1509000, - EMOTE_MANA_FULL = -1509001 + EMOTE_AGGRO = 0, + EMOTE_MANA_FULL = 1 }; enum Spells diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp index da67f93f968..1ffd74eddf3 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp @@ -23,22 +23,22 @@ enum Yells { // The time of our retribution is at hand! Let darkness reign in the hearts of our enemies! Sound: 8645 Emote: 35 - SAY_ANDOROV_INTRO = -1509003, // Before for the first wave - SAY_ANDOROV_ATTACK = -1509004, // Beginning the event - SAY_ANDOROV_WAVE_1 = -1509001, // When the first wave comes text: Kill first, ask questions later... Incoming! emote: 45 sound: 8653 - SAY_WAVE3 = -1509005, - SAY_WAVE4 = -1509006, - SAY_WAVE5 = -1509007, - SAY_WAVE6 = -1509008, - SAY_WAVE7 = -1509009, - SAY_INTRO = -1509010, - SAY_UNK1 = -1509011, - SAY_UNK2 = -1509012, - SAY_UNK3 = -1509013, - SAY_DEATH = -1509014, - SAY_CHANGEAGGRO = -1509015, - SAY_KILLS_ANDOROV = -1509016, - SAY_COMPLETE_QUEST = -1509017 // Yell when realm complete quest 8743 for world event + SAY_ANDOROV_INTRO = 0, // Before for the first wave + SAY_ANDOROV_ATTACK = 1, // Beginning the event + + SAY_WAVE3 = 0, + SAY_WAVE4 = 1, + SAY_WAVE5 = 2, + SAY_WAVE6 = 3, + SAY_WAVE7 = 4, + SAY_INTRO = 5, + SAY_UNK1 = 6, + SAY_UNK2 = 7, + SAY_UNK3 = 8, + SAY_DEATH = 9, + SAY_CHANGEAGGRO = 10, + SAY_KILLS_ANDOROV = 11, + SAY_COMPLETE_QUEST = 12 // Yell when realm complete quest 8743 for world event // Warriors, Captains, continue the fight! Sound: 8640 }; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 1cb69689b67..c97f8a0495f 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -58,8 +58,6 @@ EndScriptData */ * - the current phase is stored in the instance data to be easily shared between the eye and cthun. */ -#define PI 3.14 - enum Phases { PHASE_NOT_STARTED = 0, @@ -76,24 +74,6 @@ enum Phases PHASE_CTHUN_DONE = 6, }; -enum Creatures -{ - MOB_CTHUN_PORTAL = 15896, - - // ***** Main Phase 1 ******** - BOSS_EYE_OF_CTHUN = 15589, - MOB_CLAW_TENTACLE = 15725, - MOB_EYE_TENTACLE = 15726, - MOB_SMALL_PORTAL = 15904, - - // ***** Main Phase 2 ******** - MOB_BODY_OF_CTHUN = 15809, - MOB_GIANT_CLAW_TENTACLE = 15728, - MOB_GIANT_EYE_TENTACLE = 15334, - MOB_FLESH_TENTACLE = 15802, - MOB_GIANT_PORTAL = 15910, -}; - enum Spells { // ***** Main Phase 1 ******** diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index d0e97bc36c8..c97fd40929a 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,18 +15,293 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Viscidus -SD%Complete: 0 -SDComment: place holder -SDCategory: Temple of Ahn'Qiraj -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellInfo.h" +#include "temple_of_ahnqiraj.h" + +enum Spells +{ + SPELL_POISON_SHOCK = 25993, + SPELL_POISONBOLT_VOLLEY = 25991, + SPELL_TOXIN = 26575, + SPELL_VISCIDUS_SLOWED = 26034, + SPELL_VISCIDUS_SLOWED_MORE = 26036, + SPELL_VISCIDUS_FREEZE = 25937, + SPELL_REJOIN_VISCIDUS = 25896, + SPELL_VISCIDUS_EXPLODE = 25938, + SPELL_VISCIDUS_SUICIDE = 26003, + SPELL_VISCIDUS_SHRINKS = 25893, // Removed from client, in world.spell_dbc + + SPELL_MEMBRANE_VISCIDUS = 25994, // damage reduction spell - removed from DBC + SPELL_VISCIDUS_WEAKNESS = 25926, // aura which procs at damage - should trigger the slow spells - removed from DBC + SPELL_VISCIDUS_GROWS = 25897, // removed from DBC + SPELL_SUMMON_GLOBS = 25885, // summons npc 15667 using spells from 25865 to 25884; All spells have target coords - removed from DBC + SPELL_VISCIDUS_TELEPORT = 25904, // removed from DBC +}; + +enum Events +{ + EVENT_POISONBOLT_VOLLEY = 1, + EVENT_POISON_SHOCK = 2, + EVENT_RESET_PHASE = 3 +}; + +enum Phases +{ + PHASE_FROST = 1, + PHASE_MELEE = 2, + PHASE_GLOB = 3 +}; + +enum Emotes +{ + EMOTE_SLOW = 0, + EMOTE_FREEZE = 1, + EMOTE_FROZEN = 2, + + EMOTE_CRACK = 3, + EMOTE_SHATTER = 4, + EMOTE_EXPLODE = 5 +}; + +enum HitCounter +{ + HITCOUNTER_SLOW = 100, + HITCOUNTER_SLOW_MORE = 150, + HITCOUNTER_FREEZE = 200, + + HITCOUNTER_CRACK = 50, + HITCOUNTER_SHATTER = 100, + HITCOUNTER_EXPLODE = 150, +}; + +enum MovePoints +{ + ROOM_CENTER = 1 +}; + +Position const ViscidusCoord = { -7992.36f, 908.19f, -52.62f, 1.68f }; // TODO: Visci isn't in room middle +float const RoomRadius = 40.0f; // TODO: Not sure if its correct + +class boss_viscidus : public CreatureScript +{ + public: + boss_viscidus() : CreatureScript("boss_viscidus") { } + + struct boss_viscidusAI : public BossAI + { + boss_viscidusAI(Creature* creature) : BossAI(creature, DATA_VISCIDUS) { } + + void Reset() + { + _Reset(); + _hitcounter = 0; + _phase = PHASE_FROST; + } + + void DamageTaken(Unit* attacker, uint32& /*damage*/) + { + if (_phase != PHASE_MELEE) + return; + + ++_hitcounter; + + if (attacker->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && _hitcounter >= HITCOUNTER_EXPLODE) + { + Talk(EMOTE_EXPLODE); + events.Reset(); + _phase = PHASE_GLOB; + DoCast(me, SPELL_VISCIDUS_EXPLODE); + me->SetVisible(false); + me->RemoveAura(SPELL_TOXIN); + me->RemoveAura(SPELL_VISCIDUS_FREEZE); + + uint8 NumGlobes = me->GetHealthPct() / 5.0f; + for (uint8 i = 0; i < NumGlobes; ++i) + { + float Angle = i * 2 * M_PI / NumGlobes; + float X = ViscidusCoord.GetPositionX() + std::cos(Angle) * RoomRadius; + float Y = ViscidusCoord.GetPositionY() + std::sin(Angle) * RoomRadius; + float Z = -35.0f; + + if (TempSummon* Glob = me->SummonCreature(NPC_GLOB_OF_VISCIDUS, X, Y, Z)) + { + Glob->UpdateAllowedPositionZ(X, Y, Z); + Glob->NearTeleportTo(X, Y, Z, 0.0f); + Glob->GetMotionMaster()->MovePoint(ROOM_CENTER, ViscidusCoord); + } + } + } + else if (_hitcounter == HITCOUNTER_SHATTER) + Talk(EMOTE_SHATTER); + else if (_hitcounter == HITCOUNTER_CRACK) + Talk(EMOTE_CRACK); + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if ((spell->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && _phase == PHASE_FROST && me->GetHealthPct() > 5.0f) + { + ++_hitcounter; + + if (_hitcounter >= HITCOUNTER_FREEZE) + { + _hitcounter = 0; + Talk(EMOTE_FROZEN); + _phase = PHASE_MELEE; + DoCast(me, SPELL_VISCIDUS_FREEZE); + me->RemoveAura(SPELL_VISCIDUS_SLOWED_MORE); + events.ScheduleEvent(EVENT_RESET_PHASE, 15000); + } + else if (_hitcounter >= HITCOUNTER_SLOW_MORE) + { + Talk(EMOTE_FREEZE); + me->RemoveAura(SPELL_VISCIDUS_SLOWED); + DoCast(me, SPELL_VISCIDUS_SLOWED_MORE); + } + else if (_hitcounter >= HITCOUNTER_SLOW) + { + Talk(EMOTE_SLOW); + DoCast(me, SPELL_VISCIDUS_SLOWED); + } + } + } + + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + events.Reset(); + InitSpells(); + } + + void InitSpells() + { + DoCast(me, SPELL_TOXIN); + events.ScheduleEvent(EVENT_POISONBOLT_VOLLEY, urand(10000, 15000)); + events.ScheduleEvent(EVENT_POISON_SHOCK, urand(7000, 12000)); + } + + void EnterEvadeMode() + { + summons.DespawnAll(); + ScriptedAI::EnterEvadeMode(); + } + + void JustDied(Unit* /*killer*/) + { + DoCast(me, SPELL_VISCIDUS_SUICIDE); + summons.DespawnAll(); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + if (_phase == PHASE_GLOB && summons.empty()) + { + DoResetThreat(); + me->NearTeleportTo(ViscidusCoord.GetPositionX(), + ViscidusCoord.GetPositionY(), + ViscidusCoord.GetPositionZ(), + ViscidusCoord.GetOrientation()); + + _hitcounter = 0; + _phase = PHASE_FROST; + InitSpells(); + me->SetVisible(true); + } + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_POISONBOLT_VOLLEY: + DoCast(me, SPELL_POISONBOLT_VOLLEY); + events.ScheduleEvent(EVENT_POISONBOLT_VOLLEY, urand(10000, 15000)); + break; + case EVENT_POISON_SHOCK: + DoCast(me, SPELL_POISON_SHOCK); + events.ScheduleEvent(EVENT_POISON_SHOCK, urand(7000, 12000)); + break; + case EVENT_RESET_PHASE: + _hitcounter = 0; + _phase = PHASE_FROST; + break; + default: + break; + } + } + + if (_phase != PHASE_GLOB) + DoMeleeAttackIfReady(); + } + + private: + uint8 _hitcounter; + Phases _phase; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_viscidusAI(creature); + } +}; + +class npc_glob_of_viscidus : public CreatureScript +{ + public: + npc_glob_of_viscidus() : CreatureScript("boss_glob_of_viscidus") { } + + struct npc_glob_of_viscidusAI : public ScriptedAI + { + npc_glob_of_viscidusAI(Creature* creature) : ScriptedAI(creature) { } + + void JustDied(Unit* /*killer*/) + { + InstanceScript* Instance = me->GetInstanceScript(); + if (!Instance) + return; + + if (Creature* Viscidus = me->GetMap()->GetCreature(Instance->GetData64(DATA_VISCIDUS))) + { + if (BossAI* ViscidusAI = dynamic_cast<BossAI*>(Viscidus->GetAI())) + ViscidusAI->SummonedCreatureDespawn(me); + + if (Viscidus->isAlive() && Viscidus->GetHealthPct() < 5.0f) + { + Viscidus->SetVisible(true); + Viscidus->getVictim()->Kill(Viscidus); + } + else + { + Viscidus->SetHealth(Viscidus->GetHealth() - Viscidus->GetMaxHealth() / 20); + Viscidus->GetAI()->DoCast(Viscidus, SPELL_VISCIDUS_SHRINKS); + } + } + } -#define SPELL_POISON_SHOCK 25993 -#define SPELL_POISONBOLT_VOLLEY 25991 + void MovementInform(uint32 /*type*/, uint32 id) + { + if (id == ROOM_CENTER) + { + DoCast(me, SPELL_REJOIN_VISCIDUS); + ((TempSummon*)me)->UnSummon(); + } + } + }; -#define SPELL_TOXIN_CLOUD 25989 + CreatureAI* GetAI(Creature* creature) const + { + return new npc_glob_of_viscidusAI(creature); + } +}; +void AddSC_boss_viscidus() +{ + new boss_viscidus(); + new npc_glob_of_viscidus(); +} diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index c8a1ff63925..3efdcd0dcf6 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -29,71 +29,86 @@ EndScriptData */ class instance_temple_of_ahnqiraj : public InstanceMapScript { -public: - instance_temple_of_ahnqiraj() : InstanceMapScript("instance_temple_of_ahnqiraj", 531) { } + public: + instance_temple_of_ahnqiraj() : InstanceMapScript("instance_temple_of_ahnqiraj", 531) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_temple_of_ahnqiraj_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_temple_of_ahnqiraj_InstanceMapScript(map); + } - struct instance_temple_of_ahnqiraj_InstanceMapScript : public InstanceScript - { - instance_temple_of_ahnqiraj_InstanceMapScript(Map* map) : InstanceScript(map) {} + struct instance_temple_of_ahnqiraj_InstanceMapScript : public InstanceScript + { + instance_temple_of_ahnqiraj_InstanceMapScript(Map* map) : InstanceScript(map) {} - //If Vem is dead... - bool IsBossDied[3]; + //If Vem is dead... + bool IsBossDied[3]; - //Storing Skeram, Vem and Kri. - uint64 SkeramGUID; - uint64 VemGUID; - uint64 KriGUID; - uint64 VeklorGUID; - uint64 VeknilashGUID; + //Storing Skeram, Vem and Kri. + uint64 SkeramGUID; + uint64 VemGUID; + uint64 KriGUID; + uint64 VeklorGUID; + uint64 VeknilashGUID; + uint64 ViscidusGUID; - uint32 BugTrioDeathCount; + uint32 BugTrioDeathCount; - uint32 CthunPhase; + uint32 CthunPhase; - void Initialize() - { - IsBossDied[0] = false; - IsBossDied[1] = false; - IsBossDied[2] = false; + void Initialize() + { + IsBossDied[0] = false; + IsBossDied[1] = false; + IsBossDied[2] = false; - SkeramGUID = 0; - VemGUID = 0; - KriGUID = 0; - VeklorGUID = 0; - VeknilashGUID = 0; + SkeramGUID = 0; + VemGUID = 0; + KriGUID = 0; + VeklorGUID = 0; + VeknilashGUID = 0; + ViscidusGUID = 0; - BugTrioDeathCount = 0; + BugTrioDeathCount = 0; - CthunPhase = 0; - } + CthunPhase = 0; + } - void OnCreatureCreate(Creature* creature) - { - switch (creature->GetEntry()) + void OnCreatureCreate(Creature* creature) { - case 15263: SkeramGUID = creature->GetGUID(); break; - case 15544: VemGUID = creature->GetGUID(); break; - case 15511: KriGUID = creature->GetGUID(); break; - case 15276: VeklorGUID = creature->GetGUID(); break; - case 15275: VeknilashGUID = creature->GetGUID(); break; + switch (creature->GetEntry()) + { + case NPC_SKERAM: + SkeramGUID = creature->GetGUID(); + break; + case NPC_VEM: + VemGUID = creature->GetGUID(); + break; + case NPC_KRI: + KriGUID = creature->GetGUID(); + break; + case NPC_VEKLOR: + VeklorGUID = creature->GetGUID(); + break; + case NPC_VEKNILASH: + VeknilashGUID = creature->GetGUID(); + break; + case NPC_VISCIDUS: + ViscidusGUID = creature->GetGUID(); + break; + } } - } - bool IsEncounterInProgress() const - { - //not active in AQ40 - return false; - } + bool IsEncounterInProgress() const + { + //not active in AQ40 + return false; + } - uint32 GetData(uint32 type) const - { - switch (type) + uint32 GetData(uint32 type) const { + switch (type) + { case DATA_VEMISDEAD: if (IsBossDied[0]) return 1; @@ -114,14 +129,14 @@ public: case DATA_CTHUN_PHASE: return CthunPhase; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 identifier) const - { - switch (identifier) + uint64 GetData64(uint32 identifier) const { + switch (identifier) + { case DATA_SKERAM: return SkeramGUID; case DATA_VEM: @@ -132,14 +147,16 @@ public: return VeklorGUID; case DATA_VEKNILASH: return VeknilashGUID; - } - return 0; - } // end GetData64 + case DATA_VISCIDUS: + return ViscidusGUID; + } + return 0; + } // end GetData64 - void SetData(uint32 type, uint32 data) - { - switch (type) + void SetData(uint32 type, uint32 data) { + switch (type) + { case DATA_VEM_DEATH: IsBossDied[0] = true; break; @@ -159,9 +176,9 @@ public: case DATA_CTHUN_PHASE: CthunPhase = data; break; + } } - } - }; + }; }; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h index 13c3d56d14c..f154ccf2c5d 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h @@ -19,19 +19,45 @@ #ifndef DEF_TEMPLE_OF_AHNQIRAJ_H #define DEF_TEMPLE_OF_AHNQIRAJ_H -#define DATA_SKERAM 1 -#define DATA_KRI 2 -#define DATA_VEM 3 -#define DATA_VEMISDEAD 4 -#define DATA_VEM_DEATH 5 -#define DATA_VEKLOR 6 -#define DATA_VEKLORISDEAD 7 -#define DATA_VEKLOR_DEATH 8 -#define DATA_VEKNILASH 9 -#define DATA_VEKNILASHISDEAD 10 -#define DATA_VEKNILASH_DEATH 11 -#define DATA_BUG_TRIO_DEATH 14 +enum DataTypes +{ + DATA_SKERAM = 1, + DATA_KRI = 2, + DATA_VEM = 3, + DATA_VEMISDEAD = 4, + DATA_VEM_DEATH = 5, + DATA_VEKLOR = 6, + DATA_VEKLORISDEAD = 7, + DATA_VEKLOR_DEATH = 8, + DATA_VEKNILASH = 9, + DATA_VEKNILASHISDEAD = 10, + DATA_VEKNILASH_DEATH = 11, + DATA_BUG_TRIO_DEATH = 14, + DATA_CTHUN_PHASE = 20, + DATA_VISCIDUS = 21 +}; -#define DATA_CTHUN_PHASE 20 +enum Creatures +{ + BOSS_EYE_OF_CTHUN = 15589, + MOB_CTHUN_PORTAL = 15896, + MOB_CLAW_TENTACLE = 15725, + MOB_EYE_TENTACLE = 15726, + MOB_SMALL_PORTAL = 15904, + MOB_BODY_OF_CTHUN = 15809, + MOB_GIANT_CLAW_TENTACLE = 15728, + MOB_GIANT_EYE_TENTACLE = 15334, + MOB_FLESH_TENTACLE = 15802, + MOB_GIANT_PORTAL = 15910, + + NPC_VISCIDUS = 15299, + NPC_GLOB_OF_VISCIDUS = 15667, + + NPC_SKERAM = 15263, + NPC_VEM = 15544, + NPC_KRI = 15511, + NPC_VEKLOR = 15276, + NPC_VEKNILASH = 15275 +}; #endif diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 9485048da8c..f438275b82a 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -37,6 +37,9 @@ EndContentData */ #include "ScriptedGossip.h" #include "Player.h" #include "SpellInfo.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" /*###### ## npc_bunthen_plainswind @@ -319,6 +322,28 @@ public: } } + void IsSummonedBy(Unit* /*summoner*/) + { + std::list<Player*> playerOnQuestList; + Trinity::AnyPlayerInObjectRangeCheck checker(me, 5.0f); + Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(me, playerOnQuestList, checker); + me->VisitNearbyWorldObject(5.0f, searcher); + for (std::list<Player*>::const_iterator itr = playerOnQuestList.begin(); itr != playerOnQuestList.end(); ++itr) + { + // Check if found player target has active quest + if (Player* player = (*itr)) + { + if (player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + { + StartEvent(player); + break; + } + } + else + break; + } + } + void JustDied(Unit* /*killer*/) { if (!PlayerGUID) @@ -358,7 +383,7 @@ public: return; } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { npc_escortAI::UpdateAI(diff); @@ -533,30 +558,6 @@ public: }; /*#### -# npc_clintar_dreamwalker -####*/ - -enum Clintar -{ - CLINTAR_SPIRIT = 22916 -}; - -class npc_clintar_dreamwalker : public CreatureScript -{ -public: - npc_clintar_dreamwalker() : CreatureScript("npc_clintar_dreamwalker") { } - - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) - { - if (quest->GetQuestId() == 10965) - if (Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, ClintarSpiritSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000)) - CAST_AI(npc_clintar_spirit::npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(player); - return true; - } - -}; - -/*#### # npc_omen ####*/ @@ -707,7 +708,6 @@ void AddSC_moonglade() new npc_bunthen_plainswind(); new npc_great_bear_spirit(); new npc_silva_filnaveth(); - new npc_clintar_dreamwalker(); new npc_clintar_spirit(); new npc_omen(); new npc_giant_spotlight(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index d77c84b2978..3c20acf34a6 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -27,10 +27,34 @@ EndScriptData */ #include "SpellScript.h" #include "trial_of_the_champion.h" #include "ScriptedEscortAI.h" - -enum eSpells +/* +enum Yells +{ + // Eadric the Pure + SAY_INTRO = 0, + SAY_AGGRO = 1, + EMOTE_RADIANCE = 2, + EMOTE_HAMMER_RIGHTEOUS = 3, + SAY_HAMMER_RIGHTEOUS = 4, + SAY_KILL_PLAYER = 5, + SAY_DEFEATED = 6, + + // Argent Confessor Paletress + SAY_INTRO_1 = 0, + SAY_INTRO_2 = 1, + SAY_AGGRO = 2, + SAY_MEMORY_SUMMON = 3, + SAY_MEMORY_DEATH = 4, + SAY_KILL_PLAYER = 5, + SAY_DEFEATED = 6, + + // Memory of X + EMOTE_WAKING_NIGHTMARE = 0 +}; +*/ +enum Spells { - //Eadric + // Eadric the Pure SPELL_EADRIC_ACHIEVEMENT = 68197, SPELL_HAMMER_JUSTICE = 66863, SPELL_HAMMER_RIGHTEOUS = 66867, diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index c56d44ceb08..c1a2f9c07d2 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -27,7 +27,7 @@ EndScriptData */ #include "ScriptedEscortAI.h" #include "trial_of_the_champion.h" -enum eSpells +enum Spells { //phase 1 SPELL_PLAGUE_STRIKE = 67884, @@ -61,13 +61,13 @@ enum eSpells SPELL_KILL_CREDIT = 68663 }; -enum eModels +enum Models { MODEL_SKELETON = 29846, MODEL_GHOST = 21300 }; -enum ePhases +enum Phases { PHASE_UNDEAD = 1, PHASE_SKELETON = 2, 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 ffda3d12e2f..9c0b894bfa7 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 @@ -33,6 +33,18 @@ EndContentData */ #include "Vehicle.h" #include "Player.h" +enum Yells +{ + SAY_INTRO_1 = 0, + SAY_INTRO_2 = 1, + SAY_INTRO_3 = 2, + SAY_AGGRO = 3, + SAY_PHASE_2 = 4, + SAY_PHASE_3 = 5, + SAY_KILL_PLAYER = 6, + SAY_DEATH = 7 +}; + #define GOSSIP_START_EVENT1 "I'm ready to start challenge." #define GOSSIP_START_EVENT2 "I'm ready for the next challenge." diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h index cb3a43acdd0..6116a150334 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h @@ -19,7 +19,7 @@ #ifndef DEF_TOC_H #define DEF_TOC_H -enum eData +enum Data { BOSS_GRAND_CHAMPIONS, BOSS_ARGENT_CHALLENGE_E, @@ -46,7 +46,7 @@ enum Data64 DATA_GRAND_CHAMPION_3 }; -enum eNpcs +enum CreatureIds { // Horde Champions NPC_MOKRA = 35572, @@ -78,7 +78,7 @@ enum eNpcs NPC_ARELAS = 35005 }; -enum eGameObjects +enum GameObjects { GO_MAIN_GATE = 195647, @@ -92,7 +92,7 @@ enum eGameObjects GO_PALETRESS_LOOT_H = 195324 }; -enum eVehicles +enum Vehicles { //Grand Champions Alliance Vehicles VEHICLE_MARSHAL_JACOB_ALERIUS_MOUNT = 35637, diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index 0018c58f4cb..8be4ac6b8b6 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -117,12 +117,16 @@ public: events.ScheduleEvent(EVENT_FEVER, urand(15000, 20000)); events.ScheduleEvent(EVENT_PHASE, 90000); events.ScheduleEvent(EVENT_ERUPT, 15000); + me->GetMotionMaster()->MoveChase(me->getVictim()); } else { float x, y, z, o; me->GetHomePosition(x, y, z, o); - me->NearTeleportTo(x, y, z, o); + me->NearTeleportTo(x, y, z, o - G3D::halfPi()); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->SetTarget(0); DoCastAOE(SPELL_PLAGUE_CLOUD); events.ScheduleEvent(EVENT_PHASE, 45000); events.ScheduleEvent(EVENT_ERUPT, 8000); diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index c0635f897d9..5bf45452d34 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -18,7 +18,7 @@ /* ScriptData SDName: Sholazar_Basin SD%Complete: 100 -SDComment: Quest support: 12570, 12573, 12621. +SDComment: Quest support: 12570, 12573, 12621, 12726 SDCategory: Sholazar_Basin EndScriptData */ @@ -26,6 +26,7 @@ EndScriptData */ npc_injured_rainspeaker_oracle npc_vekjik avatar_of_freya +npc_haiphoon (Quest: "Song of Wind and Water") EndContentData */ #include "ScriptMgr.h" @@ -34,6 +35,8 @@ EndContentData */ #include "ScriptedEscortAI.h" #include "SpellScript.h" #include "SpellAuras.h" +#include "Vehicle.h" +#include "CombatAI.h" #include "Player.h" /*###### @@ -984,6 +987,52 @@ public: } }; +/*###### +## Quest: Song of Wind and Water ID: 12726 +######*/ +/*This quest precisly needs core script since battle vehicles are not well integrated with SAI, +may be easily converted to SAI when they get.*/ +enum SongOfWindAndWater +{ + // Spells + SPELL_DEVOUR_WIND = 52862, + SPELL_DEVOUR_WATER = 52864, + // NPCs + NPC_HAIPHOON_WATER = 28999, + NPC_HAIPHOON_AIR = 28985 +}; + +class npc_haiphoon : public CreatureScript +{ +public: + npc_haiphoon() : CreatureScript("npc_haiphoon") { } + + struct npc_haiphoonAI : public VehicleAI + { + npc_haiphoonAI(Creature* creature) : VehicleAI(creature) { } + + void SpellHitTarget(Unit* target, SpellInfo const* spell) + { + if (target == me) + return; + + if (spell->Id == SPELL_DEVOUR_WIND && me->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + me->UpdateEntry(NPC_HAIPHOON_AIR); + } + else if (spell->Id == SPELL_DEVOUR_WATER && me->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + me->UpdateEntry(NPC_HAIPHOON_WATER); + } + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_haiphoonAI(creature); + } +}; + void AddSC_sholazar_basin() { new npc_injured_rainspeaker_oracle(); @@ -995,4 +1044,5 @@ void AddSC_sholazar_basin() new npc_jungle_punch_target(); new spell_q12620_the_lifewarden_wrath(); new spell_q12589_shoot_rjr(); + new npc_haiphoon(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 7fa476100d5..5617c69aea9 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -53,14 +53,16 @@ enum eUnits ENTRY_REINFORCED_FEL_IRON_CHEST_H = 185169 }; -enum eSays +enum Says { SAY_INTRO = 0, - SAY_WIPE = 1, - SAY_AGGRO = 2, - SAY_KILL = 3, - SAY_DIE = 4, - EMOTE = 5 + + SAY_WIPE = 0, + SAY_AGGRO = 1, + SAY_KILL = 2, + SAY_DIE = 3, + + EMOTE = 0 }; const float VazrudenMiddle[3] = {-1406.5f, 1746.5f, 81.2f}; diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index 4f48c311612..40cef99048f 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -274,6 +274,69 @@ class spell_hallow_end_tricky_treat : public SpellScriptLoader } }; +enum Mistletoe +{ + SPELL_CREATE_MISTLETOE = 26206, + SPELL_CREATE_HOLLY = 26207, + SPELL_CREATE_SNOWFLAKES = 45036 +}; + +class spell_winter_veil_mistletoe : public SpellScriptLoader +{ + public: + spell_winter_veil_mistletoe() : SpellScriptLoader("spell_winter_veil_mistletoe") { } + + class spell_winter_veil_mistletoe_SpellScript : public SpellScript + { + PrepareSpellScript(spell_winter_veil_mistletoe_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_MISTLETOE) || + !sSpellMgr->GetSpellInfo(SPELL_CREATE_HOLLY) || + !sSpellMgr->GetSpellInfo(SPELL_CREATE_SNOWFLAKES)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + + if (Player* target = GetHitPlayer()) + { + uint32 spellId = 0; + switch (urand(0, 2)) + { + case 0: + spellId = SPELL_CREATE_MISTLETOE; + break; + case 1: + spellId = SPELL_CREATE_HOLLY; + break; + case 2: + spellId = SPELL_CREATE_SNOWFLAKES; + break; + default: + return; + } + + caster->CastSpell(target, spellId, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_winter_veil_mistletoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_winter_veil_mistletoe_SpellScript(); + } +}; + void AddSC_holiday_spell_scripts() { // Love is in the Air @@ -282,4 +345,6 @@ void AddSC_holiday_spell_scripts() new spell_hallow_end_trick(); new spell_hallow_end_trick_or_treat(); new spell_hallow_end_tricky_treat(); + // Winter Veil + new spell_winter_veil_mistletoe(); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index da80ec8f1da..58b6fca8a81 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1432,7 +1432,7 @@ class spell_q11010_q11102_q11023_choose_loc : public SpellScriptLoader Unit* caster = GetCaster(); // Check for player that is in 65 y range std::list<Player*> playerList; - Trinity::AnyPlayerInObjectRangeCheck checker(caster, 765.0f); + Trinity::AnyPlayerInObjectRangeCheck checker(caster, 65.0f); Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(caster, playerList, checker); caster->VisitNearbyWorldObject(65.0f, searcher); for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 4e0818c7c82..4524a3a9374 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -785,7 +785,7 @@ enum eEngineeringTrinkets SPELL_TO_TOSHLEY = 36955, }; -#define GOSSIP_ITEM_ZAP "[PH] Unknown" +#define GOSSIP_ITEM_ZAP "This Dimensional Imploder sounds dangerous! How can I make one?" #define GOSSIP_ITEM_JHORDY "I must build a beacon for this marvelous device!" #define GOSSIP_ITEM_KABLAM "[PH] Unknown" @@ -819,7 +819,7 @@ public: switch (creature->GetEntry()) { case NPC_ZAP: - canLearn = CanLearn(player, 7249, 0, 260, S_GOBLIN, SPELL_TO_EVERLOOK, npcTextId); + canLearn = CanLearn(player, 6092, 0, 260, S_GOBLIN, SPELL_TO_EVERLOOK, npcTextId); if (canLearn) gossipItem = GOSSIP_ITEM_ZAP; break; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 59ab9cd61e7..36657dc76c3 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1586,49 +1586,6 @@ public: } }; -/*#### -## npc_winter_reveler -####*/ - -enum WinterReveler -{ - SPELL_MISTLETOE_DEBUFF = 26218, - SPELL_CREATE_MISTLETOE = 26206, - SPELL_CREATE_HOLLY = 26207, - SPELL_CREATE_SNOWFLAKES = 45036, -}; - -class npc_winter_reveler : public CreatureScript -{ - public: - npc_winter_reveler() : CreatureScript("npc_winter_reveler") { } - - struct npc_winter_revelerAI : public ScriptedAI - { - npc_winter_revelerAI(Creature* creature) : ScriptedAI(creature) {} - - void ReceiveEmote(Player* player, uint32 emote) - { - if (player->HasAura(SPELL_MISTLETOE_DEBUFF)) - return; - - if (!IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) - return; - - if (emote == TEXT_EMOTE_KISS) - { - uint32 spellId = RAND<uint32>(SPELL_CREATE_MISTLETOE, SPELL_CREATE_HOLLY, SPELL_CREATE_SNOWFLAKES); - me->CastSpell(player, spellId, false); - me->CastSpell(player, SPELL_MISTLETOE_DEBUFF, false); - } - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_winter_revelerAI(creature); - } -}; /*#### ## npc_snake_trap_serpents @@ -3039,7 +2996,6 @@ void AddSC_npcs_special() new npc_sayge(); new npc_steam_tonk(); new npc_tonk_mine(); - new npc_winter_reveler(); new npc_brewfest_reveler(); new npc_snake_trap(); new npc_mirror_image(); |
