Changeset 233 for binary-improvements/7dtd-server-fixes/src
- Timestamp:
- Apr 30, 2015, 1:55:16 AM (10 years ago)
- Location:
- binary-improvements/7dtd-server-fixes/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.