private static void initBlowfish(string key) { var decodeKey = Convert.FromBase64String(key); if (decodeKey.Length <= 0) { return; fixed(byte *s = decodeKey) _blowfish = BlowFishCreate(s, new IntPtr(16)); }
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); }
public static extern void Decrypt1(BlowFish *handle, byte *buf, IntPtr n, int iMode = (int)BlowfishMode.ECB);
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; }