Beispiel #1
0
 public CharacterComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     Router.AddHandler(WorldOpcodes.CMSG_CHAR_ENUM, OnCharEnum);
     Router.AddHandler<PCCharDelete>(WorldOpcodes.CMSG_CHAR_DELETE, OnCharDelete);
     Router.AddHandler<PCCharCreate>(WorldOpcodes.CMSG_CHAR_CREATE, OnCharCreate);
 }
 public PlayerMovementComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     MOVEMENT_CODES.ForEach(opcode => Router.AddHandler(opcode, GenerateResponse(opcode)));
     Router.AddHandler<PCMoveTimeSkipped>(WorldOpcodes.CMSG_MOVE_TIME_SKIPPED, OnMoveTimeSkipped);
     Router.AddHandler(WorldOpcodes.MSG_MOVE_WORLDPORT_ACK, OnWorldPort);
 }
Beispiel #3
0
 public CreatureEntity(ObjectGUID objectGUID, creature creature, VanillaWorld vanillaWorld)
     : base(objectGUID)
 {
     this.VanillaWorld = vanillaWorld;
     this.Creature     = creature;
     this.Template     = CreatureTemplateDatabase.SingleOrDefault(ct => ct.Entry == creature.id);
 }
Beispiel #4
0
 public MailComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     Router.AddHandler<PCGetMailList>(WorldOpcodes.CMSG_GET_MAIL_LIST, OnGetMailList);
     Router.AddHandler<PCSendMail>(WorldOpcodes.CMSG_SEND_MAIL, OnSendMail);
     Router.AddHandler<PCSendMail>(WorldOpcodes.CMSG_MAIL_RETURN_TO_SENDER, OnReturnMailToSender);
 }
        public GameObjectComponent(VanillaWorld vanillaWorld)
            : base(vanillaWorld)
        {
            Router.AddHandler <PCGameObjectUse>(WorldOpcodes.CMSG_GAMEOBJ_USE, OnGameObjectUsePacket);
            Router.AddHandler <PCGameObjectQuery>(WorldOpcodes.CMSG_GAMEOBJECT_QUERY, OnGameObjectQuery);

            GameObjectUseHandlers = new Dictionary <GameObjectType, ProcessGameObjectUseCallback>();
            GameObjectUseHandlers.Add(GameObjectType.GAMEOBJECT_TYPE_CHAIR, OnUseChair);
        }
        public GameObjectComponent(VanillaWorld vanillaWorld)
            : base(vanillaWorld)
        {
            Router.AddHandler<PCGameObjectUse>(WorldOpcodes.CMSG_GAMEOBJ_USE, OnGameObjectUsePacket);
            Router.AddHandler<PCGameObjectQuery>(WorldOpcodes.CMSG_GAMEOBJECT_QUERY, OnGameObjectQuery);

            GameObjectUseHandlers = new Dictionary<GameObjectType, ProcessGameObjectUseCallback>();
            GameObjectUseHandlers.Add(GameObjectType.GAMEOBJECT_TYPE_CHAIR, OnUseChair);
        }
Beispiel #7
0
        public LogoutComponent(VanillaWorld vanillaWorld)
            : base(vanillaWorld)
        {
            LogoutQueue = new Dictionary<WorldSession, DateTime>();

            var thread = new Thread(Update);
            thread.Start();

            Router.AddHandler<PacketReader>(WorldOpcodes.CMSG_LOGOUT_REQUEST, OnLogout);
            Router.AddHandler<PacketReader>(WorldOpcodes.CMSG_LOGOUT_CANCEL, OnCancel);
        }
Beispiel #8
0
        public WeatherComponent(VanillaWorld vanillaWorld)
            : base(vanillaWorld)
        {
            WeatherZones = new Dictionary<int, WeatherZone>();

            var weathers = Core.WorldDatabase.GetRepository<game_weather>().AsQueryable().ToList();
            foreach (var weather in weathers)
            {
                WeatherZones.Add(weather.zone, new WeatherZone(weather));
            }
        }
Beispiel #9
0
        public LogoutComponent(VanillaWorld vanillaWorld) : base(vanillaWorld)
        {
            LogoutQueue = new Dictionary <WorldSession, DateTime>();

            var thread = new Thread(Update);

            thread.Start();

            Router.AddHandler <PacketReader>(WorldOpcodes.CMSG_LOGOUT_REQUEST, OnLogout);
            Router.AddHandler <PacketReader>(WorldOpcodes.CMSG_LOGOUT_CANCEL, OnCancel);
        }
