Ejemplo n.º 1
0
 private void UpdateFields(SubProfile subProfile)
 {
     try
     {
         SaveSubProfiles();
         TBName.Text            = subProfile.Name;
         PMaxLevel.Value        = subProfile.PlayerMaxLevel;
         PMinLevel.Value        = subProfile.PlayerMinLevel;
         UMaxLevel.Value        = subProfile.MobMaxLevel;
         UMinLevel.Value        = subProfile.MobMinLevel;
         SpotRoamDistance.Value = subProfile.SpotRoamDistance;
         LBFactionCount.Text    = subProfile.Factions.Count + "";
         LBSpotCount.Text       = subProfile.Spots.Count + "";
         CBSpotOrder.Checked    = subProfile.Order;
         TBFactionList.Text     = subProfile.Factions.Aggregate(string.Empty,
                                                                (current, faction) =>
                                                                current + string.Format("{0} ", faction));
         TBIgnore.Text = _selected.Ignore.Aggregate(string.Empty,
                                                    (current, faction) =>
                                                    current + string.Format("{0}|", faction));
     }
     catch (Exception e)
     {
         Logging.Write("Exception when updatingFields: " + e);
     }
 }
Ejemplo n.º 2
0
 internal void AddSubProfile(SubProfile profile)
 {
     if (!_subProfile.Contains(profile))
     {
         _subProfile.Add(profile);
     }
 }
Ejemplo n.º 3
0
        private void AddNode(string name, SubProfile profile)
        {
            var node = new Node();

            node.Text = name;
            node.Tag  = profile;
            AddNode(node);
        }
Ejemplo n.º 4
0
 private void BtnAddClick(object sender, EventArgs e)
 {
     foreach (Node node1 in ListSubProfiles.Nodes)
     {
         if (node1.Tag is SubProfile)
         {
             if (_selected == node1.Tag)
             {
                 node1.Text = _selected.Name;
             }
         }
     }
     _selected = new SubProfile();
     AddNode(_selected.Name, _selected);
     UpdateFields(_selected);
     ListSubProfiles.SelectedIndex = ListSubProfiles.Nodes.Count - 1;
 }
Ejemplo n.º 5
0
 private void BtnRemoveClick(object sender, EventArgs e)
 {
     if (ListSubProfiles.SelectedNode != null)
     {
         Node toRemove = null;
         foreach (Node node1 in ListSubProfiles.Nodes)
         {
             if (node1.Tag.Equals(ListSubProfiles.SelectedNode.Tag))
             {
                 toRemove = node1;
             }
         }
         if (toRemove != null)
         {
             ListSubProfiles.Nodes.Remove(toRemove);
             _selected = new SubProfile();
             UpdateFields(_selected);
             DisableSubProfiles();
         }
     }
 }
Ejemplo n.º 6
0
 private void SelectNode(Node node)
 {
     if (_selected != null)
     {
         _selected.Name             = TBName.Text;
         _selected.PlayerMaxLevel   = PMaxLevel.Value;
         _selected.PlayerMinLevel   = PMinLevel.Value;
         _selected.MobMaxLevel      = UMaxLevel.Value;
         _selected.MobMinLevel      = UMinLevel.Value;
         _selected.Order            = CBSpotOrder.Checked;
         _selected.SpotRoamDistance = SpotRoamDistance.Value;
         foreach (Node node1 in ListSubProfiles.Nodes)
         {
             if (node1.Tag is SubProfile)
             {
                 if (_selected == node1.Tag)
                 {
                     node1.Text = _selected.Name;
                 }
             }
         }
     }
     ListSubProfiles.BeginUpdate();
     _selected = (SubProfile)node.Tag;
     UpdateFields(_selected);
     ListSubProfiles.EndUpdate();
     TBName.Enabled           = true;
     PMinLevel.Enabled        = true;
     PMaxLevel.Enabled        = true;
     CBSpotOrder.Enabled      = true;
     BtnFaction.Enabled       = true;
     BtnAddSpot.Enabled       = true;
     UMaxLevel.Enabled        = true;
     UMinLevel.Enabled        = true;
     SpotRoamDistance.Enabled = true;
     TBFactionList.Enabled    = true;
     BtnAddIgnore.Enabled     = true;
     TBIgnore.Enabled         = true;
 }
Ejemplo n.º 7
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);
     }
 }
Ejemplo n.º 8
0
 internal void AddSubProfile(SubProfile profile)
 {
     if (!_subProfile.Contains(profile))
         _subProfile.Add(profile);
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 10
0
 private void BtnRemoveClick(object sender, EventArgs e)
 {
     if (ListSubProfiles.SelectedNode != null)
     {
         Node toRemove = null;
         foreach (Node node1 in ListSubProfiles.Nodes)
         {
             if (node1.Tag.Equals(ListSubProfiles.SelectedNode.Tag))
             {
                 toRemove = node1;
             }
         }
         if (toRemove != null)
         {
             ListSubProfiles.Nodes.Remove(toRemove);
             _selected = new SubProfile();
             UpdateFields(_selected);
             DisableSubProfiles();
         }
     }
 }
Ejemplo n.º 11
0
 private void SelectNode(Node node)
 {
     if (_selected != null)
     {
         _selected.Name = TBName.Text;
         _selected.PlayerMaxLevel = PMaxLevel.Value;
         _selected.PlayerMinLevel = PMinLevel.Value;
         _selected.MobMaxLevel = UMaxLevel.Value;
         _selected.MobMinLevel = UMinLevel.Value;
         _selected.Order = CBSpotOrder.Checked;
         _selected.SpotRoamDistance = SpotRoamDistance.Value;
         foreach (Node node1 in ListSubProfiles.Nodes)
         {
             if (node1.Tag is SubProfile)
             {
                 if (_selected == node1.Tag)
                 {
                     node1.Text = _selected.Name;
                 }
             }
         }
     }
     ListSubProfiles.BeginUpdate();
     _selected = (SubProfile) node.Tag;
     UpdateFields(_selected);
     ListSubProfiles.EndUpdate();
     TBName.Enabled = true;
     PMinLevel.Enabled = true;
     PMaxLevel.Enabled = true;
     CBSpotOrder.Enabled = true;
     BtnFaction.Enabled = true;
     BtnAddSpot.Enabled = true;
     UMaxLevel.Enabled = true;
     UMinLevel.Enabled = true;
     SpotRoamDistance.Enabled = true;
     TBFactionList.Enabled = true;
     BtnAddIgnore.Enabled = true;
     TBIgnore.Enabled = true;
 }
Ejemplo n.º 12
0
 private void UpdateFields(SubProfile subProfile)
 {
     try
     {
         SaveSubProfiles();
         TBName.Text = subProfile.Name;
         PMaxLevel.Value = subProfile.PlayerMaxLevel;
         PMinLevel.Value = subProfile.PlayerMinLevel;
         UMaxLevel.Value = subProfile.MobMaxLevel;
         UMinLevel.Value = subProfile.MobMinLevel;
         SpotRoamDistance.Value = subProfile.SpotRoamDistance;
         LBFactionCount.Text = subProfile.Factions.Count + "";
         LBSpotCount.Text = subProfile.Spots.Count + "";
         CBSpotOrder.Checked = subProfile.Order;
         TBFactionList.Text = subProfile.Factions.Aggregate(string.Empty,
                                                            (current, faction) =>
                                                            current + string.Format("{0} ", faction));
         TBIgnore.Text = _selected.Ignore.Aggregate(string.Empty,
                                                    (current, faction) =>
                                                    current + string.Format("{0}|", faction));
     }
     catch (Exception e)
     {
         Logging.Write("Exception when updatingFields: " + e);
     }
 }
Ejemplo n.º 13
0
 private void AddNode(string name, SubProfile profile)
 {
     var node = new Node();
     node.Text = name;
     node.Tag = profile;
     AddNode(node);
 }
Ejemplo n.º 14
0
 private void BtnAddClick(object sender, EventArgs e)
 {
     foreach (Node node1 in ListSubProfiles.Nodes)
     {
         if (node1.Tag is SubProfile)
         {
             if (_selected == node1.Tag)
             {
                 node1.Text = _selected.Name;
             }
         }
     }
     _selected = new SubProfile();
     AddNode(_selected.Name, _selected);
     UpdateFields(_selected);
     ListSubProfiles.SelectedIndex = ListSubProfiles.Nodes.Count - 1;
 }