public static void LoadShutdown(ReceiveGPacket p) { string text1 = p.readS((int)p.readC()); string text2 = p.readS((int)p.readC()); Account account = AccountManager.getAccount(text1, 0, 0); if (account == null || !(account.password == ComDiv.gen5(text2)) || account.access < AccessLevel.GameMaster) { return; } int num = 0; foreach (GameClient gameClient in (IEnumerable <GameClient>)GameManager._socketList.Values) { gameClient._client.Shutdown(SocketShutdown.Both); gameClient.Close(5000, false); ++num; } Logger.warning("[SM] Clients downed due a shutdown: " + (object)num + ". (By: " + text1 + ")"); GameManager.ServerIsClosed = true; GameManager.mainSocket.Close(5000); Logger.warning("[SM] Server receive code has been shutdowned for 5 seconds!"); Thread.Sleep(5000); Game_SyncNet.udp.Close(); Logger.warning("[SM] Starting step 2."); foreach (GameClient gameClient in (IEnumerable <GameClient>)GameManager._socketList.Values) { gameClient.Close(0, false); } Logger.warning("[SM] Server has been completely shutdowned."); }
public static void LoadShutdown(ReceiveGPacket p) { string str1 = p.readS((int)p.readC()); string str2 = ComDiv.gen5(p.readS((int)p.readC())); Account accountDb = AccountManager.getInstance().getAccountDB((object)str1, (object)str2, 2, 0); if (accountDb == null || !(accountDb.password == str2) || accountDb.access < 4) { return; } int num = 0; foreach (LoginClient loginClient in (IEnumerable <LoginClient>)LoginManager._socketList.Values) { loginClient._client.Shutdown(SocketShutdown.Both); loginClient._client.Close(10000); ++num; } Logger.warning("[SM] Clients downed due a shutdown: " + (object)num + ". (By: " + str1 + ")"); LoginManager.ServerIsClosed = true; LoginManager.mainSocket.Close(5000); Logger.warning("[SM] Server receive code has been shutdowned for 5 seconds!"); Thread.Sleep(5000); Auth_SyncNet.udp.Close(); Logger.warning("[SM] Starting step 2."); foreach (LoginClient loginClient in (IEnumerable <LoginClient>)LoginManager._socketList.Values) { loginClient.Close(0, true); } Logger.warning("[SM] Server has been completely shutdowned."); }
public static void Load(ReceiveGPacket p) { int type = p.readC(); int clanId = p.readD(); long ownerId; int date; string name, info; Clan clanCache = ClanManager.getClan(clanId); if (type == 0) { if (clanCache != null) { return; } ownerId = p.readQ(); date = p.readD(); name = p.readS(p.readC()); info = p.readS(p.readC()); Clan clan = new Clan { _id = clanId, _name = name, owner_id = ownerId, _logo = 0, _info = info, creationDate = date }; ClanManager.AddClan(clan); } else { if (clanCache != null) { ClanManager.RemoveClan(clanCache); } } }
public static void Load(ReceiveGPacket p) { int num1 = (int)p.readC(); int id = p.readD(); Clan clan = ClanManager.getClan(id); if (num1 == 0) { if (clan != null) { return; } long num2 = p.readQ(); int num3 = p.readD(); string str1 = p.readS((int)p.readC()); string str2 = p.readS((int)p.readC()); ClanManager.AddClan(new Clan() { _id = id, _name = str1, owner_id = num2, _logo = 0U, _info = str2, creationDate = num3 }); } else { if (clan == null) { return; } ClanManager.RemoveClan(clan); } }
public Add_Allow_Rule(ReceiveGPacket dados) { // codigo de operação - 1 byte // ipSize - 1 byte // ip int ipSize = dados.readC(); string ip = dados.readS(ipSize); IPAddress ipAddr; if (!IPAddress.TryParse(ip, out ipAddr)) { Printf.danger("[Error] Invalid IP"); return; } if (allowed.Contains(ip)) { Printf.info("[Permitir] Já esta na liberado " + ip); return; } Netsh.Permit(ip); allowed.Add(ip); Printf.blue("[Permitir] IP: " + ip + " Ports " + Config.gamePort + " UDP " + Config.battlePort); }
public static void LoadGMWarning(ReceiveGPacket p) { string text1 = p.readS((int)p.readC()); string text2 = p.readS((int)p.readC()); string msg = p.readS((int)p.readH()); Account account = AccountManager.getAccount(text1, 0, 0); if (account == null || !(account.password == ComDiv.gen5(text2)) || account.access < AccessLevel.GameMaster) { return; } int num = 0; using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) num = GameManager.SendPacketToAllClients((SendPacket)messageAnnouncePak); Logger.warning("[SM] Aviso gerado a " + (object)num + " jogadores: " + msg); }
public static void LoadGMWarning(ReceiveGPacket p) { string str1 = p.readS((int)p.readC()); string text = p.readS((int)p.readC()); string msg = p.readS((int)p.readH()); string str2 = ComDiv.gen5(text); Account accountDb = AccountManager.getInstance().getAccountDB((object)str1, (object)str2, 2, 0); if (accountDb == null || accountDb.access <= 3) { return; } int num = 0; using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) num = LoginManager.SendPacketToAllClients((SendPacket)messageAnnouncePak); Logger.warning("[SM] Aviso gerado a " + (object)num + " jogadores: " + msg); }
public static void Load(ReceiveGPacket p) { long id1 = p.readQ(); int num1 = (int)p.readC(); Account account = AccountManager.getInstance().getAccount(id1, true); if (account == null) { return; } switch (num1) { case 0: ClanInfo.ClearList(account); break; case 1: long pId = p.readQ(); string str = p.readS((int)p.readC()); byte[] buffer = p.readB(4); byte num2 = p.readC(); Account member = new Account() { player_id = pId, player_name = str, _rank = (int)num2 }; member._status.SetData(buffer, pId); ClanInfo.AddMember(account, member); break; case 2: long id2 = p.readQ(); ClanInfo.RemoveMember(account, id2); break; case 3: int num3 = p.readD(); int num4 = (int)p.readC(); account.clan_id = num3; account.clanAccess = num4; break; } }
public static void Load(ReceiveGPacket p) { long playerId = p.readQ(), memberId; int type = p.readC(); Account player = AccountManager.getInstance().getAccount(playerId, true); if (player == null) { return; } if (type == 0) { ClanInfo.ClearList(player); } else if (type == 1) { memberId = p.readQ(); string name = p.readS(p.readC()); byte[] status = p.readB(4); byte rank = p.readC(); Account member = new Account { player_id = memberId, player_name = name, _rank = rank }; member._status.SetData(status, memberId); ClanInfo.AddMember(player, member); } else if (type == 2) { memberId = p.readQ(); ClanInfo.RemoveMember(player, memberId); } else if (type == 3) { int clanId = p.readD(); int clanAccess = p.readC(); player.clan_id = clanId; player.clanAccess = clanAccess; } }
private static void parse(string path, string missionName, int typeLoad) { int missionId = ConvertStringToInt(missionName); if (missionId == 0) { SaveLog.warning("[INVALID]: " + missionName); } byte[] buffer; try { buffer = File.ReadAllBytes(path); } catch { buffer = new byte[0]; } if (buffer.Length == 0) { return; } try { ReceiveGPacket r = new ReceiveGPacket(buffer); r.readS(4); int questType = r.readD(); r.readB(16); int valor1 = 0, valor2 = 0; for (int i = 0; i < 40; i++) { int missionBId = valor2++, cardBId = valor1; if (valor2 == 4) { valor2 = 0; valor1++; } int reqType = r.readUH(); int type = r.readC(); int mapId = r.readC(); byte limitCount = r.readC(); ClassType weaponClass = (ClassType)r.readC(); int weaponId = r.readUH(); Card nc = new Card(cardBId, missionBId) { _mapId = mapId, _weaponReq = weaponClass, _weaponReqId = weaponId, _missionType = (MISSION_TYPE)type, _missionLimit = limitCount, _missionId = missionId }; list.Add(nc); if (questType == 1) { r.readB(24); } } int vai = (questType == 2 ? 5 : 1); for (int i = 0; i < 10; i++) { int gp = r.readD(); int xp = r.readD(); int medals = r.readD(); for (int i2 = 0; i2 < vai; i2++) { int unk = r.readD(); int type = r.readD(); int itemId = r.readD(); int itemCount = r.readD(); } if (typeLoad == 1) { CardAwards card = new CardAwards { _id = missionId, _card = i, _exp = (questType == 1 ? (xp * 10) : xp), _gp = gp }; GetCardMedalInfo(card, medals); if (!card.Unusable()) { awards.Add(card); } } } if (questType == 2) { int goldResult = r.readD(); r.readB(8); for (int i = 0; i < 5; i++) { int unkI = r.readD(); int typeI = r.readD(); //1 - unidade | 2 - dias int itemId = r.readD(); int itemCount = r.readD(); if (unkI > 0 && typeLoad == 1) { _items.Add(new MissionItemAward { _missionId = missionId, item = new ItemsModel(itemId) { _equip = 1, _count = (uint)itemCount, _name = "Mission item" } }); } } } } catch (XmlException ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[MissionCardXML.parse] Erro fatal!"); } }
public Add_Drop_Rule(ReceiveGPacket dados) { try { int ipSize = dados.readC(); int descSize = dados.readC(); string ip = dados.readS(ipSize); if (blocked.Contains(ip)) { return; } IPAddress ipAddr; if (!IPAddress.TryParse(ip, out ipAddr)) { Printf.danger("[Error] Invalid IP"); return; } if (WhiteList.check(ipAddr)) { return; // WhiteList } string descricao = "[" + DateTime.Now.ToString() + "] " + dados.readS(descSize); int timeBan = Tools.getGravit(dados.readC()); // Verifica se o ip já foi permitido if (Add_Allow_Rule.allowed.Contains(ip)) { Printf.info("[Remove] Removendo ip ja liberado para bloqueio" + ip); Netsh.Remove("PB API Protection " + ip); Add_Allow_Rule.allowed.Remove(ip); } uint date = uint.Parse(DateTime.Now.ToString("yyMMddHHmm")); string name = Netsh.RandName(timeBan, ip, date); Netsh.Block(ip, name, descricao); // Bloqueia no firewall Printf.danger("[Blocked " + timeBan + " Min]", false); Printf.white("...IP " + ip, false); Printf.white("...Name: " + name, false); Printf.white("...Description: " + descricao, false); // Adiciona na lista de bloqueados caso o tempo seja diferente de 0 if (timeBan > 0) { Monitoring.RuleInfo ev = new Monitoring.RuleInfo { start = date, end = (date + (int)timeBan), name = name, _ip = ip }; Monitoring.unlockQueue.Add(ev); Printf.info("Adicionado, vence: " + (date + timeBan) + " Name:" + name); } else { Memory.blockPerm++; Printf.info("Bloqueio permanente - " + ip); } blocked.Add(ip); } catch (Exception ex) { Printf.b_danger("[AddRule]\n" + ex); } }