Beispiel #10
0
        public WeatherComponent(VanillaWorld vanillaWorld)
            : base(vanillaWorld)
        {
            WeatherZones = new Dictionary <int, WeatherZone>();

            var weathers = Core.WorldDatabase.GetRepository <game_weather>().AsQueryable().ToList();

            foreach (var weather in weathers)
            {
                WeatherZones.Add(weather.zone, new WeatherZone(weather));
            }
        }
Beispiel #11
0
 public MiscComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     Router.AddHandler <PCNameQuery>(WorldOpcodes.CMSG_NAME_QUERY, OnNameQuery);
     Router.AddHandler <PCCreatureQuery>(WorldOpcodes.CMSG_CREATURE_QUERY, OnCreatureQuery);
     Router.AddHandler <PCTextEmote>(WorldOpcodes.CMSG_TEXT_EMOTE, OnTextEmote);
     Router.AddHandler <PCEmote>(WorldOpcodes.CMSG_EMOTE, OnEmote);
     Router.AddHandler <PCZoneUpdate>(WorldOpcodes.CMSG_ZONEUPDATE, OnZoneUpdate);
     Router.AddHandler <PCAreaTrigger>(WorldOpcodes.CMSG_AREATRIGGER, OnAreaTrigger);
     Router.AddHandler <PCPing>(WorldOpcodes.CMSG_PING, OnPing);
     Router.AddHandler <PCSetSelection>(WorldOpcodes.CMSG_SET_SELECTION, OnSetSelection);
 }
Beispiel #12
0
 public MiscComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     Router.AddHandler<PCNameQuery>(WorldOpcodes.CMSG_NAME_QUERY, OnNameQuery);
     Router.AddHandler<PCCreatureQuery>(WorldOpcodes.CMSG_CREATURE_QUERY, OnCreatureQuery);
     Router.AddHandler<PCTextEmote>(WorldOpcodes.CMSG_TEXT_EMOTE, OnTextEmote);
     Router.AddHandler<PCEmote>(WorldOpcodes.CMSG_EMOTE, OnEmote);
     Router.AddHandler<PCZoneUpdate>(WorldOpcodes.CMSG_ZONEUPDATE, OnZoneUpdate);
     Router.AddHandler<PCAreaTrigger>(WorldOpcodes.CMSG_AREATRIGGER, OnAreaTrigger);
     Router.AddHandler<PCPing>(WorldOpcodes.CMSG_PING, OnPing);
     Router.AddHandler<PCSetSelection>(WorldOpcodes.CMSG_SET_SELECTION, OnSetSelection);
 }
Beispiel #13
0
        static void Main(string[] args)
        {
            Config.Boot();

            VanillaLogin = new VanillaLogin(LoginPort, LoginMaxConnection);
            VanillaWorld = new VanillaWorld(WorldPort, WorldMaxConnection);

            //new LuaManager(VanillaWorld);

            //new BotClient(LoginPort).ConnectToServer();

            while (true) Thread.Sleep(1000);
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            Config.Boot();

            VanillaLogin = new VanillaLogin(LoginPort, LoginMaxConnection);
            VanillaWorld = new VanillaWorld(WorldPort, WorldMaxConnection);

            //new LuaManager(VanillaWorld);

            //new BotClient(LoginPort).ConnectToServer();

            while (true) Thread.Sleep(1000);
        }
Beispiel #15
0
        public WorldSession(WorldServer server, VanillaWorld core, int connectionID, Socket connectionSocket) : base(connectionID, connectionSocket)
        {
            Server = server;
            Core   = core;

            UpdatePacketBuilder = new UpdatePacketBuilder(this);

            // Connection Packet
            using (WorldPacket packet = new WorldPacket(WorldOpcodes.SMSG_AUTH_CHALLENGE))
            {
                packet.WriteBytes(new byte[] { 0x33, 0x18, 0x34, 0xC8 });
                SendPacket(packet);
            }
        }
Beispiel #16
0
        static void ToRealWorld(Client player, string[] cmd, int iarg)
        {
            VanillaWorld w = World.Main;

            if (iarg < cmd.Length) //we got arguments
            {
                if (World.VanillaWorlds.ContainsKey(cmd [iarg]) == false)
                {
                    throw new UsageException("No world named " + cmd [iarg]);
                }
                w = World.VanillaWorlds [cmd [iarg]];
            }
            player.SetWorld(w);
        }
Beispiel #17
0
        public EntityChunk(Vector2 chunkLocation, float chunkSize, VanillaWorld vanillaWorld)
        {
            this.vanillaWorld  = vanillaWorld;
            this.ChunkLocation = chunkLocation;

            this.bounds = new EntityBounds
            {
                MinX = (chunkLocation.X * chunkSize),
                MinY = (chunkLocation.Y * chunkSize),
                MaxX = ((chunkLocation.X + 1) * chunkSize),
                MaxY = ((chunkLocation.Y + 1) * chunkSize)
            };

            AddInitialEntities();
        }
Beispiel #18
0
        public EntityChunk(Vector2 chunkLocation, float chunkSize, VanillaWorld vanillaWorld)
        {
            this.vanillaWorld = vanillaWorld;
            this.ChunkLocation = chunkLocation;

            this.bounds = new EntityBounds
                         {
                             MinX = (chunkLocation.X * chunkSize),
                             MinY = (chunkLocation.Y * chunkSize),
                             MaxX = ((chunkLocation.X + 1) * chunkSize),
                             MaxY = ((chunkLocation.Y + 1) * chunkSize)
                         };

            AddInitialEntities();
        }
Beispiel #19
0
        public WorldSession(WorldServer server, VanillaWorld core, int connectionID, Socket connectionSocket)
            : base(connectionID, connectionSocket)
        {
            Server = server;
            Core = core;

            UpdatePacketBuilder = new UpdatePacketBuilder(this);

            // Connection Packet
            using (WorldPacket packet = new WorldPacket(WorldOpcodes.SMSG_AUTH_CHALLENGE))
            {
                packet.WriteBytes(new byte[] { 0x33, 0x18, 0x34, 0xC8 });
                SendPacket(packet);
            }
        }
        public ChatMessageComponent(VanillaWorld vanillaWorld) : base(vanillaWorld)
        {
            ChatChannels = new List <ChatChannel>();

            Router.AddHandler <PCMessageChat>(WorldOpcodes.CMSG_MESSAGECHAT, OnMessageChatPacket);
            Router.AddHandler <PCJoinChannel>(WorldOpcodes.CMSG_JOIN_CHANNEL, OnJoinChannel);
            Router.AddHandler <PCChannel>(WorldOpcodes.CMSG_LEAVE_CHANNEL, OnLeaveChannel);
            Router.AddHandler <PCChannel>(WorldOpcodes.CMSG_CHANNEL_LIST, OnListChannel);

            ChatHandlers = new Dictionary <ChatMessageType, ProcessChatCallback>();
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_SAY, OnSayYell);
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_YELL, OnSayYell);
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_EMOTE, OnSayYell);
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_WHISPER, OnWhisper);
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_CHANNEL, OnChannelMessage);
        }
Beispiel #21
0
        void VanillaUnload(Client player, string[] cmd, int iarg)
        {
            string name = cmd [iarg];

            if (World.VanillaWorlds.ContainsKey(name) == false)
            {
                throw new ErrorException("World not loaded");
            }

            VanillaWorld w = World.VanillaWorlds [name];

            World.VanillaWorlds.Remove(name);

            w.Suspended = true;
            w.StopBackend();
            player.TellSystem(Chat.Purple, "Unloaded world " + name);
        }
        public ChatMessageComponent(VanillaWorld vanillaWorld)
            : base(vanillaWorld)
        {
            ChatChannels = new List<ChatChannel>();

            Router.AddHandler<PCMessageChat>(WorldOpcodes.CMSG_MESSAGECHAT, OnMessageChatPacket);
            Router.AddHandler<PCJoinChannel>(WorldOpcodes.CMSG_JOIN_CHANNEL, OnJoinChannel);
            Router.AddHandler<PCChannel>(WorldOpcodes.CMSG_LEAVE_CHANNEL, OnLeaveChannel);
            Router.AddHandler<PCChannel>(WorldOpcodes.CMSG_CHANNEL_LIST, OnListChannel);

            ChatHandlers = new Dictionary<ChatMessageType,ProcessChatCallback>();
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_SAY, OnSayYell);
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_YELL, OnSayYell);
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_EMOTE, OnSayYell);
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_WHISPER, OnWhisper);
            ChatHandlers.Add(ChatMessageType.CHAT_MSG_CHANNEL, OnChannelMessage);
        }
Beispiel #23
0
        void VanillaResume(Client player, string[] cmd, int iarg)
        {
            VanillaWorld w = player.Session.World as VanillaWorld;

            if (iarg < cmd.Length)
            {
                w = World.VanillaWorlds [cmd [iarg]];
            }

            if (w == null)
            {
                throw new UsageException("No vanilla world with the name " + cmd [iarg]);
            }

            w.Suspended = false;
            w.StartBackend();
            Log.WriteChat(player, null, -1, "[Resume]");
        }
Beispiel #24
0
        public WorldServer(VanillaWorld core)
        {
            this.Router = new WorldRouter();
            this.Core = core;
            Sessions = new List<WorldSession>();

            ThreadStart updateLoop = () =>
                {
                    while (true)
                    {
                        this.Update();
                        Core.Components.ForEach(c => c.Update());
                        Thread.Sleep(500);
                    }
                };

            Thread updateSessionThread = new Thread(updateLoop);
            updateSessionThread.Start();
        }
Beispiel #25
0
        void VanillaLoad(Client player, string[] cmd, int iarg)
        {
            string name = cmd [iarg];

            if (World.VanillaWorlds.ContainsKey(name))
            {
                throw new ErrorException("World already loaded");
            }

            try
            {
                VanillaWorld w = new VanillaWorld(name);
                World.VanillaWorlds.Add(name, w);
            } catch (FileNotFoundException)
            {
                throw new ErrorException("No such world: " + name);
            }
            player.TellSystem(Chat.Purple, "Loaded world " + name);
        }
Beispiel #26
0
        public WorldServer(VanillaWorld core)
        {
            this.Router = new WorldRouter();
            this.Core   = core;
            Sessions    = new List <WorldSession>();

            ThreadStart updateLoop = () =>
            {
                while (true)
                {
                    this.Update();
                    Core.Components.ForEach(c => c.Update());
                    Thread.Sleep(500);
                }
            };

            Thread updateSessionThread = new Thread(updateLoop);

            updateSessionThread.Start();
        }
Beispiel #27
0
        static void ToRealWorld(Client player, string[] cmd, int iarg)
        {
            //Unless the world change does not work we give them this workaround
            player.TellChat(Chat.Yellow, "Please connect your minecraft to " + cmd [iarg] + ".mctraveler.eu");
            return;

            #pragma warning disable 162
            VanillaWorld w = World.Main;
            if (iarg < cmd.Length) //we got arguments
            {
                if (World.VanillaWorlds.ContainsKey(cmd [iarg]) == false)
                {
                    throw new UsageException("No world named " + cmd [iarg]);
                }

                w = World.VanillaWorlds [cmd [iarg]];
            }
            player.SetWorld(w);
            #pragma warning restore 162
        }
Beispiel #28
0
        public LuaManager(VanillaWorld world)
        {
            /*watcher = new FileSystemWatcher("scripts")
             * {
             *  NotifyFilter = NotifyFilters.LastAccess |
             *                 NotifyFilters.LastWrite |
             *                 NotifyFilters.FileName |
             *                 NotifyFilters.DirectoryName,
             *  Filter = "*.lua"
             * };
             *
             * //watcher.Changed += ReloadScript;
             * //watcher.Created += LoadScript;
             * //watcher.Renamed += LoadScript;
             * //watcher.Deleted += UnloadScript;
             *
             * watcher.EnableRaisingEvents = true;*/

            Script = new JavascriptContext();
            Script.SetParameter("debug", new Debug());
            Script.Run(File.ReadAllText("Scripts//test.js"));
        }
Beispiel #29
0
        public LuaManager(VanillaWorld world)
        {
            /*watcher = new FileSystemWatcher("scripts")
            {
                NotifyFilter = NotifyFilters.LastAccess |
                               NotifyFilters.LastWrite |
                               NotifyFilters.FileName |
                               NotifyFilters.DirectoryName,
                Filter = "*.lua"
            };

            //watcher.Changed += ReloadScript;
            //watcher.Created += LoadScript;
            //watcher.Renamed += LoadScript;
            //watcher.Deleted += UnloadScript;

            watcher.EnableRaisingEvents = true;*/

            Script = new JavascriptContext();
            Script.SetParameter("debug", new Debug());
            Script.Run(File.ReadAllText("Scripts//test.js"));
        }
Beispiel #30
0
        void VanillaSuspend(Client player, string[] cmd, int iarg)
        {
            if (player.Admin(Permissions.Server) == false)
            {
                throw new ErrorException("Disabled");
            }

            VanillaWorld w = player.Session.World as VanillaWorld;

            if (iarg < cmd.Length)
            {
                w = World.VanillaWorlds [cmd [iarg]];
            }

            if (w == null)
            {
                throw new UsageException("No vanilla world with the name " + cmd [iarg]);
            }

            w.Suspended = true;
            w.StopBackend();

            Log.WriteChat(player, null, -1, "[Suspend]");
        }
Beispiel #31
0
 public CharacterComponent(VanillaWorld vanillaWorld) : base(vanillaWorld)
 {
     Router.AddHandler(WorldOpcodes.CMSG_CHAR_ENUM, OnCharEnum);
     Router.AddHandler <PCCharDelete>(WorldOpcodes.CMSG_CHAR_DELETE, OnCharDelete);
     Router.AddHandler <PCCharCreate>(WorldOpcodes.CMSG_CHAR_CREATE, OnCharCreate);
 }
Beispiel #32
0
 public EntityComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     EntityChunks   = new Dictionary <Vector2, EntityChunk>();
     PlayerEntities = new List <PlayerEntity>();
 }
 public ActionButtonComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     this.Router.AddHandler <PCSetActionButton>(WorldOpcodes.CMSG_SET_ACTION_BUTTON, this.OnSetActionButton);
 }
Beispiel #34
0
 public static void Send(VanillaWorld world, string command)
 {
     instance.SendCommand(world.ServerName + "\t" + command);
 }
Beispiel #35
0
 public AuthComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     Router.AddHandler<PCAuthSession>(WorldOpcodes.CMSG_AUTH_SESSION, OnAuthSession);
 }
Beispiel #36
0
 public EntityComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     EntityChunks = new Dictionary<Vector2, EntityChunk>();
     PlayerEntities = new List<PlayerEntity>();
 }
Beispiel #37
0
 public LoginComponent(VanillaWorld vanillaWorld) : base(vanillaWorld)
 {
     this.Router.AddHandler <PCPlayerLogin>(WorldOpcodes.CMSG_PLAYER_LOGIN, this.OnPlayerLogin);
 }
Beispiel #38
0
 public SpellComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     Router.AddHandler <PCCastSpell>(WorldOpcodes.CMSG_CAST_SPELL, OnCastSpell);
     Router.AddHandler <PCCancelSpell>(WorldOpcodes.CMSG_CANCEL_CAST, OnCancelSpell);
 }
Beispiel #39
0
 public AuthComponent(VanillaWorld vanillaWorld) : base(vanillaWorld)
 {
     Router.AddHandler <PCAuthSession>(WorldOpcodes.CMSG_AUTH_SESSION, OnAuthSession);
 }
 public ActionButtonComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     this.Router.AddHandler<PCSetActionButton>(WorldOpcodes.CMSG_SET_ACTION_BUTTON, this.OnSetActionButton);
 }
 public PlayerMovementComponent(VanillaWorld vanillaWorld) : base(vanillaWorld)
 {
     MOVEMENT_CODES.ForEach(opcode => Router.AddHandler(opcode, GenerateResponse(opcode)));
     Router.AddHandler <PCMoveTimeSkipped>(WorldOpcodes.CMSG_MOVE_TIME_SKIPPED, OnMoveTimeSkipped);
     Router.AddHandler(WorldOpcodes.MSG_MOVE_WORLDPORT_ACK, OnWorldPort);
 }
Beispiel #42
0
 public SpellComponent(VanillaWorld vanillaWorld)
     : base(vanillaWorld)
 {
     Router.AddHandler<PCCastSpell>(WorldOpcodes.CMSG_CAST_SPELL, OnCastSpell);
     Router.AddHandler<PCCancelSpell>(WorldOpcodes.CMSG_CANCEL_CAST, OnCancelSpell);
 }
Beispiel #43
0
 public MailComponent(VanillaWorld vanillaWorld) : base(vanillaWorld)
 {
     Router.AddHandler <PCGetMailList>(WorldOpcodes.CMSG_GET_MAIL_LIST, OnGetMailList);
     Router.AddHandler <PCSendMail>(WorldOpcodes.CMSG_SEND_MAIL, OnSendMail);
     Router.AddHandler <PCSendMail>(WorldOpcodes.CMSG_MAIL_RETURN_TO_SENDER, OnReturnMailToSender);
 }