public override bool TakeAction() { int equUseGold; int openGold = ConfigEnvSet.GetInt("Queue.OpenGold"); int openMaxNum = ConfigEnvSet.GetInt("Queue.OpenMaxNum"); if (ContextUser.QueueNum >= openMaxNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1703_QueueNumFull; return(false); } if (ContextUser.QueueNum > 1) { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.KaiQiQiangHuaDuiLie)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } equUseGold = (openGold * 2); } else { equUseGold = openGold; } if (_ops == 1) { ErrorCode = _ops; ErrorInfo = string.Format(LanguageManager.GetLang().St1703_UseGold, equUseGold); return(false); } if (_ops == 2) { if (ContextUser.GoldNum >= equUseGold) { ErrorCode = _ops; if (ContextUser.QueueNum < 3) { ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, equUseGold, int.MaxValue); ContextUser.QueueNum = MathUtils.Addition(ContextUser.QueueNum, (short)1, short.MaxValue); //ContextUser.Update(); } } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } } return(true); }
public override bool TakeAction() { int totalNum = 0; UserHelper.ChechDailyRestrain(ContextUser.UserID); UserDailyRestrain dailyRestrain = new PersonalCacheStruct <UserDailyRestrain>().FindKey(ContextUser.UserID); if (VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.ZhongZhiJingYingPlot)) { totalNum = MathUtils.Addition(totalNum, 1, int.MaxValue); } if (VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.SecondZhongZhiJingYingPlot)) { totalNum = MathUtils.Addition(totalNum, 1, int.MaxValue); } if (totalNum <= 0 || (dailyRestrain != null && dailyRestrain.Funtion10 >= totalNum)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St4012_JingYingPlotFull; return(false); } int useGold = ConfigEnvSet.GetInt("ResetElitePlot"); if (ops == 1) { ErrorCode = ops; ErrorInfo = string.Format(LanguageManager.GetLang().St4012_JingYingPlot, useGold); return(false); } else if (ops == 2) { if (ContextUser.GoldNum < useGold) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } if (dailyRestrain != null) { dailyRestrain.Funtion10 = MathUtils.Addition(dailyRestrain.Funtion10, 1, int.MaxValue); //dailyRestrain.Update(); } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue); //ContextUser.Update(); } return(true); }
public static int EquStrongQueue(string userID) { int equNum = 0; GameUser user = new PersonalCacheStruct <GameUser>().FindKey(userID); UserFunction userFunction = new PersonalCacheStruct <UserFunction>().FindKey(userID, FunctionEnum.Qianghuaqueue); if (user != null && userFunction != null && user.QueueNum <= 1) { equNum = MathUtils.Addition(equNum, 1, int.MaxValue); } if (user != null) { if (VipHelper.GetVipOpenFun(user.VipLv, ExpandType.KaiQiQiangHuaDuiLie) && user.QueueNum <= 2) { equNum = MathUtils.Addition(equNum, 1, int.MaxValue); } } return(equNum); }
public override bool TakeAction() { UserFunction userFunction = new PersonalCacheStruct <UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.Xiulian); if (userFunction != null) { UserHelper.XiuLianGianExperience(ContextUser.UserID); //修炼完成后更改修炼状态 int inerDate = (int)(DateTime.Now - ContextUser.OnlineDate).TotalSeconds; if (inerDate > 300 && ContextUser.UserStatus != UserStatus.XiuLian) { int totalTime = 0; GeneralPracticeInfo generalpractice = new ShareCacheStruct <GeneralPracticeInfo>().FindKey(ContextUser.UserLv); if (VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.XiuLianYanChangErShiSiXiaoShi)) { totalTime = ConfigEnvSet.GetInt("User.XiuLianDate"); } else { if (generalpractice != null) { totalTime = (generalpractice.MaxHour * 60 * 60); } } if (inerDate > 300 && ContextUser.UserStatus != UserStatus.XiuLian && ContextUser.UserStatus != UserStatus.FightCombat) { ContextUser.UserStatus = UserStatus.XiuLian; //ContextUser.Update(); List <UserQueue> userQueueArray = new PersonalCacheStruct <UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.XiuLian); if (userQueueArray.Count > 0) { UserQueue userQueue = userQueueArray[0]; userQueue.TotalColdTime = totalTime; userQueue.ColdTime = totalTime; userQueue.Timing = DateTime.Now; userQueue.IsSuspend = false; userQueue.StrengNum = 0; //userQueue.Update(); } _statusList.Add(MessageState.XiuLian); } } } UserDailyRestrain dailyRestrain = new PersonalCacheStruct <UserDailyRestrain>().FindKey(ContextUser.UserID); if (new TjxChatService(ContextUser).HasMessage(ContextUser.ChatVesion)) { _statusList.Add(MessageState.Chat); } if (NoviceHelper.CheckOnlinePrize(Uid)) { _statusList.Add(MessageState.TakeOnline); } if (NoviceHelper.CheckLoginPrize(Uid)) { _statusList.Add(MessageState.TakeLogin); } if (new TjxBroadcastService(ContextUser).HasMessage()) { _statusList.Add(MessageState.Broadcast); } if (NoviceHelper.CheckDailyExpPrize(Uid)) { _statusList.Add(MessageState.TakeDailyExp); } if (RankingHelper.IsGainSportsReward(ContextUser.UserID)) { _statusList.Add(MessageState.JingJiChangReward); } UserFunction countryFunction = new PersonalCacheStruct <UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.Country); if (countryFunction != null && dailyRestrain != null && dailyRestrain.Funtion8 < VipHelper.GetVipUseNum(ContextUser.VipLv, RestrainType.LingQuFengLu)) { _statusList.Add(MessageState.LingQuFengLv); } if (NoviceHelper.DailyEnergy(ContextUser.UserID)) { _statusList.Add(MessageState.SurplusEnergy); } if (new GameActiveCenter(Uid).HasActive()) { _statusList.Add(MessageState.Huodong); } if (NoviceHelper.IsAugustSecondWeekEnergy(ContextUser)) { _statusList.Add(MessageState.FestivalEnergy); } if (NoviceHelper.IsWingFestivalInfo(ContextUser.UserID)) { _statusList.Add(MessageState.Wing); } if (GuildFightBroadcast(ContextUser.UserID, stakecount, ContextUser.MercenariesID)) { _statusList.Add(MessageState.GuildFight); } else { stakecount = 0; } var userPrizeList = new ShareCacheStruct <UserTakePrize>().FindAll(m => !m.IsTasked && m.UserID == Uid.ToInt()); if (userPrizeList.Count > 0) { _statusList.Add(MessageState.TaskPrize); } return(true); }
public override bool TakeAction() { int energyNum = ConfigEnvSet.GetInt("User.EnergyNum"); UserHelper.ChechDailyRestrain(ContextUser.UserID); var cacheSet = new PersonalCacheStruct <UserDailyRestrain>(); double addNum = FestivalHelper.SurplusPurchased(ContextUser.UserID, FestivalType.PurchasedEnergy);//活动加成 int payNum = FestivalHelper.SurplusEnergyNum(ContextUser.UserID); UserDailyRestrain userRestrain = cacheSet.FindKey(ContextUser.UserID); if (payNum == 0) { if (userRestrain != null && DateTime.Now.Date != userRestrain.RefreshDate.Date) { userRestrain.Funtion4 = 0; } if (userRestrain != null && userRestrain.Funtion4 >= VipHelper.GetVipUseNum(ContextUser.VipLv, RestrainType.GouMaiJingLi) && DateTime.Now.Date == userRestrain.RefreshDate.Date) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St1010_JingliFull; return(false); } } int useGold = (GetPayEnergyGold(ContextUser.UserID, ContextUser.VipLv, payType) * addNum).ToInt(); if (payType == 1) { if (ops == 1) { this.ErrorCode = 1; this.ErrorInfo = string.Format(LanguageManager.GetLang().St1010_PayEnergyUseGold, useGold, energyNum); return(false); } else if (ops == 2) { if (ContextUser.GoldNum < useGold) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue); ContextUser.EnergyNum = MathUtils.Addition(ContextUser.EnergyNum, GetEnergyNum(ContextUser.UserID, ContextUser.VipLv, payType), short.MaxValue); if (payNum == 0) { if (userRestrain != null) { userRestrain.Funtion4 = MathUtils.Addition(userRestrain.Funtion4, 1, int.MaxValue); } else { userRestrain = new UserDailyRestrain(); userRestrain.UserID = ContextUser.UserID; userRestrain.RefreshDate = DateTime.Now; userRestrain.Funtion4 = 1; cacheSet.Add(userRestrain); } } UserLogHelper.AppenUseGoldLog(ContextUser.UserID, 1, 0, userRestrain.Funtion4, useGold, ContextUser.GoldNum, MathUtils.Addition(ContextUser.GoldNum, useGold, int.MaxValue)); FestivalHelper.PurchasedEnergy(ContextUser.UserID); } } else if (payType == 2) { short payEnergy = GetEnergyNum(ContextUser.UserID, ContextUser.VipLv, payType); if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.ZiDongGouMaiJingLi)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } if (ops == 1) { this.ErrorCode = 1; this.ErrorInfo = string.Format(LanguageManager.GetLang().St1010_PayEnergyUseGold, useGold, payEnergy); return(false); } else if (ops == 2) { if (ContextUser.GoldNum < useGold) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue); ContextUser.EnergyNum = MathUtils.Addition(ContextUser.EnergyNum, payEnergy, short.MaxValue); if (userRestrain != null) { userRestrain.Funtion4 = MathUtils.Addition(userRestrain.Funtion4, 1, int.MaxValue); } else { userRestrain = new UserDailyRestrain(); userRestrain.UserID = ContextUser.UserID; userRestrain.RefreshDate = DateTime.Now; userRestrain.Funtion4 = 1; cacheSet.Add(userRestrain); } UserLogHelper.AppenUseGoldLog(ContextUser.UserID, 1, userRestrain.Funtion4, 1, useGold, ContextUser.GoldNum, MathUtils.Addition(ContextUser.GoldNum, useGold, int.MaxValue)); } } return(true); }
public override bool TakeAction() { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.BossChongSheng)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } if (CombatHelper.IsBossKill(_activeId)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return(false); } BossCombat bossCombat = new BossCombat(_activeId); GameActive gameActive = bossCombat.GameActive; CombatStatus combatStatus = gameActive.CombatStatus; if (combatStatus != CombatStatus.Wait && combatStatus != CombatStatus.Combat) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart; return(false); } this.ErrorCode = Ops; BossUser bossUser = bossCombat.GetCombatUser(Uid); if (bossUser != null && !bossUser.IsRelive) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5403_IsLive; return(false); } if (bossUser != null && bossUser.ReliveNum >= MaxNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5403_IsReLiveMaxNum; return(false); } int goldNum = GoldNum * (bossUser.ReliveNum + 1); if (Ops == 1) { ErrorInfo = string.Format(LanguageManager.GetLang().St5403_CombatGoldTip, goldNum); } else if (Ops == 2) { if (ContextUser.GoldNum < goldNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } if (bossUser != null && bossUser.IsRelive) { ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, goldNum, int.MaxValue); //ContextUser.Update(); bossUser.IsRelive = false; bossUser.ReliveBeginDate = DateTime.MinValue; bossUser.ReliveInspirePercent = MathUtils.Addition(bossUser.ReliveInspirePercent, CountryCombat.InspireIncrease, 1); _reliveInspirePercent = bossUser.ReliveInspirePercent; bossUser.ReliveNum++; } } return(true); }
public override void BuildPacket() { PushIntoStack(idolInfo == null ? LanguageManager.GetLang().shortInt : idolInfo.IdolLv); PushIntoStack(idolInfo == null ? 0 : idolInfo.CurrExperience); PushIntoStack(maxAura); PushIntoStack(guildLogArray.Count); foreach (MemberLog log in guildLogArray) { GameUser gameUser = new GameDataCacheSet <GameUser>().FindKey(log.UserID); if (gameUser == null) { gameUser = UserCacheGlobal.CheckLoadUser(log.UserID); } DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(log.UserID); dsItem.PushIntoStack(gameUser == null ? string.Empty : gameUser.NickName.ToNotNullString()); dsItem.PushIntoStack(log.LogType); dsItem.PushIntoStack(log.GainAura); dsItem.PushIntoStack(GetGainDate(log.InsertDate)); dsItem.PushIntoStack(log.IdolID); PushIntoStack(dsItem); } PushIntoStack(idolInfoArray.Count); foreach (GuildIdolInfo guildIdol in idolInfoArray) { if (isXs == 2) { isShow = 2; } else { if (guildIdol.IdolID == 1) { isShow = 1; } if (guildIdol.IdolID == 2 && VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.GuildMemberShangSuHeXiang)) { isShow = 1; } else if (guildIdol.IdolID == 2) { isShow = 2; } if (guildIdol.IdolID == 3 && VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.GuildMemberShangTianMuXiang)) { isShow = 1; } else if (guildIdol.IdolID == 3) { isShow = 2; } } DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack((short)guildIdol.IdolID); dsItem.PushIntoStack(guildIdol.GainObtion); dsItem.PushIntoStack(guildIdol.GainBlessing); dsItem.PushIntoStack(guildIdol.GainAura); dsItem.PushIntoStack(guildIdol.UseExpNum); dsItem.PushIntoStack(guildIdol.UseGold); dsItem.PushIntoStack(isShow); PushIntoStack(dsItem); } }
public override bool TakeAction() { UserHelper.ChechDailyRestrain(ContextUser.UserID); int wjkNum = 0; int subNum = 0; int maxNum = VipHelper.GetVipUseNum(ContextUser.VipLv, RestrainType.WaJinKuang); UserDailyRestrain userRestrain = new GameDataCacheSet <UserDailyRestrain>().FindKey(ContextUser.UserID); if (userRestrain != null && DateTime.Now.Date == userRestrain.RefreshDate.Date) { wjkNum = userRestrain.Funtion3; subNum = MathUtils.Subtraction(maxNum, wjkNum); } else { wjkNum = 0; subNum = maxNum; } if ((userRestrain != null && userRestrain.Funtion3 >= VipHelper.GetVipUseNum(ContextUser.VipLv, RestrainType.WaJinKuang) && DateTime.Now.Date == userRestrain.RefreshDate.Date)) { ErrorCode = 2; ErrorInfo = LanguageManager.GetLang().St1011_WaJinKuangFull; return(false); } int useGold = GetPayCoinGold(ContextUser.UserID, ContextUser.VipLv, payType); int payCoinNum = GetPayCoinNum(ContextUser.UserID, ContextUser.VipLv, payType, ContextUser.UserLv); if (payType == 1) { if (ops == 1) { this.ErrorCode = 1; this.ErrorInfo = string.Format(LanguageManager.GetLang().St1011_PayUseGold, useGold, payCoinNum, subNum); return(false); } else if (ops == 2) { if (ContextUser.GoldNum < useGold) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } if (ContextUser.GoldNum >= useGold) { int goldNum = ContextUser.GoldNum; ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold); ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, payCoinNum); //ContextUser.Update(); if (userRestrain != null) { userRestrain.Funtion3 = MathUtils.Addition(wjkNum, 1); //userRestrain.Update(); UserLogHelper.AppenUseGoldLog(ContextUser.UserID, 2, 0, userRestrain.Funtion3, useGold, ContextUser.GoldNum, goldNum); } } this.ErrorCode = 0; this.ErrorInfo = string.Format(LanguageManager.GetLang().St1011_PayCoinUseGold, useGold, payCoinNum, subNum - 1); return(false); } } else if (payType == 2) { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.ZiDongJinRuJinKuangDong)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } if (ops == 1) { this.ErrorCode = 0; this.ErrorInfo = string.Format(LanguageManager.GetLang().St1011_PayCoinUseGold, useGold, payCoinNum, subNum); return(false); } else if (ops == 2) { if (ContextUser.VipLv < 6) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnough; return(false); } if (ContextUser.GoldNum < useGold) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } if (userRestrain != null) { userRestrain.Funtion3 = MathUtils.Addition(wjkNum, 1); //userRestrain.Update(); } int gamecoin = GetPayCoinNum(ContextUser.UserID, ContextUser.VipLv, payType, ContextUser.UserLv); ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold); ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, gamecoin); //ContextUser.Update(); } } return(true); }
public override bool TakeAction() { short opType = 0; UserItemInfo synthesisUserItem = null; var package = UserItemPackage.Get(Uid); UserItemInfo userItem = null; if (!string.IsNullOrEmpty(_userItemID)) { var userItemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.UserItemID.Equals(_userItemID)); foreach (var item in userItemList) { if (item.ItemStatus == ItemStatus.Sell) { package.RemoveItem(userItem); continue; } else if (item.SoldDate > MathUtils.SqlMinDate) { item.SoldDate = MathUtils.SqlMinDate; //package.Update(); userItem = item; } else { userItem = item; } } if (userItem == null) { return(false); } ItemBaseInfo itemBaseOpType = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID); if (itemBaseOpType == null) { return(false); } if (itemBaseOpType.ItemType == ItemType.TuZhi) { opType = 1; } else { opType = 2; } } else if (!string.IsNullOrEmpty(_userEquID)) { opType = 1; userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(_userEquID)); } if (userItem == null) { return(false); } int genlv = ContextUser.UserLv; CacheList <SynthesisInfo> synthesisInfoList = new CacheList <SynthesisInfo>(); short itemLv = 0; List <ItemSynthesisInfo> itemSynthesisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(m => m.SynthesisID == userItem.ItemID); //图纸ID if (itemSynthesisArray.Count > 0) { ItemSynthesisInfo synthesisInfo = itemSynthesisArray[0]; if (synthesisInfo == null) { return(false); } ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesisInfo.ItemID); if (itemInfo != null && itemInfo.ItemType == ItemType.ZhuangBei && itemInfo.DemandLv > genlv) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } List <ItemSynthesisInfo> synthesisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(m => m.ItemID == synthesisInfo.ItemID);//合成物品的材料数组 if (synthesisArray.Count == 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().LoadDataError; return(false); } int useGold = GetSytnthesisGold(ContextUser.UserID, synthesisInfo.ItemID); if (_ops == 1) { #region 普通合成 if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv < 4) { ErrorCode = 3; ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough; return(false); } if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv >= 4) { ErrorCode = 2; ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough + "," + string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold); return(false); } foreach (ItemSynthesisInfo synthesis in synthesisArray) { ItemBaseInfo itemsInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesis.SynthesisID); if (itemInfo == null) { return(false); } if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID && itemsInfo != null && itemInfo.ItemType == ItemType.ZhuangBei) { if (userItem.ItemStatus == ItemStatus.YongBing) { //if (UserHelper.IsItemEquSpare(ContextUser, userItem.UserItemID)) //{ // ErrorCode = LanguageManager.GetLang().ErrorCode; // ErrorInfo = LanguageManager.GetLang().St_ItemEquIndexOfSpare; // return false; //} if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID); synthesisInfoList.Add(new SynthesisInfo() { DemandID = userItem.ItemID, Num = 1 }); //package.SyncCache(() => //{ // userItem.IsRemove = true; // package.ItemPackage.Remove(userItem); // package.DelayChange(); //}); } } else { if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei) { synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } //synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); } else { synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum }); UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum); } } } if (!string.IsNullOrEmpty(_userEquID)) { itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, userItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { if (synthesisUserItem != null) { itemLv = MathUtils.Subtraction(synthesisUserItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, synthesisUserItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { UserItemHelper.AddUserItem(ContextUser.UserID, synthesisInfo.ItemID, synthesisArray[0].SynthesisNum); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } } #endregion } else if (_ops == 2) { #region 晶石合成 if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.JuanZouZhiJieWanCheng)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } ErrorCode = 1; ErrorInfo = string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold); return(false); #endregion } else if (_ops == 3) { #region 确认晶石合成 if (ContextUser.GoldNum < useGold) { ErrorCode = 1; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } //原因:配置材料不使用晶石合成时提示 string userItemName = UseritemGoldName(ContextUser.UserID, synthesisArray); if (!string.IsNullOrEmpty(userItemName)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = string.Format(LanguageManager.GetLang().St_ItemIsGold, userItemName); return(false); } foreach (ItemSynthesisInfo synthesis in synthesisArray) { int curNum = 0; ItemBaseInfo itemsInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesis.SynthesisID); if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID) { if (userItem.ItemStatus == ItemStatus.YongBing) { if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID); synthesisInfoList.Add(new SynthesisInfo() { DemandID = userItem.ItemID, Num = 1 }); } } else { if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei) { synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } } else { var itemArray = UserItemHelper.GetItems(Uid).FindAll(u => u.ItemID.Equals(synthesis.SynthesisID) && (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu)); if (itemArray.Count > 0) { foreach (var item in itemArray) { curNum += item.Num; } if (synthesis.DemandNum < curNum) { UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum); synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum }); } else { UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, curNum); synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = curNum }); } } } } } if (!string.IsNullOrEmpty(_userEquID)) { itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, userItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { if (synthesisUserItem != null) { itemLv = MathUtils.Subtraction(synthesisUserItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, synthesisUserItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { UserItemHelper.AddUserItem(ContextUser.UserID, synthesisInfo.ItemID, synthesisArray[0].SynthesisNum); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue); // ContextUser.Update(); #endregion } } return(true); }
public override bool TakeAction() { TaskStar taskOpsStar = TaskStar.Star1; userLv = ContextUser.UserLv; this.ErrorCode = ops; if (ops == 1) { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.RefreashDailyTask)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } List <UserTask> taskArray = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, u => u.TaskState == TaskState.AllowTake && u.TaskType == TaskType.Daily); if (taskArray.Count > 0) { if (taskArray[0].TaskStar == TaskStar.Star5) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St3005_RefreashStarFull; return(false); } } ErrorInfo = string.Format(LanguageManager.GetLang().St3005_RefreashUseGold, useProGold); return(false); } else if (ops == 2) { if (ContextUser.GoldNum < useProGold) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } List <UserTask> taskArray = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, u => u.TaskState != TaskState.Disable && u.TaskType == TaskType.Daily); if (taskArray.Count > 0) { taskOpsStar = TaskHelper.GetTaskStar(taskArray[0].TaskStar, taskArray[0].TakeDate); } foreach (UserTask taskInfo in taskArray) { taskInfo.TaskStar = taskOpsStar; //taskInfo.Update(); } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useProGold, int.MaxValue); //ContextUser.Update(); if (taskArray.Count > 0) { userTaskList = taskArray; //UserTask userTask = taskArray[0]; //刷新任务 //userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask); } } else if (ops == 3) { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.ShuanChuMaxXingJiRenWu)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } this.ErrorInfo = string.Format(LanguageManager.GetLang().St3005_RefreashUseGold, useFullGold); return(false); } else if (ops == 4) { if (ContextUser.GoldNum < useFullGold) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } taskOpsStar = TaskStar.Star5; List <UserTask> taskArray = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, u => u.TaskState == TaskState.AllowTake && u.TaskType == TaskType.Daily); foreach (UserTask taskInfo in taskArray) { taskInfo.TaskStar = taskOpsStar; //taskInfo.Update(); } if (taskArray.Count > 0) { UserTask userTask = taskArray[0]; //刷新任务 userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask); } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useFullGold, int.MaxValue); //ContextUser.Update(); } else if (ops == 5) { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.DailyRenWuZhiJieWanCheng)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } this.ErrorInfo = string.Format(LanguageManager.GetLang().St3005_CompletedUseGold, completedUseGold); return(false); } else if (ops == 6) { if (ContextUser.GoldNum < completedUseGold) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } List <UserTask> taskArray = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, u => u.TaskState == TaskState.Taked && u.TaskType == TaskType.Daily); if (taskArray.Count > 0) { UserTask userTask = taskArray[0]; DailyTaskInfo dtaskInfo = new ConfigCacheSet <DailyTaskInfo>().FindKey(taskArray[0].TaskID); //交付任务 //奖励 int userExp = ContextUser.ExpNum; int expNum = userTask.GetDailyExpNum(userLv); ContextUser.ExpNum = MathUtils.Addition(ContextUser.ExpNum, expNum, int.MaxValue); //ContextUser.Update(); var userItem = userTask.GetDailyItem(userLv); if (userItem != null) { UserItemHelper.AddUserItem(ContextUser.UserID, userItem.ItemID, userItem.Num); } userTask.TaskState = TaskState.Close; userTask.CompleteNum = MathUtils.Addition(userTask.CompleteNum, 1, int.MaxValue); //userTask.Update(); //奖励日志 UserTaskLog taskLog = new UserTaskLog() { LogID = System.Guid.NewGuid().ToString(), TaskID = userTask.TaskID, UserID = userTask.UserID, TaskType = userTask.TaskType, TaskState = userTask.TaskState, TaskPrize = string.Format("ExpNum:{0},item:{1}={2};User expnum:{3}", expNum, userItem != null ? userItem.ItemID : 0, userItem != null ? userItem.Num : 0, userExp ), CreateDate = DateTime.Now }; var sender = DataSyncManager.GetDataSender(); sender.Send(taskLog); //刷新任务 userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask); ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, completedUseGold, int.MaxValue); //ContextUser.Update(); } } else if (ops == 0) { if (TaskID > 0) { UserTask userTask = new GameDataCacheSet <UserTask>().FindKey(ContextUser.UserID, TaskID); if (userTask == null || userTask.TaskState != TaskState.Completed) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St3007_NoCompleted; return(false); } if (TaskHelper.GetTaskCompleteNum(ContextUser.UserID) >= TaskHelper.DailyEveryMaxNum) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St3005_CompletedTimeout; return(false); } DailyTaskInfo dtaskInfo = new ConfigCacheSet <DailyTaskInfo>().FindKey(userTask.TaskID); //交付任务 //奖励 int userExp = ContextUser.ExpNum; int expNum = userTask.GetDailyExpNum(userLv); ContextUser.ExpNum = MathUtils.Addition(ContextUser.ExpNum, expNum, int.MaxValue); //ContextUser.Update(); var userItem = userTask.GetDailyItem(userLv); if (userItem != null) { UserItemHelper.AddUserItem(ContextUser.UserID, userItem.ItemID, userItem.Num); } userTask.TaskState = TaskState.Close; userTask.CompleteNum = MathUtils.Addition(userTask.CompleteNum, 1, int.MaxValue); //userTask.Update(); //奖励日志 UserTaskLog taskLog = new UserTaskLog() { LogID = System.Guid.NewGuid().ToString(), TaskID = userTask.TaskID, UserID = userTask.UserID, TaskType = userTask.TaskType, TaskState = userTask.TaskState, TaskPrize = string.Format("ExpNum:{0},item:{1}={2};User expnum:{3}", expNum, userItem != null ? userItem.ItemID : 0, userItem != null ? userItem.Num : 0, userExp ), CreateDate = DateTime.Now }; var sender = DataSyncManager.GetDataSender(); sender.Send(taskLog); //刷新任务 userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask); } else { //刷新当天任务 if (!TaskHelper.CheckDailyTaskTimeout(ContextUser.UserID, out userTaskList)) { userTaskList = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, m => m.TaskType.Equals(TaskType.Daily) && !m.TaskState.Equals(TaskState.NoTake) && !m.TaskState.Equals(TaskState.Disable) ); } if (userTaskList.Count == 0) { //初始化时刷新任务 userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, null); } //刷新状态 foreach (UserTask userTask in userTaskList) { bool isModify = false; if (userTask.TaskState == TaskState.Taked && userTask.TaskTargetNum.ToInt() >= (int)userTask.TaskStar) { isModify = true; userTask.TaskState = TaskState.Completed; } if (isModify) { //userTask.Update(); } } } } //计算当天完成次数 currNum = TaskHelper.GetTaskCompleteNum(ContextUser.UserID); return(true); }
public override bool TakeAction() { UserHelper.ChechDailyRestrain(ContextUser.UserID); UserDailyRestrain dailyRestrain = new GameDataCacheSet <UserDailyRestrain>().FindKey(ContextUser.UserID); if (refreshType == 1) { if (dailyRestrain != null) { if (!IsRefreshKalpa(dailyRestrain, RestrainType.RefreshKalpa, 0)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St4302_PlotRefresh; return(false); } } } else if (refreshType == 2) { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.SecondRefreshKalpa)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnough; return(false); } int vipRefeshGold = ConfigEnvSet.GetInt("UserPlot.SecondRefreshKalpa"); if (ops == 1) { ErrorCode = 1; ErrorInfo = string.Format(LanguageManager.GetLang().St4302_SecondRefreshKalpa, vipRefeshGold); return(false); } else if (ops == 2) { if (vipRefeshGold > ContextUser.GoldNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } } if (dailyRestrain != null) { if (!IsRefreshKalpa(dailyRestrain, RestrainType.RefreshKalpa, vipRefeshGold)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St4302_PlotRefresh; return(false); } } } else if (refreshType == 3) { int lastRefeshGold = ConfigEnvSet.GetInt("UserPlot.LastRefreshKalpa"); if (ops == 1) { ErrorCode = 1; ErrorInfo = string.Format(LanguageManager.GetLang().St4302_LastRefreshKalpa, lastRefeshGold); return(false); } else if (ops == 2) { if (ContextUser.UserExtend != null && ContextUser.UserExtend.LayerNum == 1) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St4302_LastRefreshKalpaNotEnough; return(false); } if (lastRefeshGold > ContextUser.GoldNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } } if (dailyRestrain != null) { if (!IsRefreshKalpa(dailyRestrain, RestrainType.RefreshLastKalpa, lastRefeshGold)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St4302_PlotRefresh; return(false); } } } return(true); }
public override bool TakeAction() { short currMaxLv = ConfigEnvSet.GetInt("User.CurrMaxLv").ToShort(); //玩家最大等级 if (ContextUser.UserStatus == UserStatus.SaoDang) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St4007_Saodanging; return(false); } if (ops == 0 && ContextUser.UserStatus == UserStatus.XiuLian) { return(false); } int totalTime = 0; int genlv = 0; if (ContextUser.UserLv > currMaxLv) { genlv = currMaxLv.ToInt(); } else { genlv = ContextUser.UserLv; } GeneralPracticeInfo generalpractice = new ConfigCacheSet <GeneralPracticeInfo>().FindKey(genlv); if (generalpractice == null || generalpractice.IntervalTime == 0) { return(false); } if (VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.XiuLianYanChangErShiSiXiaoShi)) { totalTime = ConfigEnvSet.GetInt("User.XiuLianDate"); } else { totalTime = (generalpractice.MaxHour * 60 * 60); } List <UserQueue> userQueueArray = new GameDataCacheSet <UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.XiuLian); if (ops == 0) { this.ErrorCode = 0; UserQueue userQueue = null; if (userQueueArray.Count > 0) { userQueue = userQueueArray[0]; } if (ContextUser.UserStatus != UserStatus.XiuLian) { ContextUser.UserStatus = UserStatus.XiuLian; //ContextUser.Update(); if (userQueue == null) { userQueue = new UserQueue() { UserID = ContextUser.UserID, QueueID = Guid.NewGuid().ToString(), QueueType = QueueType.XiuLian, QueueName = QueueType.XiuLian.ToString(), TotalColdTime = totalTime, Timing = DateTime.Now, ColdTime = totalTime, IsSuspend = false, StrengNum = 0 }; new GameDataCacheSet <UserQueue>().Add(userQueue, GameEnvironment.CacheUserPeriod); } else { userQueue.TotalColdTime = totalTime; userQueue.ColdTime = totalTime; userQueue.Timing = DateTime.Now; userQueue.StrengNum = 0; userQueue.DoStart(); } } } else if (ops == 1) { ErrorCode = 1; if (ContextUser.UserStatus != UserStatus.Normal && ContextUser.UserStatus != UserStatus.FightCombat) { ContextUser.UserStatus = UserStatus.Normal; //ContextUser.Update(); if (userQueueArray.Count > 0) { UserQueue userQueue = userQueueArray[0]; userQueue.IsSuspend = true; //userQueue.Update(); } List <UserMagic> userMagicArray = new GameDataCacheSet <UserMagic>().FindAll(ContextUser.UserID, u => u.IsEnabled && u.MagicType == MagicType.MoFaZhen); if (userMagicArray.Count > 0) { List <UserEmbattle> userEmbattleArray = new GameDataCacheSet <UserEmbattle>().FindAll(ContextUser.UserID, m => m.MagicID == userMagicArray[0].MagicID); int practiceTime = 0; //修炼时间 if (userQueueArray.Count > 0) { UserQueue queueInfo = userQueueArray[0]; TimeSpan ts = DateTime.Now - queueInfo.Timing; practiceTime = (int)ts.TotalSeconds; if (practiceTime <= totalTime && queueInfo.Timing <= DateTime.Now) { experience = ((practiceTime / generalpractice.IntervalTime) * generalpractice.Exprience); } foreach (UserEmbattle embattle in userEmbattleArray) { UserGeneral general = new GameDataCacheSet <UserGeneral>().FindKey(ContextUser.UserID, embattle.GeneralID); if (general != null) { general.Experience1 = MathUtils.Addition(general.Experience1, experience, int.MaxValue); if (general.GeneralLv >= UserHelper._currMaxLv) { continue; } if (general.GeneralID == LanguageManager.GetLang().GameUserGeneralID) { general.CurrExperience = MathUtils.Addition(general.CurrExperience, MathUtils.Subtraction(experience, queueInfo.StrengNum, 0), int.MaxValue); } else { general.CurrExperience = MathUtils.Addition(general.CurrExperience, experience, int.MaxValue); } //general.Update(); } } } } } } return(true); }
public override bool TakeAction() { if (string.IsNullOrEmpty(ContextUser.MercenariesID)) { return(false); } if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.GuildMemberShangSuHeXiang) && idolID == 2) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.GuildMemberShangTianMuXiang) && idolID == 3) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } GuildMember member = new ShareCacheStruct <GuildMember>().FindKey(ContextUser.MercenariesID, ContextUser.UserID); if (member != null) { GuildIdolInfo idolInfo = new ShareCacheStruct <GuildIdolInfo>().FindKey(idolID); var memberLog = new ShareCacheStruct <GuildMemberLog>().FindKey(ContextUser.MercenariesID) ?? new GuildMemberLog(); List <MemberLog> guildLogArray = memberLog.GetLog(u => u.UserID == ContextUser.UserID && DateTime.Now.Date == u.InsertDate.Date); UserDailyRestrain userRestrain = new PersonalCacheStruct <UserDailyRestrain>().FindKey(ContextUser.UserID); if (guildLogArray.Count > 0 && userRestrain.Funtion6 >= VipHelper.GetVipUseNum(ContextUser.VipLv, RestrainType.BangPaiShangXiang) && DateTime.Now.Date == userRestrain.RefreshDate.Date) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6012_HasIncenseToday; return(false); } if (idolInfo.UseExpNum != 0 && ContextUser.ExpNum <= idolInfo.UseExpNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_ExpNumNotEnough; return(false); } else if (idolInfo.UseGold != 0 && ContextUser.GoldNum < idolInfo.UseGold) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } //UserGuild userGuild = new ShareCacheStruct<UserGuild>().FindKey(guildID); userRestrain.Funtion6 = MathUtils.Addition(userRestrain.Funtion6, 1, int.MaxValue); //userRestrain.Update(); UpIdolLv(ContextUser.MercenariesID, idolInfo.GainAura); ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, idolInfo.UseGold, int.MaxValue); ContextUser.ExpNum = MathUtils.Subtraction(ContextUser.ExpNum, idolInfo.UseExpNum, 0); ContextUser.ObtainNum = MathUtils.Addition(ContextUser.ObtainNum, idolInfo.GainObtion, int.MaxValue); //ContextUser.Update(); UserHelper.UserGuildUpLv(ContextUser.MercenariesID, idolInfo.GainObtion); if (DateTime.Now.Date == member.IncenseDate.Date) { member.GainBlessing = idolInfo.GainBlessing; member.IncenseNum = MathUtils.Addition(member.IncenseNum, 1, int.MaxValue); member.Contribution = MathUtils.Addition(member.Contribution, idolInfo.GainObtion, int.MaxValue); } else { member.IncenseNum = 1; member.GainBlessing = idolInfo.GainBlessing; member.Contribution = idolInfo.GainObtion; } member.TotalContribution = MathUtils.Addition(member.TotalContribution, idolInfo.GainObtion, int.MaxValue); member.IncenseDate = DateTime.Now; //member.Update(); GuildMemberLog.AddLog(member.GuildID, new MemberLog() { UserID = ContextUser.UserID, IdolID = idolID, LogType = 2, GainObtion = idolInfo.GainObtion, Experience = idolInfo.GainObtion, GainAura = idolInfo.GainAura, InsertDate = DateTime.Now, }); } return(true); }
public override bool TakeAction() { //List<UserQueue> queueList = new PersonalCacheStruct<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.MagicStrong); //if (queueList.Count > 0) //{ // if (queueList[0].StrengNum >= 2 && queueList[0].DoRefresh() > 0) // { // ErrorCode = LanguageManager.GetLang().ErrorCode; // ErrorInfo = LanguageManager.GetLang().St1503_MagicColding; // return false; // } //} magicInfo = new ShareCacheStruct <MagicInfo>().FindKey(magicID); if (magicInfo == null) { return(false); } int maxMagicLv = ConfigEnvSet.GetInt("Queue.MaxLength"); UserMagic userMagic = new PersonalCacheStruct <UserMagic>().FindKey(ContextUser.UserID, magicID); if (userMagic == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1503_MagicIDNotEnough; return(false); } sumMagicLv = MathUtils.Addition(userMagic.MagicLv, (short)1, (short)100); MagicLvInfo magicLvInfo = new ShareCacheStruct <MagicLvInfo>().FindKey(magicID, sumMagicLv); if (magicLvInfo == null || userMagic.MagicLv == maxMagicLv) { guideID = 1; //等级已达到最高 ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1503_MaxMagicLv; return(false); } if (ContextUser.UserLv < magicLvInfo.EscalateMinLv) { //超出用户等级 ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1503_MagicLevel; return(false); } experience = magicLvInfo.ExpNum; //codeTime = magicLvInfo.ColdTime; if (experience > ContextUser.ExpNum) { guideID = 3; //阅历不足 ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = string.Format(LanguageManager.GetLang().St1503_UpgradeExpNum); return(false); } int useGold = 0; if (ops == 1) { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.EquXiaoChuLengQueShiJian)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } useGold = (codeTime / 60); if (ContextUser.GoldNum < useGold) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue); } else { //放入队列中 // List<UserQueue> queueList = new PersonalCacheStruct<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType ==QueueType.MagicStrong); //todo //if (queueList.Count > 0) //{ // UserQueue queue = queueList[0]; // if (queue.DoRefresh() > 0 && queue.StrengNum < 2) // { // queue.TotalColdTime = MathUtils.Addition(queue.TotalColdTime, codeTime, int.MaxValue); // queue.ColdTime = MathUtils.Addition(queue.ColdTime, codeTime, int.MaxValue); // queue.IsSuspend = false; // queue.StrengNum = MathUtils.Addition(queue.StrengNum, 1, int.MaxValue); // //queue.Update(); // } // else // { // queue.TotalColdTime = codeTime; // queue.Timing = DateTime.Now; // queue.ColdTime = codeTime; // queue.IsSuspend = false; // queue.StrengNum = 1; // //queue.Update(); // } //} //else //{ // UserQueue userQueue = new UserQueue() // { // QueueID = Guid.NewGuid().ToString(), // UserID = ContextUser.UserID, // QueueType = QueueType.MagicStrong, // QueueName = QueueType.MagicStrong.ToString(), // TotalColdTime = codeTime, // Timing = DateTime.Now, // ColdTime = codeTime, // StrengNum = 1, // IsSuspend = false // }; // new PersonalCacheStruct<UserQueue>().Add(userQueue); //} } if (userMagic != null) { if (userMagic.MagicType == MagicType.MoFaZhen) { MagicLvInfo mLvInfo = new ShareCacheStruct <MagicLvInfo>().FindKey(userMagic.MagicID, userMagic.MagicLv); string[] mGridRange = mLvInfo.GridRange.Split(','); foreach (string gridRange in mGridRange) { UserEmbattle userEmbattle = new PersonalCacheStruct <UserEmbattle>().FindKey(ContextUser.UserID, userMagic.MagicID, gridRange.ToShort()); if (userEmbattle == null) { UserEmbattle embattle = new UserEmbattle() { UserID = ContextUser.UserID, MagicID = userMagic.MagicID, Position = gridRange.ToShort(), GeneralID = 0 }; new PersonalCacheStruct <UserEmbattle>().Add(embattle); } } } if (experience < ContextUser.ExpNum) { ContextUser.ExpNum = MathUtils.Subtraction(ContextUser.ExpNum, experience, 0); userMagic.MagicLv = MathUtils.Addition(userMagic.MagicLv, (short)1, (short)maxMagicLv); } UserLogHelper.AppenStrongLog(ContextUser.UserID, 1, null, magicID, 2, (short)userMagic.MagicLv, useGold, 0); } List <UserGeneral> userGeneralsArray = new PersonalCacheStruct <UserGeneral>().FindAll(ContextUser.UserID, s => s.GeneralStatus == GeneralStatus.DuiWuZhong && s.GeneralType != GeneralType.Soul); foreach (UserGeneral general in userGeneralsArray) { general.RefreshMaxLife(); } //日常任务-魔术升级 TaskHelper.TriggerDailyTask(Uid, 4004); return(true); }