mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
*Revert ea1e16a
, should be done globally and not simply here
This commit is contained in:
parent
06606c5f01
commit
c38fbc0c09
@ -24,7 +24,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||
class CommandProcessor
|
||||
{
|
||||
private Dictionary<uint, ConnectedPlayer> mConnectedPlayerList;
|
||||
private static WorldManager mWorldManager = Server.getWorldManager();
|
||||
private static WorldManager mWorldManager = Server.GetWorldManager();
|
||||
private static Dictionary<uint, Item> gamedataItems = Server.getItemGamedataList();
|
||||
|
||||
// For the moment, this is the only predefined item
|
||||
@ -322,23 +322,23 @@ namespace FFXIVClassic_Lobby_Server
|
||||
private void parseWarp(ConnectedPlayer client, string[] split)
|
||||
{
|
||||
float x = 0, y = 0, z = 0, r = 0.0f;
|
||||
uint zoneId = 0;
|
||||
uint zoneId = 0;
|
||||
string privatearea = null;
|
||||
|
||||
if (split.Length == 2) // Predefined list
|
||||
{
|
||||
// TODO: Handle !warp Playername
|
||||
#region !warp (predefined list)
|
||||
try
|
||||
{
|
||||
if (split[1].ToLower().StartsWith("0x"))
|
||||
zoneId = Convert.ToUInt32(split[1], 16);
|
||||
else
|
||||
zoneId = Convert.ToUInt32(split[1]);
|
||||
}
|
||||
catch{return;}
|
||||
{
|
||||
// TODO: Handle !warp Playername
|
||||
#region !warp (predefined list)
|
||||
try
|
||||
{
|
||||
if (split[1].ToLower().StartsWith("0x"))
|
||||
zoneId = Convert.ToUInt32(split[1], 16);
|
||||
else
|
||||
zoneId = Convert.ToUInt32(split[1]);
|
||||
}
|
||||
catch{return;}
|
||||
#endregion
|
||||
|
||||
|
||||
doWarp(client, zoneId);
|
||||
}
|
||||
else if (split.Length == 4)
|
||||
@ -393,7 +393,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||
r = client.getActor().rotation;
|
||||
#endregion
|
||||
|
||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y));
|
||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y));
|
||||
doWarp(client, zoneId, privatearea, x, y, z, r);
|
||||
}
|
||||
else if (split.Length == 5)
|
||||
@ -406,20 +406,20 @@ namespace FFXIVClassic_Lobby_Server
|
||||
z = Single.Parse(split[4]);
|
||||
}
|
||||
catch{return;}
|
||||
|
||||
if (split[1].ToLower().StartsWith("0x"))
|
||||
{
|
||||
try { zoneId = Convert.ToUInt32(split[1], 16); }
|
||||
catch{return;}
|
||||
}
|
||||
else
|
||||
{
|
||||
try { zoneId = Convert.ToUInt32(split[1]); }
|
||||
catch{return;}
|
||||
|
||||
if (split[1].ToLower().StartsWith("0x"))
|
||||
{
|
||||
try { zoneId = Convert.ToUInt32(split[1], 16); }
|
||||
catch{return;}
|
||||
}
|
||||
else
|
||||
{
|
||||
try { zoneId = Convert.ToUInt32(split[1]); }
|
||||
catch{return;}
|
||||
}
|
||||
#endregion
|
||||
|
||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y));
|
||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y));
|
||||
doWarp(client, zoneId, privatearea, x, y, z, r);
|
||||
}
|
||||
else if (split.Length == 6)
|
||||
@ -431,23 +431,23 @@ namespace FFXIVClassic_Lobby_Server
|
||||
y = Single.Parse(split[4]);
|
||||
z = Single.Parse(split[5]);
|
||||
}
|
||||
catch{return;}
|
||||
|
||||
if (split[1].ToLower().StartsWith("0x"))
|
||||
{
|
||||
try { zoneId = Convert.ToUInt32(split[1], 16); }
|
||||
catch{return;}
|
||||
}
|
||||
else
|
||||
{
|
||||
try { zoneId = Convert.ToUInt32(split[1]); }
|
||||
catch{return;}
|
||||
catch{return;}
|
||||
|
||||
if (split[1].ToLower().StartsWith("0x"))
|
||||
{
|
||||
try { zoneId = Convert.ToUInt32(split[1], 16); }
|
||||
catch{return;}
|
||||
}
|
||||
else
|
||||
{
|
||||
try { zoneId = Convert.ToUInt32(split[1]); }
|
||||
catch{return;}
|
||||
}
|
||||
|
||||
privatearea = split[2];
|
||||
#endregion
|
||||
|
||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y));
|
||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y));
|
||||
doWarp(client, zoneId, privatearea, x, y, z, r);
|
||||
}
|
||||
else
|
||||
|
@ -188,7 +188,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||
subpacket.debugPrintSubPacket();
|
||||
client.queuePacket(_0x2Packet.buildPacket(player.actorID), true, false);
|
||||
|
||||
Server.getWorldManager().DoLogin(player.getActor());
|
||||
Server.GetWorldManager().DoLogin(player.getActor());
|
||||
|
||||
|
||||
break;
|
||||
@ -267,7 +267,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||
if (ownerActor == null)
|
||||
{
|
||||
//Is it a instance actor?
|
||||
ownerActor = Server.getWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner);
|
||||
ownerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner);
|
||||
if (ownerActor == null)
|
||||
{
|
||||
//Is it a Director?
|
||||
@ -298,7 +298,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||
Actor updateOwnerActor = Server.getStaticActors(player.getActor().eventCurrentOwner);
|
||||
if (updateOwnerActor == null)
|
||||
{
|
||||
updateOwnerActor = Server.getWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner);
|
||||
updateOwnerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner);
|
||||
|
||||
if (player.getActor().currentDirector != null && player.getActor().eventCurrentOwner == player.getActor().currentDirector.actorId)
|
||||
updateOwnerActor = player.getActor().currentDirector;
|
||||
|
@ -83,8 +83,8 @@ namespace FFXIVClassic_Lobby_Server
|
||||
mConnectionHealthThread.Name = "MapThread:Health";
|
||||
//mConnectionHealthThread.Start();
|
||||
|
||||
mStaticActors = new StaticActors(STATIC_ACTORS_PATH);
|
||||
|
||||
mStaticActors = new StaticActors(STATIC_ACTORS_PATH);
|
||||
|
||||
gamedataItems = Database.getItemGamedata();
|
||||
Log.info(String.Format("Loaded {0} items.", gamedataItems.Count));
|
||||
|
||||
@ -95,9 +95,9 @@ namespace FFXIVClassic_Lobby_Server
|
||||
|
||||
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_MAP_PORT);
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -146,8 +146,8 @@ namespace FFXIVClassic_Lobby_Server
|
||||
private void acceptCallback(IAsyncResult result)
|
||||
{
|
||||
ClientConnection conn = null;
|
||||
Socket socket = (System.Net.Sockets.Socket)result.AsyncState;
|
||||
|
||||
Socket socket = (System.Net.Sockets.Socket)result.AsyncState;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@ -169,8 +169,8 @@ namespace FFXIVClassic_Lobby_Server
|
||||
catch (SocketException)
|
||||
{
|
||||
if (conn != null)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
@ -181,7 +181,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||
catch (Exception)
|
||||
{
|
||||
if (conn != null)
|
||||
{
|
||||
{
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
@ -225,7 +225,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
}
|
||||
}
|
||||
if (conn.connType == BasePacket.TYPE_ZONE)
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
return;
|
||||
@ -243,36 +243,36 @@ namespace FFXIVClassic_Lobby_Server
|
||||
|
||||
//Build packets until can no longer or out of data
|
||||
while (true)
|
||||
{
|
||||
BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead);
|
||||
|
||||
//If can't build packet, break, else process another
|
||||
if (basePacket == null)
|
||||
break;
|
||||
else
|
||||
mProcessor.processPacket(conn, basePacket);
|
||||
}
|
||||
|
||||
//Not all bytes consumed, transfer leftover to beginning
|
||||
{
|
||||
BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead);
|
||||
|
||||
//If can't build packet, break, else process another
|
||||
if (basePacket == null)
|
||||
break;
|
||||
else
|
||||
mProcessor.processPacket(conn, basePacket);
|
||||
}
|
||||
|
||||
//Not all bytes consumed, transfer leftover to beginning
|
||||
if (offset < bytesRead)
|
||||
Array.Copy(conn.buffer, offset, conn.buffer, 0, bytesRead - offset);
|
||||
|
||||
conn.lastPartialSize = bytesRead - offset;
|
||||
|
||||
//Build any queued subpackets into basepackets and send
|
||||
conn.flushQueuedSendPackets();
|
||||
|
||||
if (offset < bytesRead)
|
||||
//Need offset since not all bytes consumed
|
||||
conn.flushQueuedSendPackets();
|
||||
|
||||
if (offset < bytesRead)
|
||||
//Need offset since not all bytes consumed
|
||||
conn.socket.BeginReceive(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset), SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
||||
else
|
||||
//All bytes consumed, full buffer available
|
||||
else
|
||||
//All bytes consumed, full buffer available
|
||||
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
@ -280,15 +280,15 @@ namespace FFXIVClassic_Lobby_Server
|
||||
}
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
{
|
||||
if (conn.socket != null)
|
||||
{
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,23 +326,23 @@ namespace FFXIVClassic_Lobby_Server
|
||||
}
|
||||
|
||||
return newPacket;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static WorldManager getWorldManager()
|
||||
{
|
||||
return mWorldManager;
|
||||
}
|
||||
|
||||
public Dictionary<uint, ConnectedPlayer> getConnectedPlayerList()
|
||||
{
|
||||
return mConnectedPlayerList;
|
||||
}
|
||||
|
||||
public static Dictionary<uint, Item> getItemGamedataList()
|
||||
{
|
||||
return gamedataItems;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static WorldManager GetWorldManager()
|
||||
{
|
||||
return mWorldManager;
|
||||
}
|
||||
|
||||
public Dictionary<uint, ConnectedPlayer> getConnectedPlayerList()
|
||||
{
|
||||
return mConnectedPlayerList;
|
||||
}
|
||||
|
||||
public static Dictionary<uint, Item> getItemGamedataList()
|
||||
{
|
||||
return gamedataItems;
|
||||
}
|
||||
}
|
||||
}
|
@ -49,7 +49,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
List<LuaParam> lParams;
|
||||
|
||||
Player player = Server.getWorldManager().GetPCInWorld(playerActorId);
|
||||
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
|
||||
lParams = LuaEngine.doActorOnInstantiate(player, this);
|
||||
|
||||
if (lParams == null)
|
||||
|
@ -703,34 +703,34 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
if (msgParams.Length == 0)
|
||||
{
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.getWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log));
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log));
|
||||
}
|
||||
else
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.getWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams)));
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams)));
|
||||
}
|
||||
|
||||
public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, params object[] msgParams)
|
||||
{
|
||||
if (msgParams.Length == 0)
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.getWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log));
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log));
|
||||
else
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.getWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams)));
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams)));
|
||||
}
|
||||
|
||||
public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, string customSender, params object[] msgParams)
|
||||
{
|
||||
if (msgParams.Length == 0)
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.getWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log));
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log));
|
||||
else
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.getWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.createLuaParamList(msgParams)));
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.createLuaParamList(msgParams)));
|
||||
}
|
||||
|
||||
public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, uint displayId, params object[] msgParams)
|
||||
{
|
||||
if (msgParams.Length == 0)
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.getWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log));
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log));
|
||||
else
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.getWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.createLuaParamList(msgParams)));
|
||||
queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.createLuaParamList(msgParams)));
|
||||
}
|
||||
|
||||
public void broadcastWorldMessage(ushort worldMasterId, params object[] msgParams)
|
||||
|
@ -43,7 +43,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||
Script script = new Script();
|
||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getWorldManager().GetActor;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
||||
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||
script.DoFile(luaPath);
|
||||
DynValue result = script.Call(script.Globals["onInstantiate"], target);
|
||||
@ -82,9 +82,9 @@ namespace FFXIVClassic_Map_Server.lua
|
||||
{
|
||||
Script script = new Script();
|
||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.getWorldManager;
|
||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
|
||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getWorldManager().GetActor;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
||||
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||
script.DoFile(luaPath);
|
||||
|
||||
@ -125,9 +125,9 @@ namespace FFXIVClassic_Map_Server.lua
|
||||
{
|
||||
Script script = new Script();
|
||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.getWorldManager;
|
||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
|
||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getWorldManager().GetActor;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
||||
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||
script.DoFile(luaPath);
|
||||
|
||||
@ -158,9 +158,9 @@ namespace FFXIVClassic_Map_Server.lua
|
||||
{
|
||||
Script script = new Script();
|
||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.getWorldManager;
|
||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
|
||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getWorldManager().GetActor;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
||||
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||
script.DoFile(luaPath);
|
||||
|
||||
@ -175,9 +175,9 @@ namespace FFXIVClassic_Map_Server.lua
|
||||
{
|
||||
Script script = new Script();
|
||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.getWorldManager;
|
||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
|
||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getWorldManager().GetActor;
|
||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
||||
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||
script.DoFile(FILEPATH_PLAYER);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user