public void AddCollection(Collection col, RackOutfitGender gender, RackType type) { foreach (var item in col) { var purchasable = Content.AvatarPurchasables.Get(item.PurchasableOutfitId); if (purchasable == null) { continue; } var outfit = new RackOutfit() { AssetID = purchasable.OutfitID, Gender = gender, RackType = type, Price = 1000 }; if (!Racks.ContainsKey(outfit.RackType)) { Racks.Add(outfit.RackType, new RackOutfits() { Outfits = new List <RackOutfit>(), RackType = outfit.RackType }); } Racks[outfit.RackType].Outfits.Add(outfit); } }
public void Init() { var purchasable = Content.GetPath("packingslips/purchasable.xml"); if (!File.Exists(purchasable)) { return; } var xml = new XmlDocument(); xml.Load(purchasable); foreach (XmlNode child in xml.FirstChild.ChildNodes) { if (!(child is XmlElement)) { continue; } var name = child.Name; var assetId = child.Attributes["assetID"]; var price = child.Attributes["price"]; if (assetId == null || price == null) { continue; } var outfit = new RackOutfit { AssetID = (uint)ulong.Parse(assetId.InnerText.Substring(2), NumberStyles.HexNumber), Price = int.Parse(price.InnerText) }; //Convert to full content id so its consistent with DbAvatar outfit.AssetID = (outfit.AssetID << 32) | 0xd; if (name.EndsWith("Male")) { outfit.Gender = RackOutfitGender.Male; outfit.RackType = GetRackType(name.Substring(0, name.Length - 4)); } else if (name.EndsWith("Female")) { outfit.Gender = RackOutfitGender.Female; outfit.RackType = GetRackType(name.Substring(0, name.Length - 6)); } else if (name.StartsWith("Decor")) { outfit.Gender = RackOutfitGender.Neutral; var type = name.Split('_'); outfit.RackType = GetRackType(type[0] + "_" + type[1]); } else { continue; } if (!Racks.ContainsKey(outfit.RackType)) { Racks.Add(outfit.RackType, new RackOutfits() { Outfits = new List <RackOutfit>(), RackType = outfit.RackType }); } Racks[outfit.RackType].Outfits.Add(outfit); } //load CAS outfits too AddCollection(Content.AvatarCollections.Get("ea_male.col"), RackOutfitGender.Male, RackType.CAS); AddCollection(Content.AvatarCollections.Get("ea_female.col"), RackOutfitGender.Female, RackType.CAS); }