mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Spells: Handle player talk in spell scripts pt 3 (#27657)
(cherry picked from commit e3409e277d)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
-- Torp
|
||||
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 13 AND `SourceEntry` = 45877;
|
||||
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
|
||||
(13,2,45877,0,0,31,0,3,25607,0,0,0,0,"","Group 0: Spell 'Deliver Kodo' (Effect 1) targets creature 'Farmer Torp'");
|
||||
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = 25607 AND `source_type` = 0;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = 2560700 AND `source_type` = 9;
|
||||
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`,`event_param5`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_param4`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
|
||||
(25607,0,0,0,8,0,100,0,45877,0,0,0,0,80,2560700,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Farmer Torp - On Spellhit 'Deliver Kodo' - Run Script"),
|
||||
|
||||
(2560700,9,0,0,0,0,100,0,3000,3000,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Farmer Torp - On Script - Say Line 0");
|
||||
|
||||
DELETE FROM `creature_text` WHERE `CreatureID` = 25607;
|
||||
INSERT INTO `creature_text` (`CreatureID`,`GroupID`,`ID`,`Text`,`Type`,`Language`,`Probability`,`Emote`,`Duration`,`Sound`,`BroadcastTextId`,`TextRange`,`comment`) VALUES
|
||||
(25607,0,0,"YES! It worked!",12,1,100,71,0,0,24883,0,"Farmer Torp"),
|
||||
(25607,0,1,"Great job!",12,1,100,71,0,0,24884,0,"Farmer Torp");
|
||||
|
||||
-- Kodo, his script need more updates
|
||||
UPDATE `smart_scripts` SET `link` = 0, `action_type` = 41, `action_param2` = 0, `target_type` = 1, `target_param1` = 0, `target_param2` = 0, `comment` = "Infected Kodo Beast - On Target Spell Hit 'Deliver Kodo' - Despawn" WHERE `entryorguid` = 25596 AND `source_type` = 0 AND `id` = 6;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = 25596 AND `source_type` = 0 AND `id` = 7;
|
||||
|
||||
DELETE FROM `spell_script_names` WHERE (
|
||||
`spell_id` = 45877 AND `ScriptName` = 'spell_deliver_kodo' OR
|
||||
`spell_id` = 48204 AND `ScriptName` = 'spell_kodo_delivered');
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(45877,'spell_deliver_kodo'),
|
||||
(48204,'spell_kodo_delivered');
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameObject.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -1893,6 +1894,69 @@ class spell_dispel_freed_soldier_debuff : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
/*######
|
||||
## Quest 11690: Bring 'Em Back Alive
|
||||
######*/
|
||||
|
||||
enum BringEmBackAlive
|
||||
{
|
||||
SPELL_KODO_DELIVERED = 48203,
|
||||
|
||||
TEXT_DELIVERED_1 = 24881,
|
||||
TEXT_DELIVERED_2 = 24882,
|
||||
TEXT_DELIVERED_3 = 26284,
|
||||
TEXT_DELIVERED_4 = 26285,
|
||||
TEXT_DELIVERED_5 = 26286
|
||||
};
|
||||
|
||||
// 45877 - Deliver Kodo
|
||||
class spell_deliver_kodo : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_deliver_kodo);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_KODO_DELIVERED });
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(caster, SPELL_KODO_DELIVERED, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_deliver_kodo::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 48204 - Kodo Delivered
|
||||
class spell_kodo_delivered : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_kodo_delivered);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return sBroadcastTextStore.HasRecord(TEXT_DELIVERED_1) &&
|
||||
sBroadcastTextStore.HasRecord(TEXT_DELIVERED_2) &&
|
||||
sBroadcastTextStore.HasRecord(TEXT_DELIVERED_3) &&
|
||||
sBroadcastTextStore.HasRecord(TEXT_DELIVERED_4) &&
|
||||
sBroadcastTextStore.HasRecord(TEXT_DELIVERED_5);
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->Unit::Say(RAND(TEXT_DELIVERED_1, TEXT_DELIVERED_2, TEXT_DELIVERED_3, TEXT_DELIVERED_4, TEXT_DELIVERED_5), caster);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_kodo_delivered::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_borean_tundra()
|
||||
{
|
||||
new npc_corastrasza();
|
||||
@@ -1917,4 +1981,6 @@ void AddSC_borean_tundra()
|
||||
RegisterSpellScript(spell_nerubar_web_random_unit_not_on_quest_dummy);
|
||||
RegisterSpellScript(spell_nerubar_web_random_unit_on_quest_dummy);
|
||||
RegisterSpellScript(spell_dispel_freed_soldier_debuff);
|
||||
RegisterSpellScript(spell_deliver_kodo);
|
||||
RegisterSpellScript(spell_kodo_delivered);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user