So I was reminiscing about powerhour and how cool it was to have a super gaining duration. I know this script exists on other servers, but no one has publicly released it onto runuo.com or servuo.com; I think, in part, because there are some who believe its not necessary with the GGS in place. However what about those of us who still use Rate Over Time?! Just a thought.
So I did some digging and I came up with these links:
http://www.runuo.com/community/threads/power-hour.95461/#post-801732
http://www.runuo.com/community/threads/runuo-svn-gain-potions.484250/#post-3737580
http://www.runuo.com/community/threads/power-hour.60203/
And remarkable I came up with nothing except a few broken references. So I decided to use the first link (in the list above) and came up with this:
PowerHour.cs
SkillCheck.cs
What I need, and I'm having trouble with, is sending a global message that tells players when powerhour begins and when powerhour ends (with a warning about 5 min before it ends). I've never been too good with timers and I'm not too familiar with DateTime.UtcNow (I don't know which clock that derives from), so I used DateTime.Now which reads off the servers local clock. The commented out portion above is commented because it compiles but it doesn't work; the sound never plays and the messages don't display.
Catch 22: This script may not be useful for everyone, but this is the complete system listed here. It's been tested and it does what is intended; it doubles your skill gain during a specified hour. I'm just asking if anyone wants to help me with my issues above regarding a potential timer/ global message edit, and I'm asking if anyone wants to contribute anything else to this system here on the forum; maybe add a toggle so that the system can be shut on and off. The possibilities are endless
So I did some digging and I came up with these links:
http://www.runuo.com/community/threads/power-hour.95461/#post-801732
http://www.runuo.com/community/threads/runuo-svn-gain-potions.484250/#post-3737580
http://www.runuo.com/community/threads/power-hour.60203/
And remarkable I came up with nothing except a few broken references. So I decided to use the first link (in the list above) and came up with this:
PowerHour.cs
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Server;
using Server.Commands;
using Server.Items;
using Server.Mobiles;
namespace Server.Misc
{
public class PowerHour
{
const int StartTime = 19, EndTime = 20; // Happy Hour from 7:00pm to 8:00pm (clock is in 24hr format)
//public void SendNotification (Mobile from)
//{
// if (DateTime.Now.Hour >= StartTime)
// {
// from.PlaySound(0xFF);
// from.SendMessage("Power Hour is upon us, make haste and hone your skills wisely!");
// //World.Broadcast(0x35, true, "Power Hour is upon us, make haste and hone your skills wisely!");
// }
// else if (DateTime.Now.Hour < EndTime)
// {
// from.PlaySound(0xFE);
// from.SendMessage("Power Hour hath ended!");
// //World.Broadcast(0x35, true, "Power Hour hath ended!");
// }
// else
// {
//
// }
//}
public static bool On
{
get
{
return ((DateTime.Now.Hour >= StartTime) && (DateTime.Now.Hour < EndTime));
}
}
}
}
SkillCheck.cs
Code:
public static void Gain( Mobile from, Skill skill )
{
if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) )
return;
if ( from is BaseCreature && ((BaseCreature)from).IsDeadPet )
return;
if ( skill.SkillName == SkillName.Focus && from is BaseCreature )
return;
if ( skill.Base < skill.Cap && skill.Lock == SkillLock.Up )
{
int toGain = 1;
#region Powerhour Testing
if (PowerHour.On)
{
toGain = toGain * 2;
// Console.WriteLine("This Is Your Total Gain:" + toGain); // Debug
}
else if (!PowerHour.On)
{
toGain = toGain * 1;
// Console.WriteLine("This Is Your Total Gain:" + toGain); // Debug
}
#endregion
if ( skill.Base <= 10.0 )
toGain = Utility.Random( 4 ) + 1;
What I need, and I'm having trouble with, is sending a global message that tells players when powerhour begins and when powerhour ends (with a warning about 5 min before it ends). I've never been too good with timers and I'm not too familiar with DateTime.UtcNow (I don't know which clock that derives from), so I used DateTime.Now which reads off the servers local clock. The commented out portion above is commented because it compiles but it doesn't work; the sound never plays and the messages don't display.
Catch 22: This script may not be useful for everyone, but this is the complete system listed here. It's been tested and it does what is intended; it doubles your skill gain during a specified hour. I'm just asking if anyone wants to help me with my issues above regarding a potential timer/ global message edit, and I'm asking if anyone wants to contribute anything else to this system here on the forum; maybe add a toggle so that the system can be shut on and off. The possibilities are endless