Core/Misc: Create new enum for AreaIds

Port From (https://github.com/TrinityCore/TrinityCore/commit/60b48ad0467c4578d9944e53d9c55ed4b970a4ec)
This commit is contained in:
hondacrx
2022-02-23 16:45:12 -05:00
parent 43726e7da0
commit 3c6e9e7795
6 changed files with 28 additions and 29 deletions
+11
View File
@@ -2939,4 +2939,15 @@ namespace Framework.Constants
EnabledWithoutAutoIgnore = 1, EnabledWithoutAutoIgnore = 1,
EnabledWithAutoIgnore = 2 EnabledWithAutoIgnore = 2
} }
public enum AreaId
{
Wintergrasp = 4197,
TheSunkenRing = 4538,
TheBrokenTemplate = 4539,
WintergraspFortress = 4575,
TheChilledQuagmire = 4589,
WestparkWorkshop = 4611,
EastparkWorkshop = 4612,
}
} }
+14 -14
View File
@@ -30,7 +30,7 @@ namespace Game.BattleFields
{ {
m_TypeId = (uint)BattleFieldTypes.WinterGrasp; // See enum BattlefieldTypes m_TypeId = (uint)BattleFieldTypes.WinterGrasp; // See enum BattlefieldTypes
m_BattleId = BattlefieldIds.WG; m_BattleId = BattlefieldIds.WG;
m_ZoneId = WGConst.ZoneId; m_ZoneId = (uint)AreaId.Wintergrasp;
m_MapId = WGConst.MapId; m_MapId = WGConst.MapId;
m_Map = Global.MapMgr.CreateBaseMap(m_MapId); m_Map = Global.MapMgr.CreateBaseMap(m_MapId);
@@ -431,21 +431,21 @@ namespace Game.BattleFields
uint GetSpiritGraveyardId(uint areaId) uint GetSpiritGraveyardId(uint areaId)
{ {
switch (areaId) switch ((AreaId)areaId)
{ {
case WintergraspAreaIds.WintergraspFortress: case AreaId.WintergraspFortress:
return WGGraveyardId.Keep; return WGGraveyardId.Keep;
case WintergraspAreaIds.TheSunkenRing: case AreaId.TheSunkenRing:
return WGGraveyardId.WorkshopNE; return WGGraveyardId.WorkshopNE;
case WintergraspAreaIds.TheBrokenTemplate: case AreaId.TheBrokenTemplate:
return WGGraveyardId.WorkshopNW; return WGGraveyardId.WorkshopNW;
case WintergraspAreaIds.WestparkWorkshop: case AreaId.WestparkWorkshop:
return WGGraveyardId.WorkshopSW; return WGGraveyardId.WorkshopSW;
case WintergraspAreaIds.EastparkWorkshop: case AreaId.EastparkWorkshop:
return WGGraveyardId.WorkshopSE; return WGGraveyardId.WorkshopSE;
case WintergraspAreaIds.Wintergrasp: case AreaId.Wintergrasp:
return WGGraveyardId.Alliance; return WGGraveyardId.Alliance;
case WintergraspAreaIds.TheChilledQuagmire: case AreaId.TheChilledQuagmire:
return WGGraveyardId.Horde; return WGGraveyardId.Horde;
default: default:
Log.outError(LogFilter.Battlefield, "BattlefieldWG.GetSpiritGraveyardId: Unexpected Area Id {0}", areaId); Log.outError(LogFilter.Battlefield, "BattlefieldWG.GetSpiritGraveyardId: Unexpected Area Id {0}", areaId);
@@ -741,14 +741,14 @@ namespace Game.BattleFields
public override uint GetData(uint data) public override uint GetData(uint data)
{ {
switch (data) switch ((AreaId)data)
{ {
// Used to determine when the phasing spells must be cast // Used to determine when the phasing spells must be cast
// See: SpellArea.IsFitToRequirements // See: SpellArea.IsFitToRequirements
case WintergraspAreaIds.TheSunkenRing: case AreaId.TheSunkenRing:
case WintergraspAreaIds.TheBrokenTemplate: case AreaId.TheBrokenTemplate:
case WintergraspAreaIds.WestparkWorkshop: case AreaId.WestparkWorkshop:
case WintergraspAreaIds.EastparkWorkshop: case AreaId.EastparkWorkshop:
// Graveyards and Workshops are controlled by the same team. // Graveyards and Workshops are controlled by the same team.
BfGraveyard graveyard = GetGraveyardById((int)GetSpiritGraveyardId(data)); BfGraveyard graveyard = GetGraveyardById((int)GetSpiritGraveyardId(data));
if (graveyard != null) if (graveyard != null)
@@ -23,7 +23,6 @@ namespace Game.BattleFields
{ {
static class WGConst static class WGConst
{ {
public const uint ZoneId = 4197; // Wintergrasp
public const uint MapId = 571; // Northrend public const uint MapId = 571; // Northrend
public const byte MaxOutsideNpcs = 14; public const byte MaxOutsideNpcs = 14;
@@ -548,17 +547,6 @@ namespace Game.BattleFields
public const uint Max = 7; public const uint Max = 7;
} }
public struct WintergraspAreaIds
{
public const uint WintergraspFortress = 4575;
public const uint TheSunkenRing = 4538;
public const uint TheBrokenTemplate = 4539;
public const uint WestparkWorkshop = 4611;
public const uint EastparkWorkshop = 4612;
public const uint Wintergrasp = 4197;
public const uint TheChilledQuagmire = 4589;
}
struct WintergraspQuests struct WintergraspQuests
{ {
public const uint VictoryAlliance = 13181; public const uint VictoryAlliance = 13181;
+1 -1
View File
@@ -6289,7 +6289,7 @@ namespace Game.Entities
if (bg.GetTypeID(true) == BattlegroundTypeId.AV) if (bg.GetTypeID(true) == BattlegroundTypeId.AV)
loot.FillLoot(SharedConst.PlayerCorpseLootEntry, LootStorage.Creature, this, true); loot.FillLoot(SharedConst.PlayerCorpseLootEntry, LootStorage.Creature, this, true);
} }
else if (GetZoneId() == WintergraspAreaIds.Wintergrasp) else if (GetZoneId() == (uint)AreaId.Wintergrasp)
loot.FillLoot(SharedConst.PlayerCorpseLootEntry, LootStorage.Creature, this, true); loot.FillLoot(SharedConst.PlayerCorpseLootEntry, LootStorage.Creature, this, true);
// It may need a better formula // It may need a better formula
+1 -1
View File
@@ -3432,7 +3432,7 @@ namespace Game.Entities
bg.FillInitialWorldStates(packet); bg.FillInitialWorldStates(packet);
break; break;
// Wintergrasp // Wintergrasp
case 4197: case (uint)AreaId.Wintergrasp:
if (bf != null && bf.GetTypeId() == (uint)BattleFieldTypes.WinterGrasp) if (bf != null && bf.GetTypeId() == (uint)BattleFieldTypes.WinterGrasp)
bf.FillInitialWorldStates(packet); bf.FillInitialWorldStates(packet);
goto default; goto default;
+1 -1
View File
@@ -941,7 +941,7 @@ namespace Game.Spells
if (mapEntry == null) if (mapEntry == null)
return SpellCastResult.IncorrectArea; return SpellCastResult.IncorrectArea;
return zone_id == 4197 || (mapEntry.IsBattleground() && player != null && player.InBattleground()) ? SpellCastResult.SpellCastOk : SpellCastResult.RequiresArea; return zone_id == (uint)AreaId.Wintergrasp || (mapEntry.IsBattleground() && player != null && player.InBattleground()) ? SpellCastResult.SpellCastOk : SpellCastResult.RequiresArea;
case 44521: // Preparation case 44521: // Preparation
{ {
if (player == null) if (player == null)