Advertisement
zjqyf

GLQ_BeenToRecordPlugin

Apr 9th, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Turbo.Plugins.Default;
  5. namespace Turbo.Plugins.glq
  6. {
  7.  
  8. public class GLQ_BeenToRecordPlugin : BasePlugin, IInGameWorldPainter, IInGameTopPainter, IAfterCollectHandler, INewAreaHandler
  9. {
  10. private Dictionary<ISnoArea, string> BeenToList { get; set; } = new Dictionary<ISnoArea, string>();
  11. public IFont Font { get; set; }
  12. public WorldDecoratorCollection Decorator { get; set; }
  13. public GLQ_BeenToRecordPlugin()
  14. {
  15. Enabled = true;
  16. }
  17. public override void Load(IController hud)
  18. {
  19. base.Load(hud);
  20. Font = Hud.Render.CreateFont("tahoma", 6f, 255, 255, 128, 128, true, false, 160, 0, 0, 0, true);
  21. Decorator = new WorldDecoratorCollection(
  22. new MapLabelDecorator(Hud)
  23. {
  24. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 255, 128, 128, false, false, 160, 0, 0, 0, true),
  25. RadiusOffset = 20.0f,
  26. }
  27. );
  28.  
  29. }
  30. public void OnNewArea(bool newGame, ISnoArea area)
  31. {
  32. if (newGame)
  33. {
  34. BeenToList.Clear();
  35. }
  36. }
  37. public void PaintWorld(WorldLayer layer)
  38. {
  39. foreach (var portal in Hud.Game.Portals)
  40. {
  41. if (!portal.TargetArea.IsTown && BeenToList.Keys.Contains(portal.TargetArea))
  42. {//小地图过图点显示
  43. Decorator.Paint(layer, null, portal.FloorCoordinate, BeenToList[portal.TargetArea] + " " + "Been There");
  44. }
  45. }
  46. }
  47. public void PaintTopInGame(ClipState clipState)
  48. {
  49. if (Hud.Render.UiHidden)
  50. return;
  51. if (clipState != ClipState.AfterClip)
  52. return;
  53. if (!Hud.Render.WorldMapUiElement.Visible || Hud.Render.ActMapUiElement.Visible)
  54. return;
  55.  
  56. var mapCurrentAct = Hud.Game.ActMapCurrentAct;
  57. if (mapCurrentAct == BountyAct.None)
  58. return;
  59. var w = 220 * Hud.Window.HeightUiRatio;
  60. var h = 100 * Hud.Window.HeightUiRatio;
  61. foreach (var waypoint in Hud.Game.ActMapWaypoints.Where(x => x.BountyAct == mapCurrentAct))
  62. {
  63. var x = Hud.Render.WorldMapUiElement.Rectangle.X + (waypoint.CoordinateOnMapUiElement.X * Hud.Window.HeightUiRatio);
  64. var y = Hud.Render.WorldMapUiElement.Rectangle.Y + (waypoint.CoordinateOnMapUiElement.Y * Hud.Window.HeightUiRatio);
  65. if (BeenToList.Keys.Contains(waypoint.TargetSnoArea) && !waypoint.TargetSnoArea.IsTown)
  66. {//世界地图上显示
  67. var layout = Font.GetTextLayout(BeenToList[waypoint.TargetSnoArea] + " " + "Been There");
  68. Font.DrawText(layout, x + ((w - layout.Metrics.Width) / 2), y + (float)Math.Ceiling(h * 0.7f));
  69. }
  70. }
  71. }
  72. public void AfterCollect()
  73. {
  74. var players = Hud.Game.Players;
  75. foreach (var player in players)
  76. {
  77. ISnoArea SnoArea = player.SnoArea;
  78. if (player.SnoArea.IsTown || player.SnoArea.NameEnglish.Contains("Rift Level"))//城镇和秘境不显示
  79. continue;
  80. if (!BeenToList.Keys.Contains(SnoArea))
  81. {
  82. BeenToList.Add(SnoArea, player.BattleTagAbovePortrait);
  83. }
  84. }
  85. }
  86.  
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement