public override bool TakeAction() { List <PlotNPCInfo> plotNPCInfoList = new ShareCacheStruct <PlotNPCInfo>().FindAll(m => m.PlotID == plotID); npcCount = (short)plotNPCInfoList.Count; var cacheSet = new PersonalCacheStruct <UserQueue>(); List <UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang); if (userQueueList.Count > 0) { UserQueue userQueue = userQueueList[0]; coldTime = userQueue.DoRefresh(); if (coldTime == 0) { cacheSet.Delete(userQueue); ContextUser.ResetSweepPool(0); ContextUser.UserStatus = UserStatus.Normal; //ContextUser.Update(); } int tempNum = PlotHelper.GetBattleNum(userQueue.GetTiming()) + 1; if (npcCount > 0) { turnsNum = PlotHelper.GetTurnsNum(npcCount, tempNum); timesNum = PlotHelper.GetTimesNum(npcCount, tempNum); } //PlotHelper.CheckSweepCount(npcCount, userQueue.GetTiming(), out turnsNum, out battleNum); //if (battleNum >= npcCount) //{ // turnsNum = turnsNum + 1; //} //else //{ // battleNum = battleNum + 1; //} } userItemCount = (short)UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao).Count; plotInfo = new ShareCacheStruct <PlotInfo>().FindKey(plotID); if (plotInfo == null) { return(false); } foreach (PlotNPCInfo npcInfo in plotNPCInfoList) { if (npcInfo == null) { continue; } List <PlotEmbattleInfo> embattleInfoList = new ShareCacheStruct <PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == npcInfo.PlotNpcID); foreach (PlotEmbattleInfo embattleInfo in embattleInfoList) { if (monsterDict.ContainsKey(embattleInfo.MonsterID)) { if (monsterNumDict.ContainsKey(embattleInfo.MonsterID)) { monsterNumDict[embattleInfo.MonsterID] = monsterNumDict[embattleInfo.MonsterID] + 1; } } else { MonsterInfo monsterInfo = new ShareCacheStruct <MonsterInfo>().FindKey(embattleInfo.MonsterID); if (monsterInfo != null) { monsterDict.Add(embattleInfo.MonsterID, monsterInfo); monsterNumDict.Add(embattleInfo.MonsterID, 1); } } } } return(true); }
public override bool TakeAction() { int exp = 0; short currMaxLv = ConfigEnvSet.GetInt("User.CurrMaxLv").ToShort(); //玩家最大等级 UserGeneral userGeneral = UserGeneral.GetMainGeneral(ContextUser.UserID); int genLv = 0; if (ContextUser.UserLv > currMaxLv) { genLv = currMaxLv.ToInt(); } else { genLv = ContextUser.UserLv; } GeneralPracticeInfo generalpractice = new ConfigCacheSet <GeneralPracticeInfo>().FindKey(genLv); var ranking = RankingFactory.Get <UserRank>(CombatNumRanking.RankingKey); UserRank rankInfo = ranking.Find(m => m.UserID == ContextUser.UserID); if (rankInfo != null && rankInfo.TotalCombatNum > 0) { fightingNum = rankInfo.TotalCombatNum; } else { //fightingNum = UserHelper.GetGameUserCombat(ContextUser.UserID); } int totalTime = 0; if (generalpractice == null) { return(false); } totalTime = (generalpractice.MaxHour * 60 * 60); List <UserQueue> userQueueArray = new GameDataCacheSet <UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.XiuLian); if (userQueueArray.Count > 0 && !userQueueArray[0].IsSuspend) { UserQueue queueInfo = userQueueArray[0]; TimeSpan ts = DateTime.Now - queueInfo.Timing; //practiceTime = (int)ts.TotalSeconds; int preExpTime = 0; practiceTime = queueInfo.DoRefresh(); if (practiceTime > 0) { if (userQueueArray[0].Timing <= DateTime.Now) { preExpTime = ((int)((DateTime.Now - userQueueArray[0].Timing).TotalSeconds) / generalpractice.IntervalTime); experience = generalpractice.Exprience * preExpTime; if (experience > 0) { exp = generalpractice.Exprience; } } } currExperience = MathUtils.Addition(userGeneral.CurrExperience, exp, int.MaxValue); queueInfo.StrengNum = MathUtils.Addition(queueInfo.StrengNum, exp, int.MaxValue); //queueInfo.Update(); userGeneral.CurrExperience = currExperience; //userGeneral.Update(); } return(true); }
public override bool TakeAction() { UserQueue userQueue = null; int energyNum; int coleTime = GetSweepColdTime(out energyNum); short surEnergy = MathUtils.Addition(ContextUser.EnergyNum, ContextUser.SurplusEnergy, short.MaxValue); if ((ContextUser.EnergyNum == 0 && ContextUser.SurplusEnergy == 0) || surEnergy < energyNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_EnergyNotEnough; return(false); } int goldNum = GetGoldNum(out userQueue); if (goldNum == 0) { return(false); } if (ops == 1) { //提示晶石操作 ErrorCode = ops; ErrorInfo = string.Format(LanguageManager.GetLang().St4008_Tip, goldNum); } else if (ops == 2) { //使用晶石确认操作 int userGoldNum = ContextUser.GoldNum; if (userGoldNum < goldNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } //晶石扫荡 if (userQueue != null) { DoAccelerateQueue(goldNum, userQueue.DoRefresh(), userQueue.GetTiming(), userQueue.TotalColdTime); //加速完清除队列 var queueCacheSet = new GameDataCacheSet <UserQueue>(); queueCacheSet.Delete(userQueue); ContextUser.ResetSweepPool(0); //ContextUser.Update(); } else { //清除扫荡池 var sweepCacheSet = new GameDataCacheSet <UserSweepPool>(); List <UserSweepPool> sweepPoolList = sweepCacheSet.FindAll(ContextUser.UserID); foreach (UserSweepPool sweepPool in sweepPoolList) { if (sweepPool != null) { sweepCacheSet.Delete(sweepPool); } } var itemList = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao); if (itemList.Count >= ContextUser.GridNum) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St4007_BeiBaoTimeOut; return(false); } DoAccelerateQueue(goldNum, coleTime, 0, coleTime); } DateTime startDate = userQueue != null ? userQueue.Timing : DateTime.Now; UserLogHelper.AppenRaidsLog(ContextUser.UserID, 2, startDate, DateTime.Now, (short)GetSweepEnergy(out energyNum), goldNum); } else { this.ErrorCode = LanguageManager.GetLang().ErrorCode; return(false); } return(true); }