private void RefEnableTime(GameActive gameActive, ref DateTime enableTime, ref DateTime endTime, ref short isEnable) { try { gameActive = gameActive ?? new GameActive(); if (gameActive.ActiveType == FunctionEnum.Gonghui && !string.IsNullOrEmpty(ContextUser.MercenariesID)) { if (gameActive.ActiveId == UserGuild.ActiveID) { enableTime = guildBossDate(ContextUser.MercenariesID); endTime = enableTime.AddMinutes(gameActive.Minutes); guild.GuildBossRefreshStatus(); //gameActive.RefreshStatus(); if (guild.CombatStatus == CombatStatus.Wait || guild.CombatStatus == CombatStatus.Combat) { isEnable = 1; } else if (guild.CombatStatus == CombatStatus.Over) { isEnable = 2;//已结束 } else if (guild.CombatStatus == CombatStatus.Killed) { isEnable = 3;//已被击杀 } if (guild.GuildBossInfo != null && !UserHelper.IsCurrentWeek(guild.GuildBossInfo.RefreshDate)) { isEnable = 2; } } else { enableTime = gameActive.BeginTime.ToDateTime(DateTime.MinValue); DateTime intervalDate = gameActive.BeginTime.AddMinutes(gameActive.WaitMinutes); endTime = enableTime.AddMinutes(gameActive.Minutes); if (gameActive.ActiveId == 11 && intervalDate < DateTime.Now && DateTime.Now < endTime) { isEnable = 4; //置灰 } else { if (DateTime.Now < enableTime) { isEnable = 0; } else if (DateTime.Now > endTime) { isEnable = 2; } else { isEnable = 1; } } } } else { endTime = gameActive.EndTime; enableTime = gameActive.BeginTime; gameActive.RefreshStatus(); if (gameActive.CombatStatus == CombatStatus.Wait || gameActive.CombatStatus == CombatStatus.Combat) { isEnable = 1; } else if (gameActive.CombatStatus == CombatStatus.Over) { isEnable = 2;//已结束 } else if (gameActive.CombatStatus == CombatStatus.Killed) { isEnable = 3;//已被击杀 } } } catch (Exception ex) { SaveLog(ex); } }
public override bool TakeAction() { if (!string.IsNullOrEmpty(ContextUser.MercenariesID) && ContextUser.MercenariesID == guildID) { if (CombatHelper.GuildBossKill(ContextUser.MercenariesID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return(false); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); GameActive gameActive = new ShareCacheStruct <GameActive>().FindKey(_activeId); if (gameActive != null) { bossPlotID = gameActive.BossPlotID; GuildBossCombat bossCombat = new GuildBossCombat(guildID); if (bossCombat.HasCombat) { _guild = bossCombat.UserGuild; if (_guild != null && _guild.GuildBossInfo != null) { if (_guild.GuildBossInfo.EnableWeek > 0 && _guild.GuildBossInfo.BossLv > 0) { _guild.BeginTime = UserHelper.GuildBossDate(_guild.GuildBossInfo); _guild.EndTime = _guild.BeginTime.AddMinutes(gameActive.Minutes); CombatStatus combatStatus = _guild.GuildBossRefreshStatus(); if (UserHelper.IsCurrentWeek(_guild.BeginTime) && UserHelper.IsCurrentWeek(_guild.GuildBossInfo.RefreshDate)) { if (DateTime.Now < _guild.BeginTime) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossNotOpen; return(false); } else if ((combatStatus == CombatStatus.Killed && DateTime.Now < _guild.EndTime) || DateTime.Now > _guild.EndTime) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossOver; return(true); } } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet; return(false); } if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat) { bossCombat.Append(ContextUser); BossUser bossUser = bossCombat.GetCombatUser(ContextUser.UserID); if (bossUser != null) { _inspirePercent = bossUser.InspirePercent; _reliveInspirePercent = bossUser.ReliveInspirePercent; _reLiveNum = bossUser.ReliveNum; } } List <BossUser> userList = bossCombat.GetCombatUser(); _regNum = userList.Count; int recordCount = 0; _bossUserList = userList.GetPaging(_pageIndex, _pageSize, out recordCount); } } } else { UserGuild guild = new ShareCacheStruct <UserGuild>().FindKey(ContextUser.MercenariesID); if (guild != null && guild.GuildBossInfo != null) { if (guild.GuildBossInfo.EnableWeek > 0 && guild.GuildBossInfo.BossLv > 0) { guild.BeginTime = UserHelper.GuildBossDate(guild.GuildBossInfo); guild.EndTime = guild.BeginTime.AddMinutes(gameActive.Minutes); if (UserHelper.IsCurrentWeek(guild.BeginTime) && UserHelper.IsCurrentWeek(guild.GuildBossInfo.RefreshDate)) { if (DateTime.Now < guild.BeginTime.AddMinutes(1)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossNotOpen; return(false); } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossOver; return(true); } } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet; return(false); } } } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet; return(false); } } } stopwatch.Stop(); new BaseLog().SaveLog("公会boss6101所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms"); } return(true); }