Changeset 233
- Timestamp:
- Apr 30, 2015, 1:55:16 AM (10 years ago)
- Location:
- binary-improvements
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-binaries/README.txt
r230 r233 1 1 Put the Assembly-CSharp.deobf.dll renamed to Assembly-CSharp.dll (output of 2 the Deobfuscator [1]), LogLibrary.dll, mscorlib.dll, System.dll and3 UnityEngine.dll in this folder.2 the Deobfuscator [1]), Assembly-CSharp-firstpass.dll, LogLibrary.dll, mscorlib.dll, 3 System.dll and UnityEngine.dll in this folder. 4 4 5 5 [1]: https://github.com/DerPopo/deobfuscate-7dtd -
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r230 r233 54 54 <Private>False</Private> 55 55 </Reference> 56 <Reference Include="Assembly-CSharp-firstpass"> 57 <HintPath>..\7dtd-binaries\Assembly-CSharp-firstpass.dll</HintPath> 58 <Private>False</Private> 59 </Reference> 56 60 </ItemGroup> 57 61 <ItemGroup> -
binary-improvements/7dtd-server-fixes/src/API.cs
r232 r233 13 13 } 14 14 15 public override void SavePlayerData ( int _clientId, PlayerDataFile _playerDataFile) {16 PlayerDataStuff.GM_SavePlayerData (_c lientId, _playerDataFile);15 public override void SavePlayerData (ClientInfo _cInfo, PlayerDataFile _playerDataFile) { 16 PlayerDataStuff.GM_SavePlayerData (_cInfo, _playerDataFile); 17 17 } 18 18 19 public override void PlayerLogin ( int _clientId, string _name, string _playerId, string _token, string _compatibilityVersion) {19 public override void PlayerLogin (ClientInfo _cInfo, string _compatibilityVersion) { 20 20 } 21 21 22 public override void PlayerSpawning ( int _clientId, string _name, int _chunkViewDim, PlayerProfile _playerProfile) {23 AllocsLogFunctions.RequestToSpawnPlayer (_c lientId, _name, _chunkViewDim, _playerProfile);22 public override void PlayerSpawning (ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile) { 23 AllocsLogFunctions.RequestToSpawnPlayer (_cInfo, _chunkViewDim, _playerProfile); 24 24 } 25 25 -
binary-improvements/7dtd-server-fixes/src/AllocsLogFunctions.cs
r230 r233 8 8 public class AllocsLogFunctions 9 9 { 10 public static void RequestToSpawnPlayer ( int _clientId, string _name, int _chunkViewDim, PlayerProfile _playerProfile)10 public static void RequestToSpawnPlayer (ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile) 11 11 { 12 12 try { 13 ClientInfo ci = ConnectionManager.Instance.GetClient (_clientId); 14 15 Log.Out ("Player connected, clientid=" + _clientId + 16 ", entityid=" + ci.entityId + 17 ", name=" + ci.playerName + 18 ", steamid=" + ci.playerId + 19 ", ip=" + ci.ip 13 Log.Out ("Player connected" + 14 ", entityid=" + _cInfo.entityId + 15 ", name=" + _cInfo.playerName + 16 ", steamid=" + _cInfo.playerId + 17 ", ip=" + _cInfo.ip 20 18 ); 21 19 22 PersistentContainer.Instance.Players [ ci.playerId].SetOnline (ci);20 PersistentContainer.Instance.Players [_cInfo.playerId, true].SetOnline (_cInfo); 23 21 PersistentData.PersistentContainer.Instance.Save (); 24 22 } catch (Exception e) { … … 30 28 { 31 29 try { 32 Player p = PersistentContainer.Instance.Players [_cInfo.playerId ];30 Player p = PersistentContainer.Instance.Players [_cInfo.playerId, true]; 33 31 if (p != null) { 34 32 p.SetOffline (); -
binary-improvements/7dtd-server-fixes/src/AssemblyInfo.cs
r232 r233 18 18 // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 19 20 [assembly: AssemblyVersion("0.11. 3.0")]20 [assembly: AssemblyVersion("0.11.4.0")] 21 21 22 22 // The following attributes are used to specify the signing key for the assembly, -
binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs
r230 r233 20 20 private int 21 21 lastPositionX, lastPositionY, lastPositionZ; 22 [OptionalField] 23 private uint experience; 22 24 [NonSerialized] 23 25 private ClientInfo … … 94 96 } 95 97 98 public uint Experience { 99 get { 100 return experience; 101 } 102 } 103 104 public float Level { 105 get { 106 float perc = (float)experience / 600000; 107 perc = Mathf.Sqrt (perc); 108 return Mathf.Clamp ((perc * 60) + 1, 1, 60); 109 } 110 } 111 96 112 public void SetOffline () 97 113 { … … 121 137 } 122 138 139 public void Update (PlayerDataFile _pdf) { 140 experience = _pdf.experience; 141 inventory.Update (_pdf); 142 } 143 123 144 public Player (string steamId) 124 145 { -
binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs
r202 r233 11 11 private Dictionary<string, Player> players = new Dictionary<string, Player> (); 12 12 13 public Player this [string steamId ] {13 public Player this [string steamId, bool create] { 14 14 get { 15 15 if (players.ContainsKey (steamId)) 16 16 return players [steamId]; 17 17 else { 18 if ( steamId != null && steamId.Length == 17) {18 if (create && steamId != null && steamId.Length == 17) { 19 19 Log.Out ("Created new player entry for ID: " + steamId); 20 20 Player p = new Player (steamId); … … 35 35 } 36 36 37 public Player GetPlayerByClientId (int _clientid) 38 { 39 foreach (Player p in players.Values) { 40 if (p.ClientInfo != null && p.ClientInfo.clientId == _clientid) { 41 return p; 42 } 43 } 44 return null; 45 } 46 47 public Player GetPlayerByNameOrId (string _nameOrId, bool _ignoreColorCodes) 48 { 49 string sid = GetSteamID (_nameOrId, _ignoreColorCodes); 50 if (sid != null) 51 return this [sid]; 52 else 53 return null; 54 } 37 // public Player GetPlayerByNameOrId (string _nameOrId, bool _ignoreColorCodes) 38 // { 39 // string sid = GetSteamID (_nameOrId, _ignoreColorCodes); 40 // if (sid != null) 41 // return this [sid]; 42 // else 43 // return null; 44 // } 55 45 56 46 public string GetSteamID (string _nameOrId, bool _ignoreColorCodes) -
binary-improvements/7dtd-server-fixes/src/PlayerDataStuff.cs
r232 r233 8 8 { 9 9 10 public static void GM_SavePlayerData ( int _clientId, PlayerDataFile _playerDataFile)10 public static void GM_SavePlayerData (ClientInfo _cInfo, PlayerDataFile _playerDataFile) 11 11 { 12 12 try { 13 ClientInfo ci = ConnectionManager.Instance.GetClient (_clientId); 14 PersistentContainer.Instance.Players[ci.playerId].Inventory.Update(_playerDataFile); 13 PersistentContainer.Instance.Players[_cInfo.playerId, true].Update (_playerDataFile); 15 14 } catch (Exception e) { 16 15 Log.Out ("Error in GM_SavePlayerData: " + e); -
binary-improvements/AllocsCommands/AllocsCommands.csproj
r230 r233 42 42 <Compile Include="AssemblyInfo.cs" /> 43 43 <Compile Include="Commands\Give.cs" /> 44 <Compile Include="Commands\ListItems.cs" />45 44 <Compile Include="Commands\ListKnownPlayers.cs" /> 46 45 <Compile Include="Commands\ListLandProtection.cs" /> … … 52 51 <Compile Include="PrivateMassageConnections.cs" /> 53 52 <Compile Include="Chat.cs" /> 53 <Compile Include="Commands\ListItems.cs" /> 54 <Compile Include="Commands\GenerateItemIcons.cs" /> 54 55 </ItemGroup> 55 56 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
binary-improvements/AllocsCommands/Commands/ListKnownPlayers.cs
r230 r233 38 38 int num = 0; 39 39 foreach (string sid in PersistentContainer.Instance.Players.SteamIDs) { 40 Player p = PersistentContainer.Instance.Players [sid ];40 Player p = PersistentContainer.Instance.Players [sid, false]; 41 41 42 42 if ( -
binary-improvements/AllocsCommands/Commands/ListLandProtection.cs
r230 r233 86 86 foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) { 87 87 if (steamIdFilter.Length == 0 || kvp.Key.PlayerId.Equals (steamIdFilter)) { 88 string name = PersistentData.PersistentContainer.Instance.Players [kvp.Key.PlayerId].Name; 88 PersistentData.Player p = PersistentData.PersistentContainer.Instance.Players [kvp.Key.PlayerId, false]; 89 string name = string.Empty; 90 if (p != null) { 91 name = p.Name; 92 } 89 93 name += " (" + kvp.Key.PlayerId + ")"; 90 94 -
binary-improvements/AllocsCommands/Commands/Reply.cs
r230 r233 26 26 27 27 ClientInfo receiver = PrivateMassageConnections.GetLastPMSenderForPlayer (_sender); 28 if (receiver != null && receiver.clientId >= 0) {28 if (receiver != null) { 29 29 Chat.SendMessage (receiver, _sender, message); 30 30 } else { -
binary-improvements/AllocsCommands/Commands/ShowInventory.cs
r230 r233 31 31 } 32 32 33 Player p = PersistentContainer.Instance.Players [steamid ];33 Player p = PersistentContainer.Instance.Players [steamid, false]; 34 34 PersistentData.Inventory inv = p.Inventory; 35 35 -
binary-improvements/MapRendering/MapRendering/MapRenderBlockBuffer.cs
r230 r233 74 74 { 75 75 byte[] array = cache.LoadTile (zoomLevel, _fileName); 76 if (array == null || !blockMap.LoadImage (array)) { 76 if (array == null || !blockMap.LoadImage (array) || blockMap.height != Constants.MAP_BLOCK_SIZE || blockMap.width != Constants.MAP_BLOCK_SIZE) { 77 if (array != null) { 78 Log.Error ("Map image tile " + _fileName + " has been corrupted, recreating tile"); 79 } 80 77 81 if (blockMap.height != Constants.MAP_BLOCK_SIZE || blockMap.width != Constants.MAP_BLOCK_SIZE) { 78 82 blockMap.Resize (Constants.MAP_BLOCK_SIZE, Constants.MAP_BLOCK_SIZE); -
binary-improvements/MapRendering/Web/API/GetPlayerInventory.cs
r230 r233 17 17 } 18 18 19 Player p = PersistentContainer.Instance.Players [req.QueryString ["steamid"] ];19 Player p = PersistentContainer.Instance.Players [req.QueryString ["steamid"], false]; 20 20 if (p == null) { 21 21 resp.StatusCode = (int)HttpStatusCode.InternalServerError; -
binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs
r230 r233 16 16 17 17 foreach (string sid in playersList.SteamIDs) { 18 Player p = playersList[sid ];18 Player p = playersList[sid, false]; 19 19 20 20 JSONObject pos = new JSONObject(); -
binary-improvements/MapRendering/Web/API/GetPlayersOnline.cs
r230 r233 1 1 using AllocsFixes.JSON; 2 using AllocsFixes.PersistentData; 2 3 using System; 3 4 using System.Collections.Generic; … … 15 16 foreach (KeyValuePair<int, EntityPlayer> current in w.Players.dict) { 16 17 ClientInfo ci = ConnectionManager.Instance.GetClientInfoForEntityId (current.Key); 17 string ip = string.Empty; 18 if (ci != null) { 19 ip = ci.ip; 20 } 18 Player player = PersistentContainer.Instance.Players [ci.playerId, false]; 21 19 22 20 JSONObject pos = new JSONObject(); 23 pos.Add ("x", new JSONNumber((int)current.Value.GetPosition().x));24 pos.Add ("y", new JSONNumber((int)current.Value.GetPosition().y));25 pos.Add ("z", new JSONNumber((int)current.Value.GetPosition().z));21 pos.Add ("x", new JSONNumber ((int)current.Value.GetPosition ().x)); 22 pos.Add ("y", new JSONNumber ((int)current.Value.GetPosition ().y)); 23 pos.Add ("z", new JSONNumber ((int)current.Value.GetPosition ().z)); 26 24 27 25 JSONObject p = new JSONObject(); 28 p.Add("steamid", new JSONString(ci.playerId)); 29 p.Add("ip", new JSONString(ip)); 30 p.Add("name", new JSONString(current.Value.EntityName)); 31 p.Add("online", new JSONBoolean(true)); 32 p.Add("position", pos); 26 p.Add ("steamid", new JSONString (ci.playerId)); 27 p.Add ("ip", new JSONString (ci != null ? ci.ip : string.Empty)); 28 p.Add ("name", new JSONString (current.Value.EntityName)); 29 p.Add ("online", new JSONBoolean (true)); 30 p.Add ("position", pos); 31 32 p.Add ("experience", new JSONNumber (player != null ? player.Experience : 0)); 33 p.Add ("level", new JSONNumber (player != null ? player.Level : -1)); 34 p.Add ("health", new JSONNumber (current.Value.Health)); 35 p.Add ("stamina", new JSONNumber (current.Value.Stamina)); 36 p.Add ("zombiekills", new JSONNumber (current.Value.KilledZombies)); 37 p.Add ("playerkills", new JSONNumber (current.Value.KilledPlayers)); 38 p.Add ("playerdeaths", new JSONNumber (current.Value.Died)); 39 p.Add ("score", new JSONNumber (current.Value.Score)); 33 40 34 41 players.Add(p); -
binary-improvements/server-fixes.userprefs
r232 r233 1 1 <Properties> 2 2 <MonoDevelop.Ide.Workspace ActiveConfiguration="Release_Version" /> 3 <MonoDevelop.Ide.Workbench ActiveDocument="7dtd-server-fixes/src/PersistentData/ Inventory.cs">3 <MonoDevelop.Ide.Workbench ActiveDocument="7dtd-server-fixes/src/PersistentData/Players.cs"> 4 4 <Files> 5 <File FileName="MapRendering/Web/MimeType.cs" Line="28" Column="54" /> 6 <File FileName="7dtd-server-fixes/src/PersistentData/InvItem.cs" Line="11" Column="3" /> 7 <File FileName="7dtd-server-fixes/src/PersistentData/Inventory.cs" Line="36" Column="7" /> 8 <File FileName="7dtd-server-fixes/src/PersistentData/PersistentContainer.cs" Line="38" Column="52" /> 9 <File FileName="AllocsCommands/Commands/ShowInventory.cs" Line="27" Column="60" /> 10 <File FileName="7dtd-server-fixes/src/PersistentData/Players.cs" Line="56" Column="3" /> 11 <File FileName="7dtd-server-fixes/src/PlayerDataStuff.cs" Line="14" Column="68" /> 5 <File FileName="MapRendering/MapRendering/MapRenderBlockBuffer.cs" Line="73" Column="54" /> 6 <File FileName="MapRendering/MapRendering/MapRendering.cs" Line="237" Column="75" /> 7 <File FileName="AllocsCommands/Commands/Reply.cs" Line="28" Column="24" /> 8 <File FileName="AllocsCommands/Commands/GenerateItemIcons.cs" Line="38" Column="1" /> 9 <File FileName="MapRendering/MapRendering/Constants.cs" Line="1" Column="1" /> 10 <File FileName="MapRendering/Web/API/GetPlayersOnline.cs" Line="42" Column="1" /> 11 <File FileName="7dtd-server-fixes/src/PersistentData/Player.cs" Line="18" Column="3" /> 12 <File FileName="7dtd-server-fixes/src/PersistentData/Players.cs" Line="1" Column="1" /> 12 13 </Files> 13 14 <Pads>
Note:
See TracChangeset
for help on using the changeset viewer.