PigPen

Member
I have this old Mailbox script that is great and players love it.

Problem is . . the only player on their account that can open it is the first player they have who accessed it. That player then becomes the sole owner and their other characters on their account cannot open it.

Is there a way to have the Ownership apply to all characters on their account (not just the first one that used the mailbox)?

I thought about using an Account Tag but I don't think that would work. If I use a simple Account Tag then every player who owns a Mailbox could open all other Mailboxes.

So I am at a logic impasse on how/where to start to solve this.

Here is the Mailbox script:
Code:
using System;
using System.Collections;
using Server.Multis;
using Server.Mobiles;
using Server.Network;
using System.Collections.Generic;
using Server.ContextMenus;
namespace Server.Items
{
	public class MailBox : LockableContainer
	{
		private Mobile m_Owner;
		public Mobile Owner
		{
			get { return m_Owner; }
			set { m_Owner = value; InvalidateProperties(); }
		}
		[Constructable]
		public MailBox() : base( 0x9A8 )
		{
			Name = "Mail Box";
			Weight = 2.0;
		}
		public override void OnTelekinesis( Mobile from )
		{
			return;
		}
		public override void OnDoubleClick( Mobile from )
		{
			if( Owner == null && IsChildOf( from.Backpack ))
			{
				Owner = from;
				from.SendMessage( "You now own this box!" );
				base.OnDoubleClick( from );
			}
			else if( Owner == null)
			{
				from.SendMessage( "You can only set your self as owner of this box if it is in your pack!" );
			}
			else if( !IsSecure && IsAccessibleTo( from ) )
				base.OnDoubleClick( from );
			else if( Owner == from || from.AccessLevel > Owner.AccessLevel )
				base.OnDoubleClick( from );
			else
				from.SendMessage( "This is not your box, you must be the owner to open it!" );
		}
		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );
			list.Add( 1072304, Owner == null ? "nobody" : Owner.Name );
		}
		public MailBox(Serial serial) : base(serial){}
		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int)1 );
			writer.Write( m_Owner != null );
			if( m_Owner != null ) writer.Write( m_Owner );
		}
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
			if( reader.ReadBool() ) m_Owner = reader.ReadMobile();
		}
	}
}

Does anyone know of a solution?
Many Thanks
 
Talow . . I only have a few things to say *grins*

- Thank you for your very fast response . . *bow*
- Thank you for solving this for me in such a simple way *feeling a bit dumb here :) *
- Your long service to the UO community is hugely appreciated by all . . *deep bow*

Cheers
 

Active Shards

  • Unchained
    Custom (Classic)
    • Players
    • 130 Online
    • 273 Peak
  • The Crossroads
    Mondain's Legacy
    • Players
    • 107 Online
    • 190 Peak
  • UO Eventine
    Custom (Classic)
    • Players
    • 89 Online
    • 137 Peak
  • Insane UO
    Endless Journey
    • Players
    • 77 Online
    • 105 Peak
  • UO: New Renaissance
    Custom (Classic)
    • Players
    • 22 Online
    • 85 Peak
  • CALYPSO
    Custom (Modern)
    • Players
    • 20 Online
    • 30 Peak
  • Pandora
    Custom (Modern)
    • Players
    • 20 Online
    • 32 Peak
  • UO Phoenix
    Custom (Classic)
    • Players
    • 19 Online
    • 48 Peak
  • UO Enigma
    Custom (Modern)
    • Players
    • 18 Online
    • 172 Peak
  • Arth
    Custom (Modern)
    • Players
    • 15 Online
    • 34 Peak

Donations

Total amount
$0.00
Goal
$500.00
Back