Example #1
0
 public LokaiSkill(LokaiSkills owner, LokaiSkillInfo info, int baseValue, int cap, LokaiSkillLock LokaiSkillLock)
 {
     m_Owner = owner;
     m_Info  = info;
     m_Base  = (ushort)baseValue;
     m_Cap   = (ushort)cap;
     m_Lock  = LokaiSkillLock;
 }
Example #2
0
        public static bool UseLokaiSkill(Mobile from, int LokaiSkillID)
        {
            if (!from.CheckAlive())
            {
                return(false);
            }
            //else if (!from.Region.OnLokaiSkillUse(from, LokaiSkillID))
            //    return false;
            //else if (!from.AllowLokaiSkillUse((LokaiSkillName)LokaiSkillID))
            //    return false;

            if (LokaiSkillID >= 0 && LokaiSkillID < LokaiSkillInfo.Table.Length)
            {
                LokaiSkillInfo info = LokaiSkillInfo.Table[LokaiSkillID];

                if (info.ClickToUse)
                {
                    if (from.NextSkillTime <= Core.TickCount && from.Spell == null)
                    {
                        from.DisruptiveAction();

                        if (info.Callback != null)
                        {
                            from.NextSkillTime = Core.TickCount + (int)info.Callback(from).TotalSeconds;
                        }
                        else
                        {
                            from.NextSkillTime = Core.TickCount + (int)TimeSpan.FromSeconds(2.0).TotalSeconds;
                        }

                        return(true);
                    }
                    else
                    {
                        from.SendSkillMessage();
                    }
                }
                else
                {
                    from.SendMessage("That skill cannot be used directly.");
                }
            }

            return(false);
        }
 static LokaiSkillInfo()
 {
     // When these lokaiSkills are implemented, if there is direct-use code for the lokaiSkill,
     //   change the boolean value to 'true'
     LokaiSkillInfo[] lokaiSkillarray;
     lokaiSkillarray        = new LokaiSkillInfo[30];
     lokaiSkillarray[0]     = new LokaiSkillInfo(0, "Butchering", "Butcher", 5.0, 5.0, 10.0, false, null);
     lokaiSkillarray[1]     = new LokaiSkillInfo(1, "Skinning", "Skinner", 10.0, 0.0, 10.0, false, null);
     lokaiSkillarray[2]     = new LokaiSkillInfo(2, "Animal Riding", "Rider", 10.0, 10.0, 0.0, false, null);
     lokaiSkillarray[3]     = new LokaiSkillInfo(3, "Sailing", "Sailor", 15.0, 5.0, 0.0, false, null);
     lokaiSkillarray[4]     = new LokaiSkillInfo(4, "Detect Evil", "Cleric", 0.0, 0.0, 10.0, true, null);
     lokaiSkillarray[5]     = new LokaiSkillInfo(5, "Cure Disease", "Cleric", 0.0, 0.0, 10.0, true, null);
     lokaiSkillarray[6]     = new LokaiSkillInfo(6, "Pick Pocket", "Rogue", 0.0, 10.0, 0.0, true, null);
     lokaiSkillarray[7]     = new LokaiSkillInfo(7, "Pilfering", "Rogue", 0.0, 5.0, 10.0, true, null);
     lokaiSkillarray[8]     = new LokaiSkillInfo(8, "Framing", "Framer", 0.0, 0.0, 0.0, false, null);
     lokaiSkillarray[9]     = new LokaiSkillInfo(9, "Brick Laying", "Bricklayer", 10.0, 10.0, 0.0, false, null);
     lokaiSkillarray[10]    = new LokaiSkillInfo(10, "Roofing", "Roofer", 10.0, 10.0, 0.0, false, null);
     lokaiSkillarray[11]    = new LokaiSkillInfo(11, "Stone Masonry", "Mason", 15.0, 5.0, 0.0, false, null);
     lokaiSkillarray[12]    = new LokaiSkillInfo(12, "Ventriloquism", "Ventriloquist", 0.0, 10.0, 10.0, true, null);
     lokaiSkillarray[13]    = new LokaiSkillInfo(13, "Hypnotism", "Hypnotist", 0.0, 5.0, 15.0, true, null);
     lokaiSkillarray[14]    = new LokaiSkillInfo(14, "Prey Tracking", "Ranger", 5.0, 10.0, 5.0, false, null);
     lokaiSkillarray[15]    = new LokaiSkillInfo(15, "Speak To Animals", "Ranger", 5.0, 0.0, 10.0, true, null);
     lokaiSkillarray[16]    = new LokaiSkillInfo(16, "Woodworking", "Woodworker", 5.0, 10.0, 0.0, true, null);
     lokaiSkillarray[17]    = new LokaiSkillInfo(17, "Cooperage", "Cooper", 0.0, 20.0, 0.0, true, null);
     lokaiSkillarray[18]    = new LokaiSkillInfo(18, "Spinning", "Weaver", 10.0, 5.0, 0.0, false, null);
     lokaiSkillarray[19]    = new LokaiSkillInfo(19, "Weaving", "Weaver", 10.0, 5.0, 0.0, false, null);
     lokaiSkillarray[20]    = new LokaiSkillInfo(20, "Construction", "Merchant", 20.0, 0.0, 0.0, false, null);
     lokaiSkillarray[21]    = new LokaiSkillInfo(21, "Commerce", "Merchant", 0.0, 0.0, 20.0, true, null);
     lokaiSkillarray[22]    = new LokaiSkillInfo(22, "Brewing", "Herbalist", 0.0, 0.0, 10.0, true, null);
     lokaiSkillarray[23]    = new LokaiSkillInfo(23, "Herblore", "Herbalist", 0.0, 0.0, 10.0, true, null);
     lokaiSkillarray[24]    = new LokaiSkillInfo(24, "Tree Picking", "Harvester", 10.0, 10.0, 0.0, false, null);
     lokaiSkillarray[25]    = new LokaiSkillInfo(25, "Tree Sapping", "Harvester", 10.0, 10.0, 0.0, false, null);
     lokaiSkillarray[26]    = new LokaiSkillInfo(26, "Tree Carving", "Harvester", 15.0, 5.0, 0.0, false, null);
     lokaiSkillarray[27]    = new LokaiSkillInfo(27, "Tree Digging", "Harvester", 15.0, 5.0, 0.0, false, null);
     lokaiSkillarray[28]    = new LokaiSkillInfo(28, "Teaching", "Scholar", 0.0, 0.0, 10.0, false, null);
     lokaiSkillarray[29]    = new LokaiSkillInfo(29, "Linguistics", "Scholar", 0.0, 5.0, 5.0, false, null);
     LokaiSkillInfo.m_Table = lokaiSkillarray;
 }
