Advertisement
RNNCode

GoblinsPlugin

Apr 6th, 2024 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 20.00 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5.  
  6. namespace Turbo.Plugins.RNN
  7. {
  8.     public class GoblinsPlugin : BasePlugin, IInGameWorldPainter, ICustomizer, INewAreaHandler, IAfterCollectHandler, IMonsterKilledHandler
  9.     {
  10.         public bool Debug { get; set; } = false;
  11.         private int MyIndex { get; set; } = -1;
  12.         private int LastTick { get; set; } = 0;
  13.         private int TotalGoblins { get; set; } = 0;
  14.         private bool foundGoblin { get; set; } = false;
  15.  
  16.         private Dictionary<double, bool> MaxHealthReapp { get; set; } = new Dictionary<double, bool>();
  17.         private Dictionary<ActorSnoEnum, GoblinData> GoblinsDic { get; set; } = new Dictionary<ActorSnoEnum, GoblinData>();
  18.         private Dictionary<string, int> GoblinsFound { get; set; } = new Dictionary<string, int>();
  19.  
  20.         public WorldDecoratorCollection PortalDecorator { get; set; }
  21.         public WorldDecoratorCollection MalevolentDecorator { get; set; }
  22.         public WorldDecoratorCollection BloodDecorator { get; set; }
  23.         public WorldDecoratorCollection OdiousDecorator { get; set; }
  24.         public WorldDecoratorCollection GemDecorator { get; set; }
  25.         public WorldDecoratorCollection GelatinousDecorator { get; set; }
  26.         public WorldDecoratorCollection GildedDecorator { get; set; }
  27.         public WorldDecoratorCollection InsufferableDecorator { get; set; }
  28.         public WorldDecoratorCollection MenageristDecorator { get; set; }
  29.         public WorldDecoratorCollection RainbowDecorator { get; set; }
  30.         public WorldDecoratorCollection FiendDecorator { get; set; }
  31.         public WorldDecoratorCollection TreasureDecorator { get; set; }
  32.         public WorldDecoratorCollection DevilhandDecorator { get; set; }
  33.         public WorldDecoratorCollection VisionDecorator { get; set; }
  34.  
  35.         private ITexture BGTexture { get; set; }
  36.         private ITexture IMGTexture { get; set; }
  37.         private float widthBG { get; set; } = 0;
  38.         private float widthIMG { get; set; } = 0;
  39.         private bool fixLoad  {get; set; } = true;
  40.         private IFont FontText { get; set; }
  41.         private long LastClick { get; set; } = 0;
  42.  
  43.         public bool EnableSpeak { get; set; }
  44.         public string MalevolentSpeak { get; set; }
  45.         public string BloodSpeak { get; set; }
  46.         public string OdiousSpeak { get; set; }
  47.         public string GemSpeak { get; set; }
  48.         public string GelatinousSpeak { get; set; }
  49.         public string GelatinousSplit1Speak { get; set; }
  50.         public string GelatinousSplit2Speak { get; set; }
  51.         public string GildedSpeak { get; set; }
  52.         public string InsufferableSpeak { get; set; }
  53.         public string MenageristSpeak { get; set; }
  54.         public string RainbowSpeak { get; set; }
  55.         public string FiendSpeak { get; set; }
  56.         public string TreasureSpeak { get; set; }
  57.         public string DevilhandSpeak { get; set; }
  58.  
  59.         public string VisionSpeak { get; set; }
  60.         public string TextVisionGoblin { get; set; }
  61.  
  62.         public bool ShowCounter { get; set; }
  63.         public float xPor { get; set; }
  64.         public float yPor { get; set; }
  65.         public float SizeMultiplier { get; set; }
  66.         public float Opacity { get; set; }
  67.  
  68.         public GoblinsPlugin()
  69.         {
  70.             Enabled = true;
  71.         }
  72.  
  73.         public class GoblinData
  74.         {
  75.             public int Amount { get; set; } = 0;
  76.             public string TextSpeak { get; set; } = null;
  77.             public WorldDecoratorCollection Decorator { get; set; }
  78.  
  79.             public GoblinData(string textspeak, WorldDecoratorCollection decorator)
  80.             {
  81.                 this.TextSpeak = textspeak;
  82.                 this.Decorator = decorator;
  83.             }
  84.         }
  85.  
  86.         public override void Load(IController hud)
  87.         {
  88.             base.Load(hud);
  89.             Order = 30001;
  90.  
  91.             EnableSpeak = true;
  92.                                         // null -> NameLocalized , "" -> not Speak
  93.             MalevolentSpeak = null;     // "Malevolent Tormentor"
  94.             BloodSpeak = null;          // "Blood Thief"
  95.             OdiousSpeak = null;         // "Odious Collector"
  96.             GemSpeak = null;            // "Gem Hoarder"
  97.             GelatinousSpeak = null;     // "Gelatinous Sire"
  98.             GelatinousSplit1Speak = ""; // "" -> not Speak
  99.             GelatinousSplit2Speak = "";
  100.             GildedSpeak = null;         // "Gilded Baron"
  101.             InsufferableSpeak = null;   // "Insufferable Miscreant"
  102.             MenageristSpeak = null;     // "Menagerist Goblin"
  103.             RainbowSpeak = null;        // "Rainbow Goblin"
  104.             FiendSpeak = null;          // "Treasure Fiend"
  105.             TreasureSpeak = null;       // "Treasure Goblin"
  106.             DevilhandSpeak = null;      // "Snitchley"
  107.  
  108.             VisionSpeak = "";           // "Vision Goblin" speak when found. "" for nothing (ex. if you are installed EnmityVisionplugin)
  109.             TextVisionGoblin = "Vision Goblin"; // to differentiate it from the treasure goblins, will be used instead of namelocalized for report and decorators
  110.  
  111.             ShowCounter = true;
  112.             xPor = 0.324f;          // To set the x coordinate of the icon
  113.             yPor = 0.850f;          // To set the y coordinate of the icon
  114.             Opacity = 0.80f;        // 0f..1f  Opacity for icon texture
  115.             SizeMultiplier = 0.5f;  // Size multiplier for icon
  116.  
  117.  
  118.             BGTexture = Hud.Texture.GetTexture(672253601);  // 679903159 , 672253601
  119.             IMGTexture = Hud.Texture.GetTexture(2605755780);
  120.             CreateDecorators();
  121.         }
  122.  
  123.         public void Customize()
  124.         {
  125.             Hud.TogglePlugin<GoblinPlugin>(false);
  126.  
  127.             GoblinsDic.Add( ActorSnoEnum._p1_treasuregoblin_tentacle_a, new GoblinData(RainbowSpeak, RainbowDecorator) );
  128.             GoblinsDic.Add( ActorSnoEnum._p1_treasuregobin_a_unique_greedminion, new GoblinData(FiendSpeak, FiendDecorator) );
  129.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_a, new GoblinData(TreasureSpeak, TreasureDecorator) ); // "Treasure Goblin"
  130.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_b, new GoblinData(OdiousSpeak, OdiousDecorator)    );  // "Odious Collector"
  131.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_c, new GoblinData(GemSpeak, GemDecorator)  );          // "Gem Hoarder"
  132.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_c_unique_devilshand, new GoblinData(DevilhandSpeak, DevilhandDecorator) );
  133.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_d_splitter, new GoblinData(GelatinousSpeak, GelatinousDecorator)   );          // Gelatinous Sire
  134.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_d_splitter_02, new GoblinData(GelatinousSplit1Speak, GelatinousDecorator) );   // Gelatinous Spawn
  135.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_d_splitter_03, new GoblinData(GelatinousSplit2Speak, GelatinousDecorator) );   // Gelatinous Spawn
  136.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_e, new GoblinData(InsufferableSpeak, InsufferableDecorator) ); // "Insufferable Miscreant"
  137.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_f, new GoblinData(BloodSpeak, BloodDecorator) );           // "Blood Thief"
  138.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_h, new GoblinData(MalevolentSpeak, MalevolentDecorator) ); // "Malevolent Tormentor"
  139.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_j, new GoblinData(GildedSpeak, GildedDecorator) );         // "Gilded Baron"
  140.             GoblinsDic.Add( ActorSnoEnum._treasuregoblin_k, new GoblinData(MenageristSpeak, MenageristDecorator) );
  141.                                         // -- Vision --"
  142.             GoblinsDic.Add( ActorSnoEnum._p76_treasuregoblin_a, GoblinsDic[ActorSnoEnum._treasuregoblin_a] );   // Value by reference
  143.             GoblinsDic.Add( ActorSnoEnum._p76_treasuregoblin_b, GoblinsDic[ActorSnoEnum._treasuregoblin_b] );
  144.             GoblinsDic.Add( ActorSnoEnum._p76_treasuregoblin_c, GoblinsDic[ActorSnoEnum._treasuregoblin_c] );
  145.             GoblinsDic.Add( ActorSnoEnum._p76_treasuregoblin_e, GoblinsDic[ActorSnoEnum._treasuregoblin_e] );
  146.             GoblinsDic.Add( ActorSnoEnum._p76_treasuregoblin_f, GoblinsDic[ActorSnoEnum._treasuregoblin_f] );
  147.             GoblinsDic.Add( ActorSnoEnum._p76_treasuregoblin_a_noportal, new GoblinData(VisionSpeak, VisionDecorator) );
  148.                                         // -- NightMares --
  149.             GoblinsDic.Add( ActorSnoEnum._p73_treasuregoblin_a, GoblinsDic[ActorSnoEnum._treasuregoblin_a] );
  150.             GoblinsDic.Add( ActorSnoEnum._p73_treasuregoblin_b, GoblinsDic[ActorSnoEnum._treasuregoblin_b] );
  151.             GoblinsDic.Add( ActorSnoEnum._p73_treasuregoblin_c, GoblinsDic[ActorSnoEnum._treasuregoblin_c] );
  152.             GoblinsDic.Add( ActorSnoEnum._p73_treasuregoblin_e, GoblinsDic[ActorSnoEnum._treasuregoblin_e] );
  153.             GoblinsDic.Add( ActorSnoEnum._p73_treasuregoblin_f, GoblinsDic[ActorSnoEnum._treasuregoblin_f] );
  154.             GoblinsDic.Add( ActorSnoEnum._p73_treasuregoblin_h, GoblinsDic[ActorSnoEnum._treasuregoblin_h] );
  155.             GoblinsDic.Add( ActorSnoEnum._p73_treasuregoblin_j, GoblinsDic[ActorSnoEnum._treasuregoblin_j] );
  156.  
  157.             FontText = Hud.Render.CreateFont("arial", 18f * SizeMultiplier, 255, 255, 255, 255, false, false, 255, 0, 0, 0, true);
  158.         }
  159.  
  160.         public void OnNewArea(bool newGame, ISnoArea area)
  161.         {
  162.             if (newGame || (MyIndex != Hud.Game.Me.Index) )
  163.             {
  164.                 MyIndex = Hud.Game.Me.Index;
  165.                 DataGoblinsReset();
  166.             }
  167.         }
  168.  
  169.         private void DataGoblinsReset()
  170.         {
  171.             MaxHealthReapp.Clear();
  172.             GoblinsFound.Clear();
  173.             foreach(var d in GoblinsDic) { d.Value.Amount = 0; }
  174.             LastTick = 0;
  175.             foundGoblin = false;
  176.             TotalGoblins = 0;
  177.         }
  178.  
  179.         private string GoblinsText()
  180.         {
  181.             string text = string.Format("[ {0} Goblins ]", TotalGoblins);
  182.             foreach(var d in GoblinsFound.OrderByDescending(o => o.Value))
  183.             {
  184.                 text += string.Format("\n{0} {1}", d.Value, d.Key);
  185.             }
  186.             return text;
  187.         }
  188.  
  189.         private void CreateDecorators()
  190.         {
  191.             float offsetH = 5.0f , size1 = 8f , size2 = 6f;
  192.  
  193.             PortalDecorator = new WorldDecoratorCollection(
  194.                 new MapShapeDecorator(Hud) {
  195.                     Brush = Hud.Render.CreateBrush(180, 255, 255, 255, 0),
  196.                     Radius = 8.0f
  197.                 },
  198.                 new MapShapeDecorator(Hud) {
  199.                     Brush = Hud.Render.CreateBrush(180, 120, 0, 0, 0),
  200.                     Radius = 2.5f
  201.                 }
  202.             );
  203.             MalevolentDecorator = new WorldDecoratorCollection(
  204.                 new GroundLabelDecorator(Hud) {
  205.                     BackgroundBrush = Hud.Render.CreateBrush(180, 183, 91, 0, 0),
  206.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  207.                 },
  208.                 new MapLabelDecorator(Hud) {
  209.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 183, 91, 0, false, false, 128, 0, 0, 0, true),
  210.                     RadiusOffset = offsetH,
  211.                 }
  212.             );
  213.             BloodDecorator = new WorldDecoratorCollection(
  214.                 new GroundLabelDecorator(Hud) {
  215.                     BackgroundBrush = Hud.Render.CreateBrush(180, 255, 0, 128, 0),
  216.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 255, 255, 255, true, false, false)
  217.                 },
  218.                 new MapLabelDecorator(Hud) {
  219.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 255, 0, 128, false, false, 128, 0, 0, 0, true),
  220.                     RadiusOffset = offsetH,
  221.                 }
  222.             );
  223.             OdiousDecorator = new WorldDecoratorCollection(
  224.                 new GroundLabelDecorator(Hud) {
  225.                     BackgroundBrush = Hud.Render.CreateBrush(180, 0, 255, 0, 0),
  226.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  227.                 },
  228.                 new MapLabelDecorator(Hud) {
  229.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 0, 255, 0, false, false, 128, 0, 0, 0, true),
  230.                     RadiusOffset = offsetH,
  231.                 }
  232.             );
  233.             GemDecorator = new WorldDecoratorCollection(
  234.                 new GroundLabelDecorator(Hud) {
  235.                     BackgroundBrush = Hud.Render.CreateBrush(180, 220, 220, 220, 0),
  236.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  237.                 },
  238.                 new MapLabelDecorator(Hud) {
  239.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 220, 220, 220, false, false, 128, 0, 0, 0, true),
  240.                     RadiusOffset = offsetH,
  241.                 }
  242.             );
  243.             GelatinousDecorator = new WorldDecoratorCollection(
  244.                 new GroundLabelDecorator(Hud) {
  245.                     BackgroundBrush = Hud.Render.CreateBrush(200, 50, 50, 200, 0),
  246.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 255, 255, 255, true, false, false)
  247.                 },
  248.                 new MapLabelDecorator(Hud) {
  249.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 62, 158, 255, false, false, 128, 0, 0, 0, true),
  250.                     RadiusOffset = offsetH,
  251.                 }
  252.             );
  253.             GildedDecorator = new WorldDecoratorCollection(
  254.                 new GroundLabelDecorator(Hud) {
  255.                     BackgroundBrush = Hud.Render.CreateBrush(180, 255, 255, 0, 0),
  256.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  257.                 },
  258.                 new MapLabelDecorator(Hud) {
  259.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 255, 255, 0, false, false, 128, 0, 0, 0, true),
  260.                     RadiusOffset = offsetH,
  261.                 }
  262.             );
  263.             InsufferableDecorator = new WorldDecoratorCollection(
  264.                 new GroundLabelDecorator(Hud) {
  265.                     BackgroundBrush = Hud.Render.CreateBrush(180, 64, 128, 128, 0),
  266.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  267.                 },
  268.                 new MapLabelDecorator(Hud) {
  269.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 64, 128, 128, false, false, 128, 0, 0, 0, true),
  270.                     RadiusOffset = offsetH,
  271.                 }
  272.             );
  273.             MenageristDecorator = new WorldDecoratorCollection(
  274.                 new GroundLabelDecorator(Hud) {
  275.                     BackgroundBrush = Hud.Render.CreateBrush(180, 56, 1, 185, 0),
  276.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 255, 255, 255, true, false, false)
  277.                 },
  278.                 new MapLabelDecorator(Hud) {
  279.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 200, 25, 1, 185, true, false, 128, 255, 255, 255, true),
  280.                     RadiusOffset = offsetH,
  281.                 }
  282.             );
  283.             RainbowDecorator = new WorldDecoratorCollection(
  284.                 new GroundLabelDecorator(Hud) {
  285.                     BackgroundBrush = Hud.Render.CreateBrush(160, 196, 107, 255, 0),
  286.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  287.                 },
  288.                 new MapLabelDecorator(Hud) {
  289.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 196, 107, 255, false, false, 128, 0, 0, 0, true),
  290.                     RadiusOffset = offsetH,
  291.                 }
  292.             );
  293.             FiendDecorator  = new WorldDecoratorCollection(
  294.                 new GroundLabelDecorator(Hud) {
  295.                     BackgroundBrush = Hud.Render.CreateBrush(160, 255, 163, 15, 0),
  296.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  297.                 },
  298.                 new MapLabelDecorator(Hud) {
  299.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 255, 163, 15, false, false, 128, 0, 0, 0, true),
  300.                     RadiusOffset = offsetH,
  301.                 }
  302.             );
  303.             TreasureDecorator = new WorldDecoratorCollection(
  304.                 new GroundLabelDecorator(Hud) {
  305.                     BackgroundBrush = Hud.Render.CreateBrush(200, 255, 255, 128, 0),
  306.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  307.                 },
  308.                 new MapLabelDecorator(Hud) {
  309.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 255, 255, 128, false, false, 128, 0, 0, 0, true),
  310.                     RadiusOffset = offsetH,
  311.                 }
  312.             );
  313.             DevilhandDecorator = new WorldDecoratorCollection(
  314.                 new GroundLabelDecorator(Hud) {
  315.                     BackgroundBrush = Hud.Render.CreateBrush(200, 255, 128, 255, 0),
  316.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 0, 0, 0, true, false, false)
  317.                 },
  318.                 new MapLabelDecorator(Hud) {
  319.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 255, 128, 255, false, false, 128, 0, 0, 0, true),
  320.                     RadiusOffset = offsetH,
  321.                 }
  322.             );
  323.             VisionDecorator = new WorldDecoratorCollection(
  324.                 new GroundLabelDecorator(Hud) {
  325.                     BackgroundBrush = Hud.Render.CreateBrush(200, 50, 150, 250, 0),
  326.                     TextFont = Hud.Render.CreateFont("tahoma", size1, 255, 255, 255, 255, true, false, false)
  327.                 },
  328.                 new MapLabelDecorator(Hud) {
  329.                     LabelFont = Hud.Render.CreateFont("tahoma", size2, 255, 62, 158, 255, false, false, 128, 0, 0, 0, true),
  330.                     RadiusOffset = offsetH,
  331.                 }
  332.             );
  333.  
  334.         }
  335.  
  336.         public void AfterCollect()
  337.         {
  338.             if (!Hud.Game.IsInGame || Hud.Game.Me.InGreaterRiftRank > 0) return;
  339.  
  340.             var goblins = Hud.Game.AliveMonsters.Where(x => x.SnoMonster.Priority == MonsterPriority.goblin);
  341.             foreach (var goblin in goblins)
  342.             {
  343.                 if (goblin.MaxHealth > 0)
  344.                 {
  345.                     if (MaxHealthReapp.TryGetValue(goblin.MaxHealth, out var r))
  346.                     {
  347.                         if (r == false)
  348.                         {
  349.                             MaxHealthReapp[goblin.MaxHealth] = true;
  350.                             LastTick = Hud.Game.CurrentGameTick;
  351.                             foundGoblin = true;
  352.                             var name = (goblin.SnoActor.Sno == ActorSnoEnum._p76_treasuregoblin_a_noportal && !string.IsNullOrEmpty(TextVisionGoblin))?TextVisionGoblin:goblin.SnoMonster.NameLocalized;
  353.                             if (!GoblinsDic.TryGetValue(goblin.SnoActor.Sno,out var data))
  354.                             {
  355.                                 //Hud.TextLog.Log("GoblinsData",string.Format("?? \"{0}\" => A:{1} , M:{2} , \"{3}\" , \"{4}\" , P:{5} ",
  356.                                 //goblin.SnoActor.Sno,(int)goblin.SnoActor.Sno,goblin.SnoMonster.Sno,goblin.SnoMonster.NameLocalized,goblin.SnoMonster.NameEnglish, goblin.SnoMonster.Priority),false,true);
  357.                                 data = GoblinsDic[ActorSnoEnum._treasuregoblin_a];
  358.                             }
  359.                             else
  360.                             {
  361.                                 if (data.TextSpeak == null) { data.TextSpeak = name; }
  362.                             }
  363.                             data.Amount += 1;
  364.                             if ( goblin.SnoActor.Sno != ActorSnoEnum._treasuregoblin_d_splitter_02 && goblin.SnoActor.Sno != ActorSnoEnum._treasuregoblin_d_splitter_03 )
  365.                             {
  366.                                 TotalGoblins += 1;
  367.                                 if (GoblinsFound.TryGetValue(name,out var c))   { GoblinsFound[name] = c + 1; }
  368.                                 else { GoblinsFound.Add(name,1); }
  369.                             }
  370.                         }
  371.                     }
  372.                     else { MaxHealthReapp.Add(goblin.MaxHealth, false); }
  373.                 }
  374.             }
  375.             if (foundGoblin && EnableSpeak && Hud.Game.CurrentGameTick - LastTick > 60)
  376.             {
  377.                 foreach(var d in GoblinsDic)
  378.                 {
  379.                     var n = d.Value.Amount;
  380.                     if (n > 0)
  381.                     {
  382.                         var msg = d.Value.TextSpeak ?? "Goblin";
  383.                         if (!string.IsNullOrEmpty(msg))
  384.                         {
  385.                             Hud.Sound.Speak( ((n > 1)? n.ToString() : "") + msg);
  386.                         }
  387.                         d.Value.Amount = 0;
  388.                     }
  389.                 }
  390.                 foundGoblin = false;
  391.             }
  392.         }
  393.  
  394.         public void OnMonsterKilled(IMonster monster)
  395.         {
  396.             if (monster.SnoMonster.Priority == MonsterPriority.goblin && monster.MaxHealth > 0)
  397.             {
  398.                 if (MaxHealthReapp.TryGetValue(monster.MaxHealth, out var r) /*&& r*/)
  399.                 {
  400.                     var n = MaxHealthReapp.Count;
  401.                     MaxHealthReapp.Remove(monster.MaxHealth);
  402.                     Hud.TextLog.Log("GoblinsKill",string.Format("?? \"{0}\" => A:{1} , M:{2} , \"{3}\" , \"{4}\" , P:{5} , Reapp:{6}, MaxHealth:{7}, Count:{8}",
  403.                     monster.SnoActor.Sno,(int)monster.SnoActor.Sno,monster.SnoMonster.Sno,monster.SnoMonster.NameLocalized,monster.SnoMonster.NameEnglish, monster.SnoMonster.Priority, r, monster.MaxHealth, MaxHealthReapp.Count
  404.                     ),false,true);
  405.                 }
  406.             }
  407.         }
  408.  
  409.         public void PaintWorld(WorldLayer layer)
  410.         {
  411.             if ( (!Hud.Game.IsInGame) || (Hud.Game.Me.InGreaterRiftRank > 0) ) return;
  412.  
  413.             var portals = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._treasuregoblin_portal_open);
  414.             foreach (var actor in portals)
  415.             {
  416.                 PortalDecorator.Paint(layer, actor, actor.FloorCoordinate, null);
  417.             }
  418.  
  419.             var goblins = Hud.Game.AliveMonsters.Where(x => x.SnoMonster.Priority == MonsterPriority.goblin);
  420.             foreach (var goblin in goblins)
  421.             {
  422.                 if (!GoblinsDic.TryGetValue(goblin.SnoActor.Sno,out var data))
  423.                 {
  424.                     data = GoblinsDic[ActorSnoEnum._treasuregoblin_a];
  425.                 }
  426.                 (data.Decorator).Paint(layer, goblin, goblin.FloorCoordinate, (goblin.SnoActor.Sno == ActorSnoEnum._p76_treasuregoblin_a_noportal)?TextVisionGoblin:goblin.SnoMonster.NameLocalized);
  427.             }
  428.  
  429.             if (ShowCounter)
  430.             {
  431.                 var x = Hud.Window.Size.Width * xPor; var y = Hud.Window.Size.Height * yPor;
  432.                 widthBG = BGTexture.Width *  Hud.Window.Size.Height/1200.0f * SizeMultiplier; widthIMG = IMGTexture.Width *  Hud.Window.Size.Height/1200.0f * SizeMultiplier;
  433.                 BGTexture.Draw(x, y, widthBG, widthBG, Opacity);
  434.                 IMGTexture.Draw(x + (widthBG - widthIMG)/2, y + (widthBG - widthIMG)/2, widthIMG, widthIMG, Opacity);
  435.                 if (Hud.Window.CursorInsideRect(x, y, widthBG, widthBG))
  436.                 {
  437.                     Hud.Render.SetHint(GoblinsText());
  438.                     if (/*Hud.Input.IsKeyDown(Keys.ControlKey) &&*/ Hud.Input.IsKeyDown(Keys.MButton))
  439.                     {
  440.                         if(Hud.Game.CurrentRealTimeMilliseconds - LastClick > 1000)
  441.                         {
  442.                             LastClick = Hud.Game.CurrentRealTimeMilliseconds;
  443.                             DataGoblinsReset();
  444.                         }
  445.                     }
  446.                 }
  447.                 var layout = FontText.GetTextLayout(TotalGoblins.ToString());
  448.                 FontText.DrawText(layout,x + (widthBG - layout.Metrics.Width)/2,y + (widthBG - layout.Metrics.Height)/2);
  449.             }
  450.         }
  451.     }
  452. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement