public SortedList<int, PaintInfo> GetSortedAllPaintInfo() { SortedList<int, PaintInfo> list = new SortedList<int, PaintInfo>(); KeyValue paintKitsRarity = this.Read("paint_kits_rarity"); Dictionary<string, string> paintKitsRarityDic = new Dictionary<string, string>(); if (paintKitsRarity != null) { foreach (var subChildKey in paintKitsRarity.Children) { paintKitsRarityDic.Add(subChildKey.Name, subChildKey.Value); } } KeyValue result = this.Read(PaintInfo.KeyName); PaintInfo def; if (result != null) { foreach (var subChildKey in result.Children) { def = new PaintInfo(); def.CodedValue = int.Parse(subChildKey.Name); foreach (var itemSubChildKey in subChildKey.Children) { if (itemSubChildKey.Name.Equals(PaintInfo.SubKeyName, StringComparison.CurrentCultureIgnoreCase)) { def.Name = itemSubChildKey.Value; } else if (itemSubChildKey.Name.Equals(PaintInfo.SubKeyWearDefault, StringComparison.CurrentCultureIgnoreCase)) { def.WearDefaultLevel = float.Parse(itemSubChildKey.Value, CultureInfo.InvariantCulture); } else if (itemSubChildKey.Name.Equals(PaintInfo.SubKeyWearMin, StringComparison.CurrentCultureIgnoreCase)) { def.WearMinLevel = float.Parse(itemSubChildKey.Value, CultureInfo.InvariantCulture); } else if (itemSubChildKey.Name.Equals(PaintInfo.SubKeyWearMax, StringComparison.CurrentCultureIgnoreCase)) { def.WearMaxLevel = float.Parse(itemSubChildKey.Value, CultureInfo.InvariantCulture); } } foreach (var itemDict in paintKitsRarityDic) { if (def.Name.Equals(itemDict.Key)) { def.Rarity = itemDict.Value; break; } } list.Add(def.CodedValue, def); } } return list; }
public List<Tuple<ItemInfo, PaintInfo>> GetOfficialItems() { List<Tuple<ItemInfo, PaintInfo>> officialItems = new List<Tuple<ItemInfo, PaintInfo>>(); KeyValue result = this.Read("alternate_icons2"); List<PaintInfo> paintInfos = this.GetAllPaintKits(); List<ItemInfo> itemInfos = this.GetAllItemInfo(); ItemInfo item = new ItemInfo(); PaintInfo paint = new PaintInfo(); string econPath; List<string> econPathList = new List<string>(); if (result != null) { foreach (var subChildKey in result.Children[0].Children) { econPath = subChildKey.Children[0].Value; econPathList.Add(econPath); } } string[] splittedEconPath; string[] removeList = new string[] { "_medium", "_heavy" }; string itemPaint; foreach (var strRemove in removeList) { econPathList.RemoveAll(p => p.Contains(strRemove)); } foreach (var str in econPathList) { splittedEconPath = str.Split('/'); if (splittedEconPath[2].Contains("_light")) { itemPaint = splittedEconPath[2].Replace("_light", string.Empty); foreach (var paintInfo in paintInfos) { if (itemPaint.Contains(paintInfo.Name)) { paint = paintInfo; itemPaint = itemPaint.Replace("_" + paintInfo.Name, string.Empty); break; } } foreach (var itemInfo in itemInfos) { if (itemPaint.Equals(itemInfo.CodedName)) { item = itemInfo; break; } } } if ((string.IsNullOrEmpty(item.CodedName) == false) && (string.IsNullOrEmpty(paint.Name) == false)) { officialItems.Add(new Tuple<ItemInfo, PaintInfo>(item, paint)); } } return officialItems; }