Advertisement
zjqyf

GLQ_PlayerResurrectionTimerdebug.cs

Aug 17th, 2017
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.09 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Linq;
  3. namespace Turbo.Plugins.glq
  4. {
  5. public class GLQ_PlayerResurrectionTimerdebug : BasePlugin, IInGameTopPainter, INewAreaHandler
  6. {
  7. public IFont debugTextFont1 { get; set; }
  8. public IFont debugTextFont2 { get; set; }
  9. private bool IsDead1;
  10. private int DeadTimes1;
  11. private bool IsDead2;
  12. private int DeadTimes2;
  13. private bool IsDead3;
  14. private int DeadTimes3;
  15. private bool IsDead4;
  16. private int DeadTimes4;
  17. public GLQ_PlayerResurrectionTimerdebug()
  18. {
  19. Enabled = true;
  20. }
  21. public override void Load(IController hud)
  22. {
  23. base.Load(hud);
  24. debugTextFont1 = Hud.Render.CreateFont("tahoma", 12, 200, 255, 255, 255, true, false, true);
  25. debugTextFont2 = Hud.Render.CreateFont("tahoma", 12, 200, 255, 0, 0, true, false, true);
  26. }
  27. public void OnNewArea(bool newGame, ISnoArea area)
  28. {
  29. if (newGame)
  30. {
  31. DeadTimes1 = 0;
  32. DeadTimes2 = 0;
  33. DeadTimes3 = 0;
  34. DeadTimes4 = 0;
  35. }
  36. }
  37. private IQuest riftQuest
  38. {
  39. get
  40. {
  41. return Hud.Game.Quests.FirstOrDefault(q => q.SnoQuest.Sno == 337492) ?? // rift
  42. Hud.Game.Quests.FirstOrDefault(q => q.SnoQuest.Sno == 382695); // gr
  43. }
  44. }
  45. public void PaintTopInGame(ClipState clipState)
  46. {
  47. if (clipState != ClipState.BeforeClip) return;
  48. var layoutdebug = debugTextFont1.GetTextLayout("1");
  49. if (riftQuest == null || (riftQuest != null && riftQuest.State == QuestState.none))
  50. {
  51. DeadTimes1 = 0;
  52. DeadTimes2 = 0;
  53. DeadTimes3 = 0;
  54. DeadTimes4 = 0;
  55. }
  56. foreach (var player in Hud.Game.Players)
  57. {
  58. if(player.Index==0)
  59. {
  60. var portrait = player.PortraitUiElement.Rectangle;
  61. var x = portrait.Left + portrait.Width * 1.1f;
  62. var y = portrait.Top + portrait.Height / 6;
  63. if (player.IsDead)
  64. {
  65. layoutdebug = debugTextFont2.GetTextLayout("Index:0 Dead " + DeadTimes1 + "times");
  66. debugTextFont2.DrawText(layoutdebug, x, y);
  67. if(!IsDead1)
  68. {
  69. DeadTimes1++;
  70. IsDead1 = true;
  71. }
  72. }
  73. else
  74. {
  75. IsDead1 = false;
  76. layoutdebug = debugTextFont1.GetTextLayout("Index:0 Alive, Dead " + DeadTimes1 + "times");
  77. debugTextFont1.DrawText(layoutdebug, x, y);
  78.  
  79. }
  80. }
  81.  
  82. if (player.Index == 1)
  83. {
  84. var portrait = player.PortraitUiElement.Rectangle;
  85. var x = portrait.Left + portrait.Width * 1.1f;
  86. var y = portrait.Top + portrait.Height / 6;
  87. if (player.IsDead)
  88. {
  89. layoutdebug = debugTextFont2.GetTextLayout("Index:1 Dead " + DeadTimes2 + "times");
  90. debugTextFont2.DrawText(layoutdebug, x, y);
  91. if (!IsDead2)
  92. {
  93. DeadTimes2++;
  94. IsDead2 = true;
  95. }
  96. }
  97. else
  98. {
  99. IsDead2 = false;
  100. layoutdebug = debugTextFont1.GetTextLayout("Index:1 Alive, Dead " + DeadTimes2 + "times");
  101. debugTextFont1.DrawText(layoutdebug, x, y);
  102. }
  103. }
  104. if (player.Index == 2)
  105. {
  106. var portrait = player.PortraitUiElement.Rectangle;
  107. var x = portrait.Left + portrait.Width * 1.1f;
  108. var y = portrait.Top + portrait.Height / 6;
  109. if (player.IsDead)
  110. {
  111. layoutdebug = debugTextFont2.GetTextLayout("Index:2 Dead " + DeadTimes3 + "times");
  112. debugTextFont2.DrawText(layoutdebug, x, y);
  113. if (!IsDead3)
  114. {
  115. DeadTimes3++;
  116. IsDead3 = true;
  117. }
  118. }
  119. else
  120. {
  121. IsDead3 = false;
  122. layoutdebug = debugTextFont1.GetTextLayout("Index:2 Alive, Dead " + DeadTimes3 + "times");
  123. debugTextFont1.DrawText(layoutdebug, x, y);
  124.  
  125. }
  126. }
  127. if (player.Index == 3)
  128. {
  129. var portrait = player.PortraitUiElement.Rectangle;
  130. var x = portrait.Left + portrait.Width * 1.1f;
  131. var y = portrait.Top + portrait.Height / 6;
  132. if (player.IsDead)
  133. {
  134. layoutdebug = debugTextFont2.GetTextLayout("Index:3 Dead "+ DeadTimes4+"times");
  135. debugTextFont2.DrawText(layoutdebug, x, y);
  136. if (!IsDead4)
  137. {
  138. DeadTimes4++;
  139. IsDead4 = true;
  140. }
  141. }
  142. else
  143. {
  144. IsDead4 = false;
  145. layoutdebug = debugTextFont1.GetTextLayout("Index:3 Alive, Dead " + DeadTimes4 + "times");
  146. debugTextFont1.DrawText(layoutdebug, x, y);
  147. }
  148. }
  149. }
  150. }
  151. }
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement