public OSRICItemModel(JSONObject _jo) { UID = _jo["Uid"].str; ItemType = OSRICConstants.GetEnum<OSRIC_ITEM_TYPE>(_jo["ItemType"].str); Name = _jo["Name"].str; Description = _jo["Description"].str; string[] smd = _jo[""].str.Split('-'); if(smd.Length==2) { SmallMediumDamage = new Range(); SmallMediumDamage.min = Int32.Parse(smd[0]); SmallMediumDamage.max = Int32.Parse(smd[1]); } string[] ld = _jo["LargeDamage"].str.Split('-'); if(ld.Length==2) { LargeDamage = new Range(); LargeDamage.min = Int32.Parse(ld[0]); LargeDamage.max = Int32.Parse(ld[1]); } Encumberance = (int)_jo["Encumberance"].n; Cost = (int)_jo["Cost"].n; WeaponRange = (int)_jo["WeaponRange"].n; Charges = (int)_jo["Charges"].n; ModifierList = new OSRICModifierCollection(_jo["ModifierList"]); }
public List<OSRICItemModel> GetAllItemsOfType(OSRIC_ITEM_TYPE _oit) { List<OSRICItemModel> retList = new List<OSRICItemModel>(); foreach(OSRICItemModel item in ItemList) if(item.ItemType == _oit) retList.Add(item); return retList; }
// Melee weapon constructor public OSRICItemModel(OSRIC_ITEM_TYPE _type, string _name, Range _smallDam, Range _largeDam, int _weight, int _cost) { ItemType = _type; Name = _name; SmallMediumDamage = _smallDam; LargeDamage = _largeDam; Encumberance = _weight; Cost = _cost; }
public void SetDropSelection(OSRIC_ITEM_TYPE _oim) { int index = drop.options.IndexOf(new Dropdown.OptionData(_oim.GetDesc())); drop.value = index; }