コード例 #1
0
ファイル: RuneDyeTub.cs プロジェクト: zerodowned/UO-Forever
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (targeted is Item)
     {
         var item = (Item)targeted;
         if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
         {
             from.SendLocalizedMessage(500446); // That is too far away.
         }
         else if (!item.Deleted &&
                  (item.Dyable ||
                   (m_Tub.UsesRemaining >= 0 && m_Tub.Redyable && item is BaseDyeTub &&
                    ((BaseDyeTub)item).Redyable &&
                    ((BaseDyeTub)item).UsesRemaining >= 0)) && m_Tub.IsDyable(item) && item is RecallRune)
         {
             m_Tub.Dye(from, item);
         }
         else
         {
             from.SendMessage("You cannot dye that.");
         }
     }
     else
     {
         from.SendMessage("You cannot dye that.");
     }
 }
コード例 #2
0
ファイル: BaseDyeTub.cs プロジェクト: zerodowned/UO-Forever
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (targeted is Item)
     {
         Item item = (Item)targeted;
         if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
         {
             from.SendLocalizedMessage(500446);                         // That is too far away.
         }
         else if (targeted is MetalKiteShield && m_Tub is DyeTub)
         {
             m_Tub.Dye(from, item);
         }
         else if (targeted is HouseToHouseTeleporter && m_Tub is FurnitureDyeTub)
         {
             m_Tub.Dye(from, item);
         }
         else if (!item.Deleted &&
                  (item.Dyable ||
                   (m_Tub.UsesRemaining >= 0 && m_Tub.Redyable && item is BaseDyeTub && ((BaseDyeTub)item).Redyable &&
                    ((BaseDyeTub)item).UsesRemaining >= 0)) && m_Tub.IsDyable(item))
         {
             if (m_Tub.Dye(from, item))
             {
                 if (m_Tub.UsesRemaining > 0)
                 {
                     m_Tub.UsesRemaining--;
                     if (m_Tub.UsesRemaining == 0)
                     {
                         m_Tub.Delete();
                         from.SendMessage(54, "Your dye tub has run out of charges!");
                     }
                 }
             }
         }
         else
         {
             TextDefinition.SendMessageTo(from, m_Tub.FailMessage);
         }
     }
     else
     {
         TextDefinition.SendMessageTo(from, m_Tub.FailMessage);
     }
 }