Advertisement
zjqyf

NecDeadBodyPlugin.cs

Jul 16th, 2017
1,280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. using System.Linq;
  2. using Turbo.Plugins.Default;
  3.  
  4. namespace Turbo.Plugins.glq
  5. {
  6. public class GLQ_NecDeadBodyPlugin : BasePlugin, IInGameTopPainter, IInGameWorldPainter
  7. {
  8. public IFont TextFont { get; set; }
  9. public int yard { get; set; }
  10. public bool DeadBodyCircle { get; set; }
  11. public bool DeadBodyCount { get; set; }
  12. public TopLabelDecorator DeadBodyCountDecorator { get; set; }
  13. public WorldDecoratorCollection DeadBodyCircleDecorator { get; set; }
  14. public float XWidth { get; set; }
  15. public float YHeight { get; set; }
  16.  
  17. public GLQ_NecDeadBodyPlugin()
  18. {
  19. Enabled = true;
  20. }
  21.  
  22. public override void Load(IController hud)
  23. {
  24. base.Load(hud);
  25. DeadBodyCircle = true;
  26. DeadBodyCount = true;
  27.  
  28.  
  29. DeadBodyCountDecorator = new TopLabelDecorator(Hud)
  30. {
  31. TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 175, 238, 238, true, false, false), //this configures the size of the numbers ("7") and the color in RGB ("255, 175, 238, 238")
  32. BackgroundTexture1 = hud.Texture.ButtonTextureBlue,
  33. BackgroundTexture2 = hud.Texture.BackgroundTextureGreen,
  34. BackgroundTextureOpacity2 = 0.6f,
  35. };
  36.  
  37. DeadBodyCircleDecorator = new WorldDecoratorCollection(
  38. new GroundShapeDecorator(Hud)
  39. {
  40. Brush = Hud.Render.CreateBrush(192, 255, 0, 0, -3),
  41. ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
  42. ShapePainter = WorldStarShapePainter.NewCross(Hud),
  43. Radius = 1f,
  44. RadiusTransformator = new StandardPingRadiusTransformator(Hud, 400, 0.8f, 1.0f),
  45. RotationTransformator = new CircularRotationTransformator(Hud, 30),
  46. },
  47. new GroundCircleDecorator(Hud)
  48. {
  49. Brush = Hud.Render.CreateBrush(255, 255, 0, 0, 2f),
  50. Radius = 1f
  51. }
  52. );
  53. }
  54.  
  55. public void PaintWorld(WorldLayer layer)
  56. {
  57. if ((Hud.Game.MapMode == MapMode.WaypointMap) || (Hud.Game.MapMode == MapMode.ActMap) || (Hud.Game.MapMode == MapMode.Map)) return;
  58. var skill = Hud.Game.Me.Powers.UsedSkills.Where(x => x.SnoPower.Sno == 454174 || x.SnoPower.Sno == 461650 || x.SnoPower.Sno == 460757 || x.SnoPower.Sno == 462239).FirstOrDefault();
  59. if (skill != null)
  60. {
  61. var DeadBody = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._p6_necro_corpse_flesh);
  62. if (DeadBodyCircle == true)
  63. foreach (var actor in DeadBody)
  64. {
  65. DeadBodyCircleDecorator.Paint(layer, actor, actor.FloorCoordinate, "");
  66. }
  67. }
  68.  
  69. }
  70. public void PaintTopInGame(ClipState clipState)
  71. {
  72. if (clipState != ClipState.BeforeClip) return;
  73. var skill = Hud.Game.Me.Powers.UsedSkills.Where(x => x.SnoPower.Sno == 454174 || x.SnoPower.Sno == 461650 || x.SnoPower.Sno == 460757 || x.SnoPower.Sno == 462239).FirstOrDefault();
  74. if (skill != null)
  75. {
  76. var DeadBody = Hud.Game.Actors.Where(d => d.SnoActor.Sno == ActorSnoEnum._p6_necro_corpse_flesh && d.IsOnScreen);
  77. int Count = 0;
  78. var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.game_dialog_backgroundScreenPC.game_progressBar_manaBall").Rectangle;
  79. var w = uiRect.Width / 3f;
  80. var h = uiRect.Height * 0.15f;
  81. var x = uiRect.Left + w;
  82. var y = uiRect.Top - uiRect.Height * 0.17f;
  83. if (DeadBodyCount == true)
  84. {
  85. foreach (var actor in DeadBody)
  86. {
  87. Count++;
  88. }
  89. if (Count > 0)
  90. {
  91. if (Count < 10)
  92. {
  93. DeadBodyCountDecorator.TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 175, 238, 238, true, false, false);
  94. }
  95. if (Count >= 10 && Count < 16)
  96. {
  97. DeadBodyCountDecorator.TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 0, true, false, false);
  98. }
  99. if (Count >= 16)
  100. {
  101. DeadBodyCountDecorator.TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 255, 0, 0, true, false, false);
  102. }
  103. DeadBodyCountDecorator.TextFunc = () => Count.ToString();
  104. DeadBodyCountDecorator.HintFunc = () => "Corpse";
  105. DeadBodyCountDecorator.Paint(x, y, w, h, HorizontalAlign.Center);
  106. }
  107.  
  108. }
  109.  
  110. }
  111. }
  112. }
  113.  
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement