Merge 4a347d2a666952f62acc3b9f81a8efa4f086d41e into f6c4164765afe447476114e632ee3d70b04a1777
This commit is contained in:
commit
921feacdb3
@ -0,0 +1,3 @@
|
||||
-- Remove SmartAI sql for NPC Jenny (25969)
|
||||
DELETE FROM `smart_scripts`
|
||||
WHERE `entryorguid` = 25969;
|
||||
@ -62,6 +62,7 @@ public:
|
||||
[[nodiscard]] bool IsVisibleBySummonerOnly() const { return _visibleBySummonerOnly; }
|
||||
|
||||
const SummonPropertiesEntry* const m_Properties;
|
||||
bool m_InheritsOwnerSpeed = true; /// Adjust whether this summon inherits its owners speed/velocity
|
||||
|
||||
std::string GetDebugInfo() const override;
|
||||
|
||||
|
||||
@ -337,6 +337,12 @@ static Optional<float> GetVelocity(Unit* owner, Unit* target, G3D::Vector3 const
|
||||
if (!owner->IsInCombat() && !owner->IsVehicle() && !owner->HasUnitFlag(UNIT_FLAG_POSSESSED) &&
|
||||
(owner->IsPet() || owner->IsGuardian() || owner->GetGUID() == target->GetCritterGUID() || owner->GetCharmerOrOwnerGUID() == target->GetGUID()))
|
||||
{
|
||||
// Some temp summons are designed to just follow the owner to the quest giver
|
||||
// They are not always intended to have their speed adjusted based on their owner
|
||||
if (TempSummon* summon = owner->ToTempSummon())
|
||||
if (!summon->m_InheritsOwnerSpeed)
|
||||
return speed;
|
||||
|
||||
uint32 moveFlags = target->GetUnitMovementFlags();
|
||||
if (target->movespline->isWalking())
|
||||
{
|
||||
|
||||
@ -474,6 +474,94 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/*######
|
||||
## Quest 11881: Load'er Up
|
||||
######*/
|
||||
|
||||
// NPC 25969: Jenny
|
||||
enum Jenny
|
||||
{
|
||||
EVENT_JENNY_MOVE_TO_FEZZIX = 1,
|
||||
EVENT_JENNY_DESPAWN = 2,
|
||||
SPELL_CRATES_CARRIED = 46340,
|
||||
SPELL_DROP_CRATE = 46342,
|
||||
SPELL_GIVE_JENNY_CREDIT = 46358,
|
||||
NPC_FEZZIX_GEARTWIST = 25849
|
||||
};
|
||||
|
||||
class npc_jenny : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_jenny() : CreatureScript("npc_jenny") {}
|
||||
|
||||
struct npc_jennyAI : public FollowerAI
|
||||
{
|
||||
npc_jennyAI(Creature* creature) : FollowerAI(creature)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->CastSpell(me, SPELL_CRATES_CARRIED);
|
||||
// This NPC only moves at its fixed speed_run rate in the db
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
summon->m_InheritsOwnerSpeed = false;
|
||||
if (Player* summoner = me->ToTempSummon()->GetSummonerUnit()->ToPlayer())
|
||||
StartFollow(summoner);
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*type*/, SpellSchoolMask /*school*/) override
|
||||
{
|
||||
if (me->HasAura(SPELL_CRATES_CARRIED))
|
||||
me->CastSpell(me, SPELL_DROP_CRATE);
|
||||
else
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
void UpdateFollowerAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
if (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_JENNY_MOVE_TO_FEZZIX:
|
||||
me->SetWalk(true);
|
||||
me->GetMotionMaster()->MovePoint(0, _fezzix);
|
||||
_events.ScheduleEvent(EVENT_JENNY_DESPAWN, 7s);
|
||||
break;
|
||||
case EVENT_JENNY_DESPAWN:
|
||||
me->DespawnOrUnsummon();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (who->GetEntry() == NPC_FEZZIX_GEARTWIST && me->IsWithinDistInMap(who, 15.0f))
|
||||
{
|
||||
if (Player* summoner = me->ToTempSummon()->GetSummonerUnit()->ToPlayer())
|
||||
me->CastSpell(summoner, SPELL_GIVE_JENNY_CREDIT);
|
||||
SetFollowComplete(true);
|
||||
_fezzix = who->GetPosition();
|
||||
_events.ScheduleEvent(EVENT_JENNY_MOVE_TO_FEZZIX, 1s);
|
||||
}
|
||||
}
|
||||
private:
|
||||
EventMap _events;
|
||||
Position _fezzix;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_jennyAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
/*######
|
||||
## Quest 11590: Abduction
|
||||
######*/
|
||||
@ -2059,4 +2147,5 @@ void AddSC_borean_tundra()
|
||||
new npc_hidden_cultist();
|
||||
RegisterSpellScript(spell_q11719_bloodspore_ruination_45997);
|
||||
new npc_bloodmage_laurith();
|
||||
RegisterCreatureAI(npc_jenny);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user