Esempio n. 1
0
 private bool MissionHandler_Scene(UserInfo user, MissionInfo mission, StageClearInfo info = null)
 {
     if (null != info)
     {
         if (null != mission && mission.Param0 == info.SceneId)
         {
             mission.CurValue = mission.CurValue + info.SweepCount;
             if (mission.CurValue >= mission.Param1)
             {
                 return(true);
             }
         }
     }
     else
     {
         if (null != mission && mission.FinishType != (int)MissionType.DAILY)
         {
             if (user.GetSceneInfo(mission.Param0) > 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 2
0
 internal void OnStageClear(UserInfo user, StageClearInfo info, ref List <int> completedMissions)
 {
     // 任务完成,新任务解锁
     foreach (MissionInfo missionInfo in user.Mission.UnCompletedMissions.Values)
     {
         if (null != missionInfo && null != missionInfo.Config)
         {
             if (user.Level >= missionInfo.Config.LevelLimit)
             {
                 UpdateMissionDelegate handler = GetHandlerById(missionInfo.FinishType);
                 if (null != handler)
                 {
                     bool result = handler(user, missionInfo, info);
                     if (result)
                     {
                         completedMissions.Add(missionInfo.MissionId);
                     }
                 }
             }
         }
     }
     for (int i = 0; i < completedMissions.Count; ++i)
     {
         CompleteMission(user, completedMissions[i]);
     }
 }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
 private bool MissionHandler_DeadCount(UserInfo user, MissionInfo mission, StageClearInfo info = null)
 {
     if (null != mission && null != info && mission.SceneId == info.SceneId && mission.Param0 >= info.DeadCount)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 5
0
 private bool MissionHandler_Time(UserInfo user, MissionInfo mission, StageClearInfo info = null)
 {
     if (null != mission && null != info && mission.SceneId == info.SceneId && mission.Param0 >= info.Duration / 1000)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 6
0
 private bool MissionHandler_SceneStar(UserInfo user, MissionInfo mission, StageClearInfo info = null)
 {
     if (null != user && null != mission)
     {
         if (user.GetSceneInfo(mission.Config.Args0) >= mission.Config.Args1)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 7
0
 private bool MissionHandler_Level(UserInfo user, MissionInfo mission, StageClearInfo info = null)
 {
     if (null != mission)
     {
         mission.CurValue = user.Level;
         if (mission.Param0 <= user.Level)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 8
0
 private bool MissionHandler_AnyScene(UserInfo user, MissionInfo mission, StageClearInfo info = null)
 {
     if (null != mission && null != info)
     {
         mission.CurValue = mission.CurValue + info.SweepCount;
         if (mission.CurValue >= mission.Param0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     return(false);
 }
Esempio n. 9
0
        internal void CheckAndSyncMissions(UserInfo user, StageClearInfo info = null)
        {
            List <int> completedMissions = new List <int>();

            OnStageClear(user, info, ref completedMissions);
            foreach (int missionId in completedMissions)
            {
                JsonMessageWithGuid missionCompletedMsg = new JsonMessageWithGuid(JsonMessageID.MissionCompleted);
                missionCompletedMsg.m_Guid = user.Guid;
                ArkCrossEngineMessage.Msg_LC_MissionCompleted missionProtoData = new ArkCrossEngineMessage.Msg_LC_MissionCompleted();
                if (null != missionProtoData)
                {
                    missionProtoData.m_MissionId    = missionId;
                    missionProtoData.m_Progress     = MissionSystem.Instance.GetMissionProgress(user, missionId, true);
                    missionCompletedMsg.m_ProtoData = missionProtoData;
                    JsonMessageDispatcher.SendDcoreMessage(user.NodeName, missionCompletedMsg);
                }
            }
        }
Esempio n. 10
0
 private bool MissionHandler_AutoFinish(UserInfo user, MissionInfo mission, StageClearInfo info = null)
 {
     return(true);
 }