protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_RawFlax.Deleted)
                {
                    return;
                }

                ISpinningWheel wheel = targeted as ISpinningWheel;

                if (wheel == null && targeted is AddonComponent)
                {
                    wheel = ((AddonComponent)targeted).Addon as ISpinningWheel;
                }

                if (wheel is Item)
                {
                    Item item = (Item)wheel;

                    if (!m_RawFlax.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001);                           // That must be in your pack for you to use it.
                    }
                    else if (wheel.Spinning)
                    {
                        from.SendLocalizedMessage(502656);                           // That spinning wheel is being used.
                    }
                    else
                    {
                        LokaiSkills   skills     = LokaiSkillUtilities.XMLGetSkills(from);
                        LokaiSkill    lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Spinning;
                        SuccessRating rating     = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0);

                        if (rating >= SuccessRating.PartialSuccess)
                        {
                            m_RawFlax.Consume();
                            wheel.BeginSpin(new SpinCallback(RawFlax.OnSpun), from, m_RawFlax.Hue);
                        }
                        else if (rating == SuccessRating.Failure)
                        {
                            from.SendMessage("You fail, but manage to save your Raw Flax.");
                        }
                        else if (rating == SuccessRating.HazzardousFailure || rating == SuccessRating.CriticalFailure)
                        {
                            m_RawFlax.Consume();
                            from.SendMessage("You fail, and some Raw Flax is lost.");
                        }
                        else if (rating == SuccessRating.TooDifficult)
                        {
                            m_RawFlax.Consume();
                            from.SendMessage("You have no idea how to use this thing.");
                            from.SendMessage("You fail utterly, some Raw Flax is lost.");
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502658);                       // Use that on a spinning wheel.
                }
            }
        public ShowLokaiSkillsGump(Mobile mobile, bool value)
            : base(0, 0)
        {
            m_Mobile = mobile;
            m_Value  = value;
            bool        GM    = mobile.AccessLevel >= AccessLevel.GameMaster;
            LokaiSkills skils = LokaiSkillUtilities.XMLGetSkills(m_Mobile);

            m_Mobile.CloseGump(typeof(ShowLokaiSkillsGump));
            AddPage(0);
            AddBackground(564, 17, 220, 574, 9200);
            AddBackground(592, 21, 189, 537, 9300);

            AddButton(590, 560, value ? 0x25FF : 0x2602, value ? 0x2602 : 0x25FF, 19, GumpButtonType.Reply, 0);
            AddButton(680, 560, value ? 0x2602 : 0x25FF, value ? 0x25FF : 0x2602, 29, GumpButtonType.Reply, 0);
            AddHtml(621, 567, 55, 20, Color("BASE", value ? 0x20 : 0x777), false, false);
            AddHtml(711, 567, 55, 20, Color("VALUE", value ? 0x777 : 0x20), false, false);

            int y   = 32;
            int hue = 0;

            for (int x = 0; x < LokaiSkillInfo.Table.Length; x++)
            {
                if (LokaiSkillUtilities.ShowLokaiSkill(x))
                {
                    if (LokaiSkillInfo.Table[x].ClickToUse || LokaiSkillInfo.Table[x].Callback != null)
                    {
                        AddButton(573, y + 3, 1210, 1209, x + 100, GumpButtonType.Reply, 0);
                        AddButton(555, y + 7, 2101, 2101, x + 200, GumpButtonType.Reply, 0);
                    }
                    if (GM)
                    {
                        AddButton(761, y + 2, 5401, 5401, x + 300, GumpButtonType.Reply, 0);
                    }
                    hue = 0;
                }
                else
                {
                    if (GM)
                    {
                        AddButton(761, y + 2, 5402, 5402, x + 300, GumpButtonType.Reply, 0);
                    }
                    hue = 1152;
                }
                string skill = value ? skils[x].Value.ToString("F1") : skils[x].Base.ToString("F1");
                if (LokaiSkillUtilities.ShowLokaiSkill(x) || GM)
                {
                    AddLabel(647, y, hue, LokaiSkillInfo.Table[x].Name);
                }
                if (LokaiSkillUtilities.ShowLokaiSkill(x) || GM)
                {
                    AddLabel(602, y, hue, skill);
                }
                y += 17;
            }
        }
Exemple #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            // version 0
            m_From   = reader.ReadMobile();
            m_Skills = new LokaiSkills(m_From, reader);
        }
        public double GetSuccessChance(Mobile from, Type typeRes, BuildSystem buildSystem, bool gainLokaiSkills, ref bool allRequiredLokaiSkills)
        {
            double minMainLokaiSkill = 0.0;
            double maxMainLokaiSkill = 0.0;
            double valMainLokaiSkill = 0.0;

            allRequiredLokaiSkills = true;

            LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from);

            for (int i = 0; i < m_arBuildLokaiSkill.Count; i++)
            {
                BuildLokaiSkill buildLokaiSkill = m_arBuildLokaiSkill.GetAt(i);

                double minLokaiSkill = buildLokaiSkill.MinLokaiSkill;
                double maxLokaiSkill = buildLokaiSkill.MaxLokaiSkill;
                double valLokaiSkill = skills[buildLokaiSkill.LokaiSkillToMake].Value;

                if (valLokaiSkill < minLokaiSkill)
                {
                    allRequiredLokaiSkills = false;
                }

                if (buildLokaiSkill.LokaiSkillToMake == buildSystem.MainLokaiSkill)
                {
                    minMainLokaiSkill = minLokaiSkill;
                    maxMainLokaiSkill = maxLokaiSkill;
                    valMainLokaiSkill = valLokaiSkill;
                }

                if (gainLokaiSkills)                   // This is a passive check. Success chance is entirely dependant on the main lokaiSkill
                {
                    LokaiSkillUtilities.CheckLokaiSkill(from, skills[buildLokaiSkill.LokaiSkillToMake], minLokaiSkill, maxLokaiSkill);
                }
            }

            double chance;

            if (allRequiredLokaiSkills)
            {
                chance = buildSystem.GetChanceAtMin(this) + ((valMainLokaiSkill - minMainLokaiSkill) / (maxMainLokaiSkill - minMainLokaiSkill) * (1.0 - buildSystem.GetChanceAtMin(this)));
            }
            else
            {
                chance = 0.0;
            }

            if (allRequiredLokaiSkills && valMainLokaiSkill == maxMainLokaiSkill)
            {
                chance = 1.0;
            }

            return(chance);
        }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile      targ        = (Mobile)targeted;
                    LokaiSkills lokaiSkills = LokaiSkillUtilities.XMLGetSkills(targ);

                    for (int i = 0; i < lokaiSkills.Length; ++i)
                    {
                        lokaiSkills[i].Base = m_Value;
                    }

                    CommandLogging.LogChangeProperty(from, targ, "EveryLokaiSkill.Base", m_Value.ToString());
                }
                else
                {
                    from.SendMessage("That does not have Lokai Skills!");
                }
            }
        public virtual void Resource_OnTarget(Mobile from, object targ)
        {
            LokaiSkills skills         = LokaiSkillUtilities.XMLGetSkills(from);
            LokaiSkill  brewLokaiSkill = skills[LokaiSkillName.Brewing];
            LokaiSkill  herbLokaiSkill = skills[LokaiSkillName.Herblore];

            if (this.grindable)
            {
                if (targ is MortarPestle)
                {
                    Container pack = from.Backpack;
                    if (!(pack == null || pack.Deleted))
                    {
                        Grind(this, from, LokaiSkillUtilities.CheckLokaiSkill(from, herbLokaiSkill, 0.0, 100.0), grindResult, pack);
                    }
                }
                else
                {
                    from.SendMessage("Try using this on a mortar and pestle.");
                }
            }
            else if (this.cookable)
            {
                if (IsHeatSource(targ))
                {
                    Container pack = from.Backpack;
                    if (!(pack == null || pack.Deleted))
                    {
                        Cook(this, from, LokaiSkillUtilities.CheckLokaiSkill(from, brewLokaiSkill, 0.0, 100.0), cookResult, pack);
                    }
                }
                else
                {
                    from.SendMessage("Try using this on a heat source.");
                }
            }
        }
        public static void SailBoat(Mobile from, BaseBoat boat)
        {
            bool newsail = true;

            if (m_SailTime.ContainsKey(from))
            {
                if (m_SailTime[from] >= DateTime.Now)
                {
                    newsail = false;
                }
                else
                {
                    m_SailTime.Remove(from);
                }
            }

            if (newsail)
            {
                int MinLevel = 10;
                int MaxLevel = 100;
                //if (Core.Debug) from.SendMessage("TEST: SAILING IN A BOAT");

                Mobile sailor = from;

                LokaiSkills skils = LokaiSkillUtilities.XMLGetSkills(sailor);

                List <Mobile> crew = GetMobilesOn(boat);

                SuccessRating rating = SuccessRating.LokaiSkillNotEnabled;

                foreach (Mobile seaman in crew)
                {
                    skils = LokaiSkillUtilities.XMLGetSkills(sailor);

                    LokaiSkills seamanAbs = LokaiSkillUtilities.XMLGetSkills(seaman);
                    if (seamanAbs.Sailing.Value > skils.Sailing.Value)
                    {
                        sailor = seaman;
                    }
                    MinLevel--;
                    MaxLevel--;
                    if ((MinLevel == 5 && (boat is SmallBoat || boat is SmallDragonBoat)) ||
                        (MinLevel == 0 && (boat is MediumBoat || boat is MediumDragonBoat)) ||
                        (MinLevel == -5 && (boat is LargeBoat || boat is LargeDragonBoat)))
                    {
                        break;
                    }
                }

                int count = 0;
                foreach (Mobile seaman in crew)
                {
                    if ((count == 5 && (boat is SmallBoat || boat is SmallDragonBoat)) ||
                        (count == 10 && (boat is MediumBoat || boat is MediumDragonBoat)) ||
                        (count == 15 && (boat is LargeBoat || boat is LargeDragonBoat)))
                    {
                        break;
                    }
                    else
                    {
                        count++;
                        skils = LokaiSkillUtilities.XMLGetSkills(seaman);
                        if (seaman != sailor)
                        {
                            rating = LokaiSkillUtilities.CheckLokaiSkill(seaman, skils.Sailing, MinLevel, MaxLevel);
                            if (rating >= SuccessRating.PartialSuccess)
                            {
                                seaman.SendMessage("You did your part.");
                            }
                            else
                            {
                                seaman.SendMessage("You could have been more helpful.");
                            }
                        }
                    }
                }

                skils = LokaiSkillUtilities.XMLGetSkills(sailor);

                rating = LokaiSkillUtilities.CheckLokaiSkill(sailor, skils.Sailing, MinLevel, MaxLevel);
                if (rating <= SuccessRating.Failure)
                {
                    int severity = 25;
                    if (rating == SuccessRating.HazzardousFailure)
                    {
                        severity += 4;
                    }
                    else if (rating == SuccessRating.CriticalFailure)
                    {
                        severity += 8;
                    }

                    bool crash = false;

                    foreach (Mobile seaman in crew)
                    {
                        if (!m_SailTime.ContainsKey(seaman))
                        {
                            m_SailTime.Add(seaman, DateTime.Now.AddSeconds(FAILSECONDS));
                        }
                    }

                    switch (Utility.Random(severity))
                    {
                    case 0:
                    case 1:
                    case 2: boat.StartMove(Direction.Down, true); goto case 24;

                    case 3:
                    case 4:
                    case 5: boat.StartMove(Direction.East, true); goto case 24;

                    case 6:
                    case 7:
                    case 8: boat.StartMove(Direction.Left, true); goto case 24;

                    case 9:
                    case 10:
                    case 11: boat.StartMove(Direction.North, true); goto case 24;

                    case 12:
                    case 13:
                    case 14: boat.StartMove(Direction.Right, true); goto case 24;

                    case 15:
                    case 16:
                    case 17: boat.StartMove(Direction.South, true); goto case 24;

                    case 18:
                    case 19:
                    case 20: boat.StartMove(Direction.Up, true); goto case 24;

                    case 21:
                    case 22:
                    case 23: boat.StartMove(Direction.West, true); goto case 24;

                    case 24: boat.StartTurn(Utility.RandomList(2, -2, -4), false); goto case 99;

                    case 99:
                    {
                        foreach (Mobile mobile in crew)
                        {
                            MightGetSick(mobile);
                        }
                        break;
                    }

                    default: crash = true; break;
                    }

                    if (crash)
                    {
                        boat.LowerAnchor(false);
                        List <Item> items = CheckForItems(boat);

                        BaseDockedBoat dboat = boat.DockedBoat;

                        foreach (Mobile seaman in crew)
                        {
                            seaman.SendMessage("The boat runs aground at some nearby land.");
                            boat.RemoveKeys(seaman);
                            if (seaman == boat.Owner)
                            {
                                if (dboat != null)
                                {
                                    seaman.AddToBackpack(dboat);
                                }
                            }
                        }

                        boat.Delete();

                        foreach (Mobile seaman in crew)
                        {
                            Strand(seaman);
                        }
                        if (items.Count > 0)
                        {
                            for (int v = 0; v < items.Count; v++)
                            {
                                int x = from.X + Utility.Random(7) - 3;
                                int y = from.Y + Utility.Random(7) - 3;
                                items[v].MoveToWorld(new Point3D(x, y, from.Z));
                            }
                        }
                    }
                    else
                    {
                        foreach (Mobile seaman in crew)
                        {
                            seaman.SendMessage("You go off course slightly.");
                        }
                    }
                }
                else
                {
                    //if (Core.Debug) from.SendMessage("TEST: SAILING SUCCESSFUL.");

                    foreach (Mobile seaman in crew)
                    {
                        seaman.SendMessage("You feel the gentle breeze of the open sea.");
                        if (!m_SailTime.ContainsKey(seaman))
                        {
                            m_SailTime.Add(seaman, DateTime.Now.AddSeconds(SAILSECONDS));
                        }
                    }
                }
            }
        }
        public static void RideEthereal(Mobile from, Item ethereal)
        {
            bool newride = true;

            if (m_RideTime.ContainsKey(from))
            {
                if (m_RideTime[from] >= DateTime.Now)
                {
                    newride = false;
                }
                else
                {
                    m_RideTime.Remove(from);
                }
            }


            LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from);

            if (newride)
            {
                int MinLevel = 20;
                int MaxLevel = 100;
                int fame     = 0;
                if (Core.Debug)
                {
                    from.SendMessage("TEST: RIDING AN ETHEREAL MOUNT");
                }

                SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, skills.AnimalRiding, MinLevel, MaxLevel);
                if (rating <= SuccessRating.Failure)
                {
                    int    scalar      = from.TotalWeight / (from.Dex + from.Str);
                    double penaltyTime = 0.0;

                    if (Core.Debug)
                    {
                        from.SendMessage("TEST: RIDING FAILED CHECK.");
                    }
                    IMount mount = ethereal as IMount;

                    if (mount != null)
                    {
                        mount.Rider = null;
                        from.SendMessage("You were dismounted.");
                    }
                    switch (rating)
                    {
                    case SuccessRating.HazzardousFailure:
                    {
                        if (Utility.RandomBool())
                        {
                            from.Damage(Utility.Random(5 * scalar));
                            from.SendMessage("You took some damage!");
                            fame = -200 * Utility.Random(1, 2);
                            Misc.Titles.AwardFame(from, fame, true);
                            penaltyTime = 4.0;
                        }
                        break;
                    }

                    case SuccessRating.CriticalFailure:
                    {
                        if (Utility.RandomBool())
                        {
                            from.Damage(Utility.Random(15 * scalar));
                            from.SendMessage("You took serious damage!");
                            fame = -400 * Utility.Random(1, 2);
                            Misc.Titles.AwardFame(from, fame, true);
                            penaltyTime = 10.0;
                        }
                        break;
                    }

                    case SuccessRating.TooDifficult:
                    {
                        from.SendMessage("This mount is too difficult for you!");
                        break;
                    }

                    default: break;
                    }
                    m_RideTime.Add(from, DateTime.Now.AddSeconds(FAILSECONDS + penaltyTime));
                }
                else
                {
                    double bonusTime = 0.0;
                    if (Core.Debug)
                    {
                        from.SendMessage("TEST: RIDING SUCCEEDED CHECK.");
                    }
                    switch (rating)
                    {
                    case SuccessRating.ExceptionalSuccess:
                    {
                        if (Utility.RandomBool())
                        {
                            fame = 400 * Utility.Random(1, 2);
                            Misc.Titles.AwardFame(from, fame, true);
                            bonusTime = 20.0;
                        }
                        break;
                    }

                    case SuccessRating.CompleteSuccess:
                    {
                        if (Utility.RandomBool())
                        {
                            fame = 200 * Utility.Random(1, 2);
                            Misc.Titles.AwardFame(from, fame, true);
                            bonusTime = 10.0;
                        }
                        break;
                    }

                    case SuccessRating.Success:
                    {
                        if (Utility.RandomBool())
                        {
                            fame = 100 * Utility.Random(1, 2);
                            Misc.Titles.AwardFame(from, fame, true);
                            bonusTime = 4.0;
                        }
                        break;
                    }

                    case SuccessRating.TooEasy:
                    {
                        from.SendMessage("This mount does not provide enough of a challenge for you.");
                        bonusTime = 120.0;
                        break;
                    }

                    default: break;
                    }
                    m_RideTime.Add(from, DateTime.Now.AddSeconds(RIDESECONDS + bonusTime));
                }
                skills.LastLokaiSkillCheck[(int)LokaiSkillName.AnimalRiding] = rating;
            }
            else
            {
                SuccessRating rating = skills.LastCheck(LokaiSkillName.AnimalRiding);
                if (rating <= SuccessRating.Failure)
                {
                    double wait = ((TimeSpan)(m_RideTime[from] - DateTime.Now)).TotalSeconds;
                    if (Core.Debug)
                    {
                        from.SendMessage("TEST: FAILED LAST RIDING CHECK.");
                    }
                    IMount mount = ethereal as IMount;

                    if (mount != null)
                    {
                        mount.Rider = null;
                        if (rating > SuccessRating.TooDifficult)
                        {
                            from.SendMessage("You must wait {0} seconds before you attempt this again.", wait.ToString("F1"));
                        }
                        else
                        {
                            from.SendMessage("This mount is too difficult for you!");
                        }
                    }
                }
            }
        }
Exemple #9
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Material.Deleted)
                {
                    return;
                }

                ILoom loom = targeted as ILoom;

                if (loom == null && targeted is AddonComponent)
                {
                    loom = ((AddonComponent)targeted).Addon as ILoom;
                }

                if (loom != null)
                {
                    if (!m_Material.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                    else
                    {
                        LokaiSkills   skills     = LokaiSkillUtilities.XMLGetSkills(from);
                        LokaiSkill    lokaiSkill = skills[LokaiSkillName.Weaving];
                        SuccessRating rating     = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0);

                        if (rating >= SuccessRating.PartialSuccess)
                        {
                            if (loom.Phase < 4)
                            {
                                if (targeted is Item)
                                {
                                    ((Item)targeted).SendLocalizedMessageTo(from, 1010001 + loom.Phase++);
                                }
                                m_Material.Consume();
                            }
                            else
                            {
                                Item create = new BoltOfCloth();
                                create.Hue = m_Material.Hue;
                                loom.Phase = 0;
                                from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
                                from.AddToBackpack(create);
                                m_Material.Consume();
                            }
                        }
                        else if (rating == SuccessRating.Failure)
                        {
                            from.SendMessage("You fail, but manage to save your material.");
                        }
                        else if (rating == SuccessRating.HazzardousFailure)
                        {
                            m_Material.Consume();
                            from.SendMessage("You fail, and some material is lost.");
                        }
                        else if (rating == SuccessRating.CriticalFailure)
                        {
                            m_Material.Consume();
                            loom.Phase = 0;
                            from.SendMessage("You fail utterly, some material is lost, and you need to start over.");
                        }
                        else if (rating == SuccessRating.TooDifficult)
                        {
                            m_Material.Consume();
                            loom.Phase = 0;
                            from.SendMessage("You have no idea how to work this thing.");
                            from.SendMessage("You fail utterly, some material is lost, and you need to start over.");
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500367);                       // Try using that on a loom.
                }
            }
