Advertisement
zjqyf

UberRealmMarker.cs

Jun 17th, 2017
982
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Turbo.Plugins.Default;
  4. namespace Turbo.Plugins.glq
  5. {
  6.  
  7. public class UberRealmMarker : BasePlugin, IInGameWorldPainter, INewAreaHandler, IInGameTopPainter
  8. {
  9.  
  10. public WorldDecoratorCollection MarkerDecorator { get; set; }
  11. public TopLabelWithTitleDecorator FinishedDecorator { get; set; }
  12. public TopLabelWithTitleDecorator TimesDecorator { get; set; }
  13. bool RedDoor0 { get; set; }
  14. bool RedDoor1 { get; set; }
  15. bool RedDoor2 { get; set; }
  16. bool RedDoor3 { get; set; }
  17. bool Finished { get; set; }
  18. int Times { get; set; }
  19. private HashSet<ActorSnoEnum> _actorSnoList = new HashSet<ActorSnoEnum>();
  20. public UberRealmMarker()
  21. {
  22. Enabled = false;
  23. }
  24.  
  25. public override void Load(IController hud)
  26. {
  27. base.Load(hud);
  28. RedDoor0 = false;
  29. RedDoor1 = false;
  30. RedDoor2 = false;
  31. RedDoor3 = false;
  32. Finished = false;
  33. Times = 0;
  34. MarkerDecorator = new WorldDecoratorCollection(
  35. new GroundLabelDecorator(Hud)
  36. {
  37. BackgroundBrush = Hud.Render.CreateBrush(255, 255, 0, 0, 0),
  38. BorderBrush = Hud.Render.CreateBrush(192, 255, 255, 255, 1),
  39. TextFont = Hud.Render.CreateFont("tahoma", 10f, 255, 255, 255, 255, true, false, false),
  40. }
  41. );
  42. FinishedDecorator = new TopLabelWithTitleDecorator(Hud)
  43. {
  44. TextFont = Hud.Render.CreateFont("tahoma", 9, 255, 255, 0, 0, true, false, true),
  45. };
  46. TimesDecorator = new TopLabelWithTitleDecorator(Hud)
  47. {
  48. TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 239, 220, 129, false, false, true),
  49. };
  50. _actorSnoList.Add(ActorSnoEnum._uber_portalspot0); //Uber_PortalSpot0
  51. _actorSnoList.Add(ActorSnoEnum._uber_portalspot1); //Uber_PortalSpot1
  52. _actorSnoList.Add(ActorSnoEnum._uber_portalspot2); //Uber_PortalSpot2
  53. _actorSnoList.Add(ActorSnoEnum._uber_portalspot3); //Uber_PortalSpot3
  54.  
  55. }
  56. public void OnNewArea(bool newGame, ISnoArea area)
  57. {
  58. if (newGame)
  59. {
  60. RedDoor0 = false;
  61. RedDoor1 = false;
  62. RedDoor2 = false;
  63. RedDoor3 = false;
  64. Finished = false;
  65. }
  66. }
  67. public void PaintWorld(WorldLayer layer)
  68. {
  69. var MapSno = Hud.Game.Me.SnoArea.Sno.ToString();
  70. var actors = Hud.Game.Actors.Where(actor => actor.DisplayOnOverlay && _actorSnoList.Contains(actor.SnoActor.Sno));
  71. if (MapSno == "256767") RedDoor0 = true;
  72. if (MapSno == "256106") RedDoor1 = true;
  73. if (MapSno == "256742") RedDoor2 = true;
  74. if (MapSno == "374239") RedDoor3 = true;
  75. if (RedDoor0 && RedDoor1 && RedDoor2 && RedDoor3 && Finished == false)
  76. {
  77. Times++;
  78. Finished = true;
  79. }
  80. foreach (var actor in actors)
  81. {
  82. if (RedDoor0 && actor.SnoActor.Sno == ActorSnoEnum._uber_portalspot0) MarkerDecorator.Paint(layer, null, actor.FloorCoordinate.Offset(0, 0, 6f), "A1Key Entered");
  83. if (RedDoor1 && actor.SnoActor.Sno == ActorSnoEnum._uber_portalspot1) MarkerDecorator.Paint(layer, null, actor.FloorCoordinate.Offset(0, 0, 6f), "A2Key Entered");
  84. if (RedDoor2 && actor.SnoActor.Sno == ActorSnoEnum._uber_portalspot2) MarkerDecorator.Paint(layer, null, actor.FloorCoordinate.Offset(0, 0, 6f), "A3Key Entered");
  85. if (RedDoor3 && actor.SnoActor.Sno == ActorSnoEnum._uber_portalspot3) MarkerDecorator.Paint(layer, null, actor.FloorCoordinate.Offset(0, 0, 6f), "A4Key Entered");
  86. }
  87. }
  88. public void PaintTopInGame(ClipState clipState)
  89. {
  90. if (clipState != ClipState.BeforeClip) return;
  91. var ui = Hud.Render.GetUiElement("Root.NormalLayer.minimap_dialog_backgroundScreen.minimap_dialog_pve.BoostWrapper.BoostsDifficultyStackPanel.clock");
  92. var ui2 = Hud.Render.GetUiElement("Root.NormalLayer.minimap_dialog_backgroundScreen.minimap_dialog_pve.minimap_pve_main");
  93. var w = 0;
  94. var h = ui.Rectangle.Height;
  95. float XPos = ui2.Rectangle.Left + ui2.Rectangle.Width / 3.5f;
  96. float YPos = ui.Rectangle.Top;
  97. if (Finished) FinishedDecorator.Paint(XPos, YPos - h, w, h, "All UberRealm Entered");
  98. if (Times != 0)
  99. {
  100. TimesDecorator.Paint(XPos, YPos, w, h, "HellfireAmulet mission: " + Times);
  101. }
  102. }
  103.  
  104. }
  105.  
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement