fix(Scripts/Midsummer): fix handling of unwanted npc and gameobject s… (#19141)

fix(Scripts/Midsummer): fix handling of unwanted npc and gameobject spawns

- properly spawn bonfire spell focus for city bonfires
- properly despawn unwanted creatures and gameobjects which are spawned
  by linked traps
- all midsummer bonfire gameobjects have a linked trap "181290 Midsummer Bonfire Spawn Trap"
- the trap is linked to the spell "28784 Summon Midsummer Bonfire Bunnies" which then spawns
  npc "16592 Midsummer Bonfire", npc "16606 Midsummer Bonfire Despawner" and gameobject
  "181371 Midsummer Bonfire Spell Focus" i have no idea how this trap is beeing triggered,
  but it's doing only harm right now
This commit is contained in:
sudlud
2024-06-24 10:10:31 +02:00
committed by GitHub
parent a1ce807685
commit 3d03cb64ba
2 changed files with 29 additions and 0 deletions

View File

@@ -31,6 +31,7 @@
enum eBonfire
{
GO_MIDSUMMER_BONFIRE_SPELL_FOCUS = 181371,
GO_MIDSUMMER_BONFIRE_CAMPFIRE_SPELL_FOCUS = 181377,
GO_AHUNE_BONFIRE = 188073,
@@ -182,6 +183,10 @@ struct npc_midsummer_bonfire : public ScriptedAI
{
npc_midsummer_bonfire(Creature* creature) : ScriptedAI(creature)
{
// Midsummer Bonfire Spawn Trap also spawns this NPC (currently unwanted)
if (me->ToTempSummon())
me->DespawnOrUnsummon();
_isStampedOut = nullptr;
_teamId = TEAM_NEUTRAL;
_type = BONFIRE_TYPE_NONE;
@@ -300,6 +305,7 @@ struct npc_midsummer_bonfire : public ScriptedAI
if ((_bonfire = me->FindNearestGameObject(GoBonfireCity[i], 10.0f)))
{
_type = BONFIRE_TYPE_CITY;
Ignite();
return true;
}
}
@@ -362,6 +368,23 @@ private:
GameObject* _bonfire;
};
struct npc_midsummer_bonfire_despawner : public ScriptedAI
{
npc_midsummer_bonfire_despawner(Creature* creature) : ScriptedAI(creature)
{
std::list<GameObject*> gobjList;
me->GetGameObjectListWithEntryInGrid(gobjList, GO_MIDSUMMER_BONFIRE_SPELL_FOCUS, 10.0f);
for (std::list<GameObject*>::const_iterator itr = gobjList.begin(); itr != gobjList.end(); ++itr)
{
// spawnID is 0 for temp spawns
if (0 == (*itr)->GetSpawnId())
(*itr)->DespawnOrUnsummon();
}
me->DespawnOrUnsummon();
}
};
enum torchToss
{
GO_TORCH_TARGET_BRAZIER = 187708,
@@ -1265,6 +1288,7 @@ void AddSC_event_midsummer_scripts()
// NPCs
RegisterCreatureAI(npc_midsummer_bonfire);
RegisterCreatureAI(npc_midsummer_bonfire_despawner);
RegisterCreatureAI(npc_midsummer_torch_target);
RegisterCreatureAI(npc_midsummer_ribbon_pole_target);