Exemple #10
0
                public override void OnResponse(Mobile from, string text)
                {
                    if (targeted is Item && ((Item)targeted).Parent != null)
                    {
                        targeted = ((Item)targeted).Parent;
                        OnResponse(from, text);
                    }
                    LokaiSkills skills     = LokaiSkillUtilities.XMLGetSkills(from);
                    LokaiSkill  lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Ventriloquism;

                    if (targeted is Mobile)
                    {
                        Mobile mob = (Mobile)targeted;
                        if (mob == from)
                        {
                            from.SendMessage("That's not much of a trick.");
                        }
                        else if (!mob.Alive || mob.Deleted || mob.Hidden)
                        {
                            from.SendMessage("I don't know who or what you mean.");
                        }
                        else if (!from.InRange(mob.Location, 5))
                        {
                            from.SendMessage("They are too far away.");
                        }
                        else if (!from.CanSee(mob))
                        {
                            from.SendMessage("You can't see them well enough to make them talk.");
                        }
                        else
                        {
                            double distance = Math.Sqrt((double)((mob.X - from.X) * (mob.X - from.X) +
                                                                 (double)((mob.Y - from.Y) * (mob.Y - from.Y))));
                            double        minLokaiSkill = 10.0 + (distance * 5.0);
                            double        maxLokaiSkill = 75.0 + (distance * 5.0);
                            SuccessRating rating        = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, minLokaiSkill, maxLokaiSkill);
                            if (rating >= SuccessRating.PartialSuccess)
                            {
                                mob.PublicOverheadMessage(MessageType.Emote, 0, false, text);
                            }
                            else
                            {
                                from.Say(text);
                                from.SendMessage("Your attempt at ventriloquism fails.");
                            }
                        }
                    }
                    else if (targeted is Item)
                    {
                        Item item = (Item)targeted;
                        if (!from.InRange(item.Location, 5))
                        {
                            from.SendMessage("That is too far away.");
                        }
                        else if (!from.CanSee(item))
                        {
                            from.SendMessage("You can't see that well enough to make it talk.");
                        }
                        else
                        {
                            double distance = Math.Sqrt((double)((item.X - from.X) * (item.X - from.X) +
                                                                 (double)((item.Y - from.Y) * (item.Y - from.Y))));
                            double        minLokaiSkill = 0.0 + (distance * 5.0);
                            double        maxLokaiSkill = 65.0 + (distance * 5.0);
                            SuccessRating rating        = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, minLokaiSkill, maxLokaiSkill);
                            if (rating >= SuccessRating.PartialSuccess)
                            {
                                item.PublicOverheadMessage(MessageType.Emote, 0, false, text);
                            }
                            else
                            {
                                from.Say(text);
                                from.SendMessage("Your attempt at ventriloquism fails.");
                            }
                        }
                    }
                    else if (targeted is StaticTarget)
                    {
                        StaticTarget stat = (StaticTarget)targeted;
                        if (!from.InRange(stat.Location, 5))
                        {
                            from.SendMessage("That is too far away.");
                        }
                        else
                        {
                            double distance = Math.Sqrt((double)((stat.X - from.X) * (stat.X - from.X) +
                                                                 (double)((stat.Y - from.Y) * (stat.Y - from.Y))));
                            double        minLokaiSkill = -10.0 + (distance * 5.0);
                            double        maxLokaiSkill = 55.0 + (distance * 5.0);
                            SuccessRating rating        = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, minLokaiSkill, maxLokaiSkill);
                            if (rating >= SuccessRating.PartialSuccess)
                            {
                                IPoint3D p    = targeted as IPoint3D;
                                Item     item = new Item(stat.ItemID);
                                if (p == null)
                                {
                                    from.SendMessage("Unable to target that.");
                                    return;
                                }

                                if (p is Item)
                                {
                                    p = ((Item)p).GetWorldTop();
                                    if (Core.Debug)
                                    {
                                        from.SendMessage("TEMP: Set Point3D to ((Item)p).GetWorldTop().");
                                    }
                                }
                                else
                                {
                                    p = new Point3D(stat.X, stat.Y, stat.Z - item.ItemData.CalcHeight);
                                    if (Core.Debug)
                                    {
                                        from.SendMessage("TEMP: IPoint3D was not an Item.");
                                    }
                                }
                                item.MoveToWorld(new Point3D(p), from.Map);
                                item.PublicOverheadMessage(MessageType.Emote, 0, false, text);
                                new InternalTimer(from, item).Start();
                            }
                            else
                            {
                                from.Say(text);
                                from.SendMessage("Your attempt at ventriloquism fails.");
                            }
                        }
                    }
                }
Exemple #11
0
        public ResourceGump(Mobile from, TreeHarvestTool tool)
            : base(0, 0)
        {
            m_From = from;
            m_Tool = tool;
            LokaiSkills    skills     = LokaiSkillUtilities.XMLGetSkills(from);
            LokaiSkillName skil       = LokaiSkillName.TreePicking;
            string         lokaiSkill = "Current Tree";

            switch (m_Tool.ResourceType)
            {
            case TreeResourceType.BarkSkin: lokaiSkill += " Carving Skill: "; skil = LokaiSkillName.TreeCarving; break;

            case TreeResourceType.FruitNut: lokaiSkill += " Picking Skill: "; skil = LokaiSkillName.TreePicking; break;

            case TreeResourceType.LeafSpine: lokaiSkill += " Picking Skill: "; skil = LokaiSkillName.TreePicking; break;

            case TreeResourceType.RootBranch: lokaiSkill += " Digging Skill: "; skil = LokaiSkillName.TreeDigging; break;

            case TreeResourceType.SapJuice: lokaiSkill += " Sapping Skill: "; skil = LokaiSkillName.TreeSapping; break;
            }
            lokaiSkill += skills[skil].Value.ToString("F1");

            m_From.CloseGump(typeof(ResourceGump));

            Closable  = true;
            Dragable  = true;
            Resizable = false;
            int bark  = m_Tool.ResourceType == TreeResourceType.BarkSkin ? 2361 : 2360;
            int fruit = m_Tool.ResourceType == TreeResourceType.FruitNut ? 2361 : 2360;
            int leaf  = m_Tool.ResourceType == TreeResourceType.LeafSpine ? 2361 : 2360;
            int root  = m_Tool.ResourceType == TreeResourceType.RootBranch ? 2361 : 2360;
            int sap   = m_Tool.ResourceType == TreeResourceType.SapJuice ? 2361 : 2360;

            AddPage(0);
            AddBackground(40, 40, 404, 445, 9250);
            AddImage(40, 40, from.Female ? 13 : 12, 146);
            AddImage(40, 40, 50981);
            AddImage(40, 40, 60479);
            AddImage(40, 40, 60517);
            AddImage(40, 40, 50617);
            AddImage(40, -30, 50650);
            AddImage(-3, 178, 50497);
            AddImage(95, 81, 11374);
            AddImage(51, 52, 11374);
            AddImage(55, 99, 11374);
            AddImage(56, 135, 11374);
            AddImage(61, 233, 11374);
            AddLabel(57, 57, 1378, @"A");
            AddLabel(99, 84, 1378, @"B");
            AddLabel(60, 102, 1378, @"C");
            AddLabel(61, 137, 1378, @"D");
            AddLabel(66, 236, 1378, @"E");
            AddLabel(70, 300, 1378, @"A");
            AddLabel(70, 330, 1378, @"B");
            AddLabel(70, 360, 1378, @"C");
            AddLabel(70, 390, 1378, @"D");
            AddLabel(70, 420, 1378, @"E");
            AddLabel(170, 54, 0, @"Tree Harvest Tool");
            AddLabel(88, 300, 0, @"Fruit Picking Tool: for harvesting fruit and nuts");
            AddLabel(88, 330, 0, @"Leaf Picking Tool: for harvesting leaves and spines");
            AddLabel(88, 360, 0, @"Carving Tool: for harvesting bark and skin");
            AddLabel(88, 390, 0, @"Sapping Tool: for harvesting sap and juice");
            AddLabel(88, 420, 0, @"Digging Tool: for harvesting roots and buried branches");
            AddLabel(55, 274, 0, lokaiSkill);
            AddButton(55, 304, fruit, 2362, (int)Buttons.FruitNut, GumpButtonType.Reply, 0);
            AddButton(55, 394, sap, 2362, (int)Buttons.SapJuice, GumpButtonType.Reply, 0);
            AddButton(55, 364, bark, 2362, (int)Buttons.BarkSkin, GumpButtonType.Reply, 0);
            AddButton(55, 334, leaf, 2362, (int)Buttons.LeafSpine, GumpButtonType.Reply, 0);
            AddButton(55, 424, root, 2362, (int)Buttons.RootBranch, GumpButtonType.Reply, 0);
            AddItem(300, 65, 0x0C96);
            AddItem(167, 201, 0x194F);
            AddItem(207, 211, 0x0993);
            AddItem(220, 75, 0x0D94);
            AddItem(220, 75, 0x0D96);
            AddItem(270, 145, 0x0CDA);
            AddItem(270, 145, 0x0CDC);
            AddButton(133, 447, 9904, 9905, (int)Buttons.Investigate, GumpButtonType.Reply, 0);
            AddLabel(159, 448, 0, @"Investigate Tree");
        }
Exemple #12
0
        public IncreaseLokaiSkillsGump(PlayerMobile mobile, LokaiSkillBall ball, bool first, int page)
            : base(50, 50)
        {
            m_Page   = page;
            m_Ball   = ball;
            m_Points = m_Ball.Points;
            m_Mobile = mobile;

            m_LokaiSkills = LokaiSkillUtilities.XMLGetSkills(m_Mobile);

            if (first)
            {
                m_StartValue = new double[30];
                m_Page       = 0;
                for (int x = 0; x < 30; x++)
                {
                    m_StartValue[x] = m_LokaiSkills[x].Base;
                }
            }

            m_Mobile.CloseGump(typeof(IncreaseLokaiSkillsGump));

            AddPage(0);

            AddBackground(0, 0, 476, 440, 0x13BE);

            AddLabel(10, 7, 2100, "Choose Skills");

            if (m_Page > 0)
            {
                AddButton(275, 7, 250, 251, 2, GumpButtonType.Reply, 0); // Prev Page
            }

            if (m_Page < 2)
            {
                AddButton(275, 395, 252, 253, 3, GumpButtonType.Reply, 0); // Next Page
            }

            AddLabel(160, 7, 2100, "Points Left: " + m_Points.ToString());

            //			We only need this "if" condition if we want to make them use it all up right now.
            //			if ( m_Points == 0 )
            //			{
            AddButton(305, 335, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0); // OK button
            //			}

            AddImage(170, -10, 0x58A);

            m_StartPos = m_Page * 10;
            int z = 0;

            for (int i = m_StartPos; i < m_StartPos + 10; i++)
            {
                int y = 20 + (30 * (++z));

                if (LokaiSkillUtilities.ShowLokaiSkill(i))
                {
                    m_LokaiSkill = m_LokaiSkills[i];

                    AddLabel(10, y, 2124, m_LokaiSkill.Name.ToString());

                    AddLabel(170, y, 2100, (((double)m_LokaiSkill.BaseFixedPoint) / 10).ToString());

                    if (CanLowerLokaiSkill(m_LokaiSkill, i, 1))
                    {
                        AddButton(220, y, 0x1519, 0x1519, 1000 + i, GumpButtonType.Reply, 0); // Decrease
                    }
                    if (CanRaiseLokaiSkill(m_LokaiSkill, i, 1))
                    {
                        AddButton(240, y, 0x151A, 0x151A, 2000 + i, GumpButtonType.Reply, 0); // Increase
                    }
                    if (CanLowerLokaiSkill(m_LokaiSkill, i, 5))
                    {
                        AddButton(200, y - 2, 2229, 2229, 3000 + i, GumpButtonType.Reply, 0); // Decrease by 5
                    }
                    if (CanRaiseLokaiSkill(m_LokaiSkill, i, 5))
                    {
                        AddButton(256, y - 2, 2229, 2229, 4000 + i, GumpButtonType.Reply, 0); // Increase by 5
                    }
                }
            }
        }
Exemple #13
0
 public LSA(LokaiSkills skills, Mobile from)
     : base()
 {
     m_Skills = skills;
     m_From   = from;
 }
Exemple #14
0
 public LSA(Mobile from)
 {
     m_From   = from;
     m_Skills = new LokaiSkills(m_From);
 }