//Maybe have armour etc. as a set command and special case here somehow private InternalNameValue processSetCommand(string command) { InternalNameValue intNamVal = new InternalNameValue(); Item x = new Item(); command = removeCommandPortion(command, "set"); if (!command.Contains(" ")) { return(null); } intNamVal.internalName = command.Substring(0, command.IndexOf(' ')); x = Get_Item(intNamVal.internalName); if (null == x) { return(null); } command = removeCommandPortion(command, intNamVal.internalName); if ("max" == command || "on" == command) { intNamVal.value = x.maxVal; return(intNamVal); } if ("min" == command || "off" == command) { intNamVal.value = x.minVal; return(intNamVal); } int val = getInt(command); if (-1 == val) { return(null); } intNamVal.value = (ushort)val; return(intNamVal); }
public void ParseCommand(string command) { command = preprocessCommand(command); if (null == command) { return; } InternalNameValue intNamVal = new InternalNameValue(); Item x; x = Get_Item(getInternalNameGiveRemoveCommand(command)); if (null == x) { x = new Item(); } if (command.StartsWith("give")) { command = removeCommandPortion(command, "give"); command = "set " + command + " " + x.maxVal.ToString(); } if (command.StartsWith("remove")) { command = removeCommandPortion(command, "remove"); command = "set " + command + " " + x.minVal.ToString(); } if (command.StartsWith("set")) { intNamVal = processSetCommand(command); if (null == intNamVal) { return; } Set_Item(intNamVal.internalName, intNamVal.value); return; } }