1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-24 05:37:46 +00:00

Added relative warps

This commit is contained in:
TheManii 2016-04-08 00:48:34 -07:00
parent 33be97ea9d
commit 21745a6aa8
3 changed files with 139 additions and 85 deletions

View file

@ -351,6 +351,64 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
private void parseWarp(ConnectedPlayer client, string[] split)
{
//bool relx = false,
// rely = false,
// relz = false;
float x = 0,
y = 0,
z = 0;
if (split.Length == 2) // Predefined list
doWarp(client, split[1]);
else if (split.Length == 4) // X/Y/Z
{
#region relativewarp
if (split[1].StartsWith("@"))
{
//relx = true;
split[1] = split[1].Replace("@", string.Empty);
if (String.IsNullOrEmpty(split[1]))
split[1] = "0";
x = Single.Parse(split[1]) + client.getActor().positionX;
split[1] = x.ToString();
}
if (split[2].StartsWith("@"))
{
//rely = true;
split[2] = split[2].Replace("@", string.Empty);
if (String.IsNullOrEmpty(split[2]))
split[2] = "0";
y = Single.Parse(split[2]) + client.getActor().positionY;
split[2] = y.ToString();
}
if (split[3].StartsWith("@"))
{
//relz = true;
split[3] = split[3].Replace("@", string.Empty);
if (String.IsNullOrEmpty(split[3]))
split[3] = "0";
z = Single.Parse(split[3]) + client.getActor().positionZ;
split[3] = z.ToString();
}
#endregion
//sendMessage(client, String.Format("relx: {0}, rely: {1}, relz: {2}, x: {3}, y: {4}, z: {5}, fx: {6}, fy: {7}, fz: {8}", relx, rely, relz, split[1], split[2], split[3], x, y ,z));
sendMessage(client, String.Format("Warping to: X: {0}, Y: {1}, Z: {2}", split[1], split[2], split[3]));
doWarp(client, null, null, split[1], split[2], split[3]);
}
else if (split.Length == 5) // Zone + X/Y/Z
doWarp(client, split[1], null, split[2], split[3], split[4]);
else if (split.Length == 6) // Zone + instance + X/Y/Z
doWarp(client, split[1], split[2], split[3], split[4], split[5]);
}
/// <summary> /// <summary>
/// We only use the default options for SendMessagePacket. /// We only use the default options for SendMessagePacket.
/// May as well make it less unwieldly to view /// May as well make it less unwieldly to view
@ -639,14 +697,7 @@ namespace FFXIVClassic_Lobby_Server
#region !warp #region !warp
else if (split[0].Equals("warp")) else if (split[0].Equals("warp"))
{ {
if (split.Length == 2) // Predefined list parseWarp(client, split);
doWarp(client, split[1]);
else if (split.Length == 4) // X/Y/Z
doWarp(client, null, null, split[1], split[2], split[3]);
else if (split.Length == 5) // Zone + X/Y/Z
doWarp(client, split[1], null, split[2], split[3], split[4]);
else if (split.Length == 6) // Zone + instance + X/Y/Z
doWarp(client, split[1], split[2], split[3], split[4], split[5]);
return true; return true;
} }
#endregion #endregion

View file

@ -239,13 +239,14 @@ namespace FFXIVClassic_Map_Server.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to Teleports the player to the specified location /// Looks up a localized string similar to Teleports the player to the specified location
/// ///
///*Note: You teleport relative to your current position by putting a @ in front of a value, cannot be combined with a zone id or instance name
///
///*Syntax: warp &lt;location list&gt; ///*Syntax: warp &lt;location list&gt;
/// warp &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt; /// warp &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt;
/// warp &lt;zone id&gt; &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt; /// warp &lt;zone id&gt; &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt;
/// warp &lt;zone id&gt; &lt;instance&gt; &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt; /// warp &lt;zone id&gt; &lt;instance&gt; &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt;
///&lt;location list&gt; is a pre-defined list of locations from the server database ///&lt;location list&gt; is a pre-defined list of locations from the server database
///&lt;zone id&gt; is the zone&apos;s id as defined in the server database ///&lt;zone id&gt; is the zon [rest of string was truncated]&quot;;.
///&lt;instance&gt; is an instanced copy of the desired zone that&apos;s only visible to the current player.
/// </summary> /// </summary>
public static string CPwarp { public static string CPwarp {
get { get {

View file

@ -206,6 +206,8 @@ Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, remo
<data name="CPwarp" xml:space="preserve"> <data name="CPwarp" xml:space="preserve">
<value>Teleports the player to the specified location <value>Teleports the player to the specified location
*Note: You teleport relative to your current position by putting a @ in front of a value, cannot be combined with a zone id or instance name
*Syntax: warp &lt;location list&gt; *Syntax: warp &lt;location list&gt;
warp &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt; warp &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt;
warp &lt;zone id&gt; &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt; warp &lt;zone id&gt; &lt;X coordinate&gt; &lt;Y coordinate&gt; &lt;Z coordinate&gt;