Changeset 273 for binary-improvements/AllocsCommands
- Timestamp:
- May 11, 2016, 8:54:19 PM (9 years ago)
- Location:
- binary-improvements/AllocsCommands
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/ListItems.cs
r230 r273 26 26 int n = 0; 27 27 foreach (string s in ItemList.Instance.ItemNames) { 28 if (s.ToLower ().Contains (_params [0].ToLower ()) ) {28 if (s.ToLower ().Contains (_params [0].ToLower ()) || _params[0].Trim().Equals("*")) { 29 29 SdtdConsole.Instance.Output (" " + s); 30 30 n++; -
binary-improvements/AllocsCommands/Commands/ListLandProtection.cs
r253 r273 13 13 public override string GetHelp () { 14 14 return "Usage:\n" + 15 " 1. listlandprotection summary\n" + 16 " 2. listlandprotection <steam id>\n" + 17 " 3. listlandprotection <player name / entity id>\n" + 18 " 4. listlandprotection nearby\n" + 19 " 5. listlandprotection nearby <radius>\n" + 20 "1. Lists only players that own claimstones, the number they own and the protection status\n" + 21 "2. Lists only the claims of the player given by his SteamID including the individual claim positions\n" + 22 "3. Same as 2 but player given by his player name or entity id (as given by e.g. \"lpi\")\n" + 23 "4. Lists claims in a square with edge length of 64 around the executing player\n" + 24 "5. Same as 4 but square edge length can be specified"; 15 " 1. listlandprotection summary\n" + 16 " 2. listlandprotection <steam id / player name / entity id> [parseable]\n" + 17 " 3. listlandprotection nearby [length]\n" + 18 "1. Lists only players that own claimstones, the number they own and the protection status\n" + 19 "2. Lists only the claims of the player given by his SteamID / entity id / playername, including the individual claim positions.\n" + 20 " If \"parseable\" is specified the output of the individual claims will be in a format better suited for programmatical readout.\n" + 21 "3. Lists claims in a square with edge length of 64 (or the optionally specified size) around the executing player\n"; 25 22 } 26 23 … … 47 44 bool onlyCloseToPlayer = false; 48 45 int closeToDistance = 32; 46 bool parseableOutput = false; 47 48 if (_params.Contains ("parseable")) { 49 parseableOutput = true; 50 _params.Remove ("parseable"); 51 } 49 52 50 53 if (_params.Count == 1) { … … 69 72 if (_params.Count == 3) { 70 73 if (!int.TryParse (_params[1], out closeToDistance)) { 71 SdtdConsole.Instance.Output ("Given radius is not an integer!"); 74 SdtdConsole.Instance.Output ("Given length is not an integer!"); 75 return; 72 76 } 77 closeToDistance /= 2; 73 78 } 74 79 ClientInfo ci = ConsoleHelper.ParseParamSteamIdOnline (_params [_params.Count - 1]); … … 79 84 SdtdConsole.Instance.Output ("Error getting current player's position"); 80 85 Log.Out ("Error in ListLandProtection.Run: " + e); 86 return; 81 87 } 82 88 } else { … … 108 114 if (!summaryOnly) { 109 115 foreach (Vector3i v in kvp.Value) { 110 SdtdConsole.Instance.Output (" (" + v.ToString () + ")"); 116 if (parseableOutput) { 117 SdtdConsole.Instance.Output ("LandProtectionOf: id=" + kvp.Key.SteamID + ", playerName=" + kvp.Key.Name + ", location=" + v.ToString ()); 118 } else { 119 SdtdConsole.Instance.Output (" (" + v.ToString () + ")"); 120 } 111 121 } 112 122 } -
binary-improvements/AllocsCommands/Commands/RepairChunkDensity.cs
r272 r273 11 11 12 12 public override string GetHelp () { 13 return "Usage:\n" + 13 return "This command is used to check if the densities of blocks in a chunk match the actual block type.\n" + 14 "If there is a mismatch it can lead to the chunk rendering incorrectly or not at all, typically\n" + 15 "indicated by the error message \"Failed setting triangles. Some indices are referencing out of\n" + 16 "bounds vertices.\". It can also fix such mismatches within a chunk.\n" + 17 "Usage:\n" + 14 18 " 1. repairchunkdensity <x> <z>\n" + 15 19 " 2. repairchunkdensity <x> <z> fix\n" + 16 "1. Teleports the player given by his SteamID, player name or entity id (as given by e.g. \"lpi\")\n" + 17 " to the specified location. Use y = -1 to spawn on ground.\n" + 18 "2. As 1, but destination given by another player which has to be online\n" + 19 "3. Teleport the local player to the position calculated by his current position and the given offsets"; 20 "1. Just checks the chunk and prints mismatched to the server log. x and z are the coordinates of any\n" + 21 " block within the chunk to check.\n" + 22 "2. Repairs any mismatch found in the chunk."; 20 23 } 21 24 -
binary-improvements/AllocsCommands/Commands/ShowInventory.cs
r253 r273 5 5 namespace AllocsFixes.CustomCommands 6 6 { 7 public class ShowInventory : ConsoleCmdAbstract { 7 public class ShowInventory : ConsoleCmdAbstract 8 { 8 9 9 public override string GetDescription () { 10 public override string GetDescription () 11 { 10 12 return "list inventory of a given player"; 11 13 } 12 14 13 public override string GetHelp () { 15 public override string GetHelp () 16 { 14 17 return "Usage:\n" + 15 " showinventory <steam id / player name / entity id>\n" + 16 "Show the inventory of the player given by his SteamID, player name or\n" + 17 "entity id (as given by e.g. \"lpi\")." + 18 "Note: This only shows the player's inventory after it was first sent to\n" + 19 "the server which happens at least every 30 seconds."; 18 " showinventory <steam id / player name / entity id> [tag]\n" + 19 "Show the inventory of the player given by his SteamID, player name or\n" + 20 "entity id (as given by e.g. \"lpi\").\n" + 21 "Optionally specify a tag that is included in each line of the output. In\n" + 22 "this case output is designed to be easily parseable by tools.\n" + 23 "Note: This only shows the player's inventory after it was first sent to\n" + 24 "the server which happens at least every 30 seconds."; 20 25 } 21 26 22 public override string[] GetCommands () { 27 public override string[] GetCommands () 28 { 23 29 return new string[] { "showinventory", "si" }; 24 30 } 25 31 26 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 32 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) 33 { 27 34 try { 28 35 if (_params.Count < 1) { 29 SdtdConsole.Instance.Output ("Usage: showinventory <steamid|playername|entityid> ");36 SdtdConsole.Instance.Output ("Usage: showinventory <steamid|playername|entityid> [tag]"); 30 37 return; 31 38 } … … 37 44 } 38 45 46 string tag = null; 47 if (_params.Count > 1 && _params [1].Length > 0) { 48 tag = _params [1]; 49 } 50 39 51 Player p = PersistentContainer.Instance.Players [steamid, false]; 40 52 PersistentData.Inventory inv = p.Inventory; 41 53 42 SdtdConsole.Instance.Output ("Belt of player " + p.Name + ":"); 43 PrintInv (inv.belt); 44 SdtdConsole.Instance.Output (string.Empty); 54 if (tag == null) 55 SdtdConsole.Instance.Output ("Belt of player " + p.Name + ":"); 56 PrintInv (inv.belt, p.EntityID, "belt", tag); 57 if (tag == null) 58 SdtdConsole.Instance.Output (string.Empty); 45 59 46 SdtdConsole.Instance.Output ("Bagpack of player " + p.Name + ":"); 47 PrintInv (inv.bag); 48 SdtdConsole.Instance.Output (string.Empty); 60 if (tag == null) 61 SdtdConsole.Instance.Output ("Bagpack of player " + p.Name + ":"); 62 PrintInv (inv.bag, p.EntityID, "backpack", tag); 63 if (tag == null) 64 SdtdConsole.Instance.Output (string.Empty); 49 65 50 SdtdConsole.Instance.Output ("Equipment of player " + p.Name + ":"); 51 PrintEquipment (inv.equipment); 66 if (tag == null) 67 SdtdConsole.Instance.Output ("Equipment of player " + p.Name + ":"); 68 PrintEquipment (inv.equipment, p.EntityID, "equipment", tag); 52 69 53 70 } catch (Exception e) { … … 56 73 } 57 74 58 private void PrintInv (List<InvItem> _inv) { 75 private void PrintInv (List<InvItem> _inv, int _entityId, string _location, string _tag) 76 { 59 77 for (int i = 0; i < _inv.Count; i++) { 60 78 if (_inv [i] != null) { 61 if (_inv [i].quality < 0) { 62 SdtdConsole.Instance.Output (string.Format (" Slot {0}: {1:000} * {2}", i, _inv [i].count, _inv [i].itemName)); 63 } else { 64 SdtdConsole.Instance.Output (string.Format (" Slot {0}: {1:000} * {2} - quality: {3}", i, _inv [i].count, _inv [i].itemName, _inv [i].quality)); 79 if (_tag == null) { // no Tag defined -> readable output 80 if (_inv [i].quality < 0) { 81 SdtdConsole.Instance.Output (string.Format (" Slot {0}: {1:000} * {2}", i, _inv [i].count, _inv [i].itemName)); 82 } else { 83 SdtdConsole.Instance.Output (string.Format (" Slot {0}: {1:000} * {2} - quality: {3}", i, _inv [i].count, _inv [i].itemName, _inv [i].quality)); 84 } 85 DoParts (_inv [i].parts, 1, null); 86 } else { // Tag defined -> parseable output 87 String partsMsg = DoParts(_inv[i].parts, 1, ""); 88 String msg = "tracker_item id=" + _entityId + ", tag=" + _tag + ", location=" + _location + ", slot=" + i + ", item=" + _inv[i].itemName + ", qnty=" + _inv[i].count + ", quality=" + _inv[i].quality + ", parts=(" + partsMsg + ")"; 89 SdtdConsole.Instance.Output(msg); 65 90 } 66 DoParts (_inv [i].parts, 1);67 91 } 68 92 } 69 93 } 70 94 71 private void PrintEquipment (InvItem[] _equipment) { 72 AddEquipment ("head", _equipment, EquipmentSlots.Headgear); 73 AddEquipment ("eyes", _equipment, EquipmentSlots.Eyewear); 74 AddEquipment ("face", _equipment, EquipmentSlots.Face); 95 private void PrintEquipment (InvItem[] _equipment, int _entityId, string _location, string _tag) 96 { 97 AddEquipment ("head", _equipment, EquipmentSlots.Headgear, _entityId, _location, _tag); 98 AddEquipment ("eyes", _equipment, EquipmentSlots.Eyewear, _entityId, _location, _tag); 99 AddEquipment ("face", _equipment, EquipmentSlots.Face, _entityId, _location, _tag); 75 100 76 AddEquipment ("armor", _equipment, EquipmentSlots.ChestArmor );77 AddEquipment ("jacket", _equipment, EquipmentSlots.Jacket );78 AddEquipment ("shirt", _equipment, EquipmentSlots.Shirt );101 AddEquipment ("armor", _equipment, EquipmentSlots.ChestArmor, _entityId, _location, _tag); 102 AddEquipment ("jacket", _equipment, EquipmentSlots.Jacket, _entityId, _location, _tag); 103 AddEquipment ("shirt", _equipment, EquipmentSlots.Shirt, _entityId, _location, _tag); 79 104 80 AddEquipment ("legarmor", _equipment, EquipmentSlots.LegArmor );81 AddEquipment ("pants", _equipment, EquipmentSlots.Legs );82 AddEquipment ("boots", _equipment, EquipmentSlots.Feet );105 AddEquipment ("legarmor", _equipment, EquipmentSlots.LegArmor, _entityId, _location, _tag); 106 AddEquipment ("pants", _equipment, EquipmentSlots.Legs, _entityId, _location, _tag); 107 AddEquipment ("boots", _equipment, EquipmentSlots.Feet, _entityId, _location, _tag); 83 108 84 AddEquipment ("gloves", _equipment, EquipmentSlots.Hands );109 AddEquipment ("gloves", _equipment, EquipmentSlots.Hands, _entityId, _location, _tag); 85 110 } 86 111 87 private void AddEquipment (string _slotname, InvItem[] _items, EquipmentSlots _slot) { 112 private void AddEquipment (string _slotname, InvItem[] _items, EquipmentSlots _slot, int _entityId, string _location, string _tag) 113 { 88 114 int[] slotindices = XUiM_PlayerEquipment.GetSlotIndicesByEquipmentSlot (_slot); 89 115 … … 91 117 if (_items != null && _items [slotindices [i]] != null) { 92 118 InvItem item = _items [slotindices [i]]; 93 if (item.quality < 0) { 94 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000}", _slotname, item.itemName)); 95 } else { 96 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000} - quality: {2}", _slotname, item.itemName, item.quality)); 119 if (_tag == null) { // no Tag defined -> readable output 120 if (item.quality < 0) { 121 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000}", _slotname, item.itemName)); 122 } else { 123 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000} - quality: {2}", _slotname, item.itemName, item.quality)); 124 } 125 DoParts (_items [slotindices [i]].parts, 1, null); 126 } else { // Tag defined -> parseable output 127 String partsMsg = DoParts(_items[slotindices[i]].parts, 1, ""); 128 String msg = "tracker_item id=" + _entityId + ", tag=" + _tag + ", location=" + _location + ", slot=" + _slotname + ", item=" + item.itemName + ", qnty=1, quality=" + item.quality + ", parts=(" + partsMsg + ")"; 129 SdtdConsole.Instance.Output(msg); 97 130 } 98 DoParts (_items [slotindices [i]].parts, 1);99 131 return; 100 132 } … … 102 134 } 103 135 104 private void DoParts (InvItem[] _parts, int _indent) { 136 private string DoParts (InvItem[] _parts, int _indent, string _currentMessage) 137 { 105 138 if (_parts != null && _parts.Length > 0) { 106 139 string indenter = new string (' ', _indent * 4); 107 140 for (int i = 0; i < _parts.Length; i++) { 108 141 if (_parts [i] != null) { 109 if (_parts [i].quality < 0) { 110 SdtdConsole.Instance.Output (string.Format ("{0} - {1}", indenter, _parts [i].itemName)); 111 } else { 112 SdtdConsole.Instance.Output (string.Format ("{0} - {1} - quality: {2}", indenter, _parts [i].itemName, _parts [i].quality)); 142 if (_currentMessage == null) { // no currentMessage given -> readable output 143 if (_parts [i].quality < 0) { 144 SdtdConsole.Instance.Output (string.Format ("{0} - {1}", indenter, _parts [i].itemName)); 145 } else { 146 SdtdConsole.Instance.Output (string.Format ("{0} - {1} - quality: {2}", indenter, _parts [i].itemName, _parts [i].quality)); 147 } 148 DoParts (_parts [i].parts, _indent + 1, _currentMessage); 149 } else { // currentMessage given -> parseable output 150 if (_currentMessage.Length > 0) { 151 _currentMessage += ","; 152 } 153 _currentMessage += _parts[i].itemName + "@" + _parts[i].quality; 154 _currentMessage = DoParts (_parts [i].parts, _indent + 1, _currentMessage); 113 155 } 114 DoParts (_parts [i].parts, _indent + 1);115 156 } 116 157 } 117 158 } 159 return _currentMessage; 118 160 } 119 161 -
binary-improvements/AllocsCommands/ModInfo.xml
r271 r273 5 5 <Description value="Additional commands for server operation" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value=" 7" />7 <Version value="8" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo>
Note:
See TracChangeset
for help on using the changeset viewer.