mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-13 23:43:44 +00:00
fix(Scripts/Underbog): Moved Gha'zan script to C++ file. (#13887)
* fix(Scripts/Underbog)L Moved Gha'zan script to C++ file. Added scripted waypoints. Fixes #13793 * Update. * missing player include * Update. Co-authored-by: Angelo Venturini <nefertum.dev@protonmail.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
--
|
||||
UPDATE `creature` SET `position_x`=193.68, `position_y`=-425.001, `position_z`=43.536, `orientation`=4.910, `MovementType`=2 WHERE `id1`=18105;
|
||||
|
||||
SET @CGUID := (SELECT `guid` FROM `creature` WHERE `id1`=18105);
|
||||
DELETE FROM `creature_addon` WHERE `guid`=@CGUID;
|
||||
INSERT INTO `creature_addon` VALUES
|
||||
(@CGUID,@CGUID*10,0,0,1,0,0,'');
|
||||
|
||||
DELETE FROM `waypoint_data` WHERE `id` IN (@CGUID*10,(@CGUID*10)+1);
|
||||
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES
|
||||
(@CGUID*10,1,220.287480,-447.83450,43.72291,0,0,0,0,100,0),
|
||||
(@CGUID*10,2,217.265560,-424.75412,45.52847,0,0,0,0,100,0),
|
||||
(@CGUID*10,3,225.281620,-398.65262,45.47290,0,0,0,0,100,0),
|
||||
(@CGUID*10,4,253.491170,-397.89430,45.52849,0,0,0,0,100,0),
|
||||
(@CGUID*10,5,253.131480,-414.29672,44.77849,0,0,0,0,100,0),
|
||||
(@CGUID*10,6,234.916290,-424.61800,44.61180,0,0,0,0,100,0),
|
||||
(@CGUID*10,7,223.580960,-426.78760,44.61183,0,0,0,0,100,0),
|
||||
(@CGUID*10,8,204.304470,-431.26736,44.13958,0,0,0,0,100,0),
|
||||
(@CGUID*10,9,196.254750,-456.66520,42.61182,0,0,0,0,100,0),
|
||||
(@CGUID*10,10,223.04488,-479.07944,32.47294,0,0,0,0,100,0),
|
||||
(@CGUID*10,11,263.47906,-480.66202,46.80626,0,0,0,0,100,0),
|
||||
(@CGUID*10,12,278.39508,-477.34967,43.88961,0,0,0,0,100,0),
|
||||
(@CGUID*10,13,276.92447,-457.94210,37.05632,0,0,0,0,100,0),
|
||||
(@CGUID*10,14,276.92447,-457.94210,37.05632,0,0,0,0,100,0),
|
||||
(@CGUID*10,15,275.60797,-469.67816,33.47302,0,0,0,0,100,0),
|
||||
(@CGUID*10,16,276.92447,-457.94210,37.05631,0,0,0,0,100,0),
|
||||
(@CGUID*10,17,278.24097,-446.20605,40.63961,0,0,0,0,100,0),
|
||||
(@CGUID*10,18,260.68362,-421.50210,43.44514,0,0,0,0,100,0),
|
||||
(@CGUID*10,19,233.34468,-409.80292,45.11180,0,0,0,0,100,0),
|
||||
(@CGUID*10,20,193.74000,-423.40268,43.58399,0,0,0,0,100,0),
|
||||
|
||||
((@CGUID*10)+1,1,276.92447,-457.9421,37.05632,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,2,230.84842,-473.81586,44.384487,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,3,223.15588,-474.34158,46.36878,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,4,214.68163,-479.58606,52.51196,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,5,200.88074,-483.32407,58.438652,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,6,185.70932,-485.64243,64.15632,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,7,175.2845,-486.21573,67.86781,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,8,160.93648,-476.7256,74.70425,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,9,158.37117,-472.06967,74.63962,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,10,159.37047,-467.53186,75.40111,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,11,180.78477,-471.30957,77.03179,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,12,189.26646,-471.74365,77.766594,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,13,200.31303,-472.0223,79.02495,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,14,212.294,-480.27985,80.729095,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,15,222.19577,-476.2322,81.27319,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,16,233.52731,-471.28235,81.37284,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,17,239.5655,-468.65033,81.37284,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,18,248.33444,-465.86627,81.37284,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,19,260.44455,-457.9094,81.37284,0,0,0,0,100,0),
|
||||
((@CGUID*10)+1,20,256.2785,-458.73138,81.37284,3.543018341064453125,0,0,0,100,0);
|
||||
|
||||
DELETE FROM `areatrigger_scripts` WHERE `entry`=4302;
|
||||
INSERT INTO `areatrigger_scripts` VALUES
|
||||
(4302,'at_underbog_ghazan');
|
||||
|
||||
DELETE FROM `spelldifficulty_dbc` WHERE `ID`=34267;
|
||||
INSERT INTO `spelldifficulty_dbc` VALUES
|
||||
(34267,34267,38737,0,0);
|
||||
|
||||
UPDATE `creature_template` SET `AiName`='', `ScriptName`='boss_ghazan' WHERE `entry`=18105;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid`=18105;
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore 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 Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 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 Affero 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/>.
|
||||
*/
|
||||
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellScript.h"
|
||||
#include "the_underbog.h"
|
||||
|
||||
enum eBlackStalker
|
||||
{
|
||||
SPELL_ACID_BREATH = 34268,
|
||||
SPELL_ACID_SPIT = 34290,
|
||||
SPELL_TAIL_SWEEP = 34267,
|
||||
SPELL_ENRAGE = 15716,
|
||||
|
||||
EVENT_ACID_BREATH = 1,
|
||||
EVENT_ACID_SPIT = 2,
|
||||
EVENT_TAIL_SWEEP = 3,
|
||||
|
||||
ACTION_MOVE_TO_PLATFORM = 1
|
||||
};
|
||||
|
||||
struct boss_ghazan : public ScriptedAI
|
||||
{
|
||||
boss_ghazan(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
}
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
_movedToPlatform = false;
|
||||
_reachedPlatform = false;
|
||||
Reset();
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
events.Reset();
|
||||
_enraged = false;
|
||||
if (!_reachedPlatform)
|
||||
{
|
||||
_movedToPlatform = false;
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit*) override
|
||||
{
|
||||
events.ScheduleEvent(EVENT_ACID_BREATH, 3s);
|
||||
events.ScheduleEvent(EVENT_ACID_SPIT, 1s);
|
||||
events.ScheduleEvent(EVENT_TAIL_SWEEP, DUNGEON_MODE<Milliseconds>(5900ms, 10s));
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*type*/, SpellSchoolMask /*school*/) override
|
||||
{
|
||||
if (!_enraged && me->HealthBelowPctDamaged(20, damage))
|
||||
{
|
||||
_enraged = true;
|
||||
DoCastSelf(SPELL_ENRAGE);
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 type) override
|
||||
{
|
||||
if (type == ACTION_MOVE_TO_PLATFORM && !_movedToPlatform)
|
||||
{
|
||||
_movedToPlatform = true;
|
||||
me->GetMotionMaster()->MovePath((me->GetSpawnId() * 10) + 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 pointId) override
|
||||
{
|
||||
if (!_movedToPlatform || type != WAYPOINT_MOTION_TYPE || pointId != 19)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_reachedPlatform = true;
|
||||
me->SetHomePosition(me->GetPosition());
|
||||
|
||||
me->m_Events.AddEventAtOffset([this]()
|
||||
{
|
||||
me->StopMoving();
|
||||
me->GetMotionMaster()->MoveRandom(12.f);
|
||||
}, 1ms);
|
||||
}
|
||||
|
||||
void JustReachedHome() override
|
||||
{
|
||||
if (_reachedPlatform)
|
||||
{
|
||||
me->GetMotionMaster()->MoveRandom(12.f);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_ACID_BREATH:
|
||||
DoCastVictim(SPELL_ACID_BREATH);
|
||||
events.Repeat(7s, 9s);
|
||||
break;
|
||||
case EVENT_ACID_SPIT:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
|
||||
{
|
||||
DoCast(target, SPELL_ACID_SPIT);
|
||||
}
|
||||
events.Repeat(7s, 9s);
|
||||
break;
|
||||
case EVENT_TAIL_SWEEP:
|
||||
DoCastVictim(SPELL_TAIL_SWEEP);
|
||||
events.Repeat(7s, 9s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
bool _enraged;
|
||||
bool _movedToPlatform;
|
||||
bool _reachedPlatform;
|
||||
};
|
||||
|
||||
class at_underbog_ghazan : public OnlyOnceAreaTriggerScript
|
||||
{
|
||||
public:
|
||||
at_underbog_ghazan() : OnlyOnceAreaTriggerScript("at_underbog_ghazan") {}
|
||||
|
||||
bool _OnTrigger(Player* player, const AreaTrigger* /*at*/) override
|
||||
{
|
||||
if (InstanceScript* instance = player->GetInstanceScript())
|
||||
{
|
||||
if (Creature* ghazan = ObjectAccessor::GetCreature(*player, instance->GetGuidData(NPC_GHAZAN)))
|
||||
{
|
||||
ghazan->AI()->DoAction(ACTION_MOVE_TO_PLATFORM);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_ghazan()
|
||||
{
|
||||
RegisterUnderbogCreatureAI(boss_ghazan);
|
||||
new at_underbog_ghazan();
|
||||
}
|
||||
@@ -15,13 +15,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
This placeholder for the instance is needed for dungeon finding to be able
|
||||
to give credit after the boss defined in lastEncounterDungeon is killed.
|
||||
Without it, the party doing random dungeon won't get satchel of spoils and
|
||||
gets instead the deserter debuff.
|
||||
*/
|
||||
|
||||
#include "InstanceScript.h"
|
||||
#include "Map.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -40,6 +33,36 @@ public:
|
||||
struct instance_the_underbog_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
instance_the_underbog_InstanceMapScript(Map* map) : InstanceScript(map) { }
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
{
|
||||
InstanceScript::OnCreatureCreate(creature);
|
||||
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_GHAZAN:
|
||||
_ghazanGUID = creature->GetGUID();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ObjectGuid GetGuidData(uint32 type) const override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case NPC_GHAZAN:
|
||||
return _ghazanGUID;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ObjectGuid::Empty;
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectGuid _ghazanGUID;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -22,10 +22,17 @@
|
||||
|
||||
#define TheUnderbogScriptName "instance_the_underbog"
|
||||
|
||||
enum NPCs
|
||||
{
|
||||
NPC_GHAZAN = 18105
|
||||
};
|
||||
|
||||
template <class AI, class T>
|
||||
inline AI* GetTheUnderbogAI(T* obj)
|
||||
{
|
||||
return GetInstanceAI<AI>(obj, TheUnderbogScriptName);
|
||||
}
|
||||
|
||||
#define RegisterUnderbogCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetTheUnderbogAI)
|
||||
|
||||
#endif // the_underbog_h__
|
||||
|
||||
@@ -51,6 +51,7 @@ void AddSC_boss_mekgineer_steamrigger();
|
||||
void AddSC_boss_warlord_kalithresh();
|
||||
void AddSC_instance_steam_vault();
|
||||
void AddSC_boss_the_black_stalker(); //CR Underbog
|
||||
void AddSC_boss_ghazan();
|
||||
void AddSC_instance_the_underbog();
|
||||
void AddSC_boss_ahune();
|
||||
void AddSC_instance_the_slave_pens();
|
||||
@@ -144,6 +145,7 @@ void AddOutlandScripts()
|
||||
AddSC_boss_warlord_kalithresh();
|
||||
AddSC_instance_steam_vault();
|
||||
AddSC_boss_the_black_stalker(); //CR Underbog
|
||||
AddSC_boss_ghazan();
|
||||
AddSC_instance_the_underbog();
|
||||
AddSC_boss_ahune();
|
||||
AddSC_instance_the_slave_pens();
|
||||
|
||||
Reference in New Issue
Block a user