private void RestartStopTimers() { // (re)start/stop timers if needed if (!riftTimer.IsRunning && !IsGuardianDead) { riftTimer.Start(); } if (!guardianTimer.IsRunning && IsGuardianAlive) { guardianTimer.Start(); } if (pauseTimer.IsRunning) { pauseTimer.Stop(); } if (IsGreaterRift && IsGuardianDead && riftTimer.IsRunning) { riftTimer.Stop(); } if (IsNephalemRift && riftQuest.State == QuestState.completed && riftTimer.IsRunning) { riftTimer.Stop(); } }
private bool GamePauseTimers() { // game pause if (Hud.Game.IsPaused || (IsGreaterRift && Hud.Game.NumberOfPlayersInGame == 1 && Hud.Game.IsLoading)) { if (!pauseTimer.IsRunning) { pauseTimer.Start(); } return(true); } return(false); }
public override void Load(IController hud) { base.Load(hud); _Timer = Hud.Time.CreateWatch(); _Timer.Start(); WhichStat = 0; CurrentStatDecorator = new TopLabelDecorator(Hud) { BackgroundBrush = Hud.Render.CreateBrush(0, 255, 234, 137, 30), TextFont = Hud.Render.CreateFont("Segoe UI Light", 9, 255, 255, 234, 137, false, false, true), TextFunc = () => CurrentStats, }; }
private void TownWatches() { if (!AlwaysStopTime && !Show) { return; //if AlwaysStopTime = false: only stops time if bounty table was shown once (F6 key) } foreach (var player in Hud.Game.Players) { IWatch playerWatch = TownWatch[player.Index]; if (player.IsInTown && !playerWatch.IsRunning) { playerWatch.Start(); } else if (!player.IsInTown && playerWatch.IsRunning) { playerWatch.Stop(); } } }
public override void AfterCollect() { if (!Hud.Game.IsInGame) { return; } // game cannot be paused in multiplayer games if (Hud.Game.NumberOfPlayersInGame > 1) { return; } if (riftQuest == null || (riftQuest != null && riftQuest.State == QuestState.none)) { if (pauseTimer.ElapsedMilliseconds > 0) { pauseTimer.Stop(); //probably useless if it's a stopwatch pauseTimer.Reset(); } } // TODO : turn this into a 'IsGamePaused' helper property // TODO : check if pause is still not working when in Achievements tab var uiMenu = Hud.Render.GetUiElement("Root.NormalLayer.gamemenu_dialog.gamemenu_bkgrnd"); var uiAchievements = Hud.Render.GetUiElement("Root.NormalLayer.BattleNetAchievements_main.LayoutRoot.OverlayContainer"); if (uiMenu.Visible || uiAchievements.Visible) { if (!pauseTimer.IsRunning) { pauseTimer.Start(); } } else if (pauseTimer.IsRunning) { pauseTimer.Stop(); } //Simon.Says.Debug(pauseTimer.ElapsedMilliseconds.ToString()); }
public void PaintWorld(WorldLayer layer) { // Talking Obelisk part string ObeliskMessage = ""; int TenSeconds = ((int)(Hud.Game.CurrentRealTimeMilliseconds / 10000)) % 10; int OtherPlayers = Hud.Game.NumberOfPlayersInGame - 1; string OPSentence = ""; string GenderSentence = ""; if (OtherPlayers == 1) { OPSentence = "The other player is in town..."; } else { OPSentence = "The " + OtherPlayers + " other players are in town..."; } if (Hud.Game.Me.HeroIsMale) { GenderSentence = "Hep! ... Young lad..."; } else { GenderSentence = "Hep! ... Young lady..."; } switch (TenSeconds) { case 0: ObeliskMessage = "Close me!"; break; case 1: ObeliskMessage = OPSentence; break; case 2: ObeliskMessage = "Please!"; break; case 3: ObeliskMessage = "It's " + DateTime.Now.ToShortTimeString() + " now..."; break; case 4: ObeliskMessage = "Everybody is back!"; break; case 5: ObeliskMessage = "You can close!"; break; case 6: ObeliskMessage = "Psssst! ... " + Hud.Game.Me.Hero.Name + "!"; break; case 7: ObeliskMessage = "There's a draught from the rift!"; break; case 8: ObeliskMessage = "Close me, Nephalem!"; break; case 9: ObeliskMessage = GenderSentence; break; } var Rift = Hud.Game.Quests.FirstOrDefault(q => q.SnoQuest.Sno == 337492); var GRift = Hud.Game.Quests.FirstOrDefault(q => q.SnoQuest.Sno == 382695); GardianIsDead = false; if (Rift != null) { if (Rift.QuestStepId == 5 || Rift.QuestStepId == 10 || Rift.QuestStepId == 34 || Rift.QuestStepId == 46) { GardianIsDead = true; } } else if (GRift != null) { if (GRift.QuestStepId == 5 || GRift.QuestStepId == 10 || GRift.QuestStepId == 34 || GRift.QuestStepId == 46) { GardianIsDead = true; } } else { return; } if (PlayerInTownCount == Hud.Game.NumberOfPlayersInGame && Hud.Game.RiftPercentage == 100 && Hud.Game.IsInTown && GardianIsDead && Hud.Game.NumberOfPlayersInGame != 1) { var Obelisk = Hud.Game.Actors.FirstOrDefault(x => x.SnoActor.Sno == ActorSnoEnum._x1_openworld_lootrunportal); // 345935 if (Obelisk != null) { ObeliskClose.Paint(layer, Obelisk, Obelisk.FloorCoordinate, ObeliskMessage); } } // Current Greater rift level display part var PlayerInGreaterRift = Hud.Game.Players.FirstOrDefault(p => p.InGreaterRift); if (PlayerInGreaterRift != null && Hud.Render.GreaterRiftBarUiElement.Visible) { CurrentGRLevel = PlayerInGreaterRift.InGreaterRiftRank; var uiRect = Hud.Render.GreaterRiftBarUiElement.Rectangle; OnGoingGRLevelDecorator.Paint((int)(uiRect.Left), (int)(uiRect.Bottom / 1.060), 230, 38, HorizontalAlign.Left); } // 5% of Rift circle part CircleDecorator = new WorldDecoratorCollection( new MapShapeDecorator(Hud) { Brush = Hud.Render.CreateBrush(255, 255, 0, 0, 2), ShapePainter = new CircleShapePainter(Hud), Radius = CircleSize, } ); if ((Hud.Game.Me.InGreaterRift || Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.ChallengeRift) && Hud.Game.RiftPercentage < 100 && RedCircle) { var monsters = Hud.Game.AliveMonsters.OrderByDescending(x => x.SnoMonster.RiftProgression); foreach (var monster in monsters) { CircleSize = 10; NewLoop: var CircleSizeYardMonsters = monsters.Where(x => x.FloorCoordinate.XYDistanceTo(monster.FloorCoordinate) <= CircleSize); float RiftPercentage = 0f; foreach (var CircleSizeYardMonster in CircleSizeYardMonsters) { RiftPercentage = RiftPercentage + CircleSizeYardMonster.SnoMonster.RiftProgression; if (CircleSizeYardMonster.Rarity == ActorRarity.Rare) { RiftPercentage = RiftPercentage + 28.6f; // 4.4% of 650 (4 progression orb drops per yellow) } else if (CircleSizeYardMonster.Rarity == ActorRarity.Champion) { RiftPercentage = RiftPercentage + 7.15f; // 1.1% of 650 (1 progression orb drop per blue) } } float PercentOfRift = 32.5f; // 5% of 650 if (Hud.Game.RiftPercentage > 95) { PercentOfRift = (float)(((100 - Hud.Game.RiftPercentage) / 100) * 650); // if less than 5% rift completion left, use that percentage instead. } if (RiftPercentage >= PercentOfRift) { CircleDecorator.Paint(layer, null, monster.FloorCoordinate, null); break; } else if (CircleSize < 56) // Within 55 yards max { CircleSize++; goto NewLoop; } } } // Talked to Urshi part bool UrshiPanel = Hud.Render.GetUiElement("Root.NormalLayer.vendor_dialog_mainPage.riftReward_dialog.LayoutRoot.gemUpgradePane.items_list._content").Visible; if (UrshiPanel) { TalkedToUrshi = true; } if (Hud.Game.Me.IsInTown) { TalkedToUrshi = false; } if (Hud.Game.Me.InGreaterRift && Hud.Game.RiftPercentage == 100 && GardianIsDead && Hud.Game.Me.AnimationState == AcdAnimationState.CastingPortal && !TalkedToUrshi && Hud.Game.SpecialArea == SpecialArea.GreaterRift) { TalkToUrshiDecorator.Paint(layer, null, Hud.Game.Me.FloorCoordinate, "Talk to Urshi!"); } // Countdown to boss fight part const int Magictime = 3750; // time in ms between 100% rift completion and the moment you can hit the boss if (Hud.Game.Me.InGreaterRift && Hud.Game.RiftPercentage == 100 && !GardianIsDead) { _Countdown.Start(); float TimeLeft = (float)(Magictime - _Countdown.ElapsedMilliseconds) / 1000; bool BossOnScreen = Hud.Game.AliveMonsters.Where(x => x.IsOnScreen && x.Rarity == ActorRarity.Boss).Any(); if (TimeLeft > 0 && TimeLeft < Magictime && BossOnScreen) { BossCountdownDecorator.Paint(layer, null, Hud.Game.Me.FloorCoordinate, TimeLeft.ToString("F1", CultureInfo.InvariantCulture)); } } if (_Countdown.ElapsedMilliseconds > Magictime) { _Countdown.Stop(); if (GardianIsDead) { _Countdown.Reset(); } } // Monster pack part if (PackLeaderLifePercentage) { var EliteLeaders = Hud.Game.AliveMonsters.Where(x => x.Rarity == ActorRarity.Rare); var Blues = Hud.Game.AliveMonsters.Where(x => x.Rarity == ActorRarity.Champion); foreach (var EliteLeader in EliteLeaders) { var MaxHealth = EliteLeader.MaxHealth; var CurHealth = EliteLeader.CurHealth; var LifePercentage = Math.Truncate((CurHealth / MaxHealth * 100) * 10) / 10; var layout = YellowFont.GetTextLayout(LifePercentage + "%"); YellowFont.DrawText(layout, EliteLeader.ScreenCoordinate.X, EliteLeader.ScreenCoordinate.Y); } foreach (var Blue in Blues) { var MaxHealth = Blue.MaxHealth; var CurHealth = Blue.CurHealth; var LifePercentage = Math.Truncate((CurHealth / MaxHealth * 100) * 10) / 10; var layout = BlueFont.GetTextLayout(LifePercentage + "%"); BlueFont.DrawText(layout, Blue.ScreenCoordinate.X, Blue.ScreenCoordinate.Y); } } }
public void AfterCollect() { // reset states if needed var monsters = Hud.Game.AliveMonsters.Where(x => x.SnoMonster.Priority == MonsterPriority.boss); if (monsters.Count() != 0) { EncounterBoss = true; } if (riftQuest == null || (riftQuest != null && riftQuest.State == QuestState.none)) { if (riftTimer.IsRunning || riftTimer.ElapsedMilliseconds > 0) { riftTimer.Reset(); } if (guardianTimer.IsRunning || guardianTimer.ElapsedMilliseconds > 0) { guardianTimer.Reset(); } if (pauseTimer.IsRunning || pauseTimer.ElapsedMilliseconds > 0) { pauseTimer.Reset(); } if (deathTimer.IsRunning || deathTimer.ElapsedMilliseconds > 0) { deathTimer.Reset(); } currentRun = null; return; } // guardian if (IsGuardianAlive) { if (!guardianTimer.IsRunning) { guardianTimer.Start(); if (!inRift && BOSSSpeakOutOfTown && !Speaking) { Speaking = true; Hud.Sound.Speak("秘境守护者出现了"); } } } else if (IsGuardianDead && guardianTimer.IsRunning) { guardianTimer.Stop(); Speaking = false; } // death timer if (Hud.Game.Me.IsDead && !deathTimer.IsRunning) { deathTimer.Start(); } // game pause if (Hud.Game.IsPaused || (IsGreaterRift && Hud.Game.NumberOfPlayersInGame == 1 && Hud.Game.IsLoading)) { if (!pauseTimer.IsRunning) { pauseTimer.Start(); } if (riftTimer.IsRunning) { riftTimer.Stop(); } if (guardianTimer.IsRunning) { guardianTimer.Stop(); } if (deathTimer.IsRunning) { deathTimer.Stop(); } return; } // (re)start/stop timers if needed if (!riftTimer.IsRunning && !IsGuardianDead) { riftTimer.Start(); } if (!guardianTimer.IsRunning && IsGuardianAlive) { guardianTimer.Start(); } if (pauseTimer.IsRunning) { pauseTimer.Stop(); } if (!Hud.Game.Me.IsDead && deathTimer.IsRunning) { deathTimer.Stop(); } if (IsGreaterRift && IsGuardianDead && riftTimer.IsRunning) { riftTimer.Stop(); if (!EncounterBoss && BOSSSpeakOutOfTown) { Hud.Sound.Speak("快来卡光了"); } } if (IsNephalemRift && IsGuardianDead && riftTimer.IsRunning) { riftTimer.Stop(); if (!EncounterBoss && BOSSSpeakOutOfTown) { Hud.Sound.Speak("快来捡票啊"); } } }
public void AfterCollect() { // reset states if needed if (riftQuest == null || (riftQuest != null && riftQuest.State == QuestState.none)) { if (riftTimer.IsRunning || riftTimer.ElapsedMilliseconds > 0) { riftTimer.Reset(); } if (guardianTimer.IsRunning || guardianTimer.ElapsedMilliseconds > 0) { guardianTimer.Reset(); } if (pauseTimer.IsRunning || pauseTimer.ElapsedMilliseconds > 0) { pauseTimer.Reset(); } currentRun = null; return; } // guardian if (IsGuardianAlive) { if (!guardianTimer.IsRunning) { guardianTimer.Start(); } } else if (IsGuardianDead && guardianTimer.IsRunning) { guardianTimer.Stop(); } // game pause if (Hud.Game.IsPaused || (IsGreaterRift && Hud.Game.NumberOfPlayersInGame == 1 && Hud.Game.IsLoading)) { if (!pauseTimer.IsRunning) { pauseTimer.Start(); } if (riftTimer.IsRunning) { riftTimer.Stop(); } if (guardianTimer.IsRunning) { guardianTimer.Stop(); } return; } // (re)start/stop timers if needed if (!riftTimer.IsRunning && !IsGuardianDead) { riftTimer.Start(); } if (!guardianTimer.IsRunning && IsGuardianAlive) { guardianTimer.Start(); } if (pauseTimer.IsRunning) { pauseTimer.Stop(); } if (IsGreaterRift && IsGuardianDead && riftTimer.IsRunning) { riftTimer.Stop(); } if (IsNephalemRift && riftQuest.State == QuestState.completed && riftTimer.IsRunning) { riftTimer.Stop(); } }
public void AfterCollect() { if (!_IsStoryMode) { return; } if (Hud.Game.IsPaused || (Hud.Game.NumberOfPlayersInGame == 1 && Hud.Game.IsLoading)) { if (TotalTimeWatch.IsRunning) { TotalTimeWatch.Stop(); } if (A1TimeWatch.IsRunning) { A1TimeWatch.Stop(); } if (A2TimeWatch.IsRunning) { A2TimeWatch.Stop(); } if (A3TimeWatch.IsRunning) { A3TimeWatch.Stop(); } if (A4TimeWatch.IsRunning) { A4TimeWatch.Stop(); } if (A5TimeWatch.IsRunning) { A5TimeWatch.Stop(); } return; } if (!TotalTimeWatch.IsRunning) { TotalTimeWatch.Start(); } int CurrentAct = Hud.Game.CurrentAct; if (CurrentAct == 1 && !A1TimeWatch.IsRunning) { A1TimeWatch.Start(); A2TimeWatch.Stop(); A3TimeWatch.Stop(); A4TimeWatch.Stop(); A5TimeWatch.Stop(); } if (CurrentAct == 2 && !A2TimeWatch.IsRunning) { A1TimeWatch.Stop(); A2TimeWatch.Start(); A3TimeWatch.Stop(); A4TimeWatch.Stop(); A5TimeWatch.Stop(); } if (CurrentAct == 3 && !A3TimeWatch.IsRunning) { A1TimeWatch.Stop(); A2TimeWatch.Stop(); A3TimeWatch.Start(); A4TimeWatch.Stop(); A5TimeWatch.Stop(); } if (CurrentAct == 4 && !A4TimeWatch.IsRunning) { A1TimeWatch.Stop(); A2TimeWatch.Stop(); A3TimeWatch.Stop(); A4TimeWatch.Start(); A5TimeWatch.Stop(); } if (CurrentAct == 5 && !A5TimeWatch.IsRunning) { A1TimeWatch.Stop(); A2TimeWatch.Stop(); A3TimeWatch.Stop(); A4TimeWatch.Stop(); A5TimeWatch.Start(); } }