public Item.Property GetItemProperty() { var prop = new Item.Property(); prop.info = ItemPropertyInfo.Find(this.prop); prop.param = param; prop.value = max; prop.min = min; prop.max = max; return(prop); }
private static void GenerateSetItem(Item item, SetItem setItem) { item.name = setItem.name; item.setItem = setItem; item.levelReq = setItem.levelReq; foreach (var mod in setItem.props) { if (mod.prop == null) { break; } var prop = new Item.Property(); prop.info = ItemPropertyInfo.Find(mod.prop); prop.param = mod.param; prop.value = Random.Range(mod.min, mod.max + 1); prop.min = mod.min; prop.max = mod.max; item.properties.Add(prop); } for (int i = 0; i < setItem.additionalProps.Length; ++i) { var mod = setItem.additionalProps[i]; if (mod.prop == null) { continue; } var prop = new Item.Property(); prop.info = ItemPropertyInfo.Find(mod.prop); prop.param = mod.param; prop.value = Random.Range(mod.min, mod.max + 1); prop.min = mod.min; prop.max = mod.max; if (setItem.addFunc == 0) { item.properties.Add(prop); } else { int blockSize = 2; int blockIndex = i / blockSize; while (blockIndex >= item.setItemProperties.Count) { item.setItemProperties.Add(new List <Item.Property>()); } item.setItemProperties[blockIndex].Add(prop); } } }
private static void AddAffix(Item item, MagicAffix affix) { foreach (var mod in affix.mods) { if (mod.code == null) { break; } var prop = new Item.Property(); prop.info = ItemPropertyInfo.Find(mod.code); prop.param = mod.param; prop.value = Random.Range(mod.min, mod.max + 1); prop.min = mod.min; prop.max = mod.max; prop.classSpecific = affix.classSpecific; item.properties.Add(prop); } }
private static void GenerateUnique(Item item, UniqueItem unique) { item.name = unique.name; item.unique = unique; item.levelReq = unique.levelReq; foreach (var mod in unique.props) { if (mod.prop == null) { break; } var prop = new Item.Property(); prop.info = ItemPropertyInfo.Find(mod.prop); prop.param = mod.param; prop.value = Random.Range(mod.min, mod.max + 1); prop.min = mod.min; prop.max = mod.max; item.properties.Add(prop); } }
static public bool GenerateUnique(Item item) { if (item.info.uniques.Count == 0) { return(false); } UniqueItem unique = SelectUniqueForItem(item); if (unique == null) { return(false); } item.name = unique.name; item.unique = unique; item.levelReq = unique.levelReq; foreach (var mod in unique.props) { if (mod.prop == null) { break; } var prop = new Item.Property(); prop.info = ItemPropertyInfo.Find(mod.prop); prop.param = mod.param; prop.value = Random.Range(mod.min, mod.max + 1); prop.min = mod.min; prop.max = mod.max; item.properties.Add(prop); } return(true); }