public void action_HappyModeData_enterNum(object state) { ConsoleLog.showNotifyInfo("action_HappyModeData_enterNum begin."); var cache = new PersonalCacheStruct<HappyModeData>(); cache.Foreach(update_HappyModeData_enterNum); ConsoleLog.showNotifyInfo("action_HappyModeData_enterNum end."); }
public override bool TakeAction() { UserGeneral userGeneral = new PersonalCacheStruct<UserGeneral>().FindKey(ContextUser.UserID, generalID); if (userGeneral == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St1405_GeneralIDNotEnough; return false; } if (ops == 1) { //佣兵离队时,传承清空 if (ContextUser.HeritageList.Count > 0) { GeneralHeritage heritage = ContextUser.HeritageList.Find(m => m.GeneralID == generalID); if (heritage != null) { ContextUser.HeritageList = new CacheList<GeneralHeritage>(); } } List<UserEmbattle> embattleArray = new PersonalCacheStruct<UserEmbattle>().FindAll(ContextUser.UserID, u => u.GeneralID == generalID); foreach (UserEmbattle embattle in embattleArray) { embattle.GeneralID = 0; } if (userGeneral.GeneralID == LanguageManager.GetLang().GameUserGeneralID) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St1405_LiDuiNotFilter; return false; } userGeneral.GeneralStatus = GeneralStatus.LiDui; } return true; }
public override bool TakeAction() { int sumGold = 0; UserExpedition userExp = new PersonalCacheStruct<UserExpedition>().FindKey(ContextUser.UserID); if (userExp == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; return false; } if (DateTime.Now.Date == userExp.InsertDate.Date) { sumGold = MathUtils.Addition(userExp.DoRefresh() / 60, 1, int.MaxValue); } if (ops == 1) { this.ErrorCode = 1; this.ErrorInfo = string.Format(LanguageManager.GetLang().St11003_DelCodeTime, sumGold); return false; } else if (ops == 2) { if (ContextUser.GoldNum < sumGold) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return false; } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold, int.MaxValue); userExp.CodeTime = 0; } return true; }
/// <summary> /// 父亲节奖励 /// </summary> public static void FathersDay(GameUser user) { short energyNum = 30; int obtainNum = 50; int gameGoin = 20000; string fatherTime = "2012-06-17 00:00:00"; DateTime fatherDate = DateTime.Parse(fatherTime); UserDailyRestrain dailyRestrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(user.UserID); if (dailyRestrain != null && dailyRestrain.Funtion13 < 1) { if (DateTime.Now.Date == fatherDate.Date) { dailyRestrain.Funtion13 = 1; //dailyRestrain.Update(); user.EnergyNum = MathUtils.Addition(user.EnergyNum, energyNum, short.MaxValue); user.ObtainNum = MathUtils.Addition(user.ObtainNum, obtainNum, int.MaxValue); user.GameCoin = MathUtils.Addition(user.GameCoin, gameGoin, int.MaxValue); //user.Update(); string content = string.Format(LanguageManager.GetLang().St_FathersDay, energyNum, obtainNum, gameGoin); new TjxChatService().SystemSendWhisper(user, content); } } }
public static List<SkillLvInfo> CreateSkillLvInfo(CombatGeneral general) { List<SkillLvInfo> _skillLvList = new List<SkillLvInfo>(); if (general.GeneralID == LanguageManager.GetLang().GameUserGeneralID) { var abilityCacheSet = new ShareCacheStruct<AbilityInfo>(); var skillLvSet = new ShareCacheStruct<SkillLvInfo>(); UserTrump userTrump = new PersonalCacheStruct<UserTrump>().FindKey(general.UserID, TrumpInfo.CurrTrumpID) ?? new UserTrump(); if (userTrump.LiftNum > 0) { userTrump.SkillInfo.Foreach(obj => { var abilityInfo = abilityCacheSet.FindKey(obj.AbilityID) ?? new AbilityInfo(); if (abilityInfo.AttackType == AttackType.Trigger) { var temp = skillLvSet.FindKey(obj.AbilityID, obj.AbilityLv); if (temp != null) { _skillLvList.Add(temp); } } return true; }); } } return _skillLvList; }
private static bool GetPayment(int game, int server, string account, string userID) { try { GameUser userInfo = new PersonalCacheStruct<GameUser>().FindKey(userID); if (userInfo == null) return false; var chatService = new TjxChatService(); OrderInfo[] model = PayManager.getPayment(game, server, account); foreach (OrderInfo order in model) { userInfo.PayGold = MathUtils.Addition(userInfo.PayGold, order.GameCoins, int.MaxValue); //userInfo.Update(); PayManager.Abnormal(order.OrderNO); DialHelper.ReturnRatioGold(userID, order.GameCoins); //大转盘抽奖奖励充值返还 chatService.SystemSendWhisper(userInfo, string.Format(LanguageManager.GetLang().PaySuccessMsg, order.GameCoins)); DoGiff(userID, order); FestivalHelper.GetPayReward(userInfo, order.GameCoins, FestivalType.PayReward); } return true; } catch (Exception ex) { BaseLog log = new BaseLog("PaymentLog"); log.SaveLog(ex); return false; } }
public override void BuildPacket() { var cacheSetItemEqu = new ShareCacheStruct<ItemEquAttrInfo>(); PushIntoStack(_userItemArray.Count); foreach (UserItemInfo item in _userItemArray) { ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(item.ItemID); var general = new PersonalCacheStruct<UserGeneral>().FindKey(Uid, item.GeneralID); var itemEquList = cacheSetItemEqu.FindAll(e => e.ItemID.Equals(item.ItemID)); DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(item.UserItemID.ToNotNullString()); dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString()); dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString()); dsItem.PushIntoStack(item.ItemLv); dsItem.PushIntoStack(itemInfo == null ? LanguageManager.GetLang().shortInt : (short)itemInfo.QualityType); dsItem.PushIntoStack(general != null ? general.GeneralName : string.Empty); PushIntoStack(dsItem); dsItem.PushIntoStack(itemEquList.Count); foreach (var itemEquAttrInfo in itemEquList) { DataStruct dsItem1 = new DataStruct(); dsItem1.PushIntoStack(itemEquAttrInfo.AttributeID.ToInt()); int strengNum = 0; strengNum = MathUtils.Addition(itemEquAttrInfo.BaseNum, (itemEquAttrInfo.IncreaseNum * item.ItemLv), int.MaxValue); // dsItem1.PushIntoStack(itemEqu.BaseNum); dsItem1.PushIntoStack(strengNum); dsItem.PushIntoStack(dsItem1); } } }
public override void BuildPacket() { PushIntoStack(moreTeam.MorePlot.PlotID); PushIntoStack(moreTeam.MorePlot.PlotName.ToNotNullString()); PushIntoStack(moreTeam.UserList.Count); PushIntoStack(PlotTeamCombat.TeamMaxPeople); PushIntoStack(moreTeam.MorePlot.ItemId); PushIntoStack(moreTeam.MorePlot.ItemName.ToNotNullString()); PushIntoStack(moreTeam.MorePlot.ItemNum); PushIntoStack(moreTeam.MorePlot.ExpNum); PushIntoStack(moreTeam.TeamUser != null && moreTeam.TeamUser.UserId.ToNotNullString().Equals(Uid) ? 1 : 0); PushIntoStack(moreTeam.Status); PushIntoStack(moreTeam.UserList.Count); foreach (var teamUser in moreTeam.UserList) { var gameUser = new PersonalCacheStruct<GameUser>().FindKey(teamUser.UserId); UserGeneral general = UserGeneral.GetMainGeneral(teamUser.UserId); CareerInfo careerInfo = null; if (general != null) { careerInfo = new ShareCacheStruct<CareerInfo>().FindKey(general.CareerID); } DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(teamUser.UserId); dsItem.PushIntoStack(teamUser.NickName.ToNotNullString()); dsItem.PushIntoStack(careerInfo == null ? 0 : (int)careerInfo.CareerID); dsItem.PushIntoStack(careerInfo == null ? string.Empty : careerInfo.CareerName.ToNotNullString()); dsItem.PushIntoStack(gameUser == null ? (short)0 : gameUser.UserLv); PushIntoStack(dsItem); } }
public override bool TakeAction() { var cacheSet = new PersonalCacheStruct<UserQueue>(); List<UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang); foreach (UserQueue queue in userQueueList) { if (queue != null) { int npcCount = new ShareCacheStruct<PlotNPCInfo>().FindAll(m => m.PlotID == plotID).Count; //战斗次数 int totalBattleNum = (int)Math.Floor((double)(queue.TotalColdTime - queue.DoRefresh()) / PlotInfo.BattleSpeedNum); int turnsNum = totalBattleNum / npcCount; int battleNum = totalBattleNum % npcCount; //没发生战斗或上未通关都返还精力 //if (turnsNum == 0 || battleNum > 0) //{ // ContextUser.EnergyNum = ContextUser.EnergyNum.Addition(PlotInfo.BattleEnergyNum, short.MaxValue); //} cacheSet.Delete(queue); } } if (ContextUser.UserStatus == UserStatus.SaoDang) { ContextUser.ResetSweepPool(0); ContextUser.UserStatus = UserStatus.Normal; //ContextUser.Update(); } return true; }
public static short _currMaxLv = ObjectExtend.ToShort(ConfigEnvSet.GetInt("User.CurrMaxLv")); //玩家最大等级 /// <summary> /// 获取生命上限,等级*职业初始值+装备+命运水晶(未完成) /// </summary> /// <returns></returns> public static int GetMaxLife(string userID, int generalID) { //修改者wuzf 2012-04-19 UserGeneral general = new PersonalCacheStruct<UserGeneral>().FindKey(userID, generalID); return general == null ? 0 : general.LifeMaxNum; }
public override bool TakeAction() { var package = UserItemPackage.Get(ContextUser.UserID); UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID == userItemID); if (userItem != null) { UserTrump userTrump = new PersonalCacheStruct<UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.TrumpLv >= GameConfigSet.MaxTrumpLv) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1456_OutTrumpMaxLv; return false; } ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(userItem.ItemID); if (itemInfo != null && itemInfo.PropType == 10) { TrumpHelper.CheckTrumpEscalate(ContextUser.UserID, itemInfo.EffectNum); UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.ItemID, 1); var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID); if (usergeneral != null) { usergeneral.RefreshMaxLife(); } } } return true; }
public override void BuildPacket() { PushIntoStack(isSuccess); PushIntoStack(memberArray.Count); foreach (GuildMember member in memberArray) { UserCacheGlobal.CheckLoadUser(member.UserID); GameUser gameUser = new PersonalCacheStruct<GameUser>().FindKey(member.UserID); UserGeneral general = UserGeneral.GetMainGeneral(member.UserID); int isHelp = 0; if (member.DevilNum > 1) { isHelp = 1; } else { isHelp = 2; } DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(member.UserID); dsItem.PushIntoStack(gameUser == null ? string.Empty : gameUser.NickName.ToNotNullString()); dsItem.PushIntoStack(general == null ? string.Empty : general.HeadID.ToNotNullString()); dsItem.PushIntoStack(isHelp); PushIntoStack(dsItem); } PushIntoStack(currNum); PushIntoStack(isPilgrimage); PushIntoStack(chaoShengNum); }
public override bool TakeAction() { UserDailyRestrain dailyRestrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(ContextUser.UserID); if (RankingHelper.IsGainSportsReward(ContextUser.UserID) && dailyRestrain != null && dailyRestrain.UserExtend != null) { var envSet = ServerEnvSet.Get(ServerEnvKey.JingJiChangReward, ""); SportsRewardInfo sportsInfo = new ShareCacheStruct<SportsRewardInfo>().FindKey(dailyRestrain.UserExtend.UserRankID); { if (envSet != null && sportsInfo != null) if (envSet.ToDateTime().Date > dailyRestrain.Funtion11.Date && dailyRestrain.UserExtend.UserRankID > 0) { dailyRestrain.Funtion11 = DateTime.Now; dailyRestrain.UserExtend.UserRankID = 0; //dailyRestrain.Update(); ContextUser.ObtainNum = MathUtils.Addition(ContextUser.ObtainNum, sportsInfo.RewardObtian, int.MaxValue); ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, sportsInfo.RewardGoin, int.MaxValue); //ContextUser.Update(); UserHelper.Contribution(ContextUser.UserID, sportsInfo.RewardObtian); ErrorInfo = string.Format(LanguageManager.GetLang().St5106_JingJiChangRankReward, sportsInfo.RewardObtian, sportsInfo.RewardGoin); } } } return true; }
public override bool TakeAction() { if (new PersonalCacheStruct<UserFunction>().FindKey(Uid, FunctionEnum.PetRun) == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_NoFun; return false; } UserDailyRestrain restrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(Uid); if (restrain != null && restrain.UserExtend != null) { var dailyCacheSet = new ShareCacheStruct<DailyRestrainSet>(); if (dailyCacheSet.FindKey(RestrainType.PetRun) != null) _runTimes = MathUtils.Subtraction(dailyCacheSet.FindKey(RestrainType.PetRun).MaxNum, restrain.UserExtend.PetRunTimes, 0); if (dailyCacheSet.FindKey(RestrainType.PetIntercept) != null) _interceptTimes = MathUtils.Subtraction(dailyCacheSet.FindKey(RestrainType.PetIntercept).MaxNum, restrain.UserExtend.PetIntercept, 0); if (dailyCacheSet.FindKey(RestrainType.PetHelp) != null) _helpTimes = MathUtils.Subtraction(dailyCacheSet.FindKey(RestrainType.PetHelp).MaxNum, restrain.UserExtend.PetHelp, 0); } var petRun = new ShareCacheStruct<PetRunPool>().FindKey(Uid); if (petRun != null) { //问题:在赛跑时有重刷点亮宠物后,等赛跑完服务端与客户端记录宠物ID不一致,原因是赛跑完有将宠物ID清除 if (petRun.PetID > 0 && petRun.ColdTime == 0) { UserHelper.ProcessPetPrize(petRun); } _coldTime = petRun.ColdTime; _petHead = (new ShareCacheStruct<PetInfo>().FindKey(petRun.PetID) ?? new PetInfo()).PetHead; if (ContextUser.UserExtend != null) _petId = ContextUser.UserExtend.LightPetID; } return true; }
public override bool TakeAction() { int sumGold = 0; int userGold = ConfigEnvSet.GetInt("UserLand.UseGold"); int intervalDate = ConfigEnvSet.GetInt("UserLand.IntervalDate"); UserLand land = new PersonalCacheStruct<UserLand>().FindKey(ContextUser.UserID, landPostion); if (land != null) { int subDate = (land.DoRefresh() / intervalDate); sumGold = (MathUtils.Addition(subDate, 1, int.MaxValue) * userGold); } if (Ops == 1) { this.ErrorCode = 1; this.ErrorInfo = string.Format(LanguageManager.GetLang().St10007_DoRefresh, sumGold); return false; } else if (Ops == 2) { if (ContextUser.GoldNum < sumGold) { this.ErrorCode = 2; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return false; } if (land != null && (DateTime.Now - land.GainDate).TotalSeconds < 28800) { land.GainDate = MathUtils.SqlMinDate; ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold, int.MaxValue); } } return true; }
/// <summary> /// 竞技场每日奖励 /// </summary> /// <param name="user"></param> public static void DailySportsRankPrize(GameUser user) { UserDailyRestrain dailyRestrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(user.UserID); if (IsGainSportsReward(user.UserID) && dailyRestrain != null && dailyRestrain.UserExtend != null) { //var envSet = ServerEnvSet.Get(ServerEnvKey.JingJiChangReward, ""); SportsRewardInfo sportsInfo = new ShareCacheStruct<SportsRewardInfo>().FindKey(dailyRestrain.UserExtend.UserRankID); //if (envSet != null && sportsInfo != null && envSet.ToDateTime().Date > dailyRestrain.Funtion11.Date && // dailyRestrain.UserExtend.UserRankID > 0) if (sportsInfo != null && DateTime.Now.Date != dailyRestrain.Funtion11.Date && dailyRestrain.UserExtend.UserRankID > 0) { dailyRestrain.Funtion11 = DateTime.Now; dailyRestrain.UserExtend.UserRankID = 0; user.SportsIntegral = MathUtils.Addition(user.SportsIntegral, sportsInfo.RewardObtian, int.MaxValue); user.GameCoin = MathUtils.Addition(user.GameCoin, sportsInfo.RewardGoin, int.MaxValue); string sportContent = string.Format(LanguageManager.GetLang().St5106_JingJiChangRankReward, sportsInfo.RewardObtian, sportsInfo.RewardGoin); var chatService = new TjxChatService(); chatService.SystemSendWhisper(user, sportContent); } } }
public override bool TakeAction() { UserTrump userTrump = new PersonalCacheStruct<UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.PropertyInfo.Count > 0) { GeneralProperty property = userTrump.PropertyInfo.Find(m => m.AbilityType == propertyID); if (property != null) { if (property.AbilityLv >= TrumpPropertyInfo.MaxTrumpPropertyLv) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1466_OutPropertyMaxLv; return false; } TrumpPropertyInfo trumpProperty = new ShareCacheStruct<TrumpPropertyInfo>().FindKey(property.AbilityType, property.AbilityLv); if (trumpProperty != null) { int upItemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, trumpProperty.ItemID); if (upItemNum < trumpProperty.ItemNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1462_ItemNumNotEnough; return false; } if (ContextUser.GameCoin < trumpProperty.GameCoin) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough; return false; } if (ContextUser.ObtainNum < trumpProperty.ObtainNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_ObtainNumNotEnough; return false; } ContextUser.ObtainNum = MathUtils.Subtraction(ContextUser.ObtainNum, trumpProperty.ObtainNum); ContextUser.GameCoin = MathUtils.Subtraction(ContextUser.GameCoin, trumpProperty.GameCoin); UserItemHelper.UseUserItem(ContextUser.UserID, trumpProperty.ItemID, trumpProperty.ItemNum); short upLv = MathUtils.Addition(property.AbilityLv, (short)1, (short)TrumpPropertyInfo.MaxTrumpPropertyLv); TrumpPropertyInfo uptrumpProperty = new ShareCacheStruct<TrumpPropertyInfo>().FindKey(property.AbilityType, upLv); property.UpdateNotify(obj => { property.AbilityLv = MathUtils.Addition(property.AbilityLv, (short)1, TrumpPropertyInfo.MaxTrumpPropertyLv); property.AbilityValue = uptrumpProperty.PropertyNum; return true; }); var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID); if (usergeneral != null) { usergeneral.RefreshMaxLife(); } ErrorCode = 0; ErrorInfo = LanguageManager.GetLang().St1464_UpgradeWasSsuccessful; } } } return true; }
public override bool TakeAction() { int useGold = ConfigEnvSet.GetInt("TrumpZodiac.ChangeZodiacUseGold"); if (ops == 1) { ErrorCode = ops; ErrorInfo = string.Format(LanguageManager.GetLang().St1471_ChangeZodiac, useGold); return false; } else if (ops == 2) { if (ContextUser.GoldNum < useGold) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return false; } var cacheSet = new PersonalCacheStruct<UserTrump>(); UserTrump userTrump = cacheSet.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump != null) { userTrump.Zodiac = TrumpHelper.GetZodiacType(userTrump.Zodiac); ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue); } ErrorCode = ops; } return true; }
public override bool TakeAction() { GeneralProperty property = null; UserTrump userTrump = new PersonalCacheStruct<UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.PropertyInfo.Count > 0) { property = userTrump.PropertyInfo.Find(m => m.AbilityType == propertyID); } if (property == null) { return false; } if (ops == 1) { ErrorCode = ops; ErrorInfo = LanguageManager.GetLang().St1467_WorshipGridNotEnough; return false; } else if (ops == 2) { ErrorCode = ops; userTrump.PropertyInfo.Remove(property); var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID); if (usergeneral != null) { usergeneral.RefreshMaxLife(); } } return true; }
protected override void ProcessCmd(string[] args) { int magicID = args.Length > 0 ? args[0].Trim().ToInt() : 0; short magicLv = args.Length > 1 ? args[1].Trim().ToShort() : (short)1; var cacheSet = new PersonalCacheStruct<UserMagic>(); var userMagic = cacheSet.FindKey(UserID, magicID); MagicInfo magic = new ShareCacheStruct<MagicInfo>().FindKey(magicID); if (magic == null) { return; } if (userMagic == null) { userMagic = new UserMagic() { UserID = UserID, MagicID = magicID, MagicLv = magicLv, IsEnabled = false, MagicType = magic.MagicType, }; cacheSet.Add(userMagic); } else { userMagic.MagicLv = magicLv; } }
public override void BuildPacket() { this.PushIntoStack(heritageList.Count); foreach (var item in heritageList) { UserGeneral userGeneral = new PersonalCacheStruct<UserGeneral>().FindKey(ContextUser.UserID, item.GeneralID); GeneralInfo general = new ShareCacheStruct<GeneralInfo>().FindKey(item.GeneralID); DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack((short)item.Type); dsItem.PushIntoStack(userGeneral == null ? 0 : userGeneral.GeneralID); dsItem.PushIntoStack(userGeneral == null ? string.Empty : ObjectExtend.ToNotNullString(userGeneral.GeneralName)); dsItem.PushIntoStack(general == null ? string.Empty : ObjectExtend.ToNotNullString(general.BattleHeadID)); dsItem.PushIntoStack(item.GeneralLv); dsItem.PushIntoStack(item.PowerNum); dsItem.PushIntoStack(item.SoulNum); dsItem.PushIntoStack(item.IntellectNum); dsItem.PushIntoStack(userGeneral == null ? (short)0 : (short)userGeneral.GeneralQuality); this.PushIntoStack(dsItem); } this.PushIntoStack(opsInfoList.Count); foreach (var item in opsInfoList) { DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(item.Type); dsItem.PushIntoStack(item.VipLv); dsItem.PushIntoStack(item.UseGold); dsItem.PushIntoStack(item.ItemID); dsItem.PushIntoStack(item.ItemNum); this.PushIntoStack(dsItem); } this.PushIntoStack(heritageName.ToNotNullString()); this.PushIntoStack(heritageLv); this.PushIntoStack(disGeneralName.ToNotNullString()); }
private static void CheckFestivalRestrain(string userid, int festivalID) { var cacheSet = new PersonalCacheStruct<FestivalRestrain>(); FestivalRestrain restrain = cacheSet.FindKey(userid, festivalID); if (restrain != null) { if (restrain.RefreashDate.Date != DateTime.Now.Date) { if (restrain.RefreashDate.Date != DateTime.Now.Date) { restrain.RefreashDate = DateTime.Now; restrain.RestrainNum = 0; //restrain.Update(); } } } else { restrain = new FestivalRestrain() { UserID = userid, FestivalID = festivalID, RestrainNum = 0, RefreashDate = DateTime.Now }; cacheSet.Add(restrain); } }
public override bool TakeAction() { if (ops == 0) { UserGeneral userGeneral = new PersonalCacheStruct<UserGeneral>().FindKey(ContextUser.UserID, ContextUser.GeneralID); if (userGeneral == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; return false; } userGeneral.TrainingPower = ContextUser.TrainingPower; userGeneral.TrainingSoul = ContextUser.TrainingSoul; userGeneral.TrainingIntellect = ContextUser.TrainingIntellect; UserHelper.GetGameUserCombat(ContextUser.UserID); } else if (ops == 1) { this.ErrorCode = ops; } else { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().ServerBusy; return false; } return true; }
public override void BuildPacket() { PushIntoStack(_chargePacksArray.Count); foreach (RechargePacks packs in _chargePacksArray) { short _isRevice = 0; short _isShow = 0; List<PackageReceive> receivesArray = new PersonalCacheStruct<PackageReceive>().FindAll(ContextUser.UserID, u => u.IsReceive == false && u.PacksID == packs.PacksID); if (receivesArray.Count == 0) { _isRevice = 2; } else { _isRevice = 1; } SaveLog(receivesArray.Count + ContextUser.UserID + packs.PacksID); DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(packs.PacksID); dsItem.PushIntoStack(packs.PacksName); dsItem.PushIntoStack(_isRevice); dsItem.PushIntoStack(_isShow); dsItem.PushIntoStack(receivesArray.Count); PushIntoStack(dsItem); } }
public override bool TakeAction() { if (ContextUser.UserStatus == UserStatus.CountryCombat) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1902_CountryCombatNotUpEmbattle; return false; } var userMagicArray = new PersonalCacheStruct<UserMagic>().FindAll(ContextUser.UserID, m => m.MagicType == MagicType.MoFaZhen); foreach (UserMagic magic in userMagicArray) { if (magic.MagicID == _magicID) { magic.IsEnabled = true; ContextUser.UseMagicID = _magicID; //ContextUser.Update(); } else { magic.IsEnabled = false; } //magic.Update(); UserHelper.GetGameUserCombat(ContextUser.UserID); } return true; }
public override bool TakeAction() { if (ContextUser.TempEnergyNum > 0 && ContextUser.UserStatus != UserStatus.Combat) { List<UserPlotCombat> plotCombatList = new PersonalCacheStruct<UserPlotCombat>().FindAll(ContextUser.UserID, m => m.PlotID == plotID); //没发生战斗或上次战斗失败都返还精力 if (plotCombatList.Count == 0 || (ContextUser.TempEnergyNum > 0 && IsNotCombat(plotCombatList))) { if (ContextUser.SurplusEnergy == 0 && !ContextUser.IsSurplus) //策划要求:领取的不返还 { if (ContextUser.UserExtend != null && ContextUser.UserExtend.PlotStatusID > 0 && ContextUser.UserExtend.MercenarySeq <= 1) { ContextUser.TempEnergyNum = 0; ContextUser.EnergyNum = MathUtils.Addition(ContextUser.EnergyNum, PlotInfo.BattleEnergyNum, short.MaxValue); } //ContextUser.Update(); } } } if (ContextUser.UserExtend != null) { ContextUser.UserExtend.UpdateNotify(obj => { ContextUser.UserExtend.PlotStatusID = 0; ContextUser.UserExtend.PlotNpcID = -1; ContextUser.UserExtend.MercenarySeq = 0; ContextUser.UserExtend.IsBoss = false; return true; }); } return true; }
private void Process(string userID, int expNum) { GameUser currentUser = new PersonalCacheStruct<GameUser>().FindKey(userID); if (currentUser != null) { currentUser.ExpNum += expNum; } }
private void Process(string userID, short energyNum) { GameUser currentUser = new PersonalCacheStruct<GameUser>().FindKey(userID); if (currentUser != null) { currentUser.EnergyNum = MathUtils.Addition(currentUser.EnergyNum, energyNum, short.MaxValue); }//currentUser.Update(); }
private void Process(string userID, int honourNum) { GameUser currentUser = new PersonalCacheStruct<GameUser>().FindKey(userID); if (currentUser != null) { currentUser.HonourNum = MathUtils.Addition(currentUser.HonourNum, honourNum, int.MaxValue); } }
public override void BuildPacket() { PushIntoStack(_userMagicArray.Count); foreach (UserMagic userMagic in _userMagicArray) { MagicInfo magicInfo = new ShareCacheStruct<MagicInfo>().FindKey(userMagic.MagicID); short repostion = GeneralHelper.ReplacePostion(ContextUser.UserID, userMagic.MagicID); DataStruct ds = new DataStruct(); ds.PushIntoStack(userMagic.MagicID); ds.PushIntoStack(magicInfo == null ? string.Empty : magicInfo.MagicName.ToNotNullString()); ds.PushIntoStack((short)userMagic.MagicLv); ds.PushIntoStack(userMagic.IsEnabled == false ? 0 : 1); ds.PushIntoStack(magicInfo == null ? string.Empty : magicInfo.MagicDesc.ToNotNullString()); string gridPostion = string.Empty; string[] gridRanges = new string[0]; MagicLvInfo magicLv = new ShareCacheStruct<MagicLvInfo>().FindKey(userMagic.MagicID, userMagic.MagicLv); if (magicLv != null) { var userFunction = new PersonalCacheStruct<UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.ReplaceGeneral); gridPostion = magicLv.GridRange; if (magicLv.ReplacePostion > 0 && userFunction != null) { gridPostion = gridPostion.TrimEnd(',') + "," + magicLv.ReplacePostion; } } gridRanges = gridPostion.Split(','); ds.PushIntoStack(gridRanges.Length); foreach (string gridRang in gridRanges) { int isDisplace = repostion == gridRang.ToInt() ? 1 : 0; UserEmbattle userEmbattle = new PersonalCacheStruct<UserEmbattle>().FindKey(ContextUser.UserID, userMagic.MagicID, gridRang.ToShort()); UserGeneral uGeneral = new PersonalCacheStruct<UserGeneral>().FindKey(ContextUser.UserID, userEmbattle == null ? 0 : userEmbattle.GeneralID); DataStruct ds1 = new DataStruct(); ds1.PushIntoStack(uGeneral == null ? (short)0 : (short)1); ds1.PushIntoStack(gridRang.ToShort()); ds1.PushIntoStack(uGeneral == null ? 0 : uGeneral.GeneralID); ds1.PushIntoStack(uGeneral == null ? string.Empty : uGeneral.HeadID.ToNotNullString()); ds1.PushIntoStack((short)isDisplace); ds1.PushShortIntoStack(uGeneral == null ? (short)0 : MathUtils.ToShort(uGeneral.GeneralQuality)); ds.PushIntoStack(ds1); } PushIntoStack(ds); } // 获取佣兵品质 var generalInfoCacheSet = new ShareCacheStruct<GeneralInfo>(); PushIntoStack(_userGeneralArray.Count); foreach (UserGeneral general in _userGeneralArray) { GeneralInfo generalInfo = generalInfoCacheSet.FindKey(general.GeneralID); DataStruct ds = new DataStruct(); ds.PushIntoStack(general.GeneralID); ds.PushIntoStack(general.HeadID.ToNotNullString()); ds.PushShortIntoStack(generalInfo == null ? (short)0 : MathUtils.ToShort(generalInfo.GeneralQuality)); PushIntoStack(ds); } }
public override void BuildPacket() { PushIntoStack(ContextUser.CrystalNum); PushIntoStack(userCrystalArray.Count); foreach (UserCrystalInfo crystal in userCrystalArray) { UserGeneral general = new PersonalCacheStruct <UserGeneral>().FindKey(ContextUser.UserID, crystal.GeneralID); CrystalInfo crystalInfo = new ShareCacheStruct <CrystalInfo>().FindKey(crystal.CrystalID); DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(crystal.UserCrystalID); dsItem.PushIntoStack(crystal.CrystalID); dsItem.PushIntoStack(crystalInfo == null ? string.Empty : crystalInfo.HeadID.ToNotNullString()); dsItem.PushIntoStack(crystalInfo == null ? string.Empty : crystalInfo.CrystalName.ToNotNullString()); dsItem.PushIntoStack(crystal.CrystalLv); dsItem.PushIntoStack(crystalInfo == null ? LanguageManager.GetLang().shortInt : (short)crystalInfo.CrystalQuality); dsItem.PushIntoStack(crystalInfo == null ? LanguageManager.GetLang().shortInt : (short)crystalInfo.AbilityID); dsItem.PushIntoStack(CrystalAbilityNum(crystal.CrystalID, crystal.CrystalLv).ToNotNullString()); dsItem.PushIntoStack(general == null ? string.Empty : general.GeneralName.ToNotNullString()); PushIntoStack(dsItem); } }
/// <summary> /// 法宝等级属性数值 /// </summary> /// <param name="userID"></param> /// <param name="generalID"></param> /// <param name="abilityType"></param> /// <returns></returns> public static short TrumpPropertyNum(string userID, int generalID, AbilityType abilityType) { short proNum = 0; UserTrump userTrump = new PersonalCacheStruct <UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.LiftNum > 0 && generalID == LanguageManager.GetLang().GameUserGeneralID) { TrumpInfo trumpInfo = new ShareCacheStruct <TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, userTrump.TrumpLv); if (trumpInfo != null && trumpInfo.Property.Count > 0) { decimal mature = (decimal)userTrump.MatureNum / GameConfigSet.MaxMatureNum; foreach (var property in trumpInfo.Property) { if (property.AbilityType == abilityType) { proNum = (short)MathUtils.RoundCustom(MathUtils.Addition(proNum, mature * property.AbilityValue)); } } } } return(proNum); }
public override void BuildPacket() { this.PushIntoStack(userSweepPoolList.Count); foreach (UserSweepPool sweepPool in userSweepPoolList) { DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack(sweepPool.TurnsNum); dsItem.PushIntoStack(sweepPool.BattleNum); dsItem.PushIntoStack(sweepPool.GameCoin); dsItem.PushIntoStack(sweepPool.Gold); dsItem.PushIntoStack(sweepPool.ExpNum); dsItem.PushIntoStack(userEmbattleList.Count); foreach (UserEmbattle userEmbattle in userEmbattleList) { UserGeneral userGeneral = new PersonalCacheStruct <UserGeneral>().FindKey(ContextUser.UserID, userEmbattle.GeneralID); DataStruct dsItem1 = new DataStruct(); dsItem1.PushIntoStack(userGeneral.GeneralName.ToNotNullString()); dsItem1.PushIntoStack(sweepPool.Experience); dsItem1.PushIntoStack(sweepPool.BlessExperience); dsItem.PushIntoStack(dsItem1); } dsItem.PushIntoStack(sweepPool.PrizeItems.Count); foreach (PrizeItemInfo prizeItemInfo in sweepPool.PrizeItems) { ItemBaseInfo itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(prizeItemInfo.ItemID); DataStruct dsItem1 = new DataStruct(); dsItem1.PushIntoStack(itemInfo != null ? itemInfo.ItemName.ToNotNullString() : string.Empty); dsItem1.PushIntoStack(prizeItemInfo.Num); dsItem1.PushIntoStack(itemInfo != null ? (short)itemInfo.QualityType : (short)0); dsItem.PushIntoStack(dsItem1); } dsItem.PushIntoStack(sweepPool.BlessPennyNum); this.PushIntoStack(dsItem); } }
protected override bool DoSuccess(int userId, out IUser user) { user = null; var cacheSet = new PersonalCacheStruct <GameUser>(); var roleCache = new PersonalCacheStruct <UserRole>(); var roleList = roleCache.FindAll(userId.ToString()); GameUser gameUser = cacheSet.FindKey(userId.ToString()); if (gameUser == null || roleList.Count == 0) { //通知客户跳转到创建角色接口 GuideId = 1005; return(true); } user = new SessionUser(gameUser); if (gameUser.CurrRoleId == 0) { gameUser.CurrRoleId = roleList[0].RoleId; } return(true); }
/// <summary> /// 添加玩家魂技 /// </summary> /// <param name="abilityId"></param> /// <param name="userId"></param> private void AddUserAbility(int abilityId, int userId, int generalID, int position) { PersonalCacheStruct <UserAbility> _cacheSetAbility = new PersonalCacheStruct <UserAbility>(); var userAbility = _cacheSetAbility.FindKey(userId.ToString()); var ability = userAbility != null && userAbility.AbilityList != null ? userAbility.AbilityList.Find(s => s.AbilityID == abilityId) : null; var abilityLv = new ShareCacheStruct <AbilityLvInfo>().FindKey(abilityId, 1); int experienceNum = abilityLv != null ? abilityLv.Experience : 0; if (userAbility == null) { userAbility = new UserAbility(userId); ability = new Ability(); userAbility.CreateDate = DateTime.Now; ability.UserItemID = Guid.NewGuid().ToString(); ability.AbilityID = abilityId; ability.AbilityLv = 1; ability.GeneralID = generalID; ability.ExperienceNum = experienceNum; ability.Position = position; userAbility.AbilityList.Add(ability); _cacheSetAbility.Add(userAbility); } else { ability = new Ability(); ability.UserItemID = Guid.NewGuid().ToString(); userAbility.CreateDate = DateTime.Now; ability.AbilityID = abilityId; ability.AbilityLv = 1; ability.GeneralID = generalID; ability.Position = position; ability.ExperienceNum = experienceNum; userAbility.AbilityList.Add(ability); } }
/// <summary> /// 被动魂技效果 /// </summary> /// <param name="userId"></param> /// <returns></returns> public static List <SelfAbilityEffect> GetSelfAbilityEffectList(string userId, short role) { List <SelfAbilityEffect> selfAbilityEffectList = new List <SelfAbilityEffect>(); var cacheSetUserAbility = new PersonalCacheStruct <UserAbility>(); var cacheSetUserEmbattle = new PersonalCacheStruct <UserEmbattle>(); var cacheSetAbilityInfo = new ShareCacheStruct <AbilityInfo>(); var userAbility = cacheSetUserAbility.FindKey(userId); var userMagic = new PersonalCacheStruct <UserMagic>().Find(userId, s => s.IsEnabled); if (userAbility != null && userAbility.AbilityList != null) { var userEmbattleList = cacheSetUserEmbattle.FindAll(userId, s => s.MagicID == userMagic.MagicID); userEmbattleList.ForEach(obj => { if (obj.GeneralID > 0) { var abilityList = userAbility.AbilityList.FindAll(s => s.GeneralID == obj.GeneralID); abilityList.ForEach(ability => { var abilityInfo = cacheSetAbilityInfo.FindKey(ability.AbilityID); if (abilityInfo != null && abilityInfo.IsActive == 1) { SelfAbilityEffect selfAbilityEffect = new SelfAbilityEffect(); selfAbilityEffect.GeneralID = obj.GeneralID; selfAbilityEffect.EffectID1 = abilityInfo.EffectID1; selfAbilityEffect.FntHeadID = abilityInfo.FntHeadID; selfAbilityEffect.IsIncrease = abilityInfo.IsIncrease; selfAbilityEffect.Position = obj.Position; selfAbilityEffect.Role = role; selfAbilityEffectList.Add(selfAbilityEffect); } }); } }); } return(selfAbilityEffectList); }
/// <summary> /// 装备的属性值 /// </summary> /// <returns></returns> public static decimal GetEquNum(string userID, int generalID, AbilityType abilityType) { int valueNum = 0; decimal equSumNum = 0; var userItemArray = UserItemHelper.GetItems(userID).FindAll(u => u.GeneralID.Equals(generalID) && u.ItemStatus == ItemStatus.YongBing); foreach (var item in userItemArray) { //ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(item.ItemID); var itemEquArray = new ShareCacheStruct <ItemEquAttrInfo>().FindAll(m => m.ItemID == item.ItemID); foreach (ItemEquAttrInfo equ in itemEquArray) { if (equ.AttributeID == abilityType) { valueNum = MathUtils.Addition(equ.BaseNum, (equ.IncreaseNum * item.ItemLv), int.MaxValue); equSumNum = MathUtils.Addition(equSumNum, valueNum, int.MaxValue); break; } } //灵件配置 var user = new PersonalCacheStruct <GameUser>().FindKey(userID); if (user != null) { var sparepartList = user.SparePartList.FindAll(m => m.UserItemID.Equals(item.UserItemID)); foreach (var sparepart in sparepartList) { foreach (var property in sparepart.Propertys) { if (property.AbilityType == abilityType) { equSumNum = MathUtils.Addition(equSumNum, property.Num.ToDecimal(), decimal.MaxValue); } } } } } return(equSumNum); }
/// <summary> /// 小助手列表 /// </summary> /// <param name="user"></param> /// <returns></returns> public static List <HelperInfo> UserHelperList(GameUser user) { List <HelperInfo> helperInfosList = new List <HelperInfo>(); var functionArray = new PersonalCacheStruct <UserFunction>().FindAll(user.UserID); foreach (UserFunction function in functionArray) { if (function.FunEnum == FunctionEnum.Goujili) { helperInfosList.Add(GetDailyEnergy(user, RestrainType.GouMaiJingLi)); } if (function.FunEnum == FunctionEnum.Jingkuandong) { helperInfosList.Add(GetDailyEnergy(user, RestrainType.WaJinKuang)); } if (function.FunEnum == FunctionEnum.Gonghui) { helperInfosList.Add(GetDailyPrayer(user)); } if (function.FunEnum == FunctionEnum.Mingyunshuijing) { helperInfosList.Add(GetDailyEnergy(user, RestrainType.MianFeiLieMing)); } if (function.FunEnum == FunctionEnum.Jingjichang) { helperInfosList.Add(GetDailyEnergy(user, RestrainType.JingJiChangTiaoZhan)); } if (function.FunEnum == FunctionEnum.Meiritanxian) { helperInfosList.Add(GetDailyExplore(user)); } if (function.FunEnum == FunctionEnum.Zhongzhijiyangshu) { helperInfosList.Add(GetDailyPlant(user)); } } return(helperInfosList); }
public void KeyCharTest() { var watch = Stopwatch.StartNew(); string key = "Test_1_B|A@#-$~'%"; var cache = new ShareCacheStruct <KeyData>(); var data = ShareCacheStruct.Get <KeyData>(key, true); if (data == null) { cache.Add(new KeyData() { Key = key, Value = key }); WaitEnd(watch); cache.UnLoad(); data = ShareCacheStruct.Get <KeyData>(key, true); Assert.IsNotNull(data, "find key faild"); } int userId = 1380000; UserKeyData userData; var userCache = new PersonalCacheStruct <UserKeyData>(); if (userCache.TryFindKey(userId.ToString(), out userData, userId, key) == LoadingStatus.Success) { if (userData == null) { userCache.Add(new UserKeyData() { UserId = userId, Key = key, Value = key }); WaitEnd(watch); userCache.UnLoad(); userData = userCache.FindKey(userId.ToString(), userId, key); Assert.IsNotNull(userData, "find key faild"); } } }
/// <summary> /// 初始化魔法阵 /// </summary> /// <param name="userId"></param> /// <param name="userLv"></param> private static void InitMagicEmbattle(string userId, short userLv) { List <UserMagic> userMagicList = new PersonalCacheStruct <UserMagic>().FindAll(userId, m => m.MagicType == MagicType.MoFaZhen && m.MagicID != new GameUser().UserMagicID); if (userMagicList.Count == 0) { List <MagicInfo> magicInfoList = new ShareCacheStruct <MagicInfo>().FindAll(m => m.MagicType == MagicType.MoFaZhen && m.DemandLv <= userLv); foreach (var magicInfo in magicInfoList) { var userMagic = new PersonalCacheStruct <UserMagic>().FindKey(userId, magicInfo.MagicID); if (userMagic != null) { continue; } userMagic = new UserMagic { UserID = userId, MagicID = magicInfo.MagicID, MagicLv = magicInfo.MagicLv, MagicType = magicInfo.MagicType, IsEnabled = false }; new PersonalCacheStruct <UserMagic>().Add(userMagic); MagicLvInfo magicLvInfo = new ShareCacheStruct <MagicLvInfo>().FindKey(magicInfo.MagicID, magicInfo.MagicLv); short position = magicLvInfo.GetFirstGrid(); var userEmbattle = new UserEmbattle { UserID = userId, GeneralID = 0, // LanguageManager.GetLang().GameUserGeneralID, MagicID = magicInfo.MagicID, Position = position }; new PersonalCacheStruct <UserEmbattle>().Add(userEmbattle); } } //UserEmbattle }
protected override void ProcessCmd(string[] args) { int taskID = args.Length > 0 ? args[0].Trim().ToInt() : 0; GameUser user = new PersonalCacheStruct <GameUser>().FindKey(UserID); if (user == null) { UserCacheGlobal.Load(UserID); user = new PersonalCacheStruct <GameUser>().FindKey(UserID); } var taskList = StoryTaskInfo.GetNextTask(taskID); foreach (StoryTaskInfo taskInfo in taskList) { if (taskInfo.CountryID != CountryType.None && user.CountryID != taskInfo.CountryID) { continue; } var cacheSet = new PersonalCacheStruct <UserTask>(); UserTask userTask = cacheSet.FindKey(UserID, taskInfo.TaskID); if (userTask == null) { userTask = new UserTask { TaskID = taskInfo.TaskID, UserID = UserID, TaskType = taskInfo.TaskType, TaskState = TaskState.AllowTake, CreateDate = DateTime.Now }; cacheSet.Add(userTask); } else { userTask.TaskState = TaskState.AllowTake; } } }
public override bool TakeAction() { // 存入数据库 var cache = new PersonalCacheStruct <HappyModeData>(); ConsoleLog.showErrorInfo(0, "index:" + cache.GetNextNo()); int keyid = utils.KeyUInt2Int(requestPack.the3rdUserID); HappyModeData hmd = cache.FindKey(keyid.ToString()); int happyPointMaxEnterNum = GameConfigMgr.Instance().getInt("happyPointMaxEnterNum", 3); if (null == hmd) { responsePack.errorCode = (byte)Response1007Pack.EnumErrorCode.not_findHMD; return(true); } doRefleshEnterTimer(hmd); // 刷新enterNum responsePack.errorCode = (byte)Response1007Pack.EnumErrorCode.ok; responsePack.enterNum = hmd.EnterNum; responsePack.happyPoint = hmd.HappyPoint; responsePack.happyReLiveNum = hmd.HappyReliveNum; responsePack.maxEnterNum = happyPointMaxEnterNum; if (requestPack.dateType != 1) { return(true); // not return realitem infos } foreach (var rii in hmd.RealItemInfoLst) { Action1007RealItem timeInfo = new Action1007RealItem(); timeInfo.id = rii.realItemID; timeInfo.theTime = rii.CreateDate; responsePack.realItemsIds.Add(timeInfo); } return(true); }
/// <summary> /// 灵件ID=数量=属性ID:区间|属性ID:区间 /// </summary> /// <param name="list"></param> /// <param name="userID"></param> private static void PutSparePackage(string[] list, string userID) { var chatService = new TjxChatService(); foreach (var item in list) { if (string.IsNullOrEmpty(item)) { continue; } string[] itemList = item.Split(new char[] { '=' }); int spareID = itemList.Length > 0 ? Convert.ToInt32(itemList[0]) : 0; int spareNum = itemList.Length > 1 ? Convert.ToInt32(itemList[1]) : 0; string[] propertys = itemList.Length > 2 ? itemList[2].ToNotNullString().Split('|') : new string[0]; var sparePartInfo = new ShareCacheStruct <SparePartInfo>().FindKey(spareID); if (spareNum > 0 && propertys.Length > 0 && sparePartInfo != null) { for (int i = 0; i < spareNum; i++) { UserSparePart sparePart = UserSparePart.CreateSparePart(spareID, propertys, ':'); if (sparePart == null) { continue; } GameUser user = new PersonalCacheStruct <GameUser>().FindKey(userID); if (!UserHelper.AddSparePart(user, sparePart)) { chatService.SystemSendWhisper(user, string.Format(LanguageManager.GetLang().St4303_SparePartFalling, sparePartInfo.Name) + "*" + spareNum); } } } else { new Base.BaseLog().SaveLog("领取灵件异常", new Exception(string.Format("userID:{3},spareID:{0},spareNum:{1},propertys:{2}", spareID, spareNum, propertys.Length, userID))); } } }
void doAdd_enterCnt(string parm) { ConsoleLog.showNotifyInfo("doAdd_enterCnt:" + parm); var cache = new PersonalCacheStruct <HappyModeData>(); int maxEnterNum = GameConfigMgr.Instance().getInt("happyPointMaxEnterNum", 2); string[] ppp = parm.Split(','); HappyModeData hmd = cache.FindKey(ppp[0]); int happyPoint = int.Parse(ppp[1]); if (hmd != null) { hmd.ModifyLocked(() => { hmd.EnterNum += maxEnterNum; hmd.HappyPoint += happyPoint; }); ConsoleLog.showNotifyInfo("doAdd_enterCnt End " + parm + ":" + hmd.EnterNum); } else { ConsoleLog.showNotifyInfo("doAdd_enterCnt failed hmd is null" + parm); } }
void doAdd_HappyDataMap(string parm) { doAdd_checkMap(); int id = int.Parse(parm); var cache = new PersonalCacheStruct <The3rdUserIDMap>(); var theData = cache.FindKey("888"); if (theData == null) { return; } foreach (var k in theData.the3rdMap.Keys) { if (theData.the3rdMap[k] == id) { theData.the3rdMap.Remove(k); ConsoleLog.showErrorInfo(0, "map del:" + k + ":" + id); break; } } }
private static void SendMessage(CountryLvGroup lvGroup) { List <KeyValuePair <string, CountryUser> > cuserList = lvGroup.UserList.ToList(); var chatService = new TjxChatService(); foreach (KeyValuePair <string, CountryUser> keyPair in cuserList) { CountryUser cuser = keyPair.Value; GameUser gameUser = new PersonalCacheStruct <GameUser>().FindKey(cuser.UserId); if (gameUser != null) { gameUser.UserStatus = UserStatus.Normal; gameUser.GroupType = CountryType.None; //领土战礼包 UserItemHelper.AddUserItem(gameUser.UserID, 5013, 1); CombatHelper.EmbattlePostion(gameUser.UserID); } string content = string.Format(LanguageManager.GetLang().St5204_CombatTransfusion, cuser.WinCount, cuser.FailCount, cuser.GameCoin, cuser.ObtainNum); chatService.SystemSendWhisper(cuser.UserId, cuser.UserName, cuser.UserVipLv, content); } }
void doAdd_reCreateHappy(string parm) { var cache = new PersonalCacheStruct <HappyModeData>(); cache.LoadFrom(null); var mapCache = new PersonalCacheStruct <The3rdUserIDMap>(); var mapData = mapCache.FindKey("888"); if (null == mapData) { mapData = new The3rdUserIDMap(); mapData.Index = 888; mapCache.Add(mapData); } string mapKey = ""; cache.Foreach((string a, string b, HappyModeData hmd) => { mapKey = Action1005.getMapKey(parm, hmd.the3rdUserId.ToString()); mapData.the3rdMap.Add(mapKey, hmd.the3rdUserId); return(true); }); }
/// <summary> /// 登入送好礼 /// </summary> /// <param name="userID"></param> /// <param name="type"></param> public static void GetLoginGainReward(string userID, FestivalType type) { FestivalInfo info = GetInfo(type); if (info != null && info.FestivalExtend != null) { var cacheSet = new PersonalCacheStruct <FestivalRestrain>(); FestivalRestrain fRest = cacheSet.FindKey(userID, info.FestivalID); if (fRest == null) { AppendFestivalRestrain(userID, info.FestivalID, 1); } else { var prizeList = info.Reward.FindAll(s => s.RefreshDate.Date == DateTime.Now.Date); if (fRest.RefreashDate.Date != DateTime.Now.Date && prizeList.Count > 0) { fRest.RefreashDate = DateTime.Now; fRest.IsReceive = false; } } } }
private void Process(string userID, int generalID, short lv) { var cacheSet = new PersonalCacheStruct <UserGeneral>(); var userGeneral = cacheSet.FindKey(userID, generalID); if (generalID > 0 && userGeneral != null) { userGeneral.GeneralLv = lv; } else { GameUser currentUser = new PersonalCacheStruct <GameUser>().FindKey(UserID); currentUser.UserLv = lv; currentUser.IsLv = true; } //var userGeneralList = cacheSet.FindAll(userID, m => m.IsUserGeneral); //foreach (UserGeneral general in userGeneralList) //{ // general.GeneralLv = lv; // //general.Update(); //} }
public override bool TakeAction() { UserGeneral general = new PersonalCacheStruct <UserGeneral>().FindKey(Uid, _generalID); if (general != null) { var package = UserItemPackage.Get(Uid); _userItemArray = package.ItemPackage.FindAll( u => { var itemInfo = new UserItemHelper(u); return(!u.IsRemove && itemInfo.EquPartsID == _equParts && itemInfo.DemandLv <= general.GeneralLv && //u.ItemLv <= general.GeneralLv && u.ItemStatus.ToEnum <ItemStatus>() != ItemStatus.YongBing && //点击装备或者更换装备的时候,在筛选时去掉已经装备 itemInfo.CheckCareer(general.CareerID)); }); _userItemArray.QuickSort((a, b) => a.CompareTo(b)); } //var package = UserItemPackage.Get(Uid); //_userItemArray = package.ItemPackage.FindAll(s=>s.ItemType==ItemType.ZhuangBei); return(true); }
/// <summary> /// 多人副本获胜加一次 /// </summary> /// <param name="userID"></param> /// <param name="plotID"></param> public static void DailyMorePlotRestrainNum(string userID, int plotID) { UserDailyRestrain dailyRestrain = new PersonalCacheStruct <UserDailyRestrain>().FindKey(userID); if (dailyRestrain != null && dailyRestrain.UserExtend != null) { FunPlot plot = new FunPlot(); plot.PlotID = plotID; plot.Num = 1; plot.MoreDate = DateTime.Now; dailyRestrain.UserExtend.UpdateNotify(obj => { if (dailyRestrain.UserExtend.MorePlot == null) { dailyRestrain.UserExtend.MorePlot = new CacheList <FunPlot>(); } dailyRestrain.UserExtend.MorePlot.Add(plot); return(true); }); //dailyRestrain.Update(); } }
public override bool TakeAction() { if (requestPack.UserID <= 0) { var persionCache = new PersonalCacheStruct <GameUser>(); GameUser gu = new GameUser(); gu.UserId = (int)persionCache.GetNextNo(); gu.CreateTime = System.DateTime.Now; gu.CompensationDate = gu.CreateTime; gu.NickName = ""; gu.Identify = requestPack.identify; gu.version = "1.09"; persionCache.Add(gu); // theUserId = gu.UserId; } else { theUserId = requestPack.UserID; } version = requestPack.version; //ConsoleLog.showErrorInfo(0, "acton1005:userid:"+requestPack.UserID+"#version:"+requestPack.version); if (requestPack.typeUser == "YYS_CP360") { Pay360(); } else if (requestPack.typeUser == "YYS_BaiDu") { PayBaiDu(); } else { responsePack.errorCode = (byte)Response1005Pack.EnumErrorCode.not_find_typeUser; } return(true); }
private void PlotLsit() { var cacheSet = new PersonalCacheStruct <UserPlotPackage>(); var userPlotPack = cacheSet.FindKey(ContextUser.UserID); var plotPackList = userPlotPack != null ? userPlotPack.PlotPackage : null; var cityInfoList = new ShareCacheStruct <CityInfo>().FindAll(); foreach (var cityInfo in cityInfoList) { var plotInfoList = _cacheSetPlot.FindAll(s => s.CityID == cityInfo.CityID && s.PlotType == plotType); foreach (var plotInfo in plotInfoList) { var plotPack = plotPackList != null?plotPackList.Find(s => s.PlotID == plotInfo.PlotID) : null; if (plotPack != null) { if (_cityInfoList.Find(s => s.CityID == cityInfo.CityID) == null) { _cityInfoList.Add(cityInfo); } if (plotPack.RefleshDate.Date != DateTime.Now.Date) { plotPack.UpdateNotify(obj => { plotPack.RefleshDate = DateTime.Now; plotPack.PlotNum = 0; return(true); }); } //break; } } } }
/// <summary> /// 天地劫挑战次数 /// </summary> /// <param name="plotNPCInfo"></param> private void KalpaDailyRestrain(PlotNPCInfo plotNPCInfo) { var cacheSet = new PersonalCacheStruct <UserDailyRestrain>(); UserDailyRestrain userRestrain = cacheSet.FindKey(Uid); if (userRestrain == null) { userRestrain = new UserDailyRestrain() { UserID = Uid }; cacheSet.Add(userRestrain); userRestrain = cacheSet.FindKey(Uid); } if (userRestrain.UserExtend == null) { userRestrain.UserExtend = new DailyUserExtend(); //userRestrain.UserExtend.KalpaPlot = new List<FunPlot>(); } int plotNum = 0; FunPlot funPlot = userRestrain.UserExtend.KalpaPlot.Find(m => m.PlotID == plotNPCInfo.PlotID); if (funPlot == null) { plotNum = 1; funPlot = new FunPlot { PlotID = plotNPCInfo.PlotID, Num = plotNum }; userRestrain.UserExtend.UpdateNotify(obj => { userRestrain.UserExtend.KalpaPlot.Add(funPlot); return(true); }); } }
public void ChangedKeyOfChar() { var watch = Stopwatch.StartNew(); int fuserId = 1000; var cache = new PersonalCacheStruct <UserFriend>(); long userId = -cache.GetNextNo(); var t = PersonalCacheStruct.Get <UserFriend>(userId.ToString(), true); if (t == null) { Assert.IsTrue(cache.Add(new UserFriend() { UserId = userId, Name = "kaikai" })); Trace.WriteLine("create id:" + userId); } Assert.IsNotNull(t = cache.Find(userId.ToString(), m => true)); Assert.IsNotNull(cache.FindAll(userId.ToString(), m => true)); Assert.IsNotNull(cache.FindKey(userId.ToString())); t.Friends.Add(new FriendsData() { UserId = fuserId, Num = 1 }); t.FriendDict.Add(fuserId, new FriendsData() { UserId = fuserId, Num = 1 }); UserFriend entity; Assert.IsTrue(cache.TryFindKey(userId.ToString(), out entity) == LoadingStatus.Success); Assert.IsNotNull(cache.TryFind(userId.ToString(), m => true, out entity) == LoadingStatus.Success); cache.ReLoad(userId.ToString()); Assert.IsTrue(cache.ChildrenItem.Any()); WaitEnd(watch); }
public override bool TakeAction() { if (ops == 1) { short onlineEnergy; if (NoviceHelper.OnlinePrize(ContextUser, out _takeNum, out _coldTime, out onlineEnergy)) { ErrorInfo = string.Format(LanguageManager.GetLang().St1013_JingliPrize, onlineEnergy); } } else if (ops == 2) { if (NoviceHelper.DailyEnergy(ContextUser.UserID)) { UserDailyRestrain dailyRestrain = new PersonalCacheStruct <UserDailyRestrain>().FindKey(ContextUser.UserID); if (dailyRestrain != null) { short dailyEnergyNum = (short)ConfigEnvSet.GetInt("DailyEnergyNum"); if (dailyRestrain.Funtion15.Date != DateTime.Now) { dailyRestrain.Funtion15 = DateTime.Now; //dailyRestrain.Update(); ContextUser.SurplusEnergy = dailyEnergyNum; //ContextUser.Update(); ErrorInfo = string.Format(LanguageManager.GetLang().St1013_DailyJingliPrize, dailyEnergyNum); } } } } else if (ops == 3) { int festivalEnergy = NoviceHelper.AugustSecondWeekEnergy(ContextUser); ErrorInfo = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, LanguageManager.GetLang().St_AugustSecondWeek, string.Format(LanguageManager.GetLang().St_EnergyNum, festivalEnergy)); } return(true); }
public override bool TakeAction() { UserTrump userTrump = new PersonalCacheStruct <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID); if (userTrump != null) { worshipLv = userTrump.WorshipLv; short upWorshLv = MathUtils.Addition(userTrump.WorshipLv, (short)1, (short)10); totalNum = userTrump.PropertyInfo.Count; worshipInfo = new ShareCacheStruct <WorshipInfo>().FindKey(TrumpInfo.CurrTrumpID, upWorshLv); if (worshipInfo != null) { successNum = TrumpHelper.GetTransformData(worshipInfo.SuccessNum); int upItemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, worshipInfo.ItemID); if (upItemNum >= worshipInfo.ItemNum) { isItem = 1; } if (ContextUser.GameCoin >= worshipInfo.GameCoin) { isCoin = 1; } if (ContextUser.ObtainNum >= worshipInfo.ObtainNum) { isObtain = 1; } ItemBaseInfo itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(worshipInfo.ItemID); if (itemInfo != null) { itemName = itemInfo.ItemName; } } } worshipInfoInfoArray = new ShareCacheStruct <WorshipInfo>().FindAll(m => m.IsOpen && m.TrumpID == TrumpInfo.CurrTrumpID).ToArray(); return(true); }
public void GetAndAddOfMutiKey() { var watch = Stopwatch.StartNew(); int userId = 138001; var cache = new PersonalCacheStruct <UserKeyData>(); cache.AddOrUpdate(new UserKeyData() { UserId = userId, Key = "4", Value = "aa" }); var list = cache.FindAll(userId.ToString()); Assert.IsTrue(list.Count > 0); Trace.WriteLine("data count:" + list.Count); var key = userId + cache.GetNextNo(); cache.Add(new UserKeyData() { UserId = key.ToInt(), Key = "4", Value = "aa" }); Assert.IsNotNull(cache.FindKey(key.ToString(), key, "4")); WaitEnd(watch); }
/// <summary> /// 公会技能升级 /// </summary> public static void UpGuildAbilityLv(string guildID, GuildAbility ability) { var memberArray = new ShareCacheStruct <GuildMember>().FindAll(m => m.GuildID == guildID); foreach (GuildMember member in memberArray) { GameUser user = new PersonalCacheStruct <GameUser>().FindKey(member.UserID); if (user == null) { user = UserCacheGlobal.CheckLoadUser(member.UserID); } if (user != null && !string.IsNullOrEmpty(user.MercenariesID)) { UserGuild guild = new ShareCacheStruct <UserGuild>().FindKey(user.MercenariesID); if (guild != null && guild.AbilityInfo.Count > 0) { LoadGuildAbility(member.UserID); if (user.PropertyInfo != null && user.PropertyInfo.Count > 0) { GuildAbility guildAbility = user.PropertyInfo.Find(m => m.Type == ability.Type); if (guildAbility != null) { guildAbility.Num = ability.Num; } else { guildAbility = new GuildAbility(); guildAbility.Type = ability.Type; guildAbility.Num = ability.Num; user.PropertyInfo.Add(guildAbility); } } } } } }
/// <summary> /// 命运水晶是否已满 已满false;未满true; /// </summary> public static bool CheckFull(string userID, int num) { GameUser userInfo = new PersonalCacheStruct <GameUser>().FindKey(userID); var package = UserCrystalPackage.Get(userID); UserCrystalInfo[] crystalsArray = package.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(0)).ToArray(); //原因:当num大于0且crystalsArray.Length + num = userInfo.CrystalNum是提示背包已满 if (num > 0) { if (crystalsArray.Length + num > userInfo.CrystalNum) { return(false); } } else { if (crystalsArray.Length >= userInfo.CrystalNum) { return(false); } } return(true); }