public override void run() { try { if (_client == null) { return; } Account player = _client._player; if (player == null || player.player_name.Length == 0 || player.player_name == playerName) { _client.SendPacket(new FRIEND_INVITE_PAK(0x80001037)); } else if (player.FriendSystem._friends.Count >= 50) { _client.SendPacket(new FRIEND_INVITE_PAK(0x80001038)); } else { Account friend = AccountManager.getAccount(playerName, 1, 32); if (friend != null) { if (player.FriendSystem.GetFriendIdx(friend.player_id) == -1) { if (friend.FriendSystem._friends.Count >= 50) { _client.SendPacket(new FRIEND_INVITE_PAK(0x80001038)); } else { int erro = AllUtils.AddFriend(friend, player, 2); if (AllUtils.AddFriend(player, friend, (erro == 1 ? 0 : 1)) == -1 || erro == -1) { _client.SendPacket(new FRIEND_INVITE_PAK(0x80001039)); return; } Friend f1 = player.FriendSystem.GetFriend(friend.player_id, out idx1); Friend f2 = friend.FriendSystem.GetFriend(player.player_id, out idx2); if (f2 != null) { friend.SendPacket(new FRIEND_UPDATE_PAK(erro == 0 ? FriendChangeState.Insert : FriendChangeState.Update, f2, idx2), false); } if (f1 != null) { _client.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Insert, f1, idx1)); } } } else { _client.SendPacket(new FRIEND_INVITE_PAK(0x80001041)); } } else { _client.SendPacket(new FRIEND_INVITE_PAK(0x80001042)); } } } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[FRIEND_INVITE_REC.run] Erro fatal!"); } }
public override void run() { try { if (this._client == null) { return; } Account player = this._client._player; if (player == null || player.player_name.Length == 0 || player.player_name == this.playerName) { this._client.SendPacket((SendPacket) new FRIEND_INVITE_PAK(2147487799U)); } else if (player.FriendSystem._friends.Count >= 50) { this._client.SendPacket((SendPacket) new FRIEND_INVITE_PAK(2147487800U)); } else { Account account = AccountManager.getAccount(this.playerName, 1, 32); if (account != null) { if (player.FriendSystem.GetFriendIdx(account.player_id) == -1) { if (account.FriendSystem._friends.Count >= 50) { this._client.SendPacket((SendPacket) new FRIEND_INVITE_PAK(2147487800U)); } else { int num = AllUtils.AddFriend(account, player, 2); if (AllUtils.AddFriend(player, account, num == 1 ? 0 : 1) == -1 || num == -1) { this._client.SendPacket((SendPacket) new FRIEND_INVITE_PAK(2147487801U)); } else { Friend friend1 = player.FriendSystem.GetFriend(account.player_id, out this.idx1); Friend friend2 = account.FriendSystem.GetFriend(player.player_id, out this.idx2); if (friend2 != null) { account.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(num == 0 ? FriendChangeState.Insert : FriendChangeState.Update, friend2, this.idx2), false); } if (friend1 == null) { return; } this._client.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Insert, friend1, this.idx1)); } } } else { this._client.SendPacket((SendPacket) new FRIEND_INVITE_PAK(2147487809U)); } } else { this._client.SendPacket((SendPacket) new FRIEND_INVITE_PAK(2147487810U)); } } } catch (Exception ex) { Logger.info("[FRIEND_INVITE_REC] " + ex.ToString()); } }