-
-
Save JackCeparou/53c0faff02f5799bfb65b95381557a6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Globalization; | |
using Turbo.Plugins.Default; | |
namespace Turbo.Plugins.Resu | |
{ | |
public class ParagonPercentagePlugin : BasePlugin, IInGameTopPainter | |
{ | |
public bool ShowGreaterRiftMaxLevel { get; set; } | |
public TopLabelDecorator ParagonPercentageDecorator { get; set; } | |
public TopLabelDecorator HighestSoloRiftLevelDecorator { get; set; } | |
public ParagonPercentagePlugin() | |
{ | |
Enabled = true; | |
} | |
public override void Load(IController hud) | |
{ | |
base.Load(hud); | |
ShowGreaterRiftMaxLevel = true; | |
var experiencePlugin = Hud.GetPlugin<TopExperienceStatistics>(); | |
ParagonPercentageDecorator = new TopLabelDecorator(Hud) | |
{ | |
BackgroundTexture1 = Hud.Texture.Button2TextureBrown, | |
BackgroundTextureOpacity1 = 0.8f, | |
TextFont = Hud.Render.CreateFont("Segoe UI Light", 7, 250, 255, 255, 255, false, false, true), | |
TextFunc = () => string.Format(CultureInfo.InvariantCulture, "{0:0.##}%", (Hud.Game.Me.CurrentLevelParagonFloat - Hud.Game.Me.CurrentLevelParagon) * 100), | |
//HintFunc = () => "Paragon percentage." + Environment.NewLine + "Paragon level " + (Hud.Game.Me.CurrentLevelParagon + 1) + " in " + Math.Truncate(Hud.Game.Me.ParagonExpToNextLevel / Hud.Game.CurrentHeroToday.GainedExperiencePerHourPlay) + "h " + Math.Truncate(((Math.Truncate(((Hud.Game.Me.ParagonExpToNextLevel / Hud.Game.CurrentHeroToday.GainedExperiencePerHourPlay) - Math.Truncate(Hud.Game.Me.ParagonExpToNextLevel / Hud.Game.CurrentHeroToday.GainedExperiencePerHourPlay)) * 100) / 10) * 6)) + "m", | |
HintFunc = () => "Paragon percentage." + Environment.NewLine + "Paragon level " + (Hud.Game.Me.CurrentLevelParagon + 1) + " in " + experiencePlugin.TimeToParagonLevel(Hud.Game.Me.CurrentLevelParagon + 1, false), | |
}; | |
HighestSoloRiftLevelDecorator = new TopLabelDecorator(Hud) | |
{ | |
BackgroundTexture1 = Hud.Texture.Button2TextureBrown, | |
BackgroundTextureOpacity1 = 0.7f, | |
TextFont = Hud.Render.CreateFont("Segoe UI Light", 7, 250, 255, 255, 255, false, false, true), | |
TextFunc = () => "GR " + Hud.Game.Me.HighestSoloRiftLevel, | |
HintFunc = () => "Highest solo rift level", | |
}; | |
} | |
public void PaintTopInGame(ClipState clipState) | |
{ | |
if (Hud.Render.UiHidden) return; | |
if (clipState != ClipState.BeforeClip) return; | |
var uiRect = Hud.Game.Me.PortraitUiElement.Rectangle; | |
ParagonPercentageDecorator.Paint(uiRect.Left + uiRect.Width * 0.71f, uiRect.Top + uiRect.Height * 0.79f, uiRect.Width * 0.44f, uiRect.Height * 0.14f, HorizontalAlign.Center); | |
if (ShowGreaterRiftMaxLevel && Hud.Game.Me.CurrentLevelNormal == 70) | |
{ | |
HighestSoloRiftLevelDecorator.Paint(uiRect.Left + uiRect.Width * 0.26f, uiRect.Top + uiRect.Height * 0.2f, uiRect.Width * 0.5f, uiRect.Height * 0.1f, HorizontalAlign.Center); | |
}; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment