Ejemplo n.º 1
0
        public void OnSyncQuestValue(int questID, int valueIndex, int newValue)
        {
            KMissionLoaclInfo localInfo = baseInfoList[questID.ToString()];

            MissionInfo vo = GetMissionByID(questID);

            vo.condition = localInfo.Condition.Replace("V" + valueIndex, newValue.ToString());
            vo.curConditionNums[valueIndex] = newValue;
            if (CheckMissionFinish(vo))
            {
                vo.curStatus = MissionInfo.MisssionStatus.Finish;
                vo.tips      = GetMissionLocalInfoByID(vo.id).QuestName + "<FFA200>(可提交)<->";
                UpdateCurrentMissionList(vo);
                SceneLogic.GetInstance().MainHero.property.CmdAutoAttack = false;

                if (vo.nPlotID == 0 && vo.type == (int)MissionInfo.MissionType.MainMission)
                {
                    EventDispatcher.GameWorld.Dispath(ControllerCommand.CONTINUE_MISSION);
                }

                if (vo.subType == (int)MissionInfo.MissionSubType.Monster || vo.subType == (int)MissionInfo.MissionSubType.Collect)
                {
                    PlayEffect("effect_ui_renwu_wanchengmubiao");
                }
            }
            else
            {
                vo.curStatus = MissionInfo.MisssionStatus.BeenAccepted;
                vo.tips      = GetMissionLocalInfoByID(vo.id).QuestName + "<FF0000>(进行中)<->";
                UpdateCurrentMissionList(vo);
            }
        }
Ejemplo n.º 2
0
        public void RemoveNPCMission(int delMissionID)
        {
            KMissionLoaclInfo localInfo = baseInfoList[delMissionID.ToString()];

            if (localInfo != null)
            {
                RemoveNpcMission(localInfo.nNpcID, delMissionID);
                RemoveNpcMission(localInfo.nSubmitNpcID, delMissionID);
            }
        }
Ejemplo n.º 3
0
        public MissionInfo WrapperMission(int missionID)
        {
            KMissionLoaclInfo localInfo = baseInfoList[missionID.ToString()];

            if (localInfo == null)
            {
                return(null);
            }

            MissionInfo vo = new MissionInfo();

            vo.curTimes  = 1;
            vo.id        = missionID;
            vo.levelLimt = localInfo.nLevelLimt;
            vo.submitLv  = localInfo.nSubmitLv;
            vo.preID     = localInfo.nPreID;
            vo.type      = localInfo.nType;
            vo.subType   = localInfo.nSubType;
            vo.nPlotID   = localInfo.nPlotID;
            vo.questName = localInfo.QuestName;
            vo.bScript   = localInfo.bScript;

            if (localInfo.ConditionNums != null && localInfo.ConditionNums != "")
            {
                string[] nums          = localInfo.ConditionNums.Split(',');
                int      len           = nums.Length;
                int[]    conditionNums = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    conditionNums[i] = int.Parse(nums[i]);
                    vo.condition     = localInfo.Condition.Replace("V" + i, "0");
                }
                vo.conditionNums    = conditionNums;
                vo.curConditionNums = new int[conditionNums.Length];
            }
            vo.curStatus = MissionInfo.MisssionStatus.Accept;

            if (localInfo.NeedItemIDs != null && localInfo.NeedItemIDs != "")
            {
                string[] ids         = localInfo.NeedItemIDs.Split(',');
                int      len         = ids.Length;
                int[]    needItemIDs = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    needItemIDs[i] = int.Parse(ids[i]);
                }
                vo.needItemIDs = needItemIDs;
            }
            if (localInfo.NeedItemNums != null && localInfo.NeedItemNums != "")
            {
                string[] nums         = localInfo.NeedItemNums.Split(',');
                int      len          = nums.Length;
                int[]    needItemNums = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    needItemNums[i] = int.Parse(nums[i]);
                }
                vo.needItemNums = needItemNums;
            }
            vo.exp   = localInfo.nRewardExp;
            vo.money = localInfo.nRewardMoney;
            vo.gold  = localInfo.nRewardGold;
            if (localInfo.RewardItemTypes != null && localInfo.RewardItemTypes != "" && localInfo.RewardItemTypes != "0")
            {
                string[] ids   = localInfo.RewardItemTypes.Split(',');
                int      len   = ids.Length;
                int[]    types = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    types[i] = int.Parse(ids[i]);
                }
                vo.rewardTypes = types;
            }
            if (localInfo.RewardItemIDs != null && localInfo.RewardItemIDs != "" && localInfo.RewardItemIDs != "0")
            {
                string[] ids           = localInfo.RewardItemIDs.Split(',');
                int      len           = ids.Length;
                int[]    rewardItemIDs = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    rewardItemIDs[i] = int.Parse(ids[i]);
                }
                vo.rewardItemIDs = rewardItemIDs;
            }

            if (localInfo.RewardItemNums != null && localInfo.RewardItemNums != "" && localInfo.RewardItemNums != "0")
            {
                string[] nums           = localInfo.RewardItemNums.Split(',');
                int      len            = nums.Length;
                int[]    rewardItemNums = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    rewardItemNums[i] = int.Parse(nums[i]);
                }
                vo.rewardItemNums = rewardItemNums;
            }

            if (localInfo.Dialogue1 != null && localInfo.Dialogue1 != "")
            {
                string[] ids         = localInfo.Dialogue1.Split(',');
                int      len         = ids.Length;
                int[]    dialogueIDs = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    dialogueIDs[i] = int.Parse(ids[i]);
                }
                vo.dialogue1 = dialogueIDs;
            }
            vo.dialogue2   = localInfo.nDialogue2;
            vo.dialogue3   = localInfo.nDialogue3;
            vo.npcID       = localInfo.nNpcID;
            vo.submitNpcID = localInfo.nSubmitNpcID;
            vo.desc        = localInfo.Describe;
            vo.tips        = localInfo.QuestName + "<78FF00>(可接)<->";
            if (localInfo.Position != null && localInfo.Position != "0")
            {
                string[] pos      = localInfo.Position.Split(';');
                int      len      = pos.Length;
                int[]    position = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    position[i] = int.Parse(pos[i]);
                }
                vo.position = position;
            }
            vo.pathAiType     = localInfo.PathAIType;
            vo.pathType       = localInfo.PathType;
            vo.isAutoComplete = localInfo.bAutoComplete;
            vo.totalTimes     = localInfo.nTimes;

            UpdateCanAcceptList(vo);

            return(vo);
        }
Ejemplo n.º 4
0
        public MissionInfo WrapperMission(RemoteTable pvo)
        {
            int    index       = pvo["QuestID"];
            string indexString = index.ToString();


            KMissionLoaclInfo localInfo = baseInfoList[indexString];

            if (localInfo == null)
            {
                return(null);
            }

            MissionInfo vo = new MissionInfo();

            vo.curTimes  = 1;
            vo.id        = (int)pvo["QuestID"];
            vo.levelLimt = localInfo.nLevelLimt;
            vo.submitLv  = localInfo.nSubmitLv;
            vo.preID     = localInfo.nPreID;
            vo.type      = localInfo.nType;
            vo.subType   = localInfo.nSubType;
            vo.nPlotID   = localInfo.nPlotID;
            vo.questName = localInfo.QuestName;
            vo.bScript   = localInfo.bScript;

            RemoteTable questValueTable = (RemoteTable)pvo["QuestValue"];

            vo.curConditionNums = new int[questValueTable.Count];
            for (int i = 0; i < questValueTable.Count; i++)
            {
                int questValue = questValueTable[i + 1];                 //lua那边table表默认是1开始的.
                vo.condition           = localInfo.Condition.Replace("V" + i, questValue.ToString());
                vo.curConditionNums[i] = questValue;
            }

            bool hasCompeled = true;

            if (localInfo.ConditionNums != null && localInfo.ConditionNums != "")
            {
                string[] nums = localInfo.ConditionNums.Split(',');
                int      len  = nums.Length;
                if (len != questValueTable.Count)
                {
                    Debug.Log("任务数据前端Condition和后端事件数不一致");
                }

                int[] conditionNums = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    conditionNums[i] = int.Parse(nums[i]);
                    if (conditionNums[i] != questValueTable[i + 1])//lua那边table表默认是1开始的.
                    {
                        hasCompeled = false;
                    }
                }
                vo.conditionNums = conditionNums;
            }
            if (hasCompeled)
            {
                vo.curStatus = MissionInfo.MisssionStatus.Finish;
            }
            else
            {
                vo.curStatus = MissionInfo.MisssionStatus.BeenAccepted;
            }

            if (localInfo.NeedItemIDs != null && localInfo.NeedItemIDs != "")
            {
                string[] ids         = localInfo.NeedItemIDs.Split(',');
                int      len         = ids.Length;
                int[]    needItemIDs = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    needItemIDs[i] = int.Parse(ids[i]);
                }
                vo.needItemIDs = needItemIDs;
            }
            if (localInfo.NeedItemNums != null && localInfo.NeedItemNums != "")
            {
                string[] nums         = localInfo.NeedItemNums.Split(',');
                int      len          = nums.Length;
                int[]    needItemNums = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    needItemNums[i] = int.Parse(nums[i]);
                }
                vo.needItemNums = needItemNums;
            }
            vo.exp   = localInfo.nRewardExp;
            vo.money = localInfo.nRewardMoney;
            vo.gold  = localInfo.nRewardGold;
            if (localInfo.RewardItemIDs != null && localInfo.RewardItemIDs != "")
            {
                string[] ids           = localInfo.RewardItemIDs.Split(',');
                int      len           = ids.Length;
                int[]    rewardItemIDs = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    rewardItemIDs[i] = int.Parse(ids[i]);
                }
                vo.rewardItemIDs = rewardItemIDs;
            }
            if (localInfo.Dialogue1 != null && localInfo.Dialogue1 != "")
            {
                string[] ids         = localInfo.Dialogue1.Split(';');
                int      len         = ids.Length;
                int[]    dialogueIDs = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    dialogueIDs[i] = int.Parse(ids[i]);
                }
                vo.dialogue1 = dialogueIDs;
            }
            vo.dialogue2   = localInfo.nDialogue2;
            vo.dialogue3   = localInfo.nDialogue3;
            vo.npcID       = localInfo.nNpcID;
            vo.submitNpcID = localInfo.nSubmitNpcID;
            vo.desc        = localInfo.Describe;
            if (vo.curStatus == MissionInfo.MisssionStatus.Accept)
            {
                vo.tips = localInfo.QuestName + "<78FF00>(可接)<->";
            }
            else if (vo.curStatus == MissionInfo.MisssionStatus.BeenAccepted)
            {
                vo.tips = localInfo.QuestName + "<FF0000>(未完成)<->";
            }
            else if (vo.curStatus == MissionInfo.MisssionStatus.Finish)
            {
                vo.tips = localInfo.QuestName + "<FFA2000>(可提交)<->";
            }
            if (localInfo.Position != null && localInfo.Position != "0")
            {
                string[] pos      = localInfo.Position.Split(';');
                int      len      = pos.Length;
                int[]    position = new int[len];
                for (int i = 0; i < len; ++i)
                {
                    position[i] = int.Parse(pos[i]);
                }
                vo.position = position;
            }
            vo.pathAiType     = localInfo.PathAIType;
            vo.pathType       = localInfo.PathType;
            vo.isAutoComplete = localInfo.bAutoComplete;// == 0 ? false : true;
            vo.totalTimes     = localInfo.nTimes;

            UpdateCurrentMissionList(vo);

            return(vo);
        }