public void TransferTo(SkillsGroup group)
        {
            for (int i = 0; i < Count; i++)
            {
                group.Add(_list[i]);
            }

            group.Sort();
        }
        public static void Load()
        {
            Groups.Clear();

            string path = Path.Combine(ProfileManager.ProfilePath, "skillsgroups.xml");

            if (!File.Exists(path))
            {
                Log.Trace("No skillsgroups.xml file. Creating a default file.");

                MakeDefault();

                return;
            }

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(path);
            }
            catch (Exception ex)
            {
                MakeDefault();

                Log.Error(ex.ToString());

                return;
            }

            XmlElement root = doc["skillsgroups"];

            if (root != null)
            {
                foreach (XmlElement xml in root.GetElementsByTagName("group"))
                {
                    SkillsGroup g = new SkillsGroup();
                    g.Name = xml.GetAttribute("name");

                    XmlElement xmlIdsRoot = xml["skillids"];

                    if (xmlIdsRoot != null)
                    {
                        foreach (XmlElement xmlIds in xmlIdsRoot.GetElementsByTagName("skill"))
                        {
                            var auto = byte.Parse(xmlIds.GetAttribute("id"));
                            g.Add(auto);
                        }
                    }

                    g.Sort();
                    Add(g);
                }
            }
        }
        private static void MakeDefaultBard()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = ResGeneral.Bard;
            g.Add(15);
            g.Add(29);
            g.Add(9);
            g.Add(22);

            Add(g);
        }
        private static void MakeDefaultWilderness()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = ResGeneral.Wilderness;
            g.Add(2);
            g.Add(35);
            g.Add(18);
            g.Add(20);
            g.Add(38);
            g.Add(39);

            Add(g);
        }
        private static void MakeDefaultDefensiveSkills()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = "Defensive";
            g.Add(14); //Detect Hidden
            g.Add(17);
            g.Add(21);
            g.Add(5);  //Parry
            g.Add(26);
            g.Add(47); //Stealth
            g.Add(43);

            Add(g);
        }
        private static void MakeDefaultMiscellaneous()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = ResGeneral.Miscellaneous;
            g.Add(4);
            g.Add(6);
            g.Add(10);
            g.Add(12);
            g.Add(19);
            g.Add(3);
            g.Add(36);

            Add(g);
        }
        private static void MakeDefaultMiscellaneous()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = ResGeneral.Miscellaneous;
            g.Add(4);
            g.Add(6);
            g.Add(10);
            g.Add(12);
            g.Add(19); // Herding?
            g.Add(3);  // Item ID
            g.Add(36); //Tinkering

            Add(g);
        }
        private static void MakeDefaultThieving()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = ResGeneral.Thieving;
            g.Add(14);
            g.Add(21);
            g.Add(24);
            g.Add(30);
            g.Add(48);
            g.Add(28);
            g.Add(33);
            g.Add(47);

            Add(g);
        }
        private static void MakeDefaultCombat()
        {
            int count = SkillsLoader.Instance.SkillsCount;

            SkillsGroup g = new SkillsGroup();

            g.Name = ResGeneral.Combat;
            g.Add(1);
            g.Add(31);
            g.Add(42);
            g.Add(17);
            g.Add(41);
            g.Add(5);
            g.Add(40);
            g.Add(27);

            if (count > 57)
            {
                g.Add(57);
            }

            g.Add(43);

            if (count > 50)
            {
                g.Add(50);
            }

            if (count > 51)
            {
                g.Add(51);
            }

            if (count > 52)
            {
                g.Add(52);
            }

            if (count > 53)
            {
                g.Add(53);
            }

            Add(g);
        }
        private static void MakeDefaultTradeSkills()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = ResGeneral.TradeSkills;
            g.Add(0);
            g.Add(7);
            g.Add(8);
            g.Add(11);
            g.Add(13);
            g.Add(23);
            g.Add(44);
            g.Add(45);
            g.Add(34);
            g.Add(37);

            Add(g);
        }
Beispiel #11
0
        public static bool Remove(SkillsGroup g)
        {
            if (Groups[0] == g)
            {
                MessageBoxGump messageBox = new MessageBoxGump(200, 125, "Cannot delete this group.", null)
                {
                    X = ProfileManager.Current.GameWindowPosition.X + ProfileManager.Current.GameWindowSize.X / 2 - 100,
                    Y = ProfileManager.Current.GameWindowPosition.Y + ProfileManager.Current.GameWindowSize.Y / 2 - 62,
                };
                UIManager.Add(messageBox);
                return(false);
            }

            Groups.Remove(g);
            g.TransferTo(Groups[0]);

            return(true);
        }
