Core/Spells: implement generic shop keeper greeting spells and use them for a couple Stormwind Vendors

This commit is contained in:
Ovahlord committed 2023-07-18 00:02:21 +02:00
1 parent 6c1c91b6b2
commit 12a3e9e64c
3 files changed
+152

No files matched your search

@@ -0,0 +1,66 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN
('spell_gen_dalaran_shop_keeper_greeting_periodic',
'spell_gen_dalaran_shop_keeper_greeting_aoe',
'spell_gen_dalaran_shop_keeper_greeting_ping');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(60913, 'spell_gen_dalaran_shop_keeper_greeting_periodic'),
(60912, 'spell_gen_dalaran_shop_keeper_greeting_aoe'),
(60909, 'spell_gen_dalaran_shop_keeper_greeting_ping');
DELETE FROM `creature_text` WHERE `CreatureID` IN (1286, 1299, 1297, 1295);
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
-- Edna Mullby
(1286, 0, 0, 'Welcome. May I help you find something?', 12, 7, 100, 3, 0, 0, 32811, 0, ''),
(1286, 0, 1, 'Greetings.', 12, 7, 100, 3, 0, 0, 32935, 0, ''),
(1286, 0, 2, 'Greetings, $c.', 12, 7, 100, 3, 0, 0, 32808, 0, ''),
(1286, 0, 3, 'Welcome.', 12, 7, 100, 3, 0, 0, 32936, 0, ''),
(1286, 0, 4, 'Welcome!', 12, 7, 100, 3, 0, 0, 32807, 0, ''),
(1286, 0, 5, 'Let me know if you need help finding anything, $c.', 12, 7, 100, 3, 0, 0, 32810, 0, ''),
-- Lina Stover
(1297, 0, 0, 'Welcome. May I help you find something?', 12, 7, 100, 3, 0, 0, 32811, 0, ''),
(1297, 0, 1, 'Greetings.', 12, 7, 100, 3, 0, 0, 32935, 0, ''),
(1297, 0, 2, 'Greetings, $c.', 12, 7, 100, 3, 0, 0, 32808, 0, ''),
(1297, 0, 3, 'Welcome.', 12, 7, 100, 3, 0, 0, 32936, 0, ''),
(1297, 0, 4, 'Welcome!', 12, 7, 100, 3, 0, 0, 32807, 0, ''),
(1297, 0, 5, 'Let me know if you need help finding anything, $c.', 12, 7, 100, 3, 0, 0, 32810, 0, ''),
-- Lara Moore
(1295, 0, 0, 'Welcome. May I help you find something?', 12, 7, 100, 3, 0, 0, 32811, 0, ''),
(1295, 0, 1, 'Greetings.', 12, 7, 100, 3, 0, 0, 32935, 0, ''),
(1295, 0, 2, 'Greetings, $c.', 12, 7, 100, 3, 0, 0, 32808, 0, ''),
(1295, 0, 3, 'Welcome.', 12, 7, 100, 3, 0, 0, 32936, 0, ''),
(1295, 0, 4, 'Welcome!', 12, 7, 100, 3, 0, 0, 32807, 0, ''),
(1295, 0, 5, 'Let me know if you need help finding anything, $c.', 12, 7, 100, 3, 0, 0, 32810, 0, '');
-- Edna Mullby smart ai
SET @ENTRY := 1286;
DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = @ENTRY;
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
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, 1, 8, 0, 100, 0, 60909, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Self: Talk Welcome. May I help you find something? (0) to invoker'),
(@ENTRY, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Self: Look at Caster'),
(@ENTRY, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 67, 1, 5000, 5000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Trigger timed event timedEvent[1] in 5000 - 5000 ms // -meta_wait'),
(@ENTRY, 0, 3, 0, 59, 0, 100, 0, 1, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On timed event timedEvent[1] triggered - Self: Set orientation to home position orientation');
-- Lina Stover smart ai
SET @ENTRY := 1297;
DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = @ENTRY;
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
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, 1, 8, 0, 100, 0, 60909, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Self: Talk Welcome. May I help you find something? (0) to invoker'),
(@ENTRY, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Self: Look at Caster'),
(@ENTRY, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 67, 1, 5000, 5000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Trigger timed event timedEvent[1] in 5000 - 5000 ms // -meta_wait'),
(@ENTRY, 0, 3, 0, 59, 0, 100, 0, 1, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On timed event timedEvent[1] triggered - Self: Set orientation to home position orientation');
-- Lara Moore smart ai
SET @ENTRY := 1295;
DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = @ENTRY;
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
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, 1, 8, 0, 100, 0, 60909, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Self: Talk Welcome. May I help you find something? (0) to invoker'),
(@ENTRY, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Self: Look at Caster'),
(@ENTRY, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 67, 1, 5000, 5000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'On spell Dalaran - Shop Keeper Greeting (60909) hit - Trigger timed event timedEvent[1] in 5000 - 5000 ms // -meta_wait'),
(@ENTRY, 0, 3, 0, 59, 0, 100, 0, 1, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On timed event timedEvent[1] triggered - Self: Set orientation to home position orientation');
UPDATE `creature_template_addon` SET `auras`= '60913' WHERE `entry` IN (1286, 1299, 1297, 1295);
+6
View File
@@ -5970,6 +5970,12 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(12); // Interact Range
});
// [DND] Dalaran - Shop Keeper Greeting
ApplySpellFix({ 60909 }, [](SpellInfo* spellInfo)
{
spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT;
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo* spellInfo = mSpellInfoMap[i];
@@ -5532,6 +5532,83 @@ uint32 const spell_gen_polymorph_cast_visual::PolymorhForms[6] =
SPELL_MAGE_SHEEP_FORM
};
enum DalaranShopKeeper
{
SPELL_DALARAN_SHOP_KEEPER_AOE = 60912,
SPELL_DALARAN_SHOP_KEEPER_PING = 60909,
SPELL_DALARAN_SHOP_KEEPER_DUMMY_AURA = 61354
};
// 60913 - [DND] Dalaran - Shop Keeper Greeting
class spell_gen_dalaran_shop_keeper_greeting_periodic : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DALARAN_SHOP_KEEPER_AOE, SPELL_DALARAN_SHOP_KEEPER_DUMMY_AURA });
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
if (!GetTarget()->HasAura(SPELL_DALARAN_SHOP_KEEPER_DUMMY_AURA))
GetTarget()->CastSpell(nullptr, SPELL_DALARAN_SHOP_KEEPER_AOE);
}
void Register() override
{
OnEffectPeriodic.Register(&spell_gen_dalaran_shop_keeper_greeting_periodic::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
// 60912 - [DND] Dalaran - Shop Keeper Greeting
class spell_gen_dalaran_shop_keeper_greeting_aoe : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DALARAN_SHOP_KEEPER_PING });
}
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
GetTarget()->CastSpell(nullptr, SPELL_DALARAN_SHOP_KEEPER_PING, CastSpellExtraArgs(TRIGGERED_FULL_MASK).SetCustomArg(caster->GetGUID()));
}
void Register() override
{
AfterEffectApply.Register(&spell_gen_dalaran_shop_keeper_greeting_aoe::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
// 60909 - [DND] Dalaran - Shop Keeper Greeting
class spell_gen_dalaran_shop_keeper_greeting_ping : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DALARAN_SHOP_KEEPER_DUMMY_AURA });
}
// We are going to skip an endless number of condition entries and just provide the target guid right away.
void SelectVendor(WorldObject*& target)
{
if (GetSpell()->m_customArg.has_value())
{
ObjectGuid targetGuid = std::any_cast<ObjectGuid>(GetSpell()->m_customArg);
target = ObjectAccessor::GetCreature(*GetCaster(), targetGuid);
}
}
void HandleDummyEffect(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->CastSpell(nullptr, SPELL_DALARAN_SHOP_KEEPER_DUMMY_AURA);
}
void Register() override
{
OnEffectHitTarget.Register(&spell_gen_dalaran_shop_keeper_greeting_ping::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
OnObjectTargetSelect.Register(&spell_gen_dalaran_shop_keeper_greeting_ping::SelectVendor, EFFECT_0, TARGET_UNIT_NEARBY_ENTRY);
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -5562,6 +5639,9 @@ void AddSC_generic_spell_scripts()
new spell_gen_creature_permanent_feign_death();
new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise");
new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise");
RegisterSpellScript(spell_gen_dalaran_shop_keeper_greeting_periodic);
RegisterSpellScript(spell_gen_dalaran_shop_keeper_greeting_aoe);
RegisterSpellScript(spell_gen_dalaran_shop_keeper_greeting_ping);
new spell_gen_decay_over_time_fungal_decay();
new spell_gen_decay_over_time_tail_sting();
new spell_gen_defend();