Skip to content

Commit

Permalink
Last batch of importing the DOLSharp positions - still need to change…
Browse files Browse the repository at this point in the history
… Gondwana-specific code
  • Loading branch information
Mishura4 committed Jun 8, 2024
1 parent 966394b commit b0d12d2
Show file tree
Hide file tree
Showing 90 changed files with 1,021 additions and 1,007 deletions.
2 changes: 1 addition & 1 deletion GameServer/Geometry/Coordinate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ public System.Numerics.Vector3 ToSysVector3()

public readonly static Coordinate Nowhere = Create(-1, -1, -1);
public readonly static Coordinate Zero = Create(0, 0, 0);
}
}
4 changes: 2 additions & 2 deletions GameServer/Territory/Territory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ public void AddArea(AbstractArea area)
IEnumerable<GameNPC> mobs;
if (area is Circle circle)
{
mobs = region.GetNPCsInRadius(circle.Position, (ushort)circle.Radius, false, true).Cast<GameNPC>().Where(n => !n.IsCannotTarget && n is not ShadowNPC);
mobs = region.GetNPCsInRadius(circle.Coordinate, (ushort)circle.Radius, false, true).Cast<GameNPC>().Where(n => !n.IsCannotTarget && n is not ShadowNPC);
}
else
{
Expand Down Expand Up @@ -962,7 +962,7 @@ private void GatherMobsInTerritory()

if (area is Circle circle)
{
region.GetNPCsInRadius(circle.Position, (ushort)circle.Radius, false, true).Cast<GameNPC>().Where(n => !n.IsCannotTarget && n is not ShadowNPC).Foreach(n => n.CurrentTerritory = this);
region.GetNPCsInRadius(circle.Coordinate, (ushort)circle.Radius, false, true).Cast<GameNPC>().Where(n => !n.IsCannotTarget && n is not ShadowNPC).Foreach(n => n.CurrentTerritory = this);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions GameServer/commands/gmcommands/checklos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class CheckLosCommandHandler : AbstractCommandHandler, ICommandHandler
{
public async void OnCommand(GameClient client, string[] args)
{
if (client.Player?.TargetObject == null && client.Player?.GroundTarget == null)
if (client.Player?.TargetObject == null && client.Player?.GroundTargetPosition == Position.Nowhere)
{
DisplayMessage(client, "You need a target to use this command.");
return;
Expand All @@ -45,7 +45,7 @@ public async void OnCommand(GameClient client, string[] args)
if (client.Player.TargetObject != null)
{
var target = client.Player.TargetObject;
text.Add($"Target: {target.Name} (OID: {target.ObjectID}, distance: {Vector3.Distance(target.Position, client.Player.Position)})");
text.Add($"Target: {target.Name} (OID: {target.ObjectID}, distance: {(int)target.Coordinate.DistanceTo(client.Player.Position)})");
text.Add($"Target in view (player's cache): {client.Player.TargetInView}");

var stats = new RaycastStats();
Expand Down
4 changes: 2 additions & 2 deletions GameServer/commands/gmcommands/earthquake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void OnCommand(GameClient client, string[] args)
intensity = 50.0f;
duration = 1000.0f;
int x, y, z = 0;
if (client.Player.GroundTarget == null)
if (client.Player.GroundTargetPosition == Position.Nowhere)
{
x = (int)client.Player.Position.X;
y = (int)client.Player.Position.Y;
Expand Down Expand Up @@ -97,7 +97,7 @@ public void OnCommand(GameClient client, string[] args)
pakBis.WriteIntLowEndian((uint)y);
pakBis.WriteIntLowEndian((uint)z);
pakBis.Write(BitConverter.GetBytes(radius), 0, sizeof(System.Single));
int distance = (int)System.Numerics.Vector3.Distance(player.Position, client.Player.Position);
int distance = (int)System.Numerics.(int)player.Coordinate.DistanceTo(client.Player.Position);
float newIntensity = intensity * (1 - distance / radius);
pakBis.Write(BitConverter.GetBytes(newIntensity), 0, sizeof(System.Single));
pakBis.Write(BitConverter.GetBytes(duration), 0, sizeof(System.Single));
Expand Down
2 changes: 1 addition & 1 deletion GameServer/gameobjects/FeuDeCamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void ProximityCheck(object sender, ElapsedEventArgs e)
{


foreach (GamePlayer Player in WorldMgr.GetPlayersCloseToSpot(this.CurrentRegionID, this.Position.X, this.Position.Y, this.Position.Z, Radius))
foreach (GamePlayer Player in WorldMgr.GetPlayersCloseToSpot(this.Position.X, this.Position.Y, this.Position.Z, Radius))
{
if (Player.IsSitting)
{
Expand Down
13 changes: 12 additions & 1 deletion GameServer/gameobjects/GameNPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,17 @@ public ushort SpawnHeading

public short ZSpeedFactor
=> (short)((Motion.Destination.Z - Motion.Start.Z) / Motion.FullDistance);

protected override Motion Motion
{
set
{
base.Motion = value;
BroadcastUpdate();
}
}

public Coordinate Destination => Motion.Destination;

/// <summary>
/// Stores the currentwaypoint that npc has to wander to
Expand Down Expand Up @@ -1236,7 +1247,7 @@ public override GameObject TargetObject
/// <summary>
/// True if the mob is at its target position, else false.
/// </summary>
public bool IsAtTargetPosition => Motion.Destination.Equals(Coordinate);
public bool IsAtTargetLocation => Motion.Destination.Equals(Coordinate);

public override void TurnTo(Coordinate coordinate, bool sendUpdate = true)
{
Expand Down
Loading

0 comments on commit b0d12d2

Please sign in to comment.