static void AddItem(OSRSItem osrsItem, List <ModItemDataXML> itemDataList, List <ModItemTypeDataXML> itemTypeDataList, List <ItemXML> texturesList, MagickImageCollection imageCollection) { int dupes; if (itemDataList.Exists(e => e.ItemID.Equals(NormalizeItemName(osrsItem.Name), StringComparison.InvariantCultureIgnoreCase))) { dupes = itemDataList.Where(e => e.ItemID.StartsWith(NormalizeItemName(osrsItem.Name) + "_", StringComparison.InvariantCultureIgnoreCase)).Count() + 1; } else { dupes = 0; } string itemid; if (dupes > 0) { itemid = $"{NormalizeItemName(osrsItem.Name)}_{dupes + 1}"; } else { itemid = NormalizeItemName(osrsItem.Name); } if (!imageCached) { var img = new MagickImage(GetItemPathPng(osrsItem.Id)); img.Crop(0, 0, 32, 32); imageCollection.Add(img); texturesList.Add(new ItemXML { ItemID = itemid }); } var itemData = new ModItemDataXML(); var itemTypeData = new ModItemTypeDataXML(); foreach (Rule rule in rules) { if (rule.ShouldTransform(itemid, osrsItem)) { itemData = rule.TransformItemData(itemid, osrsItem, itemData); itemTypeData = rule.TransformItemTypeData(itemid, osrsItem, itemTypeData); } } itemDataList.Add(itemData); itemTypeDataList.Add(itemTypeData); }
public override ModItemDataXML TransformItemData(string id, OSRSItem osrsItem, ModItemDataXML modItemData) { modItemData.ItemID = id; modItemData.Name = osrsItem.Name; modItemData.Desc = osrsItem.Description; modItemData.IsValid = true; modItemData.IsEnabled = true; modItemData.LockedDD = true; modItemData.LockedCR = false; modItemData.LockedSU = true; modItemData.MinCSPrice = -1; if (osrsItem.CanStack) { modItemData.StackSize = int.MaxValue; } else { modItemData.StackSize = 1; } modItemData.Durability = 0; modItemData.StrikeDamage = 0; modItemData.StrikeReach = 0; modItemData.HealPower = 0; modItemData.BurnTime = 0; modItemData.SmeltTime = 0; modItemData.ParticleLight = 0; modItemData.CanDropIfLocked = false; modItemData.DropChance = 0; modItemData.Plural = PluralType.None; return(modItemData); }
public override ModItemDataXML TransformItemData(string id, OSRSItem osrsItem, ModItemDataXML modItemData) { return(modItemData); }
public abstract ModItemDataXML TransformItemData(string id, OSRSItem osrsItem, ModItemDataXML modItemData);