Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Turbo.Plugins.User
- {
- using Turbo.Plugins.Default;
- using System.Linq;
- using System.Text;
- using System.Collections.Generic;
- public class MonkFireMysticAllyIndicatorPlugin : BasePlugin, IInGameWorldPainter, IInGameTopPainter
- {
- public WorldDecoratorCollection MysticAllyDecorator;
- public TopLabelDecorator MysticAllyCountLabel;
- public string MysticAllyLabel;
- public int MysticAllyCount;
- public float barW, barH, barX, barY;
- public bool MysticAllyEnabled;
- private static uint MysticAllySkillSNO = 362102;
- public HashSet<ActorSnoEnum> MysticAllyActorSNOs = new HashSet<ActorSnoEnum>
- {
- ActorSnoEnum._monk_male_mystically_crimson, //169906
- ActorSnoEnum._monk_female_mystically_crimson, //168878
- };
- public MonkFireMysticAllyIndicatorPlugin()
- {
- Enabled = true;
- MysticAllyEnabled = true;
- // Inits variables
- MysticAllyCount = 0;
- MysticAllyLabel = "";
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- // Unlike the old XML system where it draws x,y,w,h in terms of percentage of screen size, the new plugin uses actual pixel coordinates
- // To convert x,y,w,h sizes from the XML system to the new plugin system, multiply the screensize with percentage. ie. XML size of 2 => 0.02f * screensize
- // Display coordinates for non-combined indicators
- barW = Hud.Window.Size.Width * 0.012f;
- barH = Hud.Window.Size.Height * 0.0175f;
- barX = Hud.Window.Size.Width * 0.347f;
- barY = Hud.Window.Size.Height * 0.928f;
- // Decorator under each MysticAlly
- MysticAllyDecorator = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(0, 0, 0, 0, 0),
- Radius = 0f,
- });
- // Label Decorator for Indicator
- MysticAllyCountLabel = new TopLabelDecorator(Hud)
- {
- TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 48, 201, 255, true, false, 255, 0, 0, 0, true)
- };
- }
- public void PaintWorld(WorldLayer layer)
- {
- // Don't draw if not playing a Monk
- if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Monk) return;
- // For MysticAlly, only when equipping the skill
- if (MysticAllyEnabled && Hud.Game.Me.Powers.UsedSkills.Where(x => x.SnoPower.Sno == MysticAllySkillSNO) != null)
- {
- // Iterate all the game actors, find out and count which are MysticAlly summoned by player
- var MysticAllyActors = Hud.Game.Actors.Where(EachActor => MysticAllyActorSNOs.Contains(EachActor.SnoActor.Sno) && // Find out which are skeleton melees actors
- EachActor.SummonerAcdDynamicId == Hud.Game.Me.SummonerId); // Then find out if they are summoned by the player
- MysticAllyCount = MysticAllyActors.Count(); // And then count how many are found
- // Paint circle decorator under each MysticAlly
- foreach (var EachActor in MysticAllyActors)
- {
- var text = string.IsNullOrWhiteSpace(MysticAllyLabel) ? EachActor.SnoActor.NameLocalized : MysticAllyLabel;
- MysticAllyDecorator.Paint(layer, EachActor, EachActor.FloorCoordinate, text);
- }
- }
- else
- {
- MysticAllyCount = 0;
- }
- }
- public void PaintTopInGame(ClipState clipState)
- {
- // Don't draw if not playing a Monk
- if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Monk) return;
- if (clipState != ClipState.BeforeClip) return;
- // Drawing count indicator
- if (MysticAllyEnabled && MysticAllyCount != 0)
- {
- MysticAllyCountLabel.TextFunc = () => MysticAllyCount.ToString();
- MysticAllyCountLabel.Paint(barX, barY, barW, barH, HorizontalAlign.Center);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement