public static void AddAchieveNode(mw.AchieveConfig val)
        {
            uint id = CUtils.MakeLong((ushort)val.type, (ushort)val.id);

            if (tableAchieve.ContainsKey(id))
            {
                tableAchieve[id] = val;
            }
            else
            {
                tableAchieve.Add(id, val);
            }

            if (val.id >= MinAchieveID && val.id <= MaxAchieveID)
            {
                spareAchieveIds.Remove(id);
            }
            m_isDirty = true;
        }
        private static STQuestInfo ConvertToSTQuest(mw.AchieveConfig config)
        {
            STQuestInfo quest = new STQuestInfo();

            quest.type        = (int)config.type;
            quest.typename    = GetQuestTypeName(quest.type);
            quest.desc        = TextManager.GetText(config.desc);
            quest.overlap     = (config.taskFlag == 1);
            quest.request     = config.opt_type_1;
            quest.requestname = GetRequestName(quest.request);
            quest.count_a     = config.opt_val_1_a;
            quest.count_b     = config.opt_val_1_b;
            quest.count_c     = config.opt_val_1_c;

            mw.RewardConfig configReward = GMTActivityMananger.GetRewardConfigsById(config.reward);
            if (null != configReward)
            {
                ConvertToSTReward(configReward, out quest.rewards);
            }

            return(quest);
        }
        public static bool RemoveAchieveNode(uint id)
        {
            mw.AchieveConfig config = null;
            tableAchieve.TryGetValue(id, out config);
            if (null == config)
            {
                return(false);
            }

            // text do not recycle
            //config.txt;
            //config.desc;
            //config.name;

            RemoveRewardNode(config.reward);
            config.reward = 0;

            tableAchieve.Remove(id);
            spareAchieveIds.Add(id);
            config    = null;
            m_isDirty = true;
            return(true);
        }
        public static mw.AchieveConfig GetNewConfigAchieve(mw.Enums.TaskType type)
        {
            if (spareAchieveIds.Count == 0)
            {
                CErrMgr.SetLastErrMsg(EErrType.ERR_ACTIVITY_ACHIEVE_ID_MAX);
                return(null);
            }

            mw.AchieveConfig config = new mw.AchieveConfig();
            for (int i = MinAchieveID; i <= MaxAchieveID; ++i)
            {
                uint id = CUtils.MakeLong((ushort)type, (ushort)i);
                if (spareAchieveIds.Contains(id))
                {
                    config.id   = i;
                    config.type = type;
                    break;
                }
            }

            AddAchieveNode(config);

            return(config);
        }
        private static bool DoAddQuest(int activiytId, List <STQuestInfo> quests, ref List <mw.AchieveConfig> listAchieve, ref List <mw.RewardConfig> listReward)
        {
            for (int i = 0; i < quests.Count; ++i)
            {
                mw.Enums.TaskType taskType      = (mw.Enums.TaskType)quests[i].type;
                mw.AchieveConfig  configAchieve = GMTActivityMananger.GetNewConfigAchieve(taskType);
                if (null == configAchieve)
                {
                    return(false);
                }

                configAchieve.activity    = activiytId;
                configAchieve.taskFlag    = (quests[i].overlap) ? 1 : 0;
                configAchieve.opt_type_1  = quests[i].type;
                configAchieve.opt_val_1_a = quests[i].count_a;
                configAchieve.opt_val_1_b = quests[i].count_b;
                configAchieve.opt_val_1_c = quests[i].count_c;

                if (quests[i].count_a < 1 || quests[i].count_a > 9999 ||
                    quests[i].count_b < 0 || quests[i].count_b > 9999 ||
                    quests[i].count_c < 0 || quests[i].count_c > 9999
                    )
                {
                    CErrMgr.SetLastErrMsg(EErrType.ERR_ACTIVITY_ACHIEVE_REQUEST_COUNT);
                    return(false);
                }

                if (quests[i].rewards.Count == 0 ||
                    quests[i].rewards.Count > 4)
                {
                    CErrMgr.SetLastErrMsg(EErrType.ERR_ACTIVITY_REWARD_COUNT);
                    return(false);
                }

                mw.RewardConfig configReward = null;
                bool            ret          = MakeRewardConfigWithRewardInfos(quests[i].rewards, out configReward);
                if (null != configReward)
                {
                    listReward.Add(configReward);
                }

                if (!ret)
                {
                    return(false);
                }

                configAchieve.reward = configReward.id;

                int taskDescTextId = 0;
                if (!string.IsNullOrEmpty(quests[i].desc))
                {
                    taskDescTextId = TextManager.CreateText();
                    TextManager.SetText(taskDescTextId, quests[i].desc);
                }

                // 这里贼乱, name 是活动标题, txt是活动内容, desc 是活动任务描述
                configAchieve.desc = taskDescTextId;

                listAchieve.Add(configAchieve);
            }

            return(true);
        }