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); }
private void CreateUtilityCurves() { // Weights and Points List <float> weights = new List <float>(); weights.Add(0.6f); weights.Add(0.4f); List <Point2D> points = new List <Point2D>(); points.Add(new Point2D(0, 1)); points.Add(new Point2D(0.2f, 0.5f)); points.Add(new Point2D(0.4f, 0.1f)); points.Add(new Point2D(0.6f, 0.4f)); points.Add(new Point2D(0.8f, 0.2f)); points.Add(new Point2D(1, 0)); // Leaf Factors Factor pizzasVariable = new LeafVariable(() => pizzasCreated, 0, 10); Factor pepperoniVariable = new LeafVariable(() => pepperoniCreated, 0, 4); List <Factor> leafs = new List <Factor>(); leafs.Add(pizzasVariable); leafs.Add(pepperoniVariable); // Other Factors Factor pepperoniSum = new WeightedSumFusion(leafs, weights); Factor vegetarianLinear = new LinearPartsCurve(pizzasVariable, points); Factor hawaiianExp = new ExpCurve(pizzasVariable, 0.7f); // Actions utilityCurves.CreateUtilityAction("exit_ac1", pepperoniSum, () => { CreateRecipe(1); }, IsRecipeCreated, behaviourTree); utilityCurves.CreateUtilityAction("exit_ac2", vegetarianLinear, () => { CreateRecipe(2); }, IsRecipeCreated, behaviourTree); utilityCurves.CreateUtilityAction("exit_ac3", hawaiianExp, () => { CreateRecipe(3); }, IsRecipeCreated, behaviourTree); lookRecipe = behaviourTree.CreateSubBehaviour("Sub-Utility", utilityCurves); }
public static byte ToByte(this ExpCurve expCurve) { switch (expCurve) { case ExpCurve.Slow: return(5); case ExpCurve.MediumSlow: return(3); case ExpCurve.MediumFast: return(0); case ExpCurve.Fast: return(4); case ExpCurve.Erratic: return(1); case ExpCurve.Fluctuating: return(2); } return(0); // default }
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); }