Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Text;
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.Csavo // Plugin for counting legendary drops. Credits to JackCeparou (http://www.ownedcore.com/forums/members/1164396-jackceparou.html) for helping out!
- {
- public class LegendaryCountPlugin : BasePlugin, IInGameTopPainter, ILootGeneratedHandler // version 1.0
- {
- public bool ShowPercent { get; set; }
- public int LegendaryCount { get; private set; }
- public int AncientCount { get; private set; }
- public int PrimalCount { get; private set; }
- public IFont TextFont { get; set; }
- public LegendaryCountPlugin()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- ShowPercent = true;
- LegendaryCount = 0;
- AncientCount = 0;
- PrimalCount = 0;
- TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 235, 170, false, false, true);
- }
- public void OnLootGenerated(IItem item, bool gambled)
- {
- if (item.IsLegendary)
- {
- if (item.AncientRank >= 0) LegendaryCount++;
- if (item.AncientRank == 1) AncientCount++;
- if (item.AncientRank == 2) PrimalCount++;
- }
- }
- public void PaintTopInGame(ClipState clipState)
- {
- if (clipState != ClipState.BeforeClip) return;
- if (TextFont == null) return;
- var uiMinimap = Hud.Render.MinimapUiElement.Rectangle;
- if (!ShowPercent)
- {
- var text = string.Format("Legs: {0} / {1} / {2}", LegendaryCount, AncientCount, PrimalCount);
- var layout = TextFont.GetTextLayout(text);
- TextFont.DrawText(layout, uiMinimap.Left, uiMinimap.Top);
- }
- else
- {
- var text = string.Format("Legs: {0} / {1} ({2:0.#}%) / {3} ({4:0.##}%)", LegendaryCount, AncientCount, ((float)AncientCount * 100 / LegendaryCount), PrimalCount, ((float)PrimalCount * 100 / LegendaryCount));
- var layout = TextFont.GetTextLayout(text);
- TextFont.DrawText(layout, uiMinimap.Left, uiMinimap.Top);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement