예제 #1
0
        public int Update(SimulationQuestCountValue simulCountValue, ref DBUserQuests userQuestInfo, Int64 traceId)
        {
            var userID   = userQuestInfo._id;
            var hitCount = 0;

            if (simulCountValue != null)
            {
                if (userQuestInfo.Quest.ID != 0 && userQuestInfo.Quest.IsC == false && userQuestInfo.Quest.ST > 0)
                {
                    var quest = Loader.GetQuestData(userQuestInfo.Quest.ID);
                    if (quest == null)
                    {
                        OPLogger.Error(LOG_TYPE.QUEST_PR_UPDATE, traceId, string.Format("UserID:{0}, 퀘스트ID:{1} 정보가 없음", userID, userQuestInfo.Quest.ID));
                        return(hitCount);
                    }

                    hitCount += simulCountValue.Update(quest.SubjectClass, quest.SubjectID,
                                                       quest.SubjectCountOpenStart,
                                                       ref userQuestInfo.Quest.PR);

                    CheckUpdateComplete(quest.SubjectCount, userQuestInfo.Quest.PR, ref userQuestInfo.Quest.IsC);
                }

                for (int i = 0; i < userQuestInfo.DQList.Count; ++i)
                {
                    if (userQuestInfo.DQList[i].ID != 0 && userQuestInfo.DQList[i].IsC == false && userQuestInfo.DQList[i].ST > 0)
                    {
                        var quest = Loader.GetQuestData(userQuestInfo.DQList[i].ID);
                        if (quest == null)
                        {
                            OPLogger.Error(LOG_TYPE.QUEST_PR_UPDATE, traceId, string.Format("UserID:{0}, 퀘스트ID:{1} 정보가 없음", userID, userQuestInfo.DQList[i].ID));
                            continue;
                        }

                        hitCount += simulCountValue.Update(quest.SubjectClass, quest.SubjectID,
                                                           quest.SubjectCountOpenStart,
                                                           ref userQuestInfo.DQList[i].PR);

                        CheckUpdateComplete(quest.SubjectCount, userQuestInfo.DQList[i].PR, ref userQuestInfo.DQList[i].IsC);
                    }
                }
            }

            return(hitCount);
        }
예제 #2
0
        public static async Task <int> Update(string userID, SimulationQuestCountValue simulCountValue, Int64 traceId = 0)
        {
            int updateCount = 0;

            var userQuestInfo = await DBUserGameData.GetQuestData(userID);

            if (userQuestInfo != null)
            {
                updateCount = CountUpdaterInst.Update(simulCountValue, ref userQuestInfo, traceId);
                if (updateCount > 0)
                {
                    await DBUserGameData.SaveQuestData(userQuestInfo);
                }
            }
            else
            {
                OPLogger.Error(LOG_TYPE.QUEST_PR_UPDATE, traceId, string.Format("{0} 유저의 퀘스트 정보가 없습니다", userID));
            }

            return(updateCount);
        }