# HG changeset patch # User IBBoard # Date 1242744010 0 # Node ID 284ebe05158c00ba8ce4f580ff3ce593e4b38831 # Parent f70c709dad8bd2841c42e0fed5e954ba8768ecc8 Re #61 - Complete structure of API objects * Add methods for new cost multiplier and rounding * Reduce "train wreck" code by making some EquipmentItem properties visible on the UnitEquipmentItem no-open-ticket diff -r f70c709dad8b -r 284ebe05158c api/Objects/UnitEquipmentItem.cs --- a/api/Objects/UnitEquipmentItem.cs Tue May 19 14:27:40 2009 +0000 +++ b/api/Objects/UnitEquipmentItem.cs Tue May 19 14:40:10 2009 +0000 @@ -3,7 +3,8 @@ // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. using System; -using System.Xml; +using System.Xml; +using IBBoard.Lang; namespace IBBoard.WarFoundry.API.Objects { @@ -18,7 +19,9 @@ private int minNum; private int maxNum; private double minPercentage; - private double maxPercentage; + private double maxPercentage; + private double costMultiplier; + private RoundType roundType; private string mutexGroup; private UnitType unitType; @@ -45,8 +48,29 @@ public double Cost { - get { return item.Cost; } - } + get + { + return IBBMath.Round(EquipmentItem.Cost * CostMultiplier, CostRoundType); + } + } + + public double CostMultiplier + { + get { return costMultiplier; } + set + { + costMultiplier = value; + } + } + + public RoundType CostRoundType + { + get { return roundType; } + set + { + roundType = value; + } + } public bool IsRequired { @@ -157,6 +181,31 @@ return EquipmentForUnit.GetEquipmentItemsByExclusionGroup(MutexGroup).Length > 1; } } + + public ArmourType ItemArmourType + { + get { return EquipmentItem.ItemArmourType; } + } + + public string Description + { + get { return EquipmentItem.Description; } + } + + public Race EquipmentForRace + { + get { return EquipmentItem.EquipmentForRace; } + } + + public bool CanBeUsedWithItem(EquipmentItem item) + { + return EquipmentItem.CanBeUsedWithItem(item); + } + + public bool CanBeUsedWithArmourType(ArmourType otherItemType) + { + return EquipmentItem.CanBeUsedWithArmourType(otherItemType); + } public static string FormatEquipmentAmount(UnitEquipmentItem item, double amount) {