s4000

DAV_ShrineTaker

Dec 24th, 2020
1,069
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Linq;
  3. using Turbo.Plugins.Default;
  4.  
  5. namespace Turbo.Plugins.DAV
  6. {
  7.     public class DAV_ShrineTaker : BasePlugin, IInGameWorldPainter {
  8.         public string Message_ByMe { get; set; }
  9.         public Func<string, string> Message_ByOther { get; set; }
  10.         public WorldDecoratorCollection TakerDecorator { get; set; }
  11.  
  12.         public DAV_ShrineTaker() {
  13.             Enabled = true;
  14.         }
  15.  
  16.         public override void Load(IController hud) {
  17.             base.Load(hud);
  18.  
  19.             Message_ByMe = "Token by ME";
  20.             Message_ByOther = (name) => "Token by " + name;
  21.  
  22.             TakerDecorator = new WorldDecoratorCollection(
  23.                 new GroundLabelDecorator(Hud) {
  24.                     ForceOnScreen= false,
  25.                     OffsetY = -120,
  26.                     BackgroundBrush = Hud.Render.CreateBrush(255, 255, 255, 64, 0),
  27.                     TextFont = Hud.Render.CreateFont("Arial", 8.5f, 255, 0, 0, 0, false, false, false),
  28.                 }
  29.             );
  30.         }
  31.  
  32.         public void PaintWorld(WorldLayer layer) {
  33.             if (Hud.Game.IsInTown) return;
  34.  
  35.             var shrines = Hud.Game.Shrines.Where(x => (x.IsShrine || x.IsPylon) && (x.IsDisabled || x.IsOperated || x.IsClickable));
  36.             foreach (var actor in shrines) {
  37.                 var tookID = actor.GetAttributeValueAsUInt(Hud.Sno.Attributes.Gizmo_Operator_ACDID, 2147483647);
  38.                 var taker = Hud.Game.Players.FirstOrDefault(y => y.SummonerId == tookID);
  39.                 if (taker != null)
  40.                     TakerDecorator.Paint(layer, actor, actor.FloorCoordinate, taker.IsMe ? Message_ByMe : Message_ByOther(taker.BattleTagAbovePortrait));
  41.             }
  42.         }
  43.     }
  44. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×