diff --git a/sql/updates/world/custom/custom_2019_04_08_01_world.sql b/sql/updates/world/custom/custom_2019_04_08_01_world.sql new file mode 100644 index 00000000000..8ede94c38c2 --- /dev/null +++ b/sql/updates/world/custom/custom_2019_04_08_01_world.sql @@ -0,0 +1,51 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_darkmoon_deathmatch', +'spell_darkmoon_island_deathmatch', +'spell_darkmoon_island_ring_toss'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(108941, 'spell_darkmoon_deathmatch'), +(101695, 'spell_darkmoon_island_ring_toss'); + +DELETE FROM `gameobject_template` WHERE `entry`= 209292; +INSERT INTO `gameobject_template` (`entry`,`type`, `displayId`, `name`, `size`, `Data0`, `Data1`, `Data3`, `Data6`, `VerifiedBuild`) VALUES +(209292, 8, 2770, '[DND] Spell Focus', 1, 1729, 1, 1, -1, -18019); + +DELETE FROM `gameobject` WHERE `guid`= 200888; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `PhaseId`, `position_x`, `position_y`, `position_z`, `orientation`) VALUES +(200888, 209292, 974, 5861, 5870, 169, -4289.51, 6309.706, 13.117, 4.302); + +DELETE FROM `conditions` WHERE `SourceEntry` IN (101807, 101699, 101695) AND `SourceTypeOrReferenceId`= 13; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES +(13, 2, 101807, 0, 0, 31, 0, 3, 54490, 0, 0, 0, '', 'Ring Toss - Target Dubenko'), +(13, 2, 101699, 0, 0, 31, 0, 3, 54490, 0, 0, 0, '', 'Ring Toss - Target Dubenko'), +(13, 1, 101695, 0, 0, 31, 0, 3, 54490, 0, 0, 0, '', 'Ring Toss - Target Dubenko'); + +UPDATE `creature` SET `MovementType`= 1, `spawndist`= 6 WHERE `guid`= 290641; + +-- Creature Dubenko 54490 SAI +SET @ENTRY := 54490; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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, 8, 0, 100, 0, 101807, 0, 0, 0, 11, 101738, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "On spell Ring Toss (101807) hit - Self: Cast spell Ring Toss (101738) on Self // "); + +UPDATE `gossip_menu_option` SET `OptionType`= 1, `OptionNpcFlag`= 1 WHERE `MenuID` IN (13012, 13018, 13019); +DELETE FROM `gossip_menu_option` WHERE `MenuID` IN (13012, 13018, 13019) AND `OptionID`= 1; +UPDATE `gossip_menu_option` SET `ActionMenuID`= 13013 WHERE `MenuID`= 13012 AND `OptionID`= 0; + +-- Creature Jessica Rogers 54485 SAI +SET @ENTRY := 54485; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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, 62, 0, 100, 0, 13012, 2, 0, 0, 98, 13064, 18348, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "On gossip action 2 from menu 13012 selected - Action invoker: Send gossip ID 13064 with text 18348 // "), +(@ENTRY, 0, 1, 2, 62, 0, 100, 0, 13012, 2, 0, 0, 57, 71083, 1, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "On gossip action 2 from menu 13012 selected - Action invoker: Remove item 1x0 // "), +(@ENTRY, 0, 2, 3, 61, 0, 100, 0, 0, 0, 0, 0, 11, 101808, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Cast spell Ring Toss Gossip (101808) on Action invoker // "), +(@ENTRY, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, " Linked - Action invoker: Close gossip // "); + + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=54485 AND SourceId = 0; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`, `NegativeCondition`, `ErrorTextId`,`ScriptName`,`Comment`) VALUES +(22, 2, 54485, 0, 0, 2, 0, 71083, 1, 0, 0, 0, "", "If Invoker has 1 of item 71083 in backpack"), +(22, 1, 54485, 0, 0, 2, 0, 71083, 0, 0, 0, 0, "", "If Invoker has 0 of item 71083 in backpack"); diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index 5da2139e999..474386813a8 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -1614,6 +1614,140 @@ class spell_gen_ribbon_pole_dancer_check : public SpellScriptLoader } }; +enum DarkmoonDeathmatch +{ + AREA_ID_DARKMOON_DEATHMATCH = 5877, + + SPELL_ENTER_DEATHMATCH_1 = 108919, + SPELL_ENTER_DEATHMATCH_2 = 113212, + SPELL_ENTER_DEATHMATCH_3 = 113213, + SPELL_ENTER_DEATHMATCH_4 = 113216, + SPELL_ENTER_DEATHMATCH_5 = 113219, + SPELL_ENTER_DEATHMATCH_6 = 113224, + SPELL_ENTER_DEATHMATCH_7 = 113227, + SPELL_ENTER_DEATHMATCH_8 = 113228, + SPELL_EXIT_DEATHMATCH = 108923, + +}; + +uint32 enterDeathMatchSpells[] = +{ + SPELL_ENTER_DEATHMATCH_1, + SPELL_ENTER_DEATHMATCH_2, + SPELL_ENTER_DEATHMATCH_3, + SPELL_ENTER_DEATHMATCH_4, + SPELL_ENTER_DEATHMATCH_5, + SPELL_ENTER_DEATHMATCH_6, + SPELL_ENTER_DEATHMATCH_7, + SPELL_ENTER_DEATHMATCH_8 +}; + +class spell_darkmoon_island_deathmatch : public SpellScript +{ + PrepareSpellScript(spell_darkmoon_island_deathmatch); + + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( + { + SPELL_ENTER_DEATHMATCH_1, + SPELL_ENTER_DEATHMATCH_2, + SPELL_ENTER_DEATHMATCH_3, + SPELL_ENTER_DEATHMATCH_4, + SPELL_ENTER_DEATHMATCH_5, + SPELL_ENTER_DEATHMATCH_6, + SPELL_ENTER_DEATHMATCH_7, + SPELL_ENTER_DEATHMATCH_8, + SPELL_EXIT_DEATHMATCH + }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* target = GetHitUnit(); + if (target->GetAreaId() == AREA_ID_DARKMOON_DEATHMATCH) + target->CastSpell(target, SPELL_EXIT_DEATHMATCH); + else + { + uint8 i = urand(0, 7); + target->CastSpell(target, enterDeathMatchSpells[i]); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_darkmoon_island_deathmatch::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +enum RingToss +{ + SPELL_RING_TOSS_HIT = 101699, + SPELL_RING_TOSS_MISS = 101698, + SPELL_RING_TOSS_AURA = 102058 +}; + +class spell_darkmoon_island_ring_toss : public SpellScript +{ + PrepareSpellScript(spell_darkmoon_island_ring_toss); + + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( + { + SPELL_RING_TOSS_HIT, + SPELL_RING_TOSS_MISS, + SPELL_RING_TOSS_AURA + }); + } + + bool Load() override + { + _hasHit = false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + Unit* target = GetHitUnit(); + Position destination = GetExplTargetDest()->GetPosition(); + + if (target->GetExactDist2d(destination) <= 1.0f) + caster->CastSpell(target, SPELL_RING_TOSS_HIT, true); + else + caster->CastSpell(destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ(), SPELL_RING_TOSS_MISS, true); + _hasHit = true; + } + + void HandleAfterCast() + { + Unit* caster = GetCaster(); + + if (!_hasHit) + { + printf("no hit! \n"); + Position destination = GetExplTargetDest()->GetPosition(); + caster->CastSpell(destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ(), SPELL_RING_TOSS_MISS, true); + } + + if (!caster->GetPower(POWER_ALTERNATE_POWER)) + caster->RemoveAurasDueToSpell(SPELL_RING_TOSS_AURA); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_darkmoon_island_ring_toss::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + AfterCast += SpellCastFn(spell_darkmoon_island_ring_toss::HandleAfterCast); + } + +private: + bool _hasHit; +}; + void AddSC_holiday_spell_scripts() { // Love is in the Air @@ -1664,4 +1798,7 @@ void AddSC_holiday_spell_scripts() // Midsummer Fire Festival new spell_midsummer_braziers_hit(); new spell_gen_ribbon_pole_dancer_check(); + // Darkmoon Island + RegisterSpellScript(spell_darkmoon_island_deathmatch); + RegisterSpellScript(spell_darkmoon_island_ring_toss); }