Surrounded command chain with region boxes

Changed doWarp() to handle in implicit, in-zone only warps

Might have issues with instanced zones, untested
This commit is contained in:
TheManii 2016-04-07 12:25:28 -07:00
parent b17d193a59
commit ecc61ea5f9
2 changed files with 154 additions and 83 deletions

View File

@ -95,6 +95,11 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
/// <summary>
/// Teleports player to a location on a predefined list
/// </summary>
/// <param name="client">The current player</param>
/// <param name="entranceId">Predefined list: &lt;ffxiv_database&gt;\server_zones_spawnlocations</param>
public void doWarp(ConnectedPlayer client, string entranceId) public void doWarp(ConnectedPlayer client, string entranceId)
{ {
uint id; uint id;
@ -130,6 +135,17 @@ namespace FFXIVClassic_Lobby_Server
uint zoneId; uint zoneId;
float x,y,z; float x,y,z;
x = Single.Parse(sx);
y = Single.Parse(sy);
z = Single.Parse(sz);
if (zone == null)
{
if (client != null)
mWorldManager.DoZoneChange(client.getActor(), 0, privateArea, 0x2, x, y, z, 0.0f);
}
else
{
if (zone.ToLower().StartsWith("0x")) if (zone.ToLower().StartsWith("0x"))
zoneId = Convert.ToUInt32(zone, 16); zoneId = Convert.ToUInt32(zone, 16);
else else
@ -142,10 +158,6 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Zone does not exist or setting isn't valid."); Log.error("Zone does not exist or setting isn't valid.");
} }
x = Single.Parse(sx);
y = Single.Parse(sy);
z = Single.Parse(sz);
if (client != null) if (client != null)
mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f);
else else
@ -156,6 +168,7 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
} }
}
public void printPos(ConnectedPlayer client) public void printPos(ConnectedPlayer client)
{ {
@ -364,6 +377,7 @@ namespace FFXIVClassic_Lobby_Server
if (split.Length >= 1) if (split.Length >= 1)
{ {
#region !help
if (split[0].Equals("help")) if (split[0].Equals("help"))
{ {
if (split.Length == 1) if (split.Length == 1)
@ -408,6 +422,9 @@ namespace FFXIVClassic_Lobby_Server
return true; return true;
} }
#endregion
#region !mypos
else if (split[0].Equals("mypos")) else if (split[0].Equals("mypos"))
{ {
try try
@ -420,6 +437,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not load packet: " + e); Log.error("Could not load packet: " + e);
} }
} }
#endregion
#region !reloadzones
else if (split[0].Equals("reloadzones")) else if (split[0].Equals("reloadzones"))
{ {
if (client != null) if (client != null)
@ -433,6 +453,9 @@ namespace FFXIVClassic_Lobby_Server
mWorldManager.reloadZone(client.getActor().zoneId); mWorldManager.reloadZone(client.getActor().zoneId);
return true; return true;
} }
#endregion
#region !reloaditems
else if (split[0].Equals("reloaditems")) else if (split[0].Equals("reloaditems"))
{ {
Log.info(String.Format("Got request to reload item gamedata")); Log.info(String.Format("Got request to reload item gamedata"));
@ -445,6 +468,9 @@ namespace FFXIVClassic_Lobby_Server
client.getActor().queuePacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("Loaded {0} items.", gamedataItems.Count))); client.getActor().queuePacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("Loaded {0} items.", gamedataItems.Count)));
return true; return true;
} }
#endregion
#region !sendpacket
else if (split[0].Equals("sendpacket")) else if (split[0].Equals("sendpacket"))
{ {
if (split.Length < 2) if (split.Length < 2)
@ -460,6 +486,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not load packet: " + e); Log.error("Could not load packet: " + e);
} }
} }
#endregion
#region !graphic
else if (split[0].Equals("graphic")) else if (split[0].Equals("graphic"))
{ {
try try
@ -473,6 +502,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not give item."); Log.error("Could not give item.");
} }
} }
#endregion
#region !giveitem
else if (split[0].Equals("giveitem")) else if (split[0].Equals("giveitem"))
{ {
try try
@ -490,6 +522,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not give item."); Log.error("Could not give item.");
} }
} }
#endregion
#region !removeitem
else if (split[0].Equals("removeitem")) else if (split[0].Equals("removeitem"))
{ {
if (split.Length < 2) if (split.Length < 2)
@ -510,6 +545,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not remove item."); Log.error("Could not remove item.");
} }
} }
#endregion
#region !givekeyitem
else if (split[0].Equals("givekeyitem")) else if (split[0].Equals("givekeyitem"))
{ {
try try
@ -522,6 +560,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not give keyitem."); Log.error("Could not give keyitem.");
} }
} }
#endregion
#region !removekeyitem
else if (split[0].Equals("removekeyitem")) else if (split[0].Equals("removekeyitem"))
{ {
if (split.Length < 2) if (split.Length < 2)
@ -538,6 +579,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not remove keyitem."); Log.error("Could not remove keyitem.");
} }
} }
#endregion
#region !givecurrency
else if (split[0].Equals("givecurrency")) else if (split[0].Equals("givecurrency"))
{ {
try try
@ -552,6 +596,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not give currency."); Log.error("Could not give currency.");
} }
} }
#endregion
#region !removecurrency
else if (split[0].Equals("removecurrency")) else if (split[0].Equals("removecurrency"))
{ {
if (split.Length < 2) if (split.Length < 2)
@ -570,6 +617,9 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not remove currency."); Log.error("Could not remove currency.");
} }
} }
#endregion
#region !music
else if (split[0].Equals("music")) else if (split[0].Equals("music"))
{ {
if (split.Length < 2) if (split.Length < 2)
@ -585,16 +635,24 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not change music: " + e); Log.error("Could not change music: " + e);
} }
} }
#endregion
#region !warp
else if (split[0].Equals("warp")) else if (split[0].Equals("warp"))
{ {
if (split.Length == 2) if (split.Length == 2) // Predefined list
doWarp(client, split[1]); doWarp(client, split[1]);
else if (split.Length == 5) 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]); doWarp(client, split[1], null, split[2], split[3], split[4]);
else if (split.Length == 6) else if (split.Length == 6) // Zone + instance + X/Y/Z
doWarp(client, split[1], split[2], split[3], split[4], split[5]); doWarp(client, split[1], split[2], split[3], split[4], split[5]);
return true; return true;
} }
#endregion
#region !property
else if (split[0].Equals("property")) else if (split[0].Equals("property"))
{ {
if (split.Length == 4) if (split.Length == 4)
@ -603,6 +661,9 @@ namespace FFXIVClassic_Lobby_Server
} }
return true; return true;
} }
#endregion
#region !property2
else if (split[0].Equals("property2")) else if (split[0].Equals("property2"))
{ {
if (split.Length == 4) if (split.Length == 4)
@ -611,6 +672,7 @@ namespace FFXIVClassic_Lobby_Server
} }
return true; return true;
} }
#endregion
} }
return false; return false;
} }

View File

@ -374,11 +374,20 @@ namespace FFXIVClassic_Map_Server
//Add player to new zone and update //Add player to new zone and update
Area newArea; Area newArea;
if (destinationZoneId != 0)
{
if (destinationPrivateArea == null) if (destinationPrivateArea == null)
newArea = GetZone(destinationZoneId); newArea = GetZone(destinationZoneId);
else else
newArea = GetZone(destinationZoneId).getPrivateArea(destinationPrivateArea, 0); newArea = GetZone(destinationZoneId).getPrivateArea(destinationPrivateArea, 0);
}
else
{
if (destinationPrivateArea == null)
newArea = GetZone(player.zoneId);
else
newArea = GetZone(player.zoneId).getPrivateArea(destinationPrivateArea, 0);
}
//This server does not contain that zoneId //This server does not contain that zoneId
if (newArea == null) if (newArea == null)
return; return;