Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.yin
- {
- public class HeroClassCirclePlugin : BasePlugin, IInGameWorldPainter
- {
- public WorldDecoratorCollection MeDecorator { get; set; } // public propertiy to be editable
- // sno skill/buff? radius
- public Dictionary<HeroClass, List<Tuple<uint, bool, float>>> HeroClassCircleRadius { get; set; }
- public Dictionary<HeroClass, IBrush> HeroClassCircleBrush { get; set; }
- public bool ShowInTown { get; set; }
- public bool ShowInNormalRift { get; set; }
- private float CircleRadius;
- public HeroClassCirclePlugin()
- {
- Enabled = true;
- CircleRadius = 5; // default value
- ShowInTown = true;
- ShowInNormalRift = false;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- MeDecorator = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(255, 255, 0, 0, 3),
- Radius = CircleRadius, //default value
- }
- );
- HeroClassCircleBrush = new Dictionary<HeroClass, IBrush>(){
- {HeroClass.Barbarian, Hud.Render.CreateBrush(200, 250, 10, 10, 3)},
- {HeroClass.Crusader, Hud.Render.CreateBrush(240, 0, 200, 250, 3)},
- {HeroClass.DemonHunter, Hud.Render.CreateBrush(255, 0, 0, 200, 3)},
- {HeroClass.Monk, Hud.Render.CreateBrush(245, 120, 0, 200, 3)},
- {HeroClass.Necromancer, Hud.Render.CreateBrush(255, 175, 238, 238, 3)},
- {HeroClass.WitchDoctor, Hud.Render.CreateBrush(155, 0, 155, 125, 3)},
- {HeroClass.Wizard, Hud.Render.CreateBrush(255, 250, 50, 180, 3)},
- };
- HeroClassCircleRadius = new Dictionary<HeroClass, List<Tuple<uint, bool, float>>>();
- HeroClassCircleRadius.Add(HeroClass.Barbarian, new List<Tuple<uint, bool, float>>(){
- Tuple.Create(hud.Sno.SnoPowers.Barbarian_GroundStomp.Sno, true, 24f),//践踏, Barbarian_GroundStomp, 79446
- //Tuple.Create(hud.Sno.SnoPowers.Barbarian_Leap.Sno, true, 10f),//跳斩, Barbarian_Leap, 93409
- });
- HeroClassCircleRadius.Add(HeroClass.Wizard, new List<Tuple<uint, bool, float>>(){
- Tuple.Create(hud.Sno.SnoPowers.Wizard_Passive_PowerHungry.Sno, false, 30f),//奥能渴求, Wizard_Passive_PowerHungry, 208478
- Tuple.Create(hud.Sno.SnoPowers.Wizard_Passive_Audacity.Sno, false, 15f),//无畏无惧, Wizard_Passive_Audacity, 341540
- });
- HeroClassCircleRadius.Add(HeroClass.Monk, new List<Tuple<uint, bool, float>>(){
- Tuple.Create(hud.Sno.SnoPowers.Monk_InnerSanctuary.Sno, true, 11f),//金轮阵, Monk_InnerSanctuary, 317076
- });
- HeroClassCircleRadius.Add(HeroClass.DemonHunter, new List<Tuple<uint, bool, float>>(){
- Tuple.Create(hud.Sno.SnoPowers.DemonHunter_Passive_SingleOut.Sno, false, 20f),//逐一击破, DemonHunter_Passive_SingleOut, 338859
- Tuple.Create(hud.Sno.SnoPowers.DemonHunter_Passive_SteadyAim.Sno, false, 10f),//稳固瞄准, DemonHunter_Passive_SteadyAim, 164363
- });
- HeroClassCircleRadius.Add(HeroClass.WitchDoctor, new List<Tuple<uint, bool, float>>(){
- Tuple.Create(hud.Sno.SnoPowers.WitchDoctor_Horrify.Sno, true, 18f),//惧灵, WitchDoctor_Horrify, 67668
- Tuple.Create(hud.Sno.SnoPowers.WitchDoctor_SoulHarvest.Sno, true, 18f),//灵魂收割, WitchDoctor_SoulHarvest, 67616
- });
- HeroClassCircleRadius.Add(HeroClass.Crusader, new List<Tuple<uint, bool, float>>(){
- Tuple.Create(hud.Sno.SnoPowers.Crusader_Condemn.Sno, true, 15f),//天谴, Crusader_Condemn, 266627
- Tuple.Create(hud.Sno.SnoPowers.WitchDoctor_SoulHarvest.Sno, true, 18f),//灵魂收割, WitchDoctor_SoulHarvest, 67616
- });
- HeroClassCircleRadius.Add(HeroClass.Necromancer, new List<Tuple<uint, bool, float>>(){
- Tuple.Create(hud.Sno.SnoPowers.Necromancer_DeathNova.Sno, true, 15f),//死亡新星, Necromancer_DeathNova, 462243
- });
- }
- public void PaintWorld(WorldLayer layer)
- {
- if ((Hud.Game.MapMode == MapMode.WaypointMap) || (Hud.Game.MapMode == MapMode.ActMap) || (Hud.Game.MapMode == MapMode.Map)) return;
- if (!Hud.Game.Me.IsInGame) return;
- if (!ShowInTown && Hud.Game.Me.IsInTown) return;
- if (!ShowInNormalRift && (Hud.Game.SpecialArea == SpecialArea.Rift)) return;
- var me = Hud.Game.Me;
- var radiusList = HeroClassCircleRadius[me.HeroClassDefinition.HeroClass];
- // find the first matched sno
- var matchedRadius = radiusList.Find(tuple => {
- // if is skill, not buff or passive
- if (tuple.Item2)
- {
- return me.Powers.UsedSkills.Any(skill => skill.SnoPower.Sno == tuple.Item1);
- }
- else {
- return me.Powers.BuffIsActive(tuple.Item1);
- }
- });
- if (matchedRadius != null && matchedRadius.Item3 != 0)
- {
- MeDecorator.GetDecorators<IWorldDecoratorWithRadius>().ForEach(d => d.Radius = matchedRadius.Item3);
- MeDecorator.GetDecorators<GroundCircleDecorator>().ForEach(d => d.Brush = HeroClassCircleBrush[me.Hero.ClassDefinition.HeroClass]);
- MeDecorator.Paint(layer, me, me.FloorCoordinate, null);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment