MR123

Initiate
Hello support officers,
first time scripter here.
I've ran into a hurdle I can't jump over; Felucca and Trammel, ilishener, malas, tokuno, for that matter, but primarily trammel/felucca are on different ingame timezones. I would like both on the same felucca gametime.

Kudos,
I don't know how to change it.

thanks for responses
 
Time zones? or no? :)

for example,
if you're in moonglow in fel around the bank it's 5 AM
go to trammel now same spot using the staffrunebook, it's now 10AM

I don't want trammel to be 5 hours ahead of felucca. any way to change it?

na not about leafs, to change leafs it's all in MapRegistry.cs


thanks milva
 
Last edited:
He means the facet time based on the "moon cycle" like when you click on a clock in game.
 
that's some funny naming

I can probably find it w/ that, it's quite a thing tho

the help is appreciated :]


I maybe stupid on the subject of time tbh in this game, all the different areas of the facet have different times
im not sure how thats really calculated on the grand scale, that isn't my question...

trammel and felucca aren't exactly the same times however

does anyone know how to help me x.x

as you can see in clocks.cs
there's a property for time, timecycle, moonphase, mooncycle, or ....
it's calling it off the map
Code:
        public static MoonPhase GetMoonPhase(Map map, int x, int y)
        {
            int hours, minutes, totalMinutes;

            GetTime(map, x, y, out hours, out minutes, out totalMinutes);

            if (map != null)
                totalMinutes /= 10 + (map.MapIndex * 20);

            return (MoonPhase)(totalMinutes % 8);
        }

        public static void GetTime(Map map, int x, int y, out int hours, out int minutes)
        {
            int totalMinutes;

            GetTime(map, x, y, out hours, out minutes, out totalMinutes);
        }

        public static void GetTime(Map map, int x, int y, out int hours, out int minutes, out int totalMinutes)
        {
            TimeSpan timeSpan = DateTime.UtcNow - WorldStart;

            totalMinutes = (int)(timeSpan.TotalSeconds / SecondsPerUOMinute);

            if (map != null)
                totalMinutes += map.MapIndex * 320;

            // Really on OSI this must be by subserver
            totalMinutes += x / 16;

            hours = (totalMinutes / 60) % 24;
            minutes = totalMinutes % 60;
        }

        public static void GetTime(out int generalNumber, out string exactTime)
        {
            GetTime(null, 0, 0, out generalNumber, out exactTime);
        }

        public static void GetTime(Mobile from, out int generalNumber, out string exactTime)
        {
            GetTime(from.Map, from.X, from.Y, out generalNumber, out exactTime);
        }

        public static void GetTime(Map map, int x, int y, out int generalNumber, out string exactTime)
        {
            int hours, minutes;

            GetTime(map, x, y, out hours, out minutes);

            // 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 (hours >= 20)
                generalNumber = 1042957; // It's late at night
            else if (hours >= 16)
                generalNumber = 1042956; // It's early in the evening
            else if (hours >= 13)
                generalNumber = 1042955; // It's the afternoon
            else if (hours >= 12)
                generalNumber = 1042954; // It's around noon
            else if (hours >= 08)
                generalNumber = 1042953; // It's late in the morning
            else if (hours >= 04)
                generalNumber = 1042952; // It's early in the morning
            else if (hours >= 01)
                generalNumber = 1042951; // It's the middle of the night
            else
                generalNumber = 1042950; // 'Tis the witching hour. 12 Midnight.

            hours %= 12;

            if (hours == 0)
                hours = 12;

            exactTime = String.Format("{0}:{1:D2}", hours, minutes);
        }
[doublepost=1480102040][/doublepost]
[doublepost=1480102635][/doublepost]If I modify clocks, will it modify just the clock object?
how does I modify the global time // facet time?
 
Last edited:
just came on and had a quick look and tested it. anything with "map.MapIndex" in the calculating i replaced with 1. that makes all time sync together as 1. i guess because theyre different realms/warps they would have different times. but this does the trick. :)

Code:
        public static MoonPhase GetMoonPhase(Map map, int x, int y)
        {
            int hours, minutes, totalMinutes;

            GetTime(map, x, y, out hours, out minutes, out totalMinutes);

            if (map != null)
                totalMinutes /= 10 + (1 /*map.MapIndex*/ * 20);

            return (MoonPhase)(totalMinutes % 8);
        }

        public static void GetTime(Map map, int x, int y, out int hours, out int minutes)
        {
            int totalMinutes;

            GetTime(map, x, y, out hours, out minutes, out totalMinutes);
        }

        public static void GetTime(Map map, int x, int y, out int hours, out int minutes, out int totalMinutes)
        {
            TimeSpan timeSpan = DateTime.UtcNow - WorldStart;

            totalMinutes = (int)(timeSpan.TotalSeconds / SecondsPerUOMinute);

            if (map != null)
                totalMinutes += 1 /*map.MapIndex*/ * 320;

            // Really on OSI this must be by subserver
            totalMinutes += x / 16;

            hours = (totalMinutes / 60) % 24;
            minutes = totalMinutes % 60;
        }

        public static void GetTime(out int generalNumber, out string exactTime)
        {
            GetTime(null, 0, 0, out generalNumber, out exactTime);
        }

        public static void GetTime(Mobile from, out int generalNumber, out string exactTime)
        {
            GetTime(from.Map, from.X, from.Y, out generalNumber, out exactTime);
        }

        public static void GetTime(Map map, int x, int y, out int generalNumber, out string exactTime)
        {
            int hours, minutes;

            GetTime(map, x, y, out hours, out minutes);

            // 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 (hours >= 20)
                generalNumber = 1042957; // It's late at night
            else if (hours >= 16)
                generalNumber = 1042956; // It's early in the evening
            else if (hours >= 13)
                generalNumber = 1042955; // It's the afternoon
            else if (hours >= 12)
                generalNumber = 1042954; // It's around noon
            else if (hours >= 08)
                generalNumber = 1042953; // It's late in the morning
            else if (hours >= 04)
                generalNumber = 1042952; // It's early in the morning
            else if (hours >= 01)
                generalNumber = 1042951; // It's the middle of the night
            else
                generalNumber = 1042950; // 'Tis the witching hour. 12 Midnight.

            hours %= 12;

            if (hours == 0)
                hours = 12;

            exactTime = String.Format("{0}:{1:D2}", hours, minutes);
        }
 
Looks like this line is modifying the time based on the map index. Remove it.

if (map != null)
totalMinutes += map.MapIndex * 320;
 
Good job, you can refine it down to this:
Code:
if (map != null)
        totalMinutes /= 30;

And
Code:
if (map != null)
        totalMinutes += 320;
 
hugely appreciated and impressive really

my goal though: does modifying this code also modify XMLspawner ' TODmode gametime ' reference?

this is the code stipend in xmlspawner2.cs

Code:
		[CommandProperty(AccessLevel.GameMaster)]
		public TimeSpan TOD
		{
			get
			{
				if (m_TODMode == TODModeType.Gametime)
				{
					int hours;
					int minutes;
					Server.Items.Clock.GetTime(this.Map, Location.X, this.Location.Y, out  hours, out  minutes);
					return (new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, hours, minutes, 0).TimeOfDay);

				}
				else
					return DateTime.UtcNow.TimeOfDay;

			}

		}
it's calling the calculation from item.clock, the object mentioned and modified by this community
 
Last edited:
hugely appreciated and impressive really

my goal though: does modifying this code also modify XMLspawner ' TODmode gametime ' reference?
well if theyre set specifically i dont see how it would change them. all we did here was sync all the clocks to 1 time. i could be wrong.

wouldnt each facets clock regulate each spawner?

E.G.
if a spawner is set at TOD of 12:00 am - 5:00 am and placed in both felucca and trammel. trammel time is 2:00 am, so theyre already spawning. while felucca time is 4:00 pm, so they wouldnt be spawning. so since theyre synced now, they should be coming up at the same time.

please correct me if im wrong anyone, as its mainly a hunch.
 
Last edited:
well if theyre set specifically i dont see how it would change them. all we did here was sync all the clocks to 1 time. i could be wrong.

wouldnt each facets clock regulate each spawner?

thats what im aiming at
but it seems to be working 'flawlessly' -- whether xmlspawner functions that way, we'll see


anyway
I really appreciate the effort!
 
thats what im aiming at
but it seems to be working 'flawlessly' -- whether xmlspawner functions that way, we'll see


anyway
I really appreciate the effort!
actually just rereading it you only wanted felucca and trammel synced correct? this will sync all but this following will only sync fell and tram (not the others).
Code:
        public static MoonPhase GetMoonPhase(Map map, int x, int y)
        {
            int hours, minutes, totalMinutes;

            GetTime(map, x, y, out hours, out minutes, out totalMinutes);

            if (map != null && (map == Map.Felucca || map == Map.Trammel))
                totalMinutes /= 30;
            else if (map != null)
                totalMinutes /= 10 + (map.MapIndex * 20);

            return (MoonPhase)(totalMinutes % 8);
        }

        public static void GetTime(Map map, int x, int y, out int hours, out int minutes)
        {
            int totalMinutes;

            GetTime(map, x, y, out hours, out minutes, out totalMinutes);
        }

        public static void GetTime(Map map, int x, int y, out int hours, out int minutes, out int totalMinutes)
        {
            TimeSpan timeSpan = DateTime.UtcNow - WorldStart;

            totalMinutes = (int)(timeSpan.TotalSeconds / SecondsPerUOMinute);

            if (map != null && (map == Map.Felucca || map == Map.Trammel))
                totalMinutes += 320;
            else if (map != null)
                totalMinutes += map.MapIndex * 320;

            // Really on OSI this must be by subserver
            totalMinutes += x / 16;

            hours = (totalMinutes / 60) % 24;
            minutes = totalMinutes % 60;
        }
sorry about that. i literally only just woke up. XD
this..
Code:
            if (map != null && (map == Map.Felucca || map == Map.Trammel))
                totalMinutes /= 30;
            else if (map != null)
                totalMinutes /= 10 + (map.MapIndex * 20);

and...

Code:
            if (map != null && (map == Map.Felucca || map == Map.Trammel))
                totalMinutes += 320;
            else if (map != null)
                totalMinutes += map.MapIndex * 320;

are the main things.
 
I am fairly certain that most systems use real-time, especially spawners.
They use time-based delays relative to the system clock.

The in-game perception of time as defined by the Clock feature pertains to things like the day and night cycle, but I don't think it's widely used for much else other than role-play.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back