Example #4
0
        public LokaiSkill(LokaiSkills owner, LokaiSkillInfo info, GenericReader reader)
        {
            m_Owner = owner;
            m_Info  = info;

            int version = reader.ReadByte();

            switch (version)
            {
            case 0:
            {
                m_Base = reader.ReadUShort();
                m_Cap  = reader.ReadUShort();
                m_Lock = (LokaiSkillLock)reader.ReadByte();

                break;
            }

            case 0xFF:
            {
                m_Base = 0;
                m_Cap  = 1000;
                m_Lock = LokaiSkillLock.Up;

                break;
            }

            default:
            {
                if ((version & 0xC0) == 0x00)
                {
                    if ((version & 0x1) != 0)
                    {
                        m_Base = reader.ReadUShort();
                    }

                    if ((version & 0x2) != 0)
                    {
                        m_Cap = reader.ReadUShort();
                    }
                    else
                    {
                        m_Cap = 1000;
                    }

                    if ((version & 0x4) != 0)
                    {
                        m_Lock = (LokaiSkillLock)reader.ReadByte();
                    }
                }

                break;
            }
            }

            if (m_Lock < LokaiSkillLock.Up || m_Lock > LokaiSkillLock.Locked)
            {
                Console.WriteLine("Bad Lokai Skill lock -> {0}.{1}", owner.Owner, m_Lock);
                m_Lock = LokaiSkillLock.Up;
            }
        }
        public static void Gain(Mobile from, LokaiSkill lokaiSkill)
        {
            if (from.Region.IsPartOf(typeof(Regions.Jail)))
            {
                return;
            }

            if (lokaiSkill.Base < lokaiSkill.Cap && lokaiSkill.Lock == LokaiSkillLock.Up)
            {
                int oldLokaiSkill = lokaiSkill.BaseFixedPoint;
                int toGain        = 1;

                if (lokaiSkill.Base <= 30.0)
                {
                    toGain = Utility.Random(3) + 1;
                }

                LokaiSkills lokaiSkills = LokaiSkillUtilities.XMLGetSkills(from);

                if (lokaiSkills.Total >= lokaiSkills.Cap)
                {
                    for (int i = 0; i < lokaiSkills.Length; ++i)
                    {
                        LokaiSkill toLower = lokaiSkills[i];

                        if (toLower != lokaiSkill && toLower.Lock == LokaiSkillLock.Down && toLower.BaseFixedPoint >= toGain)
                        {
                            toLower.BaseFixedPoint -= toGain;
                            break;
                        }
                    }
                }

                if ((lokaiSkills.Total + toGain) <= lokaiSkills.Cap)
                {
                    lokaiSkill.BaseFixedPoint += toGain;
                }
                if ((oldLokaiSkill <= 199 && lokaiSkill.BaseFixedPoint >= 200) ||
                    (oldLokaiSkill <= 299 && lokaiSkill.BaseFixedPoint >= 300) ||
                    (oldLokaiSkill <= 399 && lokaiSkill.BaseFixedPoint >= 400) ||
                    (oldLokaiSkill <= 499 && lokaiSkill.BaseFixedPoint >= 500) ||
                    (oldLokaiSkill <= 599 && lokaiSkill.BaseFixedPoint >= 600) ||
                    (oldLokaiSkill <= 699 && lokaiSkill.BaseFixedPoint >= 700) ||
                    (oldLokaiSkill <= 799 && lokaiSkill.BaseFixedPoint >= 800) ||
                    (oldLokaiSkill <= 899 && lokaiSkill.BaseFixedPoint >= 900))
                {
                    lokaiSkills.Teaching.BaseFixedPoint += (7 - toGain);
                }
            }

            if (lokaiSkill.Lock == LokaiSkillLock.Up)
            {
                LokaiSkillInfo info = lokaiSkill.Info;

                if (from.StrLock == StatLockType.Up && (info.StrScale / 33.3) > Utility.RandomDouble())
                {
                    SkillCheck.GainStat(from, SkillCheck.Stat.Str);
                }
                else if (from.DexLock == StatLockType.Up && (info.IntScale / 33.3) > Utility.RandomDouble())
                {
                    SkillCheck.GainStat(from, SkillCheck.Stat.Dex);
                }
                else if (from.IntLock == StatLockType.Up && (info.DexScale / 33.3) > Utility.RandomDouble())
                {
                    SkillCheck.GainStat(from, SkillCheck.Stat.Int);
                }
            }
        }