Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Globalization;
- using SharpDX;
- using SharpDX.Direct2D1;
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.User
- {
- public class RainbowGobAlert : BasePlugin, IInGameWorldPainter
- {
- public WorldDecoratorCollection PortalDecorator { get; set; }
- public WorldDecoratorCollection DefaultGoblinDecorator { get; set; }
- public WorldDecoratorCollection RainbowGoblinDecorator { get; set; }
- public Dictionary<uint, WorldDecoratorCollection> SnoMapping { get; private set; }
- public bool EnableSpeak { get; set; }
- public RainbowGobAlert()
- {
- Enabled = true;
- SnoMapping = new Dictionary<uint, WorldDecoratorCollection>();
- EnableSpeak = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- CreateDecorators();
- SnoMapping.Add(405186, RainbowGoblinDecorator);
- }
- private void CreateDecorators()
- {
- PortalDecorator = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(180, 255, 255, 255, 0),
- ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
- Radius = 8.0f,
- ShapePainter = new CircleShapePainter(Hud),
- },
- new MapShapeDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(180, 120, 0, 0, 0),
- ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
- Radius = 2.5f,
- ShapePainter = new CircleShapePainter(Hud),
- }
- );
- RainbowGoblinDecorator = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(180, 255, 255, 0, -2),
- Radius = 1.5f,
- },
- new GroundLabelDecorator(Hud)
- {
- BackgroundBrush = Hud.Render.CreateBrush(180, 255, 255, 0, 0),
- BorderBrush = Hud.Render.CreateBrush(0, 0, 0, 0, 0),
- TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 0, 0, 0, true, false, false)
- },
- new MapShapeDecorator(Hud)
- {
- ShapePainter = new CircleShapePainter(Hud),
- Brush = Hud.Render.CreateBrush(180, 150, 150, 225, 3),
- ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
- Radius = 8f,
- },
- new MapShapeDecorator(Hud)
- {
- ShapePainter = new CircleShapePainter(Hud),
- Brush = Hud.Render.CreateBrush(180, 200, 0, 0, 3),
- ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1),
- Radius = 4.5f,
- }
- );
- }
- public void PaintWorld(WorldLayer layer)
- {
- var portals = Hud.Game.Actors.Where(x => x.SnoActor.Sno == 410460);
- foreach (var actor in portals)
- {
- PortalDecorator.Paint(layer, actor, actor.FloorCoordinate, null);
- }
- var goblins = Hud.Game.AliveMonsters.Where(x => x.SnoMonster.Priority == MonsterPriority.goblin);
- foreach (var goblin in goblins)
- {
- if (EnableSpeak && (goblin.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(5000))
- {
- Hud.Sound.Speak(goblin.SnoMonster.NameLocalized);
- goblin.LastSpeak = Hud.Time.CreateAndStartWatch();
- }
- WorldDecoratorCollection decorator;
- if (!SnoMapping.TryGetValue(goblin.SnoActor.Sno, out decorator))
- {
- decorator = DefaultGoblinDecorator;
- }
- decorator.Paint(layer, goblin, goblin.FloorCoordinate, goblin.SnoMonster.NameLocalized);
- }
- }
- public IEnumerable<WorldDecoratorCollection> AllGoblinDecorators()
- {
- yield return RainbowGoblinDecorator;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement