Exemplo n.º 1
0
        public static void Initialize()
        {
            m_clients = new Dictionary <uint, LoLClient>();
            if (enet_initialize() < 0)
            {
                throw new Exception("Unable to initialize ENet...");
            }

            var address = new ENetAddress();

            address.host = SERVER_HOST;
            address.port = ConfigurationProvider.Instance.Configuration.ServerPort;

            _server = enet_host_create(&address, new IntPtr(32), new IntPtr(32), 0, 0);

            if (_server == null)
            {
                throw new Exception("Unable to start ENet server...");
            }

            var key = Convert.FromBase64String(SERVER_KEY);

            if (key.Length <= 0)
            {
                throw new Exception("Unable to convert SERVER_KEY...");
            }

            BlowFish = new BlowFish(key);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Yorick " + SERVER_VERSION);
            WriteToLog.ExecutingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            WriteToLog.LogfileName        = "IntWarsSharp.txt";
            WriteToLog.CreateLogFile();
            ExecutingDirectory = WriteToLog.ExecutingDirectory;

            System.AppDomain.CurrentDomain.FirstChanceException += Logger.CurrentDomain_FirstChanceException;
            System.AppDomain.CurrentDomain.UnhandledException   += Logger.CurrentDomain_UnhandledException;


            Logger.LogCoreInfo("Loading Config.");
            Config.LoadConfig("Settings/GameInfo.json");

            Logger.LogCoreInfo("Loading RAF files in filearchives/.");

            var settings = Settings.Load("Settings/Settings.json");

            if (!RAFManager.getInstance().init(System.IO.Path.Combine(settings.RadsPath, "filearchives")))
            {
                Logger.LogCoreError("Couldn't load RAF files. Make sure you have a 'filearchives' directory in the server's root directory. This directory is to be taken from RADS/projects/lol_game_client/");
                return;
            }

            ItemManager.getInstance().init();

            Logger.LogCoreInfo("Game started");

            Game g       = new Game();
            var  address = new ENetAddress();

            address.host = SERVER_HOST;
            address.port = SERVER_PORT;


            if (!g.initialize(address, SERVER_KEY))
            {
                Logger.LogCoreError("Couldn't listen on port " + SERVER_PORT + ", or invalid key");
                return;
            }

            //Sniffer.getInstance().setGame(g);
            //var p = Process.Start("SnifferApp.exe");

            g.netLoop();

            PathNode.DestroyTable(); // Cleanup
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Yorick " + SERVER_VERSION);
            WriteToLog.ExecutingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            WriteToLog.LogfileName = "IntWarsSharp.txt";
            WriteToLog.CreateLogFile();
            ExecutingDirectory = WriteToLog.ExecutingDirectory;

            System.AppDomain.CurrentDomain.FirstChanceException += Logger.CurrentDomain_FirstChanceException;
            System.AppDomain.CurrentDomain.UnhandledException += Logger.CurrentDomain_UnhandledException;

            Logger.LogCoreInfo("Loading Config.");
            Config.LoadConfig();

            Logger.LogCoreInfo("Loading RAF files in filearchives/.");

            //var basePath = RAFManager.getInstance().findGameBasePath();
            var basePath = @"C:\LolPatcherProxy\Base\RADS\projects\lol_game_client";
            if (!RAFManager.getInstance().init(System.IO.Path.Combine(basePath, "filearchives")))
            {
                Logger.LogCoreError("Couldn't load RAF files. Make sure you have a 'filearchives' directory in the server's root directory. This directory is to be taken from RADS/projects/lol_game_client/");
                return;
            }

            ItemManager.getInstance().init();

            Logger.LogCoreInfo("Game started");

            Game g = new Game();
            var address = new ENetAddress();
            address.host = SERVER_HOST;
            address.port = SERVER_PORT;


            if (!g.initialize(address, SERVER_KEY))
            {
                Logger.LogCoreError("Couldn't listen on port " + SERVER_PORT + ", or invalid key");
                return;
            }

            Sniffer.getInstance().setGame(g);
            // var p = Process.Start("SnifferApp.exe");

            g.netLoop();

            PathNode.DestroyTable(); // Cleanup
        }
Exemplo n.º 4
0
 public static extern ENetPeer* enet_host_connect(ENetHost* host, ref ENetAddress address, IntPtr channelCount);
Exemplo n.º 5
0
 public static extern int enet_address_get_host_ip(ref ENetAddress address, byte[] hostIP, IntPtr ipLength);
Exemplo n.º 6
0
 static extern int native_address_get_host_ip(ref ENetAddress address, byte* hostIP, IntPtr ipLength);
Exemplo n.º 7
0
 static extern int native_address_set_host(ref ENetAddress address, byte[] hostName);
Exemplo n.º 8
0
 public override int address_get_host(ref ENetAddress address, byte[] hostName, IntPtr nameLength)
 {
     return native_address_get_host(ref address, hostName, nameLength);
 }
Exemplo n.º 9
0
 public abstract ENetHost* host_create(ref ENetAddress address,
     IntPtr peerLimit, IntPtr channelLimit, uint incomingBandwidth, uint outgoingBandwidth);
Exemplo n.º 10
0
 public abstract ENetPeer* host_connect(ENetHost* host, ref ENetAddress address, IntPtr channelCount, uint data);
Exemplo n.º 11
0
 public static ENetHost* enet_host_create(ref ENetAddress address,
     IntPtr peerLimit, IntPtr channelLimit, uint incomingBandwidth, uint outgoingBandwidth)
 {
     return Platform.host_create(ref address, peerLimit, channelLimit, incomingBandwidth, outgoingBandwidth);
 }
Exemplo n.º 12
0
 public static ENetPeer* enet_host_connect(ENetHost* host, ref ENetAddress address, IntPtr channelCount, uint data)
 {
     return Platform.host_connect(host, ref address, channelCount, data);
 }
Exemplo n.º 13
0
 public abstract int address_get_host_ip(ref ENetAddress address, byte[] hostIP, IntPtr ipLength);
Exemplo n.º 14
0
 public abstract int address_get_host(ref ENetAddress address, byte[] hostName, IntPtr nameLength);
Exemplo n.º 15
0
 public abstract int address_set_host(ref ENetAddress address, byte[] hostName);
Exemplo n.º 16
0
 static extern ENetHost* native_host_create(ref ENetAddress address,
     IntPtr peerLimit, IntPtr channelLimit, uint incomingBandwidth, uint outgoingBandwidth);
Exemplo n.º 17
0
 public override int address_set_host(ref ENetAddress address, byte[] hostName)
 {
     return native_address_set_host(ref address, hostName);
 }
Exemplo n.º 18
0
 public static int enet_address_set_host(ref ENetAddress address, byte[] hostName)
 {
     return Platform.address_set_host(ref address, hostName);
 }
Exemplo n.º 19
0
 public override int address_get_host_ip(ref ENetAddress address, byte[] hostIP, IntPtr ipLength)
 {
     return native_address_get_host_ip(ref address, hostIP, ipLength);
 }
Exemplo n.º 20
0
 public static int enet_address_get_host(ref ENetAddress address, byte[] hostName, IntPtr nameLength)
 {
     return Platform.address_get_host(ref address, hostName, nameLength);
 }
Exemplo n.º 21
0
 static extern int native_address_get_host(ref ENetAddress address, byte* hostName, IntPtr nameLength);
Exemplo n.º 22
0
 public static int enet_address_get_host_ip(ref ENetAddress address, byte[] hostIP, IntPtr ipLength)
 {
     return Platform.address_get_host_ip(ref address, hostIP, ipLength);
 }
Exemplo n.º 23
0
 public static extern int enet_address_get_host(ref ENetAddress address, byte[] hostName, IntPtr nameLength);
Exemplo n.º 24
0
 public override ENetPeer* host_connect(ENetHost* host, ref ENetAddress address, IntPtr channelCount, uint data)
 {
     return native_host_connect(host, ref address, channelCount, data);
 }
Exemplo n.º 25
0
 public static extern int enet_address_set_host(ref ENetAddress address, byte[] hostName);
Exemplo n.º 26
0
 public override ENetHost* host_create(ref ENetAddress address,
     IntPtr peerLimit, IntPtr channelLimit, uint incomingBandwidth, uint outgoingBandwidth)
 {
     return native_host_create(ref address, peerLimit, channelLimit, incomingBandwidth, outgoingBandwidth);
 }
Exemplo n.º 27
0
 public static extern ENetHost* enet_host_create(ref ENetAddress address,
                                                 IntPtr peerLimit, uint incomingBandwidth, uint outgoingBandwidth);
Exemplo n.º 28
0
 static extern ENetPeer* native_host_connect(ENetHost* host, ref ENetAddress address, IntPtr channelCount, uint data);
Exemplo n.º 29
0
        private const double REFRESH_RATE    = 16.666; // 60 fps

        public bool initialize(ENetAddress address, string baseKey)
        {
            if (enet_initialize() < 0)
            {
                return(false);
            }

            _server = enet_host_create(&address, new IntPtr(32), new IntPtr(32), 0, 0);
            if (_server == null)
            {
                return(false);
            }

            var key = System.Convert.FromBase64String(baseKey);

            if (key.Length <= 0)
                return(false);

            fixed(byte *s = key)
            {
                _blowfish = BlowFishCS.BlowFishCS.BlowFishCreate(s, new IntPtr(16));
            }

            PacketHandlerManager.getInstace().InitHandlers(this);

            map = new SummonersRift(this);

            PacketNotifier.setMap(map);
            //TODO: better lua implementation

            var id = 1;

            foreach (var p in Config.players)
            {
                var player = new ClientInfo(p.Value.rank, ((p.Value.team.ToLower() == "blue") ? TeamId.TEAM_BLUE : TeamId.TEAM_PURPLE), p.Value.ribbon, p.Value.icon);

                player.setName(p.Value.name);

                player.setSkinNo(p.Value.skin);
                player.userId = id; // same as StartClient.bat
                id++;

                player.setSummoners(strToId(p.Value.summoner1), strToId(p.Value.summoner2));

                Champion c   = ChampionFactory.getChampionFromType(p.Value.champion, map, GetNewNetID(), (int)player.userId);
                var      pos = c.getRespawnPosition();

                c.setPosition(pos.Item1, pos.Item2);
                c.setTeam((p.Value.team.ToLower() == "blue") ? TeamId.TEAM_BLUE : TeamId.TEAM_PURPLE);
                c.levelUp();

                player.setChampion(c);
                var pair = new Pair <uint, ClientInfo>();
                pair.Item2 = player;
                players.Add(pair);
            }

            // Uncomment the following to get 2-players

            /*ClientInfo* player2 = new ClientInfo("GOLD", TEAM_PURPLE);
             * player2->setName("tseT");
             * Champion* c2 = ChampionFactory::getChampionFromType("Ezreal", map, GetNewNetID());
             * c2->setPosition(100.f, 273.55f);
             * c2->setTeam(1);
             * map->addObject(c2);
             * player2->setChampion(c2);
             * player2->setSkinNo(4);
             * player2->userId = 2; // same as StartClient.bat
             * player2->setSummoners(SPL_Ignite, SPL_Flash);
             *
             * players.push_back(player2);*/

            return(_isAlive = true);
        }
Exemplo n.º 30
0
        private const double REFRESH_RATE = 16.666; // 60 fps

        public bool initialize(ENetAddress address, string baseKey)
        {
            if (enet_initialize() < 0)
                return false;

            _server = enet_host_create(&address, new IntPtr(32), new IntPtr(32), 0, 0);
            if (_server == null)
                return false;

            var key = System.Convert.FromBase64String(baseKey);

            if (key.Length <= 0)
                return false;

            fixed (byte* s = key)
            {
                _blowfish = BlowFishCS.BlowFishCS.BlowFishCreate(s, new IntPtr(16));
            }

            PacketHandlerManager.getInstace().InitHandlers(this);

            map = new SummonersRift(this);

            PacketNotifier.setMap(map);
            //TODO: better lua implementation

            var id = 1;
            foreach (var p in Config.players)
            {
                var player = new ClientInfo(p.Value.rank, ((p.Value.team.ToLower() == "blue") ? TeamId.TEAM_BLUE : TeamId.TEAM_PURPLE), p.Value.ribbon, p.Value.icon);

                player.setName(p.Value.name);

                player.setSkinNo(p.Value.skin);
                player.userId = id; // same as StartClient.bat
                id++;

                player.setSummoners(strToId(p.Value.summoner1), strToId(p.Value.summoner2));

                Champion c = ChampionFactory.getChampionFromType(p.Value.champion, map, GetNewNetID(), (int)player.userId);
                var pos = c.getRespawnPosition();

                c.setPosition(pos.Item1, pos.Item2);
                c.setTeam((p.Value.team.ToLower() == "blue") ? TeamId.TEAM_BLUE : TeamId.TEAM_PURPLE);
                c.levelUp();

                player.setChampion(c);
                var pair = new Pair<uint, ClientInfo>();
                pair.Item2 = player;
                players.Add(pair);
            }

            // Uncomment the following to get 2-players
            /*ClientInfo* player2 = new ClientInfo("GOLD", TEAM_PURPLE);
            player2->setName("tseT");
            Champion* c2 = ChampionFactory::getChampionFromType("Ezreal", map, GetNewNetID());
            c2->setPosition(100.f, 273.55f);
            c2->setTeam(1);
            map->addObject(c2);
            player2->setChampion(c2);
            player2->setSkinNo(4);
            player2->userId = 2; // same as StartClient.bat
            player2->setSummoners(SPL_Ignite, SPL_Flash);

            players.push_back(player2);*/

            return _isAlive = true;
        }