mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Outland: Fix npc_ancestral_wolf not starting waypoint (#23763)
* Scripts/Outlands: Fix npc_ancestral_wolf not starting waypoint, and also add a way to not follow owner automatically in CreatureAI::JustAppeared() for tempsummons * fix nopch
This commit is contained in:
committed by
Giacomo Pozzoni
parent
6ebe1afeec
commit
0b3a9e2a2b
@@ -191,7 +191,7 @@ void CreatureAI::JustAppeared()
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
{
|
||||
// Only apply this to specific types of summons
|
||||
if (!summon->GetVehicle() && ShouldFollowOnSpawn(summon->m_Properties))
|
||||
if (!summon->GetVehicle() && ShouldFollowOnSpawn(summon->m_Properties) && summon->CanFollowOwner())
|
||||
{
|
||||
if (Unit* owner = summon->GetCharmerOrOwner())
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
TempSummon::TempSummon(SummonPropertiesEntry const* properties, WorldObject* owner, bool isWorldObject) :
|
||||
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
|
||||
m_timer(0), m_lifetime(0)
|
||||
m_timer(0), m_lifetime(0), m_canFollowOwner(true)
|
||||
{
|
||||
if (owner)
|
||||
m_summonerGUID = owner->GetGUID();
|
||||
@@ -346,7 +346,7 @@ void Minion::setDeathState(DeathState s)
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER || owner->GetMinionGUID() != GetGUID())
|
||||
return;
|
||||
|
||||
|
||||
for (Unit* controlled : owner->m_Controlled)
|
||||
{
|
||||
if (controlled->GetEntry() == GetEntry() && controlled->IsAlive())
|
||||
|
||||
@@ -53,6 +53,8 @@ class TC_GAME_API TempSummon : public Creature
|
||||
ObjectGuid GetSummonerGUID() const { return m_summonerGUID; }
|
||||
TempSummonType GetSummonType() const { return m_type; }
|
||||
uint32 GetTimer() const { return m_timer; }
|
||||
bool CanFollowOwner() const { return m_canFollowOwner; }
|
||||
void SetCanFollowOwner(bool can) { m_canFollowOwner = can; }
|
||||
|
||||
SummonPropertiesEntry const* const m_Properties;
|
||||
|
||||
@@ -62,6 +64,7 @@ class TC_GAME_API TempSummon : public Creature
|
||||
uint32 m_timer;
|
||||
uint32 m_lifetime;
|
||||
ObjectGuid m_summonerGUID;
|
||||
bool m_canFollowOwner;
|
||||
};
|
||||
|
||||
class TC_GAME_API Minion : public TempSummon
|
||||
|
||||
@@ -39,6 +39,7 @@ EndContentData */
|
||||
#include "Player.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
/*######
|
||||
@@ -154,15 +155,21 @@ public:
|
||||
|
||||
struct npc_ancestral_wolfAI : public EscortAI
|
||||
{
|
||||
npc_ancestral_wolfAI(Creature* creature) : EscortAI(creature)
|
||||
npc_ancestral_wolfAI(Creature* creature) : EscortAI(creature) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||
Start(false, false, creature->GetOwner()->GetGUID());
|
||||
if (me->GetOwner() && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
EscortAI::Start(false, false, me->GetOwner()->GetGUID());
|
||||
|
||||
me->SetSpeedRate(MOVE_WALK, 1.5f);
|
||||
|
||||
if (auto tempSummon = me->ToTempSummon())
|
||||
tempSummon->SetCanFollowOwner(false);
|
||||
}
|
||||
else
|
||||
TC_LOG_ERROR("scripts", "TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player.");
|
||||
|
||||
creature->SetSpeedRate(MOVE_WALK, 1.5f);
|
||||
Reset();
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
@@ -189,33 +196,31 @@ public:
|
||||
break;
|
||||
// Move Ryga into position
|
||||
case 48:
|
||||
if (Creature* ryga = me->FindNearestCreature(NPC_RYGA,70))
|
||||
if (Creature* ryga = me->FindNearestCreature(NPC_RYGA, 70.0f))
|
||||
{
|
||||
if (ryga->IsAlive() && !ryga->IsInCombat())
|
||||
{
|
||||
ryga->SetWalk(true);
|
||||
ryga->SetSpeedRate(MOVE_WALK, 1.5f);
|
||||
ryga->GetMotionMaster()->MovePoint(0, 517.340698f, 3885.03975f, 190.455978f, true);
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Ryga Kneels and welcomes spirit wolf
|
||||
case 50:
|
||||
if (Creature* ryga = me->FindNearestCreature(NPC_RYGA,70))
|
||||
if (Creature* ryga = me->FindNearestCreature(NPC_RYGA, 70.0f))
|
||||
{
|
||||
if (ryga->IsAlive() && !ryga->IsInCombat())
|
||||
{
|
||||
ryga->SetFacingTo(0.776773f);
|
||||
ryga->SetStandState(UNIT_STAND_STATE_KNEEL);
|
||||
ryga->AI()->Talk(SAY_WOLF_WELCOME);
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Ryga returns to spawn point
|
||||
case 51:
|
||||
if (Creature* ryga = me->FindNearestCreature(NPC_RYGA,70))
|
||||
if (Creature* ryga = me->FindNearestCreature(NPC_RYGA, 70.0f))
|
||||
{
|
||||
if (ryga->IsAlive() && !ryga->IsInCombat())
|
||||
{
|
||||
@@ -224,7 +229,6 @@ public:
|
||||
ryga->SetHomePosition(fRetX, fRetY, fRetZ, fRetO);
|
||||
ryga->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
ryga->GetMotionMaster()->MoveTargetedHome();
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user