Advertisement
s4000

DAV_Extend_OtherPlugin

Jun 27th, 2020
2,301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.95 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using Turbo.Plugins.Default;
  5.  
  6. namespace Turbo.Plugins.DAV
  7. {
  8.     public static class DAV_ExtendOther {
  9.         public static IController Hud { get; private set; }
  10.  
  11.     // ISnoArea variable
  12.         public static string riftMapName { get; set; }
  13.         public static Dictionary<uint, int> ActFix { get; private set; } = new Dictionary<uint, int> { // from RNN
  14.             { 288482, 0 }, { 288684, 0 }, { 288686, 0 }, { 288797, 0 }, { 288799, 0 }, // GR
  15.             { 288801, 0 }, { 288803, 0 }, { 288809, 0 }, { 288812, 0 }, { 288813, 0 }, // GR
  16.             {  63666, 1 }, { 445426, 1 },
  17.             { 456638, 2 }, { 460671, 2 }, { 464092, 2 }, { 464830, 2 }, { 465885, 2 }, { 467383, 2 },
  18.             { 444307, 3 }, { 445762, 3 },
  19.             { 444396, 4 }, { 445792, 4 }, { 446367, 4 }, { 446550, 4 }, { 448011, 4 }, { 448039, 4 },
  20.             { 464063, 4 }, { 464065, 4 }, { 464066, 4 }, { 464810, 4 }, { 464820, 4 }, { 464821, 4 },
  21.             { 464822, 4 }, { 464857, 4 }, { 464858, 4 }, { 464865, 4 }, { 464867, 4 }, { 464868, 4 },
  22.             { 464870, 4 }, { 464871, 4 }, { 464873, 4 }, { 464874, 4 }, { 464875, 4 }, { 464882, 4 },
  23.             { 464886, 4 }, { 464889, 4 }, { 464890, 4 }, { 464940, 4 }, { 464941, 4 }, { 464942, 4 },
  24.             { 464943, 4 }, { 464944, 4 }, { 475854, 4 }, { 475856, 4 },
  25.             { 448391, 5 }, { 448368, 5 }, { 448375, 5 }, { 448398, 5 }, { 448404, 5 }, { 448411, 5 },
  26.         };
  27.  
  28.     // IMonster variable
  29.         public static Dictionary<MonsterAffix, int> AffixPriority { get; set; } = new Dictionary<MonsterAffix, int> {
  30.             { MonsterAffix.Wormhole, 1 },       { MonsterAffix.Juggernaut, 2 },     { MonsterAffix.Waller, 3 },
  31.             { MonsterAffix.Teleporter, 4 },     { MonsterAffix.Shielding, 5 },      { MonsterAffix.Illusionist, 6 },
  32.             { MonsterAffix.Electrified, 7 },    { MonsterAffix.Orbiter, 8 },        { MonsterAffix.Thunderstorm, 9 },
  33.             { MonsterAffix.FireChains, 10 },    { MonsterAffix.Desecrator, 11 },    { MonsterAffix.Molten, 12 },
  34.             { MonsterAffix.Mortar, 13 },        { MonsterAffix.Frozen, 14 },        { MonsterAffix.FrozenPulse, 15 },
  35.             { MonsterAffix.Arcane, 16 },        { MonsterAffix.Jailer, 17 },        { MonsterAffix.Plagued, 18 },
  36.             { MonsterAffix.Poison, 19 },        { MonsterAffix.Horde, 20 },         { MonsterAffix.MissileDampening, 21 },
  37.             { MonsterAffix.Fast, 23 },
  38.             { MonsterAffix.Knockback, 25 },     { MonsterAffix.Nightmarish, 26 },   { MonsterAffix.Vortex, 27 },
  39.             { MonsterAffix.Avenger, 28 },       { MonsterAffix.Reflect, 29 },       { MonsterAffix.HealthLink, 30 },
  40.         };
  41.  
  42.     // Initial Setting
  43.         public static void Init(IController hud) {
  44.             Hud = hud;
  45.         }
  46.  
  47.     // IActor Extends
  48.         public static IScreenCoordinate ScreenFloorCoordinate(this IActor actor, float offsetX = 0f, float offsetY = 0f) {
  49.             var screenCoord = actor.FloorCoordinate.ToScreenCoordinate(true);
  50.  
  51.             return Hud.Window.CreateScreenCoordinate(screenCoord.X + offsetX, screenCoord.Y + offsetY);
  52.         }
  53.  
  54.         public static bool isOculus(this IActor actor) {
  55.             return (actor.SnoActor.Sno == ActorSnoEnum._generic_proxy && actor.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, Hud.Sno.SnoPowers.OculusRing.Sno) == 1);
  56.         }
  57.  
  58.     // IMonster Extends
  59.         public static int Priority(this ISnoMonsterAffix mAffix) { return AffixPriority[mAffix.Affix]; }
  60.         public static void SetPriority(MonsterAffix affic, int priority) { AffixPriority[affic] = priority; }
  61.  
  62.         public static bool IceBlinked(this IMonster m) { return m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, 428354) == 1; }
  63.  
  64.         // Necromancer
  65.         public static bool Frailtied(this IMonster m) { return m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471845) == 1; }
  66.         public static bool Leeched(this IMonster m) { return m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471869) == 1; }
  67.         public static bool Decrepified(this IMonster m) { return m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471738) == 1; }
  68.  
  69.         public static float PctHealth(this IMonster m, bool base100 = true) {
  70.             var healthRatio = Math.Min(m.CurHealth / m.MaxHealth, 1);
  71.             return (float) (healthRatio * (base100 ? 100 : 1));
  72.         }
  73.  
  74.     // ISnoArea Extends
  75.         public static void SetRiftMapName(string map_to) { riftMapName = map_to; }
  76.         public static int ActFixed(this ISnoArea snoArea) { return ActFix.ContainsKey(snoArea.Sno) ? ActFix[snoArea.Sno] : snoArea.Act; }
  77.  
  78.         public static string CustAreaName(this ISnoArea snoArea, bool showAct = false) {
  79.             if (snoArea.Code.StartsWith("x1_lr_l"))
  80.                 return snoArea.Code.Replace("x1_lr_level_", riftMapName);
  81.             if (showAct) {
  82.                 var actrev = snoArea.ActFixed();
  83.                 if (actrev > 0)
  84.                     return ("A" + actrev + " - " + snoArea.NameLocalized);
  85.             }
  86.             return snoArea.NameLocalized;
  87.         }
  88.     }
  89.  
  90.     public class DAV_Extend_OtherPlugin : BasePlugin {
  91.  
  92.         public DAV_Extend_OtherPlugin() {
  93.             Enabled = true;
  94.         }
  95.  
  96.         public override void Load(IController hud) {
  97.             base.Load(hud);
  98.  
  99.             DAV_ExtendOther.Init(hud);
  100.             DAV_ExtendOther.SetRiftMapName("Rift ");
  101.             Enabled = false;
  102.         }
  103.     }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement