Merge pull request #219 from rgto/community
Fix: prevent ActorFactory from logging errors for logical/non-renderable spawner SNOs.
This commit is contained in:
commit
1a483c117f
@ -28,7 +28,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
|||||||
.Where(x => x.Attribute != null)
|
.Where(x => x.Attribute != null)
|
||||||
.SelectMany(x => x.Attribute.SNOIds.Select(a => new { x.Type, Sno = a }))
|
.SelectMany(x => x.Attribute.SNOIds.Select(a => new { x.Type, Sno = a }))
|
||||||
.ToDictionary(x => x.Sno, x => x.Type);
|
.ToDictionary(x => x.Sno, x => x.Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LazyCreate(World world, ActorSno sno, TagMap tags, Vector3D spawn, Action<Actor, Vector3D> OnCreate)
|
public static void LazyCreate(World world, ActorSno sno, TagMap tags, Vector3D spawn, Action<Actor, Vector3D> OnCreate)
|
||||||
{
|
{
|
||||||
@ -39,14 +39,31 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
|||||||
|
|
||||||
public static Actor Create(World world, ActorSno sno, TagMap tags, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0)
|
public static Actor Create(World world, ActorSno sno, TagMap tags, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0)
|
||||||
{
|
{
|
||||||
if (!MPQStorage.Data.Assets[SNOGroup.Actor].ContainsKey((int)sno))
|
if (sno == ActorSno.__NONE)
|
||||||
{
|
{
|
||||||
var path = Path.GetFileName(filePath);
|
// SNOSpawn == 0/none → never generates an Actor.
|
||||||
Logger.Trace($"$[underline red on white]$Actor asset not found$[/]$, Method: $[olive]${memberName}()$[/]$ - $[underline white]${memberName}() in {path}:{lineNumber}$[/]$");
|
Logger.Debug($"[ActorFactory] Ignorando ActorSno.__NONE");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sno)
|
if (!MPQStorage.Data.Assets[SNOGroup.Actor].ContainsKey((int)sno))
|
||||||
|
{
|
||||||
|
string snoName = sno.ToString().ToLower();
|
||||||
|
|
||||||
|
// If the name itself indicates that it is a spawner/marker/symbol → it is not an error, just ignore it.
|
||||||
|
if (snoName.Contains("spawn") || snoName.Contains("spawner") ||
|
||||||
|
snoName.Contains("symbol") || snoName.Contains("marker"))
|
||||||
|
{
|
||||||
|
Logger.Debug($"[ActorFactory] Ignorando actor lógico {sno} (sem asset renderizável no MPQ)");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise → it is indeed an expected asset that does not exist → log error.
|
||||||
|
var path = Path.GetFileName(filePath);
|
||||||
|
Logger.Trace($"$[underline red on white]$Actor asset not found$[/]$, Method: $[olive]{memberName}()$[/]$ - $[underline white]{memberName}() in {path}:{lineNumber}$[/]$");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
switch (sno)
|
||||||
{
|
{
|
||||||
case ActorSno._woodwraith_a_01:
|
case ActorSno._woodwraith_a_01:
|
||||||
case ActorSno._woodwraith_a_02:
|
case ActorSno._woodwraith_a_02:
|
||||||
|
|||||||
@ -249,7 +249,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var actor = ActorFactory.Create(World, (ActorSno)marker.SNOHandle.Id, marker.TagMap); // try to create it.
|
var actor = ActorFactory.Create(World, (ActorSno)marker.SNOHandle.Id, marker.TagMap); // try to create it.
|
||||||
//Logger.Debug("not-lazy spawned {0}", actor.GetType().Name);
|
//Logger.Debug("not-lazy spawned {0}", actor.GetType().Name);
|
||||||
if (actor == null) continue;
|
if (actor == null) continue;
|
||||||
if (World.SNO == WorldSno.a3_battlefields_02 && SceneSNO.Id == 145392 && actor is StartingPoint) continue; //arreat crater hack
|
if (World.SNO == WorldSno.a3_battlefields_02 && SceneSNO.Id == 145392 && actor is StartingPoint) continue; //arreat crater hack
|
||||||
if (World.SNO == WorldSno.x1_westm_intro && SceneSNO.Id == 311310 && actor is StartingPoint) continue; //A5 start location hack
|
if (World.SNO == WorldSno.x1_westm_intro && SceneSNO.Id == 311310 && actor is StartingPoint) continue; //A5 start location hack
|
||||||
@ -267,22 +267,22 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
|||||||
{
|
{
|
||||||
//Logger.Warn("load Encounter marker {0} in {1} ({2})", marker.Name, markerSetData.FileName, marker.SNOHandle.Id);
|
//Logger.Warn("load Encounter marker {0} in {1} ({2})", marker.Name, markerSetData.FileName, marker.SNOHandle.Id);
|
||||||
var encounter = marker.SNOHandle.Target as Encounter;
|
var encounter = marker.SNOHandle.Target as Encounter;
|
||||||
var actorsno = RandomHelper.RandomItem(encounter.Spawnoptions, x => x.Probability);
|
|
||||||
/*foreach (var option in encounter.Spawnoptions)
|
|
||||||
{
|
|
||||||
Logger.Trace("Encounter option {0} - {1} - {2} - {3}", option.SNOSpawn, option.Probability, option.I1, option.I2);
|
|
||||||
}*/ //only for debugging purposes
|
|
||||||
if ((ActorSno)actorsno.SNOSpawn == ActorSno.__NONE)
|
|
||||||
{
|
|
||||||
var path = Path.GetFileName(filePath);
|
|
||||||
Logger.Trace($"$[underline red on white]$Actor asset not found$[/]$, Method: $[olive]${memberName}()$[/]$ - $[underline white]${memberName}() in {path}:{lineNumber}$[/]$");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var actor2 = ActorFactory.Create(World, (ActorSno)actorsno.SNOSpawn, marker.TagMap); // try to create it.
|
var selected = RandomHelper.RandomItem(encounter.Spawnoptions, x => x.Probability);
|
||||||
if (actor2 == null) continue;
|
|
||||||
|
|
||||||
var position2 = marker.PRTransform.Vector3D + Position; // calculate the position for the actor.
|
// Ignores invalid/non-existent spawns.
|
||||||
|
if ((ActorSno)selected.SNOSpawn == ActorSno.__NONE) continue;
|
||||||
|
|
||||||
|
if (!MPQStorage.Data.Assets[SNOGroup.Actor].ContainsKey(selected.SNOSpawn))
|
||||||
|
{
|
||||||
|
Logger.Debug($"[Encounter] Ignorando SNO {selected.SNOSpawn} (sem asset)");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var actor2 = ActorFactory.Create(World, (ActorSno)selected.SNOSpawn, marker.TagMap);
|
||||||
|
if (actor2 == null) continue;
|
||||||
|
|
||||||
|
var position2 = marker.PRTransform.Vector3D + Position; // calculate the position for the actor.
|
||||||
actor2.RotationW = marker.PRTransform.Quaternion.W;
|
actor2.RotationW = marker.PRTransform.Quaternion.W;
|
||||||
actor2.RotationAxis = marker.PRTransform.Quaternion.Vector3D;
|
actor2.RotationAxis = marker.PRTransform.Quaternion.Vector3D;
|
||||||
actor2.AdjustPosition = false;
|
actor2.AdjustPosition = false;
|
||||||
@ -528,10 +528,10 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
|||||||
public MapRevealSceneMessage MapRevealMessage(Player plr)
|
public MapRevealSceneMessage MapRevealMessage(Player plr)
|
||||||
{
|
{
|
||||||
if (SceneSNO.Id is 1904 or 33342 or 33343 or 33347 or 33348 or 33349 or 414798 or 161516 or 161510 or 185542
|
if (SceneSNO.Id is 1904 or 33342 or 33343 or 33347 or 33348 or 33349 or 414798 or 161516 or 161510 or 185542
|
||||||
or 161507 or 161513 or 185545 or 172892 or 172880 or 172868 or 172888 or 172876 or 172863 or 172884
|
or 161507 or 161513 or 185545 or 172892 or 172880 or 172868 or 172888 or 172876 or 172863 or 172884
|
||||||
or 172872 or 172908 or 183555 or 183556 or 183557 or 183502 or 183505 or 183557 or 183519 or 183545
|
or 172872 or 172908 or 183555 or 183556 or 183557 or 183502 or 183505 or 183557 or 183519 or 183545
|
||||||
or 183553 or 315706 or 311307 or 311295 or 313849 or 311316 or 313845 or 315710 or 311310 or 311298
|
or 183553 or 315706 or 311307 or 311295 or 313849 or 311316 or 313845 or 315710 or 311310 or 311298
|
||||||
or 313853 or 311313 or 311301 or 313857
|
or 313853 or 311313 or 311301 or 313857
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return new MapRevealSceneMessage
|
return new MapRevealSceneMessage
|
||||||
|
|||||||
Loading…
Reference in New Issue
user.block.title