RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Wrist Watch

otimpyre

Sorceror
Wrist Watch

:idea: I made one using GM commands but I cant script
[Add GoldBracelet
[Add Clock
[Get itemid Goldbracelet
Change Itemid on Clock to Bracelet
Rename wrist watch
Set Layer Bracelet
And Walla Wristwatch
You can mess with the layers to make it show up on top of gloves
forgot how I did that.
Be nice if we could just say add wristwatch and perhaps set the time!
So we dont loose track of the real world and be late for work.

Wise man say he who pees the screen will strain himself.
 

Phantom

Knight
...

You can script this I doubt it will be done for you.

Since there is no real "item" for it you will have to do the time part if you want.
 
K

Krazy_zack

Guest
Phantom said:
...

You can script this I doubt it will be done for you.

Since there is no real "item" for it you will have to do the time part if you want.

Why not? It was a 'rare' givent out on the 'original' OSI and RunUO is suposed to be emulating OSI.......

I think I'm going to script a bunch of the 'goofy rares' (like this one) so people can have them on their shards.
 

Alari

Wanderer
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:D2}", 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. :>
 

Alari

Wanderer
Don't, like, say thank you or anything. :confused:;

Or give suggestions on how to fix the sleeve problem.
 

otimpyre

Sorceror
Thank You

Thank you. You did a great job! BTW to make it appear on top of gloves you can set the layer to helmet.
 
Top