Exemplo n.º 1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack) || Parent == from)
            {
                Item i = from.FindItemOnLayer(Layer.OneHanded);

                if (i != null && i != this)
                {
                    if (i is AncientSmithyHammer || i is BaseRunicTool)
                    {
                        from.SendMessage("You cannot use this in conjunction with another tool.");
                        return;
                    }
                }

                CraftSystem system = this.CraftSystem;

                int num = system.CanCraft(from, this, null);

                if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    CraftContext context = system.GetContext(from);

                    from.SendGump(new CraftGump(from, system, this, null));
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 2
0
        public static void OnDoubleClickRedirected(Mobile from, object o)
        {
            if (o == null || (!(o is BaseTool)))
            {
                return;
            }

            BaseTool tool = (BaseTool)o;

            if (tool.IsChildOf(from.Backpack) || tool.Parent == from)
            {
                CraftSystem system = tool.CraftSystem;

                int num = system.CanCraft(from, tool, null);

                if (num > 0 && (num != 1044267 || !Core.SE)) // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    CraftContext context = system.GetContext(from);

                    from.SendGump(new CraftGump(from, system, tool, null));
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack) || Parent == from)
            {
                CraftSystem system = CraftSystem;

                if (Core.TOL && m_RepairMode)
                {
                    Repair.Do(from, system, this);
                }
                else
                {
                    int num = system.CanCraft(from, this, null);

                    if (num > 0 && (num != 1044267 || !Core.SE)) // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
                    {
                        from.SendLocalizedMessage(num);
                    }
                    else
                    {
                        from.SendGump(new CraftGump(from, system, this, null));
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 4
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack) || Parent == from)
            {
                CraftSystem system = this.CraftSystem;

                int num = system.CanCraft(from, this, null);

                if (num > 0 && (num != 1044267 || !Core.SE))                     // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    CraftContext context = system.GetContext(from);

                    Gump cgump = new CraftGump(from, system, this, null);
                    CaptchaGump.sendCaptcha(from, CaptchaGump.SendGumpAfterCaptcha, cgump);
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 5
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack) || Parent == from)
            {
                if (UsesRemaining > 0)
                {
                    CraftSystem system = this.CraftSystem;

                    int num = system.CanCraft(from, this, null);

                    if (num > 0)
                    {
                        from.SendLocalizedMessage(num);
                    }
                    else
                    {
                        CraftContext context = system.GetContext(from);

                        from.SendGump(new CraftGump(from, system, this, null));
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1072306);                       // You must wait a moment for it to recharge.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 6
0
        public override void OnDoubleClick(Mobile m)
        {
            if (!this.CheckDoubleClick(m, true, false, 2, true))
            {
                return;
            }

            CraftSystem system = CraftSystem;

            if (system == null)
            {
                return;
            }

            int num = system.CanCraft(m, this, null);

            // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
            if (num <= 0 || (num == 1044267 && m.EraSE))
            {
                m.SendGump(new CraftGump(m, system, this, null));
                return;
            }

            m.SendLocalizedMessage(num);
        }
Exemplo n.º 7
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack) && !(Parent == from) && from.InLOS(this) && from.InRange(Location, 3))
            {
                from.AddToBackpack(this);
            }

            if (IsChildOf(from.Backpack) || Parent == from)
            {
                CraftSystem system = CraftSystem;

                int num = system.CanCraft(from, this, null);

                if (num > 0 && (num != 1044267 || !Core.SE)) // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    from.SendGump(new CraftGump(from, system, this, null));
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 8
0
        private void DoSmelt(object targeted)
        {
            Mobile      from        = Craft.From;
            BaseTool    tool        = Craft.Tool;
            CraftSystem craftSystem = Craft.CraftSystem;

            int num = craftSystem.CanCraft(from, tool, null);

            if (num > 0)
            {
                from.SendLocalizedMessage(num);
                return;
            }
            else
            {
                SmeltResult result        = SmeltResult.Invalid;
                bool        isStoreBought = false;
                int         message;

                if (targeted is BaseArmor)
                {
                    result        = Resmelt(from, (BaseArmor)targeted, ((BaseArmor)targeted).Resource);
                    isStoreBought = !((Item)targeted).PlayerCrafted;
                }
                else if (targeted is BaseWeapon)
                {
                    result        = Resmelt(from, (BaseWeapon)targeted, ((BaseWeapon)targeted).Resource);
                    isStoreBought = !((Item)targeted).PlayerCrafted;
                }
                else if (targeted is DragonBardingDeed)
                {
                    result        = Resmelt(from, (DragonBardingDeed)targeted, ((DragonBardingDeed)targeted).Resource);
                    isStoreBought = false;
                }

                switch (result)
                {
                default:
                case SmeltResult.Invalid: message = 1044272; break;                          // You can't melt that down into ingots.

                case SmeltResult.NoSkill: message = 1044269; break;                          // You have no idea how to work this metal.

                case SmeltResult.Success: message = isStoreBought ? 500418 : 1044270; break; // You melt the item down into ingots.
                }

                from.SendLocalizedMessage(message);
            }
        }
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this, 4))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045);                 // I can't reach that.
                return;
            }

            if (CheckAccessible(from, this))
            {
                CraftSystem  system  = this.CraftSystem;
                int          num     = system.CanCraft(from, this, null);
                CraftContext context = system.GetContext(from);
                from.SendGump(new CraftGump(from, system, this, null));
            }
        }
Exemplo n.º 10
0
        public static void OnDoubleClickRedirected(Mobile from, object o)
        {
            if (!(o is object[]))
            {
                return;
            }
            object[] arglist = (object[])o;

            if (arglist.Length != 1)
            {
                return;
            }

            if (!(arglist[0] is BaseTool))
            {
                return;
            }

            BaseTool tool = (BaseTool)arglist[0];

            if (tool.IsChildOf(from.Backpack) || tool.Parent == from)
            {
                CraftSystem system = tool.CraftSystem;

                int num = system.CanCraft(from, tool, null);

                if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    CraftContext context = system.GetContext(from);

                    from.SendGump(new CraftGump(from, system, tool, null));
                }
            }
            else
            {
                from.SendAsciiMessage("That must be in your pack for you to use it.");                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 11
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!Server.Misc.DifficultyLevel.AllowMacroResources())
            {
                CaptchaGump.sendCaptcha(from, BaseTool.OnDoubleClickRedirected, this);
            }
            else if (IsChildOf(from.Backpack) || Parent == from)
            {
                CraftSystem system = this.CraftSystem;

                object num = system.CanCraft(from, this, null);

                // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
                if ((num is int && (int)num > 0 && ((int)num != 1044267 || !Core.SE)) || (num is string && !string.IsNullOrWhiteSpace((string)num)))
                {
                    if (num is int)
                    {
                        from.SendLocalizedMessage((int)num);
                    }
                    else
                    {
                        from.SendMessage((string)num);
                    }
                }
                else
                {
                    CraftContext context = system.GetContext(from);

                    from.SendGump(new CraftGump(from, system, this, null));

                    if (this is TomeOfWands)
                    {
                        from.PlaySound(0x55);
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 12
0
        public override void OnDoubleClick(Mobile from)
        {
            if (CraftSystem != null && (IsChildOf(from.Backpack) || Parent == from))
            {
                int num = CraftSystem.CanCraft(from, this, null);

                if (num > 0 && num != 1044267) // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    CraftContext context = CraftSystem.GetContext(from);

                    from.SendGump(new CraftGump(from, CraftSystem, this, null));
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 13
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack) || Parent == from)
            {
                CraftSystem system = this.CraftSystem;

                int num = system.CanCraft(from, this, null);

                if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    from.SendGump(new CraftGump(from, system, this, null));
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 14
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack) || Parent == from)
            {
                CraftSystem system = this.CraftSystem;

                int num = system.CanCraft(from, this, null);

                if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    // What good is this? Just to ensure creation?
                    CraftContext context = system.GetContext(from);

                    // add UOSP old school craft system hook here
                    if (Core.UOSP)
                    {
                        if (new OldSchoolCraft(from, system, this, null).DoOldSchoolCraft() == false)
                        {
                            from.SendGump(new CraftGump(from, system, this, null));                             // call the old system as the old-school system is not impl
                        }
                    }
                    else
                    {
                        from.SendGump(new CraftGump(from, system, this, null));
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                 // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 15
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack) || Parent == from)
            {
                CraftSystem system = this.CraftSystem;

                string num = system.CanCraft(from, this, null);

                if (num != "")
                {
                    from.SendAsciiMessage(num);
                }
                else
                {
                    CraftContext context = system.GetContext(from);

                    from.SendGump(new CraftGump(from, system, this, null));
                }
            }
            else
            {
                from.SendAsciiMessage("That must be in your pack for you to use it.");
            }
        }
Exemplo n.º 16
0
        public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes,
                                  BaseTool tool, CustomCraft customCraft)
        {
            int badCraft = craftSystem.CanCraft(from, tool, m_Type);

            if (badCraft > 0)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                }
                else
                {
                    from.SendLocalizedMessage(badCraft);
                }

                return;
            }

            int    checkResHue = 0, checkMaxAmount = 0;
            object checkMessage = null;

            // Not enough resource to craft it
            if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None,
                            ref checkMessage))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                }
                else if (checkMessage is int && (int)checkMessage > 0)
                {
                    from.SendLocalizedMessage((int)checkMessage);
                }
                else if (checkMessage is string)
                {
                    from.SendMessage((string)checkMessage);
                }

                return;
            }
            else if (!ConsumeAttributes(from, ref checkMessage, false))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                }
                else if (checkMessage is int && (int)checkMessage > 0)
                {
                    from.SendLocalizedMessage((int)checkMessage);
                }
                else if (checkMessage is string)
                {
                    from.SendMessage((string)checkMessage);
                }

                return;
            }

            bool toolBroken = false;

            int ignored    = 1;
            int endquality = 1;

            bool allRequiredSkills = true;

            if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
            {
                // Resource
                int resHue    = 0;
                int maxAmount = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }
                    else if (message is int i && i > 0)
                    {
                        from.SendLocalizedMessage(i);
                    }
                    else if (message is string s)
                    {
                        from.SendMessage(s);
                    }

                    return;
                }
                else if (!ConsumeAttributes(from, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }
                    else if (message is int i && i > 0)
                    {
                        from.SendLocalizedMessage(i);
                    }
                    else if (message is string s)
                    {
                        from.SendMessage(s);
                    }

                    return;
                }
Exemplo n.º 17
0
        public void Craft(Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool)
        {
            if (from.BeginAction(typeof(CraftSystem)))
            {
                if (RequiredExpansion == Expansion.None || @from.NetState != null)
                {
                    bool   allRequiredSkills = true;
                    double chance            = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);

                    if (allRequiredSkills && chance >= 0.0)
                    {
                        int badCraft = craftSystem.CanCraft(from, tool, m_Type);

                        if (badCraft <= 0)
                        {
                            int    resHue    = 0;
                            int    maxAmount = 0;
                            object message   = null;

                            if (ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None,
                                           ref message))
                            {
                                message = null;

                                if (ConsumeAttributes(from, ref message, false))
                                {
                                    CraftContext context = craftSystem.GetContext(from);

                                    if (context != null)
                                    {
                                        context.OnMade(this);
                                    }

                                    int iMin    = craftSystem.MinCraftEffect;
                                    int iMax    = craftSystem.MaxCraftEffect - iMin + 1;
                                    int iRandom = Utility.Random(iMax);
                                    iRandom += iMin + 1;
                                    new InternalTimer(from, craftSystem, this, typeRes, tool, iRandom).Start();
                                }
                                else
                                {
                                    from.EndAction(typeof(CraftSystem));
                                    from.SendGump(new CraftGump(from, craftSystem, tool, message));
                                }
                            }
                            else
                            {
                                from.EndAction(typeof(CraftSystem));
                                from.SendGump(new CraftGump(from, craftSystem, tool, message));
                            }
                        }
                        else
                        {
                            from.EndAction(typeof(CraftSystem));
                            from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                        }
                    }
                    else
                    {
                        from.EndAction(typeof(CraftSystem));
                        from.SendGump(new CraftGump(from, craftSystem, tool,
                                                    1044153)); // You don't have the required skills to attempt this item.
                    }
                }
                else
                {
                    from.EndAction(typeof(CraftSystem));
                    from.SendGump(new CraftGump(from, craftSystem, tool,
                                                RequiredExpansionMessage(
                                                    RequiredExpansion))); //The {0} expansion is required to attempt this item.
                }
            }
            else
            {
                from.SendLocalizedMessage(500119); // You must wait to perform another action
            }
        }
Exemplo n.º 18
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack) || Parent == from)
            {
                TeiravonMobile m_Player = (TeiravonMobile)from;

                CraftSystem system = this.CraftSystem;

                if (!m_Player.IsTinker())
                {
                    if (system == DefAlchemy.CraftSystem || system == DefGlassblowing.CraftSystem)
                    {
                        if (!m_Player.IsAlchemist() && !m_Player.HasFeat(TeiravonMobile.Feats.AlchemyScience) && !m_Player.HasFeat(TeiravonMobile.Feats.ExoticPoisons))
                        {
                            m_Player.SendMessage("You don't have the skills to use this.");
                            return;
                        }

                        if (!m_Player.HasFeat(TeiravonMobile.Feats.ExoticPoisons))
                        {
                            if (m_Player.Backpack.FindItemByType(typeof(AlchemyTome)) == null)
                            {
                                m_Player.SendMessage("Where's your Alchemy Tome?");
                                return;
                            }
                        }
                    }
                    else if (system == DefBlacksmithy.CraftSystem)
                    {
                        if (!m_Player.IsBlacksmith() && !m_Player.IsTinker() && !m_Player.IsMerchant())
                        {
                            m_Player.SendMessage("You don't have the skills to use this.");
                            return;
                        }
                    }
                    else if (system == DefBowFletching.CraftSystem)
                    {
                        if (!m_Player.IsWoodworker() && !m_Player.IsRanger() && !m_Player.IsArcher() && !m_Player.IsMageSlayer() && !m_Player.IsMerchant() && !m_Player.IsStrider())
                        {
                            m_Player.SendMessage("You don't have the skills to use this.");
                            return;
                        }
                    }
                    else if (system == DefCarpentry.CraftSystem)
                    {
                        if (!m_Player.IsWoodworker() && !m_Player.IsMerchant())
                        {
                            m_Player.SendMessage("You don't have the skills to use this.");
                            return;
                        }
                    }
                    else if (system == DefInscription.CraftSystem)
                    {
                        if (!m_Player.HasFeat(TeiravonMobile.Feats.Inscription) && !m_Player.IsAlchemist() && !m_Player.IsMerchant())
                        {
                            m_Player.SendMessage("You're not sure how to do this.");
                            return;
                        }
                    }
                    else if (system == DefTailoring.CraftSystem)
                    {
                        if (!m_Player.IsTailor() && !m_Player.IsMerchant())
                        {
                            m_Player.SendMessage("You don't have the skills to use this.");
                            return;
                        }
                    }
                }

                int num = system.CanCraft(from, this, null);

                if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
                else
                {
                    CraftContext context = system.GetContext(from);

                    from.SendGump(new CraftGump(from, system, this, null));
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 19
0
            protected override void OnTick()
            {
                m_iCount++;

                m_From.DisruptiveAction();

                if (m_iCount < m_iCountMax)
                {
                    m_CraftSystem.PlayCraftEffect(m_From);
                }
                else
                {
                    m_From.EndAction <CraftSystem>();

                    var badCraft = m_CraftSystem.CanCraft(m_From, m_Tool, m_CraftItem.ItemType);

                    if (badCraft > 0)
                    {
                        if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0)
                        {
                            m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft));
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(badCraft);
                        }

                        return;
                    }

                    var quality = 1;

                    m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, out _, false);

                    var context = m_CraftSystem.GetContext(m_From);

                    if (context == null)
                    {
                        return;
                    }

                    if (typeof(CustomCraft).IsAssignableFrom(m_CraftItem.ItemType))
                    {
                        try
                        {
                            m_CraftItem.ItemType.CreateInstance <CustomCraft>(
                                m_From,
                                m_CraftItem,
                                m_CraftSystem,
                                m_TypeRes,
                                m_Tool,
                                quality
                                )?.EndCraftAction();
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }

                        return;
                    }

                    var makersMark = false;

                    if (quality == 2 && m_From.Skills[m_CraftSystem.MainSkill].Base >= 100.0)
                    {
                        makersMark = m_CraftItem.IsMarkable(m_CraftItem.ItemType);
                    }

                    if (makersMark && context.MarkOption == CraftMarkOption.PromptForMark)
                    {
                        m_From.SendGump(
                            new QueryMakersMarkGump(
                                quality,
                                m_From,
                                m_CraftItem,
                                m_CraftSystem,
                                m_TypeRes,
                                m_Tool
                                )
                            );
                    }
                    else
                    {
                        if (context.MarkOption == CraftMarkOption.DoNotMark)
                        {
                            makersMark = false;
                        }

                        m_CraftItem.CompleteCraft(quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
                    }
                }
            }