示例#1
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (targeted is Item)
     {
         Item item = (Item)targeted;
         if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) || item is BaseArmor || item is BaseWeapon || item is IDyable || item is MonsterStatuette || item is EtherealMount || item is Spellbook || item is Runebook || item is RecallRune)
         {
             if (!item.IsChildOf(from.Backpack))
             {
                 from.SendMessage("The item must be in your pack.");
             }
             else
             {
                 item.Hue = theHue;
                 from.PlaySound(0x23F);
             }
         }
         else
         {
             from.SendMessage("That item cannot be dyed.");
         }
     }
     else
     {
         from.SendMessage("You cannot dye that.");
     }
 }
示例#2
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (targeted is NubiaSpecialHarvest && from is NubiaPlayer)
            {
                ((NubiaSpecialHarvest)targeted).BeginSpecialHarvest(from as NubiaPlayer, m_Tool);
                return;
            }


            if (m_System is Mining && targeted is StaticTarget)
            {
                int itemID = ((StaticTarget)targeted).ItemID;

                // grave
                if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8)
                {
                    PlayerMobile player = from as PlayerMobile;

                    if (player != null)
                    {
                        QuestSystem qs = player.Quest;

                        if (qs is WitchApprenticeQuest)
                        {
                            FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                            if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones)
                            {
                                player.SendLocalizedMessage(1055037);                                   // You finish your grim work, finding some of the specific bones listed in the Hag's recipe.
                                obj.Complete();

                                return;
                            }
                        }
                    }
                }
            }

            if (m_System is Lumberjacking && targeted is IChopable)
            {
                ((IChopable)targeted).OnChop(from);
            }
            else if (m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                DestroyFurniture(from, (Item)targeted);
            }
            else if (m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }
            else
            {
                m_System.StartHarvesting(from, m_Tool, targeted);
            }
        }
示例#3
0
 protected override void OnTarget(Mobile from, object o)
 {
     if (o is IChopable)
     {
         ((IChopable)o).OnChop(from);
     }
     else if (o is Item && FurnitureAttribute.Check((Item)o))
     {
         DismantleItem(from, (Item)o);
     }
 }
示例#4
0
		protected override void OnTarget( Mobile from, object targeted )
		{
			if ( m_System is Mining && targeted is StaticTarget )
			{
				int itemID = ((StaticTarget)targeted).ItemID;

				// grave
				if ( itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8 )
				{
					PlayerMobile player = from as PlayerMobile;

					if ( player != null )
					{
						QuestSystem qs = player.Quest;

						if ( qs is WitchApprenticeQuest )
						{
							FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;

							if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones )
							{
								player.SendLocalizedMessage( 1055037 ); // You finish your grim work, finding some of the specific bones listed in the Hag's recipe.
								obj.Complete();

								return;
							}
						}
					}
				}
			}

			if ( m_System is Lumberjacking && targeted is IChopable )
				((IChopable)targeted).OnChop( from );
			else if ( m_System is Lumberjacking && targeted is IAxe && m_Tool is BaseAxe )
			{
				IAxe obj = (IAxe)targeted;
				Item item = (Item)targeted;
					
				if ( !item.IsChildOf( from.Backpack ) )
					from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
				else if ( obj.Axe( from, (BaseAxe)m_Tool ) )
					from.PlaySound( 0x13E );
			}
			else if ( m_System is Lumberjacking && targeted is ICarvable )
				((ICarvable)targeted).Carve( from, (Item)m_Tool );
			else if ( m_System is Lumberjacking && FurnitureAttribute.Check( targeted as Item ) )
				DestroyFurniture( from, (Item)targeted );
			else if ( m_System is Mining && targeted is TreasureMap )
				((TreasureMap)targeted).OnBeginDig( from );
			else
				m_System.StartHarvesting( from, m_Tool, targeted );
		}
示例#5
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (m_System is Lumberjacking && targeted is IChopable)
     {
         ((IChopable)targeted).OnChop(from);
     }
     else if (m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
     {
         DestroyFurniture(from, (Item)targeted);
     }
     else
     {
         m_System.StartHarvesting(from, m_Tool, targeted);
     }
 }
示例#6
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_System is Lumberjacking && targeted is IChopable)
            {
                ((IChopable)targeted).OnChop(from);
            }

            else if (m_System is Lumberjacking && targeted is IAxe && m_Tool is BaseAxe)
            {
                IAxe obj  = (IAxe)targeted;
                Item item = (Item)targeted;

                if (!item.IsChildOf(from.Backpack) && !item.IsChildOf(from.BankBox))
                {
                    from.SendMessage("This item must be in your backpack or bankbox to be used.");
                }

                else if (obj.Axe(from, (BaseAxe)m_Tool))
                {
                    from.PlaySound(0x13E);
                }
            }

            else if (m_System is Lumberjacking && targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, (Item)m_Tool);
            }

            else if (m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                DestroyFurniture(from, (Item)targeted);
            }

            else if (m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }

            else if (targeted == from)
            {
                m_System.StartHarvesting(from, m_Tool, targeted, true);
            }

            else
            {
                m_System.StartHarvesting(from, m_Tool, targeted, false);
            }
        }
