Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Turbo.Plugins.Default;
- using System;
- using System.Linq;
- namespace Turbo.Plugins.RNN
- {
- public class TheFellowshipOfThePotion : BasePlugin, IInGameTopPainter
- {
- private SharpDX.DirectWrite.TextLayout layout { get; set; } = null;
- private ITexture[] PotionTextures { get; set; }
- private IFont FontTimeLeft { get; set; }
- private IFont FontCooldown { get; set; }
- private IFont FontStacks { get; set; }
- private IBrush LoveBrush { get; set; }
- private IBrush CreationBrush { get; set; }
- private IBrush DeterminationBrush { get; set; }
- private float _SizeMultiplier { get; set; }
- private uint snoPower { get; set; } = 488071; // Generic_CommunityBuffDarkAlchemy
- public float OffsetX { get; set; }
- public float OffsetY { get; set; }
- public float Opacity { get; set; }
- public bool swapTexturePotion { get; set; }
- public float SizeMultiplier
- {
- get { return _SizeMultiplier; }
- set
- {
- if (_SizeMultiplier != value)
- {
- _SizeMultiplier = value;
- FontTimeLeft = Hud.Render.CreateFont("Tahoma", 9 * _SizeMultiplier, 255, 0, 255, 0, true, false, 255, 0, 0, 0, true);
- FontCooldown = Hud.Render.CreateFont("Tahoma", 12f * _SizeMultiplier, 255, 255, 255, 255, true, false, 255, 0, 0, 0, true);
- FontStacks = Hud.Render.CreateFont("Tahoma", 8 * _SizeMultiplier, 255, 255, 255, 0, false, false, 255, 0, 0, 0, true);
- }
- }
- }
- public TheFellowshipOfThePotion()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- Order = 91000;
- OffsetX = 2.90f; // To set the x coordinate of the icon (OffsetYX * Portrait Width)
- OffsetY = 0.50f; // To set the y coordinate of the icon (OffsetYX * Portrait Height)
- Opacity = 0.75f; // 0f..1f Opacity for icon texture
- SizeMultiplier = 0.65f; // Size multiplier for icons
- swapTexturePotion = true; // Change the texture when you get a buff from the potion.
- LoveBrush = Hud.Render.CreateBrush(255, 255, 0, 128, -1); // Damage
- CreationBrush = Hud.Render.CreateBrush(255, 64, 200, 144, -1); // CDR
- DeterminationBrush = Hud.Render.CreateBrush(255, 164, 150, 32, -1); // RCR
- PotionTextures = new ITexture[]
- {
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_01), // 2276259498 - Bottomless Potion of the Tower
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_02), // 2276259499 - Bottomless Potion of the Diamond
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_03), // 2276259500 - Bottomless Potion of Regeneration
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_04), // 2276259501 - Bottomless Potion of the Leech
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_05), // 2276259502 - Bottomless Potion of Mutilation
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_06), // 2276259503 - Bottomless Potion of Kulle-Aid
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.P2_HealthPotionLegendary_07), // 510979313 - Bottomless Potion of Rejuvenation
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_08), // 2276259505 - Bottomless Potion of Fear
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_09), // 2276259506 - Bottomless Potion of Amplification
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_10), // 2276259530 - Bottomless Potion of Chaos
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_11), // 2276259531 - Bottomless Potion of the Unfettered
- Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionBottomless),
- };
- }
- int GetIndexTexture(IPlayer p)
- {
- var textureIndex = 11;
- if (Math.Abs(Hud.Game.CurrentGameTick - p.Powers.HealthPotionSkill.CooldownStartTick) < 421)
- {
- if ( p.Powers.BuffIsActive(342078) )
- {
- for(var i = 0; i < 5; i++)
- {
- if (p.Powers.BuffIsActive(342078,i)) { textureIndex = i; break; }
- }
- }
- else if (p.Powers.BuffIsActive(344094)) textureIndex = 5;
- else if (p.Powers.BuffIsActive(433021)) textureIndex = 6;
- else if (p.Powers.BuffIsActive(428812)) textureIndex = 7;
- else if (p.Powers.BuffIsActive(434626)) textureIndex = 8;
- else if (p.Powers.BuffIsActive(451310)) textureIndex = 9;
- else if (p.Powers.BuffIsActive(483315)) textureIndex = 10;
- }
- return textureIndex;
- }
- public void PaintTopInGame(ClipState clipState)
- {
- if (clipState != ClipState.BeforeClip) return;
- if (!Hud.Game.IsInGame) return;
- if (Hud.Game.Me.Powers.BuffIsActive(488071)) // Comunity_Buff_DarkAlchemy , Season
- {
- var players = Hud.Game.Players.Where( p => p.HasValidActor && p.Powers.BuffIsActive(488004) ); //P75_ItemPassive_DarkAlchemyMayor_001 // Madre
- foreach(var player in players)
- {
- var x = player.PortraitUiElement.Rectangle.X + player.PortraitUiElement.Rectangle.Width * OffsetX; var y = player.PortraitUiElement.Rectangle.Y + player.PortraitUiElement.Rectangle.Height * OffsetY;
- var SizeIconWidth = Hud.Texture.BuffFrameTexture.Width * Hud.Window.Size.Height/1200.0f * _SizeMultiplier; var SizeIconHeight = Hud.Texture.BuffFrameTexture.Height * Hud.Window.Size.Height/1200.0f * _SizeMultiplier;
- if (swapTexturePotion) PotionTextures[GetIndexTexture(player)].Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
- else Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionBottomless).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
- Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity);
- var skill = player.Powers.HealthPotionSkill;
- if (skill.CooldownFinishTick > Hud.Game.CurrentGameTick) // player.Powers.HealthPotionSkill.IsOnCooldown
- {
- double remaining = (skill.CooldownFinishTick - Hud.Game.CurrentGameTick)/60.0d;
- layout = FontCooldown.GetTextLayout( remaining.ToString( (remaining < 1)? "F1":"F0" ) );
- FontCooldown.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width))/2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height))/1.20f) );
- if ( (Hud.Game.CurrentGameTick - skill.CooldownStartTick) < 421) // 7s
- {
- var circles = Hud.Game.Actors.Where(a => a.SnoActor.Sno == ActorSnoEnum._generic_proxy && a.CreatedAtInGameTick == skill.CooldownStartTick);
- if (circles.Any())
- {
- if ( circles.Any(a => a.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, snoPower) == 1) ) LoveBrush.DrawRectangle(x, y, SizeIconWidth, SizeIconHeight);
- else if ( circles.Any(a => a.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_7_Visual_Effect_None, snoPower) == 1) ) CreationBrush.DrawRectangle(x, y, SizeIconWidth, SizeIconHeight);
- else if ( circles.Any(a => a.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_6_Visual_Effect_None, snoPower) == 1) ) DeterminationBrush.DrawRectangle(x, y, SizeIconWidth, SizeIconHeight);
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement