public static int FurnaceCalc(int SmeltType, int Smelters) { SmeltType = DwarfLibrary.GetFurnaceMultiplier(SmeltType); if (SmeltType > 0) { return((Smelters % SmeltType == 0) ? Smelters / SmeltType : (int)(Smelters / SmeltType) + 1); } else { return(0); } }
public static int CraftCalc(int Rangers, int Multiplier) { Multiplier = DwarfLibrary.GetCraftValue(Multiplier); if (Multiplier > 0) { return((Rangers % Multiplier == 0) ? Rangers / Multiplier : (int)(Rangers / Multiplier) + 1); } else { return(0); } }
public static int SmeltCalc(int Multiplier, int CraftShops) { Multiplier = DwarfLibrary.GetSmeltMultiplier(Multiplier); if (Multiplier > 0) { return((CraftShops % Multiplier == 0) ? CraftShops / Multiplier : (int)(CraftShops / Multiplier) + 1); } else { return(0); } }
public static int KitchenCalc(int Dwarfs, int Multiplier) { Multiplier = DwarfLibrary.GetKitchenValue(Multiplier); if (Multiplier > 0) { return((Dwarfs % Multiplier == 0) ? Dwarfs / Multiplier : (int)(Dwarfs / Multiplier) + 1); } else { return(0); } }
public Calculator(int DwarfCount, int RangerCount, int KitchenItemIndex, int CraftItemIndex) { int resultTEMP = DwarfMath.KitchenCalc(DwarfCount, KitchenItemIndex); KitchenOutput = resultTEMP.ToString(); FarmerOutput = DwarfMath.FarmCalc(resultTEMP).ToString(); resultTEMP = DwarfMath.CraftCalc(RangerCount, CraftItemIndex); CraftOutput = resultTEMP.ToString(); SmelterItemInput = DwarfLibrary.GetItemToSmelt(CraftItemIndex); SmelterOutput = DwarfMath.SmeltCalc(CraftItemIndex, resultTEMP).ToString(); if (int.TryParse(SmelterOutput, out int n)) { resultTEMP = int.Parse(SmelterOutput); FurnaceOutput = DwarfMath.FurnaceCalc(CraftItemIndex, resultTEMP).ToString(); } else { FurnaceOutput = "0"; } FinishCalc(); }