Core/Maps: Citizens of Dalaran! Raise your eyes to the skies and observe! Any non-map-default light can now be overriden!
Port From (https://github.com/TrinityCore/TrinityCore/commit/e8d1f37ee098db01872d8861a0b48d5d4cb9d172)
This commit is contained in:
@@ -1465,6 +1465,12 @@ namespace Game.AI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CliDB.LightStorage.ContainsKey(e.Action.overrideLight.areaLightId))
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses non-existent areaLightId {e.Action.overrideLight.areaLightId}, skipped.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Action.overrideLight.overrideLightId != 0 && !CliDB.LightStorage.ContainsKey(e.Action.overrideLight.overrideLightId))
|
if (e.Action.overrideLight.overrideLightId != 0 && !CliDB.LightStorage.ContainsKey(e.Action.overrideLight.overrideLightId))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses non-existent overrideLightId {e.Action.overrideLight.overrideLightId}, skipped.");
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses non-existent overrideLightId {e.Action.overrideLight.overrideLightId}, skipped.");
|
||||||
@@ -3140,6 +3146,7 @@ namespace Game.AI
|
|||||||
public struct OverrideLight
|
public struct OverrideLight
|
||||||
{
|
{
|
||||||
public uint zoneId;
|
public uint zoneId;
|
||||||
|
public uint areaLightId;
|
||||||
public uint overrideLightId;
|
public uint overrideLightId;
|
||||||
public uint transitionMilliseconds;
|
public uint transitionMilliseconds;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2419,9 +2419,9 @@ namespace Game.AI
|
|||||||
WorldObject obj = GetBaseObject();
|
WorldObject obj = GetBaseObject();
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
{
|
{
|
||||||
obj.GetMap().SetZoneOverrideLight(e.Action.overrideLight.zoneId, e.Action.overrideLight.overrideLightId, e.Action.overrideLight.transitionMilliseconds);
|
obj.GetMap().SetZoneOverrideLight(e.Action.overrideLight.zoneId, e.Action.overrideLight.areaLightId, e.Action.overrideLight.overrideLightId, e.Action.overrideLight.transitionMilliseconds);
|
||||||
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript::ProcessAction: SMART_ACTION_OVERRIDE_LIGHT: {obj.GetGUID()} sets zone override light (zoneId: {e.Action.overrideLight.zoneId}, " +
|
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript::ProcessAction: SMART_ACTION_OVERRIDE_LIGHT: {obj.GetGUID()} sets zone override light (zoneId: {e.Action.overrideLight.zoneId}, " +
|
||||||
$"overrideLightId: {e.Action.overrideLight.overrideLightId}, transitionMilliseconds: {e.Action.overrideLight.transitionMilliseconds})");
|
$"areaLightId: {e.Action.overrideLight.areaLightId}, overrideLightId: {e.Action.overrideLight.overrideLightId}, transitionMilliseconds: {e.Action.overrideLight.transitionMilliseconds})");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-13
@@ -45,7 +45,6 @@ namespace Game.Maps
|
|||||||
m_VisibleDistance = SharedConst.DefaultVisibilityDistance;
|
m_VisibleDistance = SharedConst.DefaultVisibilityDistance;
|
||||||
m_VisibilityNotifyPeriod = SharedConst.DefaultVisibilityNotifyPeriod;
|
m_VisibilityNotifyPeriod = SharedConst.DefaultVisibilityNotifyPeriod;
|
||||||
i_gridExpiry = expiry;
|
i_gridExpiry = expiry;
|
||||||
_defaultLight = Global.DB2Mgr.GetDefaultMapLight(id);
|
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
@@ -3402,13 +3401,12 @@ namespace Game.Maps
|
|||||||
|
|
||||||
SendZoneWeather(zoneInfo, player);
|
SendZoneWeather(zoneInfo, player);
|
||||||
|
|
||||||
uint overrideLightId = zoneInfo.OverrideLightId;
|
foreach (var lightOverride in zoneInfo.LightOverrides)
|
||||||
if (overrideLightId != 0)
|
|
||||||
{
|
{
|
||||||
OverrideLight overrideLight = new();
|
OverrideLight overrideLight = new();
|
||||||
overrideLight.AreaLightID = _defaultLight;
|
overrideLight.AreaLightID = lightOverride.AreaLightId;
|
||||||
overrideLight.OverrideLightID = overrideLightId;
|
overrideLight.OverrideLightID = lightOverride.OverrideLightId;
|
||||||
overrideLight.TransitionMilliseconds = zoneInfo.TransitionMilliseconds;
|
overrideLight.TransitionMilliseconds = lightOverride.TransitionMilliseconds;
|
||||||
player.SendPacket(overrideLight);
|
player.SendPacket(overrideLight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3516,20 +3514,31 @@ namespace Game.Maps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetZoneOverrideLight(uint zoneId, uint overrideLightId, uint transitionMilliseconds)
|
public void SetZoneOverrideLight(uint zoneId, uint areaLightId, uint overrideLightId, uint transitionMilliseconds)
|
||||||
{
|
{
|
||||||
if (!_zoneDynamicInfo.ContainsKey(zoneId))
|
if (!_zoneDynamicInfo.ContainsKey(zoneId))
|
||||||
_zoneDynamicInfo[zoneId] = new ZoneDynamicInfo();
|
_zoneDynamicInfo[zoneId] = new ZoneDynamicInfo();
|
||||||
|
|
||||||
ZoneDynamicInfo info = _zoneDynamicInfo[zoneId];
|
ZoneDynamicInfo info = _zoneDynamicInfo[zoneId];
|
||||||
info.OverrideLightId = overrideLightId;
|
// client can support only one override for each light (zone independent)
|
||||||
info.TransitionMilliseconds = transitionMilliseconds;
|
info.LightOverrides.RemoveAll(lightOverride => lightOverride.AreaLightId == areaLightId);
|
||||||
|
|
||||||
|
// set new override (if any)
|
||||||
|
if (overrideLightId != 0)
|
||||||
|
{
|
||||||
|
ZoneDynamicInfo.LightOverride lightOverride = new();
|
||||||
|
lightOverride.AreaLightId = areaLightId;
|
||||||
|
lightOverride.OverrideLightId = overrideLightId;
|
||||||
|
lightOverride.TransitionMilliseconds = transitionMilliseconds;
|
||||||
|
info.LightOverrides.Add(lightOverride);
|
||||||
|
}
|
||||||
|
|
||||||
var players = GetPlayers();
|
var players = GetPlayers();
|
||||||
|
|
||||||
if (!players.Empty())
|
if (!players.Empty())
|
||||||
{
|
{
|
||||||
OverrideLight overrideLight = new();
|
OverrideLight overrideLight = new();
|
||||||
overrideLight.AreaLightID = _defaultLight;
|
overrideLight.AreaLightID = areaLightId;
|
||||||
overrideLight.OverrideLightID = overrideLightId;
|
overrideLight.OverrideLightID = overrideLightId;
|
||||||
overrideLight.TransitionMilliseconds = transitionMilliseconds;
|
overrideLight.TransitionMilliseconds = transitionMilliseconds;
|
||||||
|
|
||||||
@@ -5062,7 +5071,6 @@ namespace Game.Maps
|
|||||||
|
|
||||||
Dictionary<uint, ZoneDynamicInfo> _zoneDynamicInfo = new();
|
Dictionary<uint, ZoneDynamicInfo> _zoneDynamicInfo = new();
|
||||||
IntervalTimer _weatherUpdateTimer;
|
IntervalTimer _weatherUpdateTimer;
|
||||||
uint _defaultLight;
|
|
||||||
Dictionary<HighGuid, ObjectGuidGenerator> _guidGenerators = new();
|
Dictionary<HighGuid, ObjectGuidGenerator> _guidGenerators = new();
|
||||||
Dictionary<ObjectGuid, WorldObject> _objectsStore = new();
|
Dictionary<ObjectGuid, WorldObject> _objectsStore = new();
|
||||||
MultiMap<ulong, Creature> _creatureBySpawnIdStore = new();
|
MultiMap<ulong, Creature> _creatureBySpawnIdStore = new();
|
||||||
@@ -5624,8 +5632,14 @@ namespace Game.Maps
|
|||||||
public Weather DefaultWeather;
|
public Weather DefaultWeather;
|
||||||
public WeatherState WeatherId;
|
public WeatherState WeatherId;
|
||||||
public float Intensity;
|
public float Intensity;
|
||||||
public uint OverrideLightId;
|
public List<LightOverride> LightOverrides = new();
|
||||||
public uint TransitionMilliseconds;
|
|
||||||
|
public struct LightOverride
|
||||||
|
{
|
||||||
|
public uint AreaLightId;
|
||||||
|
public uint OverrideLightId;
|
||||||
|
public uint TransitionMilliseconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PositionFullTerrainStatus
|
public class PositionFullTerrainStatus
|
||||||
|
|||||||
Reference in New Issue
Block a user