Changeset 306 for binary-improvements/AllocsCommands
- Timestamp:
- Aug 2, 2017, 6:46:15 PM (7 years ago)
- Location:
- binary-improvements/AllocsCommands
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/Give.cs
r299 r306 39 39 } 40 40 41 ItemValue iv = Item List.Instance.GetItemValue (_params [1]);42 if (iv == null) {41 ItemValue iv = ItemClass.GetItem (_params [1], true); 42 if (iv.type == ItemValue.None.type) { 43 43 SdtdConsole.Instance.Output ("Item not found."); 44 44 return; 45 45 } 46 47 iv = new ItemValue (iv.type, true); 46 48 47 49 int n = int.MinValue; … … 88 90 ItemStack invField = new ItemStack (iv, n); 89 91 90 GameManager.Instance.ItemDropServer (invField, p.GetPosition (), Vector3.zero , -1, 50);92 GameManager.Instance.ItemDropServer (invField, p.GetPosition (), Vector3.zero); 91 93 92 94 SdtdConsole.Instance.Output ("Dropped item"); -
binary-improvements/AllocsCommands/Commands/ListItems.cs
r273 r306 16 16 } 17 17 18 public override string GetHelp () { 19 return "List all available item names\n" + 20 "Usage:\n" + 21 " 1. listitems <searchString>\n" + 22 " 2. listitems *\n" + 23 "1. List only names that contain the given string.\n" + 24 "2. List all names."; 25 } 26 18 27 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) 19 28 { … … 24 33 } 25 34 26 int n = 0; 27 foreach (string s in ItemList.Instance.ItemNames) { 28 if (s.ToLower ().Contains (_params [0].ToLower ()) || _params[0].Trim().Equals("*")) { 35 int count = ItemClass.ItemNames.Count; 36 bool showAll = _params[0].Trim().Equals("*"); 37 38 int listed = 0; 39 for (int i = 0; i < count; i++) { 40 string s = ItemClass.ItemNames [i]; 41 if (showAll || s.IndexOf (_params [0], StringComparison.OrdinalIgnoreCase) >= 0) { 29 42 SdtdConsole.Instance.Output (" " + s); 30 n++;43 listed++; 31 44 } 32 45 } 33 46 34 SdtdConsole.Instance.Output ("Listed " + n+ " matching items.");47 SdtdConsole.Instance.Output ("Listed " + listed + " matching items."); 35 48 } catch (Exception e) { 36 49 Log.Out ("Error in ListItems.Run: " + e); -
binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs
r266 r306 15 15 " 1. removelandprotection <steamid>\n" + 16 16 " 2. removelandprotection <x> <y> <z>\n" + 17 " 3. removelandprotection nearby [length]\n" + 17 18 "1. Remove all land claims owned by the user with the given SteamID\n" + 18 "2. Remove only the claim block on the exactly given block position"; 19 "2. Remove only the claim block on the exactly given block position\n" + 20 "3. Remove all claims in a square with edge length of 64 (or the optionally specified size) around the executing player"; 19 21 } 20 22 … … 95 97 { 96 98 try { 97 if (_params.Count == 1) { 99 if (_senderInfo.RemoteClientInfo != null) { 100 if (_params.Count >= 1 && _params [0].EqualsCaseInsensitive ("nearby")) { 101 _params.Add (_senderInfo.RemoteClientInfo.playerId); 102 } 103 } 104 105 if (_params.Count > 0 && _params [0].EqualsCaseInsensitive ("nearby")) { 106 try { 107 int closeToDistance = 32; 108 if (_params.Count == 3) { 109 if (!int.TryParse (_params[1], out closeToDistance)) { 110 SdtdConsole.Instance.Output ("Given length is not an integer!"); 111 return; 112 } 113 closeToDistance /= 2; 114 } 115 ClientInfo ci = ConsoleHelper.ParseParamSteamIdOnline (_params [_params.Count - 1]); 116 EntityPlayer ep = GameManager.Instance.World.Players.dict [ci.entityId]; 117 Vector3i closeTo = new Vector3i (ep.GetPosition ()); 118 LandClaimList.PositionFilter[] posFilters = new LandClaimList.PositionFilter[] { LandClaimList.CloseToFilter2dRect (closeTo, closeToDistance) }; 119 Dictionary<PersistentData.Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (null, posFilters); 120 121 try { 122 List<BlockChangeInfo> changes = new List<BlockChangeInfo> (); 123 foreach (KeyValuePair<PersistentData.Player, List<Vector3i>> kvp in claims) { 124 foreach (Vector3i v in kvp.Value) { 125 BlockChangeInfo bci = new BlockChangeInfo (v, new BlockValue (0), true, false); 126 changes.Add (bci); 127 } 128 } 129 GameManager.Instance.SetBlocksRPC (changes); 130 } catch (Exception e) { 131 SdtdConsole.Instance.Output ("Error removing claims"); 132 Log.Out ("Error in RemoveLandProtection.Run: " + e); 133 return; 134 } 135 } catch (Exception e) { 136 SdtdConsole.Instance.Output ("Error getting current player's position"); 137 Log.Out ("Error in RemoveLandProtection.Run: " + e); 138 return; 139 } 140 } else if (_params.Count == 1) { 98 141 removeById (_params [0]); 99 142 } else if (_params.Count == 3) { 100 143 removeByPosition (_params); 101 144 } else { 102 SdtdConsole.Instance.Output (" Usage: removelandprotection <x> <y> <z> OR removelandprotection <steamid>");145 SdtdConsole.Instance.Output ("Illegal parameters"); 103 146 } 104 147 } catch (Exception e) { -
binary-improvements/AllocsCommands/ModInfo.xml
r299 r306 5 5 <Description value="Additional commands for server operation" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="1 2" />7 <Version value="13" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo>
Note:
See TracChangeset
for help on using the changeset viewer.