Changeset 325 for binary-improvements/AllocsCommands/Commands/Give.cs
- Timestamp:
- Sep 4, 2018, 1:00:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/Give.cs
r324 r325 3 3 using UnityEngine; 4 4 5 namespace AllocsFixes.CustomCommands 6 { 5 namespace AllocsFixes.CustomCommands { 7 6 public class Give : ConsoleCmdAbstract { 8 7 public override string GetDescription () { … … 12 11 public override string GetHelp () { 13 12 return "Give an item to a player by dropping it in front of that player\n" + 14 15 16 17 18 19 20 13 "Usage:\n" + 14 " give <name / entity id> <item name> <amount>\n" + 15 " give <name / entity id> <item name> <amount> <quality>\n" + 16 "Either pass the full name of a player or his entity id (given by e.g. \"lpi\").\n" + 17 "Item name has to be the exact name of an item as listed by \"listitems\".\n" + 18 "Amount is the number of instances of this item to drop (as a single stack).\n" + 19 "Quality is the quality of the dropped items for items that have a quality."; 21 20 } 22 21 23 22 public override string[] GetCommands () { 24 return new string[] { "give", string.Empty};23 return new[] {"give", string.Empty}; 25 24 } 26 25 … … 28 27 try { 29 28 if (_params.Count != 3 && _params.Count != 4) { 30 SdtdConsole.Instance.Output ("Wrong number of arguments, expected 3 or 4, found " + _params.Count + "."); 29 SdtdConsole.Instance.Output ("Wrong number of arguments, expected 3 or 4, found " + _params.Count + 30 "."); 31 31 return; 32 32 } … … 56 56 57 57 if (_params.Count == 4) { 58 if (!int.TryParse(_params [1], out quality) || quality <= 0) {58 if (!int.TryParse (_params [1], out quality) || quality <= 0) { 59 59 SdtdConsole.Instance.Output ("Quality is not an integer or not greater than zero."); 60 60 return; … … 64 64 if (ItemClass.list [iv.type].HasSubItems) { 65 65 for (int i = 0; i < iv.Modifications.Length; i++) { 66 ItemValue tmp = iv.Modifications [i];66 ItemValue tmp = iv.Modifications [i]; 67 67 tmp.Quality = quality; 68 iv.Modifications [i] = tmp;68 iv.Modifications [i] = tmp; 69 69 } 70 70 } else if (ItemClass.list [iv.type].HasQuality) {
Note:
See TracChangeset
for help on using the changeset viewer.