Пример #1
0
 public override void run()
 {
     try
     {
         Account player = this._client._player;
         if (player == null)
         {
             return;
         }
         Friend friend1 = player.FriendSystem.GetFriend(this.index);
         if (friend1 != null)
         {
             PlayerManager.DeleteFriend(friend1.player_id, player.player_id);
             Account account = AccountManager.getAccount(friend1.player_id, 32);
             if (account != null)
             {
                 int    index   = -1;
                 Friend friend2 = account.FriendSystem.GetFriend(player.player_id, out index);
                 if (friend2 != null)
                 {
                     friend2.removed = true;
                     PlayerManager.UpdateFriendBlock(account.player_id, friend2);
                     SEND_FRIENDS_INFOS.Load(account, friend2, 2);
                     account.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend2, index), false);
                 }
             }
             player.FriendSystem.RemoveFriend(friend1);
             this._client.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Delete, (Friend)null, 0, this.index));
         }
         else
         {
             this.erro = 2147483648U;
         }
         this._client.SendPacket((SendPacket) new FRIEND_REMOVE_PAK(this.erro));
         this._client.SendPacket((SendPacket) new FRIEND_MY_FRIENDLIST_PAK(player.FriendSystem._friends));
     }
     catch (Exception ex)
     {
         Logger.info("[FRIEND_DELETE_REC] " + ex.ToString());
     }
 }
 public override void run()
 {
     try
     {
         Account p = _client._player;
         if (p == null)
         {
             return;
         }
         Friend f = p.FriendSystem.GetFriend(index);
         if (f != null)
         {
             PlayerManager.DeleteFriend(f.player_id, p.player_id);
             Account friend = AccountManager.getAccount(f.player_id, 32);//Pega acc do amigo
             if (friend != null)
             {
                 int    idx = -1;
                 Friend f2  = friend.FriendSystem.GetFriend(p.player_id, out idx);
                 if (f2 != null)
                 {
                     SEND_FRIENDS_INFOS.Load(friend, f2, 2);
                     friend.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, f2, idx), false);
                 }
             }
             p.FriendSystem.RemoveFriend(f);
             _client.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Delete, null, 0, index));
         }
         else
         {
             erro = 0x80000000;
         }
         _client.SendPacket(new FRIEND_REMOVE_PAK(erro));
         _client.SendPacket(new FRIEND_MY_FRIENDLIST_PAK(p.FriendSystem._friends));
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[FRIEND_DELETE_REC.run] Erro fatal!");
     }
 }
Пример #3
0
        public override void run()
        {
            try
            {
                Account p = _client._player;
                if (p == null)
                {
                    return;
                }
                Friend friend = p.FriendSystem.GetFriend(index);
                if (friend != null && friend.state > 0)
                {
                    Account _f = AccountManager.getAccount(friend.player_id, 32);
                    if (_f != null)
                    {
                        if (friend.player == null)
                        {
                            friend.SetModel(_f.player_id, _f._rank, _f.player_name, _f._isOnline, _f._status);
                        }
                        else
                        {
                            friend.player.SetInfo(_f._rank, _f.player_name, _f._isOnline, _f._status);
                        }

                        friend.state = 0;
                        PlayerManager.UpdateFriendState(p.player_id, friend);
                        _client.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Accept, null, 0, index));
                        _client.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, index));
                        int    idx = -1;
                        Friend fs  = _f.FriendSystem.GetFriend(p.player_id, out idx);
                        if (fs != null && fs.state > 0)
                        {
                            if (fs.player == null)
                            {
                                fs.SetModel(p.player_id, p._rank, p.player_name, p._isOnline, p._status);
                            }
                            else
                            {
                                fs.player.SetInfo(p._rank, p.player_name, p._isOnline, p._status);
                            }

                            fs.state = 0;
                            PlayerManager.UpdateFriendState(_f.player_id, fs);
                            SEND_FRIENDS_INFOS.Load(_f, fs, 1);
                            _f.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, fs, idx), false);
                        }
                    }
                    else
                    {
                        erro = 0x80000000; //STR_TBL_GUI_BASE_NO_USER_IN_USERLIST
                    }
                }
                else
                {
                    erro = 0x80000000; //STR_TBL_GUI_BASE_NO_USER_IN_USERLIST
                }
                if (erro > 0)
                {
                    _client.SendPacket(new FRIEND_ACCEPT_PAK(erro));
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[FRIEND_ACCEPT_REC.run] Erro fatal!");
            }
        }
Пример #4
0
 public override void run()
 {
     try
     {
         Account player = this._client._player;
         if (player == null)
         {
             return;
         }
         Friend friend1 = player.FriendSystem.GetFriend(this.index);
         if (friend1 != null && friend1.state > 0)
         {
             Account account = AccountManager.getAccount(friend1.player_id, 32);
             if (account != null)
             {
                 if (friend1.player == null)
                 {
                     friend1.SetModel(account.player_id, account._rank, account.player_name, account._isOnline, account._status);
                 }
                 else
                 {
                     friend1.player.SetInfo(account._rank, account.player_name, account._isOnline, account._status);
                 }
                 friend1.state = 0;
                 PlayerManager.UpdateFriendState(player.player_id, friend1);
                 this._client.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Accept, (Friend)null, 0, this.index));
                 this._client.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend1, this.index));
                 int    index   = -1;
                 Friend friend2 = account.FriendSystem.GetFriend(player.player_id, out index);
                 if (friend2 != null && friend2.state > 0)
                 {
                     if (friend2.player == null)
                     {
                         friend2.SetModel(player.player_id, player._rank, player.player_name, player._isOnline, player._status);
                     }
                     else
                     {
                         friend2.player.SetInfo(player._rank, player.player_name, player._isOnline, player._status);
                     }
                     friend2.state = 0;
                     PlayerManager.UpdateFriendState(account.player_id, friend2);
                     SEND_FRIENDS_INFOS.Load(account, friend2, 1);
                     account.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend2, index), false);
                 }
             }
             else
             {
                 this.erro = 2147483648U;
             }
         }
         else
         {
             this.erro = 2147483648U;
         }
         if (this.erro <= 0U)
         {
             return;
         }
         this._client.SendPacket((SendPacket) new FRIEND_ACCEPT_PAK(this.erro));
     }
     catch (Exception ex)
     {
         Logger.info("[FRIEND_ACCEPT_REC] " + ex.ToString());
     }
 }