Beispiel #1
0
        internal void HandleArenaChallengeOver(ulong guid, ArkCrossEngineMessage.Msg_CL_ArenaChallengeOver protoMsg)
        {
            ChallengeInfo challeng_info = m_ArenaSystem.GetDoingChallengeInfo(guid);
            bool is_success = protoMsg.IsSuccess;
            if (challeng_info != null)
            {
                int challenger_total_damange = 0;
                challeng_info.Challenger.UserDamage = protoMsg.ChallengerDamage;
                challenger_total_damange = challeng_info.Challenger.UserDamage;
                challeng_info.Target.UserDamage = protoMsg.TargetDamage;
                foreach (var m in protoMsg.ChallengerPartnerDamage)
                {
                    DamageInfo d = ArenaUtil.GetDamageInfo(challeng_info.Challenger.PartnerDamage, m.OwnerId);
                    if (d != null)
                    {
                        d.Damage = m.Damage;
                        challenger_total_damange += d.Damage;
                    }
                    else
                    {
                        is_success = false;
                    }
                }
                foreach (var m in protoMsg.TargetPartnerDamage)
                {
                    DamageInfo d = ArenaUtil.GetDamageInfo(challeng_info.Target.PartnerDamage, m.OwnerId);
                    if (d != null)
                    {
                        d.Damage = m.Damage;
                    }
                    else
                    {
                        is_success = false;
                    }
                }
                if (is_success && challenger_total_damange < challeng_info.Target.TotalHp)
                {
                    LogSys.Log(LOG_TYPE.WARN, "ArenaChallenge result not correct, challenger {0} total damage {1} less than total hp {2}",
                               guid, challenger_total_damange, challeng_info.Target.TotalHp);
                    is_success = false;
                }
                int verify_sign = challeng_info.Sign - (int)challeng_info.Target.Guid;
                if (protoMsg.Sign != verify_sign)
                {
                    is_success = false;
                    LogSys.Log(LOG_TYPE.INFO, "ArenaChallenge Sign Verify Failed: guid{0}, rank{1}, target {2}-{3}",
                               guid, challeng_info.Challenger.Rank, challeng_info.Target.Guid, challeng_info.Target.Rank);
                }
            }
            m_ArenaSystem.ChallengeOver(guid, is_success);

            UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(guid);
            if (null != user)
            {
                user.CurrentState = UserState.Online;
                StageClearInfo info = new StageClearInfo();
                info.SceneId = 3002;
                MissionSystem.Instance.CheckAndSyncMissions(user, info);
            }
        }
Beispiel #2
0
 internal void HandleQueryArenaMatchGroup(ulong guid)
 {
     LogSys.Log(LOG_TYPE.DEBUG, "---got query match group msg! id=" + guid);
     UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(guid);
     if (user == null)
     {
         return;
     }
     JsonMessageWithGuid resultMsg = new JsonMessageWithGuid(JsonMessageID.ArenaMatchGroupResult);
     resultMsg.m_Guid = guid;
     int cur_user_rank = ArenaSystem.UNKNOWN_RANK;
     ArenaInfo arena_info = m_ArenaSystem.GetArenaInfoById(guid);
     if (arena_info != null)
     {
         cur_user_rank = arena_info.GetRank();
     };
     List<MatchGroup> match_groups = m_ArenaSystem.QueryMatchArena(cur_user_rank, 3);
     ArkCrossEngineMessage.Msg_LC_ArenaMatchGroupResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaMatchGroupResult();
     foreach (MatchGroup group in match_groups)
     {
         ArkCrossEngineMessage.Msg_LC_ArenaMatchGroupResult.MatchGroupData group_msg = new ArkCrossEngineMessage.Msg_LC_ArenaMatchGroupResult.MatchGroupData();
         group_msg.One = ArenaUtil.CreateArenaInfoMsg(group.One);
         group_msg.Two = ArenaUtil.CreateArenaInfoMsg(group.Two);
         group_msg.Three = ArenaUtil.CreateArenaInfoMsg(group.Three);
         if (group_msg.One == null || group_msg.Two == null || group_msg.Three == null)
         {
             continue;
         }
         protoData.m_MatchGroups.Add(group_msg);
     }
     resultMsg.m_ProtoData = protoData;
     JsonMessageDispatcher.SendDcoreMessage(user.NodeName, resultMsg);
     LogSys.Log(LOG_TYPE.DEBUG, "---send match group msg! id=" + guid);
 }
Beispiel #3
0
 internal void HandleQueryArenaInfo(ulong guid)
 {
     LogSys.Log(LOG_TYPE.DEBUG, "---got query arena info msg! id=" + guid);
     UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(guid);
     if (user == null)
     {
         return;
     }
     JsonMessageWithGuid resultMsg = new JsonMessageWithGuid(JsonMessageID.ArenaInfoResult);
     resultMsg.m_Guid = guid;
     ArkCrossEngineMessage.Msg_LC_ArenaInfoResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaInfoResult();
     ArenaInfo own_arena = m_ArenaSystem.GetArenaInfoById(guid);
     if (own_arena == null)
     {
         own_arena = m_ArenaSystem.CreateArenaInfo(user);
     }
     else if (own_arena.IsNeedUpdate(user))
     {
         own_arena.UpdateArenaInfo(user);
     }
     m_ArenaSystem.ResetArenaFightCount(own_arena);
     protoData.m_ArenaInfo = ArenaUtil.CreateArenaInfoMsg(own_arena, false);
     protoData.m_LeftBattleCount = own_arena.LeftFightCount;
     protoData.m_CurFightCountByTime = own_arena.FightCountBuyTime;
     long passed_time = (long)(DateTime.Now - own_arena.LastBattleTime).TotalMilliseconds;
     protoData.m_BattleLeftCDTime = m_ArenaSystem.BaseConfig.BattleCd - passed_time;
     resultMsg.m_ProtoData = protoData;
     JsonMessageDispatcher.SendDcoreMessage(user.NodeName, resultMsg);
     LogSys.Log(LOG_TYPE.DEBUG, "---send query arena info msg! id=" + guid);
 }
Beispiel #4
0
        private void SendResultMsg(ChallengeInfo info, UserInfo user)
        {
            if (user == null)
            {
                return;
            }
            JsonMessageWithGuid retMsg = new JsonMessageWithGuid(ArkCrossEngine.JsonMessageID.ArenaChallengeResult);

            retMsg.m_Guid = user.Guid;
            ArkCrossEngineMessage.Msg_LC_ArenaChallengeResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaChallengeResult();
            protoData.m_ChallengeInfo = ArenaUtil.CreateChallengeInfoData(info);
            retMsg.m_ProtoData        = protoData;
            JsonMessageDispatcher.SendDcoreMessage(user.NodeName, retMsg);
        }
Beispiel #5
0
 internal void HandleArenaQueryRank(ulong guid, int handle)
 {
     JsonMessageWithGuid resultMsg = new JsonMessageWithGuid(JsonMessageID.ArenaQueryRankResult);
     resultMsg.m_Guid = guid;
     ArkCrossEngineMessage.Msg_LC_ArenaQueryRankResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaQueryRankResult();
     ArenaInfo cur_info = m_ArenaSystem.GetArenaInfoById(guid);
     if (cur_info != null)
     {
         List<ArenaInfo> result = m_ArenaSystem.QueryRankList(cur_info.GetRank());
         for (int i = 0; i < result.Count; i++)
         {
             protoData.RankMsg.Add(ArenaUtil.CreateArenaInfoMsg(result[i]));
         }
     }
     resultMsg.m_ProtoData = protoData;
     JsonMessageDispatcher.SendDcoreMessage(handle, resultMsg);
     LogSys.Log(LOG_TYPE.DEBUG, "send query rank list!");
 }
Beispiel #6
0
 internal void HandleArenaQueryHistory(ulong guid, int handle)
 {
     LogSys.Log(LOG_TYPE.DEBUG, "--handle arena query history!");
     JsonMessageWithGuid resultMsg = new JsonMessageWithGuid(JsonMessageID.ArenaQueryHistoryResult);
     resultMsg.m_Guid = guid;
     ArkCrossEngineMessage.Msg_LC_ArenaQueryHistoryResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaQueryHistoryResult();
     UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(guid);
     List<ChallengeInfo> history = m_ArenaSystem.QueryHistory(guid);
     if (history != null)
     {
         foreach (ChallengeInfo info in history)
         {
             ArkCrossEngineMessage.ChallengeInfoData info_data = ArenaUtil.CreateChallengeInfoData(info);
             protoData.ChallengeHistory.Add(info_data);
         }
     }
     resultMsg.m_ProtoData = protoData;
     JsonMessageDispatcher.SendDcoreMessage(handle, resultMsg);
     LogSys.Log(LOG_TYPE.DEBUG, "--send arena query history result!");
 }