private void UpdateTimedData(Object sender, ElapsedEventArgs e)
        {
            TimeSpan timeElapsed = e.SignalTime - timeKeeper.StartTime;

            FriendState newFriendState = friend.CurrentFriendState;

            if (timeElapsed.TotalSeconds < 10)
            {
                newFriendState = FriendState.happy;
            }
            else if (timeElapsed.TotalSeconds < 20)
            {
                newFriendState = FriendState.sad;

                mood   -= 0.2;
                hunger -= 0.3;
                energy -= 0.35;
            }
            else if (timeElapsed.TotalSeconds >= 20)
            {
                newFriendState = FriendState.depressed;

                mood   -= 0.3;
                hunger -= 0.2;
                energy -= 0.15;
            }

            if (newFriendState != friend.CurrentFriendState)
            {
                friend.CurrentFriendState = newFriendState;
                updateUI();
            }
        }
Example #2
0
        public Friend AddOrUpdate(ulong friendId, Player plr, FriendState playerState, FriendState friendState)
        {
            using (var db = GameDatabase.Open())
            {
                if (_friends.TryGetValue(friendId, out var friend))
                {
                    var dbFriend = DbUtil.Find <PlayerFriendDto>(db, statement => statement
                                                                 .Where(
                                                                     $"{nameof(PlayerFriendDto.PlayerId):C} = @PlayerId AND {nameof(PlayerFriendDto.FriendId):C} = @FriendId")
                                                                 .WithParameters(new { PlayerId = Player.Account.Id, FriendId = friendId })).FirstOrDefault();

                    if (dbFriend == null)
                    {
                        dbFriend = DbUtil.Find <PlayerFriendDto>(db, statement => statement
                                                                 .Where(
                                                                     $"{nameof(PlayerFriendDto.PlayerId):C} = @PlayerId AND {nameof(PlayerFriendDto.FriendId):C} = @FriendId")
                                                                 .WithParameters(new { PlayerId = friendId, FriendId = Player.Account.Id })).FirstOrDefault();
                    }

                    if (dbFriend == null)
                    {
                        throw new Exception("db and server are de-synced!");
                    }

                    dbFriend.PlayerState = (int)playerState;
                    dbFriend.FriendState = (int)friendState;
                    DbUtil.Update(db, dbFriend);
                    friend.PlayerState = playerState;
                    friend.FriendState = friendState;
                    return(friend);
                }

                var newDbFriend = new PlayerFriendDto()
                {
                    PlayerId    = (int)Player.Account.Id,
                    FriendId    = (int)friendId,
                    PlayerState = (int)playerState,
                    FriendState = (int)friendState
                };

                DbUtil.Insert(db, newDbFriend);

                var newFriend = new Friend(Player.Account.Id, friendId, playerState, friendState);
                if (!_friends.TryAdd(newFriend.FriendId, newFriend))
                {
                    throw new ArgumentException("Player is already added", nameof(Player.Account.Id));
                }

                if (plr != null)
                {
                    var newPlrFriend = new Friend(friendId, Player.Account.Id, friendState, playerState);
                    if (!plr.FriendManager._friends.TryAdd(Player.Account.Id, newPlrFriend))
                    {
                        throw new ArgumentException("Player is already added", nameof(newFriend.FriendId));
                    }
                }

                return(newFriend);
            }
        }
Example #3
0
 internal Friend(ulong accountId, ulong friendId, FriendState playerState, FriendState friendState)
 {
     AccountId   = accountId;
     FriendId    = friendId;
     PlayerState = playerState;
     FriendState = friendState;
 }
Example #4
0
 void DoneReviving()
 {
     state = FriendState.TakingCover;
     reviveTarget.State  = FriendState.TakingCover;
     reviveTarget.downed = false;
     reviveTarget        = null;
 }
Example #5
0
 public void Revive(FriendlyBehaviour member)
 {
     controller.goal = member.transform;
     reviveTarget    = member;
     state           = FriendState.Reviving;
     startedReviving = false;
 }
Example #6
0
        internal NFriend(Friend message)
        {
            AvatarUrl    = message.User.AvatarUrl;
            CreatedAt    = message.User.CreatedAt;
            Fullname     = message.User.Fullname;
            Handle       = message.User.Handle;
            Id           = message.User.Id.ToByteArray();
            Lang         = message.User.Lang;
            LastOnlineAt = message.User.LastOnlineAt;
            Location     = message.User.Location;
            Metadata     = message.User.Metadata.ToByteArray();
            Timezone     = message.User.Timezone;
            UpdatedAt    = message.User.UpdatedAt;

            switch (message.Type)
            {
            case 0:
                State = FriendState.Friend;
                break;

            case 1:
                State = FriendState.Invite;
                break;

            case 2:
                State = FriendState.Invited;
                break;

            case 3:
                State = FriendState.Blocked;
                break;
            }
        }
Example #7
0
 public FRIEND_UPDATE_PAK(FriendChangeState type, Friend friend, FriendState state, int idx)
 {
     this._state = state;
     this._f     = friend;
     this._type  = type;
     this._index = idx;
 }
 public FRIEND_UPDATE_PAK(FriendChangeState type, Friend friend, int state, int idx)
 {
     _type  = type;
     _state = (FriendState)state;
     _f     = friend;
     _index = idx;
 }
Example #9
0
        private void State_End(double now)
        {
            STATE = FriendState.End;

            //Entry Action
            _Clock = now;
            Send_TAR(double.MaxValue, "OVER");
        }
Example #10
0
        private void State_Watch(double now)
        {
            STATE = FriendState.Watch;

            //Entry Action
            _Clock = now;
            Send_TAR(_Clock + qt, "Over", "OVER");
        }
 public CLAN_MEMBER_INFO_CHANGE_PAK(Account player, FriendState st)
 {
     member = player;
     if (st == 0)
     {
         status = ComDiv.GetClanStatus(player._status, player._isOnline);
     }
     else
     {
         status = ComDiv.GetClanStatus(st);
     }
 }
 void goVeryAngry()
 {
     timeInState = 0;
     if (state != FriendState.veryAngry) {
         state = FriendState.veryAngry;
         movement.moveSpeed = veryAngryMovementSpeed;
         render.sprite = angryFace;
         if(gameObject.GetComponent<PushOnTouch>() != null)
             Destroy(gameObject.GetComponent<PushOnTouch>());
         gameObject.AddComponent<DeathOnTouch>();
     }
 }
Example #13
0
 public CLAN_MEMBER_INFO_CHANGE_PAK(Account player, FriendState st)
 {
     this.p = player;
     if (st == FriendState.None)
     {
         this.status = ComDiv.GetClanStatus(player._status, player._isOnline);
     }
     else
     {
         this.status = ComDiv.GetClanStatus(st);
     }
 }
 void goHappy()
 {
     timeInState = 0;
     if (state != FriendState.happy) {
         state = FriendState.happy;
         movement.moveSpeed = happyMovementSpeed;
         render.sprite = happyFace;
         if(gameObject.GetComponent<DeathOnTouch>() != null)
             Destroy(gameObject.GetComponent<DeathOnTouch>());
         if(gameObject.GetComponent<PushOnTouch>() != null)
             Destroy(gameObject.GetComponent<PushOnTouch>());
     }
 }
 void onFriendStateChange(GameObject friend, FriendState state)
 {
     if (state == FriendState.happy) {
         if(happyFriends.IndexOf(friend) == -1)
             happyFriends.Add(friend);
         angryFriends.Remove(friend);
     } else if (state == FriendState.angry || state == FriendState.veryAngry) {
         if(angryFriends.IndexOf(friend) == -1)
             angryFriends.Add(friend);
         happyFriends.Remove(friend);
     }
     Debug.Log ("happy friends: " + happyFriends.Count + " angry friends: " + angryFriends.Count);
 }
Example #16
0
        public static string GetFriendString(FriendState friendState)
        {
            switch (friendState)
            {
            case FriendState.happy:
                return("happy");

            case FriendState.sad:
                return("sad");

            case FriendState.depressed:
                return("depressed");

            default:
                return("okay");
            }
        }
Example #17
0
 /// <summary>
 /// 查询用户好友请求记录
 /// </summary>
 /// <param name="Userid"></param>
 /// <returns></returns>
 public List <FriendState> QueryFriendRequest(int userid)
 {
     using (ChatEntities db = new ChatEntities())
     {
         List <Friends> us = db.Friends.Where(f => f.UserID == userid && f.Status == 0).ToList();
         List <IGrouping <int, Friends> > res = us.GroupBy(aa => aa.FirendID).ToList();
         List <FriendState> userlist          = new List <FriendState>();
         foreach (var temp in res)
         {
             FriendState friendstate = new FriendState();
             friendstate.user    = db.User.FirstOrDefault(u => u.ID == temp.Key);
             friendstate.endtime = db.Friends.FirstOrDefault(u => u.FirendID == temp.Key && u.Status == 0).OverdueTime;
             userlist.Add(friendstate);
         }
         return(userlist);
     }
 }
Example #18
0
 public void OnClickFriendBar(FriendState state)
 {
     //Configure State
     ResetMenuFriendOptions();
     if (state.Statebtn)     // menu Abierto ((Lo cierras
     {
         state.Statebtn = false;
         MenuFriendList.istance.cerrar();
         MenuFriendList.istance.Trans.position = state.point.position;
     }
     else
     {
         state.Statebtn = true;
         MenuFriendList.istance.Abrir(state.isFriend);
         MenuFriendList.istance.Trans.position = state.point.position;
     }
 }
 public static void GetPlayerLocation(AccountStatus status, bool isOnline, out FriendState state, out int roomId, out int channelId, out int serverId, out int clanFId)
 {
     roomId    = 0;
     channelId = 0;
     serverId  = 0;
     clanFId   = 0;
     if (isOnline)
     {
         if (status.roomId != 255)
         {
             roomId    = status.roomId;
             channelId = status.channelId;
             state     = FriendState.Room;
         }
         else if ((status.clanFId != 255 || status.roomId == 255) && status.channelId != 255)
         {
             channelId = status.channelId;
             state     = FriendState.Lobby;
         }
         else if (status.roomId == 255 && status.channelId == 255)
         {
             state = FriendState.Online;
         }
         else
         {
             state = FriendState.Offline;
         }
         if (status.serverId != 255)
         {
             serverId = status.serverId;
         }
         if (status.clanFId != 255)
         {
             clanFId = status.clanFId + 1;
         }
     }
     else
     {
         state = FriendState.Offline;
     }
 }
        public static uint GetFriendStatus(Friend f, FriendState stateN)
        {
            PlayerInfo info = f.player;

            if (info == null)
            {
                return(0);
            }
            FriendState state = stateN;
            int         serverId = 0, channelId = 0, roomId = 0;

            if (f.state > 0)
            {
                state = (FriendState)f.state;
            }
            else if (stateN == 0)
            {
                GetPlayerLocation(info._status, info._isOnline, out state, out roomId, out channelId, out serverId);
            }
            return(GetPlayerStatus(roomId, channelId, serverId, (int)state));
        }
 public void BroadcastToClient(FriendState friendState)
 {
     lvFriendState.ItemsSource = friendState.FriendList;
 }
    public string GetState(bool write) {
#if SVPN_NUNIT
      return String.Empty;
#else
      FileState fstate = new FileState();
      SocialState state = new SocialState();

      if(_node.LocalUser != null) {
        state.LocalUser = _node.LocalUser;
        fstate.Uid = state.LocalUser.Uid;
        fstate.PCID = state.LocalUser.PCID;
      }

      state.Friends = new SocialUser[_node.Friends.Values.Count];
      state.Networks = new NetworkState[_networks.Values.Count];
      state.Pending = new string[_pending.Count];
      fstate.Friends = new FriendState[_node.Friends.Values.Count];

      _pending.CopyTo(state.Pending, 0);

      int i = 0;
      foreach (KeyValuePair<string, ISocialNetwork> kvp 
        in _networks) {
        state.Networks[i] = new NetworkState();
        state.Networks[i].Name = kvp.Key;
        state.Networks[i].Message = kvp.Value.Message;
        i++;
      }

      i = 0;
      foreach(SocialUser user in _node.Friends.Values) {
        string status;

        if(_node.IsAllowed(user.Address)) {
          if(IsOffline(user.Address)) {
            status = StatusTypes.Offline.ToString();
          }
          else {
            status = StatusTypes.Online.ToString();
          }
        }
        else {
          status = StatusTypes.Blocked.ToString();
        }
        state.Friends[i] = new SocialUser(user.Certificate, user.IP, 
          status);

        FriendState friend = new FriendState();
        friend.Certificate = user.Certificate;
        friend.IP = user.IP;
        friend.Status = status;
        fstate.Friends[i] = friend;
        i++;
      }

      if(write) {
        Utils.WriteConfig(STATEPATH, fstate);
      }

      return SocialUtils.ObjectToXml<SocialState>(state);
#endif
    }
        public string GetState(bool write)
        {
#if SVPN_NUNIT
            return(String.Empty);
#else
            FileState   fstate = new FileState();
            SocialState state  = new SocialState();

            if (_node.LocalUser != null)
            {
                state.LocalUser = _node.LocalUser;
                fstate.Uid      = state.LocalUser.Uid;
                fstate.PCID     = state.LocalUser.PCID;
            }

            state.Friends  = new SocialUser[_node.Friends.Values.Count];
            state.Networks = new NetworkState[_networks.Values.Count];
            state.Pending  = new string[_pending.Count];
            fstate.Friends = new FriendState[_node.Friends.Values.Count];

            _pending.CopyTo(state.Pending, 0);

            int i = 0;
            foreach (KeyValuePair <string, ISocialNetwork> kvp
                     in _networks)
            {
                state.Networks[i]         = new NetworkState();
                state.Networks[i].Name    = kvp.Key;
                state.Networks[i].Message = kvp.Value.Message;
                i++;
            }

            i = 0;
            foreach (SocialUser user in _node.Friends.Values)
            {
                string status;

                if (_node.IsAllowed(user.Address))
                {
                    if (IsOffline(user.Address))
                    {
                        status = StatusTypes.Offline.ToString();
                    }
                    else
                    {
                        status = StatusTypes.Online.ToString();
                    }
                }
                else
                {
                    status = StatusTypes.Blocked.ToString();
                }
                state.Friends[i] = new SocialUser(user.Certificate, user.IP,
                                                  status);

                FriendState friend = new FriendState();
                friend.Certificate = user.Certificate;
                friend.IP          = user.IP;
                friend.Status      = status;
                fstate.Friends[i]  = friend;
                i++;
            }

            if (write)
            {
                Utils.WriteConfig(STATEPATH, fstate);
            }

            return(SocialUtils.ObjectToXml <SocialState>(state));
#endif
        }
Example #24
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p      = new ReceiveGPacket(buffer);
            short          opcode = p.readH();

            try
            {
                switch (opcode)
                {
                case 11:     //Request to sync a specific friend or clan info
                    int     type      = p.readC();
                    int     isConnect = p.readC();
                    long    pid       = p.readQ();
                    Account player    = AccountManager.getInstance().getAccount(pid, true);
                    if (player != null)
                    {
                        Account friend = AccountManager.getInstance().getAccount(p.readQ(), true);
                        if (friend != null)
                        {
                            FriendState state = isConnect == 1 ? FriendState.Online : FriendState.Offline;
                            if (type == 0)
                            {
                                int    idx = -1;
                                Friend frP = friend.FriendSystem.GetFriend(player.player_id, out idx);
                                if (idx != -1 && frP != null)
                                {
                                    friend.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, frP, state, idx));
                                }
                            }
                            else
                            {
                                friend.SendPacket(new CLAN_MEMBER_INFO_CHANGE_PAK(player, state));
                            }
                        }
                    }
                    break;

                case 13:
                    long    playerId = p.readQ();
                    byte    typee    = p.readC();
                    byte[]  data     = p.readB(p.readUH());
                    Account playerr  = AccountManager.getInstance().getAccount(playerId, true);
                    if (playerr != null)
                    {
                        if (typee == 0)
                        {
                            playerr.SendPacket(data);
                        }
                        else
                        {
                            playerr.SendCompletePacket(data);
                        }
                    }
                    break;

                case 15:
                    short           serverId = p.readH();
                    short           count    = p.readH();
                    GameServerModel gs       = ServersXML.getServer(serverId);
                    if (gs != null)
                    {
                        gs._LastCount = count;
                    }
                    break;

                case 16:
                    Net_Clan_Sync.Load(p);
                    break;

                case 17:
                    Net_Friend_Sync.Load(p);
                    break;

                case 19:
                    Net_Player_Sync.Load(p);
                    break;

                default:
                    Printf.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    SaveLog.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    break;
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal("[Crash/Auth_SyncNet] opcode: " + opcode + "\r\n" + ex.ToString());
                Printf.b_danger("[Auth_SyncNet.LoadPacket] Erro fatal!");
            }
        }
        public FriendState GetFriendShipState(string RequestedID, string RequesterID, FriendState state)
        {
            if (state == FriendState.Friend)
            {
                return(state);
            }

            if (RequesterID == null || RequestedID == null)
            {
                return(FriendState.NotFriend);
            }


            if (RequestedID == LogginedId)
            {
                return(FriendState.Requested);
            }

            return(FriendState.Requester);
        }
Example #26
0
    private void Update()
    {
        targetSearchTimer -= Time.deltaTime;
        if (targetSearchTimer <= 0f || target == null)
        {
            targetSearchTimer = 8.0f;
            target            = manager.SearchForTarget(transform.position);
        }
        if (downed)
        {
            state = FriendState.Downed;
        }
        switch (state)
        {
        case FriendState.Idle:
            if (gunShown)
            {
                StartCoroutine(DissolveOut());
            }
            gunShown = false;
            controller.Agent.isStopped = true;
            controller.Animator.SetBool("Crouch", false);
            controller.Animator.SetBool("Dead", false);
            controller.Animator.SetBool("Shoot", false);
            break;

        case FriendState.Cover:
            if (gunShown)
            {
                StartCoroutine(DissolveOut());
            }
            gunShown = false;
            controller.Agent.isStopped = true;
            controller.Animator.SetBool("Crouch", true);
            controller.Animator.SetBool("Shoot", false);
            controller.Animator.SetBool("Dead", false);
            break;

        case FriendState.TakingCover:
            if (gunShown)
            {
                StartCoroutine(DissolveOut());
            }
            gunShown = false;
            controller.Agent.isStopped = false;
            controller.Animator.SetBool("Crouch", false);
            controller.Animator.SetBool("Shoot", false);
            controller.Animator.SetBool("Dead", false);
            if (!hasCoverPoint)
            {
                TakeCover();
            }
            if (controller.goal != null &&
                Vector3.Distance(transform.position, controller.goal.position) <= 1f)
            {
                controller.Agent.isStopped = true;
                controller.Animator.SetBool("Crouch", true);
                hasCoverPoint = true;
                if (CeaseFire)
                {
                    state = FriendState.Cover;
                }
                else
                {
                    state = FriendState.CoverShooting;
                }
            }
            break;

        case FriendState.Sneak:
            if (gunShown)
            {
                StartCoroutine(DissolveOut());
            }
            gunShown = false;
            controller.Agent.isStopped = false;
            controller.Animator.SetBool("Crouch", true);
            controller.Animator.SetBool("Shoot", false);
            controller.Animator.SetBool("Dead", false);
            if (Vector3.Distance(transform.position, controller.goal.position) <= 1f)
            {
                controller.Agent.isStopped = true;
                controller.Animator.SetBool("Crouch", true);
                hasCoverPoint = true;
                state         = FriendState.Cover;
            }
            break;

        case FriendState.Shooting:
            controller.Agent.isStopped = true;
            controller.Animator.SetBool("Crouch", false);
            controller.Animator.SetBool("Shoot", true);
            controller.Animator.SetBool("Dead", false);
            ShootTarget();
            break;

        case FriendState.CoverShooting:
            controller.Agent.isStopped = true;
            controller.Animator.SetBool("Crouch", true);
            controller.Animator.SetBool("Shoot", true);
            controller.Animator.SetBool("Dead", false);
            ShootTarget();
            break;

        case FriendState.Downed:
            controller.Agent.isStopped = true;
            controller.Animator.SetBool("Dead", true);
            downed = true;
            Invoke("GetUp", 3.0f);
            break;

        case FriendState.Reviving:
            if (gunShown)
            {
                StartCoroutine(DissolveOut());
            }
            gunShown = false;
            controller.Agent.isStopped = false;
            controller.Animator.SetBool("Crouch", false);
            controller.Animator.SetBool("Shoot", false);
            controller.Animator.SetBool("Dead", false);
            if (Vector3.Distance(transform.position, controller.goal.position) <= 4f &&
                !startedReviving)
            {
                controller.Agent.isStopped = true;
                controller.Animator.SetBool("Crouch", true);
                Invoke("DoneReviving", 2.0f);
                startedReviving = true;
            }
            break;
        }
    }
Example #27
0
 private void State_OVER(double now)
 {
     STATE = FriendState.OVER;
 }
 public static ulong GetClanStatus(FriendState state)
 {
     return(GetPlayerStatus(0, 0, 0, 0, (int)state));
 }
 //remote callback function
 public void BroadcastToClient(FriendState friendState)
 {
     throw new NotImplementedException();
 }
Example #30
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p    = new ReceiveGPacket(buffer);
            short          num1 = p.readH();

            try
            {
                switch (num1)
                {
                case 1:
                    Net_Room_Pass_Portal.Load(p);
                    break;

                case 2:
                    Net_Room_C4.Load(p);
                    break;

                case 3:
                    Net_Room_Death.Load(p);
                    break;

                case 4:
                    Net_Room_HitMarker.Load(p);
                    break;

                case 5:
                    Net_Room_Sabotage_Sync.Load(p);
                    break;

                case 10:
                    Account account1 = AccountManager.getAccount(p.readQ(), true);
                    if (account1 == null)
                    {
                        break;
                    }
                    account1.SendPacket((SendPacket) new AUTH_ACCOUNT_KICK_PAK(1));
                    account1.SendPacket((SendPacket) new SERVER_MESSAGE_ERROR_PAK(2147487744U));
                    account1.Close(1000, false);
                    break;

                case 11:
                    int     num2     = (int)p.readC();
                    int     num3     = (int)p.readC();
                    Account account2 = AccountManager.getAccount(p.readQ(), 0);
                    if (account2 == null)
                    {
                        break;
                    }
                    Account account3 = AccountManager.getAccount(p.readQ(), true);
                    if (account3 == null)
                    {
                        break;
                    }
                    FriendState friendState = num3 == 1 ? FriendState.Online : FriendState.Offline;
                    if (num2 == 0)
                    {
                        int    index  = -1;
                        Friend friend = account3.FriendSystem.GetFriend(account2.player_id, out index);
                        if (index == -1 || friend == null || friend.state != 0)
                        {
                            break;
                        }
                        account3.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, friendState, index));
                        break;
                    }
                    account3.SendPacket((SendPacket) new CLAN_MEMBER_INFO_CHANGE_PAK(account2, friendState));
                    break;

                case 13:
                    long    id1      = p.readQ();
                    byte    num4     = p.readC();
                    byte[]  data     = p.readB((int)p.readUH());
                    Account account4 = AccountManager.getAccount(id1, true);
                    if (account4 == null)
                    {
                        break;
                    }
                    if (num4 == (byte)0)
                    {
                        account4.SendPacket(data);
                        break;
                    }
                    account4.SendCompletePacket(data);
                    break;

                case 15:
                    int             id2    = p.readD();
                    int             num5   = p.readD();
                    GameServerModel server = ServersXML.getServer(id2);
                    if (server == null)
                    {
                        break;
                    }
                    server._LastCount = num5;
                    break;

                case 16:
                    Net_Clan_Sync.Load(p);
                    break;

                case 17:
                    Net_Friend_Sync.Load(p);
                    break;

                case 18:
                    Net_Inventory_Sync.Load(p);
                    break;

                case 19:
                    Net_Player_Sync.Load(p);
                    break;

                case 20:
                    Net_Server_Warning.LoadGMWarning(p);
                    break;

                case 21:
                    Net_Clan_Servers_Sync.Load(p);
                    break;

                case 22:
                    Net_Server_Warning.LoadShopRestart(p);
                    break;

                case 23:
                    Net_Server_Warning.LoadServerUpdate(p);
                    break;

                case 24:
                    Net_Server_Warning.LoadShutdown(p);
                    break;

                case 31:
                    EventLoader.ReloadEvent((int)p.readC());
                    Logger.warning("[Game_SyncNet] Evento re-carregado.");
                    break;

                case 32:
                    ServerConfigSyncer.GenerateConfig((int)p.readC());
                    Logger.warning("[Game_SyncNet] Configurações (DB) resetadas.");
                    break;

                default:
                    Logger.warning("[Game_SyncNet] Tipo de conexão não encontrada: " + (object)num1);
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.error("[Crash/Game_SyncNet] Tipo: " + (object)num1 + "\r\n" + ex.ToString());
                if (p == null)
                {
                    return;
                }
                Logger.error("COMP: " + BitConverter.ToString(p.getBuffer()));
            }
        }
Example #31
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p    = new ReceiveGPacket(buffer);
            short          num1 = p.readH();

            switch (num1)
            {
            case 11:
                int     num2     = (int)p.readC();
                int     num3     = (int)p.readC();
                Account account1 = AccountManager.getInstance().getAccount(p.readQ(), true);
                if (account1 == null)
                {
                    break;
                }
                Account account2 = AccountManager.getInstance().getAccount(p.readQ(), true);
                if (account2 == null)
                {
                    break;
                }
                FriendState friendState = num3 == 1 ? FriendState.Online : FriendState.Offline;
                if (num2 == 0)
                {
                    int    index  = -1;
                    Friend friend = account2.FriendSystem.GetFriend(account1.player_id, out index);
                    if (index == -1 || friend == null)
                    {
                        break;
                    }
                    account2.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, friendState, index));
                    break;
                }
                account2.SendPacket((SendPacket) new CLAN_MEMBER_INFO_CHANGE_PAK(account1, friendState));
                break;

            case 13:
                long    id1      = p.readQ();
                byte    num4     = p.readC();
                byte[]  data     = p.readB((int)p.readUH());
                Account account3 = AccountManager.getInstance().getAccount(id1, true);
                if (account3 == null)
                {
                    break;
                }
                if (num4 == (byte)0)
                {
                    account3.SendPacket(data);
                    break;
                }
                account3.SendCompletePacket(data);
                break;

            case 15:
                int             id2    = p.readD();
                int             num5   = p.readD();
                GameServerModel server = ServersXML.getServer(id2);
                if (server == null)
                {
                    break;
                }
                server._LastCount = num5;
                break;

            case 16:
                Net_Clan_Sync.Load(p);
                break;

            case 17:
                Net_Friend_Sync.Load(p);
                break;

            case 19:
                Net_Player_Sync.Load(p);
                break;

            case 20:
                Net_Server_Warning.LoadGMWarning(p);
                break;

            case 22:
                Net_Server_Warning.LoadShopRestart(p);
                break;

            case 23:
                Net_Server_Warning.LoadServerUpdate(p);
                break;

            case 24:
                Net_Server_Warning.LoadShutdown(p);
                break;

            case 31:
                EventLoader.ReloadEvent((int)p.readC());
                Logger.warning("[Auth_SyncNet] Evento re-carregado.");
                break;

            case 32:
                ServerConfigSyncer.GenerateConfig((int)p.readC());
                Logger.warning("[Auth_SyncNet] Configurações (DB) resetadas.");
                break;

            default:
                Logger.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + (object)num1);
                break;
            }
        }
Example #32
0
 void GetUp()
 {
     state  = FriendState.CoverShooting;
     downed = false;
 }
Example #33
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p      = new ReceiveGPacket(buffer);
            short          opcode = p.readH();

            //Printf.warnDark("Receive SYNC - " + opcode.ToString());
            try
            {
                switch (opcode)
                {
                case 1:
                    Net_Room_Pass_Portal.Load(p);
                    break;

                case 2:     // Bomba
                    Net_Room_C4.Load(p);
                    break;

                case 3:     //Death
                    Net_Room_Death.Load(p);
                    break;

                case 4:
                    Net_Room_HitMarker.Load(p);
                    break;

                case 5:
                    Net_Room_Sabotage_Sync.Load(p);
                    break;

                case 10:
                    Account player = AccountManager.getAccount(p.readQ(), true);
                    if (player != null)
                    {
                        player.SendPacket(new AUTH_ACCOUNT_KICK_PAK(1));
                        player.SendPacket(new SERVER_MESSAGE_ERROR_PAK(0x80001000));
                        player.Close(1000);
                    }
                    break;

                case 11:      //Request to sync a specific friend or clan info
                    int     type      = p.readC();
                    int     isConnect = p.readC();
                    Account player11  = AccountManager.getAccount(p.readQ(), 0);
                    if (player11 != null)
                    {
                        Account friendAcc = AccountManager.getAccount(p.readQ(), true);
                        if (friendAcc != null)
                        {
                            FriendState state = isConnect == 1 ? FriendState.Online : FriendState.Offline;
                            if (type == 0)
                            {
                                int    idx    = -1;
                                Friend friend = friendAcc.FriendSystem.GetFriend(player11.player_id, out idx);
                                if (idx != -1 && friend != null && friend.state == 0)
                                {
                                    friendAcc.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, state, idx));
                                }
                            }
                            else
                            {
                                friendAcc.SendPacket(new CLAN_MEMBER_INFO_CHANGE_PAK(player11, state));
                            }
                        }
                    }
                    break;

                case 13:
                    long    playerId = p.readQ();
                    byte    type13   = p.readC();
                    byte[]  data     = p.readB(p.readUH());
                    Account player13 = AccountManager.getAccount(playerId, true);
                    if (player13 != null)
                    {
                        if (type13 == 0)
                        {
                            player13.SendPacket(data);
                        }
                        else
                        {
                            player13.SendCompletePacket(data);
                        }
                    }
                    break;

                case 15:
                    short           serverId = p.readH();
                    short           count    = p.readH();
                    GameServerModel gs       = ServersXML.getServer(serverId);
                    if (gs != null)
                    {
                        gs._LastCount = count;
                    }
                    break;

                case 16:
                    Net_Clan_Sync.Load(p);
                    break;

                case 17:
                    Net_Friend_Sync.Load(p);
                    break;

                case 18:
                    Net_Inventory_Sync.Load(p);
                    break;

                case 19:
                    Net_Player_Sync.Load(p);
                    break;

                case 21:
                    Net_Clan_Servers_Sync.Load(p);
                    break;

                case 100:
                    ReadAPI_Cash.Load(p);
                    break;

                default:
                    Printf.warning("[Game_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    break;
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal("[Game_SyncNet.LoadPacket] Tipo: " + opcode + "\r\n" + ex.ToString());
                Printf.b_danger("[GameSyncNet.LoadPacket] Erro fatal!");
            }
        }