public UserGuild() : base(AccessLevel.ReadWrite) { GuildBossInfo = new GuildBossInfo(); AbilityInfo = new CacheList<GuildAbility>(); GuildExercise = new GuildExercise(); }
public static short GetBossDateType(GuildBossInfo bossInfo) { if (bossInfo != null) { if (UserHelper.IsCurrentWeek(bossInfo.RefreshDate)) { return (short)bossInfo.EnableWeek; } } return (short)0; }
public override bool TakeAction() { UserGuild guild = new ShareCacheStruct<UserGuild>().FindKey(ContextUser.MercenariesID); if (guild != null) { GuildMember member = new ShareCacheStruct<GuildMember>().FindKey(ContextUser.MercenariesID, ContextUser.UserID); if (member == null || member.PostType != PostType.Chairman) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6008_NotChairman; return false; } GameActive active = new ShareCacheStruct<GameActive>().FindKey(UserGuild.ActiveID); List<BossDate> bossDateList = UserHelper.GetBossDate().FindAll(u => u.EnableWeek == dateType); GuildBossInfo guildBossInfo = guild.GuildBossInfo; if (bossDateList.Count > 0) { BossDate bossDate = bossDateList[0]; if (guildBossInfo != null) { if (guildBossInfo.RefreshDate != MathUtils.SqlMinDate) { if (UserHelper.IsCurrentWeek(guild.GuildBossInfo.RefreshDate)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6109_GuildBossTime; return false; } } if (guildBossInfo.BossLv == 0) { guildBossInfo.BossLv = (short)active.BossLv; } guildBossInfo.IsKill = false; guildBossInfo.EnablePeriod = bossDate.EnablePeriod; guildBossInfo.EnableWeek = (int)dateType; guildBossInfo.RefreshDate = DateTime.Now; guild.GuildBossInfo = guildBossInfo; //guild.Update(); } else { guildBossInfo=new GuildBossInfo(); guildBossInfo.IsKill = false; guildBossInfo.BossLv = (short)active.BossLv; guildBossInfo.EnablePeriod = bossDate.EnablePeriod; guildBossInfo.EnableWeek = (int) dateType; guildBossInfo.RefreshDate = DateTime.Now; guild.GuildBossInfo = guildBossInfo; //guild.Update(); } } } return true; }
/// <summary> /// 公会boss挑战时间 /// </summary> /// <param name="bossInfo"></param> /// <returns></returns> public static DateTime GuildBossDate(GuildBossInfo bossInfo) { BossDateType bossDateType = (BossDateType)Enum.Parse(typeof(BossDateType), bossInfo.EnableWeek.ToString()); DateTime weekDateTime = GetDateTime(bossDateType).Date; DateTime mdate = bossInfo.EnablePeriod.ToDateTime(); return weekDateTime.AddHours(mdate.Hour).AddMinutes(mdate.Minute); }
/// <summary> /// 公会boss挑战时间 /// </summary> /// <param name="bossInfo"></param> /// <returns></returns> public static DateTime GuildBossDate(GuildBossInfo bossInfo) { BossDateType bossDateType = (BossDateType)Enum.Parse(typeof(BossDateType), bossInfo.EnableWeek.ToString()); string weekDateTime = GetDateTime(bossDateType).ToString("d"); string hourDate = DateTime.Parse(bossInfo.EnablePeriod).ToString("T"); string currDate = weekDateTime + " " + hourDate; DateTime priod = DateTime.Parse(currDate); return priod; }
protected override object this[string index] { get { #region switch (index) { case "GuildID": return GuildID; case "GuildName": return GuildName; case "UserID": return UserID; case "GuildLv": return GuildLv; case "GuildRank": return GuildRank; case "CurrExperience": return CurrExperience; case "WeekExperience": return WeekExperience; case "Announcement": return Announcement; case "GuildDesc": return GuildDesc; case "CreateDate": return CreateDate; case "GuildBossInfo": return GuildBossInfo; case "AddMember": return AddMember; case "CurrDonateNum": return CurrDonateNum; case "AbilityInfo": return AbilityInfo; case "GuildExercise": return GuildExercise; default: throw new ArgumentException(string.Format("UserGuild index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "GuildID": _GuildID = value.ToNotNullString(); break; case "GuildName": _GuildName = value.ToNotNullString(); break; case "UserID": _UserID = value.ToNotNullString(); break; case "GuildLv": _GuildLv = value.ToShort(); break; case "GuildRank": _GuildRank = value.ToInt(); break; case "CurrExperience": _CurrExperience = value.ToInt(); break; case "WeekExperience": _WeekExperience = value.ToInt(); break; case "Announcement": _Announcement = value.ToNotNullString(); break; case "GuildDesc": _GuildDesc = value.ToNotNullString(); break; case "CreateDate": _CreateDate = value.ToDateTime(); break; case "GuildBossInfo": _GuildBossInfo = ConvertCustomField<GuildBossInfo>(value, index); break; case "AddMember": _AddMember = value.ToInt(); break; case "CurrDonateNum": _CurrDonateNum = value.ToInt(); break; case "AbilityInfo": _AbilityInfo = ConvertCustomField<CacheList<GuildAbility>>(value, index); break; case "GuildExercise": _GuildExercise = ConvertCustomField<GuildExercise>(value, index); break; default: throw new ArgumentException(string.Format("UserGuild index[{0}] isn't exist.", index)); } #endregion } }