Fixed kill leoric;
Fixed bug that opened a portal behind Leoric before killing him (and to reopen it after killing him); MethodTrace when opening door; Created command to open all world's doors, nearby doors, and get info about door states; Created a GetPortals near Actor.
This commit is contained in:
parent
5759335f9a
commit
602a42042a
@ -88,9 +88,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
|
||||
Logger.Trace("Breaked barricade, id: {0}", SNO);
|
||||
|
||||
if (source != null && source is Player && tombs.Contains(SNO))
|
||||
if (source is Player player && tombs.Contains(SNO))
|
||||
{
|
||||
(source as Player).AddAchievementCounter(74987243307171, 1);
|
||||
player.AddAchievementCounter(74987243307171, 1);
|
||||
}
|
||||
|
||||
if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault))
|
||||
|
||||
@ -75,7 +75,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
|
||||
public void Open()
|
||||
{
|
||||
Logger.MethodTrace($"Opening door $[underline green]${SNO}$[/]$ in world $[underline green]{World.SNO}$[/]$");
|
||||
Logger.MethodTrace($"Opening door $[underline green]${SNO}$[/]$ in world $[underline green]${World.SNO}$[/]$");
|
||||
World.BroadcastIfRevealed(plr => new PlayAnimationMessage
|
||||
{
|
||||
ActorID = DynamicID(plr),
|
||||
|
||||
@ -1630,7 +1630,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
public void AddOnLoadWorldAction(WorldSno worldSno, Action action)
|
||||
{
|
||||
Logger.Trace("AddOnLoadWorldAction: {0}", worldSno);
|
||||
if (Players.Values.Any(p => p.World != null && p.World.SNO == worldSno))
|
||||
if (Players.Values.Any(p => p.World?.SNO == worldSno))
|
||||
{
|
||||
action.Invoke();
|
||||
}
|
||||
|
||||
@ -188,10 +188,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
||||
get { return Actors.Values.OfType<StartingPoint>().Select(actor => actor).ToList(); }
|
||||
}
|
||||
|
||||
public List<Portal> Portals
|
||||
{
|
||||
get { return Actors.Values.OfType<Portal>().Select(actor => actor).ToList(); }
|
||||
}
|
||||
public List<Portal> Portals => Actors.Values.OfType<Portal>().Select(actor => actor).ToList();
|
||||
|
||||
public List<Monster> Monsters
|
||||
{
|
||||
@ -251,6 +248,43 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
||||
|
||||
#region update & tick logic
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all portals located within a specified <param name="radius"/> of the given <param name="actor"/>.
|
||||
/// </summary>
|
||||
/// <param name="actor">The actor located near the portals</param>
|
||||
/// <param name="radius">The radius of the portals to be returned is to be specified.</param>
|
||||
/// <returns>Order all existing portals in the world by ascending distance from a specified <param name="actor"></param>.</returns>
|
||||
/// <exception cref="ArgumentNullException">If <param name="actor"></param> is null.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">If <param name="radius"></param> is not null but lesser than 0.</exception>
|
||||
public ImmutableArray<Portal> GetPortals(Actor actor, float? radius = null)
|
||||
{
|
||||
if (actor == null)
|
||||
throw new ArgumentNullException(nameof(actor));
|
||||
if (radius <= 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(radius), "Radius must be greater than zero.");
|
||||
|
||||
if (radius is { } r)
|
||||
Logger.MethodTrace(
|
||||
$"All portals near $[underline]${actor.SNO} ({actor.GetType().Name})$[/]$ within $[underline]${r}$[/]$ radius");
|
||||
else
|
||||
Logger.MethodTrace($"All portals near $[underline]${actor.SNO} ({actor.GetType().Name})$[/]$");
|
||||
|
||||
return Portals
|
||||
.Where(portal =>
|
||||
{
|
||||
if (radius is not { } r) return true;
|
||||
var position = actor.Position;
|
||||
var distance = portal.Position.DistanceSquared(ref position);
|
||||
return distance <= radius.Value;
|
||||
})
|
||||
.OrderBy(s =>
|
||||
{
|
||||
var position = actor.Position;
|
||||
return s.Position.DistanceSquared(ref position);
|
||||
})
|
||||
.ToImmutableArray();
|
||||
}
|
||||
|
||||
public void Update(int tickCounter)
|
||||
{
|
||||
foreach (var player in Players.Values)
|
||||
@ -1499,6 +1533,8 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
||||
|
||||
public ImmutableArray<Door> GetAllDoors() =>
|
||||
Actors.Select(a => a.Value).Where(a => a is Door).Cast<Door>().ToImmutableArray();
|
||||
public ImmutableArray<Door> GetAllDoors(ActorSno sno) =>
|
||||
Actors.Select(a => a.Value).Where(a => a is Door && a.SNO == sno).Cast<Door>().ToImmutableArray();
|
||||
public ImmutableArray<Door> OpenAllDoors()
|
||||
{
|
||||
List<Door> openedDoors = new();
|
||||
|
||||
@ -556,7 +556,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
||||
if (Context.DogsSummoned >= 3)
|
||||
plr.GrantAchievement(74987243307567);
|
||||
}
|
||||
Logger.Trace("Killed monster, id: {0}, level {1}", Target.SNO, Target.Attributes[GameAttribute.Level]);
|
||||
Logger.Trace("Killed monster, id: $[red]${0}$[/]$, level $[red]${1}$[/]$", Target.SNO, Target.Attributes[GameAttribute.Level]);
|
||||
|
||||
|
||||
//handling quest triggers
|
||||
|
||||
@ -8,6 +8,7 @@ using DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents;
|
||||
using DiIiS_NA.GameServer.Core.Types.Math;
|
||||
using DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents.Implementations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using DiIiS_NA.GameServer.MessageSystem;
|
||||
using DiIiS_NA.GameServer.GSSystem.PlayerSystem;
|
||||
using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
|
||||
@ -1070,7 +1071,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
|
||||
});
|
||||
|
||||
ListenKill(ActorSno._skeletonking_shield_skeleton, 1, new Advance());
|
||||
ListenKill(ActorSno._skeletonking_shield_skeleton, 4, new Advance());
|
||||
}
|
||||
});
|
||||
|
||||
@ -1082,8 +1083,19 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = () =>
|
||||
{ //take crown on Leoric's head
|
||||
Game.AddOnLoadWorldAction(WorldSno.a1trdun_king_level08, () =>
|
||||
{
|
||||
var world = Game.GetWorld(WorldSno.a1trdun_king_level08);
|
||||
if (world.Players.Any())
|
||||
{
|
||||
var player = world.Players.First();
|
||||
var portal = world.GetPortals(player.Value);
|
||||
portal.First().SetUsable(false);
|
||||
}
|
||||
|
||||
OpenAll(this.Game.GetWorld(WorldSno.a1trdun_king_level08));
|
||||
Open(Game.GetWorld(WorldSno.a1trdun_king_level08), ActorSno._trdun_cath_gate_b_skeletonking);
|
||||
});
|
||||
//Open(this.Game.GetWorld(73261), 172645);
|
||||
ListenInteract(ActorSno._skeletonkinggizmo, 1, new Advance());
|
||||
}
|
||||
});
|
||||
@ -1096,6 +1108,15 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = () =>
|
||||
{ //kill Leoric
|
||||
Game.AddOnLoadWorldAction(WorldSno.a1trdun_king_level08, () =>
|
||||
{
|
||||
var world = Game.GetWorld(WorldSno.a1trdun_king_level08);
|
||||
if (!world.Players.Any()) return;
|
||||
var player = world.Players.First();
|
||||
var portal = world.GetPortals(player.Value);
|
||||
portal.First().SetUsable(false);
|
||||
});
|
||||
|
||||
ListenKill(ActorSno._skeletonking, 1, new Advance());
|
||||
}
|
||||
});
|
||||
@ -1108,13 +1129,17 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = () =>
|
||||
{ //go to fallen star room
|
||||
Open(Game.GetWorld(WorldSno.a1trdun_king_level08), ActorSno._trdun_cath_gate_b_skeletonking);
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
ListenTeleport(117411, new Advance());
|
||||
Game.AddOnLoadWorldAction(WorldSno.a1trdun_king_level08, () =>
|
||||
{
|
||||
Open(Game.GetWorld(WorldSno.a1trdun_king_level08), ActorSno._trdun_crypt_skeleton_king_throne_parts);
|
||||
var world = Game.GetWorld(WorldSno.a1trdun_king_level08);
|
||||
Open(world, ActorSno._trdun_crypt_skeleton_king_throne_parts);
|
||||
if (!world.Players.Any()) return;
|
||||
var player = world.Players.First();
|
||||
var portal = world.GetPortals(player.Value);
|
||||
portal.First().SetUsable(true);
|
||||
});
|
||||
ListenTeleport(117411, new Advance());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -694,7 +694,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
|
||||
{
|
||||
var world = Game.GetWorld(WorldSno.a3dun_azmodan_arena);
|
||||
OpenAll(world, ActorSno._a3dun_crater_st_demon_chainpylon_fire_azmodan);
|
||||
Open(world, ActorSno._a3dun_crater_st_demon_chainpylon_fire_azmodan);
|
||||
try { world.GetActorBySNO(ActorSno._azmodan).Destroy(); } catch { };
|
||||
world.SpawnMonster(ActorSno._azmodan, new Vector3D { X = 395.553f, Y = 394.966f, Z = 0.1f });
|
||||
});
|
||||
|
||||
@ -174,25 +174,20 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
//opening gates or door(for getting pass)
|
||||
protected bool Open(World world, ActorSno sno)
|
||||
{
|
||||
var actor = world.GetActorsBySNO(sno).Where(d => d.Visible).FirstOrDefault();
|
||||
if (actor == null)
|
||||
return false;
|
||||
|
||||
(actor as Door).Open();
|
||||
var doors = world.GetAllDoors(sno);
|
||||
if (!doors.Any()) return false;
|
||||
foreach (var door in doors)
|
||||
door.Open();
|
||||
return true;
|
||||
}
|
||||
|
||||
//opening all doors
|
||||
protected void OpenAll(World world)
|
||||
protected bool OpenAll(World world)
|
||||
{
|
||||
foreach (var actor in world.Actors.Select(s=>s.Value).Where(t=>t is Door).Cast<Door>())
|
||||
(actor).Open();
|
||||
}
|
||||
|
||||
protected bool OpenAll(World world, ActorSno sno)
|
||||
{
|
||||
foreach (var actor in world.GetActorsBySNO(sno).Where(d => d.Visible).ToList())
|
||||
(actor as Door).Open();
|
||||
var doors = world.GetAllDoors();
|
||||
if (!doors.Any()) return false;
|
||||
foreach (var door in doors)
|
||||
door.Open();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
user.block.title