- Timestamp:
- Jun 21, 2024, 2:58:18 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/ShowInventory.cs
r455 r488 6 6 [UsedImplicitly] 7 7 public class ShowInventory : ConsoleCmdAbstract { 8 p rotectedoverride string getDescription () {8 public override string getDescription () { 9 9 return "list inventory of a given player"; 10 10 } 11 11 12 p rotectedoverride string getHelp () {12 public override string getHelp () { 13 13 return "Usage:\n" + 14 14 " showinventory <user id / player name / entity id> [tag]\n" + … … 21 21 } 22 22 23 p rotectedoverride string[] getCommands () {23 public override string[] getCommands () { 24 24 return new[] {"showinventory", "si"}; 25 25 } … … 103 103 104 104 private static void PrintEquipment (IReadOnlyList<InvItem> _equipment, int _entityId, string _location, string _tag) { 105 AddEquipment ("head", _equipment, EquipmentSlots.Head gear, _entityId, _location, _tag);106 AddEquipment ("eyes", _equipment, EquipmentSlots.Eyewear, _entityId, _location, _tag);107 AddEquipment ("face", _equipment, EquipmentSlots.Face, _entityId, _location, _tag);105 AddEquipment ("head", _equipment, EquipmentSlots.Head, _entityId, _location, _tag); 106 // AddEquipment ("eyes", _equipment, EquipmentSlots.Eyewear, _entityId, _location, _tag); 107 // AddEquipment ("face", _equipment, EquipmentSlots.Face, _entityId, _location, _tag); 108 108 109 AddEquipment ("armor", _equipment, EquipmentSlots.Chest Armor, _entityId, _location, _tag);110 AddEquipment ("jacket", _equipment, EquipmentSlots.Jacket, _entityId, _location, _tag);111 AddEquipment ("shirt", _equipment, EquipmentSlots.Shirt, _entityId, _location, _tag);109 AddEquipment ("armor", _equipment, EquipmentSlots.Chest, _entityId, _location, _tag); 110 // AddEquipment ("jacket", _equipment, EquipmentSlots.Jacket, _entityId, _location, _tag); 111 // AddEquipment ("shirt", _equipment, EquipmentSlots.Shirt, _entityId, _location, _tag); 112 112 113 AddEquipment ("legarmor", _equipment, EquipmentSlots.LegArmor, _entityId, _location, _tag);114 AddEquipment ("pants", _equipment, EquipmentSlots.Legs, _entityId, _location, _tag);113 // AddEquipment ("legarmor", _equipment, EquipmentSlots.LegArmor, _entityId, _location, _tag); 114 // AddEquipment ("pants", _equipment, EquipmentSlots.Legs, _entityId, _location, _tag); 115 115 AddEquipment ("boots", _equipment, EquipmentSlots.Feet, _entityId, _location, _tag); 116 116 … … 120 120 private static void AddEquipment (string _slotname, IReadOnlyList<InvItem> _items, EquipmentSlots _slot, int _entityId, 121 121 string _location, string _tag) { 122 int [] slotindices = XUiM_PlayerEquipment.GetSlotIndicesByEquipmentSlot (_slot);122 int slotindex = (int)_slot; 123 123 124 for (int i = 0; i < slotindices.Length; i++) { 125 if (_items == null || _items[slotindices[i]] == null) { 126 continue; 124 if (_items == null || _items[slotindex] == null) { 125 return; 126 } 127 128 InvItem item = _items [slotindex]; 129 if (_tag == null) { 130 // no Tag defined -> readable output 131 if (item.quality < 0) { 132 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000}", _slotname, 133 item.itemName)); 134 } else { 135 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000} - quality: {2}", 136 _slotname, item.itemName, item.quality)); 127 137 } 128 138 129 InvItem item = _items [slotindices [i]]; 130 if (_tag == null) { 131 // no Tag defined -> readable output 132 if (item.quality < 0) { 133 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000}", _slotname, 134 item.itemName)); 135 } else { 136 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000} - quality: {2}", 137 _slotname, item.itemName, item.quality)); 138 } 139 140 DoParts (_items [slotindices [i]].parts, 1, null); 141 } else { 142 // Tag defined -> parseable output 143 string partsMsg = DoParts (_items [slotindices [i]].parts, 1, ""); 144 string msg = $"tracker_item id={_entityId}, tag={_tag}, location={_location}, slot={_slotname}, item={item.itemName}, qnty=1, quality={item.quality}, parts=({partsMsg})"; 145 SdtdConsole.Instance.Output (msg); 146 } 147 148 return; 139 DoParts (_items [slotindex].parts, 1, null); 140 } else { 141 // Tag defined -> parseable output 142 string partsMsg = DoParts (_items [slotindex].parts, 1, ""); 143 string msg = $"tracker_item id={_entityId}, tag={_tag}, location={_location}, slot={_slotname}, item={item.itemName}, qnty=1, quality={item.quality}, parts=({partsMsg})"; 144 SdtdConsole.Instance.Output (msg); 149 145 } 150 146 }
Note:
See TracChangeset
for help on using the changeset viewer.