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,
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_BattleId = BattlefieldIds.WG;
m_ZoneId = WGConst.ZoneId;
m_ZoneId = (uint)AreaId.Wintergrasp;
m_MapId = WGConst.MapId;
m_Map = Global.MapMgr.CreateBaseMap(m_MapId);
@@ -431,21 +431,21 @@ namespace Game.BattleFields
uint GetSpiritGraveyardId(uint areaId)
{
switch (areaId)
switch ((AreaId)areaId)
{
case WintergraspAreaIds.WintergraspFortress:
case AreaId.WintergraspFortress:
return WGGraveyardId.Keep;
case WintergraspAreaIds.TheSunkenRing:
case AreaId.TheSunkenRing:
return WGGraveyardId.WorkshopNE;
case WintergraspAreaIds.TheBrokenTemplate:
case AreaId.TheBrokenTemplate:
return WGGraveyardId.WorkshopNW;
case WintergraspAreaIds.WestparkWorkshop:
case AreaId.WestparkWorkshop:
return WGGraveyardId.WorkshopSW;
case WintergraspAreaIds.EastparkWorkshop:
case AreaId.EastparkWorkshop:
return WGGraveyardId.WorkshopSE;
case WintergraspAreaIds.Wintergrasp:
case AreaId.Wintergrasp:
return WGGraveyardId.Alliance;
case WintergraspAreaIds.TheChilledQuagmire:
case AreaId.TheChilledQuagmire:
return WGGraveyardId.Horde;
default:
Log.outError(LogFilter.Battlefield, "BattlefieldWG.GetSpiritGraveyardId: Unexpected Area Id {0}", areaId);
@@ -741,14 +741,14 @@ namespace Game.BattleFields
public override uint GetData(uint data)
{
switch (data)
switch ((AreaId)data)
{
// Used to determine when the phasing spells must be cast
// See: SpellArea.IsFitToRequirements
case WintergraspAreaIds.TheSunkenRing:
case WintergraspAreaIds.TheBrokenTemplate:
case WintergraspAreaIds.WestparkWorkshop:
case WintergraspAreaIds.EastparkWorkshop:
case AreaId.TheSunkenRing:
case AreaId.TheBrokenTemplate:
case AreaId.WestparkWorkshop:
case AreaId.EastparkWorkshop:
// Graveyards and Workshops are controlled by the same team.
BfGraveyard graveyard = GetGraveyardById((int)GetSpiritGraveyardId(data));
if (graveyard != null)
@@ -23,7 +23,6 @@ namespace Game.BattleFields
{
static class WGConst
{
public const uint ZoneId = 4197; // Wintergrasp
public const uint MapId = 571; // Northrend
public const byte MaxOutsideNpcs = 14;
@@ -548,17 +547,6 @@ namespace Game.BattleFields
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
{
public const uint VictoryAlliance = 13181;
+1 -1
View File
@@ -6289,7 +6289,7 @@ namespace Game.Entities
if (bg.GetTypeID(true) == BattlegroundTypeId.AV)
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);
// It may need a better formula
+1 -1
View File
@@ -3432,7 +3432,7 @@ namespace Game.Entities
bg.FillInitialWorldStates(packet);
break;
// Wintergrasp
case 4197:
case (uint)AreaId.Wintergrasp:
if (bf != null && bf.GetTypeId() == (uint)BattleFieldTypes.WinterGrasp)
bf.FillInitialWorldStates(packet);
goto default;
+1 -1
View File
@@ -941,7 +941,7 @@ namespace Game.Spells
if (mapEntry == null)
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
{
if (player == null)