Exemple #1
0
        public static void BeginTarget(Mobile from, CraftSystem craftSystem, BaseTool tool)
        {
            if (tool is RuneChisel)
            {
                Runescribing.Enhance(from, tool);
                return;
            }

            CraftContext context = craftSystem.GetContext(from);

            if (context == null)
            {
                return;
            }

            int            lastRes = context.LastResourceIndex;
            CraftSubResCol subRes  = craftSystem.CraftSubRes;

            if (lastRes >= 0 && lastRes < subRes.Count)
            {
                CraftSubRes res = subRes.GetAt(lastRes);

                if (from.Skills[craftSystem.MainSkill].Value < res.RequiredSkill)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, res.Message));
                }
                else
                {
                    CraftResource resource = CraftResources.GetFromType(res.ItemType);

                    if (resource != CraftResource.None)
                    {
                        from.Target = new InternalTarget(craftSystem, tool, res.ItemType, resource);
                        from.SendLocalizedMessage(1061004);                           // Target an item to enhance with the properties of your selected material.
                    }
                    else
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, 1061010));                             // You must select a special material in order to enhance an item with its properties.
                    }
                }
            }
            else
            {
                from.SendGump(new CraftGump(from, craftSystem, tool, 1061010));                     // You must select a special material in order to enhance an item with its properties.
            }
        }
        public static void EndDig(Mobile from, Item tool)
        {
            Timer it = (Timer)m_IsDigging[from];

            if (it != null)
            {
                it.Stop();
            }

            m_IsDigging.Remove(from);


            BaseHarvestTool t = (BaseHarvestTool)tool;

            t.UsesRemaining -= 1;

            if (t.UsesRemaining == 0)
            {
                tool.Delete();
                from.SendMessage("You have worn out your tool!");
            }

            if (from.CheckSkill(SkillName.Forensics, 0, 100))
            {
                int bonus = 1;

                if (tool is SturdyShovel)
                {
                    bonus = 2;
                }

                if (tool is GraveDiggersShovel)
                {
                    bonus = 4;
                }

                if (tool is GoldenShovel)
                {
                    bonus = 6;
                }

                if (tool is DiamondShovel)
                {
                    bonus = 8;
                }

                if (tool is SummonShovel)
                {
                    bonus = 10;
                }

                Double chance = from.Skills[SkillName.Forensics].Value / 10 * bonus;

                if (tool is SummonShovel && Utility.Random(1000) < chance)
                {
                    int    roll = Utility.Random(100);
                    Mobile spawn;

                    if (roll < 50)
                    {
                        spawn = new FailSafe();
                        spawn.MoveToWorld(from.Location, from.Map);

                        spawn.Combatant = from;
                        spawn.Z++;

                        World.Broadcast(0x35, true, "{0} has summoned Fail Safe!", from.Name);
                    }
                    else
                    {
                        spawn = new Grobbubatus();
                        spawn.MoveToWorld(from.Location, from.Map);

                        spawn.Combatant = from;
                        spawn.Z++;

                        World.Broadcast(0x35, true, "{0} has summoned Grobbubatus!", from.Name);
                    }
                }
                else if (Utility.Random(100) < chance)
                {
                    int roll = Utility.Random(2);

                    switch (roll)
                    {
                    case 0: from.AddToBackpack(GiveReward(from, tool)); break;

                    case 1: from.AddToBackpack(Runescribing.GetResoureDrop(false, true)); break;
                    }
                }
                else
                {
                    if (Utility.Random(100) < 25 - bonus)
                    {
                        from.SendMessage("You have disturbed the dead!");

                        BaseCreature m = null;

                        try
                        {
                            m = Activator.CreateInstance(m_Dead[Utility.Random(m_Dead.Length)]) as BaseCreature;
                        }
                        catch
                        {
                        }

                        m.Location = from.Location;
                        m.Map      = from.Map;

                        if (m.IsParagon)
                        {
                            m.IsParagon = false;
                        }

                        World.AddMobile(m);

                        m.Combatant = from;
                        m.Z++;
                    }
                    else
                    {
                        from.SendMessage("You skillfully dig the area but do not find anything.");
                    }
                }
            }
            else
            {
                if (Utility.Random(100) < 50)
                {
                    from.SendMessage("You have disturbed the dead!");

                    BaseCreature m = null;

                    try
                    {
                        m = Activator.CreateInstance(m_Dead[Utility.Random(m_Dead.Length)]) as BaseCreature;
                    }
                    catch
                    {
                    }

                    m.Location = from.Location;
                    m.Map      = from.Map;

                    if (m.IsParagon)
                    {
                        m.IsParagon = false;
                    }

                    World.AddMobile(m);

                    m.Combatant = from;
                    m.Z++;
                }
                else
                {
                    from.SendMessage("You fail to discover anything of interest.");
                }
            }
        }