mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
fix(Scripts/Silithus): Prevent summoning multiple windstone creatures (#9801)
This commit is contained in:
@@ -31,6 +31,7 @@ EndContentData */
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "Group.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -1054,6 +1055,17 @@ public:
|
||||
Seconds respawnTimer = 0s;
|
||||
player->PlayerTalkClass->SendCloseGossip();
|
||||
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, _creatureGuid))
|
||||
{
|
||||
// We already summoned something recently, return.
|
||||
CloseGossipMenuFor(player);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_creatureGuid.Clear();
|
||||
}
|
||||
|
||||
if (sender == GOSSIPID_LESSER_WS)
|
||||
{
|
||||
respawnTimer = 300s; // Lesser Windstone respawn in 5 minutes
|
||||
@@ -1152,13 +1164,19 @@ public:
|
||||
return;
|
||||
}
|
||||
player->CastSpell(player, spellInfoTrigger->Id, false);
|
||||
TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000);
|
||||
summons->CastSpell(summons, SPELL_SPAWN_IN, false);
|
||||
summons->AI()->Talk(SAY_ON_SPAWN_IN);
|
||||
summons->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
summons->SendMeleeAttackStart(player);
|
||||
summons->CombatStart(player);
|
||||
if (TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000))
|
||||
{
|
||||
summons->CastSpell(summons, SPELL_SPAWN_IN, false);
|
||||
summons->AI()->Talk(SAY_ON_SPAWN_IN);
|
||||
summons->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
summons->SendMeleeAttackStart(player);
|
||||
summons->CombatStart(player);
|
||||
_creatureGuid = summons->GetGUID();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectGuid _creatureGuid;
|
||||
};
|
||||
|
||||
GameObjectAI* GetAI(GameObject* go) const
|
||||
|
||||
Reference in New Issue
Block a user