Skip to content

Commit

Permalink
Rename GameObject.Location to .Coordinate
Browse files Browse the repository at this point in the history
Also rename other occurrences of locations that are coordinates
This is to reduce ambiguity
  • Loading branch information
NetDwarf committed Jan 16, 2024
1 parent 37e6eae commit 0ac11e6
Show file tree
Hide file tree
Showing 93 changed files with 314 additions and 314 deletions.
10 changes: 5 additions & 5 deletions GameServer/ai/brain/ControlledNpcBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public virtual void Follow(GameObject target)
/// </summary>
public virtual void Stay()
{
tempPosition = Body.Location;
tempPosition = Body.Coordinate;
WalkState = eWalkState.Stay;
Body.StopFollowing();
}
Expand All @@ -285,10 +285,10 @@ public virtual void Stay()
/// </summary>
public virtual void ComeHere()
{
tempPosition = Body.Location;
tempPosition = Body.Coordinate;
WalkState = eWalkState.ComeHere;
Body.StopFollowing();
Body.PathTo(Owner.Location, Body.MaxSpeed);
Body.PathTo(Owner.Coordinate, Body.MaxSpeed);
}

/// <summary>
Expand All @@ -297,10 +297,10 @@ public virtual void ComeHere()
/// <param name="target"></param>
public virtual void Goto(GameObject target)
{
tempPosition = Body.Location;
tempPosition = Body.Coordinate;
WalkState = eWalkState.GoTarget;
Body.StopFollowing();
Body.PathTo(target.Location, Body.MaxSpeed);
Body.PathTo(target.Coordinate, Body.MaxSpeed);
}

public virtual void SetAggressionState(eAggressionState state)
Expand Down
2 changes: 1 addition & 1 deletion GameServer/ai/brain/DragonBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private bool CheckTether()
{
GameDragon dragon = Body as GameDragon;
if (dragon == null) return false;
return dragon.Location.DistanceTo(dragon.SpawnPosition) > dragon.TetherRange;
return dragon.Coordinate.DistanceTo(dragon.SpawnPosition) > dragon.TetherRange;
}

#endregion
Expand Down
6 changes: 3 additions & 3 deletions GameServer/ai/brain/Guards/KeepGuardBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ public override void Think()
// Tolakram - always clear the aggro list so if this is done by mistake the list will correctly re-fill on next think
ClearAggroList();

if (guard.Location.DistanceTo(guard.SpawnPosition, ignoreZ: true) > 50)
if (guard.Coordinate.DistanceTo(guard.SpawnPosition, ignoreZ: true) > 50)
{
guard.WalkToSpawn();
}
}
//Eden - Portal Keeps Guards max distance
if (guard.Level > 200 && guard.Location.DistanceTo(guard.SpawnPosition) > 2000)
if (guard.Level > 200 && guard.Coordinate.DistanceTo(guard.SpawnPosition) > 2000)
{
ClearAggroList();
guard.WalkToSpawn();
}
else if (guard.InCombat == false && guard.Location.DistanceTo(guard.SpawnPosition) > 6000)
else if (guard.InCombat == false && guard.Coordinate.DistanceTo(guard.SpawnPosition) > 6000)
{
ClearAggroList();
guard.WalkToSpawn();
Expand Down
2 changes: 1 addition & 1 deletion GameServer/ai/brain/RoundsBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override void AddToAggroList(GameLiving living, int aggroamount)
{
//save current position in path go to here and reload path point
//insert path in pathpoint
PathPoint temporaryPathPoint = new PathPoint(Body.Location, Body.CurrentSpeed, Body.CurrentWayPoint.Type);
PathPoint temporaryPathPoint = new PathPoint(Body.Coordinate, Body.CurrentSpeed, Body.CurrentWayPoint.Type);
temporaryPathPoint.Next = Body.CurrentWayPoint;
temporaryPathPoint.Prev = Body.CurrentWayPoint.Prev;
Body.CurrentWayPoint = temporaryPathPoint;
Expand Down
14 changes: 7 additions & 7 deletions GameServer/ai/brain/StandardMobBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public override void Think()
// check for returning to home if to far away
if (Body.MaxDistance != 0 && !Body.IsReturningHome)
{
int distance = (int)Body.Location.DistanceTo(Body.SpawnPosition);
int distance = (int)Body.Coordinate.DistanceTo(Body.SpawnPosition);
int maxdistance = Body.MaxDistance > 0 ? Body.MaxDistance : -Body.MaxDistance * AggroRange / 100;
if (maxdistance > 0 && distance > maxdistance)
{
Expand All @@ -132,7 +132,7 @@ public override void Think()
if (!Body.AttackState && CanRandomWalk && !Body.IsRoaming && Util.Chance(DOL.GS.ServerProperties.Properties.GAMENPC_RANDOMWALK_CHANCE))
{
var target = GetRandomWalkTarget();
if (target.DistanceTo(Body.Location) <= GameNPC.CONST_WALKTOTOLERANCE)
if (target.DistanceTo(Body.Coordinate) <= GameNPC.CONST_WALKTOTOLERANCE)
{
Body.TurnTo(target);
}
Expand All @@ -146,7 +146,7 @@ public override void Think()
//If the npc can move, and the npc is not casting, not moving, and not attacking or in combat
else if (Body.MaxSpeedBase > 0 && Body.CurrentSpellHandler == null && !Body.IsMoving && !Body.AttackState && !Body.InCombat && !Body.IsMovingOnPath)
{
if (Body.Location.DistanceTo(Body.SpawnPosition) > GameNPC.CONST_WALKTOTOLERANCE)
if (Body.Coordinate.DistanceTo(Body.SpawnPosition) > GameNPC.CONST_WALKTOTOLERANCE)
Body.WalkToSpawn();
else if (Body.Orientation != Body.SpawnPosition.Orientation)
Body.Orientation = Body.SpawnPosition.Orientation;
Expand All @@ -170,7 +170,7 @@ public override void Think()
}

//If we are not attacking, and not casting, and not moving, and we aren't facing our spawn heading, we turn to the spawn heading
if( !Body.IsMovingOnPath && !Body.InCombat && !Body.AttackState && !Body.IsCasting && !Body.IsMoving && Body.Location.DistanceTo(Body.SpawnPosition) > 500)
if( !Body.IsMovingOnPath && !Body.InCombat && !Body.AttackState && !Body.IsCasting && !Body.IsMoving && Body.Coordinate.DistanceTo(Body.SpawnPosition) > 500)
{
Body.WalkToSpawn(); // Mobs do not walk back at 2x their speed..
Body.IsReturningHome = false; // We are returning to spawn but not the long walk home, so aggro still possible
Expand Down Expand Up @@ -320,7 +320,7 @@ public virtual bool CheckFormation(ref int x, ref int y, ref int z)
return false;
}

public virtual Coordinate GetFormationLocation(Coordinate loc)
public virtual Coordinate GetFormationCoordinate(Coordinate loc)
{
var x = loc.X;
var y = loc.Y;
Expand Down Expand Up @@ -1567,7 +1567,7 @@ public virtual Coordinate GetRandomWalkTarget()
if (PathCalculator.IsSupported(Body))
{
int radius = Body.RoamingRange > 0 ? Body.RoamingRange : 500;
var target = PathingMgr.Instance.GetRandomPointAsync(Body.CurrentZone, Body.Location, radius);
var target = PathingMgr.Instance.GetRandomPointAsync(Body.CurrentZone, Body.Coordinate, radius);
if (target.HasValue)
return Coordinate.Create(x: (int)target.Value.X, y: (int)target.Value.Y, z: (int)target.Value.Z);
}
Expand All @@ -1589,7 +1589,7 @@ public virtual void DetectDoor()
{
ushort range= (ushort)((ThinkInterval/800)*Body.CurrentWayPoint.MaxSpeed);

foreach (IDoor door in Body.CurrentRegion.GetDoorsInRadius(Body.Location, range, false))
foreach (IDoor door in Body.CurrentRegion.GetDoorsInRadius(Body.Coordinate, range, false))
{
if (door is GameKeepDoor)
{
Expand Down
4 changes: 2 additions & 2 deletions GameServer/behaviour/Actions/WalkToAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public WalkToAction(GameNPC defaultNPC, IPoint3D destination, GameNPC npc)
public override void Perform(DOLEvent e, object sender, EventArgs args)
{
GamePlayer player = BehaviourUtils.GuessGamePlayerFromNotify(e, sender, args);
var location = (P is IPoint3D) ? P.ToCoordinate() : player.Location;
var destination = (P is IPoint3D) ? P.ToCoordinate() : player.Coordinate;

Q.WalkTo(location, Q.CurrentSpeed);
Q.WalkTo(destination, Q.CurrentSpeed);

}
}
Expand Down
8 changes: 4 additions & 4 deletions GameServer/commands/gmcommands/AddHookPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public void OnCommand(GameClient client, string[] args)
DBKeepHookPoint dbkeephp = new DBKeepHookPoint();
dbkeephp.HookPointID = id;
dbkeephp.KeepComponentSkinID = skin;
var newHookPointLocation = client.Player.Location - comp.Location;
dbkeephp.X = newHookPointLocation.X;
dbkeephp.Y = newHookPointLocation.Y;
dbkeephp.Z = newHookPointLocation.Z;
var keepComponentOffsetToPlayer = client.Player.Coordinate - comp.Coordinate;
dbkeephp.X = keepComponentOffsetToPlayer.X;
dbkeephp.Y = keepComponentOffsetToPlayer.Y;
dbkeephp.Z = keepComponentOffsetToPlayer.Z;
dbkeephp.Heading = (client.Player.Orientation - comp.Orientation).InHeading;
GameServer.Database.AddObject(dbkeephp);
}
Expand Down
4 changes: 2 additions & 2 deletions GameServer/commands/gmcommands/GMinfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void OnCommand(GameClient client, string[] args)

info.Add(" ");
info.Add(" + Mob_ID: " + target.InternalID);
info.Add(" + Position: " + target.Location + ", " + target.Orientation.InHeading);
info.Add(" + Position: " + target.Coordinate + ", " + target.Orientation.InHeading);
info.Add(" + OID: " + target.ObjectID);
info.Add(" + Package ID: " + target.PackageID);

Expand Down Expand Up @@ -450,7 +450,7 @@ public void OnCommand(GameClient client, string[] args)
}

info.Add(" ");
info.Add(" Location: X= " + target.Position.X + " ,Y= " + target.Position.Y + " ,Z= " + target.Position.Z);
info.Add(" Coordinate: X= " + target.Position.X + " ,Y= " + target.Position.Y + " ,Z= " + target.Position.Z);
}

#endregion StaticItem
Expand Down
2 changes: 1 addition & 1 deletion GameServer/commands/gmcommands/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,7 @@ public void OnCommand(GameClient client, string[] args)

client.Out.SendMessage("\"" + player.Name + "\", " +
player.CurrentRegionID + ", " +
player.Location + ", " +
player.Coordinate + ", " +
player.Orientation.InHeading,
eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
Expand Down
2 changes: 1 addition & 1 deletion GameServer/commands/gmcommands/keep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,7 @@ public void OnCommand(GameClient client, string[] args)
(door as GameObject).RemoveFromWorld();
GameKeepDoor d = new GameKeepDoor();
d.Name = door.Name;
d.Position = Position.Create(keep.Region, door.Location, door.Orientation);
d.Position = Position.Create(keep.Region, door.Coordinate, door.Orientation);
d.Level = 0;
d.Model = 0xFFFF;
d.DoorID = door.DoorID;
Expand Down
4 changes: 2 additions & 2 deletions GameServer/commands/gmcommands/keepguard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public void OnCommand(GameClient client, string[] args)
{
RemoveAllTempPathObjects(client);

PathPoint startpoint = new PathPoint(client.Player.Location, 5000, ePathType.Once);
PathPoint startpoint = new PathPoint(client.Player.Coordinate, 5000, ePathType.Once);
client.Player.TempProperties.setProperty(TEMP_PATH_FIRST, startpoint);
client.Player.TempProperties.setProperty(TEMP_PATH_LAST, startpoint);
client.Player.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Path.CreationStarted"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
Expand Down Expand Up @@ -372,7 +372,7 @@ public void OnCommand(GameClient client, string[] args)
}
}

PathPoint newpp = new PathPoint(client.Player.Location, speedlimit, path.Type);
PathPoint newpp = new PathPoint(client.Player.Coordinate, speedlimit, path.Type);
path.Next = newpp;
newpp.Prev = path;
client.Player.TempProperties.setProperty(TEMP_PATH_LAST, newpp);
Expand Down
12 changes: 6 additions & 6 deletions GameServer/commands/gmcommands/npc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ public void OnCommand(GameClient client, string[] args)
speed = Convert.ToInt16(args[3]);
}

var location = Coordinate.Nowhere;
var coordinate = Coordinate.Nowhere;
switch (args[2].ToLower())
{
case "me":
{
location = client.Player.Location;
coordinate = client.Player.Coordinate;
break;
}

Expand All @@ -216,7 +216,7 @@ public void OnCommand(GameClient client, string[] args)
{
if (targetplayer.Name.ToLower() == args[2].ToLower())
{
location = targetplayer.Location;
coordinate = targetplayer.Coordinate;
break;
}
}
Expand All @@ -225,21 +225,21 @@ public void OnCommand(GameClient client, string[] args)
{
if (target.Name.ToLower() == args[2].ToLower())
{
location = target.Location;
coordinate = target.Coordinate;
break;
}
}
break;
}
}

if (location.Equals(Coordinate.Nowhere))
if (coordinate.Equals(Coordinate.Nowhere))
{
client.Out.SendMessage("Can't find name " + args[2].ToLower() + " near your target.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}

npc.PathTo(location, speed);
npc.PathTo(coordinate, speed);
client.Out.SendMessage("Your target is walking to your location!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion GameServer/commands/gmcommands/object.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void OnCommand(GameClient client, string[] args)
}

info.Add(" ");
info.Add(" Location: X= " + targetObject.Position.X + " ,Y= " + targetObject.Position.Y + " ,Z= " + targetObject.Position.Z);
info.Add(" Coordinate: X= " + targetObject.Position.X + " ,Y= " + targetObject.Position.Y + " ,Z= " + targetObject.Position.Z);

client.Out.SendCustomTextWindow( "[ " + name + " ]", info );
break;
Expand Down
4 changes: 2 additions & 2 deletions GameServer/commands/gmcommands/path.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void PathCreate(GameClient client)
//Remove old temp objects
RemoveAllTempPathObjects(client);

PathPoint startpoint = new PathPoint(client.Player.Location, 5000, ePathType.Once);
PathPoint startpoint = new PathPoint(client.Player.Coordinate, 5000, ePathType.Once);
client.Player.TempProperties.setProperty(TEMP_PATH_FIRST, startpoint);
client.Player.TempProperties.setProperty(TEMP_PATH_LAST, startpoint);
client.Player.Out.SendMessage("Path creation started! You can add new pathpoints via /path add now!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
Expand Down Expand Up @@ -143,7 +143,7 @@ private void PathAdd(GameClient client, string[] args)
}
}

PathPoint newpp = new PathPoint(client.Player.Location, speedlimit, path.Type);
PathPoint newpp = new PathPoint(client.Player.Coordinate, speedlimit, path.Type);
newpp.WaitTime = waittime * 10;
path.Next = newpp;
newpp.Prev = path;
Expand Down
4 changes: 2 additions & 2 deletions GameServer/commands/gmcommands/walk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public void OnCommand(GameClient client, string[] args)
return;
}

var locationOffset = Vector.Create(x: xoff, y: yoff, z: zoff);
targetNPC.WalkTo(targetNPC.Location + locationOffset, speed);
var offset = Vector.Create(x: xoff, y: yoff, z: zoff);
targetNPC.WalkTo(targetNPC.Coordinate + offset, speed);
}
}
}
2 changes: 1 addition & 1 deletion GameServer/commands/playercommands/gtrange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void OnCommand(GameClient client, string[] args)

if (client.Player.GroundTargetPosition != Position.Nowhere)
{
var range = (int)client.Player.Location.DistanceTo(client.Player.GroundTargetPosition);
var range = (int)client.Player.Coordinate.DistanceTo(client.Player.GroundTargetPosition);
client.Out.SendMessage(LanguageMgr.GetTranslation(client, "Scripts.Players.Gtrange.Range", range), eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
else
Expand Down
2 changes: 1 addition & 1 deletion GameServer/commands/playercommands/where.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void OnCommand(GameClient client, string[] args)
return;
}
GameNPC npc = npcs[0];
var orientation = targetnpc.Location.GetOrientationTo(npc.Location);
var orientation = targetnpc.Coordinate.GetOrientationTo(npc.Coordinate);
string directionstring = LanguageMgr.GetCardinalDirection(client.Account.Language, orientation);
targetnpc.SayTo(client.Player, eChatLoc.CL_SystemWindow, LanguageMgr.GetTranslation(client, "Scripts.Players.Where.Found", npc.Name, directionstring));
targetnpc.TurnTo(npc, 10000);
Expand Down
2 changes: 1 addition & 1 deletion GameServer/commands/playercommands/yell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void OnCommand(GameClient client, string[] args)
{
if (player != client.Player)
{
var directionToTarget = player.Location.GetOrientationTo(client.Player.Location);
var directionToTarget = player.Coordinate.GetOrientationTo(client.Player.Coordinate);
var cardinalDirection = LanguageMgr.GetCardinalDirection(player.Client.Account.Language, directionToTarget);
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Scripts.Players.Yell.FromDirection", client.Player.Name, cardinalDirection), eChatType.CT_Help, eChatLoc.CL_SystemWindow);
}
Expand Down
2 changes: 1 addition & 1 deletion GameServer/gameobjects/CustomNPC/GameBoatStableMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public override bool ReceiveItem(GameLiving source, InventoryItem item)
String destination = item.Name.Substring(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "GameStableMaster.ReceiveItem.TicketTo").Length);
PathPoint path = MovementMgr.LoadPath(item.Id_nb);
//PathPoint path = MovementMgr.Instance.LoadPath(this.Name + "=>" + destination);
if ((path != null) && ((Math.Abs(path.Coordinate.X - Location.X)) < 500) && ((Math.Abs(path.Coordinate.Y - Location.Y)) < 500))
if ((path != null) && ((Math.Abs(path.Coordinate.X - Coordinate.X)) < 500) && ((Math.Abs(path.Coordinate.Y - Coordinate.Y)) < 500))
{
player.Inventory.RemoveCountFromStack(item, 1);
InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, item.Template);
Expand Down
2 changes: 1 addition & 1 deletion GameServer/gameobjects/CustomNPC/GameStableMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public override bool ReceiveItem(GameLiving source, InventoryItem item)
{
PathPoint path = MovementMgr.LoadPath(item.Id_nb);

if ((path != null) && ((Math.Abs(path.Coordinate.X - Location.X)) < 500) && ((Math.Abs(path.Coordinate.Y - Location.Y)) < 500))
if ((path != null) && ((Math.Abs(path.Coordinate.X - Coordinate.X)) < 500) && ((Math.Abs(path.Coordinate.Y - Coordinate.Y)) < 500))
{
player.Inventory.RemoveCountFromStack(item, 1);
InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, item.Template);
Expand Down
2 changes: 1 addition & 1 deletion GameServer/gameobjects/CustomNPC/Recharger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override bool Interact(GamePlayer player)
if (!base.Interact(player))
return false;

TurnTo(player.Location);
TurnTo(player.Coordinate);
SayTo(player, eChatLoc.CL_ChatWindow, LanguageMgr.GetTranslation(player.Client.Account.Language, "Scripts.Recharger.Interact"));
return true;
}
Expand Down
Loading

0 comments on commit 0ac11e6

Please sign in to comment.