public override void read() { Account player = this._client._player; if (player == null) { return; } Clan clan = ClanManager.getClan(player.clanId); if (clan._id > 0 && (player.clanAccess >= 1 && player.clanAccess <= 2 || player.player_id == clan.owner_id)) { List <Account> clanPlayers = ClanManager.getClanPlayers(clan._id, -1L, true); if (clanPlayers.Count >= clan.maxPlayers) { this.result = -1; } else { int num = (int)this.readC(); for (int index = 0; index < num; ++index) { Account account = AccountManager.getAccount(this.readQ(), 0); if (account != null && clanPlayers.Count < clan.maxPlayers && (account.clanId == 0 && PlayerManager.getRequestClanId(account.player_id) > 0)) { using (CLAN_MEMBER_INFO_INSERT_PAK memberInfoInsertPak = new CLAN_MEMBER_INFO_INSERT_PAK(account)) ClanManager.SendPacket((SendPacket)memberInfoInsertPak, clanPlayers); account.clanId = player.clanId; account.clanDate = int.Parse(DateTime.Now.ToString("yyyyMMdd")); account.clanAccess = 3; SEND_CLAN_INFOS.Load(account, (Account)null, 3); ComDiv.updateDB("accounts", "player_id", (object)account.player_id, new string[3] { "clanaccess", "clan_id", "clandate" }, new object[3] { (object)account.clanAccess, (object)account.clanId, (object)account.clanDate }); PlayerManager.DeleteInviteDb(player.clanId, account.player_id); if (account._isOnline) { account.SendPacket((SendPacket) new CLAN_GET_CLAN_MEMBERS_PAK(clanPlayers), false); account._room.SendPacketToPlayers((SendPacket) new ROOM_GET_SLOTONEINFO_PAK(account, clan)); account.SendPacket((SendPacket) new CLAN_NEW_INFOS_PAK(clan, clanPlayers.Count + 1), false); } if (MessageManager.getMsgsCount(account.player_id) < 100) { Message message = this.CreateMessage(clan, account.player_id, this._client.player_id); if (message != null && account._isOnline) { account.SendPacket((SendPacket) new BOX_MESSAGE_RECEIVE_PAK(message), false); } } ++this.result; clanPlayers.Add(account); } } } } else { this.result = -1; } }
public override void read() { Account p = _client._player; if (p == null) { return; } Clan clan = ClanManager.getClan(p.clanId); if (clan._id > 0 && (p.clanAccess >= 1 && p.clanAccess <= 2 || p.player_id == clan.owner_id)) { List <Account> clanPlayers = ClanManager.getClanPlayers(clan._id, -1, true); if (clanPlayers.Count >= clan.maxPlayers) { result = -1; return; } int playersCount = readC(); for (int i = 0; i < playersCount; i++) { Account pl = AccountManager.getAccount(readQ(), 0); if (pl != null && clanPlayers.Count < clan.maxPlayers && pl.clanId == 0 && PlayerManager.getRequestClanId(pl.player_id) > 0) { using (CLAN_MEMBER_INFO_INSERT_PAK packet = new CLAN_MEMBER_INFO_INSERT_PAK(pl)) ClanManager.SendPacket(packet, clanPlayers); pl.clanId = p.clanId; pl.clanDate = int.Parse(DateTime.Now.ToString("yyyyMMdd")); pl.clanAccess = 3; SEND_CLAN_INFOS.Load(pl, null, 3); ComDiv.updateDB("contas", "player_id", pl.player_id, new string[] { "clanaccess", "clan_id", "clandate" }, pl.clanAccess, pl.clanId, pl.clanDate); PlayerManager.DeleteInviteDb(p.clanId, pl.player_id); if (pl._isOnline) { pl.SendPacket(new CLAN_GET_CLAN_MEMBERS_PAK(clanPlayers), false); Room r = pl._room; if (r != null) { r.SendPacketToPlayers(new ROOM_GET_SLOTONEINFO_PAK(pl, clan)); } pl.SendPacket(new CLAN_NEW_INFOS_PAK(clan, clanPlayers.Count + 1), false); } if (MessageManager.getMsgsCount(pl.player_id) < 100) { Message msg = CreateMessage(clan, pl.player_id, _client.player_id); if (msg != null && pl._isOnline) { pl.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(msg), false); } } result++; clanPlayers.Add(pl); } } clanPlayers = null; } else { result = -1; } }
public override void run() { Account player = _client._player; if (player == null || player.player_name.Length == 0) { return; } Clan clan = ClanManager.getClan(clanId); List <Account> clanPlayers = ClanManager.getClanPlayers(clanId, -1, true); if (clan._id == 0) { _client.SendPacket(new CLAN_MESSAGE_REQUEST_ACCEPT_PAK(2147487835)); } else if (player.clanId > 0) { _client.SendPacket(new CLAN_MESSAGE_REQUEST_ACCEPT_PAK(2147487832)); } else if (clan.maxPlayers <= clanPlayers.Count) { _client.SendPacket(new CLAN_MESSAGE_REQUEST_ACCEPT_PAK(2147487830)); } else if (type == 0 || type == 1) { try { uint erro = 0; Account master = AccountManager.getAccount(clan.owner_id, 0); if (master != null) { if (MessageManager.getMsgsCount(clan.owner_id) < 100) { Message msg = CreateMessage(clan, player.player_name, _client.player_id); if (msg != null && master._isOnline) { master.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(msg), false); } } if (type == 1) { int date = int.Parse(DateTime.Now.ToString("yyyyMMdd")); if (ComDiv.updateDB("contas", "player_id", player.player_id, new string[] { "clan_id", "clanaccess", "clandate" }, clan._id, 3, date)) { using (CLAN_MEMBER_INFO_INSERT_PAK packet = new CLAN_MEMBER_INFO_INSERT_PAK(player)) ClanManager.SendPacket(packet, clanPlayers); player.clanId = clan._id; player.clanDate = date; player.clanAccess = 3; _client.SendPacket(new CLAN_GET_CLAN_MEMBERS_PAK(clanPlayers)); Room room = player._room; if (room != null) { room.SendPacketToPlayers(new ROOM_GET_SLOTONEINFO_PAK(player, clan)); } _client.SendPacket(new CLAN_NEW_INFOS_PAK(clan, master, clanPlayers.Count + 1)); } else { erro = 0x80000000; } } } else { erro = 0x80000000; } _client.SendPacket(new BOX_MESSAGE_SEND_PAK(erro)); } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[CLAN_MESSAGE_REQUEST_INTERACT_REC.run] Erro fatal!"); } } }
public override void run() { Account player = this._client._player; if (player == null || player.player_name.Length == 0) { return; } Clan clan = ClanManager.getClan(this.clanId); List <Account> clanPlayers = ClanManager.getClanPlayers(this.clanId, -1L, true); if (clan._id == 0) { this._client.SendPacket((SendPacket) new CLAN_MESSAGE_REQUEST_ACCEPT_PAK(2147487835U)); } else if (player.clanId > 0) { this._client.SendPacket((SendPacket) new CLAN_MESSAGE_REQUEST_ACCEPT_PAK(2147487832U)); } else if (clan.maxPlayers <= clanPlayers.Count) { this._client.SendPacket((SendPacket) new CLAN_MESSAGE_REQUEST_ACCEPT_PAK(2147487830U)); } else { if (this.type != 0 && this.type != 1) { return; } try { uint erro = 0; Account account = AccountManager.getAccount(clan.owner_id, 0); if (account != null) { if (MessageManager.getMsgsCount(clan.owner_id) < 100) { Message message = this.CreateMessage(clan, player.player_name, this._client.player_id); if (message != null && account._isOnline) { account.SendPacket((SendPacket) new BOX_MESSAGE_RECEIVE_PAK(message), false); } } if (this.type == 1) { int num = int.Parse(DateTime.Now.ToString("yyyyMMdd")); if (ComDiv.updateDB("accounts", "player_id", (object)player.player_id, new string[3] { "clan_id", "clanaccess", "clandate" }, new object[3] { (object)clan._id, (object)3, (object)num })) { using (CLAN_MEMBER_INFO_INSERT_PAK memberInfoInsertPak = new CLAN_MEMBER_INFO_INSERT_PAK(player)) ClanManager.SendPacket((SendPacket)memberInfoInsertPak, clanPlayers); player.clanId = clan._id; player.clanDate = num; player.clanAccess = 3; this._client.SendPacket((SendPacket) new CLAN_GET_CLAN_MEMBERS_PAK(clanPlayers)); player._room.SendPacketToPlayers((SendPacket) new ROOM_GET_SLOTONEINFO_PAK(player, clan)); this._client.SendPacket((SendPacket) new CLAN_NEW_INFOS_PAK(clan, account, clanPlayers.Count + 1)); } else { erro = 2147483648U; } } } else { erro = 2147483648U; } this._client.SendPacket((SendPacket) new BOX_MESSAGE_SEND_PAK(erro)); } catch (Exception ex) { Logger.error(ex.ToString()); } } }