internal GameResources() { Items.Load("Gamefiles/Items.xml"); Configs.Load("Gamefiles/Configs.xml"); ShopOffers.Load("Gamefiles/ShopOffers.xml"); PvE.Load("Gamefiles/PvE.xml"); OnlineVariables.Load("Gamefiles/OnlineVariables.xml"); NewbieItemsXML.Load("Gamefiles/NewbieItems.xml"); NewbieItemsOldXML.Load("Gamefiles/NewbieItemsOld.xml"); QuickPlayMapList.Load("Gamefiles/QuickPlayMapList.xml"); ExpCurve.Load("Gamefiles/ExpCurve.xml"); if ((bool)App.Default["UseOldMode"]) { Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine($"[{this.GetType().Name}] Note! Server started on OLD mode (WF 2013 version's and lower)"); Console.ResetColor(); foreach (string Map in Directory.GetFiles("Gamefiles/Maps/Old", "*.xml", SearchOption.TopDirectoryOnly)) { XmlDocument Document = new XmlDocument(); Document.Load(Map); Maps.Add(Document); } foreach (XmlNode Item in NewbieItemsOldXML["items"].ChildNodes) { Item i = new Item(); i.Create((XmlElement)Item); NewbieItems.Add(i); } } else { foreach (string Map in Directory.GetFiles("Gamefiles/Maps", "*.xml", SearchOption.TopDirectoryOnly)) { XmlDocument Document = new XmlDocument(); Document.Load(Map); Maps.Add(Document); } foreach (XmlNode Item in NewbieItemsXML["items"].ChildNodes) { Item i = new Item(); i.Create((XmlElement)Item); NewbieItems.Add(i); } } NewbieItems = new List <Item>(); foreach (XmlNode Item in NewbieItemsOldXML["items"].ChildNodes) { Item i = new Item(); i.Create((XmlElement)Item); NewbieItems.Add(i); } SplitGamefiles(Items, ref ItemsSplited); SplitGamefiles(ShopOffers, ref ShopOffersSplited); SplitGamefiles(Configs, ref ConfigsSplited); SplitGamefiles(QuickPlayMapList, ref QuickPlayMapListSplited); }
internal GameResources() { Timer timer = new Timer(); timer.Interval = 42000.0; timer.Elapsed += delegate { ShopBuyOffer.BuyedTotally = 0; }; timer.Start(); Items.Load("Gamefiles/Items.xml"); Configs.Load("Gamefiles/Configs.xml"); ShopOffers.Load("Gamefiles/ShopOffers.xml"); PvE.Load("Gamefiles/PvE.xml"); OnlineVariables.Load("Gamefiles/OnlineVariables.xml"); NewbieItemsXML.Load("Gamefiles/NewbieItems.xml"); NewbieItemsOldXML.Load("Gamefiles/NewbieItemsOld.xml"); QuickPlayMapList.Load("Gamefiles/QuickPlayMapList.xml"); ExpCurve.Load("Gamefiles/ExpCurve.xml"); //Program.WriteLine("Магазин параша", ConsoleColor.DarkMagenta); string[] files; files = Directory.GetFiles("Gamefiles/Maps", "*.xml", SearchOption.TopDirectoryOnly); foreach (string filename2 in files) { XmlDocument xmlDocument2 = new XmlDocument(); xmlDocument2.Load(filename2); Maps.Add(xmlDocument2); } foreach (XmlNode childNode2 in NewbieItemsXML["items"].ChildNodes) { Item item2 = new Item(); item2.Create((XmlElement)childNode2); NewbieItems.Add(item2); } files = Directory.GetFiles("Gamefiles/ShopItems", "*.xml", SearchOption.AllDirectories); foreach (string filename3 in files) { XmlDocument xmlDocument3 = new XmlDocument(); xmlDocument3.Load(filename3); if (xmlDocument3["shop_item"] == null && xmlDocument3["GameItem"] == null) { continue; } string key = ""; if (xmlDocument3.LastChild["mmo_stats"] != null) { foreach (XmlElement item3 in xmlDocument3.LastChild["mmo_stats"]) { if (item3.Attributes["name"].InnerText == "item_category") { key = item3.Attributes["value"].InnerText; break; } } if (!ShopItemsReged.ContainsKey(key)) { ShopItemsReged.Add(key, new List <string>()); } ShopItemsReged[key].Add(xmlDocument3.LastChild.Attributes["name"].InnerText); } } SplitGamefiles(Items, ref ItemsSplited); SplitGamefiles(ShopOffers, ref ShopOffersSplited); SplitGamefiles(Configs, ref ConfigsSplited); SplitGamefiles(QuickPlayMapList, ref QuickPlayMapListSplited); }