Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.DAV
- {
- public class DAV_KilledElitePlugin : BasePlugin, IInGameTopPainter, INewAreaHandler, IMonsterKilledHandler {
- public float xPos { get; set; }
- public float yPos { get; set; }
- public float showTimer { get; set; }
- public string msgHeader { get; set; }
- public IFont textFont { get; set; }
- private List<Tuple<string, int>> DeadList { get; set; } = new List<Tuple<string, int>>();
- private Dictionary<string, int> DeadCount { get; set; } = new Dictionary<string, int>();
- public DAV_KilledElitePlugin() {
- Enabled = true;
- }
- public override void Load(IController hud) {
- base.Load(hud);
- showTimer = 10f;
- msgHeader = "Dead Elite";
- xPos = Hud.Window.Size.Width * 0.5f;
- yPos = Hud.Window.Size.Height * 160 / 1080;
- textFont = Hud.Render.CreateFont("Arial", 10, 255, 51, 255, 51, true, true, true);
- }
- public void PaintTopInGame(ClipState clipState) {
- if (Hud.Game.SpecialArea != SpecialArea.GreaterRift) return;
- if (Hud.Game.RiftPercentage == 100) return;
- if (DeadList.Count == 0) return;
- var k = 0;
- DeadCount.Clear();
- var curTime = Hud.Game.CurrentGameTick;
- foreach(var monster in DeadList) {
- if (monster.Item2 + (int)(60 * showTimer) < curTime) {
- k++;
- continue;
- }
- if (DeadCount.ContainsKey(monster.Item1))
- DeadCount[monster.Item1]++;
- else
- DeadCount.Add(monster.Item1, 1);
- }
- var msg = msgHeader;
- foreach (KeyValuePair<string, int> deadElite in DeadCount)
- msg += "\n" + deadElite.Value.ToString() + " x " + deadElite.Key;
- textFont.DrawText(msg, xPos, yPos);
- if (k > 0)
- DeadList.RemoveRange(0, k);
- }
- public void OnMonsterKilled(IMonster monster) {
- if (Hud.Game.SpecialArea != SpecialArea.GreaterRift) return;
- if (monster.Rarity == ActorRarity.Champion && !monster.Illusion)
- DeadList.Add(new Tuple<string, int>(monster.SnoMonster.NameLocalized, Hud.Game.CurrentGameTick));
- }
- public void OnNewArea(bool newGame, ISnoArea area) {
- if (newGame || area.IsTown)
- DeadList.Clear();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement