コード例 #1
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.
            }
        }