Changeset 224 for binary-improvements/7dtd-server-fixes/src
- Timestamp:
- Apr 2, 2015, 9:16:34 PM (10 years ago)
- Location:
- binary-improvements/7dtd-server-fixes/src
- Files:
-
- 3 added
- 4 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/AllocsLogFunctions.cs
r203 r224 31 31 PersistentContainer.Instance.Players [steamId].SetOnline (ci); 32 32 PersistentData.PersistentContainer.Instance.Save (); 33 34 Mods.CallRequestToSpawnPlayer (_clientId, _name, _chunkViewDim, _playerProfile); 33 35 } catch (Exception e) { 34 36 Log.Out ("Error in AllocsLogFunctions.RequestToSpawnPlayer: " + e); … … 36 38 } 37 39 38 public static void PlayerDisconnected (ConnectionManager manager, int _clientId, bool _bShutdown)40 public static void PlayerDisconnected (ConnectionManager manager, ClientInfo _cInfo, bool _bShutdown) 39 41 { 40 42 try { 41 Player p = PersistentContainer.Instance.Players .GetPlayerByClientId (_clientId);43 Player p = PersistentContainer.Instance.Players [_cInfo.playerId]; 42 44 if (p != null) { 43 45 p.SetOffline (); … … 46 48 } 47 49 PersistentData.PersistentContainer.Instance.Save (); 50 51 Mods.CallPlayerDisconnected (_cInfo, _bShutdown); 48 52 } catch (Exception e) { 49 53 Log.Out ("Error in AllocsLogFunctions.PlayerDisconnected: " + e); -
binary-improvements/7dtd-server-fixes/src/AssemblyInfo.cs
r216 r224 18 18 // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 19 20 [assembly: AssemblyVersion("0.1 04.*")]20 [assembly: AssemblyVersion("0.110.*")] 21 21 22 22 // The following attributes are used to specify the signing key for the assembly, -
binary-improvements/7dtd-server-fixes/src/CommandExtensions.cs
r198 r224 12 12 try { 13 13 ConsoleSdtd cons = manager.m_GUIConsole; 14 string ns = "AllocsFixes.CustomCommands"; 15 string basetype = "ConsoleCommand"; 14 Type commandType = typeof (ConsoleCommand); 16 15 17 foreach (Type t in Assembly.GetExecutingAssembly ().GetTypes()) { 18 if (t.IsClass && t.Namespace.Equals (ns) && t.BaseType.Name.Equals (basetype)) { 19 try { 20 ConstructorInfo ctor = t.GetConstructor (new Type[] {typeof(ConsoleSdtd)}); 21 cons.AddCommand ((ConsoleCommand)ctor.Invoke (new object[] {cons})); 22 } catch (Exception e) { 23 Log.Out ("Could not register custom command \"" + t.Name + "\": " + e); 16 Mods.ModData thisMd = new Mods.ModData (); 17 thisMd.assembly = Assembly.GetExecutingAssembly (); 18 19 List<Mods.ModData> mods = Mods.LoadedMods (); 20 mods.Add (thisMd); 21 22 foreach (Mods.ModData md in mods) { 23 foreach (Type t in md.assembly.GetTypes()) { 24 if (t.IsClass && commandType.IsAssignableFrom (t)) { 25 try { 26 ConstructorInfo ctor = t.GetConstructor (new Type[] {typeof(ConsoleSdtd)}); 27 cons.AddCommand ((ConsoleCommand)ctor.Invoke (new object[] {cons})); 28 } catch (Exception e) { 29 Log.Out ("Could not register custom command \"" + t.Name + "\": " + e); 30 } 24 31 } 25 32 } -
binary-improvements/7dtd-server-fixes/src/CommonMappingFunctions.cs
r213 r224 15 15 public static GameManager GetGameManager () 16 16 { 17 return G etConnectionManager ().gameManager;17 return GameManager.Instance; 18 18 } 19 19 … … 25 25 public static EntityPlayer GetEntityPlayer (ClientInfo _ci) 26 26 { 27 return GetGameManager ().World. playerEntities.dict [_ci.entityId];27 return GetGameManager ().World.Players.dict [_ci.entityId]; 28 28 } 29 29 -
binary-improvements/7dtd-server-fixes/src/ItemList.cs
r199 r224 27 27 } 28 28 29 public Nullable<ItemValue>GetItemValue (string itemName)29 public ItemValue GetItemValue (string itemName) 30 30 { 31 31 if (items.ContainsKey (itemName)) { 32 return items [itemName] ;32 return items [itemName].Clone (); 33 33 } else { 34 34 itemName = itemName.ToLower (); 35 35 foreach (KeyValuePair<string, ItemValue> kvp in items) { 36 36 if (kvp.Key.ToLower ().Equals (itemName)) { 37 return kvp.Value ;37 return kvp.Value.Clone (); 38 38 } 39 39 } … … 47 47 foreach (InventoryField invF in cm.GetAllItems()) { 48 48 ItemBase ib = ItemBase.list [invF.itemValue.type]; 49 string name = ib.GetItemName ( invF.itemValue);49 string name = ib.GetItemName (); 50 50 if (name != null && name.Length > 0) { 51 51 if (!items.ContainsKey (name)) { … … 58 58 foreach (InventoryField invF in cm.GetAllBlocks()) { 59 59 ItemBase ib = ItemBase.list [invF.itemValue.type]; 60 string name = ib.GetItemName ( invF.itemValue);60 string name = ib.GetItemName (); 61 61 if (name != null && name.Length > 0) { 62 62 if (!items.ContainsKey (name)) { -
binary-improvements/7dtd-server-fixes/src/NetConnections/ConsoleOutputSeparator.cs
r213 r224 22 22 private static List<NetCommand> netCommandQueue = new List<NetCommand> (); 23 23 private static bool isCurrentCommandFromClient = false; 24 private static int issuerOfCurrentClientCommand = -1; 24 25 private static IConnection issuerOfCurrentCommand; 25 26 26 public static void C_ExecuteCmdFromClient (ConsoleSdtd console, NetworkPlayer _networkPlayer, string _playerName, string _playerID, string _command)27 public static void C_ExecuteCmdFromClient (ConsoleSdtd console, int _entityId, string _playerName, string _playerID, string _command) 27 28 { 28 29 Log.Out ("Executed command \"" + _command + "\" from player \"" + _playerName + "\""); … … 30 31 lock (netCommandQueue) { 31 32 isCurrentCommandFromClient = true; 32 console.issuerOfCurrentClientCommand = _networkPlayer; 33 console.ExecuteClientCmdInternal (_playerName, _playerID, _command); 33 issuerOfCurrentClientCommand = _entityId; 34 35 string[] array = _command.Split (' '); 36 if (array.Length == 0) { 37 C_SendResult (console, "*** ERROR: empty command '" + _command + "'"); 38 } else { 39 ConsoleCommand cmd = console.getCommand (_command); 40 if (cmd != null) { 41 string[] array2 = new string[array.Length - 1]; 42 for (int i = 1; i < array.Length; i++) { 43 array2 [i - 1] = array [i]; 44 } 45 cmd.ExecuteRemote (_playerID, array2); 46 } else { 47 C_SendResult (console, "*** ERROR: unknown command '" + array [0] + "'"); 48 } 49 } 50 34 51 isCurrentCommandFromClient = false; 35 52 } … … 40 57 { 41 58 if (isCurrentCommandFromClient) { 42 console.gameManager.GetRPCNetworkView ().RPC ("RPC_Console", console.issuerOfCurrentClientCommand, new object[] 43 { 44 _line, 45 false 46 } 47 ); 59 CommonMappingFunctions.GetConnectionManager ().SendPackage (new NetPackage_ConsoleCmdClient (_line, false), new PackageDestinationSingleEntityID (issuerOfCurrentClientCommand)); 48 60 } else { 49 61 if (console.telnetServer != null && issuerOfCurrentCommand != null) -
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Telnet/TelnetConnection.cs
r202 r224 13 13 private readonly BlockingQueue<string> toClientQueue = new BlockingQueue<string> (); 14 14 private readonly Telnet telnet; 15 private readonly Thread receiveThread = null;16 private readonly Thread sendThread = null;17 15 private bool authenticated = false; 18 16 private readonly bool authEnabled; … … 44 42 Log.Out ("Telnet connection from: " + endpoint); 45 43 46 receiveThread = ThreadMaster.Create ("TelnetClientReceive_" + endpoint.ToString (), new ThreadStart (ReceiveThread)); 47 receiveThread.Start (); 48 sendThread = ThreadMaster.Create ("TelnetClientSend" + endpoint.ToString (), new ThreadStart (SendThread)); 49 sendThread.Start (); 44 ThreadManager.StartThread ("TelnetClientReceive_" + endpoint.ToString (), new ThreadManager.ThreadFunctionDelegate (ReceiveThread), System.Threading.ThreadPriority.BelowNormal); 45 ThreadManager.StartThread ("TelnetClientSend_" + endpoint.ToString (), new ThreadManager.ThreadFunctionDelegate (SendThread), System.Threading.ThreadPriority.BelowNormal); 50 46 51 47 if (authEnabled) { … … 77 73 } 78 74 79 private void ReceiveThread ( )75 private void ReceiveThread (ThreadManager.ThreadInfo _tInfo) 80 76 { 81 77 try { … … 116 112 if (!closed) 117 113 Close (); 118 ThreadMaster.Remove (Thread.CurrentThread.Name);119 114 } 120 115 121 private void SendThread ( )116 private void SendThread (ThreadManager.ThreadInfo _tInfo) 122 117 { 123 118 try { … … 140 135 if (!closed) 141 136 Close (); 142 ThreadMaster.Remove (Thread.CurrentThread.Name);143 137 } 144 138 -
binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs
r197 r224 32 32 if (sourceFields [i].count > 0) { 33 33 int count = sourceFields [i].count; 34 int maxAllowed = ItemBase.list [sourceFields [i].itemValue.type].Stack Number;34 int maxAllowed = ItemBase.list [sourceFields [i].itemValue.type].Stacknumber.Value; 35 35 string name = getInvFieldName (sourceFields [i]); 36 36 … … 48 48 { 49 49 ItemBase iBase = ItemBase.list [item.itemValue.type]; 50 return iBase.GetItemName ( item.itemValue);50 return iBase.GetItemName (); 51 51 } 52 52 -
binary-improvements/7dtd-server-fixes/src/PlayerDataStuff.cs
r144 r224 14 14 string steamId = CommonMappingFunctions.GetSteamID(ci); 15 15 PersistentContainer.Instance.Players[steamId].Inventory.Update(_playerDataFile); 16 Mods.CallSavePlayerData (_clientId, _playerDataFile); 16 17 } catch (Exception e) { 17 18 Log.Out ("Error in GM_SavePlayerData: " + e); -
binary-improvements/7dtd-server-fixes/src/StateManager.cs
r197 r224 1 1 using AllocsFixes.NetConnections.Servers.Telnet; 2 using AllocsFixes.NetConnections.Servers.Web;3 2 using System; 4 3 using System.Reflection; … … 12 11 try { 13 12 Log.Out ("[7dtd-server-fixes by Alloc] Version: " + Assembly.GetExecutingAssembly ().GetName ().Version); 14 new Web (); 13 14 Mods.LoadMods (); 15 Mods.CallGameAwake (); 16 CommandExtensions.InitCommandExtensions (manager); 17 15 18 new Telnet (); 16 19 17 20 ItemList.Instance.Init (); 18 CommandExtensions.InitCommandExtensions (manager);19 21 20 22 PersistentData.PersistentContainer.Load (); … … 28 30 try { 29 31 Log.Out ("Server shutting down!"); 32 Mods.CallGameShutdown (); 30 33 PersistentData.PersistentContainer.Instance.Save (); 31 34 } catch (Exception e) {
Note:
See TracChangeset
for help on using the changeset viewer.