private static BaseItem GetItem(XmlNode itemNode) { XmlAttribute xmlAttribute = itemNode.Attributes[0]; BaseItem.ItemType type = GetItemType(xmlAttribute.InnerText); switch (type) { case BaseItem.ItemType.ARMOR: return(CreateArmorItem(itemNode)); case BaseItem.ItemType.QUEST: return(CreateQuestItem(itemNode)); case BaseItem.ItemType.RESOURCES: return(CreateResourcesItem(itemNode)); case BaseItem.ItemType.TOOL: return(CreateToolItem(itemNode)); case BaseItem.ItemType.RING: return(CreateRingItem(itemNode)); case BaseItem.ItemType.AMULET: return(CreateAmuletItem(itemNode)); case BaseItem.ItemType.SHIELD: return(CreateShieldItem(itemNode)); case BaseItem.ItemType.HELMET: return(CreateHelmetItem(itemNode)); case BaseItem.ItemType.BELT: return(CreateBeltItem(itemNode)); case BaseItem.ItemType.GLOVES: return(CreateGlovesItem(itemNode)); case BaseItem.ItemType.PANTS: return(CreatePantsItem(itemNode)); case BaseItem.ItemType.BOOTS: return(CreateBootsItem(itemNode)); case BaseItem.ItemType.CLOAK: return(CreateCloakItem(itemNode)); case BaseItem.ItemType.TOW_HAND_WEAPON: return(CreateTowHandWeaponItem(itemNode)); case BaseItem.ItemType.WEAPON: return(CreateWeaponItem(itemNode)); case BaseItem.ItemType.PET: return(CreatePetItem(itemNode)); } return(null); }
// Public public EquipCell GetCellByType(BaseItem.ItemType equipType, int count) { foreach (EquipCell equipCell in listEqupCells) { if (equipCell.equipType == equipType && equipCell.count == count) { return(equipCell); } } return(null); }
public List <BaseCell> GetCellListByType(BaseItem.ItemType equipType) { List <BaseCell> list = new List <BaseCell>(); foreach (EquipCell equipCell in listEqupCells) { if (equipCell.equipType == equipType) { list.Add(equipCell); } } return(list); }
/// <summary> /// Prints a pretty summary to a log file /// </summary> public static void LogInfo() { string s = "There are " + Stats.Count + " stats:\n"; for (int i = 0; i < 8; i++) { ItemStat[] stats = statList.Where(a => a.Rarity == i).ToArray(); s += " • Rarity tier of stat[" + i + "] = " + stats.Length; foreach (ItemStat a in stats) { s += "\n\t • Stat \"" + a.Name + " ID [" + a.StatID + "]\""; } s += "\n"; } s += "\n\n\n There are " + ItemBases.Count + " items:\n"; for (int i = 0; i < 8; i++) { BaseItem[] items = _Item_Bases.Where(a => a.Rarity == i).ToArray(); s += " • Rarity tier of item [" + i + "] = " + items.Length; foreach (BaseItem a in items) { s += "\n\t • Item \"" + a.name + " ID [" + a.ID + "]\""; } s += "\n"; } s += "\n\n\nItem types:"; System.Array array = System.Enum.GetValues(typeof(BaseItem.ItemType)); for (int i = 0; i < array.Length; i++) { BaseItem.ItemType t = (BaseItem.ItemType)array.GetValue(i); BaseItem[] items = _Item_Bases.Where(a => a._itemType == t).ToArray(); s += "\n • Item type: [" + t.ToString() + "] = " + items.Length; for (int b = 0; b < 8; b++) { BaseItem[] items2 = items.Where(a => a.Rarity == b).ToArray(); s += "\n\t\t • RARITY " + b + " \"" + items2.Length + "\""; } foreach (BaseItem a in items) { s += "\n\t • Item \"" + a.name + " ID [" + a.ID + "] RARITY [" + a.Rarity + "]\""; } s += "\n"; } ModAPI.Log.Write(s); }
/// <summary> /// Prints a pretty summary to a log file /// </summary> public static void LogInfo() { string s = "There are " + Stats.Count + " stats:\n"; for (int i = 0; i < 8; i++) { ItemStat[] stats = statList.Where(a => a.Rarity == i).ToArray(); s += " • Rarity tier of stat[" + i + "] = " + stats.Length; foreach (ItemStat a in stats) { s += "\n\t • Stat \"" + a.Name + " ID [" + a.StatID + "]\""; } s += "\n"; } s += "\n\n\n There are " + ItemBases.Count + " items:\n"; for (int i = 0; i < 8; i++) { BaseItem[] items = _Item_Bases.Where(a => a.Rarity == i).ToArray(); s += " • Rarity tier of item [" + i + "] = " + items.Length; foreach (BaseItem a in items) { s += "\n\t • Item \"" + a.name + " ID [" + a.ID + "]\""; } s += "\n"; } s += "\n\n\nItem types:"; System.Array array = System.Enum.GetValues(typeof(BaseItem.ItemType)); for (int i = 0; i < array.Length; i++) { BaseItem.ItemType t = (BaseItem.ItemType)array.GetValue(i); BaseItem[] items = _Item_Bases.Where(a => a.type == t).ToArray(); s += "\n • Item type: [" + t.ToString() + "] = " + items.Length; for (int b = 0; b < 8; b++) { BaseItem[] items2 = items.Where(a => a.Rarity == b).ToArray(); s += "\n\t\t • RARITY " + b + " \"" + items2.Length + "\""; } foreach (BaseItem a in items) { s += "\n\t • Item \"" + a.name + " ID [" + a.ID + "] RARITY [" + a.Rarity + "]\""; } s += "\n"; } ModAPI.Log.Write(s); var f = File.CreateText("items.csv"); f.WriteLine("ITEMS;" + ItemBases.Count); for (int i = 0; i <= (int)BaseItem.ItemType.SpellScroll; i++) { BaseItem.ItemType t = (BaseItem.ItemType)i; var itemsByType = _Item_Bases.Where(a => a.type == t); f.WriteLine(t + ";" + itemsByType.Count()); if (t == BaseItem.ItemType.Weapon) { for (int j = 1; j <= (int)BaseItem.WeaponModelType.Greatbow; j++) { var weapons = itemsByType.Where(a => a.weaponModel == (BaseItem.WeaponModelType)j).OrderBy(a => a.ID + a.Rarity * 100000); f.WriteLine(((BaseItem.WeaponModelType)j) + ";" + weapons.Count()); f.WriteLine("ID;RARITY;NAME;UNIQUE STAT;MIN LEVEL; MIN STATS QUANTITY;MAX STATS QUANTITY"); foreach (var weapon in weapons) { f.WriteLine(weapon.ID + ";" + weapon.Rarity + ";" + weapon.name + ";" + weapon.uniqueStat + " ;" + weapon.minLevel + ";" + weapon.PossibleStats.Count(y => !y.Contains(null)) + ";" + weapon.PossibleStats.Count); } f.WriteLine(" "); } } else { itemsByType = itemsByType.OrderBy(a => a.ID + a.Rarity * 100000); f.WriteLine("ID;RARITY;NAME;UNIQUE STAT;MIN LEVEL; MIN STATS QUANTITY;MAX STATS QUANTITY"); foreach (var item in itemsByType) { f.WriteLine(item.ID + ";" + item.Rarity + ";" + item.name + ";" + item.uniqueStat + " ;" + item.minLevel + ";" + item.PossibleStats.Count(y => !y.Contains(null)) + ";" + item.PossibleStats.Count); } f.WriteLine(" "); } } f.Close(); }
/// <summary> /// 解析背包数据,Json格式 /// </summary> void AnalysisJson() { JsonData jsonData = JsonMapper.ToObject(itemJson.text); //通过索引的方式获取json中的信息,既可以使用索引位置,也可以使用索引键名 for (int i = 0; i < jsonData.Count; i++) { BaseItem tempBaseItem = new BaseItem { itemName = jsonData[i]["itemName"].ToString(), itemId = int.Parse(jsonData[i]["itemId"].ToString()), itemContent = jsonData[i]["itemContent"].ToString(), itemIconPath = jsonData[i]["itemIconPath"].ToString(), itemType = (BaseItem.ItemType) int.Parse(jsonData[i]["itemType"].ToString()), itemMaxCount = int.Parse(jsonData[i]["itemMaxCount"].ToString()), itemSellGold = int.Parse(jsonData[i]["itemSellGold"].ToString()), itemCurrentCount = int.Parse(jsonData[i]["itemCurrentCount"].ToString()) }; BaseItem.ItemType itemType = (BaseItem.ItemType) int.Parse(jsonData[i]["itemType"].ToString()); switch (itemType) { case BaseItem.ItemType.EConsumables: #region ConsumablesItem 数据解析 ConsumablesItem tempConsumablesItem = new ConsumablesItem { itemId = tempBaseItem.itemId, itemName = tempBaseItem.itemName, itemContent = tempBaseItem.itemContent, itemIconPath = tempBaseItem.itemIconPath, itemType = tempBaseItem.itemType, itemMaxCount = tempBaseItem.itemMaxCount, itemSellGold = tempBaseItem.itemSellGold, itemCurrentCount = tempBaseItem.itemCurrentCount, itemUseMinLevel = int.Parse(jsonData[i]["itemUseMinLevel"].ToString()), itemGrade = (BaseItem.ItemGrade) int.Parse(jsonData[i]["itemGrade"].ToString()), itemRottenTime = int.Parse(jsonData[i]["itemRottenTime"].ToString()) }; allItemDic.Add(tempConsumablesItem.itemId, tempConsumablesItem); #endregion break; case BaseItem.ItemType.EMaterial: break; case BaseItem.ItemType.EEquipment: #region Equipment 数据解析 EquipmentItem tempEquipmentItem = new EquipmentItem { itemId = tempBaseItem.itemId, itemName = tempBaseItem.itemName, itemContent = tempBaseItem.itemContent, itemIconPath = tempBaseItem.itemIconPath, itemType = tempBaseItem.itemType, itemMaxCount = tempBaseItem.itemMaxCount, itemSellGold = tempBaseItem.itemSellGold, itemCurrentCount = tempBaseItem.itemCurrentCount, itemUseMinLevel = int.Parse(jsonData[i]["itemUseMinLevel"].ToString()), itemGrade = (BaseItem.ItemGrade) int.Parse(jsonData[i]["itemGrade"].ToString()) }; allItemDic.Add(tempEquipmentItem.itemId, tempEquipmentItem); #endregion break; } } }
public EquipCell() { item = null; equipType = BaseItem.ItemType.ERROR; count = 0; }