Beispiel #1
0
        public VanillaWorld(int portNumber, int maxConnections)
        {
            DBC = new DBCLibrary();

            WorldDatabase     = new DatabaseUnitOfWork <WorldDatabase>();
            CharacterDatabase = new DatabaseUnitOfWork <CharacterDatabase>();

            Server = new WorldServer(this);

            Components.Add(new ActionButtonComponent(this));
            Components.Add(new AuthComponent(this));
            Components.Add(new CharacterComponent(this));
            Components.Add(new ChatMessageComponent(this));
            Components.Add(new WeatherComponent(this));
            Components.Add(new EntityComponent(this));
            Components.Add(new GameObjectComponent(this));
            Components.Add(new LoginComponent(this));
            Components.Add(new LogoutComponent(this));
            Components.Add(new MailComponent(this));
            Components.Add(new MiscComponent(this));
            Components.Add(new PlayerMovementComponent(this));
            Components.Add(new SpellComponent(this));

            ChatCommands = new ChatCommandParser();

            Server.Start(portNumber, maxConnections);

            var accountCreator = new AccountCreator();

            accountCreator.CreateAccount("andrew", "password");
            accountCreator.CreateAccount("lucas", "password");
        }
Beispiel #2
0
        static void Main()
        {
            Log.ServerType = "World";

            Log.Message(LogType.Init, "___________________________________________");
            Log.Message(LogType.Init, "    __                                     ");
            Log.Message(LogType.Init, "    / |                     ,              ");
            Log.Message(LogType.Init, "---/__|---)__----__--_/_--------------_--_-");
            Log.Message(LogType.Init, "  /   |  /   ) /   ' /    /   /   /  / /  )");
            Log.Message(LogType.Init, "_/____|_/_____(___ _(_ __/___(___(__/_/__/_");
            Log.Message(LogType.Init, "___________________________________________");
            Log.Message();

            Log.Message(LogType.Normal, "Starting Arctium WorldServer...");

            DB.Characters.Init(WorldConfig.CharDBHost, WorldConfig.CharDBUser, WorldConfig.CharDBPassword,
                               WorldConfig.CharDBDataBase, WorldConfig.CharDBPort, WorldConfig.MySqlPooling,
                               WorldConfig.MySqlMinPoolSize, WorldConfig.MySqlMaxPoolSize);

            DB.Realms.Init(RealmConfig.RealmDBHost, RealmConfig.RealmDBUser, RealmConfig.RealmDBPassword,
                           RealmConfig.RealmDBDataBase, RealmConfig.RealmDBPort, WorldConfig.MySqlPooling,
                           WorldConfig.MySqlMinPoolSize, WorldConfig.MySqlMaxPoolSize);

            DB.World.Init(WorldConfig.WorldDBHost, WorldConfig.WorldDBUser, WorldConfig.WorldDBPassword,
                          WorldConfig.WorldDBDataBase, WorldConfig.WorldDBPort, WorldConfig.MySqlPooling,
                          WorldConfig.MySqlMinPoolSize, WorldConfig.MySqlMaxPoolSize);

            Log.Message();

            Globals.Initialize();

            // Set all accounts offline
            DB.Realms.Execute("UPDATE accounts SET online = 0");

            WorldClass.world = new WorldNetwork();

            if (WorldClass.world.Start(WorldConfig.BindIP, (int)WorldConfig.BindPort))
            {
                WorldClass.world.AcceptConnectionThread();
                Log.Message(LogType.Normal, "WorldServer listening on {0} port {1}.", WorldConfig.BindIP, WorldConfig.BindPort);
                Log.Message(LogType.Normal, "WorldServer successfully started!");

                PacketManager.DefineOpcodeHandler();
                ChatCommandParser.DefineChatCommands();
            }
            else
            {
                Log.Message(LogType.Error, "Server couldn't be started: ");
            }

            GC.Collect();
            Log.Message(LogType.Normal, "Total Memory: {0} Kilobytes", GC.GetTotalMemory(false) / 1024);

            // Init Command handlers...
            CommandDefinitions.Initialize();
            CommandManager.InitCommands();
        }
    private void Start()
    {
        _instance = this.GetComponent <ChatCommandParser>();

        _joinedPlayers = new List <string>(Config.MaxPlayers);
        _goodPlayers   = new List <string>((int)Math.Ceiling(Config.MaxPlayers / 2f));
        _evilPlayers   = new List <string>((int)Math.Floor(Config.MaxPlayers / 2f));

        _playerTimers = new Dictionary <string, Dictionary <Cmd, float> >();

        GameLogic.PreperationStateTriggered += OnPreparationStart;
        GameLogic.PlayingStateTriggered     += OnPlayStart;
        GameLogic.GameOverStateTriggered    += OnGameOver;
    }
Beispiel #4
0
        static void Main(string[] args)
        {
            Log.Message(LogType.INIT, "___________________________________________");
            Log.Message(LogType.INIT, "    __                                     ");
            Log.Message(LogType.INIT, "    / |                     ,              ");
            Log.Message(LogType.INIT, "---/__|---)__----__--_/_--------------_--_-");
            Log.Message(LogType.INIT, "  /   |  /   ) /   ' /    /   /   /  / /  )");
            Log.Message(LogType.INIT, "_/____|_/_____(___ _(_ __/___(___(__/_/__/_");
            Log.Message(LogType.INIT, "___________________________________________");
            Log.Message();

            Log.Message(LogType.NORMAL, "Starting Arctium WorldServer...");

            DB.Characters.Init(WorldConfig.CharDBHost, WorldConfig.CharDBUser, WorldConfig.CharDBPassword, WorldConfig.CharDBDataBase, WorldConfig.CharDBPort);
            DB.Realms.Init(RealmConfig.RealmDBHost, RealmConfig.RealmDBUser, RealmConfig.RealmDBPassword, RealmConfig.RealmDBDataBase, RealmConfig.RealmDBPort);
            DB.World.Init(WorldConfig.WorldDBHost, WorldConfig.WorldDBUser, WorldConfig.WorldDBPassword, WorldConfig.WorldDBDataBase, WorldConfig.WorldDBPort);
            Log.Message();

            DBCLoader.Init();
            DB2Loader.Init();

            Globals.InitializeManager();

            WorldClass.world = new WorldNetwork();

            if (WorldClass.world.Start("127.0.0.1", 8100))
            {
                WorldClass.world.AcceptConnectionThread();
                Log.Message(LogType.NORMAL, "WorldServer listening on {0} port {1}.", "127.0.0.1", 8100);
                Log.Message(LogType.NORMAL, "WorldServer successfully started!");

                PacketManager.DefineOpcodeHandler();
                ChatCommandParser.DefineChatCommands();
            }
            else
            {
                Log.Message(LogType.ERROR, "Server couldn't be started: ");
            }

            // Free memory...
            GC.Collect();
            Log.Message(LogType.NORMAL, "Total Memory: {0} Kilobytes", GC.GetTotalMemory(false) / 1024);

            // Init Command handlers...
            CommandDefinitions.Initialize();
            CommandManager.InitCommands();
        }
Beispiel #5
0
            internal void <Main> b__1_3()
            {
                WorldClass2.world = new WorldNetwork();
                while (true)
                {
IL_DA:
                    uint arg_AE_0 = 3787839266u;
                    while (true)
                    {
                        uint num;
                        switch ((num = (arg_AE_0 ^ 3818991086u)) % 8u)
                        {
                        case 0u:
                            Log.Message(LogType.Error, Module.smethod_36 <string>(2638766104u), Array.Empty <object>());
                            arg_AE_0 = 2821928925u;
                            continue;

                        case 1u:
                            WorldClass2.world.AcceptConnectionThread2();
                            arg_AE_0 = (num * 2867472236u ^ 24152677u);
                            continue;

                        case 2u:
                            ChatCommandParser.DefineChatCommands2();
                            arg_AE_0 = (num * 2966987160u ^ 772862995u);
                            continue;

                        case 4u:
                            arg_AE_0 = ((WorldClass2.world.Start(Module.smethod_33 <string>(3600904718u), 3724) ? 4080538975u : 2924591654u) ^ num * 1703302812u);
                            continue;

                        case 5u:
                            return;

                        case 6u:
                            goto IL_DA;

                        case 7u:
                            AuthServer.WorldServer.Game.Packets.PacketManager.DefineOpcodeHandler2();
                            arg_AE_0 = (num * 3421968766u ^ 2603198422u);
                            continue;
                        }
                        return;
                    }
                }
            }
Beispiel #6
0
        public static void HandleChatMessageSay(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);
            int       language  = packet.ReadInt32();

            uint   messageLength = BitUnpack.GetBits <uint>(9);
            string chatMessage   = packet.ReadString(messageLength);

            if (chatMessage.StartsWith("!"))
            {
                WorldMgr.Session = session;
                ChatCommandParser.ExecuteChatHandler(chatMessage);
            }
            else
            {
                SendMessageByType(ref session, MessageType.ChatMessageSay, language, chatMessage);
            }
        }
        public ChatAdministrator(GameClient client)
        {
            Client = client;
            Client.PlayerChatMessageRecieved  += Client_PlayerChatMessageRecieved;
            Client.SpecialChatMessageRecieved += Client_SpecialChatMessageRecieved;
            Client.LoginComplete          += Client_LoginComplete;
            Client.AddHubPlayer           += Client_AddHubPlayer;
            Client.RemoveHubPlayer        += Client_RemoveHubPlayer;
            Client.UpdateHubPlayer        += Client_UpdateHubPlayer;
            Client.UpdateHubPlayers       += Client_UpdateHubPlayers;
            Client.ClearChat              += Client_ClearChat;
            Client.Banlist                += Client_Banlist;
            Client.Mutelist               += Client_Mutelist;
            Client.DailyQuestNotification += Client_DailyQuestNotification;
            Client.AnimationNotification  += Client_AnimationNotification;
            Client.Mutechat               += Client_Mutechat;
            Client.GetRoomsList           += Client_GetRoomsList;

            _cmdParser = new ChatCommandParser();
        }
Beispiel #8
0
        public static void HandleChatMessageSay(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            var language = packet.Read <int>();

            var messageLength = BitUnpack.GetBits <byte>(8);
            var message       = packet.ReadString(messageLength);

            ChatMessageValues chatMessage = new ChatMessageValues(MessageType.ChatMessageSay, message, true, true);

            chatMessage.Language = (byte)language;

            if (ChatCommandParser.CheckForCommand(message))
            {
                ChatCommandParser.ExecuteChatHandler(message, session);
            }
            else
            {
                SendMessage(ref session, chatMessage);
            }
        }
Beispiel #9
0
            internal void <Main> b__1_2()
            {
                AuthServer.WorldServer.Managers.Manager.Initialize();
                WorldClass.world = new WorldNetwork();
                while (true)
                {
IL_22D:
                    uint arg_1E8_0 = 3352817744u;
                    while (true)
                    {
                        uint num;
                        switch ((num = (arg_1E8_0 ^ 2174237086u)) % 14u)
                        {
                        case 0u:
                            Log.Message(LogType.Info, Module.smethod_36 <string>(3199210790u), Array.Empty <object>());
                            arg_1E8_0 = (num * 293830216u ^ 3785111977u);
                            continue;

                        case 1u:
                            arg_1E8_0 = (num * 1159999155u ^ 2715109765u);
                            continue;

                        case 3u:
                            Log.Message(LogType.Info, Module.smethod_33 <string>(3408924807u), Array.Empty <object>());
                            arg_1E8_0 = (num * 2188278457u ^ 3075230937u);
                            continue;

                        case 4u:
                            WorldClass.world.AcceptConnectionThread();
                            arg_1E8_0 = (num * 1988231028u ^ 1363700904u);
                            continue;

                        case 5u:
                            goto IL_22D;

                        case 6u:
                            arg_1E8_0 = ((WorldClass.world.Start(Module.smethod_35 <string>(78051837u), 8085) ? 4111792120u : 2412095149u) ^ num * 2486324963u);
                            continue;

                        case 7u:
                            Log.Message(LogType.Info, Module.smethod_33 <string>(264622139u), Array.Empty <object>());
                            arg_1E8_0 = (num * 4255687717u ^ 170489561u);
                            continue;

                        case 8u:
                            Log.Message(LogType.Info, Module.smethod_34 <string>(290469369u), Array.Empty <object>());
                            arg_1E8_0 = (num * 2824688434u ^ 3191605882u);
                            continue;

                        case 9u:
                            Log.Message(LogType.Info, Module.smethod_33 <string>(967570713u), Array.Empty <object>());
                            arg_1E8_0 = (num * 3591803169u ^ 1592472184u);
                            continue;

                        case 10u:
                        {
                            ThreadStart arg_AB_0;
                            if ((arg_AB_0 = Sandbox.__c.__9__1_3) == null)
                            {
                                arg_AB_0 = (Sandbox.__c.__9__1_3 = new ThreadStart(Sandbox.__c.__9.< Main > b__1_3));
                            }
                            Sandbox.__c.smethod_2(Sandbox.__c.smethod_1(arg_AB_0));
                            arg_1E8_0 = 3635468527u;
                            continue;
                        }

                        case 11u:
                            Log.Message(LogType.Error, Module.smethod_36 <string>(2638766104u), Array.Empty <object>());
                            arg_1E8_0 = 2534700142u;
                            continue;

                        case 12u:
                            AuthServer.WorldServer.Game.Packets.PacketManager.DefineOpcodeHandler();
                            ChatCommandParser.DefineChatCommands();
                            arg_1E8_0 = (num * 3339465046u ^ 1488328179u);
                            continue;

                        case 13u:
                            Log.Message(LogType.Normal, Module.smethod_37 <string>(3623392228u), Array.Empty <object>());
                            Log.Message(LogType.Info, Module.smethod_37 <string>(2659212889u), Array.Empty <object>());
                            arg_1E8_0 = (num * 2429953406u ^ 1192654773u);
                            continue;
                        }
                        return;
                    }
                }
            }
Beispiel #10
0
        public static void HandleChatMessageSay(ref PacketReader packet, WorldClass session)
        {
            BitUnpack         arg_0F_0 = new BitUnpack(packet);
            int               num      = packet.Read <int>();
            int               num2     = (int)arg_0F_0.GetBits <byte>(8) << 1;
            bool              bit      = arg_0F_0.GetBit();
            ChatMessageValues chatMessageValues;

            while (true)
            {
IL_10D:
                uint arg_E0_0 = 325641967u;
                while (true)
                {
                    uint num3;
                    switch ((num3 = (arg_E0_0 ^ 1114592966u)) % 8u)
                    {
                    case 0u:
                        goto IL_10D;

                    case 1u:
                    {
                        string text = packet.ReadString((uint)(bit ? ((byte)num2 + 1) : ((byte)num2)));
                        arg_E0_0 = 1695780296u;
                        continue;
                    }

                    case 2u:
                        return;

                    case 3u:
                    {
                        string text;
                        arg_E0_0 = ((ChatCommandParser.CheckForCommand(text) ? 3993131816u : 2950447498u) ^ num3 * 3295186339u);
                        continue;
                    }

                    case 4u:
                    {
                        string text;
                        ChatCommandParser.ExecuteChatHandler2(text, Manager.WorldMgr.GetSession2(session.Character.Guid));
                        arg_E0_0 = (num3 * 451064634u ^ 332353724u);
                        continue;
                    }

                    case 6u:
                    {
                        string text;
                        chatMessageValues          = new ChatMessageValues(MessageType.ChatMessageSay, text, true, true, session.Character.Name);
                        chatMessageValues.Language = (byte)num;
                        arg_E0_0 = (num3 * 3671775661u ^ 3376883115u);
                        continue;
                    }

                    case 7u:
                    {
                        string text;
                        ChatCommandParser.ExecuteChatHandler(text, session);
                        arg_E0_0 = (num3 * 3654367289u ^ 3353498485u);
                        continue;
                    }
                    }
                    goto Block_3;
                }
            }
Block_3:
            ChatHandler.SendMessage(ref session, chatMessageValues, null);
        }