/// <summary> /// 公会祈祷 /// </summary> /// <param name="user"></param> /// <returns></returns> public static HelperInfo GetDailyPrayer(GameUser user) { int currPayNum = 1; int maxNum = 0; if (!string.IsNullOrEmpty(user.MercenariesID)) { maxNum = 1; GuildMemberLog memberLog = new ShareCacheStruct <GuildMemberLog>().FindKey(user.MercenariesID); if (memberLog != null) { List <MemberLog> guildArray = memberLog.GetLog(m => m.LogType == 2 && m.UserID.Equals(user.UserID)); foreach (MemberLog guildLog in guildArray) { if (DateTime.Now.Date == guildLog.InsertDate.Date) { currPayNum = MathUtils.Subtraction(currPayNum, 1, 0); break; } } } } else { currPayNum = 0; maxNum = 0; } return(new HelperInfo() { Type = RestrainType.Prayer, SurplusNum = currPayNum, TotalNum = maxNum }); }
public override bool TakeAction() { List <GuildMember> guildArray = new ShareCacheStruct <GuildMember>().FindAll(m => m.UserID == ContextUser.UserID); if (guildArray.Count > 0) { var memberLog = new ShareCacheStruct <GuildMemberLog>().FindKey(guildArray[0].GuildID) ?? new GuildMemberLog(); var userGuildLogArray = memberLog.GetLog(null); userGuildLogArray.QuickSort((x, y) => { if (x == null && y == null) { return(0); } if (x != null && y == null) { return(1); } if (x == null) { return(-1); } return(y.InsertDate.CompareTo(x.InsertDate)); }); guildLogArray = userGuildLogArray.GetPaging(pageIndex, pageSize, out pageCount); } return(true); }
public override bool TakeAction() { if (string.IsNullOrEmpty(ContextUser.MercenariesID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6011_GuildMemberNotMember; return(false); } idolInfo = new ShareCacheStruct <GuildIdol>().FindKey(guildID); if (idolInfo != null) { maxAura = new ConfigCacheSet <IdolLvInfo>().FindKey(idolInfo.IdolLv).UpExperience; } idolInfoArray = new ConfigCacheSet <GuildIdolInfo>().FindAll(); var memberLog = new ShareCacheStruct <GuildMemberLog>().FindKey(guildID) ?? new GuildMemberLog(); List <MemberLog> guildArray = memberLog.GetLog(u => u.LogType == 2); foreach (MemberLog guildLog in guildArray) { if (guildLog.UserID == ContextUser.UserID && DateTime.Now.Date == guildLog.InsertDate.Date) { isXs = 2; break; } } guildArray.QuickSort((x, y) => { if (x == null && y == null) { return(0); } if (x != null && y == null) { return(1); } if (x == null) { return(-1); } return(y.InsertDate.CompareTo(x.InsertDate)); }); int recordCount = 0; guildLogArray = guildArray.GetPaging(0, guildArray.Count > 5 ? 5 : guildArray.Count, out recordCount); return(true); }
public override bool TakeAction() { UserHelper.ChecheDailyContribution(ContextUser.MercenariesID, ContextUser.UserID); guild = new ShareCacheStruct <UserGuild>().FindKey(guildID); if (guild != null) { var memberLog = new ShareCacheStruct <GuildMemberLog>().FindKey(guildID) ?? new GuildMemberLog(); List <MemberLog> guildLogArray = memberLog.GetLog(null); foreach (MemberLog log in guildLogArray) { if (IsCurrentWeek(log.InsertDate)) { weekExperience = MathUtils.Addition(weekExperience, log.Experience, int.MaxValue); } } List <GuildMember> memberArray = new ShareCacheStruct <GuildMember>().FindAll(m => m.GuildID == guild.GuildID); foreach (GuildMember member in memberArray) { if (member.PostType == PostType.Chairman) { GameUser userInfo = UserCacheGlobal.CheckLoadUser(member.UserID); if (userInfo != null) { chairman = userInfo.NickName; } } if (member.UserID == ContextUser.UserID) { memberPost = (short)member.PostType; } } currPeople = memberArray.Count; GuildLvInfo guildLvInfo = new ConfigCacheSet <GuildLvInfo>().FindKey(guild.GuildLv); if (guildLvInfo != null) { int upLv = MathUtils.Addition(guild.GuildLv, (short)1, (short)GuildLvInfo.GuildMaxLv); if (new ConfigCacheSet <GuildLvInfo>().FindKey(upLv) != null) { upExperience = new ConfigCacheSet <GuildLvInfo>().FindKey(upLv).UpExperience; } maxPeople = MathUtils.Addition(guildLvInfo.MaxPeople, guild.AddMember); } } return(true); }
public override bool TakeAction() { if (string.IsNullOrEmpty(ContextUser.MercenariesID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6011_GuildMemberNotMember; return false; } idolInfo = new ShareCacheStruct<GuildIdol>().FindKey(guildID); if (idolInfo != null) { maxAura = new ShareCacheStruct<IdolLvInfo>().FindKey(idolInfo.IdolLv).UpExperience; } idolInfoArray = new ShareCacheStruct<GuildIdolInfo>().FindAll(); var memberLog = new ShareCacheStruct<GuildMemberLog>().FindKey(guildID) ?? new GuildMemberLog(); List<MemberLog> guildArray = memberLog.GetLog(u => u.LogType == 2); foreach (MemberLog guildLog in guildArray) { if (guildLog.UserID == ContextUser.UserID && DateTime.Now.Date == guildLog.InsertDate.Date) { isXs = 2; break; } } guildArray.QuickSort((x, y) => { if (x == null && y == null) return 0; if (x != null && y == null) return 1; if (x == null) return -1; return y.InsertDate.CompareTo(x.InsertDate); }); int recordCount = 0; guildLogArray = guildArray.GetPaging(0, guildArray.Count > 5 ? 5 : guildArray.Count, out recordCount); 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 ConfigCacheSet<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 GameDataCacheSet<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() { UserHelper.ChecheDailyContribution(ContextUser.MercenariesID, ContextUser.UserID); guild = new ShareCacheStruct<UserGuild>().FindKey(guildID); if (guild != null) { var memberLog = new ShareCacheStruct<GuildMemberLog>().FindKey(guildID) ?? new GuildMemberLog(); List<MemberLog> guildLogArray = memberLog.GetLog(null); foreach (MemberLog log in guildLogArray) { if (IsCurrentWeek(log.InsertDate)) { weekExperience = MathUtils.Addition(weekExperience, log.Experience, int.MaxValue); } } List<GuildMember> memberArray = new ShareCacheStruct<GuildMember>().FindAll(m => m.GuildID == guild.GuildID); foreach (GuildMember member in memberArray) { if (member.PostType == PostType.Chairman) { GameUser userInfo = UserCacheGlobal.CheckLoadUser(member.UserID); if (userInfo != null) { chairman = userInfo.NickName; } } if (member.UserID == ContextUser.UserID) { memberPost = (short)member.PostType; } } currPeople = memberArray.Count; GuildLvInfo guildLvInfo = new ConfigCacheSet<GuildLvInfo>().FindKey(guild.GuildLv); if (guildLvInfo != null) { int upLv =MathUtils.Addition(guild.GuildLv, (short)1, (short)GuildLvInfo.GuildMaxLv); if (new ConfigCacheSet<GuildLvInfo>().FindKey(upLv) != null) { upExperience = new ConfigCacheSet<GuildLvInfo>().FindKey(upLv).UpExperience; } maxPeople = MathUtils.Addition(guildLvInfo.MaxPeople, guild.AddMember); } } return true; }
/// <summary> /// 公会祈祷 /// </summary> /// <param name="user"></param> /// <returns></returns> public static HelperInfo GetDailyPrayer(GameUser user) { int currPayNum = 1; int maxNum = 0; if (!string.IsNullOrEmpty(user.MercenariesID)) { maxNum = 1; GuildMemberLog memberLog = new ShareCacheStruct<GuildMemberLog>().FindKey(user.MercenariesID); if (memberLog != null) { List<MemberLog> guildArray = memberLog.GetLog(m => m.LogType == 2 && m.UserID.Equals(user.UserID)); foreach (MemberLog guildLog in guildArray) { if (DateTime.Now.Date == guildLog.InsertDate.Date) { currPayNum = MathUtils.Subtraction(currPayNum, 1, 0); break; } } } } else { currPayNum = 0; maxNum = 0; } return new HelperInfo() { Type = RestrainType.Prayer, SurplusNum = currPayNum, TotalNum = maxNum }; }
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<GuildMember> guildArray = new ShareCacheStruct<GuildMember>().FindAll(m => m.UserID == ContextUser.UserID); if (guildArray.Count > 0) { var memberLog = new ShareCacheStruct<GuildMemberLog>().FindKey(guildArray[0].GuildID) ?? new GuildMemberLog(); var userGuildLogArray = memberLog.GetLog(null); userGuildLogArray.QuickSort((x, y) => { if (x == null && y == null) return 0; if (x != null && y == null) return 1; if (x == null) return -1; return y.InsertDate.CompareTo(x.InsertDate); }); guildLogArray = userGuildLogArray.GetPaging(pageIndex, pageSize, out pageCount); } return true; }