Exemplo n.º 1
0
 public DB(string type)
 {
     if (type == "realmserver")
     {
         theServer = new DBServer("127.0.0.1", 8087);
     }
     else
     {
         theConnectoid = new DBConnectoid();
         serverIP      = type;
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            #if !DEBUG
            try
            {
            #endif
            /*TextWriter tw = new StreamWriter( "loot.cs" );
                tw.WriteLine("using System;using Server.Items;using System.Collections;using Server;namespace Server{public class LootTemplate {" );

                for(int t = 0;t < 10000;t++ )
                {
                    tw.WriteLine("public static Loot[] loottemplate" + t.ToString() + " = null;" );//new Loot[] { new Loot( typeof( Money ), 9, 20, 60.480000f ) };" );
                }
                tw.WriteLine("}}");
                tw.Close();*/
            /*
                            byte []aaa = new byte[] { 0x32, 0x9D, 0x33, 0x40, 0xA2, 0x63, 0x0B, 0xC6, 0x5A, 0xB5, 0xFB, 0xC2, 0x7B, 0xD9, 0xA2, 0x42, 0xE0, 0xF0, 0x63, 0x40, 0x3F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x60, 0x40 };
                            for(int t = 0;t < aaa.Length;t+=4 )
                            {
                                Console.WriteLine("{0} ", BitConverter.ToSingle( aaa, t ) );
                            }*/
            if ( args.Length > 0 )
            {
                foreach( string s in args )
                {
                    if ( s == "outfile" )
                    {
                        FileStream fs1 = new FileStream("log" + Utility.Random1024().ToString() + ".txt", FileMode.Create);
                        sw1 = new StreamWriter(fs1);
                        Console.SetOut( sw1 );
                    }
                    if ( s == "realmserver" )
                    {
                        World.RealmServer = true;
                        World.StandardServer = false;
                    }
                }
            }

            new MainConsole();

            Process []p = Process.GetProcessesByName( "WowwoW.exe" );

            if ( p.Length > 0 )
                p[ 0 ].WaitForExit();
            //	float a = Converter.ToFloat( new byte[]{ 0x
            Console.WriteLine("WowwoW Alpha v{0} (c) DrNexus ({1})", World.Version, World.ReleaseDate );
            Console.WriteLine("   Supported WoW Client -> v{0}", World.ClientVer );
            /*	if ( !BuildExternalEnvironements() )
                {
                    return;
                }*/
            if ( !World.RealmServer )
            {
                if ( !BuildAllDlls() )
                    return;
                Utility.FillConstructorList();
                ConstructorInfo ct = Utility.FindConstructor( "CustomHandlers", Utility.externAsm[ "globals" ] );
                ct.Invoke( null );
            }
            else
                Utility.FillConstructorList();

            world = new World();

            worldThread1ms = new Thread( new ThreadStart( world.Slice1ms ) );

            //	worldThread500ms = new Thread( new ThreadStart( world.Slice500ms ) );
            if ( !World.RealmServer )
                worldThread1ms.Start();

            th = new Thread[ 1 ];
            if ( !World.RealmServer )
            {
                Listen3724();
                Listen8085();
            }
            else
            {
                dbServer = new DBServer( "localhost", 8087 );
            }
            Listen80();

            worldThread1ms.Priority = ThreadPriority.AboveNormal;//.Highest;
            Area a = new Area();
            if ( sw1 != null )
                sw1.Flush();
            /*

            if ( World.StandardServer )
            {
                DBConnectoid dbc = new DBConnectoid();
                dbc.ConnectTo( "127.0.0.1", 8087 );
                byte []buffer = new byte[ 13 ];
                int offset = 0;
                Converter.ToBytes( (ushort)13, buffer, ref offset );
                Converter.ToBytes( (byte)1, buffer, ref offset );
                Converter.ToBytes( (ushort)0, buffer, ref offset );
                Converter.ToBytes( (UInt64)15051385, buffer, ref offset );
                dbc.SendGet( buffer );

            }*/
            while( !end )
            {
                /*	Process proc = Process.GetCurrentProcess();
                    Console.WriteLine("Virtual memory usage : {0} mb",proc.VirtualMemorySize / ( 1024 * 1024 ));
                    Console.WriteLine("Memory usage : {0} mb",proc.PrivateMemorySize / ( 1024 * 1024 ));
                    Console.WriteLine("Peak Virtual memory usage : {0} mb",proc.PeakVirtualMemorySize / ( 1024 * 1024 ) );
                    Console.WriteLine("Peak Memory usage : {0} mb",proc.PeakWorkingSet / ( 1024 * 1024 ) );
                    */
                /*	world.TimerReport();

                    int t = 0;
                    if ( World.localTime != null )
                        foreach( long l in World.localTime )
                            Console.WriteLine("Time {0} : {1} ({2},{3})", t++, (100*(double)l / (double)World.total).ToString("G5") , l, World.total );
                    */
                Thread.Sleep( 3000 );
            }
            #if !DEBUG
            }
            catch(Exception e )
            {
                Console.WriteLine("Error in main console !" );
                Console.WriteLine( e.Message );
                Console.WriteLine( e.Source );
                Console.WriteLine( e.StackTrace );
            }
            #endif
        }