Core/Maps: Split Ebon Hold and Exile's reach by faction and removed forced sanctuary hack
Port From (https://github.com/TrinityCore/TrinityCore/commit/515c0a43ef8fcf41ffb2785c5940f0234e757ec3)
This commit is contained in:
@@ -147,9 +147,6 @@ namespace Game.DataStorage
|
||||
|
||||
public bool IsSanctuary()
|
||||
{
|
||||
if (ContinentID == 609)
|
||||
return true;
|
||||
|
||||
return HasFlag(AreaFlags.Sanctuary);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,11 +86,27 @@ namespace Game.DataStorage
|
||||
|
||||
public bool IsContinent()
|
||||
{
|
||||
return Id == 0 || Id == 1 || Id == 530 || Id == 571 || Id == 870 || Id == 1116 || Id == 1220;
|
||||
switch (Id)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 530:
|
||||
case 571:
|
||||
case 870:
|
||||
case 1116:
|
||||
case 1220:
|
||||
case 1642:
|
||||
case 1643:
|
||||
case 2222:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDynamicDifficultyMap() { return (Flags[0] & MapFlags.CanToggleDifficulty) != 0; }
|
||||
public bool IsGarrison() { return (Flags[0] & MapFlags.Garrison) != 0; }
|
||||
public bool IsSplitByFaction() { return Id == 609 || Id == 2175; }
|
||||
}
|
||||
|
||||
public sealed class MapChallengeModeRecord
|
||||
|
||||
@@ -22,6 +22,7 @@ using Game.DataStorage;
|
||||
using Game.Garrisons;
|
||||
using Game.Groups;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -232,6 +233,9 @@ namespace Game.Entities
|
||||
else
|
||||
{
|
||||
newInstanceId = 0;
|
||||
if (entry.IsSplitByFaction())
|
||||
newInstanceId = (uint)player.GetTeamId();
|
||||
|
||||
map = FindMap_i(mapId, newInstanceId);
|
||||
if (!map)
|
||||
map = CreateWorldMap(mapId, newInstanceId);
|
||||
@@ -356,7 +360,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
public uint GenerateInstanceId()
|
||||
{
|
||||
{
|
||||
if (_nextInstanceId == 0xFFFFFFFF)
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "Instance ID overflow!! Can't continue, shutting down server. ");
|
||||
@@ -438,6 +442,13 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public void AddSC_BuiltInScripts()
|
||||
{
|
||||
foreach (var (_, mapEntry) in CliDB.MapStorage)
|
||||
if (mapEntry.IsWorldMap() && mapEntry.IsSplitByFaction())
|
||||
new SplitByFactionMapScript($"world_map_set_faction_worldstates_{mapEntry.Id}", mapEntry.Id);
|
||||
}
|
||||
|
||||
public void IncreaseScheduledScriptsCount() { ++_scheduledScripts; }
|
||||
public void DecreaseScheduledScriptCount() { --_scheduledScripts; }
|
||||
public void DecreaseScheduledScriptCount(uint count) { _scheduledScripts -= count; }
|
||||
@@ -445,11 +456,23 @@ namespace Game.Entities
|
||||
|
||||
Dictionary<(uint mapId, uint instanceId), Map> i_maps = new();
|
||||
IntervalTimer i_timer = new();
|
||||
object _mapsLock= new();
|
||||
object _mapsLock = new();
|
||||
uint i_gridCleanUpDelay;
|
||||
BitSet _freeInstanceIds;
|
||||
uint _nextInstanceId;
|
||||
MapUpdater m_updater;
|
||||
uint _scheduledScripts;
|
||||
}
|
||||
|
||||
// hack to allow conditions to access what faction owns the map (these worldstates should not be set on these maps)
|
||||
class SplitByFactionMapScript : WorldMapScript
|
||||
{
|
||||
public SplitByFactionMapScript(string name, uint mapId) : base(name, mapId) { }
|
||||
|
||||
public override void OnCreate(Map map)
|
||||
{
|
||||
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, map.GetInstanceId() == TeamId.Alliance ? 1 : 0, false, map);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, map.GetInstanceId() == TeamId.Horde ? 1 : 0, false, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@ namespace Game.Scripting
|
||||
//Load Scripts.dll
|
||||
LoadScripts();
|
||||
|
||||
// MapScripts
|
||||
Global.MapMgr.AddSC_BuiltInScripts();
|
||||
|
||||
Log.outInfo(LogFilter.ServerLoading, $"Loaded {GetScriptCount()} C# scripts in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user