Advertisement
s4000

DAV_BossQuestsPlugin

Mar 31st, 2020 (edited)
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.90 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using Turbo.Plugins.Default;
  5.  
  6. namespace Turbo.Plugins.DAV
  7. {
  8.     public class DAV_BossQuestsPlugin : BasePlugin, IInGameTopPainter {
  9.         public float offsetY { get; set; }
  10.         public string textRemove { get; set; }
  11.         public IFont HighlightFont { get; set; }
  12.  
  13.         private List<ISnoQuest> bossQuest { get; } = new List<ISnoQuest>();
  14.  
  15.         public DAV_BossQuestsPlugin() {
  16.             Enabled = true;
  17.             Order = 30000;
  18.         }
  19.  
  20.         public override void Load(IController hud) {
  21.             base.Load(hud);
  22.  
  23.             offsetY = 0f;
  24.             textRemove = "Bounty: "; // Bounty:  // 懸賞:
  25.             HighlightFont = Hud.Render.CreateFont("Arial", 7f, 255, 255, 128, 51, true, true, 160, 51, 51, 51, true);
  26.  
  27.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillTheSkeletonKing_361234); // Act 1
  28.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillQueenAraneae_345528);
  29.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillTheButcher_347032);
  30.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillMaghda_347558); // Act 2
  31.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillZoltunKulle_347656);
  32.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillBelial_358353);
  33.             // bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillVidian_474066);
  34.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillGhom_346166); // Act 3
  35.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillTheSiegebreakerAssaultBeast_349242);
  36.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillCydaea_349224);
  37.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillAzmodan_349244);
  38.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillRakanoth_349262); // Act 4
  39.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillIzual_361421);
  40.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillDiablo_349288);
  41.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillAdria_359915); // Act 5
  42.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillUrzael_359919);
  43.             bossQuest.Add(Hud.Sno.SnoQuests.Bounty_KillMalthael_359927);
  44.         }
  45.  
  46.         public void PaintTopInGame(ClipState clipState) {
  47.             if (clipState != ClipState.AfterClip) return;
  48.             if (!Hud.Render.WorldMapUiElement.Visible || Hud.Render.ActMapUiElement.Visible) return;
  49.  
  50.             var mapCurrentAct = Hud.Game.ActMapCurrentAct;
  51.             var w = 220 * Hud.Window.HeightUiRatio;
  52.             var h = 100 * Hud.Window.HeightUiRatio;
  53.  
  54.             foreach (var waypoint in Hud.Game.ActMapWaypoints.Where(x => x.BountyAct == mapCurrentAct)) {
  55.                 var quest = bossQuest.FirstOrDefault(z => z.BountySnoArea == waypoint.TargetSnoArea);
  56.                 if (quest == null) continue;
  57.  
  58.                 var x = Hud.Render.WorldMapUiElement.Rectangle.X + waypoint.CoordinateOnMapUiElement.X * Hud.Window.HeightUiRatio;
  59.                 var y = Hud.Render.WorldMapUiElement.Rectangle.Y + waypoint.CoordinateOnMapUiElement.Y * Hud.Window.HeightUiRatio;
  60.                 var layout = HighlightFont.GetTextLayout(quest.NameLocalized.Replace(textRemove,""));
  61.                 HighlightFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y /*- (float)Math.Ceiling(h * 0.32f) */- layout.Metrics.Height + offsetY);
  62.             }
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement