Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Collections.Generic;
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.DAV
- {
- public class DAV_LegendGemCountPlugin : BasePlugin, IInGameTopPainter {
- public bool alwayShow { get; set; } = false;
- public float offsetRatioX { get; set; }
- public float offsetRatioY { get; set; }
- public float GemSize { get; set; }
- public Func<int, string> GemTotal { get; set; }
- public IFont GemQtyFont { get; set; }
- public ITexture GemInvTexture { get; set; }
- private ITexture[] GemLvlTexture { get; set; } = new ITexture[8];
- private int[] GemLvlQty { get; set; } = new int[8];
- private List<uint> GemSno { get; set; } = new List<uint> {
- 3248511367, 3249948847, 3248547304, 3250847272, 3249661351,
- 3248583241, 3248655115, 3248762926, 3248798863, 3248726989,
- 3249912910, 3249697288, 3248691052, 3250919146, 3249769162,
- 3249841036, 3248619178, 3249733225
- };
- public DAV_LegendGemCountPlugin() {
- Enabled = true;
- }
- public override void Load(IController hud) {
- base.Load(hud);
- offsetRatioX = -0.25f;
- offsetRatioY = 0.1f;
- GemSize = 30f;
- GemTotal = (qty) => "Total : " + qty.ToString();
- GemQtyFont = Hud.Render.CreateFont("Arial", 10, 255, 255, 255, 255, true, false, 128, 0, 0, 0, true);
- GemInvTexture = Hud.Texture.GetTexture(2523381246);
- GemLvlTexture[0] = Hud.Texture.GetTexture(469991964);
- GemLvlTexture[1] = Hud.Texture.GetTexture(469991931);
- GemLvlTexture[2] = Hud.Texture.GetTexture(469991898);
- GemLvlTexture[3] = Hud.Texture.GetTexture(469991865);
- GemLvlTexture[4] = Hud.Texture.GetTexture(469991832);
- GemLvlTexture[5] = Hud.Texture.GetTexture(469991799);
- GemLvlTexture[6] = Hud.Texture.GetTexture(795145451);
- GemLvlTexture[7] = Hud.Texture.GetTexture(795145286);
- }
- public void PaintTopInGame(ClipState clipState) {
- if (clipState != ClipState.Inventory) return;
- var uiInvRect = Hud.Inventory.InventoryMainUiElement.Rectangle;
- var GemInvRect = new RectangleF(uiInvRect.Left + (uiInvRect.Width - GemInvTexture.Width) * 0.5f, uiInvRect.Top + uiInvRect.Height * 0.04f, GemInvTexture.Width, GemInvTexture.Height);
- GemInvTexture.Draw(GemInvRect.X, GemInvRect.Y, GemInvRect.Width, GemInvRect.Height);
- if (alwayShow || Hud.Window.CursorInsideRect(GemInvRect.X, GemInvRect.Y, GemInvRect.Width, GemInvRect.Height)) {
- for (var i = 0; i < 8; i++)
- GemLvlQty[i] = 0;
- foreach (var item in Hud.Inventory.ItemsInStash)
- CountGems(item);
- foreach (var item in Hud.Inventory.ItemsInInventory)
- CountGems(item);
- var xref = uiInvRect.Left + uiInvRect.Width * offsetRatioX;
- var yref = uiInvRect.Top + uiInvRect.Height * offsetRatioY;
- var h = (GemSize - GemQtyFont.GetTextLayout("100").Metrics.Height) / 2;
- var tQty = 0;
- for (var i = 0; i < 8; i++) {
- GemLvlTexture[i].Draw(xref, yref, GemSize, GemSize);
- tQty += GemLvlQty[i];
- GemQtyFont.DrawText(GemLvlQty[i].ToString(), xref + GemSize, yref + h);
- yref += GemSize;
- }
- GemQtyFont.DrawText(GemTotal(tQty), xref, yref + h);
- }
- }
- private void CountGems(IItem item) {
- if (GemSno.Contains(item.SnoItem.Sno)) {
- var gemLvl = item.JewelRank;
- if (gemLvl == 150) GemLvlQty[0]++;
- else if (gemLvl >= 140) GemLvlQty[1]++;
- else if (gemLvl >= 130) GemLvlQty[2]++;
- else if (gemLvl >= 120) GemLvlQty[3]++;
- else if (gemLvl >= 110) GemLvlQty[4]++;
- else if (gemLvl >= 100) GemLvlQty[5]++;
- else if (gemLvl >= 50) GemLvlQty[6]++;
- else GemLvlQty[7]++;
- }
- else if (item.SocketCount > 0 && item.ItemsInSocket != null) {
- var socketedItem = item.ItemsInSocket[0];
- if (GemSno.Contains(socketedItem.SnoItem.Sno)) {
- var gemLvl = socketedItem.JewelRank;
- if (gemLvl == 150) GemLvlQty[0]++;
- else if (gemLvl >= 140) GemLvlQty[1]++;
- else if (gemLvl >= 130) GemLvlQty[2]++;
- else if (gemLvl >= 120) GemLvlQty[3]++;
- else if (gemLvl >= 110) GemLvlQty[4]++;
- else if (gemLvl >= 100) GemLvlQty[5]++;
- else if (gemLvl >= 50) GemLvlQty[6]++;
- else GemLvlQty[7]++;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement