fix(Script/Quest): Doing Your Duty (#16923)

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Roddan
2023-08-06 18:17:38 +02:00
committed by GitHub
parent 98338e7499
commit e08ceb3d8d
4 changed files with 123 additions and 59 deletions

View File

@@ -0,0 +1,54 @@
-- Master Woodsman Anderhol smart ai
SET @ENTRY := 27277;
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, 20, 0, 100, 0, 12227, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On player rewarded quest Doing Your Duty (12227) - Self: Talk Alright Ben. We\'ve retrieved the amberseeds again. You know ... (0) to invoker'),
(@ENTRY, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 10, 113907, 27071, 0, 0, 0, 0, 0, 'On player rewarded quest Doing Your Duty (12227) - Creature Benjamin Jacobs (27071) with guid 113907 (fetching): Set creature data #0 to 0');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 22 AND `SourceEntry` = 27277 AND `SourceId` = 0;
DELETE FROM `creature_text` WHERE `CreatureID` = 27277;
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(27277, 0, 0, 'Alright Ben. We\'ve retrieved the amberseeds again. You know the drill.', 12, 0, 100, 0, 0, 0, 26350, 0, 'Master Woodsman Anderhol // Master Woodsman Anderhol');
DELETE FROM `creature_text` WHERE `CreatureID` = 27071;
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(27071, 0, 0, 'I know, I know. Back in the bucket....', 12, 0, 100, 0, 0, 0, 26351, 0, 'Benjamin Jacobs // Benjamin Jacobs');
DELETE FROM `waypoints` WHERE (`entry` = 27071) AND (`pointid` IN (1, 2));
DELETE FROM `waypoints` WHERE (`entry` = 2707100) AND (`pointid` BETWEEN 1 AND 13);
INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `point_comment`) VALUES
(27071, 1, 3405.55, -2792.33, 201.809, NULL, 0, NULL),
(27071, 2, 3414.19, -2795.07, 201.514, NULL, 0, NULL),
(2707100, 1, 3416.03, -2792.59, 201.818, NULL, 0, NULL),
(2707100, 2, 3416.28, -2791.84, 201.818, NULL, 0, NULL),
(2707100, 3, 3420.28, -2786.09, 201.818, NULL, 0, NULL),
(2707100, 4, 3421, -2785.11, 201.657, NULL, 0, NULL),
(2707100, 5, 3421.46, -2784.44, 201.777, NULL, 0, NULL),
(2707100, 6, 3422.37, -2783.12, 202.621, NULL, 0, NULL),
(2707100, 7, 3422.38, -2783.11, 202.614, NULL, 0, NULL),
(2707100, 8, 3423.12, -2782.5, 202.625, NULL, 0, NULL),
(2707100, 9, 3424.93, -2780.98, 202.628, NULL, 0, NULL),
(2707100, 10, 3426.54, -2779.83, 202.889, NULL, 0, NULL),
(2707100, 11, 3427.29, -2779.33, 202.889, NULL, 0, NULL),
(2707100, 12, 3428.04, -2779.33, 202.889, NULL, 0, NULL),
(2707100, 13, 3431.14, -2779.69, 202.65, NULL, 0, NULL);
-- Benjamin Jacobs smart ai
SET @ENTRY := 27071;
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, 38, 0, 100, 0, 0, 0, 0, 0, 53, 0, 27071, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On data[0] set to 0 - Self: Start path #27071, walk, do not repeat, Passive'),
(@ENTRY, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 67, 1, 6000, 6000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'On data[0] set to 0 - Trigger timed event timedEvent[1] in 6000 - 6000 ms // -meta_wait'),
(@ENTRY, 0, 2, 3, 61, 0, 100, 0, 0, 0, 0, 0, 67, 2, 14000, 14000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'On data[0] set to 0 - Trigger timed event timedEvent[2] in 14000 - 14000 ms // -meta_wait'),
(@ENTRY, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 67, 3, 24000, 24000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'On data[0] set to 0 - Trigger timed event timedEvent[3] in 24000 - 24000 ms // -meta_wait'),
(@ENTRY, 0, 4, 0, 59, 0, 100, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On timed event timedEvent[1] triggered - Self: Talk I know, I know. Back in the bucket.... (0) to invoker'),
(@ENTRY, 0, 5, 0, 59, 0, 100, 0, 2, 0, 0, 0, 53, 0, 2707100, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On timed event timedEvent[2] triggered - Self: Start path #2707100, walk, do not repeat, Passive'),
(@ENTRY, 0, 6, 7, 59, 0, 100, 0, 3, 0, 0, 0, 90, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On timed event timedEvent[3] triggered - Self: Set stand state to KNEEL'),
(@ENTRY, 0, 7, 0, 61, 0, 100, 0, 0, 0, 0, 0, 41, 6000, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On timed event timedEvent[3] triggered - Self: Despawn in 6 s respawn in 1 seconds'),
(@ENTRY, 0, 8, 0, 11, 0, 100, 0, 0, 0, 0, 0, 91, 8, 0, 0, 0, 0, 0, 10, 113907, 27071, 0, 0, 0, 0, 0, 'On respawn - Creature Benjamin Jacobs (27071) with guid 113907 (fetching): Remove stand state KNEEL');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 22 AND `SourceEntry` = 27071 AND `SourceId` = 0;

View File

@@ -0,0 +1,13 @@
UPDATE `creature_template` SET `scriptname` = '' WHERE `entry` = 27326;
DELETE FROM `spell_target_position` WHERE `ID` = 48324 AND `EffectIndex` = 0;
INSERT INTO `spell_target_position` (`ID`, `EffectIndex`, `MapID`, `PositionX`, `PositionY`, `PositionZ`, `Orientation`, `VerifiedBuild`) VALUES
(48324, 0, 571, 3454.11, -2802.37, 202.14, 0, 34149345);
DELETE FROM `spell_script_names` WHERE `spell_id` IN (48382, 47533);
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(48382, 'spell_q12227_outhouse_groans'),
(47533, 'spell_q12227_camera_shake');
UPDATE `creature_template` SET `flags_extra`=`flags_extra`|128 WHERE `entry` =27326;

View File

@@ -328,65 +328,69 @@ enum Outhouse
SOUND_FEMALE = 12671,
SOUND_MALE = 12670,
// Spell
SPELL_OUTHOUSE_GROANS = 48382,
SPELL_CAMERA_SHAKE = 47533,
SPELL_DUST_FIELD = 48329
SPELL_DUST_FIELD = 48329,
// Item
ITEM_ANDERHOLS_SLIDER_CIDER = 37247,
// NPC
NPC_OUTHOUSE_BUNNY_GRIZZLY = 27326,
};
class npc_outhouse_bunny : public CreatureScript
class spell_q12227_outhouse_groans : public SpellScript
{
public:
npc_outhouse_bunny() : CreatureScript("npc_outhouse_bunny") { }
PrepareSpellScript(spell_q12227_outhouse_groans);
struct npc_outhouse_bunnyAI : public ScriptedAI
bool Validate(SpellInfo const* /*spellInfo*/) override
{
npc_outhouse_bunnyAI(Creature* creature) : ScriptedAI(creature) { }
return ValidateSpellInfo({ SPELL_CAMERA_SHAKE, SPELL_DUST_FIELD });
}
void Reset() override
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetCaster()->ToPlayer())
{
_counter = 0;
_gender = 0;
}
player->CastSpell(player, SPELL_CAMERA_SHAKE, true);
void SetData(uint32 Type, uint32 Data) override
{
if (Type == 1)
_gender = Data;
}
void SpellHit(Unit* Caster, SpellInfo const* Spell) override
{
if (Spell->Id == SPELL_OUTHOUSE_GROANS)
switch (GetCaster()->getGender())
{
++_counter;
if (_counter < 5)
DoCast(Caster, SPELL_CAMERA_SHAKE, true);
else
_counter = 0;
DoCast(me, SPELL_DUST_FIELD, true);
switch (_gender)
{
case GENDER_FEMALE:
DoPlaySoundToSet(me, SOUND_FEMALE);
break;
case GENDER_MALE:
DoPlaySoundToSet(me, SOUND_MALE);
break;
}
case GENDER_FEMALE:
player->PlayDirectSound(SOUND_FEMALE);
break;
case GENDER_MALE:
player->PlayDirectSound(SOUND_MALE);
break;
default:
break;
}
}
private:
uint8 _counter;
uint8 _gender;
};
}
CreatureAI* GetAI(Creature* creature) const override
void Register() override
{
return new npc_outhouse_bunnyAI(creature);
OnEffectHitTarget += SpellEffectFn(spell_q12227_outhouse_groans::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_q12227_camera_shake : public SpellScript
{
PrepareSpellScript(spell_q12227_camera_shake);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DUST_FIELD });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetCaster()->ToPlayer())
if (Creature* target = GetClosestCreatureWithEntry(player, NPC_OUTHOUSE_BUNNY_GRIZZLY, 3.0f)) // hackfix: Outhouse bunny doesnt show in any script. But the visual of Dust Field do not show if cast by the player
target->CastSpell(target, SPELL_DUST_FIELD, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q12227_camera_shake::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// Tallhorn Stage
enum TallhornStage
@@ -1300,7 +1304,6 @@ void AddSC_grizzly_hills()
new npc_emily();
new npc_mrfloppy();
new npc_ravenous_worg();
new npc_outhouse_bunny();
new npc_tallhorn_stag();
new npc_amberpine_woodsman();
RegisterCreatureAI(npc_wounded_skirmisher);
@@ -1314,4 +1317,6 @@ void AddSC_grizzly_hills()
new spell_warhead_detonate();
new spell_vehicle_warhead_fuse();
new spell_warhead_fuse();
RegisterSpellScript(spell_q12227_outhouse_groans);
RegisterSpellScript(spell_q12227_camera_shake);
}

View File

@@ -1612,19 +1612,17 @@ public:
## go_amberpine_outhouse
######*/
#define GOSSIP_USE_OUTHOUSE "Use the outhouse."
#define GO_ANDERHOLS_SLIDER_CIDER_NOT_FOUND "Quest item Anderhol's Slider Cider not found."
enum AmberpineOuthouse
{
ITEM_ANDERHOLS_SLIDER_CIDER = 37247,
NPC_OUTHOUSE_BUNNY = 27326,
QUEST_DOING_YOUR_DUTY = 12227,
SPELL_INDISPOSED = 53017,
SPELL_INDISPOSED_II = 48324,
SPELL_INDISPOSED_III = 48341,
SPELL_CREATE_AMBERSEEDS = 48330,
GOSSIP_OUTHOUSE_INUSE = 12775,
GOSSIP_OUTHOUSE_VACANT = 12779
GOSSIP_OUTHOUSE_VACANT = 12779,
GOSSIP_USE_OUTHOUSE = 9492,
};
class go_amberpine_outhouse : public GameObjectScript
@@ -1637,7 +1635,7 @@ public:
QuestStatus status = player->GetQuestStatus(QUEST_DOING_YOUR_DUTY);
if (status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_USE_OUTHOUSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
AddGossipItemFor(player, GOSSIP_USE_OUTHOUSE, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
SendGossipMenuFor(player, GOSSIP_OUTHOUSE_VACANT, go->GetGUID());
}
else
@@ -1646,21 +1644,15 @@ public:
return true;
}
bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action) override
bool OnGossipSelect(Player* player, GameObject* /*go*/, uint32 /*sender*/, uint32 action) override
{
ClearGossipMenuFor(player);
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
CloseGossipMenuFor(player);
Creature* target = GetClosestCreatureWithEntry(player, NPC_OUTHOUSE_BUNNY, 3.0f);
if (target)
{
target->AI()->SetData(1, player->getGender());
go->CastSpell(target, SPELL_INDISPOSED_III);
}
go->CastSpell(player, SPELL_INDISPOSED);
if (player->HasItemCount(ITEM_ANDERHOLS_SLIDER_CIDER))
player->CastSpell(player, SPELL_CREATE_AMBERSEEDS, true);
player->CastSpell(player, SPELL_INDISPOSED);
player->CastSpell(player, SPELL_INDISPOSED_II);
player->CastSpell(player, SPELL_INDISPOSED_III);
return true;
}
else