diff --git a/data/sql/updates/pending_db_world/rev_1571737953110374673.sql b/data/sql/updates/pending_db_world/rev_1571737953110374673.sql new file mode 100644 index 000000000..242bb29e1 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1571737953110374673.sql @@ -0,0 +1,16 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1571737953110374673'); + +DELETE FROM `spell_script_names` WHERE `spell_id` = 17179; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) +VALUES +(17179,'spell_scholomance_boon_of_life'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 1 AND `SourceGroup` = 10508 AND `SourceEntry` = 13626 AND `ConditionTypeOrReference` = 13; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) +VALUES +(1,10508,13626,0,0,13,0,2,1,0,0,0,0,'','Instance - Get Data - Can only loot ''Human Head of Ras Frostwhisper'' if Ras is in human form'); + +DELETE FROM `creature_text` WHERE `CreatureID` = 10508; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) +VALUES +(10508,0,0,'THIS CANNOT BE!!',14,0,100,0,0,0,6371,0,'Ras Frostwhisper'); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index 3b1f4a575..22d596ec5 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -8,6 +8,7 @@ #include "scholomance.h" #include "GameObjectAI.h" #include "SpellScript.h" +#include "SpellAuras.h" class instance_scholomance : public InstanceMapScript { @@ -21,18 +22,18 @@ class instance_scholomance : public InstanceMapScript struct instance_scholomance_InstanceMapScript : public InstanceScript { - instance_scholomance_InstanceMapScript(Map* map) : InstanceScript(map) - { - GateKirtonosGUID = 0; - GateMiliciaGUID = 0; - GateTheolenGUID = 0; - GatePolkeltGUID = 0; - GateRavenianGUID = 0; - GateBarovGUID = 0; - GateIlluciaGUID = 0; - _kirtonosState = 0; - _miniBosses = 0; - } + instance_scholomance_InstanceMapScript(Map* map) : InstanceScript(map), + GateKirtonosGUID { 0 }, + GateMiliciaGUID { 0 }, + GateTheolenGUID { 0 }, + GatePolkeltGUID { 0 }, + GateRavenianGUID { 0 }, + GateBarovGUID { 0 }, + GateIlluciaGUID { 0 }, + _kirtonosState { 0 }, + _miniBosses { 0 }, + _rasHuman { 0 } + { } void OnGameObjectCreate(GameObject* go) { @@ -95,6 +96,9 @@ class instance_scholomance : public InstanceMapScript case DATA_MINI_BOSSES: ++_miniBosses; break; + case DATA_RAS_HUMAN: + _rasHuman = data; + break; } SaveToDB(); @@ -108,6 +112,8 @@ class instance_scholomance : public InstanceMapScript return _kirtonosState; case DATA_MINI_BOSSES: return _miniBosses; + case DATA_RAS_HUMAN: + return _rasHuman; } return 0; } @@ -149,6 +155,7 @@ class instance_scholomance : public InstanceMapScript uint32 _kirtonosState; uint32 _miniBosses; + uint32 _rasHuman; }; }; @@ -455,6 +462,53 @@ class spell_scholomance_shadow_portal_rooms : public SpellScriptLoader } }; +class spell_scholomance_boon_of_life : public SpellScriptLoader +{ + public: + spell_scholomance_boon_of_life() : SpellScriptLoader("spell_scholomance_boon_of_life") { } + + class spell_scholomance_boon_of_life_AuraScript : public AuraScript + { + PrepareAuraScript(spell_scholomance_boon_of_life_AuraScript); + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (Unit* target = GetTarget()) + if (Creature* creature = target->ToCreature()) + { + creature->AI()->AttackStart(caster); + creature->AddThreat(caster, 10000.0f); + } + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + if (Creature* creature = target->ToCreature()) + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_CANCEL) + { + creature->AI()->Talk(TALK_RAS_HUMAN); + creature->SetDisplayId(MODEL_RAS_HUMAN); + creature->SetHealth(target->GetMaxHealth()); + if (InstanceScript* instance = creature->GetInstanceScript()) + instance->SetData(DATA_RAS_HUMAN,1); + } + } + + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_scholomance_boon_of_life_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + AfterEffectApply += AuraEffectApplyFn(spell_scholomance_boon_of_life_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_scholomance_boon_of_life_AuraScript(); + } +}; + void AddSC_instance_scholomance() { new instance_scholomance(); @@ -463,4 +517,5 @@ void AddSC_instance_scholomance() new spell_kormok_summon_bone_minions(); new spell_scholomance_shadow_portal(); new spell_scholomance_shadow_portal_rooms(); + new spell_scholomance_boon_of_life(); } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h index 495cd4381..cc92b7fc2 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h +++ b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h @@ -8,7 +8,18 @@ enum DataTypes { DATA_KIRTONOS_THE_HERALD = 0, - DATA_MINI_BOSSES = 1 + DATA_MINI_BOSSES = 1, + DATA_RAS_HUMAN = 2 +}; + +enum ModelIds +{ + MODEL_RAS_HUMAN = 3975 +}; + +enum TalkGroupIds +{ + TALK_RAS_HUMAN = 0 }; enum CreatureIds