Scripts/Dustwallow Marsh: Fix quest 11174 (Corrosion Prevention)

This commit is contained in:
kaelima
2011-05-07 17:34:18 +02:00
parent 985c85f44e
commit b82ae5ad0d
3 changed files with 173 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
-- Zeppelin Power Core
SET @ENTRY := 23832;
-- Remove aura hack
DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY;
DELETE FROM `creature_addon` WHERE `guid` IN (SELECT `guid` FROM `creature` WHERE `id`=@ENTRY);
INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
(@ENTRY,0,0,1,0, NULL); -- Zeppelin Power Core
-- Remove random movement
UPDATE `creature` SET `spawndist`=0,`MovementType`=0 WHERE `id`=@ENTRY;
-- SmartAI for Zeppelin Power Core
UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=9 AND `entryorguid`=@ENTRY*100;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,1,0,100,0,1000,60000,90000,120000,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Zeppelin Power Core - OOC - Load script every 1.5-2 min'),
(@ENTRY*100,9,0,0,0,0,100,0,1000,1000,0,0,11,42491,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Zeppelin Power Core - Script - Cast Energized Periodic on self'),
(@ENTRY*100,9,1,0,0,0,100,0,60000,90000,0,0,28,42491,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Zeppelin Power Core - Script - After 1 - 1.5 min, remove Energized Periodic on self');
-- Add condition for Ooze Buster (item 33108, spell 42489)
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=18 AND `SourceEntry`=33108;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(18,0,33108,0,24,1,4394,0,0, '', 'Item 33108 can target Bubbling Swamp Ooze'),
(18,0,33108,1,24,1,4393,0,0, '', 'Item 33108 can target Acidic Swamp Ooze');

View File

@@ -0,0 +1,5 @@
DELETE FROM `spell_script_names` WHERE `spell_id` IN (42489,42485,42492);
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(42489, 'spell_ooze_zap'),
(42485, 'spell_ooze_zap_channel_end'),
(42492, 'spell_energize_aoe');

View File

@@ -19,7 +19,7 @@
/* ScriptData
SDName: Dustwallow_Marsh
SD%Complete: 95
SDComment: Quest support: 11180, 558, 11126, 11142, 11180. Vendor Nat Pagle
SDComment: Quest support: 11180, 558, 11126, 11142, 11174, Vendor Nat Pagle
SDCategory: Dustwallow Marsh
EndScriptData */
@@ -684,6 +684,145 @@ public:
};
};
enum SpellScripts
{
SPELL_OOZE_ZAP = 42489,
SPELL_OOZE_ZAP_CHANNEL_END = 42485,
SPELL_OOZE_CHANNEL_CREDIT = 42486,
SPELL_ENERGIZED = 42492,
};
class spell_ooze_zap : public SpellScriptLoader
{
public:
spell_ooze_zap() : SpellScriptLoader("spell_ooze_zap") { }
class spell_ooze_zap_SpellScript : public SpellScript
{
PrepareSpellScript(spell_ooze_zap_SpellScript);
bool Validate(SpellEntry const* /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_OOZE_ZAP))
return false;
return true;
}
SpellCastResult CheckRequirement()
{
if (!GetCaster()->HasAura(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_1)))
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
if (!GetTargetUnit())
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (GetHitUnit())
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register()
{
OnEffect += SpellEffectFn(spell_ooze_zap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnCheckCast += SpellCheckCastFn(spell_ooze_zap_SpellScript::CheckRequirement);
}
};
SpellScript* GetSpellScript() const
{
return new spell_ooze_zap_SpellScript();
}
};
class spell_ooze_zap_channel_end : public SpellScriptLoader
{
public:
spell_ooze_zap_channel_end() : SpellScriptLoader("spell_ooze_zap_channel_end") { }
class spell_ooze_zap_channel_end_SpellScript : public SpellScript
{
PrepareSpellScript(spell_ooze_zap_channel_end_SpellScript);
bool Validate(SpellEntry const* /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_OOZE_ZAP_CHANNEL_END))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Player* player = GetCaster()->ToPlayer())
player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true);
GetHitUnit()->Kill(GetHitUnit());
}
void Register()
{
OnEffect += SpellEffectFn(spell_ooze_zap_channel_end_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_ooze_zap_channel_end_SpellScript();
}
};
class spell_energize_aoe : public SpellScriptLoader
{
public:
spell_energize_aoe() : SpellScriptLoader("spell_energize_aoe") { }
class spell_energize_aoe_SpellScript : public SpellScript
{
PrepareSpellScript(spell_energize_aoe_SpellScript);
bool Validate(SpellEntry const* /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_ENERGIZED))
return false;
return true;
}
void FilterTargets(std::list<Unit*>& unitList)
{
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end();)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_1)) == QUEST_STATUS_INCOMPLETE)
++itr;
else
unitList.erase(itr++);
}
unitList.push_back(GetCaster());
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void Register()
{
OnEffect += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnUnitTargetSelect += SpellUnitTargetFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_AREA_ALLY_SRC);
OnUnitTargetSelect += SpellUnitTargetFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_AREA_ALLY_SRC);
}
};
SpellScript* GetSpellScript() const
{
return new spell_energize_aoe_SpellScript();
}
};
void AddSC_dustwallow_marsh()
{
new mobs_risen_husk_spirit();
@@ -694,4 +833,7 @@ void AddSC_dustwallow_marsh()
new npc_stinky();
new npc_theramore_guard();
new npc_deserter_agitator();
new spell_ooze_zap();
new spell_ooze_zap_channel_end();
new spell_energize_aoe();
}