Took me a few tries to get it right. You can wear it, it's named "Wristwatch", and it tells you the time. If I missed anything, let me know. :>
The only problem I noticed is that it's hard to click on while wearing sleeves...
Wristwatch.cs
[code:1]
// Mostly copied from clocks.cs
using System;
using Server;
namespace Server.Items
{
public class Wristwatch : BaseBracelet
{
private static DateTime m_ServerStart;
public static DateTime ServerStart
{
get{ return m_ServerStart; }
}
public static void Initialize()
{
m_ServerStart = DateTime.Now;
}
[Constructable]
public Wristwatch() : base( 0x1086 )
{
Weight = 0.1;
Name = "Wristwatch";
}
public Wristwatch( Serial serial ) : base( serial )
{
}
private const double SecondsPerUOMinute = 5.0;
public static void GetTime( out int generalNumber, out string exactTime )
{
TimeSpan timeSpan = DateTime.Now - m_ServerStart;
double earthSeconds = timeSpan.TotalSeconds;
double uoMinutes = earthSeconds / SecondsPerUOMinute;
double uoHours = uoMinutes / 60.0;
uoHours += 12.0; // server starts at noon
uoMinutes %= 60.0;
uoHours %= 24.0;
// 00:00 AM - 00:59 AM : Witching hour
// 01:00 AM - 03:59 AM : Middle of night
// 04:00 AM - 07:59 AM : Early morning
// 08:00 AM - 11:59 AM : Late morning
// 12:00 PM - 12:59 PM : Noon
// 01:00 PM - 03:59 PM : Afternoon
// 04:00 PM - 07:59 PM : Early evening
// 08:00 PM - 11:59 AM : Late at night
if ( uoHours >= 20.0 )
generalNumber = 1042957; // It's late at night
else if ( uoHours >= 16.0 )
generalNumber = 1042956; // It's early in the evening
else if ( uoHours >= 13.0 )
generalNumber = 1042955; // It's the afternoon
else if ( uoHours >= 12.0 )
generalNumber = 1042954; // It's around noon
else if ( uoHours >= 08.0 )
generalNumber = 1042953; // It's late in the morning
else if ( uoHours >= 04.0 )
generalNumber = 1042952; // It's early in the morning
else if ( uoHours >= 01.0 )
generalNumber = 1042951; // It's the middle of the night
else
generalNumber = 1042950; // 'Tis the witching hour. 12 Midnight.
uoHours %= 12.0;
if ( uoHours < 1.0 )
uoHours = 12.0;
exactTime = String.Format( "{0:F0}:{1
2}", uoHours, (int)uoMinutes );
}
public override void OnDoubleClick( Mobile from )
{
int genericNumber;
string exactTime;
GetTime( out genericNumber, out exactTime );
SendLocalizedMessageTo( from, genericNumber );
SendLocalizedMessageTo( from, 1042958, exactTime ); // ~1_TIME~ to be exact
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
[/code:1]
Personally, I'm trying to modify Stealing.cs to only let thieves steal gold from players, not items, but let them continue to steal items from containers (bookshelves, crates, etc, as well as "town" chests that will get them in bad with the guards) I still need to learn more C# code tho and this is good practice. :>