Equals() public static method

public static Equals ( string a, string b ) : bool
a string
b string
return bool
Esempio n. 1
0
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.ProcessExit        += new EventHandler(CurrentDomain_ProcessExit);

            for (int i = 0; i < args.Length; ++i)
            {
                if (Insensitive.Equals(args[i], "-debug"))
                {
                    m_Debug = true;
                }
                else if (Insensitive.Equals(args[i], "-service"))
                {
                    m_Service = true;
                }
                else if (Insensitive.Equals(args[i], "-profile"))
                {
                    Profiling = true;
                }
                else if (Insensitive.Equals(args[i], "-nocache"))
                {
                    m_Cache = false;
                }
                else if (Insensitive.Equals(args[i], "-haltonwarning"))
                {
                    m_HaltOnWarning = true;
                }
                else if (Insensitive.Equals(args[i], "-vb"))
                {
                    m_VBdotNET = true;
                }
            }

            try
            {
                if (m_Service)
                {
                    if (!Directory.Exists("Logs"))
                    {
                        Directory.CreateDirectory("Logs");
                    }

                    Console.SetOut(m_MultiConOut = new MultiTextWriter(new FileLogger("Logs/Console.log")));
                }
                else
                {
                    Console.SetOut(m_MultiConOut = new MultiTextWriter(Console.Out));
                }
            }
            catch
            {
            }

            m_Thread   = Thread.CurrentThread;
            m_Process  = Process.GetCurrentProcess();
            m_Assembly = Assembly.GetEntryAssembly();

            if (m_Thread != null)
            {
                m_Thread.Name = "Core Thread";
            }

            if (BaseDirectory.Length > 0)
            {
                Directory.SetCurrentDirectory(BaseDirectory);
            }

            Timer.TimerThread ttObj = new Timer.TimerThread();
            timerThread      = new Thread(new ThreadStart(ttObj.TimerMain));
            timerThread.Name = "Timer Thread";

            Version ver = m_Assembly.GetName().Version;

            // Added to help future code support on forums, as a 'check' people can ask for to it see if they recompiled core or not
            Console.WriteLine("RunUO - [www.runuo.com] Version {0}.{1}, Build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
            Console.WriteLine("Core: Running on .NET Framework Version {0}.{1}.{2}", Environment.Version.Major, Environment.Version.Minor, Environment.Version.Build);

            string s = Arguments;

            if (s.Length > 0)
            {
                Console.WriteLine("Core: Running with arguments: {0}", s);
            }

            m_ProcessorCount = Environment.ProcessorCount;

            if (m_ProcessorCount > 1)
            {
                m_MultiProcessor = true;
            }

            if (m_MultiProcessor || Is64Bit)
            {
                Console.WriteLine("Core: Optimizing for {0} {2}processor{1}", m_ProcessorCount, m_ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "");
            }

            int platform = (int)Environment.OSVersion.Platform;

            if (platform == 4 || platform == 128)                // MS 4, MONO 128
            {
                m_Unix = true;
                Console.WriteLine("Core: Unix environment detected");
            }
            else
            {
                m_ConsoleEventHandler = new ConsoleEventHandler(OnConsoleEvent);
                SetConsoleCtrlHandler(m_ConsoleEventHandler, true);
            }

            if (GCSettings.IsServerGC)
            {
                Console.WriteLine("Core: Server garbage collection mode enabled");
            }

            while (!ScriptCompiler.Compile(m_Debug, m_Cache))
            {
                Console.WriteLine("Scripts: One or more scripts failed to compile or no script files were found.");

                if (m_Service)
                {
                    return;
                }

                Console.WriteLine(" - Press return to exit, or R to try again.");

                if (Console.ReadKey(true).Key != ConsoleKey.R)
                {
                    return;
                }
            }

            ScriptCompiler.Invoke("Configure");

            Region.Load();
            World.Load();

            ScriptCompiler.Invoke("Initialize");

            MessagePump ms = m_MessagePump = new MessagePump();

            timerThread.Start();

            for (int i = 0; i < Map.AllMaps.Count; ++i)
            {
                Map.AllMaps[i].Tiles.Force();
            }

            NetState.Initialize();

            EventSink.InvokeServerStarted();

            try
            {
                DateTime now, last = DateTime.Now;

                const int   sampleInterval = 100;
                const float ticksPerSecond = (float)(TimeSpan.TicksPerSecond * sampleInterval);

                long sample = 0;

                while (m_Signal.WaitOne())
                {
                    Mobile.ProcessDeltaQueue();
                    Item.ProcessDeltaQueue();

                    Timer.Slice();
                    m_MessagePump.Slice();

                    NetState.FlushAll();
                    NetState.ProcessDisposedQueue();

                    if (Slice != null)
                    {
                        Slice();
                    }

                    if ((++sample % sampleInterval) == 0)
                    {
                        now = DateTime.Now;
                        m_CyclesPerSecond[m_CycleIndex++ % m_CyclesPerSecond.Length] =
                            ticksPerSecond / (now.Ticks - last.Ticks);
                        last = now;
                    }
                }
            }
            catch (Exception e)
            {
                CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(e, true));
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            AppDomain.CurrentDomain.ProcessExit        += CurrentDomain_ProcessExit;

            foreach (string a in args)
            {
                if (Insensitive.Equals(a, "-debug"))
                {
                    Debug = true;
                }
                else if (Insensitive.Equals(a, "-service"))
                {
                    Service = true;
                }
                else if (Insensitive.Equals(a, "-profile"))
                {
                    Profiling = true;
                }
                else if (Insensitive.Equals(a, "-nocache"))
                {
                    _Cache = false;
                }
                else if (Insensitive.Equals(a, "-haltonwarning"))
                {
                    HaltOnWarning = true;
                }
                else if (Insensitive.Equals(a, "-vb"))
                {
                    VBdotNet = true;
                }
                else if (Insensitive.Equals(a, "-usehrt"))
                {
                    _UseHRT = true;
                }
                else if (Insensitive.Equals(a, "-noconsole"))
                {
                    NoConsole = true;
                }
            }

            if (!Environment.UserInteractive || Service)
            {
                NoConsole = true;
            }

            try
            {
                if (Service)
                {
                    if (!Directory.Exists("Logs"))
                    {
                        Directory.CreateDirectory("Logs");
                    }

                    Console.SetOut(MultiConsoleOut = new MultiTextWriter(new FileLogger("Logs/Console.log")));
                }
                else
                {
                    Console.SetOut(MultiConsoleOut = new MultiTextWriter(Console.Out));
                }
            }
            catch
            { }

            Thread   = Thread.CurrentThread;
            Process  = Process.GetCurrentProcess();
            Assembly = Assembly.GetEntryAssembly();

            if (Thread != null)
            {
                Thread.Name = "Core Thread";
            }

            if (BaseDirectory.Length > 0)
            {
                Directory.SetCurrentDirectory(BaseDirectory);
            }

            Timer.TimerThread ttObj = new Timer.TimerThread();

            _TimerThread = new Thread(ttObj.TimerMain)
            {
                Name = "Timer Thread"
            };

            Version ver = Assembly.GetName().Version;

            // Added to help future code support on forums, as a 'check' people can ask for to it see if they recompiled core or not
            Utility.PushColor(ConsoleColor.DarkGreen);
            if (!NoConsole)
            {
                Console.WriteLine(new String('-', Console.BufferWidth));
            }
            else
            {
                Console.WriteLine(new String('-', 10));
            }
            Utility.PopColor();
            Utility.PushColor(ConsoleColor.Cyan);
            Console.WriteLine(
                "ServUO - [https://www.servuo.com] Version {0}.{1}, Build {2}.{3}",
                ver.Major,
                ver.Minor,
                ver.Build,
                ver.Revision);
            Utility.PopColor();

            string s = Arguments;

            if (s.Length > 0)
            {
                Utility.PushColor(ConsoleColor.Yellow);
                Console.WriteLine("Core: Running with arguments: {0}", s);
                Utility.PopColor();
            }

            ProcessorCount = Environment.ProcessorCount;

            if (ProcessorCount > 1)
            {
                MultiProcessor = true;
            }

            if (MultiProcessor || Is64Bit)
            {
                Utility.PushColor(ConsoleColor.Green);
                Console.WriteLine(
                    "Core: Optimizing for {0} {2}processor{1}",
                    ProcessorCount,
                    ProcessorCount == 1 ? "" : "s",
                    Is64Bit ? "64-bit " : "");
                Utility.PopColor();
            }

            int platform = (int)Environment.OSVersion.Platform;

            if (platform == 4 || platform == 128)
            {
                // MS 4, MONO 128
                Unix = true;
                Utility.PushColor(ConsoleColor.Yellow);
                Console.WriteLine("Core: Unix environment detected");
                Utility.PopColor();
            }
            else
            {
                m_ConsoleEventHandler = OnConsoleEvent;
                UnsafeNativeMethods.SetConsoleCtrlHandler(m_ConsoleEventHandler, true);
            }

            if (GCSettings.IsServerGC)
            {
                Utility.PushColor(ConsoleColor.DarkYellow);
                Console.WriteLine("Core: Server garbage collection mode enabled");
                Utility.PopColor();
            }

            if (_UseHRT)
            {
                Utility.PushColor(ConsoleColor.DarkYellow);
                Console.WriteLine(
                    "Core: Requested high resolution timing ({0})",
                    UsingHighResolutionTiming ? "Supported" : "Unsupported");
                Utility.PopColor();
            }

            Utility.PushColor(ConsoleColor.DarkYellow);
            Console.WriteLine("RandomImpl: {0} ({1})", RandomImpl.Type.Name, RandomImpl.IsHardwareRNG ? "Hardware" : "Software");
            Utility.PopColor();

            Utility.PushColor(ConsoleColor.DarkYellow);
            Console.WriteLine("Core: Loading config...");
            Config.Load();
            Utility.PopColor();

            while (!ScriptCompiler.Compile(Debug, _Cache))
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("Scripts: One or more scripts failed to compile or no script files were found.");
                Utility.PopColor();

                if (Service)
                {
                    return;
                }

                Console.WriteLine(" - Press return to exit, or R to try again.");

                if (Insensitive.Equals(Console.ReadLine(), "R"))
                {
                    return;
                }
            }

            ScriptCompiler.Invoke("Configure");

            Region.Load();
            World.Load();

            ScriptCompiler.Invoke("Initialize");

            MessagePump messagePump = MessagePump = new MessagePump();

            _TimerThread.Start();

            foreach (Map m in Map.AllMaps)
            {
                m.Tiles.Force();
            }

            NetState.Initialize();

            EventSink.InvokeServerStarted();

            try
            {
                long now, last = TickCount;

                const int   sampleInterval = 100;
                const float ticksPerSecond = 1000.0f * sampleInterval;

                long sample = 0;

                while (!Closing)
                {
                    _Signal.WaitOne();

                    Mobile.ProcessDeltaQueue();
                    Item.ProcessDeltaQueue();

                    Timer.Slice();
                    messagePump.Slice();

                    NetState.FlushAll();
                    NetState.ProcessDisposedQueue();

                    if (Slice != null)
                    {
                        Slice();
                    }

                    if (sample++ % sampleInterval != 0)
                    {
                        continue;
                    }

                    now = TickCount;
                    _CyclesPerSecond[_CycleIndex++ % _CyclesPerSecond.Length] = ticksPerSecond / (now - last);
                    last = now;
                }
            }
            catch (Exception e)
            {
                CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(e, true));
            }
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            AppDomain.CurrentDomain.ProcessExit        += CurrentDomain_ProcessExit;

            for (int i = 0; i < args.Length; ++i)
            {
                if (Insensitive.Equals(args[i], "-debug"))
                {
                    m_Debug = true;
                }
                else if (Insensitive.Equals(args[i], "-service"))
                {
                    m_Service = true;
                }
                else if (Insensitive.Equals(args[i], "-profile"))
                {
                    Profiling = true;
                }
                else if (Insensitive.Equals(args[i], "-nocache"))
                {
                    m_Cache = false;
                }
                else if (Insensitive.Equals(args[i], "-haltonwarning"))
                {
                    m_HaltOnWarning = true;
                }
                else if (Insensitive.Equals(args[i], "-vb"))
                {
                    m_VBdotNET = true;
                }
            }

            try
            {
                if (m_Service)
                {
                    if (!Directory.Exists("Logs"))
                    {
                        Directory.CreateDirectory("Logs");
                    }

                    Console.SetOut(m_MultiConOut = new MultiTextWriter(new FileLogger("Logs/Console.log")));
                }
                else
                {
                    Console.SetOut(m_MultiConOut = new MultiTextWriter(Console.Out));
                }
            }
            catch
            { }

            m_Thread   = Thread.CurrentThread;
            m_Process  = Process.GetCurrentProcess();
            m_Assembly = Assembly.GetEntryAssembly();

            if (m_Thread != null)
            {
                m_Thread.Name = "Core Thread";
            }

            if (BaseDirectory.Length > 0)
            {
                Directory.SetCurrentDirectory(BaseDirectory);
            }

            Timer.TimerThread ttObj = new Timer.TimerThread();
            timerThread      = new Thread(ttObj.TimerMain);
            timerThread.Name = "Timer Thread";

            Version ver = m_Assembly.GetName().Version;

            String publishNumber = "";

            if (File.Exists("publish.txt"))
            {
                try
                {
                    FileStream   fs = new FileStream("publish.txt", FileMode.Open, FileAccess.Read, FileShare.Read);
                    StreamReader sr = new StreamReader(fs);

                    publishNumber = sr.ReadLine();

                    sr.Close();
                    fs.Close();
                }
                catch
                { }
            }

            // Added to help future code support on forums, as a 'check' people can ask for to it see if they recompiled core or not
            Utility.PushColor(ConsoleColor.DarkGreen);
            Console.WriteLine(@"----------------------------------------------------------------------------");
            Utility.PopColor();
            Utility.PushColor(ConsoleColor.Cyan);
            Console.WriteLine(
                "ServUO - [http://www.servuo.com] Version {0}.{1}, Build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
            Console.WriteLine("Publish {0}", publishNumber);
            Utility.PopColor();

            string s = Arguments;

            if (s.Length > 0)
            {
                Utility.PushColor(ConsoleColor.Yellow);
                Console.WriteLine("Core: Running with arguments: {0}", s);
                Utility.PopColor();
            }

            m_ProcessorCount = Environment.ProcessorCount;

            if (m_ProcessorCount > 1)
            {
                m_MultiProcessor = true;
            }

            if (m_MultiProcessor || Is64Bit)
            {
                Utility.PushColor(ConsoleColor.Green);
                Console.WriteLine(
                    "Core: Optimizing for {0} {2}processor{1}",
                    m_ProcessorCount,
                    m_ProcessorCount == 1 ? "" : "s",
                    Is64Bit ? "64-bit " : "");
                Utility.PopColor();
            }

            int platform = (int)Environment.OSVersion.Platform;

            if (platform == 4 || platform == 128)
            {
                // MS 4, MONO 128
                m_Unix = true;
                Utility.PushColor(ConsoleColor.Yellow);
                Console.WriteLine("Core: Unix environment detected");
                Utility.PopColor();
            }
            else
            {
                m_ConsoleEventHandler = OnConsoleEvent;
                UnsafeNativeMethods.SetConsoleCtrlHandler(m_ConsoleEventHandler, true);
            }

            if (GCSettings.IsServerGC)
            {
                Utility.PushColor(ConsoleColor.DarkYellow);
                Console.WriteLine("Core: Server garbage collection mode enabled");
                Utility.PopColor();
            }

            Console.WriteLine("RandomImpl: {0} ({1})", RandomImpl.Type.Name, RandomImpl.IsHardwareRNG ? "Hardware" : "Software");

            _OpenUOSDK = new OpenUOSDK();

            while (!ScriptCompiler.Compile(m_Debug, m_Cache))
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("Scripts: One or more scripts failed to compile or no script files were found.");
                Utility.PopColor();

                if (m_Service)
                {
                    return;
                }

                Console.WriteLine(" - Press return to exit, or R to try again.");

                if (Console.ReadKey(true).Key != ConsoleKey.R)
                {
                    return;
                }
            }

            ScriptCompiler.Invoke("Configure");

            Region.Load();
            World.Load();

            ScriptCompiler.Invoke("Initialize");

            MessagePump messagePump = m_MessagePump = new MessagePump();

            timerThread.Start();

            for (int i = 0; i < Map.AllMaps.Count; ++i)
            {
                Map.AllMaps[i].Tiles.Force();
            }

            NetState.Initialize();

            EventSink.InvokeServerStarted();

            try
            {
                long now, last = TickCount;

                const int   sampleInterval = 100;
                const float ticksPerSecond = (float)(1000 * sampleInterval);

                long sample = 0;

                while (!m_Closing)
                {
                    m_Signal.WaitOne();

                    Mobile.ProcessDeltaQueue();
                    Item.ProcessDeltaQueue();

                    Timer.Slice();
                    messagePump.Slice();

                    NetState.FlushAll();
                    NetState.ProcessDisposedQueue();

                    if (Slice != null)
                    {
                        Slice();
                    }

                    if ((++sample % sampleInterval) == 0)
                    {
                        now = TickCount;
                        m_CyclesPerSecond[m_CycleIndex++ % m_CyclesPerSecond.Length] = ticksPerSecond / (now - last);
                        last = now;
                    }
                }
            }
            catch (Exception e)
            {
                CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(e, true));
            }
        }
Esempio n. 4
0
        public static void Main(string[] args)
        {
#if DEBUG
            Debug = true;
#endif

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            AppDomain.CurrentDomain.ProcessExit        += CurrentDomain_ProcessExit;

            foreach (string a in args)
            {
                if (Insensitive.Equals(a, "-debug"))
                {
                    Debug = true;
                }
                else if (Insensitive.Equals(a, "-service"))
                {
                    Service = true;
                }
                else if (Insensitive.Equals(a, "-profile"))
                {
                    Profiling = true;
                }
                else if (Insensitive.Equals(a, "-nocache"))
                {
                    _Cache = false;
                }
                else if (Insensitive.Equals(a, "-haltonwarning"))
                {
                    HaltOnWarning = true;
                }
                else if (Insensitive.Equals(a, "-vb"))
                {
                    VBdotNet = true;
                }
                else if (Insensitive.Equals(a, "-usehrt"))
                {
                    _UseHRT = true;
                }
                else if (Insensitive.Equals(a, "-noconsole"))
                {
                    NoConsole = true;
                }
                else if (Insensitive.Equals(a, "-h") || Insensitive.Equals(a, "-help"))
                {
                    Console.WriteLine("An Ultima Online server emulator written in C# - Visit https://www.servuo.com for more information.\n\n");
                    Console.WriteLine(System.AppDomain.CurrentDomain.FriendlyName + " [Parameter]\n\n");
                    Console.WriteLine("     -debug              Starting ServUO in Debug Mode. Debug Mode is being used in Core and Scripts to give extended inforamtion during runtime.");
                    Console.WriteLine("     -haltonwarning      ServUO halts if any warning is raised during compilation of scripts.");
                    Console.WriteLine("     -h or -help         Displays this help text.");
                    Console.WriteLine("     -nocache            No known effect.");
                    Console.WriteLine("     -noconsole          No user interaction during startup and runtime.");
                    Console.WriteLine("     -profile            Enables profiling allowing to get performance diagnostic information of packets, timers etc. in AdminGump -> Maintenance. Use with caution. This increases server load.");
                    Console.WriteLine("     -service            This parameter should be set if you're running ServUO as a Windows Service. No user interaction. *Windows only*");
                    Console.WriteLine("     -usehrt             Enables High Resolution Timing if requirements are met. Increasing the resolution of the timer. *Windows only*");
                    Console.WriteLine("     -vb                 Enables compilation of VB.NET Scripts. Without this option VB.NET Scripts are skipped.");

                    System.Environment.Exit(0);
                }
            }

            if (!Environment.UserInteractive || Service)
            {
                NoConsole = true;
            }

            try
            {
                if (Service)
                {
                    if (!Directory.Exists("Logs"))
                    {
                        Directory.CreateDirectory("Logs");
                    }

                    Console.SetOut(MultiConsoleOut = new MultiTextWriter(new FileLogger("Logs/Console.log")));
                }
                else
                {
                    Console.SetOut(MultiConsoleOut = new MultiTextWriter(Console.Out));
                }
            }
            catch (Exception e)
            {
                Server.Diagnostics.ExceptionLogging.LogException(e);
            }

            Thread   = Thread.CurrentThread;
            Process  = Process.GetCurrentProcess();
            Assembly = Assembly.GetEntryAssembly();

            if (Thread != null)
            {
                Thread.Name = "Core Thread";
            }

            if (BaseDirectory.Length > 0)
            {
                Directory.SetCurrentDirectory(BaseDirectory);
            }

            Timer.TimerThread ttObj = new Timer.TimerThread();

            _TimerThread = new Thread(ttObj.TimerMain)
            {
                Name = "Timer Thread"
            };

            Version  ver       = Assembly.GetName().Version;
            DateTime buildDate = new DateTime(2000, 1, 1).AddDays(ver.Build).AddSeconds(ver.Revision * 2);

            Utility.PushColor(ConsoleColor.Cyan);
#if DEBUG
            Console.WriteLine(
                "ServUO - [https://www.servuo.com] Version {0}.{1}, Build {2}.{3} - Build on {4} UTC - Debug",
                ver.Major,
                ver.Minor,
                ver.Build,
                ver.Revision,
                buildDate);
#else
            Console.WriteLine(
                "ServUO - [https://www.servuo.com] Version {0}.{1}, Build {2}.{3} - Build on {4} UTC - Release",
                ver.Major,
                ver.Minor,
                ver.Build,
                ver.Revision,
                buildDate);
#endif
            Utility.PopColor();

            string s = Arguments;

            if (s.Length > 0)
            {
                Utility.PushColor(ConsoleColor.Yellow);
                Console.WriteLine("Core: Running with arguments: {0}", s);
                Utility.PopColor();
            }

            ProcessorCount = Environment.ProcessorCount;

            if (ProcessorCount > 1)
            {
                MultiProcessor = true;
            }

            if (MultiProcessor || Is64Bit)
            {
                Utility.PushColor(ConsoleColor.Green);
                Console.WriteLine(
                    "Core: Optimizing for {0} {2}processor{1}",
                    ProcessorCount,
                    ProcessorCount == 1 ? "" : "s",
                    Is64Bit ? "64-bit " : "");
                Utility.PopColor();
            }

            string dotnet = null;

            if (Type.GetType("Mono.Runtime") != null)
            {
                MethodInfo displayName = Type.GetType("Mono.Runtime").GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);

                if (displayName != null)
                {
                    dotnet = displayName.Invoke(null, null).ToString();

                    Utility.PushColor(ConsoleColor.Yellow);
                    Console.WriteLine("Core: Unix environment detected");
                    Utility.PopColor();

                    Unix = true;
                }
            }
            else
            {
                m_ConsoleEventHandler = OnConsoleEvent;
                UnsafeNativeMethods.SetConsoleCtrlHandler(m_ConsoleEventHandler, true);
            }

#if NETFX_472
            dotnet = "4.7.2";
#endif

#if NETFX_48
            dotnet = "4.8";
#endif

            if (String.IsNullOrEmpty(dotnet))
            {
                dotnet = "MONO/CSC/Unknown";
            }

            Utility.PushColor(ConsoleColor.Green);
            Console.WriteLine("Core: Compiled for " + (Unix ? "MONO and running on {0}" : ".NET {0}"), dotnet);
            Utility.PopColor();

            if (GCSettings.IsServerGC)
            {
                Utility.PushColor(ConsoleColor.Green);
                Console.WriteLine("Core: Server garbage collection mode enabled");
                Utility.PopColor();
            }

            if (_UseHRT)
            {
                Utility.PushColor(ConsoleColor.DarkYellow);
                Console.WriteLine(
                    "Core: Requested high resolution timing ({0})",
                    UsingHighResolutionTiming ? "Supported" : "Unsupported");
                Utility.PopColor();
            }

            Utility.PushColor(ConsoleColor.DarkYellow);
            Console.WriteLine("RandomImpl: {0} ({1})", RandomImpl.Type.Name, RandomImpl.IsHardwareRNG ? "Hardware" : "Software");
            Utility.PopColor();

            Utility.PushColor(ConsoleColor.Green);
            Console.WriteLine("Core: Loading config...");
            Config.Load();
            Utility.PopColor();

            while (!ScriptCompiler.Compile(Debug, _Cache))
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("Scripts: One or more scripts failed to compile or no script files were found.");
                Utility.PopColor();

                if (Service)
                {
                    return;
                }

                Console.WriteLine(" - Press return to exit, or R to try again.");

                if (Console.ReadKey(true).Key != ConsoleKey.R)
                {
                    return;
                }
            }

            ScriptCompiler.Invoke("Configure");

            Region.Load();
            World.Load();

            ScriptCompiler.Invoke("Initialize");

            MessagePump messagePump = MessagePump = new MessagePump();

            _TimerThread.Start();

            foreach (Map m in Map.AllMaps)
            {
                m.Tiles.Force();
            }

            NetState.Initialize();

            EventSink.InvokeServerStarted();

            try
            {
                long now, last = TickCount;

                const int   sampleInterval = 100;
                const float ticksPerSecond = 1000.0f * sampleInterval;

                long sample = 0;

                while (!Closing)
                {
                    _Signal.WaitOne();

                    Mobile.ProcessDeltaQueue();
                    Item.ProcessDeltaQueue();

                    Timer.Slice();
                    messagePump.Slice();

                    NetState.FlushAll();
                    NetState.ProcessDisposedQueue();

                    if (Slice != null)
                    {
                        Slice();
                    }

                    if (sample++ % sampleInterval != 0)
                    {
                        continue;
                    }

                    now = TickCount;
                    _CyclesPerSecond[_CycleIndex++ % _CyclesPerSecond.Length] = ticksPerSecond / (now - last);
                    last = now;
                }
            }
            catch (Exception e)
            {
                CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(e, true));
            }
        }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            m_Assembly = Assembly.GetEntryAssembly();

            /* print a banner */
            Version ver = m_Assembly.GetName().Version;

            Console.WriteLine("SunUO Version {0}.{1}.{2} http://max.kellermann.name/projects/sunuo/",
                              ver.Major, ver.Minor, ver.Revision);
            Console.WriteLine("  on {0}, runtime {1}",
                              Environment.OSVersion, Environment.Version);

            if ((int)Environment.OSVersion.Platform == 128)
            {
                Console.WriteLine("Please make sure you have Mono 1.1.7 or newer! (mono -V)");
            }

            Console.WriteLine();

            /* prepare SunUO */
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.ProcessExit        += new EventHandler(CurrentDomain_ProcessExit);

            bool debug = false;

            for (int i = 0; i < args.Length; ++i)
            {
                if (Insensitive.Equals(args[i], "-debug"))
                {
                    debug = true;
                }
                else if (Insensitive.Equals(args[i], "-service"))
                {
                    m_Service = true;
                }
                else if (Insensitive.Equals(args[i], "-profile"))
                {
                    Profiling = true;
                }
            }

            config = new Config(Path.Combine(BaseDirectoryInfo.CreateSubdirectory("etc").FullName, "sunuo.xml"));

            try
            {
                m_MultiConOut = new MultiTextWriter(Console.Out);
                Console.SetOut(m_MultiConOut);

                if (m_Service)
                {
                    string filename = Path.Combine(LogDirectoryInfo.FullName, "console.log");
                    m_MultiConOut.Add(new FileLogger(filename));
                }
            }
            catch
            {
            }

            m_Thread  = Thread.CurrentThread;
            m_Process = Process.GetCurrentProcess();

            if (m_Thread != null)
            {
                m_Thread.Name = "Core Thread";
            }

            if (BaseDirectory.Length > 0)
            {
                Directory.SetCurrentDirectory(BaseDirectory);
            }

            Timer.TimerThread ttObj = new Timer.TimerThread();
            timerThread      = new Thread(new ThreadStart(ttObj.TimerMain));
            timerThread.Name = "Timer Thread";

            if (!ScriptCompiler.Compile(debug))
            {
                return;
            }

            Console.Write("Verifying scripts:");
            m_ItemCount   = 0;
            m_MobileCount = 0;
            foreach (Library l in ScriptCompiler.Libraries)
            {
                int itemCount = 0, mobileCount = 0;
                Console.Write(" {0}[", l.Name);
                l.Verify(ref itemCount, ref mobileCount);
                Console.Write("{0} items, {1} mobiles]", itemCount, mobileCount);
                m_ItemCount   += itemCount;
                m_MobileCount += mobileCount;
            }
            Console.WriteLine(" - done ({0} items, {1} mobiles)", m_ItemCount, m_MobileCount);

            try {
                ScriptCompiler.Configure();
            } catch (TargetInvocationException e) {
                Console.WriteLine("Configure exception: {0}", e.InnerException);
                return;
            }

            config.Save();

            World.Load();

            try {
                ScriptCompiler.Initialize();
            } catch (TargetInvocationException e) {
                Console.WriteLine("Initialize exception: {0}", e.InnerException);
                return;
            }

            Region.Load();

            m_MessagePump = new MessagePump(new Listener(Listener.Port));

            timerThread.Start();

            NetState.Initialize();

            EventSink.InvokeServerStarted();

            try
            {
                while (!m_Closing)
                {
                    Thread.Sleep(1);

                    Mobile.ProcessDeltaQueue();
                    Item.ProcessDeltaQueue();

                    Timer.Slice();
                    m_MessagePump.Slice();

                    NetState.FlushAll();
                    NetState.ProcessDisposedQueue();

                    if (Slice != null)
                    {
                        Slice();
                    }
                }
            }
            catch (Exception e)
            {
                CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(e, true));
            }

            if (timerThread.IsAlive)
            {
                timerThread.Abort();
            }
        }
Esempio n. 6
0
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.ProcessExit        += new EventHandler(CurrentDomain_ProcessExit);

            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.Title = "UO Aberration : Core";

            for (int i = 0; i < args.Length; ++i)
            {
                if (Insensitive.Equals(args[i], "-debug"))
                {
                    m_Debug = true;
                }
                else if (Insensitive.Equals(args[i], "-service"))
                {
                    m_Service = true;
                }
                else if (Insensitive.Equals(args[i], "-profile"))
                {
                    Profiling = true;
                }
                else if (Insensitive.Equals(args[i], "-nocache"))
                {
                    m_Cache = false;
                }
                else if (Insensitive.Equals(args[i], "-haltonwarning"))
                {
                    m_HaltOnWarning = true;
                }
            }

            try
            {
                if (m_Service)
                {
                    if (!Directory.Exists("Logs"))
                    {
                        Directory.CreateDirectory("Logs");
                    }

                    Console.SetOut(m_MultiConOut = new MultiTextWriter(new FileLogger("Logs/Console.log")));
                }

                else
                {
                    Console.SetOut(m_MultiConOut = new MultiTextWriter(Console.Out));
                }
            }

            catch                   {                       }

            m_Thread   = Thread.CurrentThread;
            m_Process  = Process.GetCurrentProcess();
            m_Assembly = Assembly.GetEntryAssembly();

            if (m_Thread != null)
            {
                m_Thread.Name = "Core Thread";
            }

            if (BaseDirectory.Length > 0)
            {
                Directory.SetCurrentDirectory(BaseDirectory);
            }

            Timer.TimerThread ttObj = new Timer.TimerThread();
            timerThread      = new Thread(new ThreadStart(ttObj.TimerMain));
            timerThread.Name = "Timer Thread";

            Version ver = m_Assembly.GetName().Version;

            /*
             * ServUO's Original Code
             * if (File.Exists("publish.txt"))
             * {
             *  try
             *  {
             *      FileStream fs = new FileStream("publish.txt", FileMode.Open, FileAccess.Read, FileShare.Read);
             *      StreamReader sr = new StreamReader(fs);
             *
             *      publishNumber = sr.ReadLine();
             *
             *      sr.Close();
             *      fs.Close();
             *  }
             *  catch
             *  { }
             * }*/
            //Concept Expanded based upon ServUO's publish number.

            string       header       = "";
            ConsoleColor desiredColor = ConsoleColor.White;

            if (File.Exists("header.txt"))
            {
                bool chopColor = false;

                try
                {
                    FileStream   file   = new FileStream("header.txt", FileMode.Open, FileAccess.Read, FileShare.Read);
                    StreamReader reader = new StreamReader(file);

                    string determineTextColor = (string)(reader.ReadLine().Trim().ToLower());

                    if (Enum.TryParse <ConsoleColor>(determineTextColor, true, out desiredColor))
                    {
                        chopColor = true;
                    }

                    else
                    {
                        Utility.PushColor(ConsoleColor.White);
                    }

                    if (chopColor)
                    {
                        header = (string)(reader.ReadToEnd());
                    }

                    file.Close();
                    reader.Close();

                    file.Dispose();
                    reader.Dispose();
                }

                catch
                {
                    Utility.PushColor(ConsoleColor.Red);
                    Console.Write("Error: ");
                    Utility.PushColor(ConsoleColor.White);
                    Console.WriteLine("Your are either missing header.txt or it is misconfigured.");
                }
            }

            else
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.Write("Error: ");
                Utility.PushColor(ConsoleColor.White);
                Console.WriteLine("header.txt could not be located.");
            }

            Utility.PushColor(desiredColor);
            Console.WriteLine(header);
            Utility.PushColor(ConsoleColor.White);
            Console.WriteLine();
            Console.WriteLine("Core ({3}): Running on .NET Framework Version {0}.{1}.{2}", Environment.Version.Major, Environment.Version.Minor, Environment.Version.Build, Environment.Is64BitProcess ? "x64" : "x86");

            string s = Arguments;

            if (s.Length > 0)
            {
                Console.WriteLine("Core: Running with arguments: {0}", s);
            }

            m_ProcessorCount = Environment.ProcessorCount;

            if (m_ProcessorCount > 1)
            {
                m_MultiProcessor = true;
            }

            if (m_MultiProcessor || Is64Bit)
            {
                Console.WriteLine("Core: Optimizing for {0} {2}processor{1}", m_ProcessorCount, m_ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "");
            }

            int platform = (int)Environment.OSVersion.Platform;

            if (platform == 4 || platform == 128)                // MS 4, MONO 128
            {
                m_Unix = true;
                Console.WriteLine("Core: Unix environment detected");
            }
            else
            {
                m_ConsoleEventHandler = new ConsoleEventHandler(OnConsoleEvent);
                SetConsoleCtrlHandler(m_ConsoleEventHandler, true);
            }

            if (GCSettings.IsServerGC)
            {
                Console.WriteLine("Core: Server garbage collection mode enabled");
            }

            while (!ScriptCompiler.Compile(m_Debug, m_Cache))
            {
                Console.WriteLine("Scripts: One or more scripts failed to compile or no script files were found.");

                if (m_Service)
                {
                    return;
                }

                Console.WriteLine(" - Press return to exit, or R to try again.");

                if (Console.ReadKey(true).Key != ConsoleKey.R)
                {
                    return;
                }
            }

            ScriptCompiler.Invoke("Configure");

            Region.Load();
            World.Load();

            ScriptCompiler.Invoke("Initialize");

            MessagePump messagePump = m_MessagePump = new MessagePump();

            timerThread.Start();

            for (int i = 0; i < Map.AllMaps.Count; ++i)
            {
                Map.AllMaps[i].Tiles.Force();
            }

            NetState.Initialize();

            EventSink.InvokeServerStarted();

            try
            {
                DateTime now, last = DateTime.UtcNow;

                const int   sampleInterval = 100;
                const float ticksPerSecond = (float)(TimeSpan.TicksPerSecond * sampleInterval);

                long sample = 0;

                while (m_Signal.WaitOne())
                {
                    Mobile.ProcessDeltaQueue();
                    Item.ProcessDeltaQueue();

                    Timer.Slice();
                    messagePump.Slice();

                    NetState.FlushAll();
                    NetState.ProcessDisposedQueue();

                    if (Slice != null)
                    {
                        Slice();
                    }

                    if ((++sample % sampleInterval) == 0)
                    {
                        now = DateTime.UtcNow;
                        m_CyclesPerSecond[m_CycleIndex++ % m_CyclesPerSecond.Length] =
                            ticksPerSecond / (now.Ticks - last.Ticks);
                        last = now;
                    }
                }
            }
            catch (Exception e)
            {
                CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(e, true));
            }
        }
Esempio n. 7
0
        public static string BritanniaLow(BaseCreature m_Mobile, SpeechEventArgs e)
        {
            Mobile from     = e.Mobile;
            string response = null;
            string town     = GetLocation(m_Mobile);
            string MyName   = m_Mobile.Name;

            if (Insensitive.Speech(e.Speech, "hello") || Insensitive.Speech(e.Speech, "hi") || (Insensitive.Speech(e.Speech, "good") && Insensitive.Speech(e.Speech, "see") && Insensitive.Speech(e.Speech, "thee")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("What dost thou want?"); break;

                    case 1: response = ("Uh huh?"); break;

                    case 2: response = ("Yeah, what?"); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("Hello."); break;

                    case 1: response = ("Hi."); break;

                    case 2: response = ("Greetings."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = String.Format("Hello, {0}.", e.Mobile.Female ? "milady" : "milord"); break;

                    case 1: response = ("Hi."); break;

                    case 2: response = String.Format("Greetings, {0}.", e.Mobile.Female ? "milady" : "milord"); break;
                    }
                }
            }
            if ((Insensitive.Speech(e.Speech, "how") && Insensitive.Speech(e.Speech, "you")) || (Insensitive.Speech(e.Speech, "how") && Insensitive.Speech(e.Speech, "thou")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("Horrible!"); break;

                    case 1: response = ("None of thy business!"); break;

                    case 2: response = ("Get away from me!"); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("I'm alright."); break;

                    case 1: response = ("Fine."); break;

                    case 2: response = ("I'm good."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = String.Format("I'm good, {0}.  I hope thou'rt alright too.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                    case 1: response = ("Doin' great!"); break;

                    case 2: response = String.Format("Pretty good, $m'lord/m'lady$.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                    }
                }
            }
            if ((Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "thou") && Insensitive.Speech(e.Speech, "live")) || (Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "you") && Insensitive.Speech(e.Speech, "live")) || (Insensitive.Speech(e.Speech, "thou") && Insensitive.Speech(e.Speech, "live")) || (Insensitive.Speech(e.Speech, "you") && Insensitive.Speech(e.Speech, "live")) || Insensitive.Speech(e.Speech, "what city are you from") || Insensitive.Speech(e.Speech, "what town are you from") || (Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "you") && Insensitive.Speech(e.Speech, "from")) || (Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "thou") && Insensitive.Speech(e.Speech, "from")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("I live here!"); break;

                    case 1: response = ("None of thy business!"); break;

                    case 2: response = ("I live in the bottom of the ocean!  I only come here during the day!"); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(5))
                    {
                    case 0: response = String.Format("I live here in {0}.", town); break;

                    case 1: response = String.Format("I live in {0}.", town); break;

                    case 2: response = String.Format("Here. In {0}.", town); break;

                    case 3: response = String.Format("Right here.  In {0}.", town); break;

                    case 4: response = "I live in the town that thou'rt standin' in."; break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                    case 0: response = String.Format("I live here in {0}.", town); break;

                    case 1: response = String.Format("Here, {0}.", e.Mobile.Female ? "milady" : "milord"); break;

                    case 2: response = String.Format("Right here.  In {0}, {1}.", town, e.Mobile.Female ? "m'lady" : "m'lord"); break;

                    case 3: response = String.Format("I live in the town that thou'rt standin' in, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                    }
                }
            }
            if ((Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "am") && Insensitive.Speech(e.Speech, "i")) || Insensitive.Speech(e.Speech, "what town am I in") || (Insensitive.Speech(e.Speech, "what") && Insensitive.Speech(e.Speech, "town is this")))
            {
                switch (Utility.Random(3))
                {
                case 0: response = String.Format("{0}.", town); break;

                case 1: response = String.Format("Uhhh... {0}, I think.", town); break;

                case 2: response = String.Format("Thou'rt in the town of {0}.", town); break;
                }
            }
            if ((Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "thou") && Insensitive.Speech(e.Speech, "work")) || (Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "you") && Insensitive.Speech(e.Speech, "work")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("I work here, moron!"); break;

                    case 1: response = ("None of thy business!"); break;

                    case 2: response = ("I work out of a cave!"); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = String.Format("I work here in {0}.", town); break;

                    case 1: response = String.Format("Here. In {0}.", town); break;

                    case 2: response = String.Format("I work in the town that thou art in.", town); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = String.Format("I work here in {0}.", town); break;

                    case 1: response = String.Format("Here. In {0}, {1}.", town, e.Mobile.Female ? "m'lady" : "m'lord"); break;

                    case 2: response = String.Format("I work in this town, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                    }
                }
            }
            if (Insensitive.Speech(e.Speech, "thanks") || Insensitive.Speech(e.Speech, "thank you") || Insensitive.Speech(e.Speech, "thank thee") || Insensitive.Speech(e.Speech, "thank ye") || Insensitive.Speech(e.Speech, "appreciate"))
            {
                switch (Utility.Random(4))
                {
                case 0: response = "Thou'rt welcome."; break;

                case 1: response = "'Twas nothin'."; break;

                case 2: response = "Sure, Thee's welcome."; break;

                case 3: response = "No problem."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "bye") || Insensitive.Speech(e.Speech, "farewell") || (Insensitive.Speech(e.Speech, "fare") && Insensitive.Speech(e.Speech, "well")) || Insensitive.Speech(e.Speech, "chow") || Insensitive.Speech(e.Speech, "ciao") || (Insensitive.Speech(e.Speech, "see") && Insensitive.Speech(e.Speech, "ya")) || Insensitive.Speech(e.Speech, "seeya") || Insensitive.Speech(e.Speech, "see you") || Insensitive.Speech(e.Speech, "cya"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Goodbye."; break;

                case 1: response = "Farewell."; break;

                case 2: response = "Fare thee well."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "who are you") || Insensitive.Speech(e.Speech, "what's your name") || Insensitive.Speech(e.Speech, "what is your name") || Insensitive.Speech(e.Speech, "who art thou") || Insensitive.Speech(e.Speech, "who are ye") || (Insensitive.Speech(e.Speech, "who") && Insensitive.Speech(e.Speech, "you")) || Insensitive.Speech(e.Speech, "what are you called") || Insensitive.Speech(e.Speech, "what art thou called") || Insensitive.Speech(e.Speech, "what are ye called") || Insensitive.Speech(e.Speech, "know your name") || Insensitive.Speech(e.Speech, "know thy name") || Insensitive.Speech(e.Speech, "know yer name") || Insensitive.Speech(e.Speech, "what is thy name") || Insensitive.Speech(e.Speech, "what's thy name"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = String.Format("{0}.", MyName); break;

                case 1: response = String.Format("I am {0}, {1}.", MyName, e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("Call me {0}.", MyName); break;
                }
            }
            if (Insensitive.Equals(e.Speech, "name"))
            {
                response = String.Format("My name, {0}?", e.Mobile.Female ? "m'lady" : "m'lord");
            }
            if ((Insensitive.Speech(e.Speech, "Is") && Insensitive.Speech(e.Speech, "name")) || Insensitive.Speech(e.Speech, "What's thy name"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = String.Format("I'm {0}.", MyName); break;

                case 1: response = String.Format("My name's {0}.", MyName); break;

                case 2: response = String.Format("I'm {0}.", MyName); break;
                }
            }
            if ((Insensitive.Speech(e.Speech, "make") && Insensitive.Speech(e.Speech, "money")) || (Insensitive.Speech(e.Speech, "earn") && Insensitive.Speech(e.Speech, "money")) || (Insensitive.Speech(e.Speech, "get") && Insensitive.Speech(e.Speech, "money")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("If it's money thou'rt wantin', find thy own source!"); break;

                    case 1: response = ("I ain't tellin' thee nothin'. Thou would elbow in on my victim - er - customers."); break;

                    case 2: response = ("If thou'rt able, go huntin'. What thou hunts is thy own business, though."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(6))
                    {
                    case 0: response = ("I can tell thee that in order to make some money thou would do best to practice thy skills in a shop somewhere. Some even have the tools and materials thou would need on hand."); break;

                    case 1: response = ("If thou'rt willing to work, thou could use the tools and stuff at some of the local shops and make some things that thou could sell."); break;

                    case 2: response = ("Thou could go chop up some trees for wood. Carpenters are usually lookin' for wood."); break;

                    case 3: response = ("Either work an honest living and make some things or don't. Ain't no matter to me."); break;

                    case 4: response = ("Thou can always hunt. Meat, hides, and feathers an' such can all be sold to shokeepers."); break;

                    case 5: response = ("There's ore to be mined, wood to be cut, armor to be made, and lotsa other things to do. Take thy pick."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                    case 0: response = "Thou could practice thy skills at a shop, and then sell what thou art able to make. The shops should have tools and materials."; break;

                    case 1: response = "If thou kills some monsters, thou can usually find gold. They tend to keep any that they find."; break;

                    case 2: response = "Thou want money? Hunt for meat an' hides. Lotsa folks do it."; break;

                    case 3: response = "Get an axe and chop a tree, if thou want money from a carpenter. Or sell some furniture."; break;
                    }
                }
            }
            if (Insensitive.Speech(e.Speech, "camp"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Take some kindling with thee if thou'rt wantin' to camp. Oh, and a bedroll. Yeah, that too."; break;

                case 1: response = "If thou gots a bedroll and some kindling, thou'rt set to camp."; break;

                case 2: response = "I just take a bedroll when I'm goin' out in the woods. Kindlin' thou can get from the trees, usually."; break;
                }
            }
            if ((Insensitive.Speech(e.Speech, "how") && Insensitive.Speech(e.Speech, "quit")) || (Insensitive.Speech(e.Speech, "log") && Insensitive.Speech(e.Speech, "off")) || Insensitive.Speech(e.Speech, "logoff"))
            {
                switch (Utility.Random(2))
                {
                case 0: response = "Find an Inn. Or make a camp. Either one will do thee just fine."; break;

                case 1: response = "Thou can make camp, or check in to an Inn."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "bedroll"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Thou'rt needin' a bedroll? Find a provisioner."; break;

                case 1: response = "Provisioners got bedrolls."; break;

                case 2: response = "Find a provisioner. Then thou can buy a bedroll."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "kindling"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Chop up some wood. That'll get thee some kindling."; break;

                case 1: response = "Uh... the provisioner's got some for sale, if thou wants to buy it."; break;

                case 2: response = "Thou wants kindling? Go chop some wood. Or buy some from the provisioner. I don't care."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "cave") || Insensitive.Speech(e.Speech, "dungeon") || Insensitive.Speech(e.Speech, "destard") || Insensitive.Speech(e.Speech, "despise") || Insensitive.Speech(e.Speech, "shame") || Insensitive.Speech(e.Speech, "deceit") || Insensitive.Speech(e.Speech, "hythloth") || Insensitive.Speech(e.Speech, "wrong") || Insensitive.Speech(e.Speech, "covetous"))
            {
                switch (Utility.Random(4))
                {
                case 0: response = "Dungeons got treasure. That and lotsa pain."; break;

                case 1: response = "I don't know none of the names of the dungeons. An' I KNOW I couldn't find my way there!"; break;

                case 2: response = "I'd go explore some of them places - caves and such - but I like my skin attached to my body."; break;

                case 3: response = "Them dungeons got monsters. Dangerous places. I hear they can make thee rich, though."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "gold") || Insensitive.Speech(e.Speech, "treasure"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own gold! I ain't lettin' my secrets out!"; break;

                case 1: response = "I ain't tellin' thee where I gets my gold! 'Sides, thou couldn't survive the dungeons without knowin' how."; break;

                case 2: response = "Tell thee what... go kill a deamon. They got lotsa good stuff on 'em."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Britannia"))
            {
                if (from.Karma <= -60)
                {
                    if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "Britannia? 'Tis the land thou'rt ruinin', blackguard!"; break;

                        case 1: response = "Surely thou knows the land thou'rt destroyin'!"; break;

                        case 2: response = "And what would thou like to know about Britannia? How thou can do more to make our lives worse?"; break;
                        }
                    }
                    else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = String.Format("Please, {0}, don't spoil our land no further. I beg thee!", e.Mobile.Female ? "lady" : "sir"); break;

                        case 1: response = "I can't help but worry that any news I give will only aid thy plans for destruction."; break;

                        case 2: response = String.Format("I would ask thee, {0}, to pillage our land no further.", e.Mobile.Female ? "m'lady" : "sir"); break;
                        }
                    }
                    else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "Britannia is the very land thou'rt standin' on."; break;

                        case 1: response = "Britannia? Why, 'tis all around thee."; break;

                        case 2: response = "This very land is Britannia, as thou should know."; break;
                        }
                    }
                }
                else if (from.Karma >= 60)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = "Britannia is this land thou helps make better."; break;

                    case 1: response = "Britannia? Why, 'tis the name that thanks thee daily for thy kindness."; break;

                    case 2: response = "How could thou not know of the lands made more prosperous by thy deeds?"; break;
                    }
                }
                else
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = "Britannia?  Why, 'tis the name Lord British has claimed for the lands of 'imself and 'is subjects"; break;

                    case 1: response = "This very land is Britannia, as thou must know."; break;

                    case 2: response = "Britannia? Why, 'tis all around thee."; break;
                    }
                }
            }
            if (Insensitive.Speech(e.Speech, "Buccaneer's Den") || Insensitive.Speech(e.Speech, "Buccaneers Den"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Britain") || Insensitive.Speech(e.Speech, "capital"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way around."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Cove"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Jhelom"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Magincia"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Minoc"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Serpent's Hold") || Insensitive.Speech(e.Speech, "Serpents Hold"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Skara Brae"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Trinsic"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Vesper"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Yew"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Find thy own way about."; break;

                case 1: response = String.Format("If thou don't know, {0}, I can't help.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't good with directions, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Lord British") || Insensitive.Speech(e.Speech, "ruler") || Insensitive.Speech(e.Speech, "king"))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    if (from.Karma <= -60)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "I'd like to see the bloody fool's head on a spit, I would."; break;

                        case 1: response = "Dost thou want my opinion on Lord British? I find him a lout, I do. And I'd say it to him if I could."; break;

                        case 2: response = "Thou wouldn't find me cryin' over 'is spilled blood."; break;
                        }
                    }
                    else if (from.Karma >= 60)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = String.Format("Lord British? Best we don't speak of him, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                        case 1: response = String.Format("Thou wouldn't care for my opinion, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                        case 2: response = String.Format("Nah, {0}, I ain't tellin' my feelings 'bout our liege. Best to be quiet 'bout them things.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                        }
                    }
                    else
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "I don't know what makes him feel so lordly. 'Less, 'tis his gift for collectin' gold to fill his coffers."; break;

                        case 1: response = "I hope Lord British is pleased with all he's done for Britannia. I'll say I ain't."; break;

                        case 2: response = "Lord British? I suppose the taxes he takes to fill his coffers leave us enough to live on... almost."; break;
                        }
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = "Aye, now thou'rt speakin' of our king."; break;

                    case 1: response = "Lord British? I like 'im."; break;

                    case 2: response = "They say Lord British is fair and just. I got no argument with that."; break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = "Aye, Lord British works hard to make sure we're all happy."; break;

                    case 1: response = "Lord British is our king. He's a good man, I say."; break;

                    case 2: response = "Lord British? He's done right by Britannia, he has!"; break;
                    }
                }
            }
            if (Insensitive.Speech(e.Speech, "weather"))
            {
                response = "Ah, the weather... 'Tis an interesting thing, really. No matter what the season, no matter what enchantments are cast, our land is almost always blessed with clear and beautiful blue skies.";
            }
            if (Insensitive.Speech(e.Speech, "concerns") || Insensitive.Speech(e.Speech, "troubles"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Lotsa things annoy people, like taxation, invasion, and protection form creatures of the wild."; break;

                case 1: response = "Any land sees hard times, an' it takes a wise ruler to lead his people through 'em."; break;

                case 2: response = "Surely thou ain't understandin' -- life can't always be free of trouble."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "blackthorn"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "I think Blackthorn wrote a book or somethin'. I, uh, ain't had the time to read it though."; break;

                case 1: response = "Blackthorn an' British are still pals, I hear. Huh. Strange pair, that."; break;

                case 2: response = "I don't think either one of 'em's better than the other. Blackthorn an' British, I mean."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "shamino"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Who?"; break;

                case 1: response = "Where?"; break;

                case 2: response = "What?"; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Iolo"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Who?"; break;

                case 1: response = "Where?"; break;

                case 2: response = "What?"; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Dupre"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Who?"; break;

                case 1: response = "Where?"; break;

                case 2: response = "What?"; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "New Magincia"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "New Magincia? Is there something wrong with the original?"; break;

                case 1: response = String.Format("Forgive me, {0}, but I think thou'rt drunk.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 2: response = String.Format("I ain't heard o' such a place, {0}. I s'pose it could be a colony or somethin'.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "other lands") || Insensitive.Speech(e.Speech, "other realms") || Insensitive.Speech(e.Speech, "many realms") || Insensitive.Speech(e.Speech, "many lands") || Insensitive.Speech(e.Speech, "other realm") || Insensitive.Speech(e.Speech, "one realm of many?"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "What's thou mean? There's only one land, and it's called Britannia."; break;

                case 1: response = "What other?"; break;

                case 2: response = "There ain't no other!"; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "colony"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = String.Format("I ain't knowin' of none, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;

                case 1: response = "Rumor is that Lord British wants to send idiots to settle unexplored areas."; break;

                case 2: response = String.Format("I don't know what thou'rt speakin' 'bout, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "virtue") || Insensitive.Speech(e.Speech, "virtues") || Insensitive.Speech(e.Speech, "shrines") || Insensitive.Speech(e.Speech, "truth") || Insensitive.Speech(e.Speech, "love") || Insensitive.Speech(e.Speech, "courage") || Insensitive.Speech(e.Speech, "spirituality") || Insensitive.Speech(e.Speech, "valor") || Insensitive.Speech(e.Speech, "honor") || Insensitive.Speech(e.Speech, "justice") || Insensitive.Speech(e.Speech, "sacrifice") || Insensitive.Speech(e.Speech, "honesty") || Insensitive.Speech(e.Speech, "humility") || Insensitive.Speech(e.Speech, "compassion"))
            {
                switch (Utility.Random(2))
                {
                case 0: response = "Shrines to the virtues are all 'round our land. They're mighty powerful, I've heard."; break;

                case 1: response = "Rest and health is found at the shrines. I heard they'll bring thee alive if thou'rt dead or some such non-sense."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "avatar"))
            {
                switch (Utility.Random(4))
                {
                case 0: response = "Who?"; break;

                case 1: response = "Sorry, Never heard of 'im."; break;

                case 2: response = "I ain't never heard of this tar person."; break;

                case 3: response = "I can't help thee."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "moongates"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "The moongates?  What are they for?"; break;

                case 1: response = "They help travellers. I think."; break;

                case 2: response = String.Format("Them things are beyond me, {0}.", e.Mobile.Female ? "m'lady" : "m'lord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "moons"))
            {
                response = "Britannia's moons are called Trammel and Felucca. They control the destinations of the moongates.";
            }
            return(response);
        }
Esempio n. 8
0
 public int Total(string category, string name)
 {
     return(this.Count(e => Insensitive.Equals(e.Category, category) && Insensitive.Equals(e.Name, name)));
 }
Esempio n. 9
0
        public static string BritanniaHigh(BaseCreature m_Mobile, SpeechEventArgs e)
        {
            Mobile from     = e.Mobile;
            string response = null;
            string town     = GetLocation(m_Mobile);
            string MyName   = m_Mobile.Name;

            if (Insensitive.Speech(e.Speech, "hello") || Insensitive.Speech(e.Speech, "hi") || (Insensitive.Speech(e.Speech, "good") && Insensitive.Speech(e.Speech, "see") && Insensitive.Speech(e.Speech, "thee")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("What dost thou want?"); break;

                    case 1: response = ("Uh huh?"); break;

                    case 2: response = ("Yeah, what?"); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("Hello."); break;

                    case 1: response = ("Hi."); break;

                    case 2: response = ("Greetings."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = String.Format("Hello, {0}.", e.Mobile.Female ? "milady" : "milord"); break;

                    case 1: response = ("Hi."); break;

                    case 2: response = String.Format("Greetings, {0}.", e.Mobile.Female ? "milady" : "milord"); break;
                    }
                }
            }
            if ((Insensitive.Speech(e.Speech, "how") && Insensitive.Speech(e.Speech, "you")) || (Insensitive.Speech(e.Speech, "how") && Insensitive.Speech(e.Speech, "thou")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("Horrible!"); break;

                    case 1: response = ("None of thy business!"); break;

                    case 2: response = ("Get thee away from me!"); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("I'm doing relatively well."); break;

                    case 1: response = ("Just fine."); break;

                    case 2: response = ("I am well."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = String.Format("I am well, {0}. I hope thou art the same.", e.Mobile.Female ? "milady" : "milord"); break;

                    case 1: response = ("Doing great!"); break;

                    case 2: response = String.Format("As well as I can be, {0}.", e.Mobile.Female ? "milady" : "milord"); break;
                    }
                }
            }
            if ((Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "thou") && Insensitive.Speech(e.Speech, "live")) || (Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "you") && Insensitive.Speech(e.Speech, "live")) || (Insensitive.Speech(e.Speech, "thou") && Insensitive.Speech(e.Speech, "live")) || (Insensitive.Speech(e.Speech, "you") && Insensitive.Speech(e.Speech, "live")) || Insensitive.Speech(e.Speech, "what city are you from") || Insensitive.Speech(e.Speech, "what town are you from") || (Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "you") && Insensitive.Speech(e.Speech, "from")) || (Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "thou") && Insensitive.Speech(e.Speech, "from")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("I live here!"); break;

                    case 1: response = ("None of thy business!"); break;

                    case 2: response = ("I live in the bottom of the ocean!  I only come here during the day!"); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(5))
                    {
                    case 0: response = String.Format("I live here in {0}.", town); break;

                    case 1: response = String.Format("I live in {0}.", town); break;

                    case 2: response = String.Format("Here. In {0}.", town); break;

                    case 3: response = String.Format("Right here.  In {0}.", town); break;

                    case 4: response = "I live in the town that thou art standing in."; break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                    case 0: response = String.Format("I live here in {0}.", town); break;

                    case 1: response = String.Format("Here, {0}.", e.Mobile.Female ? "milady" : "milord"); break;

                    case 2: response = String.Format("Right here.  In {0}, {1}.", town, e.Mobile.Female ? "milady" : "milord"); break;

                    case 3: response = String.Format("I live in the town that thou art standing in, {0}.", e.Mobile.Female ? "milady" : "milord"); break;
                    }
                }
            }
            if ((Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "am") && Insensitive.Speech(e.Speech, "i")) || Insensitive.Speech(e.Speech, "what town am I in") || (Insensitive.Speech(e.Speech, "what") && Insensitive.Speech(e.Speech, "town is this")))
            {
                switch (Utility.Random(3))
                {
                case 0: response = String.Format("Thou art in {0}.", town); break;

                case 1: response = String.Format("Thou art a visitor of {0}.", town); break;

                case 2: response = String.Format("If thou art lost, then know that thou art in {0}.", town); break;
                }
            }
            if ((Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "thou") && Insensitive.Speech(e.Speech, "work")) || (Insensitive.Speech(e.Speech, "where") && Insensitive.Speech(e.Speech, "you") && Insensitive.Speech(e.Speech, "work")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("I work here, moron!"); break;

                    case 1: response = ("None of thy business!"); break;

                    case 2: response = ("I work out of a cave!  What dost thou think, imbecile!"); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = String.Format("I work here in {0}.", town); break;

                    case 1: response = String.Format("Here. In {0}.", town); break;

                    case 2: response = String.Format("I work in the town that thou art in.", town); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = String.Format("I work here in {0}.", town); break;

                    case 1: response = String.Format("Here. In {0}, {1}.", town, e.Mobile.Female ? "milady" : "milord"); break;

                    case 2: response = String.Format("I work in this town, {0}.", e.Mobile.Female ? "milady" : "milord"); break;
                    }
                }
            }
            if (Insensitive.Speech(e.Speech, "thanks") || Insensitive.Speech(e.Speech, "thank you") || Insensitive.Speech(e.Speech, "thank thee") || Insensitive.Speech(e.Speech, "thank ye") || Insensitive.Speech(e.Speech, "appreciate"))
            {
                switch (Utility.Random(4))
                {
                case 0: response = "Thou'rt welcome."; break;

                case 1: response = "'Twas nothing."; break;

                case 2: response = "Certainly, thou art welcome."; break;

                case 3: response = "Not a problem."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "bye") || Insensitive.Speech(e.Speech, "farewell") || (Insensitive.Speech(e.Speech, "fare") && Insensitive.Speech(e.Speech, "well")) || Insensitive.Speech(e.Speech, "chow") || Insensitive.Speech(e.Speech, "ciao") || (Insensitive.Speech(e.Speech, "see") && Insensitive.Speech(e.Speech, "ya")) || Insensitive.Speech(e.Speech, "seeya") || Insensitive.Speech(e.Speech, "see you") || Insensitive.Speech(e.Speech, "cya"))
            {
                switch (Utility.Random(2))
                {
                case 0: response = "Goodbye."; break;

                case 1: response = "Farewell."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "who are you") || Insensitive.Speech(e.Speech, "what's your name") || Insensitive.Speech(e.Speech, "what is your name") || Insensitive.Speech(e.Speech, "who art thou") || Insensitive.Speech(e.Speech, "who are ye") || (Insensitive.Speech(e.Speech, "who") && Insensitive.Speech(e.Speech, "you")) || Insensitive.Speech(e.Speech, "what are you called") || Insensitive.Speech(e.Speech, "what art thou called") || Insensitive.Speech(e.Speech, "what are ye called") || Insensitive.Speech(e.Speech, "know your name") || Insensitive.Speech(e.Speech, "know thy name") || Insensitive.Speech(e.Speech, "know yer name") || Insensitive.Speech(e.Speech, "what is thy name") || Insensitive.Speech(e.Speech, "what's thy name"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = String.Format("My name is {0}.", MyName); break;

                case 1: response = String.Format("I am {0}, {1}.", MyName, e.Mobile.Female ? "milady" : "milord"); break;

                case 2: response = String.Format("Thou mayest call me {0}.", MyName); break;
                }
            }
            if ((Insensitive.Speech(e.Speech, "Is") && Insensitive.Speech(e.Speech, "name")) || Insensitive.Speech(e.Speech, "What's thy name"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = String.Format("I am {0}.", MyName); break;

                case 1: response = String.Format("My name, {1}, is {0}.", MyName, e.Mobile.Female ? "madam" : "sir"); break;

                case 2: response = String.Format("If thou art looking for {0} then thou hast found me.", MyName); break;
                }
            }
            if (Insensitive.Equals(e.Speech, "name"))
            {
                switch (Utility.Random(2))
                {
                case 0: response = String.Format("If thou'rt asking for my name, {0}, please be more specific.", e.Mobile.Female ? "milady" : "milord"); break;

                case 1: response = String.Format("Please be more specific, if thou'rt asking for my name, {0}.", e.Mobile.Female ? "milady" : "milord"); break;
                }
            }
            if ((Insensitive.Speech(e.Speech, "make") && Insensitive.Speech(e.Speech, "money")) || (Insensitive.Speech(e.Speech, "earn") && Insensitive.Speech(e.Speech, "money")) || (Insensitive.Speech(e.Speech, "get") && Insensitive.Speech(e.Speech, "money")))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    switch (Utility.Random(4))
                    {
                    case 0: response = ("Oh, well there's stealing, begging, scavenging... many ways for one such as thee to find money."); break;

                    case 1: response = ("I'm sure that thou can find many varied ways to take money. Like stealing things and selling them back to their owners, killing people..."); break;

                    case 2: response = ("Just lift money from people whho have it. That's what thy type would do anyway."); break;

                    case 3: response = ("Thou can always beg for thy gold."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(7))
                    {
                    case 0: response = ("If thou dost want to earn money, practice a skill. Make things and sell them to the public. Most shopkeepers will let thee use the tools and materials that they aren't using."); break;

                    case 1: response = ("If thou art able to hunt the wild animals, sometimes thou can sell the meat that thou dost carve from them to a butcher."); break;

                    case 2: response = ("If thou can get an axe, perhaps thou could cut some trees into useful boards for woodworkers. They may be willing to pay thee for tham."); break;

                    case 3: response = ("If thou dost happen upon some ore, go to the blacksmith's shop and try to craft some armor or weapons. I have heard that it just takes practice."); break;

                    case 4: response = ("I have heard that the great dungeons sometimes have great treasures."); break;

                    case 5: response = ("Tanners will buy hides and pelts that thou dost take from the animals thou dost hunt."); break;

                    case 6: response = ("Thou can sell feathers from birds to a bowyer. And a cook may purchase the bird itself from thee."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                    case 0: response = "There are many different ways to make money in Britannia. Thou can sell raw materials to merchants, make and sell goods, sell the meat that thou dost find hunting... there are many ways."; break;

                    case 1: response = "The merchants will usually let people practice skills in their shops. All thou dost need is raw materials, and sometimes tools."; break;

                    case 2: response = "Some will stoop to stealing or killing to get their money, so be careful where thou dost walk. Make use of thy skills. Make something and sell it to a merchant."; break;

                    case 3: response = "Hunting seems to be a very profitable source of income. Most cooks will purchase fowl and fish from thee, butchers will pay thee for meat, and tanners for the pelts and hides."; break;
                    }
                }
            }
            if (Insensitive.Speech(e.Speech, "camp"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "It's essential to have good kindling and a bedroll if thou dost want to camp."; break;

                case 1: response = "I never leave the city without a bedroll on which to sleep and some kindling for a fire."; break;

                case 2: response = "Kindling for a fire and a bedroll for thy comfort is all thou dost need to make camp."; break;
                }
            }
            if ((Insensitive.Speech(e.Speech, "how") && Insensitive.Speech(e.Speech, "quit")) || (Insensitive.Speech(e.Speech, "log") && Insensitive.Speech(e.Speech, "off")) || Insensitive.Speech(e.Speech, "logoff"))
            {
                switch (Utility.Random(2))
                {
                case 0: response = "Making camp, if thou art in the wilds, and paying for a room in an Inn are the ways to give thyself a rest from this world."; break;

                case 1: response = "If thou art wanting a respite from the rigors of Britannia, then thou can make a camp or check in to an Inn, whichever is the most convenient."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "bedroll"))
            {
                switch (Utility.Random(2))
                {
                case 0: response = "Bedrolls can be purchased from a provisioner."; break;

                case 1: response = "If thou dost need a bedroll, I think a provisioner might help thee."; break;

                case 2: response = "I think thou can find a bedroll at a provisioner's shop, if that is what thou art looking for."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "kindling"))
            {
                switch (Utility.Random(2))
                {
                case 0: response = "If thou dost use an axe on some wood, thou should get kindling from it. Otherwise, I think a provisioner will carry some for those wanting to camp in the wild."; break;

                case 1: response = "Thou shouldst be able to get kindling from any wood thou finds. If thou has an axe, of course."; break;

                case 2: response = "A provisioner can supply thee with kindling if thou dost lack the means to make thy own."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "cave") || Insensitive.Speech(e.Speech, "dungeon") || Insensitive.Speech(e.Speech, "destard") || Insensitive.Speech(e.Speech, "despise") || Insensitive.Speech(e.Speech, "shame") || Insensitive.Speech(e.Speech, "deceit") || Insensitive.Speech(e.Speech, "hythloth") || Insensitive.Speech(e.Speech, "wrong") || Insensitive.Speech(e.Speech, "covetous"))
            {
                switch (Utility.Random(5))
                {
                case 0: response = "There are many as yet unmapped places beneath Britannia. 'Tis rumored to be riches and magic in them. And creatures that will rend the flesh from thy bones."; break;

                case 1: response = "The places under Britannia - some call them 'dungeons' - are spposed to be rich with treasures and gold. They are also guarded by horrible creatures that want nothing more than to dine on humans."; break;

                case 2: response = "I know of seven dungeons in Britannia. Covetous, Despise, Deceit, and... a, uh, few others."; break;

                case 3: response = "Let's see... I remember the names of Shame, Wrong, Despise, and Hythloth. I've never owned a map of Britannia myself."; break;

                case 4: response = "I think the dungeons that people tend to forget are Destard, Covetous, and Hythloth. I think."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "gold") || Insensitive.Speech(e.Speech, "treasure"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Thou can find a good deal of treasure under Britannia. Look to the caves and what thou call dungeons."; break;

                case 1: response = "Some of the more dangerous creatures will carry gold that they've scavenged."; break;

                case 2: response = "If thou art needing gold, either find it in the dungeons, or scavenge it from monsters thou have killed. Thou will find it either way, if thou dost survive."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Britannia"))
            {
                if (from.Karma <= -60)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = "What wouldst thou have me say about Britannia, save that $rogues/foul wenches$ such as thee do much to bespoil its name."; break;

                    case 1: response = String.Format("Britannia? I ask thee not to speak of this land while in my company, {0}!", e.Mobile.Female ? "witch" : "varlet"); break;

                    case 2: response = String.Format("{0}! Thou carest not for Britannia! Thus, I ask thee to remove the name of Lord British's realm from thy mind.", e.Mobile.Female ? "Foul wench" : "Scoundrel"); break;
                    }
                }
                else if (from.Karma >= 60)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = "Ah, thou dost speak of fair Britannia. Lord British, himself, wouldst be proud of thine efforts to keep it peaceful. Yet, those who travel claim it is but one realm of many."; break;

                    case 1: response = "I cannot speak but fondly on my homeland, the very land thou dost seek to keep safe. Yet I would not forgo an opportunity to see other lands."; break;

                    case 2: response = "I have lived in Britannia all my life, and so I thank thee for thine efforts to improve the lives of all who live here."; break;
                    }
                }
                else
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = "Ah, fair Britannia. Those who travel claim it is but one realm of many."; break;

                    case 1: response = "I cannot speak but fondly on my homeland. Yet I would not forgo an opportunity to see other lands."; break;

                    case 2: response = "I have lived in Britannia all my life. I do love it so."; break;
                    }
                }
            }
            if (Insensitive.Speech(e.Speech, "Buccaneer's Den") || Insensitive.Speech(e.Speech, "Buccaneers Den"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Buccaneer's Den? Why, 'tis nothing more than a hiding place for pirates!"; break;

                case 1: response = "'Tis where the scum of the realm go to lick their wounds."; break;

                case 2: response = String.Format("I would not live in Buccaneer's Den if I were thee, {0}, for it is home to the most vile men and women to sail the seas.", e.Mobile.Female ? "milady" : "milord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Britain") || Insensitive.Speech(e.Speech, "capital"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Britain is the capital of all Britannia, land of Lord British."; break;

                case 1: response = "Lord British, sovereign of all Britannia, resides in Britain."; break;

                case 2: response = "Britain is home to Lord British, himself. 'Tis the capital of Britannia."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Cove"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Cove? Thou shouldst find it North and East of Britain."; break;

                case 1: response = "Cove is not much of a city. 'Tis more of a village, to be truthful."; break;

                case 2: response = "Just Northeast of Britain is Cove."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Jhelom"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Jhelom is an outpost for mercenaries and sellswords."; break;

                case 1: response = "Jhelom? 'Tis a town of sword arms looking for work. Thou canst find it off the southwestern coast of mainland Britannia."; break;

                case 2: response = "Some say Jhelom is as rough as Buccaneer's Den, with half the scoundrels and twice the bruises."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Magincia"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Magincia is a city spanning nearly an entire island, outside of Britanny Bay."; break;

                case 1: response = "Magincia? 'Tis a city of arrogance and pride, I think."; break;

                case 2: response = String.Format("Quite a lovely place, {0}. And shouldst thou doubt my word, just ask someone who resides there.", e.Mobile.Female ? "milady" : "milord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Minoc"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Minoc is a mining town now."; break;

                case 1: response = "Minoc? Why it was once home to the best artisans in the realm, but now that rich deposits of precious metals have been discovered in the mountains, 'tis full of miners."; break;

                case 2: response = String.Format("Minoc lies on the northern coast of the mainland, {0}.", e.Mobile.Female ? "milady" : "milord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Serpent's Hold") || Insensitive.Speech(e.Speech, "Serpents Hold"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Serpent's Hold is where the best knights are trained. 'Tis located in the Cape of Heroes, off the southeastern edge of the mainland."; break;

                case 1: response = "Serpent's Hold is the fortification Lord British granted to his loyal knights, those of the Order of the Silver Serpent."; break;

                case 2: response = "Serpent's Hold? Art thou interested in becoming a member of Lord British's royal order of Knights -- the Order of the Silver Serpent? If such is true, then thou shouldst go to Serpent's Hold."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Skara Brae"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Skara Brae is an island. Thou canst find it off the western coast of Britannia."; break;

                case 1: response = "The most skilled trackers in the land learn their craft on the island of Skara Brae."; break;

                case 2: response = "Many talented shipwrights live on Skara Brae, though the island is actually known for the many trackers who teach their skills there."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Trinsic"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Though Serpent's Hold may be home to valiant knights, and Jhelom home to skilled mercenaries, Trinsic is where one shouldst go to find the most honorable warriors of the realm."; break;

                case 1: response = "Though known as a haven for men and women of honor who wish to hone their martial skills, Trinsic also supports a large guild of architects and engineers."; break;

                case 2: response = "Trinsic? Why, thou couldst find thy way there by merely following the south road from Britain."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Vesper"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Vesper? 'Tis a city in northeastern Britannia. Ore from the mines of Minoc are sent down river to be unloaded in Vesper."; break;

                case 1: response = String.Format("Much of the crafts forged in Minoc find their way to Vesper by way of the river, {0}.", e.Mobile.Female ? "milady" : "milord"); break;

                case 2: response = "Some claim Vesper is merely an extension of Minoc, calling it nothing more than a large marketplace for artisans to sell their wares."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Yew"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Yew is a small, peaceful community of farmers in northwestern Britannia."; break;

                case 1: response = "The High Court of Britannia is in Yew. 'Tis there that important cases that concern all of Britannia are decided, many of which are determined by Lord British, himself."; break;

                case 2: response = "They say farmers and criminals are all who go to Yew, $milord/milady$, save for those hoping to visit one of the two."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Britanny Bay"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "'Tis the bay that touches the city of Britain."; break;

                case 1: response = "Britanny Bay is the body of water on the edge of Britannia's capital."; break;

                case 2: response = "Britanny Bay? Why, 'tis the waters that border the ports of Britain."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Order of the Silver Serpent") || Insensitive.Speech(e.Speech, "Knights"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "'Tis the order of knights who served Lord British in the battle against Lord Robere."; break;

                case 1: response = "When Lord Robere challenged Lord British for his share of the realm, Lord British's faithful knights defended the kingdom."; break;

                case 2: response = "Only the bravest knights belong to the Order of the Silver Serpent. 'Twas they who defeated the forces of Lord Robere."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Robere") || Insensitive.Speech(e.Speech, "Lord Robere"))
            {
                switch (Utility.Random(4))
                {
                case 0: response = "History claims that Lord Robere was once an honorable man. But he was overcome with greed and sought to take the entire realm by force."; break;

                case 1: response = "Years ago, Lord Robere made claims to the lands under Lord British's domain. Were it not for the stout knights in the Order of the Silver Serpent, Lord Robere could very well have conquered the entire realm."; break;

                case 2: response = "Though a kind and generous man in his youth, Lord Robere thirsted for power in his later years, so legends say."; break;

                case 3: response = "Had not the Order of the Silver Serpent been ready to fight for Lord British, this very land could have belonged to the ambitious conqueror."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Lord British") || Insensitive.Speech(e.Speech, "ruler") || Insensitive.Speech(e.Speech, "king"))
            {
                if (m_Mobile.Attitude == AttitudeLevel.Wicked)
                {
                    if (from.Karma <= -60)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "Love him like thine own brother, they say.  Fine, say I, but must I be so unnkind to mine own flesh and blood?"; break;

                        case 1: response = "Yes, it seems Lord British doth possess a rare gift for leadership...and I wish he would give it back."; break;

                        case 2: response = String.Format("Wert thou not so masterful, {0}, I would compare THEE to our illustrious ruler... but only a fool would confuse a fine {1} such as thee with Britannia'a royalty.", e.Mobile.Female ? "Milady" : "Milord", e.Mobile.Female ? "soul" : "man"); break;
                        }
                    }
                    else if (from.Karma >= 60)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "Ah, thou dost speak of fair Britannia. Lord British, himself, wouldst be proud of thine efforts to keep it peaceful. Yet, those who travel claim it is but one realm of many."; break;

                        case 1: response = "I cannot speak but fondly on my homeland, the very land thou dost seek to keep safe. Yet I would not forgo an opportunity to see other lands."; break;

                        case 2: response = "I have lived in Britannia all my life, and so I thank thee for thine efforts to improve the lives of all who live here."; break;
                        }
                    }
                    else
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "Hmmm...  yes, Lord British. That's a difficult one...."; break;

                        case 1: response = "I care not for his empty promises or hollow beliefs, for they brought me nothing vain hope."; break;

                        case 2: response = String.Format("Please accept mine apology, o' noble {0}, but I care little about sharing mine opinions on Lord Britsh with thee.", e.Mobile.Female ? "lady" : "lord"); break;
                        }
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Neutral)
                {
                    switch (Utility.Random(3))
                    {
                    case 0: response = ("I have always find Lord British to be fair and just in his rule."); break;

                    case 1: response = ("From my liege I ask no more than a strong but gently, guiding hand. Thus far, Lord British has shown just that."); break;

                    case 2: response = ("Lord British governs as any wise ruler would -- with an even hand and a thoughtful eye."); break;
                    }
                }
                else if (m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    if (from.Karma <= -60)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "Though thou might never know such, Lord British has done much to make our land one of prosperity."; break;

                        case 1: response = "Fear not, troubled soul. The worries that thou might have about our land will soon be made to vanish by Lord British."; break;

                        case 2: response = String.Format("It may not be apparent to thee, {0}, but Lord British's guidance has made Britannia great.", e.Mobile.Female ? "Milady" : "Milord", e.Mobile.Female ? "soul" : "man"); break;
                        }
                    }
                    else if (from.Karma >= 60)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = String.Format("As thou must surely know, {0} {1}, Lord British is the reason our land has prospered so.", e.Mobile.Female ? "Milady" : "Milord", e.Mobile.Name); break;

                        case 1: response = "I have little fear that all will be well in Britannia."; break;

                        case 2: response = String.Format("As must be plainly apparent to thee, {0}, Lord British's guidance has made Britannia great.", e.Mobile.Female ? "Milady" : "Milord"); break;
                        }
                    }
                    else
                    {
                        switch (Utility.Random(3))
                        {
                        case 0: response = "Lord British is a kind and generous ruler."; break;

                        case 1: response = "I do not know of another who would rule as fairly in Lord British's stead."; break;

                        case 2: response = "In truth, Lord British does his best to address any concerns we seem to have."; break;
                        }
                    }
                }
            }
            if (Insensitive.Speech(e.Speech, "weather"))
            {
                response = "Ah, the weather... 'Tis an interesting thing, really. No matter what the season, no matter what enchantments are cast, our land is almost always blessed with clear and beautiful blue skies.";
            }
            if (Insensitive.Speech(e.Speech, "concerns") || Insensitive.Speech(e.Speech, "troubles"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Various issues surface from time to time, such as taxation, invasion, protection form creatures of the wild."; break;

                case 1: response = "Any land experiences difficult times, but it takes a wise ruler to lead his people through them."; break;

                case 2: response = "Surely thou dost understand -- life cannot always be free of trouble."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "blackthorn"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "I've heard that Lord Blackthorn has written a couple of books describing his philosophies in-depth. If thou dost find these, I imagine thou wouldst be able to say better than I what Blackthorn is about."; break;

                case 1: response = "Lord Blackthorn and Lord British are still friends, or so I've heard. They just envision different futures for Britannia."; break;

                case 2: response = "Lord Blackthorn wishes the freedom of choice in ALL things extended to everyone. Some say that he'd even sees the Orcs and Lizardmen as equals to the humans in Britannia."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "shamino"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Lord Shamino? Ah, yes, Lord British's friend and ally, I believe."; break;

                case 1: response = "The name is familiar to me... ah, yes -- I believe he is the infrequent guest of Lord British."; break;

                case 2: response = String.Format("Not a name bandied about often, to be sure, kind {0}. I suspect thou'rt refering to the oft-time companion of Lord British, himself.", e.Mobile.Female ? "lady" : "sir"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Iolo"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Iolo? Ah, yes, Lord British's friend and ally, I believe."; break;

                case 1: response = "The name is familiar to me... ah, yes -- I believe he is the infrequent guest of Lord British."; break;

                case 2: response = String.Format("Not a name bandied about often, to be sure, kind {0}. I suspect thou'rt refering to the oft-time companion of Lord British, himself.", e.Mobile.Female ? "lady" : "sir"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "Dupre"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Dupre? Ah, yes, Lord British's friend and ally, I believe. If thou wert to search for him, I wouldst most recommend a tavern."; break;

                case 1: response = "The name is familiar to me... ah, yes -- I believe he is the infrequent guest of Lord British. Mayhaps thou wilt find him sampling the local spirits."; break;

                case 2: response = String.Format("Not a name bandied about often, to be sure, kind {0}. I suspect thou'rt refering to the oft-time fighting companion of Lord British, himself.", e.Mobile.Female ? "lady" : "sir"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "New Magincia"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "New Magincia? Is there something wrong with the original?"; break;

                case 1: response = String.Format("Forgive me, {0}, but I think thou dost suffer the madness of the drink.", e.Mobile.Female ? "milady" : "milord"); break;

                case 2: response = String.Format("I have not heard of such a place, {0}. I suppose it could be a colony of Britannians who have settled in a new territory.", e.Mobile.Female ? "milady" : "milord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "colony"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = String.Format("I know not of any, {0}.", e.Mobile.Female ? "milady" : "milord"); break;

                case 1: response = "Rumors abound that Lord British wishes to send adventurous and resourceful individuals to settle unexplored areas."; break;

                case 2: response = String.Format("I know not of which thou doth speak, {0}.", e.Mobile.Female ? "milady" : "milord"); break;
                }
            }
            if (Insensitive.Speech(e.Speech, "virtue") || Insensitive.Speech(e.Speech, "virtues") || Insensitive.Speech(e.Speech, "shrines") || Insensitive.Speech(e.Speech, "truth") || Insensitive.Speech(e.Speech, "love") || Insensitive.Speech(e.Speech, "courage") || Insensitive.Speech(e.Speech, "spirituality") || Insensitive.Speech(e.Speech, "valor") || Insensitive.Speech(e.Speech, "honor") || Insensitive.Speech(e.Speech, "justice") || Insensitive.Speech(e.Speech, "sacrifice") || Insensitive.Speech(e.Speech, "honesty") || Insensitive.Speech(e.Speech, "humility") || Insensitive.Speech(e.Speech, "compassion"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "Shrines to the virtues are spread around our land. I've heard that they can even resurrect the dead."; break;

                case 1: response = "Rest and health can be found at the shrines."; break;

                case 2: response = "The shrines are rumored to have the power to resurrect the dead."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "avatar"))
            {
                switch (Utility.Random(4))
                {
                case 0: response = "Who?"; break;

                case 1: response = "I'm sorry, I know not of whom thou doth speak."; break;

                case 2: response = "I have never heard of this tar person."; break;

                case 3: response = "I cannot help thee."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "moongates"))
            {
                switch (Utility.Random(3))
                {
                case 0: response = "The moongates? They are... doors to different parts of Britannia. Except the destinations of the doors change with the phases of the two moons."; break;

                case 1: response = "Thou shouldst learn to use the moongates if thou dost plan to travel far. The key is in the phases of the moons."; break;

                case 2: response = "If thou dost use the moongates to travel, then thou might not end up where thou had planned, unless thou hast learned how to use them correctly."; break;
                }
            }
            if (Insensitive.Speech(e.Speech, "moons"))
            {
                response = "Our moons are called Trammel and Felucca. They control the moongates.";
            }
            return(response);
        }
Esempio n. 10
0
 public int Total(string category)
 {
     return(this.Count(e => Insensitive.Equals(e.Category, category)));
 }
Esempio n. 11
0
 public bool Remove(string category, string name)
 {
     return(RemoveAll(e => Insensitive.Equals(e.Category, category) && Insensitive.Equals(e.Name, name)) > 0);
 }
Esempio n. 12
0
 public bool Remove(string category)
 {
     return(RemoveAll(e => Insensitive.Equals(e.Category, category)) > 0);
 }
Esempio n. 13
0
 public IEnumerable <FilterOption> this[string category, string name]
 {
     get { return(this.Where(e => Insensitive.Equals(e.Category, category) && Insensitive.Equals(e.Name, name))); }
 }
Esempio n. 14
0
        public static void Main(string[] args)
        {
            m_Assembly = Assembly.GetEntryAssembly();

            /* print a banner */
            Version ver = m_Assembly.GetName().Version;

            Console.WriteLine("SunLogin Version {0}.{1}.{2} http://www.sunuo.org/",
                              ver.Major, ver.Minor, ver.Revision);
            Console.WriteLine("  on {0}, runtime {1}",
                              Environment.OSVersion, Environment.Version);

            if ((int)Environment.OSVersion.Platform == 128)
            {
                Console.WriteLine("Please make sure you have Mono 1.1.7 or newer! (mono -V)");
            }

            Console.WriteLine();

            /* prepare SunUO */
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.ProcessExit        += new EventHandler(CurrentDomain_ProcessExit);

            for (int i = 0; i < args.Length; ++i)
            {
                if (Insensitive.Equals(args[i], "-service"))
                {
                    m_Service = true;
                }
                else if (Insensitive.Equals(args[i], "-profile"))
                {
                    Profiling = true;
                }
                else if (args[i] == "--logfile")
                {
                    string       logfile = args[++i];
                    StreamWriter writer  = new StreamWriter(new FileStream(logfile, FileMode.Append, FileAccess.Write));
                    writer.AutoFlush = true;
                    Console.SetOut(writer);
                    Console.SetError(writer);
                }
            }

            config = new Config(Path.Combine(BaseDirectoryInfo.CreateSubdirectory("etc").FullName, "sunuo.xml"));

            try
            {
                m_MultiConOut = new MultiTextWriter(Console.Out);
                Console.SetOut(m_MultiConOut);

                if (m_Service)
                {
                    string filename = Path.Combine(LogDirectoryInfo.FullName, "console.log");
                    m_MultiConOut.Add(new FileLogger(filename));
                }
            }
            catch
            {
            }

            m_Thread = Thread.CurrentThread;

            if (m_Thread != null)
            {
                m_Thread.Name = "Core Thread";
            }

            if (BaseDirectory.Length > 0)
            {
                Directory.SetCurrentDirectory(BaseDirectory);
            }

            Timer.TimerThread ttObj = new Timer.TimerThread();
            timerThread      = new Thread(new ThreadStart(ttObj.TimerMain));
            timerThread.Name = "Timer Thread";

            if (!config.Exists)
            {
                config.Save();
            }

            m_MessagePump = new MessagePump(new Listener(Listener.Port));

            timerThread.Start();

            NetState.Initialize();
            Encryption.Initialize();
            ServerList.Initialize();
            Server.Accounting.AccountHandler.Initialize();

            EventSink.InvokeServerStarted();

            try
            {
                while (!m_Closing)
                {
                    Thread.Sleep(1);

                    Timer.Slice();
                    m_MessagePump.Slice();

                    NetState.FlushAll();
                    NetState.ProcessDisposedQueue();

                    if (Slice != null)
                    {
                        Slice();
                    }
                }
            }
            catch (Exception e)
            {
                CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(e, true));
            }

            if (timerThread.IsAlive)
            {
                timerThread.Abort();
            }
        }