private static void ParseFurnidataXML(string furnidataPath) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(furnidataPath); var floorTypes = xmlDoc.SelectNodes("//furnidata/roomitemtypes/furnitype"); var floorItems = floorTypes.Count; for (int i = 0; i < floorItems; i++) { var itemNode = floorTypes.Item(i); if (itemNode.Attributes.GetNamedItem("classname") == null) { continue; } var className = itemNode.Attributes.GetNamedItem("classname").InnerText; var length = itemNode.ChildNodes.Item(2).InnerText; var width = itemNode.ChildNodes.Item(3).InnerText; FurniItem furniItem = new FurniItem(); furniItem.Length = int.Parse(length); furniItem.Width = int.Parse(width); furniItem.Type = "S"; furniItem.FileName = className; ItemList.Add(furniItem); } var wallTypes = xmlDoc.SelectNodes("//furnidata/wallitemtypes/furnitype"); var wallItems = wallTypes.Count; for (int i = 0; i < wallItems; i++) { var itemNode = wallTypes.Item(i); if (itemNode.Attributes.GetNamedItem("classname") == null) { continue; } var className = itemNode.Attributes.GetNamedItem("classname").InnerText; FurniItem furniItem = new FurniItem(); furniItem.Type = "I"; furniItem.FileName = className; ItemList.Add(furniItem); } }
private static FurniItem ResolveFurni(string sprite) { FurniItem furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite); if (furniItem == null && sprite.EndsWith("_cmp")) { furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite.Remove(sprite.Length - "_cmp".Length)); } if (furniItem == null && sprite.EndsWith("cmp")) { furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite.Remove(sprite.Length - "cmp".Length)); } if (furniItem == null && sprite.EndsWith("camp")) { furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite.Remove(sprite.Length - "camp".Length)); } if (furniItem == null && sprite.EndsWith("_camp")) { furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite.Remove(sprite.Length - "_camp".Length)); } if (furniItem == null && sprite.EndsWith("c")) { furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite.Remove(sprite.Length - "c".Length)); } if (furniItem == null && sprite.EndsWith("_c")) { furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite.Remove(sprite.Length - "_c".Length)); } if (furniItem == null && sprite.EndsWith("campaign")) { furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite.Remove(sprite.Length - "campaign".Length)); } if (furniItem == null && sprite.EndsWith("_campaign")) { furniItem = ItemList.FirstOrDefault(item => item.FileName == sprite.Remove(sprite.Length - "_campaign".Length)); } if (furniItem == null) { furniItem = ItemList.FirstOrDefault(item => item.FileName.StartsWith(sprite)); } if (furniItem == null) { return(new FurniItem() { Type = "s", SpriteId = 0, FileName = sprite, Revision = "", Unknown = "", Length = 1, Width = 1, Colour = "", Name = "", Description = "", }); } return(furniItem); }