From 2931df9644f5ec3556ef70821cca5f21cf77cbcb Mon Sep 17 00:00:00 2001 From: Xeroxxx Date: Mon, 16 Jan 2017 11:16:51 +0100 Subject: [PATCH 1/3] E-Mail Authentication --- Scripts/Misc/Email.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Scripts/Misc/Email.cs b/Scripts/Misc/Email.cs index f7d428d7a..5fbaf46dd 100644 --- a/Scripts/Misc/Email.cs +++ b/Scripts/Misc/Email.cs @@ -24,7 +24,11 @@ namespace Server.Misc public static readonly string EmailServer = null; public static readonly int EmailPort = 25; + public static readonly string FromAddress = null; + public static readonly string EmailUsername = null; + public static readonly string EmailPassword = null; + public static readonly string CrashAddresses = null; public static readonly string SpeechLogPageAddresses = null; @@ -44,7 +48,13 @@ namespace Server.Misc public static void Configure() { if ( EmailServer != null ) + { _Client = new SmtpClient( EmailServer, EmailPort ); + if ( EmailUsername != null ) + { + _Client.Credentials = new System.Net.NetworkCredential( EmailUsername, EmailPassword ); + } + } } public static bool Send( MailMessage message ) @@ -86,4 +96,4 @@ namespace Server.Misc Console.WriteLine( "Failure sending e-mail '{0}' to '{1}'.", message.Subject, message.To ); } } -} \ No newline at end of file +} From 53d6d8f882573d68647995b355810244e8fc40ec Mon Sep 17 00:00:00 2001 From: Xeroxxx Date: Mon, 16 Jan 2017 11:32:38 +0100 Subject: [PATCH 2/3] Added initial database schema creation --- Scripts/Engines/MyRunUO/MyRunUO.cs | 43 +++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/Scripts/Engines/MyRunUO/MyRunUO.cs b/Scripts/Engines/MyRunUO/MyRunUO.cs index 396287b11..5949ba254 100644 --- a/Scripts/Engines/MyRunUO/MyRunUO.cs +++ b/Scripts/Engines/MyRunUO/MyRunUO.cs @@ -24,6 +24,7 @@ namespace Server.Engines.MyRunUO { Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), Config.CharacterUpdateInterval, new TimerCallback( Begin ) ); + CommandSystem.Register( "InitMyRunUO", AccessLevel.Administrator, new CommandEventHandler( InitMyRunUO_OnCommand ) ); CommandSystem.Register( "UpdateMyRunUO", AccessLevel.Administrator, new CommandEventHandler( UpdateMyRunUO_OnCommand ) ); CommandSystem.Register( "PublicChar", AccessLevel.Player, new CommandEventHandler( PublicChar_OnCommand ) ); @@ -71,6 +72,46 @@ namespace Server.Engines.MyRunUO } } + [Usage( "InitMyRunUO" )] + [Description( "Initally creates the database tables." )] + public static void InitMyRunUO_OnCommand( CommandEventArgs e ) + { + if ( m_Command != null && m_Command.HasCompleted ) + { + TableCreation(); + e.Mobile.SendMessage( "MyRunUO table creation process has been started." ); + } + else + { + e.Mobile.SendMessage( "MyRunUO table creation is already running." ); + } + } + + public static void TableCreation() + { + if ( m_Command != null && !m_Command.HasCompleted ) + return; + DateTime start = DateTime.Now; + Console.WriteLine( "MyRunUO: Creating tables" ); + try + { + m_Command = new DatabaseCommandQueue( "MyRunUO: Tables created in {0:F1} seconds", "MyRunUO Status Database Thread" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters` ( `char_id` int(10) unsigned NOT NULL, `char_name` varchar(255) NOT NULL, `char_str` smallint(3) unsigned NOT NULL, `char_dex` smallint(3) unsigned NOT NULL, `char_int` smallint(3) unsigned NOT NULL, `char_female` tinyint(1) NOT NULL, `char_counts` smallint(6) NOT NULL, `char_guild` varchar(255) DEFAULT NULL, `char_guildtitle` varchar(255) DEFAULT NULL, `char_nototitle` varchar(255) DEFAULT NULL, `char_bodyhue` smallint(5) unsigned DEFAULT NULL, `char_public` tinyint(1) NOT NULL, PRIMARY KEY (`char_id`)) ENGINE=InnoDB" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters_layers` ( `char_id` int(10) unsigned NOT NULL, `layer_id` tinyint(3) unsigned NOT NULL, `item_id` smallint(5) unsigned NOT NULL, `item_hue` smallint(5) unsigned NOT NULL, PRIMARY KEY (`char_id`,`layer_id`)) ENGINE=InnoDB" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters_skills` ( `char_id` int(10) unsigned NOT NULL, `skill_id` tinyint(3) NOT NULL, `skill_value` smallint(5) unsigned NOT NULL, PRIMARY KEY (`char_id`,`skill_id`), KEY `skill_id` (`skill_id`)) ENGINE=InnoDB" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_guilds` ( `guild_id` smallint(5) unsigned NOT NULL, `guild_name` varchar(255) NOT NULL, `guild_abbreviation` varchar(8) DEFAULT NULL, `guild_website` varchar(255) DEFAULT NULL, `guild_charter` varchar(255) DEFAULT NULL, `guild_type` varchar(8) NOT NULL, `guild_wars` smallint(5) unsigned NOT NULL, `guild_members` smallint(5) unsigned NOT NULL, `guild_master` int(10) unsigned NOT NULL, PRIMARY KEY (`guild_id`)) ENGINE=InnoDB " ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_guilds_wars` ( `guild_1` smallint(5) unsigned NOT NULL DEFAULT '0', `guild_2` smallint(5) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`guild_1`,`guild_2`), KEY `guild1` (`guild_1`), KEY `guild2` (`guild_2`)) ENGINE=InnoDB" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_status` ( `char_id` int(10) NOT NULL, PRIMARY KEY (`char_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1" ); + } + catch ( Exception e ) + { + Console.WriteLine( "MyRunUO: Error creating tables" ); + Console.WriteLine( e ); + } + if ( m_Command != null ) + m_Command.Enqueue( null ); + } + [Usage( "UpdateMyRunUO" )] [Description( "Starts the process of updating the MyRunUO character and guild database." )] public static void UpdateMyRunUO_OnCommand( CommandEventArgs e ) @@ -637,4 +678,4 @@ namespace Server.Engines.MyRunUO } } } -} \ No newline at end of file +} From 8f3813b11f48c88983c836fe90324a4fdc52db41 Mon Sep 17 00:00:00 2001 From: Xeroxxx Date: Tue, 17 Jan 2017 15:52:16 +0100 Subject: [PATCH 3/3] Typo & removed Engine=InnoDB --- Scripts/Engines/MyRunUO/MyRunUO.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Scripts/Engines/MyRunUO/MyRunUO.cs b/Scripts/Engines/MyRunUO/MyRunUO.cs index 5949ba254..96cc10d80 100644 --- a/Scripts/Engines/MyRunUO/MyRunUO.cs +++ b/Scripts/Engines/MyRunUO/MyRunUO.cs @@ -73,7 +73,7 @@ namespace Server.Engines.MyRunUO } [Usage( "InitMyRunUO" )] - [Description( "Initally creates the database tables." )] + [Description( "Initially creates the database schema." )] public static void InitMyRunUO_OnCommand( CommandEventArgs e ) { if ( m_Command != null && m_Command.HasCompleted ) @@ -96,16 +96,16 @@ namespace Server.Engines.MyRunUO try { m_Command = new DatabaseCommandQueue( "MyRunUO: Tables created in {0:F1} seconds", "MyRunUO Status Database Thread" ); - m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters` ( `char_id` int(10) unsigned NOT NULL, `char_name` varchar(255) NOT NULL, `char_str` smallint(3) unsigned NOT NULL, `char_dex` smallint(3) unsigned NOT NULL, `char_int` smallint(3) unsigned NOT NULL, `char_female` tinyint(1) NOT NULL, `char_counts` smallint(6) NOT NULL, `char_guild` varchar(255) DEFAULT NULL, `char_guildtitle` varchar(255) DEFAULT NULL, `char_nototitle` varchar(255) DEFAULT NULL, `char_bodyhue` smallint(5) unsigned DEFAULT NULL, `char_public` tinyint(1) NOT NULL, PRIMARY KEY (`char_id`)) ENGINE=InnoDB" ); - m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters_layers` ( `char_id` int(10) unsigned NOT NULL, `layer_id` tinyint(3) unsigned NOT NULL, `item_id` smallint(5) unsigned NOT NULL, `item_hue` smallint(5) unsigned NOT NULL, PRIMARY KEY (`char_id`,`layer_id`)) ENGINE=InnoDB" ); - m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters_skills` ( `char_id` int(10) unsigned NOT NULL, `skill_id` tinyint(3) NOT NULL, `skill_value` smallint(5) unsigned NOT NULL, PRIMARY KEY (`char_id`,`skill_id`), KEY `skill_id` (`skill_id`)) ENGINE=InnoDB" ); - m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_guilds` ( `guild_id` smallint(5) unsigned NOT NULL, `guild_name` varchar(255) NOT NULL, `guild_abbreviation` varchar(8) DEFAULT NULL, `guild_website` varchar(255) DEFAULT NULL, `guild_charter` varchar(255) DEFAULT NULL, `guild_type` varchar(8) NOT NULL, `guild_wars` smallint(5) unsigned NOT NULL, `guild_members` smallint(5) unsigned NOT NULL, `guild_master` int(10) unsigned NOT NULL, PRIMARY KEY (`guild_id`)) ENGINE=InnoDB " ); - m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_guilds_wars` ( `guild_1` smallint(5) unsigned NOT NULL DEFAULT '0', `guild_2` smallint(5) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`guild_1`,`guild_2`), KEY `guild1` (`guild_1`), KEY `guild2` (`guild_2`)) ENGINE=InnoDB" ); - m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_status` ( `char_id` int(10) NOT NULL, PRIMARY KEY (`char_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters` ( `char_id` int(10) unsigned NOT NULL, `char_name` varchar(255) NOT NULL, `char_str` smallint(3) unsigned NOT NULL, `char_dex` smallint(3) unsigned NOT NULL, `char_int` smallint(3) unsigned NOT NULL, `char_female` tinyint(1) NOT NULL, `char_counts` smallint(6) NOT NULL, `char_guild` varchar(255) DEFAULT NULL, `char_guildtitle` varchar(255) DEFAULT NULL, `char_nototitle` varchar(255) DEFAULT NULL, `char_bodyhue` smallint(5) unsigned DEFAULT NULL, `char_public` tinyint(1) NOT NULL, PRIMARY KEY (`char_id`))" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters_layers` ( `char_id` int(10) unsigned NOT NULL, `layer_id` tinyint(3) unsigned NOT NULL, `item_id` smallint(5) unsigned NOT NULL, `item_hue` smallint(5) unsigned NOT NULL, PRIMARY KEY (`char_id`,`layer_id`))" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_characters_skills` ( `char_id` int(10) unsigned NOT NULL, `skill_id` tinyint(3) NOT NULL, `skill_value` smallint(5) unsigned NOT NULL, PRIMARY KEY (`char_id`,`skill_id`), KEY `skill_id` (`skill_id`))" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_guilds` ( `guild_id` smallint(5) unsigned NOT NULL, `guild_name` varchar(255) NOT NULL, `guild_abbreviation` varchar(8) DEFAULT NULL, `guild_website` varchar(255) DEFAULT NULL, `guild_charter` varchar(255) DEFAULT NULL, `guild_type` varchar(8) NOT NULL, `guild_wars` smallint(5) unsigned NOT NULL, `guild_members` smallint(5) unsigned NOT NULL, `guild_master` int(10) unsigned NOT NULL, PRIMARY KEY (`guild_id`))" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_guilds_wars` ( `guild_1` smallint(5) unsigned NOT NULL DEFAULT '0', `guild_2` smallint(5) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`guild_1`,`guild_2`), KEY `guild1` (`guild_1`), KEY `guild2` (`guild_2`))" ); + m_Command.Enqueue( "CREATE TABLE IF NOT EXISTS `myrunuo_status` ( `char_id` int(10) NOT NULL, PRIMARY KEY (`char_id`))" ); } catch ( Exception e ) { - Console.WriteLine( "MyRunUO: Error creating tables" ); + Console.WriteLine( "MyRunUO: Error creating tables." ); Console.WriteLine( e ); } if ( m_Command != null )