- Timestamp:
- Jul 24, 2014, 3:25:58 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/TelnetCommands/ShowInventory.cs
r93 r103 23 23 public override void Run (string[] _params) 24 24 { 25 if (_params.Length < 1) { 26 m_Console.md000a ("Usage: showinventory <playername|entityid>"); 27 return; 28 } 25 try { 26 if (_params.Length < 1) { 27 m_Console.md000a ("Usage: showinventory <playername|entityid>"); 28 return; 29 } 29 30 30 int entityId = -1;31 PlayerDataStuff.PlayerItems items = null;32 if (int.TryParse (_params [0], out entityId)) {33 items = PlayerDataStuff.GetPlayerItems (entityId);34 }31 int entityId = -1; 32 PlayerDataStuff.PlayerItems items = null; 33 if (int.TryParse (_params [0], out entityId)) { 34 items = PlayerDataStuff.GetPlayerItems (entityId); 35 } 35 36 36 if (items == null) { 37 string playerName = _params [0].ToLower (); 38 foreach (KeyValuePair<int, EntityPlayer> kvp in manager.World.playerEntities.dict) { 39 if (kvp.Value.EntityName.ToLower ().Equals (playerName)) { 40 entityId = kvp.Key; 41 break; 37 if (items == null) { 38 string playerName = _params [0].ToLower (); 39 foreach (KeyValuePair<int, EntityPlayer> kvp in manager.World.playerEntities.dict) { 40 if (kvp.Value.EntityName.ToLower ().Equals (playerName)) { 41 entityId = kvp.Key; 42 break; 43 } 42 44 } 43 45 } 46 items = PlayerDataStuff.GetPlayerItems (entityId); 47 48 if (items == null) { 49 m_Console.md000a ("Playername or entity id not found or no inventory saved (first saved after a player has been online for 30s)."); 50 return; 51 } 52 53 m_Console.md000a ("Belt of player:"); 54 foreach (KeyValuePair<string, int> kvp in items.belt) { 55 m_Console.md000a (string.Format (" {0:000} * {1}", kvp.Value, kvp.Key)); 56 } 57 m_Console.md000a (string.Empty); 58 m_Console.md000a ("Bagpack of player:"); 59 foreach (KeyValuePair<string, int> kvp in items.bag) { 60 m_Console.md000a (string.Format (" {0:000} * {1}", kvp.Value, kvp.Key)); 61 } 62 m_Console.md000a (string.Empty); 63 } catch (Exception e) { 64 Log.Out ("Error in ShowInventory.Run: " + e); 44 65 } 45 items = PlayerDataStuff.GetPlayerItems (entityId);46 47 if (items == null) {48 m_Console.md000a ("Playername or entity id not found or no inventory saved (first saved after a player has been online for 30s).");49 return;50 }51 52 m_Console.md000a ("Belt of player:");53 foreach (KeyValuePair<string, int> kvp in items.belt) {54 m_Console.md000a (string.Format (" {0:000} * {1}", kvp.Value, kvp.Key));55 }56 m_Console.md000a (string.Empty);57 m_Console.md000a ("Bagpack of player:");58 foreach (KeyValuePair<string, int> kvp in items.bag) {59 m_Console.md000a (string.Format (" {0:000} * {1}", kvp.Value, kvp.Key));60 }61 m_Console.md000a (string.Empty);62 66 } 63 67 }
Note:
See TracChangeset
for help on using the changeset viewer.