Example #1
0
 public PathProfile()
 {
     _starNode = new QuickGraph();
     _subProfile = new List<SubProfile>();
     TrainList = new List<Train>();
     NpcController = new NpcController();
 }
Example #2
0
 public PathProfile()
 {
     _starNode     = new QuickGraph();
     _subProfile   = new List <SubProfile>();
     TrainList     = new List <Train>();
     NpcController = new NpcController();
 }
Example #3
0
 private void LoadVendorsEx(XmlDocument doc)
 {
     try
     {
         XmlNodeList vendors = doc.GetElementsByTagName("Vendors");
         if (vendors.Count != 0)
         {
             NpcController.LoadXml(vendors[0]);
         }
     }
     catch (Exception e)
     {
         Logging.Write("Could not load Vendors: " + e);
     }
 }
Example #4
0
 private void LoadVendorOld(XmlDocument doc)
 {
     try
     {
         XmlNodeList traList = doc.GetElementsByTagName("Vendor");
         foreach (XmlNode tra in traList)
         {
             var v = new Vendor();
             v.Load(tra);
             if (!string.IsNullOrEmpty(v.Name) && v.Spot != null)
             {
                 NpcController.AddNpc(new VendorsEx(VendorType.Repair, v.Name, v.Spot, int.MinValue));
             }
         }
     }
     catch
     {
     }
 }
Example #5
0
 public bool LoadNoDialog(string profileToLoad)
 {
     try
     {
         _subProfile   = new List <SubProfile>();
         TrainList     = new List <Train>();
         NpcController = new NpcController();
         if (!File.Exists(profileToLoad))
         {
             Logging.Write("Could not find file: " + profileToLoad);
             return(false);
         }
         // Settings.SaveProfile("GraphProfile", profileToLoad); //TODO
         XmlDocument doc;
         try
         {
             doc = new XmlDocument();
             doc.Load(profileToLoad);
         }
         catch (Exception e)
         {
             Logging.Write("Error in loaded profile: " + e);
             return(false);
         }
         if (doc.GetElementsByTagName("LazyProfile")[0] == null)
         {
             MessageBox.Show("The profile you tried to load is not a valid profile for this engine");
             return(false);
         }
         LoadVendorsEx(doc);
         LoadSubProfile(doc);
         LoadVendorOld(doc);
         LoadPath(profileToLoad, doc);
     }
     catch (Exception e)
     {
         Logging.Write("Exception when loading profile: " + e);
         return(false);
     }
     return(true);
 }
Example #6
0
 public void New()
 {
     _subProfile.Clear();
     _starNode.New();
     NpcController = new NpcController();
 }
Example #7
0
 public bool LoadNoDialog(string profileToLoad)
 {
     try
     {
         _subProfile = new List<SubProfile>();
         TrainList = new List<Train>();
         NpcController = new NpcController();
         if (!File.Exists(profileToLoad))
         {
             Logging.Write("Could not find file: " + profileToLoad);
             return false;
         }
         // Settings.SaveProfile("GraphProfile", profileToLoad); //TODO
         XmlDocument doc;
         try
         {
             doc = new XmlDocument();
             doc.Load(profileToLoad);
         }
         catch (Exception e)
         {
             Logging.Write("Error in loaded profile: " + e);
             return false;
         }
         if (doc.GetElementsByTagName("LazyProfile")[0] == null)
         {
             MessageBox.Show("The profile you tried to load is not a valid profile for this engine");
             return false;
         }
         LoadVendorsEx(doc);
         LoadSubProfile(doc);
         LoadVendorOld(doc);
         LoadPath(profileToLoad, doc);
     }
     catch (Exception e)
     {
         Logging.Write("Exception when loading profile: " + e);
         return false;
     }
     return true;
 }
Example #8
0
 public void New()
 {
     _subProfile.Clear();
     _starNode.New();
     NpcController = new NpcController();
 }
Example #9
0
        private void LoadSubProfile(XmlDocument doc)
        {
            XmlNodeList subProfiles = doc.GetElementsByTagName("SubProfile");

            foreach (XmlNode subProfile in subProfiles)
            {
                var sub = new SubProfile();
                foreach (XmlNode child in subProfile.ChildNodes)
                {
                    if (child.Name.Equals("Name"))
                    {
                        sub.Name = child.InnerText;
                    }
                    if (child.Name.Equals("MinLevel"))
                    {
                        sub.PlayerMinLevel = Convert.ToInt32(child.InnerText);
                    }
                    if (child.Name.Equals("MaxLevel"))
                    {
                        sub.PlayerMaxLevel = Convert.ToInt32(child.InnerText);
                    }
                    if (child.Name.Equals("MobMinLevel"))
                    {
                        sub.MobMinLevel = Convert.ToInt32(child.InnerText);
                    }
                    if (child.Name.Equals("MobMaxLevel"))
                    {
                        sub.MobMaxLevel = Convert.ToInt32(child.InnerText);
                    }
                    if (child.Name.Equals("SpotRoamDistance"))
                    {
                        sub.SpotRoamDistance = Convert.ToInt32(child.InnerText);
                    }
                    if (child.Name.Equals("Order"))
                    {
                        sub.Order = Convert.ToBoolean(child.InnerText);
                    }
                    if (child.Name.Equals("Factions"))
                    {
                        string   temp  = child.InnerText;
                        string[] split = temp.Split(new[] { ' ' });
                        sub.Factions.AddRange(from s in split where s != "" select Convert.ToUInt32(s));
                    }
                    if (child.Name.Equals("Ignores"))
                    {
                        string   temp  = child.InnerText;
                        string[] split = temp.Split(new[] { '|' });
                        sub.Ignore.AddRange(from s in split where s != "" select s);
                    }
                    if (child.Name.Equals("Spot"))
                    {
                        string temp          = child.InnerText;
                        string correctString = temp;
                        if (Convert.ToString(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator) != ".")
                        {
                            correctString = temp.Replace(".",
                                                         CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
                        }
                        string   xyz   = correctString;
                        string[] split = xyz.Split(new[] { ' ' });
                        if (split.Length > 2)
                        {
                            var wayPointPos = new Location((float)Convert.ToDouble((split[0])),
                                                           (float)Convert.ToDouble((split[1])),
                                                           (float)Convert.ToDouble((split[2])));
                            sub.Spots.Add(wayPointPos);
                        }
                        else
                        {
                            var wayPointPos = new Location((float)Convert.ToDouble((split[0])),
                                                           (float)Convert.ToDouble((split[1])),
                                                           (float)Convert.ToDouble((0)));
                            sub.Spots.Add(wayPointPos);
                        }
                    }
                    if (child.Name.Equals("Vendor"))
                    {
                        var v = new Vendor();
                        v.Load(child);
                        NpcController.AddNpc(new VendorsEx(VendorType.Repair, v.Name, v.Spot, int.MinValue));
                    }
                }
                _subProfile.Add(sub);
            }
        }