Beispiel #1
0
 //get a new instance of an object (we just bought it)
 public object GetObject()
 {
     BoltOfCloth bc = new BoltOfCloth();
     bc.Hue = m_Hue;
     bc.ItemID = m_ItemID;
     return bc;
 }
Beispiel #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Material.Deleted)
                {
                    return;
                }

                ILoom loom = targeted as ILoom;

                if (loom == null && targeted is AddonComponent)
                {
                    loom = ((AddonComponent)targeted).Addon as ILoom;
                }

                if (loom != null)
                {
                    if (!m_Material.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("Isto precisa estar em sua mochila");
                    }
                    else if (loom.Phase < 4)
                    {
                        m_Material.Consume();
                        switch (loom.Phase)
                        {
                        case 0:
                            from.SendMessage("O rolo de tecido acabou de iniciar");
                            break;

                        case 2:
                            from.SendMessage("O rolo de tecido esta na metade");
                            break;

                        case 3:
                            from.SendMessage("O rolo de tecido esta quase terminando");
                            break;
                        }
                        loom.Phase++;

                        if (targeted is Item)
                        {
                            ((Item)targeted).SendLocalizedMessageTo(from, 1010001 + loom.Phase++);
                        }
                    }
                    else
                    {
                        Item create = new BoltOfCloth();
                        create.Hue = m_Material.Hue;

                        m_Material.Consume();
                        loom.Phase = 0;
                        from.SendMessage("Voce criou um rolo de tecido"); // You create some cloth and put it in your backpack.
                        from.AddToBackpack(create);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500367); // Try using that on a loom.
                }
            }
Beispiel #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Material.Deleted)
                {
                    return;
                }

                ILoom loom = targeted as ILoom;

                if (loom == null && targeted is AddonComponent)
                {
                    loom = ((AddonComponent)targeted).Addon as ILoom;
                }

                if (loom != null)
                {
                    if (!m_Material.IsChildOf(from.Backpack))
                    {
                        from.SendAsciiMessage("That must be in your pack for you to use it.");                           // That must be in your pack for you to use it.
                    }
                    else if (loom.Phase < 4)
                    {
                        m_Material.Consume();

                        if (targeted is Item)
                        {
                            switch (loom.Phase++)
                            {
                            case 0: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth has just been started.")); break;

                            case 1: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth needs quite a bit more.")); break;

                            case 2: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth needs a little more.")); break;

                            case 3: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth is almost finished.")); break;
                            }
                            //((Item)targeted).SendLocalizedMessageTo( from, 1010001 + loom.Phase++ );
                        }
                    }
                    else
                    {
                        Item create = new BoltOfCloth();
                        create.Hue = m_Material.Hue;

                        m_Material.Consume();
                        loom.Phase = 0;
                        from.SendAsciiMessage("You create some cloth and put it in your backpack.");                           // You create some cloth and put it in your backpack.
                        from.AddToBackpack(create);
                    }
                }
                else
                {
                    from.SendAsciiMessage("Try using that on a loom.");                       // Try using that on a loom.
                }
            }
        public void CutUp(Mobile from, Item[] items)
        {
            Container backpack = from.Backpack;

            for (int i = 0; i < items.Length; i++)
            {
                BoltOfCloth boc = items[i] as BoltOfCloth;

                if (boc != null)
                {
                    boc.Scissor(from, null);
                }
            }
        }
Beispiel #5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Material.Deleted)
                {
                    return;
                }

                ILoom loom = targeted as ILoom;

                if (loom == null && targeted is AddonComponent)
                {
                    loom = ((AddonComponent)targeted).Addon as ILoom;
                }

                if (loom != null)
                {
                    if (!m_Material.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                    else if (loom.Phase < 4)
                    {
                        m_Material.Consume();

                        if (targeted is Item)
                        {
                            ((Item)targeted).SendLocalizedMessageTo(from, 1010001 + loom.Phase++);
                        }
                    }
                    else
                    {
                        Item create = new BoltOfCloth
                        {
                            Hue = m_Material.Hue
                        };

                        m_Material.Consume();
                        loom.Phase = 0;
                        from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
                        from.AddToBackpack(create);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500367); // Try using that on a loom.
                }
            }
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Material.Deleted )
					return;

				ILoom loom = targeted as ILoom;

				if ( loom == null && targeted is AddonComponent )
					loom = ((AddonComponent)targeted).Addon as ILoom;

				if ( loom != null )
				{
					if ( !m_Material.IsChildOf( from.Backpack ) )
					{
						from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
					}
					else if ( loom.Phase < 4 )
					{
						m_Material.Consume();

						if ( targeted is Item )
							((Item)targeted).SendLocalizedMessageTo( from, 1010001 + loom.Phase++ );
					}
					else
					{
						Item create = new BoltOfCloth();
						create.Hue = m_Material.Hue;

						m_Material.Consume();
						loom.Phase = 0;
						from.SendLocalizedMessage( 500368 ); // You create some cloth and put it in your backpack.
						from.AddToBackpack( create );
					}
				}
				else
				{
					from.SendLocalizedMessage( 500367 ); // Try using that on a loom.
				}
			}
        public void OnChop(Mobile from)
        {
            if (from.InRange(this.GetWorldLocation(), 2))
            {
                Effects.SendLocationEffect(Location, Map, 0x3728, 20, 10);                   //smoke or dust
                Effects.PlaySound(Location, Map, 0x11C);

                switch (Utility.Random(25))
                {
                case 0:
                    Effects.SendLocationEffect(from, from.Map, 0x113A, 20, 10);                               // Poison Player
                    from.PlaySound(0x231);
                    from.ApplyPoison(from, Poison.Lesser);
                    break;

                case 1:
                    Effects.SendLocationEffect(from, from.Map, 0x3709, 30);                             // Burn Player
                    from.PlaySound(0x54);
                    AOS.Damage(from, from, Utility.RandomMinMax(2, 5), 0, 100, 0, 0, 0);
                    break;

                case 2:
                    new BarrelLid().MoveToWorld(Location, Map);
                    new BarrelHoops().MoveToWorld(Location, Map);
                    break;

                case 3:
                    Bandage b = new Bandage(Utility.RandomMinMax(5, 10));
                    b.MoveToWorld(Location, Map);
                    break;

                case 4:
                    new BarrelStaves().MoveToWorld(Location, Map);
                    new BarrelHoops().MoveToWorld(Location, Map);
                    break;

                case 5:
                    Gold g = new Gold(Utility.RandomMinMax(25, 50));
                    g.MoveToWorld(Location, Map);
                    break;

                case 6:
                    new AgilityPotion().MoveToWorld(Location, Map);
                    break;

                case 7:
                    new LesserCurePotion().MoveToWorld(Location, Map);
                    break;

                case 8:
                    new LesserExplosionPotion().MoveToWorld(Location, Map);
                    break;

                case 9:
                    new LesserHealPotion().MoveToWorld(Location, Map);
                    break;

                case 10:
                    new LesserLightningPotion().MoveToWorld(Location, Map);
                    break;

                case 11:
                    new LesserManaPotion().MoveToWorld(Location, Map);
                    break;

                case 12:
                    new MindPotion().MoveToWorld(Location, Map);
                    break;

                case 13:
                    new LesserPoisonPotion().MoveToWorld(Location, Map);
                    break;

                case 14:
                    new LesserShatterPotion().MoveToWorld(Location, Map);
                    break;

                case 15:
                    new StrengthPotion().MoveToWorld(Location, Map);
                    break;

                case 16:
                    new LesserToxicPotion().MoveToWorld(Location, Map);
                    break;

                case 17:
                    Arrow arrow = new Arrow(Utility.RandomMinMax(5, 25));
                    arrow.MoveToWorld(Location, Map);
                    break;

                case 18:
                    Bolt bolt = new Bolt(Utility.RandomMinMax(5, 25));
                    bolt.MoveToWorld(Location, Map);
                    break;

                case 19:
                    IronIngot ii = new IronIngot(Utility.RandomMinMax(5, 25));
                    ii.MoveToWorld(Location, Map);
                    break;

                case 20:
                    Leather leather = new Leather(Utility.RandomMinMax(5, 25));
                    leather.MoveToWorld(Location, Map);
                    break;

                case 21:
                    Log log = new Log(Utility.RandomMinMax(5, 25));
                    log.MoveToWorld(Location, Map);
                    break;

                case 22:
                    BoltOfCloth boc = new BoltOfCloth(Utility.RandomMinMax(1, 25));
                    boc.MoveToWorld(Location, Map);
                    break;

                case 23:
                    SpidersSilk spiderssilk = new SpidersSilk(Utility.RandomMinMax(5, 25));
                    spiderssilk.MoveToWorld(Location, Map);
                    break;

                case 24:
                    SulfurousAsh sulfurousash = new SulfurousAsh(Utility.RandomMinMax(1, 25));
                    sulfurousash.MoveToWorld(Location, Map);
                    break;
                }

                Destroy();
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
            }
        }
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Material.Deleted )
                    return;

                ILoom loom = targeted as ILoom;

                if ( loom == null && targeted is AddonComponent )
                    loom = ((AddonComponent)targeted).Addon as ILoom;

                if ( loom != null )
                {
                    if ( !m_Material.IsChildOf( from.Backpack ) )
                    {
                        from.SendAsciiMessage( "That must be in your pack for you to use it." );
                    }
                    else if ( loom.Phase < 4 )
                    {
                        m_Material.Consume();

                        if ( targeted is Item )
                        {
                            if ( loom.Phase == 0 )
                                ((Item)targeted).SendAsciiMessageTo( from, "The bolt of cloth has just been started." );
                            else if ( loom.Phase == 1 )
                                ((Item)targeted).SendAsciiMessageTo( from, "The bolt of cloth needs quite a bit more." );
                            else if ( loom.Phase == 2 )
                                ((Item)targeted).SendAsciiMessageTo( from, "The bolt of cloth needs a little more." );
                            else if ( loom.Phase == 3 )
                                ((Item)targeted).SendAsciiMessageTo( from, "The bolt of cloth is almost finished." );

                            loom.Phase = loom.Phase + 1;
                        }
                    }
                    else
                    {
                        Item create = new BoltOfCloth();
                        create.Hue = m_Material.Hue;

                        m_Material.Consume();
                        loom.Phase = 0;
                        from.SendAsciiMessage( "You create some cloth and put it in your backpack." );
                        from.AddToBackpack( create );
                    }
                }
                else
                {
                    from.SendAsciiMessage( "Try using that on a loom." );
                }
            }
Beispiel #9
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Material.Deleted )
                    return;

                ILoom loom = targeted as ILoom;

                if ( loom == null && targeted is AddonComponent )
                    loom = ((AddonComponent)targeted).Addon as ILoom;

                if ( loom != null )
                {
                    if ( !m_Material.IsChildOf( from.Backpack ) )
                    {
                        from.SendAsciiMessage( "That must be in your pack for you to use it." ); // That must be in your pack for you to use it.
                    }
                    else if ( loom.Phase < 4 )
                    {
                        m_Material.Consume();

                        if (targeted is Item)
                        {
                            switch (loom.Phase++)
                            {
                                case 0: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth has just been started.")); break;
                                case 1: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth needs quite a bit more.")); break;
                                case 2: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth needs a little more.")); break;
                                case 3: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth is almost finished.")); break;
                            }
                            //((Item)targeted).SendLocalizedMessageTo( from, 1010001 + loom.Phase++ );
                        }
                    }
                    else
                    {
                        Item create = new BoltOfCloth();
                        create.Hue = m_Material.Hue;

                        m_Material.Consume();
                        loom.Phase = 0;
                        from.SendAsciiMessage( "You create some cloth and put it in your backpack." ); // You create some cloth and put it in your backpack.
                        from.AddToBackpack( create );
                    }
                }
                else
                {
                    from.SendAsciiMessage( "Try using that on a loom." ); // Try using that on a loom.
                }
            }
        public static void OnLoomLoop(ILoom loom, Mobile from, int hue, Item thread)
        {
            if (loom.Phase > 4)
            {
                loom.Phase = 0;
                Item item = new BoltOfCloth();
                item.Hue = hue;
                from.AddToBackpack(item);
                from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
            }

            LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment));
            if (att == null)
            {
                att = new LoomQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveLooms((Item)loom);

            if (from.NetState == null) // player logged off
                return;
            if (thread.Deleted || thread.Amount < 1 || !(thread is BaseClothMaterial))
                from.SendMessage("You finished processing all the threads/yarns.");
            else if (!thread.IsChildOf(from.Backpack))
                from.SendMessage("You can not continue without the threads/yarns in your backpack.");
            else if (loom is Item)
            {
                Item loom1 = (Item)loom;

                if (loom1.Deleted)
                    from.SendMessage("Where did the loom go?");
                else if (!from.InRange(loom1.GetWorldLocation(), 3))
                    from.SendMessage("You are too far away from the loom to continue your work.");
                else if (loom.Looming)
                    from.SendMessage("That loom is being used.");
                else
                {
                    if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap)
                    {
                        att.AddLooms(loom1);
                        if (Utility.Random(20 * att.getNumLooms()) < 1)
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*");
                        thread.Consume();
                        loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, thread.Hue, thread);
                        return;
                    }
                    else
                        from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running.");
                }
            }
        }
Beispiel #11
0
		    public override void OnClick()
            {
                
                PlayerMobile mobile = (PlayerMobile)m_Mobile;
				Account acct=(Account)mobile.Account;
				bool TailorItemsReceived = Convert.ToBoolean( acct.GetTag("TailorItemsReceived") );
            
				{

					if ( TailorItemsReceived ) //account tag check
					
					{
					mobile.SendMessage("You have already done this quest.");
					
					}
					
					else
					
					{
					
					Item tm = mobile.Backpack.FindItemByType(typeof(NewbTailorMarker1));
					if (tm != null)
					{
					    Item tw = mobile.Backpack.FindItemByType(typeof(Wool));
						Item tb = mobile.Backpack.FindItemByType(typeof(BoltOfCloth));
						Item tt = mobile.Backpack.FindItemByType(typeof(SpoolOfThread));
						
                        if ( tw == null || tw.Amount < 10 || tb== null || tb.Amount < 10 || tt == null || tt.Amount < 10) 
						{
						mobile.SendMessage("You need more items or make sure that the only items in your pack are the ones I asked for.");
						}	
						
						else
                        {
                        
                            mobile.SendGump(new NewbTailorQuestGump2(mobile));
                            mobile.Backpack.ConsumeTotal( typeof( Wool ), 10 );
                            mobile.Backpack.ConsumeTotal( typeof( BoltOfCloth ), 10 );
                            mobile.Backpack.ConsumeTotal( typeof( SpoolOfThread ), 10 );
							tm.Delete();
	         			 	acct.SetTag( "TailorItemsReceived", "true" );
							
							
							switch ( Utility.Random( 4 ) )
							{
								
								case  0: mobile.AddToBackpack( new RunicSewingKit( CraftResource.SpinedLeather, Core.AOS ? 20 : 20 ) );; break;
								case  1: mobile.AddToBackpack( new RunicSewingKit( CraftResource.HornedLeather, Core.AOS ? 20 : 20 ) );; break;
								case  2: mobile.AddToBackpack( new RunicSewingKit( CraftResource.BarbedLeather, Core.AOS ? 20 : 20 ) );; break;
								case  3: {BoltOfCloth boc = new BoltOfCloth (); 
								boc.Hue = Utility.RandomList( 0x481, 0x489, 0x48E, 0x494, 0x484, 0x48D, 0x497 ); 
								mobile.AddToBackpack( boc ); 
								};; break;
								
							
						
							}
                        }
                    }
					
										else
                            {
                                mobile.SendGump(new NewbTailorQuestGump(mobile));
							
                            }

					
					}
					
                    
                }
				
				
				
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Material.Deleted)
                {
                    return;
                }

                ILoom loom = targeted as ILoom;

                if (loom == null && targeted is AddonComponent)
                {
                    loom = ((AddonComponent)targeted).Addon as ILoom;
                }

                if (loom != null)
                {
                    if (!m_Material.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001);                           // That must be in your pack for you to use it.
                    }
                    else
                    {
                        int cycle  = m_Material.Amount;
                        int looms  = loom.Phase;
                        int amount = 0;

                        bool sendMessage = false;

                        while (cycle > 0)
                        {
                            cycle--;

                            if (looms >= 4)
                            {
                                looms = 0;
                                amount++;
                                sendMessage = true;
                            }
                            else
                            {
                                looms++;
                            }
                        }

                        m_Material.Delete();
                        loom.Phase = looms;

                        if (sendMessage)
                        {
                            Item create = new BoltOfCloth(amount);
                            create.Hue = m_Material.Hue;
                            from.AddToBackpack(create);

                            from.SendLocalizedMessage(500368);                               // You create some cloth and put it in your backpack.
                            if (loom.Phase > 0)
                            {
                                from.SendMessage("The loom still has some incomplete cloth started.");
                            }
                        }
                        else
                        {
                            from.SendMessage("You don't have enough to create a bolt of cloth.");
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500367);                       // Try using that on a loom.
                }
            }
Beispiel #13
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Material.Deleted)
                {
                    return;
                }

                ILoom loom = targeted as ILoom;

                if (loom == null && targeted is AddonComponent)
                {
                    loom = ((AddonComponent)targeted).Addon as ILoom;
                }

                if (loom != null)
                {
                    if (!m_Material.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                    else
                    {
                        LokaiSkills   skills     = LokaiSkillUtilities.XMLGetSkills(from);
                        LokaiSkill    lokaiSkill = skills[LokaiSkillName.Weaving];
                        SuccessRating rating     = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0);

                        if (rating >= SuccessRating.PartialSuccess)
                        {
                            if (loom.Phase < 4)
                            {
                                if (targeted is Item)
                                {
                                    ((Item)targeted).SendLocalizedMessageTo(from, 1010001 + loom.Phase++);
                                }
                                m_Material.Consume();
                            }
                            else
                            {
                                Item create = new BoltOfCloth();
                                create.Hue = m_Material.Hue;
                                loom.Phase = 0;
                                from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
                                from.AddToBackpack(create);
                                m_Material.Consume();
                            }
                        }
                        else if (rating == SuccessRating.Failure)
                        {
                            from.SendMessage("You fail, but manage to save your material.");
                        }
                        else if (rating == SuccessRating.HazzardousFailure)
                        {
                            m_Material.Consume();
                            from.SendMessage("You fail, and some material is lost.");
                        }
                        else if (rating == SuccessRating.CriticalFailure)
                        {
                            m_Material.Consume();
                            loom.Phase = 0;
                            from.SendMessage("You fail utterly, some material is lost, and you need to start over.");
                        }
                        else if (rating == SuccessRating.TooDifficult)
                        {
                            m_Material.Consume();
                            loom.Phase = 0;
                            from.SendMessage("You have no idea how to work this thing.");
                            from.SendMessage("You fail utterly, some material is lost, and you need to start over.");
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500367);                       // Try using that on a loom.
                }
            }
Beispiel #14
0
        public static void OnLoomLoop(ILoom loom, Mobile from, int hue, Item thread)
        {
            if (loom.Phase > 4)
            {
                loom.Phase = 0;
                Item item = new BoltOfCloth();
                item.Hue = hue;
                from.AddToBackpack(item);
                from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
            }

            LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment));

            if (att == null)
            {
                att = new LoomQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveLooms((Item)loom);

            if (from.NetState == null) // player logged off
            {
                return;
            }
            if (thread.Deleted || thread.Amount < 1 || !(thread is BaseClothMaterial))
            {
                from.SendMessage("You finished processing all the threads/yarns.");
            }
            else if (!thread.IsChildOf(from.Backpack))
            {
                from.SendMessage("You can not continue without the threads/yarns in your backpack.");
            }
            else if (loom is Item)
            {
                Item loom1 = (Item)loom;

                if (loom1.Deleted)
                {
                    from.SendMessage("Where did the loom go?");
                }
                else if (!from.InRange(loom1.GetWorldLocation(), 3))
                {
                    from.SendMessage("You are too far away from the loom to continue your work.");
                }
                else if (loom.Looming)
                {
                    from.SendMessage("That loom is being used.");
                }
                else
                {
                    if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap)
                    {
                        att.AddLooms(loom1);
                        if (Utility.Random(20 * att.getNumLooms()) < 1)
                        {
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*");
                        }
                        thread.Consume();
                        loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, thread.Hue, thread);
                        return;
                    }
                    else
                    {
                        from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running.");
                    }
                }
            }
        }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Material.Deleted)
                {
                    return;
                }

                ILoom loom = targeted as ILoom;

                if (loom == null && targeted is AddonComponent)
                {
                    loom = ((AddonComponent)targeted).Addon as ILoom;
                }

                if (loom != null)
                {
                    if (!m_Material.IsChildOf(from.Backpack))
                    {
                        from.SendAsciiMessage("That must be in your pack for you to use it.");
                    }
                    else if (loom.Phase < 4)
                    {
                        m_Material.Consume();

                        if (targeted is Item)
                        {
                            if (loom.Phase == 0)
                            {
                                ((Item)targeted).SendAsciiMessageTo(from, "The bolt of cloth has just been started.");
                            }
                            else if (loom.Phase == 1)
                            {
                                ((Item)targeted).SendAsciiMessageTo(from, "The bolt of cloth needs quite a bit more.");
                            }
                            else if (loom.Phase == 2)
                            {
                                ((Item)targeted).SendAsciiMessageTo(from, "The bolt of cloth needs a little more.");
                            }
                            else if (loom.Phase == 3)
                            {
                                ((Item)targeted).SendAsciiMessageTo(from, "The bolt of cloth is almost finished.");
                            }

                            loom.Phase = loom.Phase + 1;
                        }
                    }
                    else
                    {
                        Item create = new BoltOfCloth();
                        create.Hue = m_Material.Hue;

                        m_Material.Consume();
                        loom.Phase = 0;
                        from.SendAsciiMessage("You create some cloth and put it in your backpack.");
                        from.AddToBackpack(create);
                    }
                }
                else
                {
                    from.SendAsciiMessage("Try using that on a loom.");
                }
            }