コード例 #1
0
ファイル: DyeRack.cs プロジェクト: Scrubtasticx/Ruo-Live
            protected override void OnTarget(Mobile from, object target)
            {
                if (from == null || m_Box == null || m_Box.Deleted)
                {
                    return;
                }

                if (!m_Box.HasDye(m_Hue)) //Sanity
                {
                    from.SendMessage("That hue is not in rack");
                    return;
                }

                if (target is DyeTester)
                {
                    DyeTester.TestHue(from, m_Hue);
                    return;
                }

                Item item;

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

                    if (!from.InRange(m_Box.GetWorldLocation(), 5) || !item.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("You must stay close to rack and have item in your backpack");
                        return;
                    }
                }
                else
                {
                    from.SendMessage("That is not item");
                    return;
                }

                if (/*item is CarpetColor || */ item is SpecialFishingNet)
                {
                    from.SendMessage("That item cannot be hued");
                    return;
                }

                if (FurnitureAttribute.Check(item) || item is BaseTalisman || item is BaseArmor || item is BaseWeapon || item is IDyable || item is MonsterStatuette || item is Server.Mobiles.EtherealMount || item is Spellbook || item is Runebook || item is RecallRune)
                {
                    if (m_Box.AcquiredDyes[m_Hue] < 1)
                    {
                        from.SendMessage("That hue is dryed. You can only test it on mirror or thin it.");
                        return;
                    }

                    item.Hue = m_Hue;
                    m_Box.AcquiredDyes[m_Hue]--;
                    from.FixedParticles(14120, 1, 10, 0x1F78, m_Hue, 5, EffectLayer.Waist);
                    from.PlaySound(0x23F);
                    from.SendMessage("Hue number {0} Has been used. {1} charges left.", m_Hue, m_Box.AcquiredDyes[m_Hue]);
                }
                else if (item is DyeThinner)
                {
                    item.Consume();
                    m_Box.AcquiredDyes[m_Hue]++;
                    from.FixedParticles(14120, 1, 10, 0x1F78, m_Hue, 5, EffectLayer.Waist);
                    from.PlaySound(32);
                    from.PlaySound(574);
                    from.SendMessage("Hue number {0} has been thinned for {1} charges", m_Hue, m_Box.AcquiredDyes[m_Hue]);
                }
                else
                {
                    from.SendMessage("That item cannot be hued");
                }

                if (m_Box.KnownDyes > 0)
                {
                    if (from.HasGump(typeof(DyeRackGump)))
                    {
                        from.CloseGump(typeof(DyeRackGump));
                    }

                    from.SendGump(new DyeRackGump(m_Box));
                }
            }