private static void DisposeData(GameActive gameActive) { if (gameActive.LoadSuccess) { gameActive.LoadSuccess = false; if (gameActive.ActiveType == FunctionEnum.Booszhang) { BossCombat.Dispose(gameActive); } else if (gameActive.ActiveType == FunctionEnum.Lintuzhang) { CountryCombat.Dispose(gameActive); } else if (gameActive.ActiveType == FunctionEnum.Multiplot) { PlotTeamCombat.Dispose(gameActive); } else if (gameActive.ActiveType == FunctionEnum.MorePlotCoin) { PlotTeamCombat.Dispose(gameActive); } else if (gameActive.ActiveType == FunctionEnum.MorePlotEnergy) { PlotTeamCombat.Dispose(gameActive); } } }
public override bool TakeAction() { BossCombat bossCombat = new BossCombat(_activeId); CombatGeneral boss = bossCombat.Boss; if (boss != null) { CurrLifeNum = boss.LifeNum; MaxLifeNum = boss.LifeMaxNum; } return true; }
private static void LoadData(GameActive gameActive) { if ((gameActive.CombatStatus == CombatStatus.Wait || gameActive.CombatStatus == CombatStatus.Combat) && !gameActive.LoadSuccess) { if (!string.IsNullOrEmpty(gameActive.Broadcast)) { var broadcastService = new TjxBroadcastService(null); var msg = broadcastService.Create(NoticeType.Game, gameActive.Broadcast); if (gameActive.ActiveId == 11) { int invertal = (int)new TimeSpan(0, 0, gameActive.WaitMinutes, 0).TotalSeconds / 5; string startTime = DateTime.Now.ToString("HH:mm:ss"); string endTime = DateTime.Now.AddMinutes(gameActive.WaitMinutes).ToString("HH:mm:ss"); broadcastService.SendTimer(msg, startTime, endTime, true, invertal);//秒 } else { broadcastService.Send(msg); } } gameActive.LoadSuccess = true; if (gameActive.ActiveType == FunctionEnum.Booszhang) { BossCombat.InitBoss(gameActive); } else if (gameActive.ActiveType == FunctionEnum.Lintuzhang) { CountryCombat.Init(gameActive); } else if (gameActive.ActiveType == FunctionEnum.Multiplot) { PlotTeamCombat.Init(gameActive); } else if (gameActive.ActiveType == FunctionEnum.MorePlotCoin) { PlotTeamCombat.Init(gameActive); } else if (gameActive.ActiveType == FunctionEnum.MorePlotEnergy) { PlotTeamCombat.Init(gameActive); } } }
public override bool TakeAction() { BossCombat bossCombat = new BossCombat(_activeId); GameActive gameActive = bossCombat.GameActive; CombatStatus combatStatus = gameActive.RefreshStatus(); if (combatStatus == CombatStatus.Killed || CombatHelper.IsBossKill(_activeId)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return false; } else if (combatStatus == CombatStatus.Wait) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5405_CombatWait; return false; } else if (combatStatus == CombatStatus.Over) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5405_CombatOver; return false; } else if (combatStatus == CombatStatus.Combat) { var cuser = bossCombat.GetCombatUser(Uid); if (cuser != null && cuser.CodeTime > 0) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5402_IsReliveError; return false; } var boss = bossCombat.Boss; if (boss.IsOver) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return false; } lock (thisLock) { if (boss.IsOver) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return false; } IsWin = bossCombat.Combat(ContextUser, bossProcess); } _userTalPriority = CombatHelper.TotalPriorityNum(ContextUser.UserID, 0); _npcTalPriority = 0; } else { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart; return false; } selfAbilityEffectList = UserAbilityHelper.GetSelfAbilityEffectList(ContextUser.UserID, 0); return true; }
public override bool TakeAction() { if (CombatHelper.IsBossKill(_activeId)) { this.ErrorCode = 1; this.ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return false; } BossCombat bossCombat = new BossCombat(_activeId); _gameActive = bossCombat.GameActive; CombatStatus combatStatus = _gameActive.RefreshStatus(); if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat) { bossCombat.Append(ContextUser); BossUser bossUser = bossCombat.GetCombatUser(Uid); if (bossUser != null) { _inspirePercent = bossUser.InspirePercent; _reliveInspirePercent = bossUser.ReliveInspirePercent; _reLiveNum = bossUser.ReliveNum; _combatNum = bossUser.CombatNum; _damageNum = bossUser.DamageNum; _codeTime = bossUser.CodeTime; } } List<BossUser> userList = bossCombat.GetCombatUser(); _regNum = userList.Count; int recordCount = 0; _bossUserList = userList.GetPaging(_pageIndex, _pageSize, out recordCount); CombatGeneral boss = bossCombat.Boss; if (boss != null) { _bossLiftNum = boss.LifeNum; _bossMaxLift = boss.LifeMaxNum; } 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 bool TakeAction() { if (ContextUser.VipLv < 3) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnough; 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; if (ops == 1) { this.ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireTip, ExpNum); } else if (ops == 2) { if (ContextUser.ExpNum < ExpNum) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_ExpNumNotEnough; return false; } if (!bossCombat.Inspire(Uid, false, out inspirePercent)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_InspireFailed; } ContextUser.ExpNum = MathUtils.Subtraction(ContextUser.ExpNum, ExpNum, 0); //ContextUser.Update(); } else if (ops == 3) { this.ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireGoldTip, GlodNum); } else if (ops == 4) { if (ContextUser.GoldNum < GlodNum) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return false; } if (!bossCombat.Inspire(Uid, true, out inspirePercent)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_InspireFailed; } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GlodNum, int.MaxValue); //ContextUser.Update(); } return true; }
public override bool TakeAction() { if (_isCurr == 0) { var bossFirst = ServerEnvSet.Get(ServerEnvKey.FirstHalfBoss, 0); if (!string.IsNullOrEmpty(bossFirst)) { int total; var tempList = JsonUtils.Deserialize<List<BossUser>>(bossFirst); if (tempList != null && tempList.Count > 0) { _bossUserList = tempList.GetPaging(1, Top, out total); _rankingNo = tempList.FindIndex(m => m.UserId == Uid) + 1; var killUserId = ServerEnvSet.GetInt(ServerEnvKey.KillBossUserID, 0); var killUser = tempList.Find(t => t.UserId == killUserId.ToString()); if (killUser != null) { _damageNum = killUser.DamageNum; _nickName = killUser.NickName; var userEntity = new GameDataCacheSet<GameUser>().FindKey(killUserId.ToString()); if (userEntity != null) { _userLv = userEntity.UserLv; } } } } } else if (_isCurr == 1) { BossCombat bossCombat = new BossCombat(_activeId); GameActive gameActive = bossCombat.GameActive; if (gameActive == null) { return true; } CombatStatus combatStatus = gameActive.CombatStatus; if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat) { int total; var tempList = bossCombat.RefreshRanking(); _bossUserList = tempList.GetPaging(1, Top, out total); _rankingNo = tempList.FindIndex(m => m.UserId == Uid) + 1; var killUserId = ServerEnvSet.GetInt(ServerEnvKey.KillBossUserID, 0); var killUser = tempList.Find(t => t.UserId == killUserId.ToString()); if (killUser != null) { _damageNum = killUser.DamageNum; _nickName = killUser.NickName; var userEntity = new GameDataCacheSet<GameUser>().FindKey(killUserId.ToString()); if (userEntity != null) { _userLv = userEntity.UserLv; } } } } return true; }