示例#7
0
        public override bool Dye(Mobile from, Item item)
        {
            bool okay        = (item.IsChildOf(from.Backpack));
            bool IsFurniture = FurnitureAttribute.Check(item);

            if (!okay)
            {
                if (item.RootParent == null)
                {
                    BaseHouse house = BaseHouse.FindHouseAt(item);

                    if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                    {
                        from.SendLocalizedMessage(501022);                           // Furniture must be locked down to paint it.
                    }
                    else if (!house.IsCoOwner(from))
                    {
                        from.SendLocalizedMessage(501023);                           // You must be the owner to use this item.
                    }
                    else
                    {
                        okay = true;
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1048135);                       // The furniture must be in your backpack to be painted.
                }
            }

            if (!IsFurniture && !(item is PotionKeg))
            {
                from.SendMessage("This is not a piece of furniture!");
                return(false);
            }

            if (okay && item.Dye(from, this))
            {
                from.PlaySound(0x23E);
                return(true);
            }
            return(false);
        }
示例#8
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (this.m_System is Lumberjacking && targeted is IChopable)
            {
                ((IChopable)targeted).OnChop(from);
            }
            else if (this.m_System is Lumberjacking && targeted is IAxe && this.m_Tool is BaseAxe)
            {
                IAxe obj  = (IAxe)targeted;
                Item item = (Item)targeted;

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
                }
                else if (obj.Axe(from, (BaseAxe)this.m_Tool))
                {
                    from.PlaySound(0x13E);
                }
            }
            else if (this.m_System is Lumberjacking && targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, (Item)this.m_Tool);
            }
            else if (this.m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                this.DestroyFurniture(from, (Item)targeted);
            }
            else if (this.m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }
            else
            {
                // If we got here and we're lumberjacking then we didn't target something that cna be done from the pack
                if (m_System is Lumberjacking && m_Tool.Parent != from)
                {
                    from.SendLocalizedMessage(500487);                     // The axe must be equipped for any serious wood chopping.
                    return;
                }
                this.m_System.StartHarvesting(from, this.m_Tool, targeted);
            }
        }
示例#9
0
		protected override void OnTarget( Mobile from, object targeted )
		{
			if ( m_System is Lumberjacking && targeted is IChopable )
				((IChopable)targeted).OnChop( from );
			else if ( m_System is Lumberjacking && targeted is IAxe && m_Tool is BaseAxe )
			{
				IAxe obj = (IAxe)targeted;
				Item item = (Item)targeted;
					
				if ( !item.IsChildOf( from.Backpack ) )
					from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
				else if ( obj.Axe( from, (BaseAxe)m_Tool ) )
					from.PlaySound( 0x13E );
			}
			else if ( m_System is Lumberjacking && targeted is ICarvable )
				((ICarvable)targeted).Carve( from, (Item)m_Tool );
			else if ( m_System is Lumberjacking && FurnitureAttribute.Check( targeted as Item ) )
				DestroyFurniture( from, (Item)targeted );
			else if ( m_System is Mining && targeted is TreasureMap )
				((TreasureMap)targeted).OnBeginDig( from );
			else
				m_System.StartHarvesting( from, m_Tool, targeted );
		}
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if ((FurnitureAttribute.Check(item)) && (from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), 100)))
                    {
                        if (!item.IsChildOf(from.Backpack))
                        {
                            from.SendMessage("The item must be in your pack.");
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;

                            if (m_Tub.Charged)
                            {
                                if (m_Tub.Charges <= 1)
                                {
                                    m_Tub.Delete();
                                }
                                m_Tub.Charges = m_Tub.Charges - 1;
                            }
                            from.PlaySound(0x23F);
                        }
                    }
                    else
                    {
                        from.SendMessage("That item cannot be dyed.");
                    }
                }
                else
                {
                    from.SendMessage("You cannot dye that.");
                }
            }
示例#11
0
文件: DyeTub.cs 项目: nogu3ira/xrunuo
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && !(item is CloakOfHumility) && !(item is SolleretsOfSacrifice) && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    var house = HousingHelper.FindHouseAt(item);

                                    if (house == null || !house.IsLockedDown(item))
                                    {
                                        from.SendLocalizedMessage(501022);                                           // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023);                                           // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135);                                       // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776);                               // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779);                               // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419);                               // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
示例#12
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_System is Mining && targeted is StaticTarget)
            {
                int itemID = ((StaticTarget)targeted).ItemID;

                // grave
                if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8)
                {
                    PlayerMobile player = from as PlayerMobile;

                    if (player != null)
                    {
                        QuestSystem qs = player.Quest;

                        if (qs is WitchApprenticeQuest)
                        {
                            FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                            if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones)
                            {
                                player.SendLocalizedMessage(1055037);                                   // You finish your grim work, finding some of the specific bones listed in the Hag's recipe.
                                obj.Complete();

                                return;
                            }
                        }
                    }
                }
            }

            if (m_System is Lumberjacking && targeted is IChopable)
            {
                ((IChopable)targeted).OnChop(from);
            }
            else if (m_System is Lumberjacking && targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, m_Tool);
            }
            else if (m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                DestroyFurniture(from, (Item)targeted);
            }
            else if (m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }
            else if (m_System is Lumberjacking && targeted is GuildContainer) //Taran: Turn guildcontainer into deed
            {
                Guild guild = from.Guild as Guild;
                if (guild != null && !guild.Disbanded)
                {
                    GuildContainer gc     = (GuildContainer)targeted;
                    Mobile         leader = guild.Leader;

                    if (from.Guild.Id == gc.GuildID && from == leader)
                    {
                        Container cont  = (Container)targeted;
                        Item[]    found = cont.FindItemsByType(typeof(Item), true);

                        if (found.Length > 0)
                        {
                            from.SendAsciiMessage("The container must be empty before you can re-deed it");
                        }
                        else
                        {
                            cont.Delete();
                            from.AddToBackpack(new GuildContainerDeed());
                            from.SendAsciiMessage("You put the guild container deed in your backpack");
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You must be the leader of the guild to do that");
                    }
                }
                else
                {
                    from.SendAsciiMessage("You can't use an axe on that.");
                }
            }

            #region Turn logs into boards
            else if (m_System is Lumberjacking && targeted is BaseLog) //Turn logs into boards
            {
                BaseLog log = (BaseLog)targeted;

                if (log.IsChildOf(from.Backpack))
                {
                    CraftResource cr     = log.Resource;
                    int           amount = log.Amount;

                    log.Delete();

                    switch (cr)
                    {
                    case CraftResource.RegularWood:
                    {
                        Board board = new Board(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.OakWood:
                    {
                        OakBoard board = new OakBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.AshWood:
                    {
                        AshBoard board = new AshBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.YewWood:
                    {
                        YewBoard board = new YewBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.Heartwood:
                    {
                        HeartwoodBoard board = new HeartwoodBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.Bloodwood:
                    {
                        BloodwoodBoard board = new BloodwoodBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.Frostwood:
                    {
                        FrostwoodBoard board = new FrostwoodBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.Mahoganywood:
                    {
                        MahoganyBoard board = new MahoganyBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.Cedarwood:
                    {
                        CedarBoard board = new CedarBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.Willowwood:
                    {
                        WillowBoard board = new WillowBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    case CraftResource.Mystwood:
                    {
                        MystWoodBoard board = new MystWoodBoard(amount);
                        from.AddToBackpack(board);
                        break;
                    }

                    default:
                    {
                        from.SendAsciiMessage("Error, no check for that log is made.");
                        break;
                    }
                    }
                    if (from.Mounted)
                    {
                        from.Animate(26, 5, 1, true, false, 0);
                    }
                    else
                    {
                        from.Animate(9, 5, 1, true, false, 0);
                    }

                    from.PlaySound(573);
                    from.SendAsciiMessage("You chop the logs and turn them into boards");
                }
                else
                {
                    from.SendAsciiMessage("That must be in your backpack before you can chop it");
                }
            }
            #endregion
            else
            {
                if (!CheckAllowed(from))
                {
                    return;
                }
                m_System.StartHarvesting(from, m_Tool, targeted);
            }
        }
示例#13
0
            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));
                }
            }
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_System is Mining && targeted is StaticTarget)
            {
                int itemID = ((StaticTarget)targeted).ItemID;

                // grave
                if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8)
                {
                    PlayerMobile player = from as PlayerMobile;

                    if (player != null)
                    {
                        QuestSystem qs = player.Quest;

                        if (qs is WitchApprenticeQuest)
                        {
                            FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                            if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones)
                            {
                                player.SendLocalizedMessage(1055037);                                   // You finish your grim work, finding some of the specific bones listed in the Hag's recipe.
                                obj.Complete();

                                return;
                            }
                        }
                    }
                }
            }

            if (m_System is Lumberjacking && targeted is IChopable)
            {
                ((IChopable)targeted).OnChop(from);
            }
            else if (m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                DestroyFurniture(from, (Item)targeted);
            }
            else if (m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }
            else if (m_System is Mining && targeted is DiggableRock)
            {
                if (m_Tool is IUsesRemaining)
                {
                    ((DiggableRock)targeted).DigIt(from);
                    if (m_Tool is IUsesRemaining)
                    {
                        IUsesRemaining toolWithUses = (IUsesRemaining)m_Tool;

                        toolWithUses.ShowUsesRemaining = true;

                        if (toolWithUses.UsesRemaining > 0)
                        {
                            --toolWithUses.UsesRemaining;
                        }

                        if (toolWithUses.UsesRemaining < 1)
                        {
                            m_Tool.Delete();
                            Mining.System.OreAndStone.SendMessageTo(from, Mining.System.OreAndStone.ToolBrokeMessage);
                        }
                    }
                }
            }
            else
            {
                m_System.StartHarvesting(from, m_Tool, targeted);
            }
        }
示例#15
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted is Item )
				{
					Item item = (Item)targeted;

					if ( item is IDyable && m_Tub.AllowDyables )
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						else if ( item.Parent is Mobile )
							from.SendLocalizedMessage( 500861 ); // Can't Dye clothing that is being worn.
						else if ( ((IDyable)item).Dye( from, m_Tub ) )
							from.PlaySound( 0x23E );
					}
					else if ( FurnitureAttribute.Check( item ) )
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else
						{
							bool okay = ( item.IsChildOf( from.Backpack ) );

							if ( !okay )
							{
								if ( item.Parent == null )
								{
									BaseHouse house = BaseHouse.FindHouseAt( item );

									if ( house == null || ( !house.IsLockedDown( item ) && !house.IsSecure( item ) ) )
										from.SendLocalizedMessage( 501022 ); // Furniture must be locked down to paint it.
									else if ( !house.IsCoOwner( from ) )
										from.SendLocalizedMessage( 501023 ); // You must be the owner to use this item.
									else
										okay = true;
								}
								else
								{
									from.SendLocalizedMessage( 1048135 ); // The furniture must be in your backpack to be painted.
								}
							}

							if ( okay )
							{
								item.Hue = m_Tub.DyedHue;
								from.PlaySound( 0x23E );
							}
						}
					}
					else if ( (item is Runebook || item is RecallRune ) && m_Tub.AllowRunebooks )
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1049776 ); // You cannot dye runes or runebooks that are locked down.
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							from.PlaySound( 0x23E );
						}
					}
					else if (	item is ILevelable || 
								item is IGiftable || 
								item is BaseBoatDeed || 
								item is HouseDeed || 
								item is HousePlacementTool || 
								item is BaseDockedBoat || 
								item is MagicCloak || 
								item is MagicHat || 
								item is Pillows || 
								item is ColoredWallTorch || 
								item is BaseQuiver || 
								item is MagicBelt || 
								item is MagicSash || 
								item is MagicBoots || 
								item is MagicRobe || 
								item is HairDyeBottle || 
								item is HairDyePotion || 
								item is ThrowingGloves || 
								item is LevelPugilistGloves || 
								item is LevelThrowingGloves || 
								item is GiftPugilistGloves || 
								item is GiftThrowingGloves || 
								item is PugilistGlove || 
								item is PugilistGloves ) // WIZARD ADDED FOR SPECIAL CLOTHES
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1042083 ); // You cannot dye that.
						}
						else if ( item.Parent is Mobile )
						{
							from.SendLocalizedMessage( 500861 ); // Can't Dye clothing that is being worn.
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							from.PlaySound( 0x23E );
						}

						if ( ( item is BaseBoatDeed || item is BaseDockedBoat ) && item.Hue < 1 ){ item.Hue = 0x5BE; }
					}
					else if ( item is DDRelicRugAddonDeed ) // WIZARD ADDED TO DYE RELIC RUGS
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1042083 ); // You cannot dye that.
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							DDRelicRugAddonDeed relic = (DDRelicRugAddonDeed)item;
							relic.RelicColor = m_Tub.DyedHue;
							from.PlaySound( 0x23E );
						}
					}
					else if ( item is HenchmanFamiliarItem || item is WaxPainting || item is WaxSculptors || item is WaxSculptorsD || item is WaxSculptorsE || item is ColorCandleShort || item is ColorCandleLong ) // WIZARD ADDED
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1042083 ); // You cannot dye that.
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							from.PlaySound( 0x23E );
						}
					}
					else if ( ( item is MyTentEastAddonDeed ) || ( item is MyTentSouthAddonDeed ) ) // WIZARD ADDED TO DYE TENTS
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1042083 ); // You cannot dye that.
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							if ( item is MyTentEastAddonDeed ) { MyTentEastAddonDeed tent = (MyTentEastAddonDeed)item; tent.TentColor = m_Tub.DyedHue; }
							else { MyTentSouthAddonDeed tent = (MyTentSouthAddonDeed)item; tent.TentColor = m_Tub.DyedHue; }
							from.PlaySound( 0x23E );
						}
					}
					else if ( item is MonsterStatuette && m_Tub.AllowStatuettes )
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1049779 ); // You cannot dye statuettes that are locked down.
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							from.PlaySound( 0x23E );
						}
					}
					else if ( item is BaseArmor && ( Server.Misc.MaterialInfo.IsAnyKindOfClothItem( item ) || item is ElvenBoots ) && m_Tub.AllowLeather )
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1042419 ); // You may not dye leather items which are locked down.
						}
						else if ( item.Parent is Mobile )
						{
							from.SendLocalizedMessage( 500861 ); // Can't Dye clothing that is being worn.
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							from.PlaySound( 0x23E );
						}
					}
					else if ( item is BaseArmor && ( Server.Misc.MaterialInfo.IsAnyKindOfMetalItem( item ) || Server.Misc.MaterialInfo.IsAnyKindOfWoodItem( item ) ) && m_Tub.AllowArmor )
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1042083 ); // You cannot dye that.
						}
						else if ( item.Parent is Mobile )
						{
							from.SendMessage( "Can't Dye armor that is equipped." );
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							from.PlaySound( 0x23E );
						}
					}
					else if ( item is BaseWeapon && m_Tub.AllowWeapons )
					{
						if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) )
						{
							from.SendLocalizedMessage( 500446 ); // That is too far away.
						}
						else if ( !item.Movable )
						{
							from.SendLocalizedMessage( 1042083 ); // You cannot dye that.
						}
						else if ( item.Parent is Mobile )
						{
							from.SendMessage( "Can't Dye weapons that are equipped." );
						}
						else
						{
							item.Hue = m_Tub.DyedHue;
							from.PlaySound( 0x23E );
						}
					}
					else
					{
						from.SendLocalizedMessage( m_Tub.FailMessage );
					}
				}
				else
				{
					from.SendLocalizedMessage( m_Tub.FailMessage );
				}
			}
示例#16
0
 public override bool IsDyable(Item item)
 {
     return(base.IsDyable(item) || FurnitureAttribute.Check(item));
 }
示例#17
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (/*item is CarpetColor || */ item is SpecialFishingNet)
                    {
                        from.SendMessage("That item cannot be dyed.");
                    }
                    else if (item is AddonComponent)
                    {
                        AddonComponent component = (AddonComponent)targeted;

                        if (component.Addon is DyeRack)
                        {
                            if (m_Tub.DyedHue < 1059)
                            {
                                from.SendMessage("This hue cannot be added to rack");
                            }
                            else
                            {
                                if (m_Tub.Charged)
                                {
                                    from.PlaySound(0x23F);
                                    from.FixedParticles(14120, 10, 15, 5011, m_Tub.DyedHue, 5, EffectLayer.Waist);

                                    ((DyeRack)component.Addon).AcquireDye(m_Tub.DyedHue, m_Tub.Charges);
                                    from.SendMessage("Hue has been added to rack with number {0}", m_Tub.DyedHue);

                                    m_Tub.Delete();
                                }
                            }
                        }
                        else
                        {
                            from.SendMessage("That item cannot be dyed.");
                        }
                    }
                    else if (FurnitureAttribute.Check(item) || item is BaseTalisman || item is BaseArmor || item is BaseWeapon || item is IDyable || item is MonsterStatuette || item is EtherealMount || item is Spellbook || item is Runebook || item is RecallRune)
                    {
                        if (!item.IsChildOf(from.Backpack))
                        {
                            from.SendMessage("The item must be in your pack.");
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;

                            if (m_Tub.Charged)
                            {
                                if (m_Tub.Charges <= 1)
                                {
                                    m_Tub.Delete();
                                }
                                m_Tub.Charges = m_Tub.Charges - 1;
                            }
                            from.PlaySound(0x23F);
                            from.FixedParticles(14120, 10, 15, 5011, item.Hue, 5, EffectLayer.Waist);
                        }
                    }
                    else
                    {
                        from.SendMessage("That item cannot be dyed.");
                    }
                }
                else
                {
                    from.SendMessage("You cannot dye that.");
                }
            }
示例#18
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_System is Mining && targeted is StaticTarget)
            {
                int itemID = ((StaticTarget)targeted).ItemID;

                // grave
                if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8)
                {
                    PlayerMobile player = from as PlayerMobile;

                    if (player != null)
                    {
                        QuestSystem qs = player.Quest;

                        if (qs is WitchApprenticeQuest)
                        {
                            FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                            if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones)
                            {
                                player.SendLocalizedMessage(1055037);                                   // You finish your grim work, finding some of the specific bones listed in the Hag's recipe.
                                obj.Complete();

                                return;
                            }
                        }
                    }
                }
            }

            if (m_System is Lumberjacking && targeted is IChopable)
            {
                if (m_Tool.Parent != from)
                {
                    from.SendAsciiMessage("The axe must be equipped for any serious wood chopping.");
                    //from.SendLocalizedMessage( 500487 ); // The axe must be equipped for any serious wood chopping.
                    return;
                }
                else
                {
                    ((IChopable)targeted).OnChop(from);
                }
            }
            else if (m_System is Lumberjacking && targeted is ICarvable)
            {
                from.Animate(32, 5, 1, true, false, 0);
                ((ICarvable)targeted).Carve(from, m_Tool);
            }
            else if (m_System is Lumberjacking && targeted is Log)
            {
                BaseTool tools = new FletcherTools();
                from.SendMenu(new BowFletchingMenu(from, BowFletchingMenu.Main(from), "Main", tools));
                if (tools != null)
                {
                    tools.Delete();
                }
            }
            else if (m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                DestroyFurniture(from, (Item)targeted);
            }
            else if (m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }
            else
            {
                m_System.StartHarvesting(from, m_Tool, targeted);
            }
        }
示例#19
0
文件: DyeTub.cs 项目: MythikGN/Mythik
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item    = (Item)targeted;
                    var  limited = m_Tub as LimitedUseDyeTub;
                    if (item is Hair && item.Parent == from && m_Tub.AllowDyables)
                    {
                        if (limited != null)
                        {
                            limited.Uses--;
                        }
                        (item as Hair).Hue = m_Tub.DyedHue;
                        from.PlaySound(0x23E);
                    }
                    else if (item is Beard && item.Parent == from && m_Tub.AllowDyables)
                    {
                        if (limited != null)
                        {
                            limited.Uses--;
                        }
                        (item as Beard).Hue = m_Tub.DyedHue;
                        from.PlaySound(0x23E);
                    }
                    else if (item is DyeDeed && item.Parent == from.Backpack)
                    {
                        if (limited != null)
                        {
                            limited.Uses--;
                        }
                        (item as DyeDeed).Hue = (item as DyeDeed).DyedHue = m_Tub.DyedHue;
                        from.PlaySound(0x23E);
                    }
                    else if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                            if (limited != null)
                            {
                                limited.Uses--;
                            }
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                                    {
                                        from.SendLocalizedMessage(501022);                                           // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023);                                           // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135);                                       // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                if (limited != null)
                                {
                                    limited.Uses--;
                                }
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776);                               // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            if (limited != null)
                            {
                                limited.Uses--;
                            }
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779);                               // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            if (limited != null)
                            {
                                limited.Uses--;
                            }
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots || item is WoodlandBelt) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419);                               // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            if (limited != null)
                            {
                                limited.Uses--;
                            }
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
示例#20
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                        }
                    }
                    //------------------------------------------------------------------------------------------------------------------------
                    else if ((item is BaseArmor || (item is BaseShield)) && m_Tub.AllowArmor)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);
                        }
                        else if (!item.Movable)
                        {
                            from.SendMessage("You cannot dye that which is locked down.");
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendMessage("You cannot be wearing items you wish to dye!");
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is BaseWeapon) && m_Tub.AllowWeapons)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);
                        }
                        else if (!item.Movable)
                        {
                            from.SendMessage("You cannot dye that which is locked down.");
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendMessage("You cannot be holding a weapon you wish to dye!");
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is RedBook || (item is BlueBook) || (item is TanBook) || (item is BrownBook)) && m_Tub.AllowBooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);
                        }
                        else if (!item.Movable)
                        {
                            from.SendMessage("You cannot dye that which is locked down.");
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    //-----------------------------------------------------------------------------------------------------------------------------
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || !house.IsLockedDown(item))
                                    {
                                        from.SendLocalizedMessage(501022);                                           // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023);                                           // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135);                                       // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776);                               // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779);                               // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is Server.Items.LeatherBelt || (item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419);                               // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
示例#21
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                    }
                                    else if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)) && (!(item is AddonComponent) || !house.Addons.ContainsKey(((AddonComponent)item).Addon)))
                                    {
                                        from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135); // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776); // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779); // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (m_Tub.AllowLeather)
                    {
                        if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) ||
                            (item is BaseClothing && (((BaseClothing)item).DefaultResource == CraftResource.RegularLeather) || item is WoodlandBelt || item is BarbedWhip ||
                             item is BladedWhip || item is SpikedWhip))
                        {
                            if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                            {
                                from.SendLocalizedMessage(500446); // That is too far away.
                            }
                            else if (!item.Movable)
                            {
                                from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                            }
                            else if (item.Parent is Mobile)
                            {
                                from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                            }
                            else
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(m_Tub.FailMessage);
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Chainmail || ((BaseArmor)item).MaterialType == ArmorMaterialType.Ringmail || ((BaseArmor)item).MaterialType == ArmorMaterialType.Plate)) && m_Tub.AllowMetal)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
示例#22
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (this.m_System is Mining && targeted is StaticTarget)
            {
                int itemID = ((StaticTarget)targeted).ItemID;

                // grave
                if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8)
                {
                    PlayerMobile player = from as PlayerMobile;

                    if (player != null)
                    {
                        QuestSystem qs = player.Quest;

                        if (qs is WitchApprenticeQuest)
                        {
                            FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                            if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones)
                            {
                                player.SendLocalizedMessage(1055037); // You finish your grim work, finding some of the specific bones listed in the Hag's recipe.
                                obj.Complete();

                                return;
                            }
                        }
                    }
                }
            }

            if (this.m_System is Lumberjacking && targeted is IChopable)
            {
                ((IChopable)targeted).OnChop(from);
            }
            else if (this.m_System is Lumberjacking && targeted is IAxe && this.m_Tool is BaseAxe)
            {
                IAxe obj  = (IAxe)targeted;
                Item item = (Item)targeted;

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
                }
                else if (obj.Axe(from, (BaseAxe)this.m_Tool))
                {
                    from.PlaySound(0x13E);
                }
            }
            else if (this.m_System is Lumberjacking && targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, (Item)this.m_Tool);
            }
            else if (this.m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                this.DestroyFurniture(from, (Item)targeted);
            }
            else if (this.m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }
            #region High Seas
            else if (m_System is Mining && targeted is NiterDeposit)
            {
                ((NiterDeposit)targeted).OnMine(from, m_Tool);
            }
            else if (m_System is Lumberjacking && targeted is CrackedLavaRockEast)
            {
                ((CrackedLavaRockEast)targeted).OnCrack(from);
            }
            else if (m_System is Lumberjacking && targeted is CrackedLavaRockSouth)
            {
                ((CrackedLavaRockSouth)targeted).OnCrack(from);
            }
            #endregion
            else
            {
                // If we got here and we're lumberjacking then we didn't target something that cna be done from the pack
                if (m_System is Lumberjacking && m_Tool.Parent != from)
                {
                    from.SendLocalizedMessage(500487);                     // The axe must be equipped for any serious wood chopping.
                    return;
                }
                this.m_System.StartHarvesting(from, this.m_Tool, targeted);
            }
        }
示例#23
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if ((m_Tub.DyedHue == 0x497 || m_Tub.DyedHue == 0x485) && (!(item is BaseClothing) /*|| item.LootType == LootType.Newbied*/))
                        {
                            from.SendAsciiMessage("This can only be used to dye regular clothes.");
                        }
                        else if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);

                            m_Tub.UsesRemaining--;
                            if (m_Tub.UsesRemaining <= 0)
                            {
                                from.SendAsciiMessage("The dye tub has run dry!");
                                m_Tub.Delete();
                            }
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || !house.IsLockedDown(item))
                                    {
                                        from.SendLocalizedMessage(501022);                                           // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023);                                           // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135);                                       // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                m_Tub.UsesRemaining--;
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);

                                if (m_Tub.UsesRemaining <= 0)
                                {
                                    from.SendAsciiMessage("The dye tub has run dry!");
                                    m_Tub.Delete();
                                }
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776);                               // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            m_Tub.UsesRemaining--;
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);

                            if (m_Tub.UsesRemaining <= 0)
                            {
                                from.SendAsciiMessage("The dye tub has run dry!");
                                m_Tub.Delete();
                            }
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779);                               // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            m_Tub.UsesRemaining--;
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);

                            if (m_Tub.UsesRemaining <= 0)
                            {
                                from.SendAsciiMessage("The dye tub has run dry!");
                                m_Tub.Delete();
                            }
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419);                               // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            m_Tub.UsesRemaining--;
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);

                            if (m_Tub.UsesRemaining <= 0)
                            {
                                from.SendAsciiMessage("The dye tub has run dry!");
                                m_Tub.Delete();
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
示例#24
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendAsciiMessage("That is too far away.");   // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendAsciiMessage("Can't Dye clothing that is being worn.");   // Can't Dye clothing that is being worn.
                        }
                        else if (!m_Tub.AllowBolts && (item is BoltOfCloth || item is Cloth || item is UncutCloth || item is BaseClothMaterial || item is Wool || item is Cotton || item is OilCloth))
                        {
                            from.SendAsciiMessage("You can't dye this with a charged dye tub.");
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                            m_Tub.AfterDye(from);
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendAsciiMessage("That is too far away."); // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || !house.IsLockedDown(item))
                                    {
                                        from.SendLocalizedMessage("Furniture must be locked down to paint it.");   // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage("You must be the owner to use this item.");   // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage("The furniture must be in your backpack to be painted.");   // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                                m_Tub.AfterDye(from);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendAsciiMessage("That is too far away.");                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage("You cannot dye runes or runebooks that are locked down.");   // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.AfterDye(from);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage("That is too far away.");                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage("You cannot dye statuettes that are locked down.");   // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.AfterDye(from);
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage("That is too far away.");                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage("You may not dye leather items which are locked down.");   // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage("Can't Dye clothing that is being worn.");                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.AfterDye(from);
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You can not dye that.");
                    }
                }
                else
                {
                    from.SendAsciiMessage("You can not dye that.");
                }
            }
示例#25
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item item)
                {
                    if (item is IDyable dyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else if (dyable.Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || item is PotionKeg) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else
                        {
                            bool okay = item.IsChildOf(@from.Backpack);

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || !house.IsLockedDown(item) && !house.IsSecure(item))
                                    {
                                        from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(
                                        1048135); // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(
                                1049776); // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is BaseArmor armor &&
                             (armor.MaterialType == ArmorMaterialType.Leather ||
                              armor.MaterialType == ArmorMaterialType.Studded) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(armor.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!armor.Movable)
                        {
                            from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                        }
                        else if (armor.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            armor.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
示例#26
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 3) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                        }
                        //else if ( item.Parent is Mobile )
                        //	from.SendLocalizedMessage( 500861 ); // Can't Dye clothing that is being worn.
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || !house.IsLockedDown(item))
                                    {
                                        from.SendLocalizedMessage(501022);                                           // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023);                                           // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135);                                       // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 3) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776);                               // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779);                               // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots || item is WoodlandBelt) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 3) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419);                               // You may not dye leather items which are locked down.
                        }

                        /*else if ( item.Parent is Mobile )
                         *      from.SendLocalizedMessage( 500861 ); // Can't Dye clothing that is being worn.*/
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else if (from == targeted)
                {
                    from.HairHue = from.FacialHairHue = m_Tub.DyedHue;
                    from.PlaySound(0x23E);
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
示例#27
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Item.Deleted)
                {
                    return;
                }

                Item item = targeted as Item;

                if (null != item)
                {
                    bool valid = (item is IDyable ||
                                  item is BaseBook || item is BaseClothing ||
                                  item is BaseJewel || item is BaseStatuette ||
                                  item is BaseWeapon || item is Runebook ||
                                  item is Spellbook || item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item));

                    if (!valid && item is BaseArmor)
                    {
                        CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource);
                        if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) &&
                            ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType)
                        {
                            valid = true;
                        }
                    }

                    if (!valid && FurnitureAttribute.Check(item))
                    {
                        if (!from.InRange(this.m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                            return;
                        }
                        else
                        {
                            BaseHouse house = BaseHouse.FindHouseAt(item);

                            if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                            {
                                from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                return;
                            }
                            else if (!house.IsCoOwner(from))
                            {
                                from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                return;
                            }
                            else
                            {
                                valid = true;
                            }
                        }
                    }

                    // need to add any bags, chests, boxes, crates not IDyable but dyable by natural dyes

                    if (valid)
                    {
                        item.Hue = PlantPigmentHueInfo.GetInfo(this.m_Item.PigmentHue).Hue;
                        from.PlaySound(0x23E);

                        if (--this.m_Item.UsesRemaining > 0)
                        {
                            this.m_Item.InvalidateProperties();
                        }
                        else
                        {
                            this.m_Item.Delete();
                        }

                        return;
                    }
                }

                from.SendLocalizedMessage(1042083); // You cannot dye that.
            }
示例#28
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            // true if return override encountered in script
            IEntity targetedEntity = targeted as IEntity;

            if (XmlScript.HasTrigger(targetedEntity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(targetedEntity, from, TriggerName.onTargeted, m_Tool))
            {
                return;
            }

            CustomRegion customRegion = from.Region as CustomRegion;

            if (customRegion != null && customRegion.Controller != null)
            {
                SkillName skill = SkillName.Spellweaving; // placeholder
                if (m_System is Mining)
                {
                    skill = SkillName.Mining;
                }
                else if (m_System is Fishing)
                {
                    skill = SkillName.Fishing;
                }
                else if (m_System is Lumberjacking)
                {
                    skill = SkillName.Lumberjacking;
                }

                if (customRegion.Controller.IsRestrictedSkill((int)skill))
                {
                    from.SendMessage("You cannot use that skill here.");
                    return;
                }
            }

            //conquest skill check
            Skill tskill = null;

            if (m_System is Mining)
            {
                tskill = from.Skills[SkillName.Mining];
            }
            else if (m_System is Lumberjacking)
            {
                tskill = from.Skills[SkillName.Lumberjacking];
            }
            else if (m_System is Fishing)
            {
                tskill = from.Skills[SkillName.Fishing];
            }

            if (tskill != null)
            {
                Conquests.Conquests.CheckProgress <SkillConquest>(from as PlayerMobile, tskill);
            }

            if (m_System is Mining && targeted is StaticTarget)
            {
                int itemID = ((StaticTarget)targeted).ItemID;

                // grave
                if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8)
                {
                    PlayerMobile player = from as PlayerMobile;

                    if (player != null)
                    {
                        QuestSystem qs = player.Quest;

                        if (qs is WitchApprenticeQuest)
                        {
                            FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                            if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones)
                            {
                                player.SendLocalizedMessage(1055037);                                   // You finish your grim work, finding some of the specific bones listed in the Hag's recipe.
                                obj.Complete();

                                return;
                            }
                        }
                    }
                }
            }

            if (m_System is Lumberjacking && targeted is IChopable)
            {
                if (targeted is Item)
                {
                    if (((Item)targeted).Breakable)
                    {
                        ((IChopable)targeted).OnChop(from);
                    }
                    else
                    {
                        from.SendMessage("That is unbreakable!");
                    }
                }
                else
                {
                    ((IChopable)targeted).OnChop(from);
                }
            }
            else if (m_System is Lumberjacking && targeted is IAxe && m_Tool is BaseAxe)
            {
                IAxe obj  = (IAxe)targeted;
                Item item = (Item)targeted;

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
                }
                else if (obj.Axe(from, (BaseAxe)m_Tool))
                {
                    from.PlaySound(0x13E);
                }
            }
            else if (m_System is Lumberjacking && targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, (Item)m_Tool);
            }
            else if (m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                if (((Item)targeted).Breakable)
                {
                    DestroyFurniture(from, (Item)targeted);
                }
                else
                {
                    from.SendMessage("That is unbreakable!");
                }
            }
            else if (m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }
            else
            {
                m_System.StartHarvesting(from, m_Tool, targeted);
            }
        }