/////////////////////////////////////////////////////////
// Scripted by BKW of Awaken Lands, Future Online Game //
// URL: [url]www.awakenlands.com[/url] //
// © 2004, By Fanatsy World Entertainment //
/////////////////////////////////////////////////////////
/**********PLEASE DO NOT REMOVE THIS HEADER*************/
using System;
using System.Reflection;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Items;
using Server.Mobiles;
using Server.Misc;
using Server.Accounting;
namespace Server.Motd
{
public class Motd : Gump
{
private Mobile m_From;
public Mobile From{ get{ return m_From; } set{ m_From = value; } }
public static int RunUOBeta = 36;
public static double ShardVersion = 1.0;
public static string ToDo = "Showing whats currently in project";
public static string MessageoftheDay = "<text> *Offical Message*";
public static void Initialize()
{
Server.Commands.Register( "UpdateMOTD", AccessLevel.Administrator, new CommandEventHandler( Update_OnCommand ) );
Server.Commands.Register( "MOTD", AccessLevel.Player, new CommandEventHandler( MOTD_OnCommand ) );
EventSink.Login += new LoginEventHandler( EventSink_Login );
}
[Usage( "Message of the Day" )]
[Description( "Shows the Message of the Day" )]
public static void MOTD_OnCommand( CommandEventArgs e )
{
ALPlayerMobile from = e.Mobile as ALPlayerMobile;
e.Mobile.SendGump( new Motd( e.Mobile ) );
}
[Usage( "Updates the MOTD to turn all Mobile's MOTD false to True..." )]
[Description( "Updates the MOTD to turn all Mobile's MOTD false to True..." )]
public static void Update_OnCommand( CommandEventArgs e )
{
ArrayList mobs = new ArrayList( World.Mobiles.Values );
e.Mobile.SendMessage( "You have sent the MOTD throughout the world, and activated it through Login..." );
foreach ( Mobile m in mobs )
{
if ( m.Player )
{
ALPlayerMobile a = m as ALPlayerMobile;
a.MOTD = true;
a.SendGump( new Motd( m ) );
}
}
}
private static void EventSink_Login( LoginEventArgs args )
{
ALPlayerMobile from = args.Mobile as ALPlayerMobile;
if ( from.MOTD != false )
{
args.Mobile.SendGump( new Motd( args.Mobile ) );
}
}
public Motd( Mobile from ) : base( 10, 10 )
{
from.CloseGump( typeof( Motd ) );
int gumpX = 0;
int gumpY = 0;
m_From = from;
Closable = false;
Disposable = false;
Dragable = true;
Resizable = false;
AddPage( 0 );
gumpX = 80; gumpY = 25;
AddBackground( gumpX, gumpY, 450, 400, 0x53 );
gumpX = 315; gumpY = 165;
AddHtml( gumpX, gumpY, 205, 210, String.Format( "<basefont color=#FFFFFF><center>* Things to Do *</center><br><br>{0}</basefont>", ToDo ), false, true );
gumpX = 95; gumpY = 165;
AddHtml( gumpX, gumpY, 205, 210, String.Format( "<basefont color=#FFFFFF><center>* Message of the Day *</center><br><br>{0}<br><br>Thank you,<br>Awaken Lands Staff</basefont>", MessageoftheDay ), false, true );
gumpX = 185; gumpY = 397;
AddLabel( gumpX, gumpY, 40, "© 2004, by Fantasy World Entertainment" );
gumpX = 100; gumpY = 45;
AddImage( gumpX, gumpY, 0x28D2 );
gumpX = 470; gumpY = 45;
AddImage( gumpX, gumpY, 0x28D2 );
gumpX = 220; gumpY = 45;
AddImage( gumpX, gumpY, 0x28D4 );
gumpX = 95; gumpY = 100;
AddHtml( gumpX, gumpY, 420, 20, "<basefont color=#0000FF><center>Awaken Lands Shard</center></basefont>", false, false );
gumpX = 95; gumpY = 125;
AddHtml( gumpX, gumpY, 200, 20, String.Format( "<basefont color=#0000FF><center>Shard Beta: RunUO Beta {0}</center></basefont>", RunUOBeta), false, false );
gumpX = 305; gumpY = 125;
AddHtml( gumpX, gumpY, 200, 20, String.Format( "<basefont color=#0000FF><center>Shard Version: Beta {0}</center></basefont>", ShardVersion ), false, false );
gumpX = 450; gumpY = 380;
AddButton( gumpX, gumpY, 0xFAE, 0xFB0, 0, GumpButtonType.Reply, 0 );
gumpX = 95; gumpY = 380;
AddLabel( gumpX, gumpY, 55, "Press this to close the Message of the Day." );
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
ALPlayerMobile m = from as ALPlayerMobile;
switch( info.ButtonID )
{
case 0:
if ( m.MOTD != false )
{
m.MOTD = false;
m.SendMessage( "To view the MOTD again just do \"[motd\", and for more information on those commands do \"[help\"" );
}
else
{
from.SendMessage( "You close the MOTD." );
}
break;
}
}
}
}