Changeset 351 for binary-improvements/7dtd-server-fixes/src/PersistentData
- Timestamp:
- Jan 19, 2019, 6:12:21 PM (6 years ago)
- Location:
- binary-improvements/7dtd-server-fixes/src/PersistentData
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/PersistentData/InvItem.cs
r325 r351 16 16 public int useTimes; 17 17 18 public InvItem (string itemName, int count, int quality, int maxUseTimes, intmaxUse) {19 this.itemName =itemName;20 this.count =count;21 this.quality =quality;22 this.maxUseTimes =maxUseTimes;23 this.useTimes =maxUse;18 public InvItem (string _itemName, int _count, int _quality, int _maxUseTimes, int _maxUse) { 19 itemName = _itemName; 20 count = _count; 21 quality = _quality; 22 maxUseTimes = _maxUseTimes; 23 useTimes = _maxUse; 24 24 } 25 25 } -
binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs
r326 r351 15 15 } 16 16 17 public void Update (PlayerDataFile pdf) {17 public void Update (PlayerDataFile _pdf) { 18 18 lock (this) { 19 19 //Log.Out ("Updating player inventory - player id: " + pdf.id); 20 ProcessInv (bag, pdf.bag,pdf.id);21 ProcessInv (belt, pdf.inventory,pdf.id);22 ProcessEqu ( pdf.equipment,pdf.id);20 ProcessInv (bag, _pdf.bag, _pdf.id); 21 ProcessInv (belt, _pdf.inventory, _pdf.id); 22 ProcessEqu (_pdf.equipment, _pdf.id); 23 23 } 24 24 } 25 25 26 private void ProcessInv (List<InvItem> target, ItemStack[] sourceFields, intid) {27 target.Clear ();28 for (int i = 0; i < sourceFields.Length; i++) {29 InvItem item = CreateInvItem ( sourceFields [i].itemValue, sourceFields [i].count,id);30 if (item != null && sourceFields [i].itemValue.Modifications != null) {31 ProcessParts ( sourceFields [i].itemValue.Modifications, item,id);26 private void ProcessInv (List<InvItem> _target, ItemStack[] _sourceFields, int _id) { 27 _target.Clear (); 28 for (int i = 0; i < _sourceFields.Length; i++) { 29 InvItem item = CreateInvItem (_sourceFields [i].itemValue, _sourceFields [i].count, _id); 30 if (item != null && _sourceFields [i].itemValue.Modifications != null) { 31 ProcessParts (_sourceFields [i].itemValue.Modifications, item, _id); 32 32 } 33 33 34 target.Add (item);34 _target.Add (item); 35 35 } 36 36 } 37 37 38 private void ProcessEqu (Equipment sourceEquipment, int _playerId) {39 equipment = new InvItem[ sourceEquipment.GetSlotCount ()];40 for (int i = 0; i < sourceEquipment.GetSlotCount (); i++) {41 equipment [i] = CreateInvItem ( sourceEquipment.GetSlotItem (i), 1, _playerId);38 private void ProcessEqu (Equipment _sourceEquipment, int _playerId) { 39 equipment = new InvItem[_sourceEquipment.GetSlotCount ()]; 40 for (int i = 0; i < _sourceEquipment.GetSlotCount (); i++) { 41 equipment [i] = CreateInvItem (_sourceEquipment.GetSlotItem (i), 1, _playerId); 42 42 } 43 43 } -
binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs
r333 r351 168 168 } 169 169 170 public Player (string steamId) {171 this.steamId =steamId;170 public Player (string _steamId) { 171 steamId = _steamId; 172 172 inventory = new Inventory (); 173 173 } … … 193 193 } 194 194 195 public void SetOnline (ClientInfo ci) {195 public void SetOnline (ClientInfo _ci) { 196 196 Log.Out ("Player set to online: " + steamId); 197 clientInfo = ci;198 entityId = ci.entityId;199 name = ci.playerName;200 ip = ci.ip;197 clientInfo = _ci; 198 entityId = _ci.entityId; 199 name = _ci.playerName; 200 ip = _ci.ip; 201 201 lastOnline = DateTime.Now; 202 202 } -
binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs
r332 r351 8 8 public readonly Dictionary<string, Player> Dict = new Dictionary<string, Player> (StringComparer.OrdinalIgnoreCase); 9 9 10 public Player this [string steamId, boolcreate] {10 public Player this [string _steamId, bool _create] { 11 11 get { 12 if (string.IsNullOrEmpty ( steamId)) {12 if (string.IsNullOrEmpty (_steamId)) { 13 13 return null; 14 14 } 15 15 16 if (Dict.ContainsKey ( steamId)) {17 return Dict [ steamId];16 if (Dict.ContainsKey (_steamId)) { 17 return Dict [_steamId]; 18 18 } 19 19 20 if (! create ||steamId.Length != 17) {20 if (!_create || _steamId.Length != 17) { 21 21 return null; 22 22 } 23 23 24 Log.Out ("Created new player entry for ID: " + steamId);25 Player p = new Player ( steamId);26 Dict.Add ( steamId, p);24 Log.Out ("Created new player entry for ID: " + _steamId); 25 Player p = new Player (_steamId); 26 Dict.Add (_steamId, p); 27 27 return p; 28 28 }
Note:
See TracChangeset
for help on using the changeset viewer.