Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/ActorFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static ActorFactory()
.Where(x => x.Attribute != null)
.SelectMany(x => x.Attribute.SNOIds.Select(a => new { x.Type, Sno = a }))
.ToDictionary(x => x.Sno, x => x.Type);
}
}

public static void LazyCreate(World world, ActorSno sno, TagMap tags, Vector3D spawn, Action<Actor, Vector3D> OnCreate)
{
Expand All @@ -39,14 +39,31 @@ public static void LazyCreate(World world, ActorSno sno, TagMap tags, Vector3D s

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))
{
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)
if (sno == ActorSno.__NONE)
{
// SNOSpawn == 0/none → never generates an Actor.
Logger.Debug($"[ActorFactory] Ignorando ActorSno.__NONE");
return null;
}

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_02:
Expand Down
46 changes: 23 additions & 23 deletions src/DiIiS-NA/D3-GameServer/GSSystem/MapSystem/Scene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ public void LoadMarkers([CallerMemberName] string memberName = "", [CallerFilePa
{
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;
continue;
}
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 (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
Expand All @@ -267,22 +267,22 @@ public void LoadMarkers([CallerMemberName] string memberName = "", [CallerFilePa
{
//Logger.Warn("load Encounter marker {0} in {1} ({2})", marker.Name, markerSetData.FileName, marker.SNOHandle.Id);
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.
if (actor2 == null) continue;

var position2 = marker.PRTransform.Vector3D + Position; // calculate the position for the actor.

var selected = RandomHelper.RandomItem(encounter.Spawnoptions, x => x.Probability);

// 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.RotationAxis = marker.PRTransform.Quaternion.Vector3D;
actor2.AdjustPosition = false;
Expand Down Expand Up @@ -399,7 +399,7 @@ public override bool Reveal(Player player)
if (player.EventWeatherEnabled)
//message.SceneSpec.SNOWeather = 50549; //Halloween
message.SceneSpec.SNOWeather = 75198; //New Year

player.InGameClient.SendMessage(message);// reveal the scene itself.
player.InGameClient.SendMessage(MapRevealMessage(player));

Expand Down Expand Up @@ -528,10 +528,10 @@ public RevealSceneMessage RevealMessage(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
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 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 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 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
)
{
return new MapRevealSceneMessage
Expand Down
Loading