Beispiel #12
0
        private static void MakeDefaultAggressiveSkills()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = "Aggressive";
            g.Add(1);
            g.Add(31);
            g.Add(58); //bombering
            g.Add(16);
            g.Add(42); //fencing
            g.Add(19); //Forensic
            g.Add(41); //mace
            g.Add(25); //magery
            g.Add(30);
            g.Add(40);
            g.Add(27);

            Add(g);
        }
Beispiel #13
0
        /* GRUPPI SKILLS UO MARS */
        private static void MakeDefaultWorkerSkills()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = "Worker";
            g.Add(0);
            g.Add(35);
            g.Add(7);
            g.Add(8);
            g.Add(11); //Carpentry
            g.Add(60); // Harvestring
            g.Add(44); // Lumberjacking
            g.Add(45);
            g.Add(59);
            g.Add(34);
            g.Add(37);

            Add(g);
        }
Beispiel #14
0
        private static void MakeDefaultUtilitieSkills()
        {
            SkillsGroup g = new SkillsGroup();

            g.Name = "Utilities";
            g.Add(2);
            g.Add(15); //disco
            g.Add(50); //focus
            g.Add(23);
            g.Add(24); //lockpicking
            g.Add(46); //Med
            g.Add(29); // Musicianship
            g.Add(9);  //peace
            g.Add(22); // provo
            g.Add(28); //snooping
            g.Add(33); //stealing
            g.Add(57);
            g.Add(38);
            g.Add(39); //vet

            Add(g);
        }
Beispiel #15
0
        private static void MakeDefaultMagic()
        {
            int count = SkillsLoader.Instance.SkillsCount;

            SkillsGroup g = new SkillsGroup();

            g.Name = ResGeneral.Magic;
            g.Add(16);

            if (count > 56)
            {
                g.Add(56);
            }

            g.Add(25);
            g.Add(46);

            if (count > 55)
            {
                g.Add(55);
            }

            g.Add(26);

            if (count > 54)
            {
                g.Add(54);
            }

            g.Add(32);

            if (count > 49)
            {
                g.Add(49);
            }

            Add(g);
        }
Beispiel #16
0
        private static bool LoadMULFile(string path)
        {
            FileInfo info = new FileInfo(path);

            if (!info.Exists)
            {
                return(false);
            }

            try
            {
                byte skillidx = 0;
                bool unicode  = false;

                using (BinaryReader bin = new BinaryReader(File.OpenRead(info.FullName)))
                {
                    int start  = 4;
                    int strlen = 17;
                    int count  = bin.ReadInt32();

                    if (count == -1)
                    {
                        unicode = true;
                        count   = bin.ReadInt32();
                        start  *= 2;
                        strlen *= 2;
                    }


                    StringBuilder sb = new StringBuilder(17);

                    SkillsGroup g = new SkillsGroup();
                    g.Name = ResGeneral.Miscellaneous;

                    SkillsGroup[] groups = new SkillsGroup[count];
                    groups[0] = g;

                    for (int i = 0; i < count - 1; ++i)
                    {
                        short strbuild;
                        bin.BaseStream.Seek(start + i * strlen, SeekOrigin.Begin);

                        if (unicode)
                        {
                            while ((strbuild = bin.ReadInt16()) != 0)
                            {
                                sb.Append((char)strbuild);
                            }
                        }
                        else
                        {
                            while ((strbuild = bin.ReadByte()) != 0)
                            {
                                sb.Append((char)strbuild);
                            }
                        }

                        groups[i + 1] = new SkillsGroup
                        {
                            Name = sb.ToString()
                        };

                        sb.Clear();
                    }

                    bin.BaseStream.Seek(start + (count - 1) * strlen, SeekOrigin.Begin);

                    while (bin.BaseStream.Length != bin.BaseStream.Position)
                    {
                        int grp = bin.ReadInt32();

                        if (grp < groups.Length && skillidx < SkillsLoader.Instance.SkillsCount)
                        {
                            groups[grp].Add(skillidx++);
                        }
                    }

                    for (int i = 0; i < groups.Length; i++)
                    {
                        Add(groups[i]);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error($"Error while reading skillgrp.mul, using CUO defaults! exception given is: {e}");

                return(false);
            }

            return(Groups.Count != 0);
        }
Beispiel #17
0
 public static void Add(SkillsGroup g)
 {
     Groups.Add(g);
 }