示例#1
0
            protected override void OnTarget(Mobile from, object targ)
            {
                if (targ is BaseFence)
                {
                    BaseFence fg = (BaseFence)targ;

                    if (fg.Movable == true)
                    {
                        from.SendMessage("You set the fence into the ground.");
                        from.PlaySound(0x136);
                        fg.Movable    = false;
                        fg.ranchstone = t_fh.ranchstone;
                    }
                    else
                    {
                        from.SendMessage("You knock it free from the ground.");
                        from.PlaySound(0x13F);
                        fg.Movable    = true;
                        fg.ranchstone = null;
                    }
                    return;
                }
                else if (targ is FenceGate)
                {
                    FenceGate fg = (FenceGate)targ;

                    if (fg.Movable == true)
                    {
                        from.SendMessage("You set the fence into the ground.");
                        from.PlaySound(0x136);
                        fg.Movable    = false;
                        fg.ranchstone = t_fh.ranchstone;
                    }
                    else
                    {
                        from.SendMessage("You knock it free from the ground.");
                        from.PlaySound(0x13F);
                        fg.Movable    = true;
                        fg.ranchstone = null;
                    }
                    return;
                }
                else if (targ is RanchStone)
                {
                    RanchStone rs = (RanchStone)targ;
                    if (rs.Owner == from)
                    {
                        from.SendMessage("Enter new ranch name.");
                        from.Prompt = new RenamePrompt(rs);
                    }
                    else
                    {
                        from.SendMessage("You don't own that!");
                    }
                }
                else
                {
                    from.SendMessage("You can't do that.");
                }
            }
 public virtual void UpdateFences()
 {
     foreach (Item item in this.GetItemsInRange(m_Size + 1))
     {
         if (item is FenceGate)
         {
             FenceGate fg = (FenceGate)item;
             if (fg.ranchstone == this)
             {
                 fg.InvalidateProperties();
             }
         }
         else if (item is BaseFence)
         {
             BaseFence f = (BaseFence)item;
             if (f.ranchstone == this)
             {
                 f.InvalidateProperties();
             }
         }
     }
 }
 public override void OnDelete()
 {
     foreach (Item item in this.GetItemsInRange(m_Size + 1))
     {
         if (item is FenceGate)
         {
             FenceGate fg = (FenceGate)item;
             if (fg.ranchstone == this)
             {
                 fg.ranchstone = null;
                 fg.Movable    = true;
             }
         }
         else if (item is BaseFence)
         {
             BaseFence f = (BaseFence)item;
             if (f.ranchstone == this)
             {
                 f.ranchstone = null;
                 f.Movable    = true;
             }
         }
     }
 }