public static void SelectNew() { Boss = string.Empty; #if DEBUG Cooldown = DateTimeOffset.Now.AddSeconds(5); #else Cooldown = DateTimeOffset.Now.AddSeconds(CooldownLength); #endif BossEvent.Start(); }
public static void ShatterBoss() { if (!BossEvent.Started && BossEvent.ChanceAction.Invoke()) { SelectNew(); } else if (BossEvent.Started && BossEvent.Part.Any() && Cooldown < DateTimeOffset.Now) { BossEvent.End(); } }
public virtual void StartPhase() { Debug.Log("starting a boss phase"); sequenceEnded = false; if (eventSequence.Length > 0) { currentEventId = 0; currentEvent = eventSequence[currentEventId]; currentEvent.StartEvent(); } }
public virtual void UpdatePhase(bool interrupt) { bool ret = currentEvent.UpdateEvent(); if (ret) { return; } if (!interrupt) { if (!sequenceEnded) { currentEvent.TerminateEvent(); currentEventId = (currentEventId + 1); if (currentEventId < eventSequence.Length) { currentEvent = eventSequence[currentEventId]; currentEvent.StartEvent(); } else { currentEventId = 0; sequenceEnded = true; currentEvent = eventsLoop [currentEventId]; currentEvent.StartEvent(); } } else { currentEvent.TerminateEvent(); currentEventId = (currentEventId + 1) % eventsLoop.Length; currentEvent = eventsLoop[currentEventId]; currentEvent.StartEvent(); } } else { currentEvent.TerminateEvent(); currentEvent = armAttackEvent; currentEvent.StartEvent(); } }
void OnRequestRaidRankingReceived(ClientPeer peer, OperationRequest operationRequest, SendParameters sendParameters) { var workRankingList = MongoHelper.RaidRankingCollection.GetAllSorting( ).GetAwaiter( ); workRankingList.OnCompleted(() => { var rankingDataList = workRankingList.GetResult( ); if (rankingDataList == null || rankingDataList.Count == 0) { RaidRankingData data = CreateRaidRankingData(peer); var workRankingAdd = MongoHelper.RaidRankingCollection.Add(data).GetAwaiter( ); workRankingAdd.OnCompleted(() => { RankingEvent.OnUpdateRaidRanking(peer, data, null, new List <RaidRankingData> { data }); BossEvent.OnUpdateRaidBoss(peer, 16); }); return; } // TODO : 보스 디졌는지 안디졌는지 확인 var myRankingData = rankingDataList.Find(x => x.Key.Equals(peer.Id)); var lastHitData = rankingDataList.Find(x => x.LastHit == true); if (myRankingData == null) { myRankingData = CreateRaidRankingData(peer); var workRankingAdd = MongoHelper.RaidRankingCollection.Add(myRankingData).GetAwaiter( ); workRankingAdd.OnCompleted(() => { rankingDataList.Add(myRankingData); RankingEvent.OnUpdateRaidRanking(peer, myRankingData, lastHitData, rankingDataList); BossEvent.OnUpdateRaidBoss(peer, 16); }); } else { RankingEvent.OnUpdateRaidRanking(peer, myRankingData, lastHitData, rankingDataList); BossEvent.OnUpdateRaidBoss(peer, 16); } }); }
void OnEnterContentReceived(ClientPeer peer, OperationRequest operationRequest, SendParameters sendParameters) { OperationResponse response = new OperationResponse((byte)OperationCode.EnterContent); if (TheLordServer.Instance.bossDataList.Count == 0) { response.ReturnCode = (short)ReturnCode.Failed; peer.SendOperationResponse(response, sendParameters); return; } var bossData = TheLordServer.Instance.bossDataList[0]; response.ReturnCode = bossData.HP > 0 ? (short)ReturnCode.Success : (short)ReturnCode.Failed; if (response.ReturnCode == (short)ReturnCode.Failed) { BossEvent.OnUpdateRaidBoss(peer, 16); } peer.SendOperationResponse(response, sendParameters); }
void OnResultRaidRankingReceived(ClientPeer peer, OperationRequest operationRequest, SendParameters sendParameters) { if (TheLordServer.Instance.bossDataList.Count == 0) { return; } var data = BinSerializer.ConvertData <ProtoData.RaidRankingScoreData> (operationRequest.Parameters); TheLordServer.Log.InfoFormat("{0}의 플레이어가 {1}의 피해를 입혔습니다.", peer.userAgent.UserData.Info.Nickname, data.score); var workRankingScore = MongoHelper.RaidRankingCollection.Get(peer.Id).GetAwaiter( ); workRankingScore.OnCompleted(() => { var rankingScore = workRankingScore.GetResult( ); TheLordServer.Instance.bossDataList[0].HP -= data.score; if (TheLordServer.Instance.bossDataList[0].HP <= 0F) { rankingScore.LastHit = true; BossEvent.OnExitRaidBoss( ); } else { foreach (var building in peer.userAgent.BuildingDataList) { int amount = building.CharactertData.Amount; int subract = (int)Math.Ceiling(amount * 0.66F); building.CharactertData.Amount = Math.Max(0, amount - subract); } } rankingScore.Score += data.score; var workUpdateRankingScore = MongoHelper.RaidRankingCollection.Update(rankingScore).GetAwaiter(); workUpdateRankingScore.OnCompleted(() => { }); }); }
/// <summary> /// Clear commands pool /// </summary> public static void ClearPool() { Commands.Clear(); BossEvent.End(); }
void ResetRaid() { TheLordServer.Log.Info("레이드 보스 리셋 시작"); var bossData = TheLordServer.Instance.bossDataList[0]; var sheet = TheLordTable.Instance.CharacterTable.CharacterInfoSheet; var record = BaseTable.Get(sheet, "index", RaidBossIndex); bossData.HP = (int)(float)record["hp"]; bossData.CreateTime += bossRemainTime; var workRankingList = MongoHelper.RaidRankingCollection.GetAllSorting( ).GetAwaiter( ); workRankingList.OnCompleted(() => { var result = workRankingList.GetResult( ); var lastHitPlayer = result.Find(x => x.LastHit == true); if (lastHitPlayer != null) { lastHitPlayer.Tier = (int)TierType.God; } const int legend = 1; const int Master = 3; const int Diamond = 5; const int Platinum = 10; const int Gold = 20; const int Silver = 40; const int Bronze = 80; const int Iron = 200; for (int i = 0; i < result.Count; ++i) { if (result[i].Score <= 0) { } else if (i < legend) { result[i].Tier = (int)TierType.Lengend > result[i].Tier ? (int)TierType.Lengend : result[i].Tier; } else if (i < Master) { result[i].Tier = (int)TierType.Master > result[i].Tier ? (int)TierType.Master : result[i].Tier; } else if (i < Diamond) { result[i].Tier = (int)TierType.Diamond > result[i].Tier ? (int)TierType.Diamond : result[i].Tier; } else if (i < Platinum) { result[i].Tier = (int)TierType.Platinum > result[i].Tier ? (int)TierType.Platinum : result[i].Tier; } else if (i < Gold) { result[i].Tier = (int)TierType.Gold > result[i].Tier ? (int)TierType.Gold : result[i].Tier; } else if (i < Silver) { result[i].Tier = (int)TierType.Silver > result[i].Tier ? (int)TierType.Silver : result[i].Tier; } else if (i < Bronze) { result[i].Tier = (int)TierType.Bronze > result[i].Tier ? (int)TierType.Bronze : result[i].Tier; } else if (i < Iron) { result[i].Tier = (int)TierType.Iron > result[i].Tier ? (int)TierType.Iron : result[i].Tier; } else { if (result[i].Score > 0) { result[i].Tier = (int)TierType.Challanger > result[i].Tier ? (int)TierType.Challanger : result[i].Tier; } } result[i].Score = 0; result[i].LastHit = false; var workUpdateRankingScore = MongoHelper.RaidRankingCollection.Update(result[i]).GetAwaiter( ); workUpdateRankingScore.OnCompleted(() => { }); } foreach (var client in TheLordServer.Instance.PeerList) { if (client.userAgent.UserData == null) { continue; } var myRanking = result.Find(x => x.Key == client.Id); if (client.userAgent.UserAssetData != null) { client.userAgent.UserAssetData.Tier = myRanking.Tier; } RankingEvent.OnUpdateRaidRanking(client, myRanking, null, result); BossEvent.OnUpdateRaidBoss(client, 16); } }); UpdateBoss( ); }