mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 00:08:01 +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 "GameObject.h"
|
||||||
#include "GameObjectAI.h"
|
#include "GameObjectAI.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
|
#include "ObjectMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
@@ -1054,6 +1055,17 @@ public:
|
|||||||
Seconds respawnTimer = 0s;
|
Seconds respawnTimer = 0s;
|
||||||
player->PlayerTalkClass->SendCloseGossip();
|
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)
|
if (sender == GOSSIPID_LESSER_WS)
|
||||||
{
|
{
|
||||||
respawnTimer = 300s; // Lesser Windstone respawn in 5 minutes
|
respawnTimer = 300s; // Lesser Windstone respawn in 5 minutes
|
||||||
@@ -1152,13 +1164,19 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player->CastSpell(player, spellInfoTrigger->Id, false);
|
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);
|
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->CastSpell(summons, SPELL_SPAWN_IN, false);
|
||||||
summons->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
summons->AI()->Talk(SAY_ON_SPAWN_IN);
|
||||||
summons->SendMeleeAttackStart(player);
|
summons->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||||
summons->CombatStart(player);
|
summons->SendMeleeAttackStart(player);
|
||||||
|
summons->CombatStart(player);
|
||||||
|
_creatureGuid = summons->GetGUID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ObjectGuid _creatureGuid;
|
||||||
};
|
};
|
||||||
|
|
||||||
GameObjectAI* GetAI(GameObject* go) const
|
GameObjectAI* GetAI(GameObject* go) const
|
||||||
|
|||||||
Reference in New Issue
Block a user