예제 #1
0
        protected override void ProcessCmd(string[] args)
        {
            int plotID = args.Length > 0 ? args[0].Trim().ToInt() : 0;

            var package = UserPlotPackage.Get(UserID);

            if (package == null)
            {
                return;
            }
            var userplotInfo = UserPlotHelper.GetUserPlotInfo(UserID, plotID);

            if (userplotInfo == null)
            {
                userplotInfo = new UserPlotInfo();

                userplotInfo.PlotID       = plotID;
                userplotInfo.PlotStatus   = PlotStatus.NoComplete;
                userplotInfo.CompleteDate = DateTime.Now;
                userplotInfo.CreateDate   = DateTime.Now;
            }
            else
            {
                userplotInfo.PlotStatus = PlotStatus.NoComplete;
            }
            package.SaveItem(userplotInfo);
        }
예제 #2
0
 private short GetPlotStatus(UserPlotInfo userPlot, PlotType plotType)
 {
     if (userPlot != null)
     {
         if (plotType == PlotType.Normal)
         {
             var plotInfo = new ConfigCacheSet <PlotInfo>().FindKey(userPlot.PlotID);
             if (plotInfo.PrePlotID > 0)
             {
                 var preUserPlot = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, plotInfo.PrePlotID);
                 if (preUserPlot == null || preUserPlot.PlotStatus != PlotStatus.Completed)
                 {
                     return((short)PlotStatus.Locked);
                 }
             }
         }
         else
         {
             if (plotType == PlotType.Elite)
             {
                 var plotInfo = new ConfigCacheSet <PlotInfo>().FindKey(userPlot.PlotID);
                 if (plotInfo.PrePlotID > 0 && plotInfo.JYPrePlotID > 0)
                 {
                     var preUserPlot = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, plotInfo.JYPrePlotID);
                     if (preUserPlot == null || preUserPlot.PlotStatus != PlotStatus.Completed)
                     {
                         return((short)PlotStatus.Locked);
                     }
                 }
             }
         }
         return((short)userPlot.PlotStatus);
     }
     return((short)PlotStatus.Locked);
 }
예제 #3
0
 public override void BuildPacket()
 {
     PushIntoStack(plotInfo.PlotName.ToNotNullString());
     PushIntoStack(plotInfo.BgScene.ToNotNullString());
     PushIntoStack(plotInfo.FgScene.ToNotNullString());
     PushIntoStack(npcList.Count);
     foreach (PlotNPCInfo item in npcList)
     {
         DataStruct ds = new DataStruct();
         ds.PushIntoStack(item.PlotNpcID);
         ds.PushIntoStack(item.NpcSeqNo);
         ds.PushIntoStack(item.NpcName.ToNotNullString());
         ds.PushIntoStack(item.HeadID.ToNotNullString());
         ds.PushIntoStack(item.NpcTip.ToNotNullString());
         ds.PushIntoStack(item.PointX);
         ds.PushIntoStack(item.PointY);
         bool isPlayStory = false;
         var  userPlot    = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, plotID);
         if (userPlot == null || userPlot.PlotStatus != PlotStatus.Completed)
         {
             isPlayStory = true;
         }
         ds.PushIntoStack(isPlayStory ? item.PreStoryCode.ToNotNullString() : string.Empty);
         ds.PushIntoStack(isPlayStory ? item.AftStoryCode.ToNotNullString() : string.Empty);
         PushIntoStack(ds);
     }
     PushIntoStack(_isOverCombat ? (short)1 : (short)0);
     PushIntoStack(_plotNum);
 }
예제 #4
0
        public override void BuildPacket()
        {
            var cacheSetItem = new ConfigCacheSet <ItemBaseInfo>();

            PushIntoStack(_cityInfoList.Count);
            foreach (var city in _cityInfoList)
            {
                List <PlotInfo> plotList = _cacheSetPlot.FindAll(s => s.CityID == city.CityID && s.PlotType == plotType);

                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(plotList.Count);
                foreach (PlotInfo item in plotList)
                {
                    UserPlotInfo userPlot   = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, item.PlotID);
                    int          isKill     = PlotHelper.IsKill(ContextUser.UserID, item.PlotID, cityID) ? 1 : 0;
                    DataStruct   dsItemPlot = new DataStruct();
                    dsItemPlot.PushIntoStack(item.PlotID);
                    dsItemPlot.PushIntoStack(item.PlotSeqNo.ToShort());
                    dsItemPlot.PushIntoStack(item.PlotName.ToNotNullString());
                    dsItemPlot.PushIntoStack(item.BossHeadID.ToNotNullString());
                    dsItemPlot.PushIntoStack(GetPlotStatus(userPlot, plotType));
                    dsItemPlot.PushIntoStack(userPlot == null ? 1 : (int)userPlot.StarScore);
                    dsItemPlot.PushIntoStack(isKill);
                    dsItemPlot.PushIntoStack(item.HonourNum);
                    dsItemPlot.PushIntoStack(item.GameCoin);
                    dsItemPlot.PushIntoStack(item.PlotDesc);
                    dsItemPlot.PushIntoStack(item.PlotLv);
                    dsItemPlot.PushIntoStack(ConfigEnvSet.GetInt("Plot.BattleEnergyNum"));
                    dsItemPlot.PushIntoStack(PlotHelper.GetPlotChallengeNum(UserId.ToString(), item.PlotID));
                    dsItemPlot.PushIntoStack(item.ChallengeNum);
                    dsItemPlot.PushIntoStack(userPlot == null ? 0 : userPlot.PlotNum);
                    dsItem.PushIntoStack(dsItemPlot);
                    var itemArray = item.ItemRank.Split(',');
                    dsItemPlot.PushIntoStack(itemArray.Length);
                    foreach (var s in itemArray)
                    {
                        var        sArray     = s.Split('=');
                        var        itemInfo   = cacheSetItem.FindKey(sArray.Length > 0 ? sArray[0].ToInt() : 0);
                        DataStruct dsItemInfo = new DataStruct();
                        dsItemInfo.PushIntoStack(itemInfo != null ? itemInfo.ItemName : string.Empty);
                        dsItemInfo.PushIntoStack(sArray.Length > 1 ? sArray[1].ToInt() : 0);
                        dsItemPlot.PushIntoStack(dsItemInfo);
                    }
                }

                dsItem.PushIntoStack(city.CityID);
                dsItem.PushIntoStack(city.CityName.ToNotNullString());

                PushIntoStack(dsItem);
            }
            PushIntoStack(resetNum);
            PushIntoStack(_backpackType);
        }
예제 #5
0
 public override void BuildPacket()
 {
     PushIntoStack(plotInfoArray.Count);
     foreach (var item in plotInfoArray)
     {
         var        userPlot = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, item.PlotID); //new GameDataCacheSet<UserPlot>().FindKey(ContextUser.UserID, item.PlotID);
         DataStruct dsItem   = new DataStruct();
         dsItem.PushIntoStack(item.PlotID);
         dsItem.PushIntoStack(item.PlotSeqNo);
         dsItem.PushIntoStack(item.PlotName.ToNotNullString());
         dsItem.PushIntoStack(item.BossHeadID.ToNotNullString());
         dsItem.PushIntoStack(UserPlotHelper.GetPlotStatus(ContextUser.UserID, userPlot));
         dsItem.PushIntoStack(userPlot == null ? 0 : (int)userPlot.StarScore);
         dsItem.PushIntoStack(UserHelper.IsKill(ContextUser, item.PlotID) ? 1 : 0);
         PushIntoStack(dsItem);
     }
     PushIntoStack(plotInfo == null ? string.Empty : plotInfo.PlotName.ToNotNullString());
     PushIntoStack(hurdleNum);
     PushIntoStack(npcName.ToNotNullString());
     PushIntoStack(RefreshKapla(ContextUser.UserID, 1));
     PushIntoStack(plotInfo == null ? 0 : plotInfo.Experience);
     PushIntoStack(plotNpcInfoArray.Count);
     foreach (PlotNPCInfo npcInfo in plotNpcInfoArray)
     {
         SparePartInfo partInfo = new ConfigCacheSet <SparePartInfo>().FindKey(npcInfo.SparePartID);
         DataStruct    dsItem   = new DataStruct();
         dsItem.PushIntoStack(partInfo == null ? 0 : partInfo.Id);
         dsItem.PushIntoStack(partInfo == null ? string.Empty : partInfo.Name.ToNotNullString());
         dsItem.PushIntoStack(itemNum);
         PushIntoStack(dsItem);
     }
     PushIntoStack(_isOverCombat ? (short)1 : (short)0);
     PushIntoStack(RefreshKapla(ContextUser.UserID, 2));
     PushIntoStack(universalArray.Length);
     foreach (var item in universalArray)
     {
         DataStruct dsItem = new DataStruct();
         dsItem.PushIntoStack(item.Name.ToNotNullString());
         dsItem.PushIntoStack(item.Num);
         PushIntoStack(dsItem);
     }
 }
예제 #6
0
        public override bool TakeAction()
        {
            List <UniversalInfo> universalList = new List <UniversalInfo>();
            int layerNum = CheckUserPlotLayerNum(ContextUser);

            hurdleNum     = CheckUserPlotHurdleNum(ContextUser);
            plotInfoArray = new ConfigCacheSet <PlotInfo>().FindAll(m => m.LayerNum == layerNum && m.PlotType == PlotType.Kalpa);
            if (plotInfoArray.Count > 0)
            {
                plotInfo = new List <PlotInfo>(plotInfoArray).Find(u => u.PlotSeqNo == hurdleNum);
                if (plotInfo != null)
                {
                    plotNpcInfoArray = new ConfigCacheSet <PlotNPCInfo>().FindAll(m => m.PlotID == plotInfo.PlotID);
                    foreach (var info in plotNpcInfoArray)
                    {
                        SparePartInfo partInfo = new ConfigCacheSet <SparePartInfo>().FindKey(info.SparePartID);
                        if (partInfo != null)
                        {
                            universalList.Add(new UniversalInfo()
                            {
                                Name = partInfo.Name, HeadID = partInfo.HeadID, Num = 1
                            });
                        }
                    }
                    npcName = plotNpcInfoArray.Count == 0 ? string.Empty : plotNpcInfoArray[0].NpcName;
                    var userPlot = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, plotInfo.PlotID);
                    //todo new GameDataCacheSet<UserPlot>().FindKey(Uid, plotInfo.PlotID);
                    _isOverCombat = userPlot != null && userPlot.PlotStatus == PlotStatus.Completed;
                    strEnchant    = plotInfo.EnchantID.Split(',');
                    if (strEnchant.Length > 0)
                    {
                        universalList.Add(new UniversalInfo()
                        {
                            Name = LanguageManager.GetLang().St4301_RandomEnchant, HeadID = string.Empty, Num = 1
                        });
                    }
                    universalArray = universalList.ToArray();
                }
            }

            return(true);
        }
예제 #7
0
        public bool IsCombat(int plotId)
        {
            var plot = new ShareCacheStruct <PlotInfo>().FindKey(plotId);

            if (plot != null)
            {
                //todo
                var userPlot = UserPlotHelper.GetUserPlotInfo(_userId, plot.PrePlotID);
                //new PersonalCacheStruct<UserPlot>().FindKey(_userId, plot.PrePlotID);)
                if (userPlot != null && userPlot.PlotStatus == PlotStatus.Completed)
                {
                    //string key = _userId + plotId;
                    //int timesNum = _userTimesList != null && _userTimesList.ContainsKey(key) ? _userTimesList[key] : 0;
                    //return timesNum < MaxCombatNum;
                    int timesNum = CombatHelper.GetDailyMorePlotNum(_userId, plotId);
                    return(timesNum < MaxCombatNum);
                }
            }
            return(false);
        }
예제 #8
0
        /// <summary>
        /// 当前玩家所在的层、关的副本
        /// </summary>
        /// <returns></returns>
        public static PlotInfo CheckUserPlotKalpa(GameUser user)
        {
            PlotInfo plotInfo = null;

            var userPlotArray = UserPlotHelper.UserPlotFindAll(user.UserID).FindAll(m => m.PlotType == PlotType.Kalpa);

            if (userPlotArray.Count == 0)
            {
                PlotHelper.EnablePlot(user.UserID, 8000);
                UserPlotHelper.UserPlotFindAll(user.UserID).FindAll(m => m.PlotType == PlotType.Kalpa);
            }
            if (userPlotArray.Count > 0)
            {
                userPlotArray.QuickSort((x, y) =>
                {
                    int result = 0;
                    if (x == null && y == null)
                    {
                        return(0);
                    }
                    if (x != null && y == null)
                    {
                        return(1);
                    }
                    if (x == null)
                    {
                        return(-1);
                    }
                    result = new ConfigCacheSet <PlotInfo>().FindKey(y.PlotID).LayerNum.CompareTo(
                        new ConfigCacheSet <PlotInfo>().FindKey(x.PlotID).LayerNum);
                    if (result == 0)
                    {
                        result = new ConfigCacheSet <PlotInfo>().FindKey(y.PlotID).PlotSeqNo.CompareTo(
                            new ConfigCacheSet <PlotInfo>().FindKey(x.PlotID).PlotSeqNo);
                    }
                    return(result);
                });
                plotInfo = new ConfigCacheSet <PlotInfo>().FindKey(userPlotArray[0].PlotID);
            }
            return(plotInfo);
        }
예제 #9
0
        /// <summary>
        /// 可创建多人副本列表
        /// </summary>
        /// <returns></returns>
        public MorePlot[] GetMorePlotList()
        {
            List <MorePlot> morePlotsList = new List <MorePlot>();
            var             plotsArray    = UserPlotHelper.UserPlotFindAll(_userId);

            // todo new PersonalCacheStruct<UserPlot>().FindAll(_userId);)
            foreach (UserPlotInfo plot in plotsArray)
            {
                var morePlotArray = new ShareCacheStruct <PlotInfo>().FindAll(u => u.PlotType == PlotType.MorePlot && u.PrePlotID == plot.PlotID);

                if (morePlotArray.Count > 0)
                {
                    var morePlot = morePlotArray[0];
                    if (IsCombat(morePlot.PlotID))
                    {
                        morePlotsList.Add(GetItem(morePlot.PlotID));
                    }
                }
            }
            return(morePlotsList.ToArray());
        }
예제 #10
0
        private bool IsPlotOut(PlotNPCInfo npcInfo)
        {
            if (npcInfo == null)
            {
                return(true);
            }
            var userPlot = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, npcInfo.PlotID);

            if (userPlot != null && UserHelper.IsKill(ContextUser, userPlot.PlotID))
            {
                int layerNum     = ContextUser.UserExtend.LayerNum;
                int nextLayerNum = MathUtils.Addition(layerNum, 1);
                if (new ConfigCacheSet <PlotInfo>().FindAll(m => m.LayerNum == nextLayerNum && m.PlotType == PlotType.Kalpa).Count == 0)
                {
                    int nextHurdleNum = MathUtils.Addition(ContextUser.UserExtend.HurdleNum, 1);
                    //是否有下一关
                    return(new ConfigCacheSet <PlotInfo>().FindAll(m => m.LayerNum == layerNum && m.PlotSeqNo == nextHurdleNum && m.PlotType == PlotType.Kalpa).Count == 0);
                }
            }
            return(false);
        }
예제 #11
0
        /// <summary>
        /// 检查是否完成
        /// 1.对话任务=>直接更新成可完成
        /// 2.副本战斗=>战斗结束需要回写玩家任务表目标数量
        /// </summary>
        public static void CheckStoryCompleted(string userID)
        {
            List <UserTask> userTaskList = new GameDataCacheSet <UserTask>().FindAll(userID, m => m.TaskType < TaskType.Daily && (m.TaskState == TaskState.Taked || m.TaskState == TaskState.NoTake));

            foreach (UserTask userTask in userTaskList)
            {
                StoryTaskInfo taskInfo = new ConfigCacheSet <StoryTaskInfo>().FindKey(userTask.TaskID);

                if (taskInfo == null)
                {
                    continue;
                }

                if (userTask.TaskState == TaskState.NoTake)
                {
                    GameUser gameUser = new GameDataCacheSet <GameUser>().FindKey(userID);
                    short    lv       = gameUser == null ? (short)0 : gameUser.UserLv;
                    userTask.TaskState = taskInfo.TaskLv <= lv ? TaskState.AllowTake : TaskState.NoTake;
                    //userTask.Update();
                    continue;
                }

                bool isUpdate = false;
                switch (taskInfo.TermsType)
                {
                case PlotTermsType.Shouji:
                case PlotTermsType.Delivery:
                    int currNum = UserItemHelper.CheckItemNum(userID, taskInfo.TargetItemID);
                    if (currNum >= taskInfo.TargetItemNum)
                    {
                        userTask.TaskState = TaskState.Completed;
                        isUpdate           = true;
                    }
                    break;

                case PlotTermsType.StoryBattle:
                    var userPlot = UserPlotHelper.GetUserPlotInfo(userID, taskInfo.PlotID);
                    if (userPlot != null && userPlot.PlotStatus == PlotStatus.Completed)
                    {
                        userTask.TaskState = TaskState.Completed;
                        isUpdate           = true;
                    }
                    break;

                case PlotTermsType.Battle:
                    string[] monsterNumList = taskInfo.TargetMonsterNum.ToNotNullString().Split(new[] { ',' });
                    string[] userNumList    = userTask.TaskTargetNum.ToNotNullString().Split(new[] { ',' });
                    bool     flag           = true;
                    for (int i = 0; i < monsterNumList.Length; i++)
                    {
                        int mNum = monsterNumList[i].ToInt();
                        int uNum = userNumList.Length > 0 ? userNumList[i].ToInt() : 0;
                        if (uNum < mNum)
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        userTask.TaskState = TaskState.Completed;
                        isUpdate           = true;
                    }
                    break;

                case PlotTermsType.Dialogue:
                    userTask.TaskState = TaskState.Completed;
                    isUpdate           = true;
                    break;

                default:
                    break;
                }
                if (isUpdate)
                {
                    //userTask.Update();
                }
            }
        }
예제 #12
0
        public override bool TakeAction()
        {
            if (ContextUser.UserStatus == UserStatus.CountryCombat)
            {
                CountryCombat countryCombat = new CountryCombat(ContextUser);
                if (countryCombat.GameActive != null && countryCombat.GameActive.RefreshStatus() == CombatStatus.Combat)
                {
                    countryCombat.Exit();
                }
            }

            if (ContextUser.EnergyNum <= 0 && ContextUser.SurplusEnergy <= 0)
            {
                ErrorCode = 3;
                ErrorInfo = LanguageManager.GetLang().St_EnergyNotEnough;
                return(false);
            }
            //if (_ops != 1 && UserHelper.IsPromptBlood(ContextUser.UserID))
            //{
            //    ErrorCode = 1;
            //    ErrorInfo = LanguageManager.GetLang().St4002_PromptBlood;
            //    return false;
            //}
            //if (_ops != 1 && UserItemHelper.CheckItemOut(ContextUser, ItemStatus.BeiBao))
            //{
            //    ErrorCode = 1;
            //    ErrorInfo = LanguageManager.GetLang().St_User_BeiBaoMsg;
            //    return false;
            //}

            UserHelper.UserGeneralPromptBlood(ContextUser);//佣兵自动使用绷带补血

            plotInfo = new ShareCacheStruct <PlotInfo>().FindKey(plotID);

            if (plotInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().LoadDataError;
                return(false);
            }
            int challengeNum = PlotHelper.GetPlotChallengeNum(UserId.ToString(), plotInfo.PlotID);

            if (plotInfo.PlotType == PlotType.Elite && challengeNum >= plotInfo.ChallengeNum)
            {
                ErrorCode = 4;
                ErrorInfo = LanguageManager.GetLang().St4002_IsPlotEliteNotChallengeNum;
                return(false);
            }

            if ((challengeNum >= plotInfo.ChallengeNum && ContextUser.VipLv < 3))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St4002_NotChallengeNum;
                return(false);
            }

            int num = challengeNum;
            int challengeDefSoldNum    = ConfigEnvSet.GetInt("UserPlot.ChallengeDefSoldNum");
            int challengeDoubleSoldNum = ConfigEnvSet.GetInt("UserPlot.ChallengeDoubleSoldNum");

            if (_ops != 1 && num >= plotInfo.ChallengeNum && PlotHelper.GetPlotIsOne(UserId.ToString(), plotInfo.PlotID))
            {
                ErrorCode = 1;
                _plotNum  = challengeDefSoldNum;
                return(false);
            }
            else
            {
                if (_ops != 1 && num >= plotInfo.ChallengeNum && PlotHelper.GetPlotIsOne(UserId.ToString(), plotInfo.PlotID) == false)
                {
                    int openNum = num - plotInfo.ChallengeNum + 1;
                    _plotNum = challengeDoubleSoldNum * openNum + challengeDefSoldNum;
                }
            }

            if (_ops != 1 && num >= plotInfo.ChallengeNum)
            {
                ErrorCode = 1;
                ErrorInfo = string.Format(LanguageManager.GetLang().St4002_IsPlotNum, _plotNum);
                return(false);
            }
            if (_ops == 1 && num >= plotInfo.ChallengeNum)
            {
                if (ContextUser.GoldNum < _plotNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }
                ContextUser.UseGold = MathUtils.Subtraction(ContextUser.UseGold, _plotNum);
            }
            if (_ops == 1 && num >= plotInfo.ChallengeNum && PlotHelper.GetPlotIsOne(UserId.ToString(), plotInfo.PlotID) == false)
            {
                int openNum = num - plotInfo.ChallengeNum + 1;
                _plotNum = challengeDoubleSoldNum * openNum + challengeDefSoldNum;;
                if (ContextUser.GoldNum < _plotNum)
                {
                    ErrorCode = 2;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }
                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, _plotNum);
            }
            if (_ops != 1 && !string.IsNullOrEmpty(plotInfo.EnchantID) && plotInfo.EnchantProbability > 0 && EnchantHelper.IsEnchantPackage(ContextUser.UserID))
            {
                ErrorCode = 1;
                ErrorInfo = LanguageManager.GetLang().St4002_EnchantPackageFull;
                return(false);
            }
            //var cacheSetUserPlot = new PersonalCacheStruct<UserPlotPackage>();
            //var userPlotPack = cacheSetUserPlot.FindKey(ContextUser.UserID);
            //var userPlot = userPlotPack != null ? userPlotPack.PlotPackage.Find(s => s.PlotID == npcInfo.PlotID) : null;
            var userPlot = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, plotID);

            if (userPlot != null && userPlot.PlotNum >= plotInfo.ChallengeNum)
            {
                if (plotInfo.PlotType == PlotType.Elite)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St4002_EliteUsed;
                    return(false);
                }
                else if (plotInfo.PlotType == PlotType.HeroPlot)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St4002_HeroPlotNum;
                    return(false);
                }
            }
            npcList = new ShareCacheStruct <PlotNPCInfo>().FindAll(m => m.PlotID == plotID);
            //if (ContextUser.EnergyNum < (npcList.Count * PlotInfo.BattleEnergyNum))
            //{
            //    ErrorCode = 3;
            //    ErrorInfo = LanguageManager.GetLang().St_EnergyNotEnough;
            //    return false;
            //}
            ContextUser.InPlotDate = DateTime.Now;
            //if (ContextUser.UserExtend == null || ContextUser.UserExtend.PlotStatusID == 0 || ContextUser.UserExtend.MercenarySeq == 0)
            //{
            //    ContextUser.TempEnergyNum = PlotInfo.BattleEnergyNum;
            //    //ContextUser.RemoveEnergyNum(PlotInfo.BattleEnergyNum);
            //}
            //ContextUser.Update();
            if (ContextUser.UserExtend != null && ContextUser.UserExtend.PlotStatusID <= 0)
            {
                ContextUser.UserExtend.UpdateNotify(obj =>
                {
                    ContextUser.UserExtend.PlotStatusID = plotID;
                    ContextUser.UserExtend.PlotNpcID    = -1;
                    ContextUser.UserExtend.MercenarySeq = 1;
                    ContextUser.UserExtend.IsBoss       = false;
                    return(true);
                });
            }

            _isOverCombat             = userPlot != null && userPlot.PlotStatus == PlotStatus.Completed;
            ContextUser.TempEnergyNum = PlotInfo.BattleEnergyNum;
            return(true);
        }
예제 #13
0
        public override bool TakeAction()
        {
            PlotInfo plotInfo = new ShareCacheStruct <PlotInfo>().FindKey(PlotID);

            if (plotInfo != null)
            {
                plotName = plotInfo.PlotName;
            }
            var cacheSetGeneralEscalate = new ShareCacheStruct <GeneralEscalateInfo>();

            GeneralEscalateHelper.AddUserLv(ContextUser, 0);
            int lv = ContextUser.UserLv;

            lv = lv < 0 ? 1 : lv + 1;
            var generalEscalate =
                cacheSetGeneralEscalate.Find(s => s.GeneralType == GeneralType.YongHu && s.GeneralLv == lv);

            if (generalEscalate != null)
            {
                maxHonourNum = generalEscalate.UpExperience;
            }
            var lastGeneralEscalate = cacheSetGeneralEscalate.Find(s => s.GeneralType == GeneralType.YongHu && s.GeneralLv == (lv - 1));

            if (lastGeneralEscalate != null)
            {
                lastMaxHonourNum = lastGeneralEscalate.UpExperience;
            }

            embattleList = new PersonalCacheStruct <UserEmbattle>().FindAll(ContextUser.UserID, m => m.MagicID == ContextUser.UseMagicID);
            embattleList.QuickSort((x, y) => x.GeneralID.CompareTo(y.GeneralID));
            List <UniversalInfo> universalList = new List <UniversalInfo>();

            userPlot = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, PlotID);
            //var cacheSetPlotInfo = new ShareCacheStruct<PlotInfo>();
            //var cacheSetItem = new ShareCacheStruct<ItemBaseInfo>();
            //var plotInfo = cacheSetPlotInfo.FindKey(PlotID);

            if (userPlot != null && userPlot.ItemList.Count > 0)
            {
                universalList.AddRange(userPlot.ItemList);
                //if (plotInfo != null && userPlot.PlotStatus == PlotStatus.Completed && plotInfo.ItemRank != "" && plotInfo.ItemRank != null)
                //{
                //    var itemArray = plotInfo.ItemRank.Split(',');
                //    foreach (var s in itemArray)
                //    {
                //        int itemId = s.Split('=')[0].ToInt();
                //        var item = cacheSetItem.FindKey(itemId);
                //        if (item != null)
                //        {
                //            universalList.Add(new UniversalInfo() { Name = item.ItemName, HeadID = item.HeadID, Num = s.Split('=')[1].ToInt() });
                //        }
                //    }

                //}
                //if (userPlot.ItemID > 0)
                //{
                //    itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(userPlot.ItemID);
                //    if (itemInfo != null)
                //    {
                //        universalList.Add(new UniversalInfo() { Name = itemInfo.ItemName, HeadID = itemInfo.HeadID, Num = 1 });
                //    }
                //}
                //if (userPlot.EnchantID > 0)
                //{
                //    enchant = new ShareCacheStruct<EnchantInfo>().FindKey(userPlot.EnchantID);

                //    if (enchant != null)
                //    {
                //        universalList.Add(new UniversalInfo() { Name = enchant.EnchantName, HeadID = enchant.HeadID, Num = 1 });
                //    }
                //}
                userPlot.ItemList.Clear();
            }
            universalArray = universalList.ToArray();


            return(true);
        }