Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Turbo.Plugins.Default;
- using System.Linq;
- namespace Turbo.Plugins.glq
- {
- public class GLQ_PlayerResurrectionTimerdebug : BasePlugin, IInGameTopPainter, INewAreaHandler
- {
- public IFont debugTextFont1 { get; set; }
- public IFont debugTextFont2 { get; set; }
- private bool IsDead1;
- private int DeadTimes1;
- private bool IsDead2;
- private int DeadTimes2;
- private bool IsDead3;
- private int DeadTimes3;
- private bool IsDead4;
- private int DeadTimes4;
- public GLQ_PlayerResurrectionTimerdebug()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- debugTextFont1 = Hud.Render.CreateFont("tahoma", 12, 200, 255, 255, 255, true, false, true);
- debugTextFont2 = Hud.Render.CreateFont("tahoma", 12, 200, 255, 0, 0, true, false, true);
- }
- public void OnNewArea(bool newGame, ISnoArea area)
- {
- if (newGame)
- {
- DeadTimes1 = 0;
- DeadTimes2 = 0;
- DeadTimes3 = 0;
- DeadTimes4 = 0;
- }
- }
- private IQuest riftQuest
- {
- get
- {
- return Hud.Game.Quests.FirstOrDefault(q => q.SnoQuest.Sno == 337492) ?? // rift
- Hud.Game.Quests.FirstOrDefault(q => q.SnoQuest.Sno == 382695); // gr
- }
- }
- public void PaintTopInGame(ClipState clipState)
- {
- if (clipState != ClipState.BeforeClip) return;
- var layoutdebug = debugTextFont1.GetTextLayout("1");
- if (riftQuest == null || (riftQuest != null && riftQuest.State == QuestState.none))
- {
- DeadTimes1 = 0;
- DeadTimes2 = 0;
- DeadTimes3 = 0;
- DeadTimes4 = 0;
- }
- foreach (var player in Hud.Game.Players)
- {
- if(player.Index==0)
- {
- var portrait = player.PortraitUiElement.Rectangle;
- var x = portrait.Left + portrait.Width * 1.1f;
- var y = portrait.Top + portrait.Height / 6;
- if (player.IsDead)
- {
- layoutdebug = debugTextFont2.GetTextLayout("Index:0 Dead " + DeadTimes1 + "times");
- debugTextFont2.DrawText(layoutdebug, x, y);
- if(!IsDead1)
- {
- DeadTimes1++;
- IsDead1 = true;
- }
- }
- else
- {
- IsDead1 = false;
- layoutdebug = debugTextFont1.GetTextLayout("Index:0 Alive, Dead " + DeadTimes1 + "times");
- debugTextFont1.DrawText(layoutdebug, x, y);
- }
- }
- if (player.Index == 1)
- {
- var portrait = player.PortraitUiElement.Rectangle;
- var x = portrait.Left + portrait.Width * 1.1f;
- var y = portrait.Top + portrait.Height / 6;
- if (player.IsDead)
- {
- layoutdebug = debugTextFont2.GetTextLayout("Index:1 Dead " + DeadTimes2 + "times");
- debugTextFont2.DrawText(layoutdebug, x, y);
- if (!IsDead2)
- {
- DeadTimes2++;
- IsDead2 = true;
- }
- }
- else
- {
- IsDead2 = false;
- layoutdebug = debugTextFont1.GetTextLayout("Index:1 Alive, Dead " + DeadTimes2 + "times");
- debugTextFont1.DrawText(layoutdebug, x, y);
- }
- }
- if (player.Index == 2)
- {
- var portrait = player.PortraitUiElement.Rectangle;
- var x = portrait.Left + portrait.Width * 1.1f;
- var y = portrait.Top + portrait.Height / 6;
- if (player.IsDead)
- {
- layoutdebug = debugTextFont2.GetTextLayout("Index:2 Dead " + DeadTimes3 + "times");
- debugTextFont2.DrawText(layoutdebug, x, y);
- if (!IsDead3)
- {
- DeadTimes3++;
- IsDead3 = true;
- }
- }
- else
- {
- IsDead3 = false;
- layoutdebug = debugTextFont1.GetTextLayout("Index:2 Alive, Dead " + DeadTimes3 + "times");
- debugTextFont1.DrawText(layoutdebug, x, y);
- }
- }
- if (player.Index == 3)
- {
- var portrait = player.PortraitUiElement.Rectangle;
- var x = portrait.Left + portrait.Width * 1.1f;
- var y = portrait.Top + portrait.Height / 6;
- if (player.IsDead)
- {
- layoutdebug = debugTextFont2.GetTextLayout("Index:3 Dead "+ DeadTimes4+"times");
- debugTextFont2.DrawText(layoutdebug, x, y);
- if (!IsDead4)
- {
- DeadTimes4++;
- IsDead4 = true;
- }
- }
- else
- {
- IsDead4 = false;
- layoutdebug = debugTextFont1.GetTextLayout("Index:3 Alive, Dead " + DeadTimes4 + "times");
- debugTextFont1.DrawText(layoutdebug, x, y);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement