Beispiel #1
0
 internal void MpveEndBattle(int kill_npc_ct)
 {
     if (this.CurrentState == RoomState.Finish || this.CurrentState == RoomState.Deactive)
     {
         return;
     }
     foreach (User user in room_users_)
     {
         if (user != null)
         {
             Msg_RL_UserQuit.Builder unqBuilder = Msg_RL_UserQuit.CreateBuilder();
             unqBuilder.SetRoomID(cur_room_id_);
             unqBuilder.SetUserGuid(user.Guid);
             unqBuilder.SetIsBattleEnd(true);
             connector_.SendMsgToLobby(unqBuilder.Build());
         }
     }
     //向Lobby发送战斗结束消息:RoomID,胜方阵营,开始时间,结束时间。。。
     Msg_RL_BattleEnd.Builder beBuilder = Msg_RL_BattleEnd.CreateBuilder();
     beBuilder.SetRoomID(RoomID);
     Msg_RL_BattleEnd.Types.WinnerCampEnum winCamp = Msg_RL_BattleEnd.Types.WinnerCampEnum.None;
     beBuilder.SetWinnerCamp(winCamp);
     //战斗数据
     foreach (User user in room_users_)
     {
         if (user != null)
         {
             var battleRecord = user.Info.GetCombatStatisticInfo();
             Msg_RL_UserBattleInfo.Builder ubrBuilder = Msg_RL_UserBattleInfo.CreateBuilder();
             ubrBuilder.SetUserGuid(user.Guid);
             Msg_RL_UserBattleInfo.Types.BattleResultEnum result = Msg_RL_UserBattleInfo.Types.BattleResultEnum.Unfinish;
             if (kill_npc_ct > 0)
             {
                 result = Msg_RL_UserBattleInfo.Types.BattleResultEnum.Win;
             }
             else
             {
                 result = Msg_RL_UserBattleInfo.Types.BattleResultEnum.Lost;
             }
             ubrBuilder.SetBattleResult(result);
             ubrBuilder.SetMoney(user.Info.Money);
             CombatStatisticInfo combatInfo = user.Info.GetCombatStatisticInfo();
             ubrBuilder.SetHitCount(combatInfo.HitCount);
             ubrBuilder.SetKillNpcCount(kill_npc_ct);
             ubrBuilder.SetMaxMultiHitCount(combatInfo.MaxMultiHitCount);
             ubrBuilder.SetTotalDamageToMyself(combatInfo.TotalDamageToMyself);
             ubrBuilder.SetTotalDamageFromMyself(combatInfo.TotalDamageFromMyself);
             beBuilder.AddUserBattleInfos(ubrBuilder.Build());
         }
     }
     connector_.SendMsgToLobby(beBuilder.Build());
     this.CurrentState = RoomState.Finish;
     m_FinishTime      = TimeUtility.GetServerMilliseconds();
     LogSys.Log(LOG_TYPE.DEBUG, "Room {0}({1}) MpveEndBattle.", RoomID, LocalID);
 }
Beispiel #2
0
        internal static Msg_RC_SyncCombatStatisticInfo BuildSyncCombatStatisticInfo(UserInfo user)
        {
            Msg_RC_SyncCombatStatisticInfo builder = new Msg_RC_SyncCombatStatisticInfo();
            CombatStatisticInfo            info    = user.GetCombatStatisticInfo();

            builder.role_id          = user.GetId();
            builder.kill_hero_count  = info.KillHeroCount;
            builder.assit_kill_count = info.AssitKillCount;
            builder.kill_npc_count   = info.KillNpcCount;
            builder.dead_count       = info.DeadCount;
            return(builder);
        }
Beispiel #3
0
        private static void UpdateCharacterHitCount(CharacterInfo character, int hit_count)
        {
            UserInfo user = character as UserInfo;

            if (user == null)
            {
                return;
            }
            CombatStatisticInfo combat_info = user.GetCombatStatisticInfo();

            combat_info.MultiHitCount = hit_count;
            combat_info.LastHitTime   = TimeUtility.GetServerMilliseconds();
        }