public static void UseSkill(string skill)
        {
            try
            {
                Skill sk = ResolveSkillName(skill);

                UOC.UseSkill(sk);
            }
            catch (ArgumentOutOfRangeException)
            {
                UOC.SystemMessage(string.Format(Strings.Invalid_skill_name___0__, skill));
            }
        }
        private static Skill ResolveSkillName(string skill)
        {
            skill = skill.ToLower();

            string[] enumNames = typeof(Skill).GetEnumNames();

            foreach (string t in enumNames)
            {
                string normalizedName = t.Replace('_', ' ').ToLower();

                if (!skill.Equals(normalizedName))
                {
                    continue;
                }

                Skill s = (Skill)Enum.Parse(typeof(Skill), t);

                return(s);
            }

            throw new ArgumentOutOfRangeException();
        }
Beispiel #3
0
        public static void UseSkill(Skill skill)
        {
            byte[] shortBaseSkillPacket = { 0x12, 0x00, 0x08, 0x24, 0x00, 0x20, 0x30, 0x00 };
            byte[] longBaseSkillPacket  = { 0x12, 0x00, 0x09, 0x24, 0x00, 0x00, 0x20, 0x30, 0x00 };

            switch (skill)
            {
            case Skill.Anatomy:
                shortBaseSkillPacket[4] = 0x31;
                Engine.SendPacketToServer(shortBaseSkillPacket, shortBaseSkillPacket.Length);
                break;

            case Skill.Animal_Lore:
                shortBaseSkillPacket[4] = 0x32;
                Engine.SendPacketToServer(shortBaseSkillPacket, shortBaseSkillPacket.Length);
                break;

            case Skill.Animal_Taming:
                longBaseSkillPacket[4] = 0x33;
                longBaseSkillPacket[5] = 0x35;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Arms_Lore:
                shortBaseSkillPacket[4] = 0x34;
                Engine.SendPacketToServer(shortBaseSkillPacket, shortBaseSkillPacket.Length);
                break;

            case Skill.Begging:
                shortBaseSkillPacket[4] = 0x36;
                Engine.SendPacketToServer(shortBaseSkillPacket, shortBaseSkillPacket.Length);
                break;

            case Skill.Cartography:
                longBaseSkillPacket[4] = 0x31;
                longBaseSkillPacket[5] = 0x32;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Detecting_Hidden:
                longBaseSkillPacket[4] = 0x31;
                longBaseSkillPacket[5] = 0x34;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Discordance:
                longBaseSkillPacket[4] = 0x31;
                longBaseSkillPacket[5] = 0x35;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Evaluating_Intelligence:
                longBaseSkillPacket[4] = 0x31;
                longBaseSkillPacket[5] = 0x36;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Forensic_Evaluation:
                longBaseSkillPacket[4] = 0x31;
                longBaseSkillPacket[5] = 0x39;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Hiding:
                longBaseSkillPacket[4] = 0x32;
                longBaseSkillPacket[5] = 0x31;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Inscription:
                longBaseSkillPacket[4] = 0x32;
                longBaseSkillPacket[5] = 0x33;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Item_Identification:
                shortBaseSkillPacket[4] = 0x33;
                Engine.SendPacketToServer(shortBaseSkillPacket, shortBaseSkillPacket.Length);
                break;

            case Skill.Meditation:
                longBaseSkillPacket[4] = 0x34;
                longBaseSkillPacket[5] = 0x36;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Peacemaking:
                shortBaseSkillPacket[4] = 0x39;
                Engine.SendPacketToServer(shortBaseSkillPacket, shortBaseSkillPacket.Length);
                break;

            case Skill.Poisoning:
                longBaseSkillPacket[4] = 0x33;
                longBaseSkillPacket[5] = 0x30;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Provocation:
                longBaseSkillPacket[4] = 0x32;
                longBaseSkillPacket[5] = 0x32;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Remove_Trap:
                longBaseSkillPacket[4] = 0x34;
                longBaseSkillPacket[5] = 0x38;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Spirit_Speak:
                longBaseSkillPacket[4] = 0x33;
                longBaseSkillPacket[5] = 0x32;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Stealing:
                longBaseSkillPacket[4] = 0x33;
                longBaseSkillPacket[5] = 0x33;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Stealth:
                longBaseSkillPacket[4] = 0x34;
                longBaseSkillPacket[5] = 0x37;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Taste_Identification:
                longBaseSkillPacket[4] = 0x33;
                longBaseSkillPacket[5] = 0x36;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Tracking:
                longBaseSkillPacket[4] = 0x33;
                longBaseSkillPacket[5] = 0x38;
                Engine.SendPacketToServer(longBaseSkillPacket, longBaseSkillPacket.Length);
                break;

            case Skill.Alchemy:
                break;

            case Skill.Parrying:
                break;

            case Skill.Blacksmithy:
                break;

            case Skill.Bowcraft_Fletching:
                break;

            case Skill.Camping:
                break;

            case Skill.Carpentry:
                break;

            case Skill.Cooking:
                break;

            case Skill.Healing:
                break;

            case Skill.Fishing:
                break;

            case Skill.Herding:
                break;

            case Skill.Lockpicking:
                break;

            case Skill.Magery:
                break;

            case Skill.Resisting_Spells:
                break;

            case Skill.Tactics:
                break;

            case Skill.Snooping:
                break;

            case Skill.Musicianship:
                break;

            case Skill.Archery:
                break;

            case Skill.Tailoring:
                break;

            case Skill.Tinkering:
                break;

            case Skill.Veterinary:
                break;

            case Skill.Swordsmanship:
                break;

            case Skill.Mace_Fighting:
                break;

            case Skill.Fencing:
                break;

            case Skill.Wrestling:
                break;

            case Skill.Lumberjacking:
                break;

            case Skill.Mining:
                break;

            case Skill.Necromancy:
                break;

            case Skill.Focus:
                break;

            case Skill.Chivalry:
                break;

            case Skill.Bushido:
                break;

            case Skill.Ninjitsu:
                break;

            case Skill.Spellweaving:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(skill), skill, null);
            }
        }