Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.RuneB
- {
- public class ArchonWizPlugin : BasePlugin, IInGameWorldPainter, ICustomizer
- {
- public bool ShowWarnings { get; set; }
- public bool ShowInTown { get; set; }
- public bool ShowZeiCircle { get; set; }
- public bool ShowRashaElements { get; set; }
- public bool ShowArchonCD { get; set; }
- public bool ShowArchonRemain { get; set; }
- public GroundCircleDecorator ZeiRanceIndicator { get; set; }
- public TopLabelDecorator ArchonCDLabel { get; set; }
- public TopLabelDecorator ArchonCooldownLabel { get; set; }
- public TopLabelDecorator ArchonRemainingLabel { get; set; }
- public IFont WarningFont { get; set; }
- public IFont ArchonCDFont { get; set; }
- public IFont ArchonRemainFont { get; set; }
- public IFont ArchonRemainSoonFont { get; set; }
- public IBrush RashaBackgroundBrush { get; set; }
- public IBrush FireBrush { get; set; }
- public IBrush ArcaneBrush { get; set; }
- public IBrush LightningBrush { get; set; }
- public IBrush ColdBrush { get; set; }
- public IBrush GreyBrush { get; set; }
- private IPlayerSkill ArchonSkill, MWeaponSkill, EArmorSkill;
- private float HudWidth, HudHeight, LW, LH, RLSize, RLYpos, RLSizeMod, arcCDRemain, Tick;
- private bool DrawCDLabel = false;
- private bool TimerRunning = false;
- public ArchonWizPlugin()
- {
- Enabled = true;
- }
- public void Customize()
- {
- Hud.RunOnPlugin<PlayerBottomBuffListPlugin>(plugin =>
- {
- plugin.BuffPainter.ShowTimeLeftNumbers = true;
- plugin.RuleCalculator.Rules.Add(new BuffRule(134872) { IconIndex = 2, MinimumIconCount = 1, ShowTimeLeft = false, ShowStacks = true, IconSizeMultiplier = 1.3f }); // Archon
- plugin.RuleCalculator.Rules.Add(new BuffRule(429855) { IconIndex = 5, MinimumIconCount = 1, ShowTimeLeft = true, ShowStacks = false, IconSizeMultiplier = 1.3f }); // Tal Rasha
- });
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- // Public vars
- ShowWarnings = true;
- ShowInTown = true;
- ShowZeiCircle = true;
- ShowRashaElements = true;
- ShowArchonCD = true;
- ShowArchonRemain = true;
- WarningFont = Hud.Render.CreateFont("tahoma", 10f, 200, 255, 0, 0, false, false, 160, 0, 0, 0, true);
- ArchonCDFont = Hud.Render.CreateFont("tahoma", 10f, 255, 140, 140, 180, false, false, 160, 0, 0, 0, true);
- ArchonRemainFont = Hud.Render.CreateFont("tahoma", 10f, 255, 80, 140, 210, false, false, 160, 0, 0, 0, true);
- ArchonRemainSoonFont = Hud.Render.CreateFont("tahoma", 14f, 255, 255, 0, 0, false, false, 160, 0, 0, 0, true);
- RashaBackgroundBrush = Hud.Render.CreateBrush(100, 30, 30, 30, 0);
- GreyBrush = Hud.Render.CreateBrush(255, 50, 50, 50, 0);
- FireBrush = Hud.Render.CreateBrush(255, 200, 130, 30, 0);
- ArcaneBrush = Hud.Render.CreateBrush(255, 180, 80, 180, 0);
- LightningBrush = Hud.Render.CreateBrush(255, 0, 65, 145, 0);
- ColdBrush = Hud.Render.CreateBrush(255, 80, 130, 180, 0);
- ZeiRanceIndicator = new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(50, 14, 200, 245, 1.5f),
- Radius = 50f
- };
- ArchonCooldownLabel = new TopLabelDecorator(Hud)
- {
- TextFont = Hud.Render.CreateFont("tahoma", 10f, 255, 140, 140, 180, false, false, 160, 0, 0, 0, true),
- TextFunc = () => ArchonStatusText(),
- };
- // Private vars
- HudWidth = Hud.Window.Size.Width;
- HudHeight = Hud.Window.Size.Height;
- LW = 80;
- LH = 15;
- RLSize = 24f;
- RLYpos = 0.585f;
- RLSizeMod = 0.9f;
- }
- public void PaintWorld(WorldLayer layer)
- {
- if (Hud.Game.IsInGame && Hud.Game.Me.HeroClassDefinition.HeroClass == HeroClass.Wizard && !(Hud.Game.Me.IsInTown && !ShowInTown))
- {
- //if (Hud.Game.Me.IsInTown && !ShowInTown) return;
- var me = Hud.Game.Me;
- UpdateSkills(me);
- //If Disentegration wave is used draw zei circle
- if (me.Powers.BuffIsActive(392891, 4) && ShowZeiCircle)
- ZeiRanceIndicator.Paint(me, me.FloorCoordinate, null);
- //Draw missing buff warnings
- if (ShowWarnings && !me.IsDead)
- DrawWarnings(me);
- //Draw individual indicators for each tal rasha element
- if (me.Powers.BuffIsActive(429855, 5) && ShowRashaElements)
- TalRashaElements(me);
- //Draw Archon cooldown
- if (ShowArchonCD && ArchonSkill != null)
- ArchonCooldownLabel.Paint(HudWidth * 0.5f - LW / 2, HudHeight * 0.515f, LW, LH, HorizontalAlign.Center);
- //Draw Archon time remaining
- if (ShowArchonRemain)
- ArchonRemaining(me);
- }
- }
- private void ArchonRemaining(IPlayer me)
- {
- if (me.Powers.BuffIsActive(134872, 2))
- {
- if (!TimerRunning)
- Tick = Hud.Game.CurrentGameTick;
- TimerRunning = true;
- var r = 20f - ((Hud.Game.CurrentGameTick - Tick) / 60.0d);
- if (r > 3f)
- {
- var layout = ArchonRemainFont.GetTextLayout(string.Format("{0:N1}", r));
- ArchonRemainFont.DrawText(layout, HudWidth * 0.5f - (layout.Metrics.Width * 0.5f), HudHeight * 0.515f);
- }
- else {
- var layout = ArchonRemainSoonFont.GetTextLayout(string.Format("{0:N1}", r));
- ArchonRemainSoonFont.DrawText(layout, HudWidth * 0.5f - (layout.Metrics.Width * 0.5f), HudHeight * 0.505f);
- }
- }
- else TimerRunning = false;
- }
- private void TalRashaElements(IPlayer me)
- {
- RashaBackgroundBrush.DrawRectangle((HudWidth * 0.5f - RLSize * .5f) - RLSize * 1.6f, HudHeight * RLYpos - RLSize * 0.1f, RLSize * 4.1f, RLSize * 1.1f);
- if (me.Powers.BuffIsActive(429855, 1)) ArcaneBrush.DrawRectangle((HudWidth * 0.5f - RLSize * .5f) - RLSize * 1.5f, HudHeight * RLYpos, RLSize * RLSizeMod, RLSize * RLSizeMod);
- else DrawGreyBrush(-RLSize * 1.5f);
- if (me.Powers.BuffIsActive(429855, 2)) ColdBrush.DrawRectangle((HudWidth * 0.5f - RLSize * .5f) - RLSize / 2, HudHeight * RLYpos, RLSize * RLSizeMod, RLSize * RLSizeMod);
- else DrawGreyBrush(-RLSize / 2);
- if (me.Powers.BuffIsActive(429855, 3)) FireBrush.DrawRectangle((HudWidth * 0.5f - RLSize * .5f) + RLSize / 2, HudHeight * RLYpos, RLSize * RLSizeMod, RLSize * RLSizeMod);
- else DrawGreyBrush(RLSize / 2);
- if (me.Powers.BuffIsActive(429855, 4)) LightningBrush.DrawRectangle((HudWidth * 0.5f - RLSize * .5f) + RLSize * 1.5f, HudHeight * RLYpos, RLSize * RLSizeMod, RLSize * RLSizeMod);
- else DrawGreyBrush(RLSize * 1.5f);
- }
- private void DrawGreyBrush(float xPos)
- {
- GreyBrush.DrawRectangle((HudWidth * 0.5f - RLSize * .5f) + xPos, HudHeight * RLYpos, RLSize * RLSizeMod, RLSize * RLSizeMod);
- }
- public string ArchonStatusText()
- {
- string s = "";
- if (ArchonSkill.CooldownFinishTick > Hud.Game.CurrentGameTick && ArchonSkill.SnoPower.NameLocalized.Equals("Archon"))
- {
- var c = (ArchonSkill.CooldownFinishTick - Hud.Game.CurrentGameTick) / 60.0d;
- s = string.Format("{0:N1}", c);
- }
- return s;
- }
- private void DrawWarnings(IPlayer me)
- {
- //IN ARCHON
- if (me.Powers.BuffIsActive(134872, 2)) //Archon
- {
- if (!me.Powers.BuffIsActive(135663, 0)) //Bubble
- {
- var layout = WarningFont.GetTextLayout("Bubble Up");
- WarningFont.DrawText(layout, HudWidth * 0.5f - (layout.Metrics.Width * 0.5f), HudHeight * 0.47f);
- }
- }
- //NOT IN ARCHON
- else {
- if (MWeaponSkill != null)
- {
- var layout = WarningFont.GetTextLayout("Missing Magic Weapon");
- if (!me.Powers.BuffIsActive(76108, 0))
- WarningFont.DrawText(layout, HudWidth * 0.5f - (layout.Metrics.Width * 0.5f), HudHeight * 0.47f);
- }
- if (EArmorSkill != null)
- {
- var layout = WarningFont.GetTextLayout("Missing Energy Armor");
- if (!me.Powers.BuffIsActive(86991, 0))
- WarningFont.DrawText(layout, HudWidth * 0.5f - (layout.Metrics.Width * 0.5f), HudHeight * 0.49f);
- }
- }
- }
- private void UpdateSkills(IPlayer me)
- {
- me.Powers.UsedSkills.ForEach(skill =>
- {
- if (skill.SnoPower.Sno == 134872) ArchonSkill = skill;
- if (skill.SnoPower.Sno == 76108) MWeaponSkill = skill;
- if (skill.SnoPower.Sno == 86991) EArmorSkill = skill;
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement