Core/GameObject: Implement ControlZone gameobject type

Port From (https://github.com/TrinityCore/TrinityCore/commit/f96f041c3edadfb5f1f09705fe699c2d7a9ed423)
This commit is contained in:
hondacrx
2024-01-31 20:53:44 -05:00
parent 7545d9395d
commit e2caec12dc
11 changed files with 998 additions and 1270 deletions
+7 -7
View File
@@ -42,7 +42,7 @@ namespace Game.BattleGrounds
{
// remove objects and creatures
// (this is done automatically in mapmanager update, when the instance is reset after the reset time)
for (var i = 0; i < BgCreatures.Length; ++i)
for (uint i = 0; i < BgCreatures.Length; ++i)
DelCreature(i);
for (var i = 0; i < BgObjects.Length; ++i)
@@ -1348,7 +1348,7 @@ namespace Game.BattleGrounds
return obj;
}
public Creature GetBGCreature(int type)
public Creature GetBGCreature(uint type)
{
if (BgCreatures[type].IsEmpty())
return null;
@@ -1398,7 +1398,7 @@ namespace Game.BattleGrounds
}
}
public virtual Creature AddCreature(uint entry, int type, float x, float y, float z, float o, int teamIndex = TeamId.Neutral, uint respawntime = 0, Transport transport = null)
public virtual Creature AddCreature(uint entry, uint type, float x, float y, float z, float o, int teamIndex = TeamId.Neutral, uint respawntime = 0, Transport transport = null)
{
Map map = FindBgMap();
if (map == null)
@@ -1445,12 +1445,12 @@ namespace Game.BattleGrounds
return creature;
}
public Creature AddCreature(uint entry, int type, Position pos, int teamIndex = TeamId.Neutral, uint respawntime = 0, Transport transport = null)
public Creature AddCreature(uint entry, uint type, Position pos, int teamIndex = TeamId.Neutral, uint respawntime = 0, Transport transport = null)
{
return AddCreature(entry, type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex, respawntime, transport);
}
public bool DelCreature(int type)
public bool DelCreature(uint type)
{
if (BgCreatures[type].IsEmpty())
return true;
@@ -1502,7 +1502,7 @@ namespace Game.BattleGrounds
return false;
}
public bool AddSpiritGuide(int type, float x, float y, float z, float o, int teamIndex)
public bool AddSpiritGuide(uint type, float x, float y, float z, float o, int teamIndex)
{
uint entry = (uint)(teamIndex == TeamId.Alliance ? BattlegroundCreatures.A_SpiritGuide : BattlegroundCreatures.H_SpiritGuide);
@@ -1514,7 +1514,7 @@ namespace Game.BattleGrounds
return false;
}
public bool AddSpiritGuide(int type, Position pos, int teamIndex = TeamId.Neutral)
public bool AddSpiritGuide(uint type, Position pos, int teamIndex = TeamId.Neutral)
{
return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex);
}
@@ -11,6 +11,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Game.BattleGrounds.Zones;
using Game.BattleGrounds.Zones.EyeofStorm;
namespace Game.BattleGrounds
{
@@ -353,9 +353,9 @@ namespace Game.BattleGrounds.Zones
if (capturedNodes >= 4)
CastSpellOnTeam(BattlegroundConst.AbQuestReward4Bases, team);
Creature trigger = !BgCreatures[node + 7].IsEmpty() ? GetBGCreature(node + 7) : null; // 0-6 spirit guides
Creature trigger = !BgCreatures[node + 7].IsEmpty() ? GetBGCreature(node + 7u) : null; // 0-6 spirit guides
if (trigger == null)
trigger = AddCreature(SharedConst.WorldTrigger, node + 7, NodePositions[node], GetTeamIndexByTeamId(team));
trigger = AddCreature(SharedConst.WorldTrigger, node + 7u, NodePositions[node], GetTeamIndexByTeamId(team));
//add bonus honor aura trigger creature when node is accupied
//cast bonus aura (+50% honor in 25yards)
@@ -374,7 +374,7 @@ namespace Game.BattleGrounds.Zones
return;
//remove bonus honor aura trigger creature when node is lost
DelCreature(node + 7);//null checks are in DelCreature! 0-6 spirit guides
DelCreature(node + 7u);//null checks are in DelCreature! 0-6 spirit guides
DelCreature(node);
File diff suppressed because it is too large Load Diff
@@ -158,7 +158,7 @@ namespace Game.BattleGrounds.Zones
ShipsStarted = false;
//Graveyards
for (byte i = 0; i < SAGraveyards.Max; i++)
for (uint i = 0; i < SAGraveyards.Max; i++)
{
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]);
if (sg == null)
@@ -744,7 +744,7 @@ namespace Game.BattleGrounds.Zones
}
}
void CaptureGraveyard(int i, Player source)
void CaptureGraveyard(uint i, Player source)
{
if (GraveyardStatus[i] == Attackers)
return;
@@ -773,7 +773,7 @@ namespace Game.BattleGrounds.Zones
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
npc = SACreatureTypes.Rigspark;
Creature rigspark = AddCreature(SAMiscConst.NpcEntries[npc], (int)npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
Creature rigspark = AddCreature(SAMiscConst.NpcEntries[npc], npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
if (rigspark != null)
rigspark.GetAI().Talk(SATextIds.SparklightRigsparkSpawn);
@@ -801,7 +801,7 @@ namespace Game.BattleGrounds.Zones
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
npc = SACreatureTypes.Sparklight;
Creature sparklight = AddCreature(SAMiscConst.NpcEntries[npc], (int)npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
Creature sparklight = AddCreature(SAMiscConst.NpcEntries[npc], npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
if (sparklight != null)
sparklight.GetAI().Talk(SATextIds.SparklightRigsparkSpawn);