DB/Scripts: Yenniku (move npc_yenniku to SAI)

(cherry picked from commit a7f3d5e59fd05d1f015ea0ad7426292d36b3dee8)
This commit is contained in:
Andrew Letson
2021-01-08 21:12:11 +01:00
committed by funjoker
parent 7204bb35e3
commit f79480bf9d
3 changed files with 15 additions and 139 deletions
@@ -0,0 +1,15 @@
--
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 2530;
DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryorguid` = 2530;
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
(2530, 0, 0, 1, 8, 0, 100, 0, 3607, 0, 0, 0, 17, 64, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Yenniku - On Spellhit \'Yenniku\'s Release\' - Set Emote State Stun'),
(2530, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 2, 83, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Yenniku - On Spellhit \'Yenniku\'s Release\' - Set Faction Horde'),
(2530, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 67, 0, 60000, 60000, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Yenniku - On Spellhit \'Yenniku\'s Release\' - Create Timed Event'),
(2530, 0, 3, 4, 59, 0, 100, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Yenniku - On Timed Event 0 Triggered - Evade'),
(2530, 0, 4, 5, 61, 0, 100, 0, 0, 0, 0, 0, 2, 28, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Yenniku - On Timed Event 0 Triggered - Set Faction Bloodscalp Trolls'),
(2530, 0, 5, 0, 61, 0, 100, 0, 0, 0, 0, 0, 17, 30, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Yenniku - On Timed Event 0 Triggered - Set Emote State Default');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceGroup` IN (1,7) AND `SourceEntry`=2530 AND `SourceId`=0;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(22, 1, 2530, 0, 0, 9, 0, 592, 0, 0, 0, 0, 0, '', 'Yenniku SAI event 0 will execute if quest Saving Yenniku has been taken.');
@@ -196,7 +196,6 @@ void AddSC_isle_of_queldanas();
void AddSC_redridge_mountains();
void AddSC_silverpine_forest();
void AddSC_stormwind_city();
void AddSC_stranglethorn_vale();
void AddSC_swamp_of_sorrows();
void AddSC_tirisfal_glades();
void AddSC_tol_barad();
@@ -389,7 +388,6 @@ void AddEasternKingdomsScripts()
AddSC_redridge_mountains();
AddSC_silverpine_forest();
AddSC_stormwind_city();
AddSC_stranglethorn_vale();
AddSC_swamp_of_sorrows();
AddSC_tirisfal_glades();
AddSC_tol_barad();
@@ -1,137 +0,0 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Stranglethorn_Vale
SD%Complete: 100
SDComment: Quest support: 592
SDCategory: Stranglethorn Vale
EndScriptData */
/* ContentData
npc_yenniku
EndContentData */
#include "ScriptMgr.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
/*######
## npc_yenniku
######*/
enum Yenniku
{
SPELL_YENNIKUS_RELEASE = 3607,
QUEST_SAVING_YENNIKU = 592,
};
class npc_yenniku : public CreatureScript
{
public:
npc_yenniku() : CreatureScript("npc_yenniku") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_yennikuAI(creature);
}
struct npc_yennikuAI : public ScriptedAI
{
npc_yennikuAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
bReset = false;
}
void Initialize()
{
Reset_Timer = 0;
}
uint32 Reset_Timer;
bool bReset;
void Reset() override
{
Initialize();
me->SetEmoteState(EMOTE_STATE_NONE);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (bReset || spell->Id != SPELL_YENNIKUS_RELEASE)
return;
if (Player* player = caster->ToPlayer())
{
if (player->GetQuestStatus(QUEST_SAVING_YENNIKU) == QUEST_STATUS_INCOMPLETE) // Yenniku's Release
{
me->SetEmoteState(EMOTE_STATE_STUN);
me->CombatStop(); //stop combat
me->GetThreatManager().ClearAllThreat(); //unsure of this
me->SetFaction(FACTION_HORDE_GENERIC);
bReset = true;
Reset_Timer = 60000;
}
}
}
void EnterCombat(Unit* /*who*/) override { }
void UpdateAI(uint32 diff) override
{
if (bReset)
{
if (Reset_Timer <= diff)
{
EnterEvadeMode();
bReset = false;
me->SetFaction(FACTION_TROLL_BLOODSCALP); // troll, bloodscalp
return;
}
Reset_Timer -= diff;
if (me->IsInCombat() && me->GetVictim())
{
if (Player* player = me->EnsureVictim()->ToPlayer())
{
if (player->GetTeam() == HORDE)
{
me->CombatStop();
me->GetThreatManager().ClearAllThreat();
}
}
}
}
//Return since we have no target
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
};
};
void AddSC_stranglethorn_vale()
{
new npc_yenniku();
}