Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://www.ownedcore.com/forums/diablo-3/turbohud/turbohud-plugin-review-zone/636940-v7-3-international-resu-urshisgiftplugin.html
- using System;
- using System.Diagnostics;
- using System.Globalization;
- using System.Linq;
- using Turbo.Plugins.Default;
- using System.Collections.Generic;
- namespace Turbo.Plugins.Resu
- {
- public class UrshisGiftPlugin : BasePlugin, IInGameTopPainter
- {
- public IBrush ShadowBrush { get; set; }
- public IBrush InventoryLockBorderBrush { get; set; }
- public IFont GRupgradeChanceFont { get; set; }
- public int GRlevel { get; set; }
- public int ChanceWantedPercentage { get; set; }
- public int NumberOfAttempts { get; set; }
- public int AddPerc { get; set; }
- private HashSet<int> Chances = new HashSet<int> {100,90,80,70,60,30,15,8,4,2,1};
- private HashSet<int> Attemps = new HashSet<int> {1,2,3,4,5};
- public UrshisGiftPlugin()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- ChanceWantedPercentage = 1;
- NumberOfAttempts = 1;
- ShadowBrush = Hud.Render.CreateBrush(175, 0, 0, 0, -1.6f);
- GRupgradeChanceFont = Hud.Render.CreateFont("arial", 7, 255, 0, 0, 0, true, false, false);
- GRupgradeChanceFont.SetShadowBrush(128, 39, 229, 224, true);
- }
- private int stashTabAbs;
- public void PaintTopInGame(ClipState clipState)
- {
- if (clipState != ClipState.Inventory) return;
- if (!Chances.Contains(ChanceWantedPercentage)) return; //false settings
- if (!Attemps.Contains(NumberOfAttempts)) return; //false settings
- stashTabAbs = Hud.Inventory.SelectedStashTabIndex + Hud.Inventory.SelectedStashPageIndex * Hud.Inventory.MaxStashTabCountPerPage;
- foreach (var item in Hud.Game.Items)
- {
- if (item.SnoItem.MainGroupCode != "gems_unique") continue;
- if (item.Location == ItemLocation.Stash)
- {
- if ((item.InventoryY / 10) != stashTabAbs) continue;
- }
- if ((item.InventoryX < 0) || (item.InventoryY < 0)) continue;
- var rect = Hud.Inventory.GetItemRect(item);
- if (rect == System.Drawing.RectangleF.Empty) continue;
- DrawItemGRupgradeChance(item, rect);
- }
- }
- private void DrawItemGRupgradeChance(IItem item, System.Drawing.RectangleF rect)
- {
- var jewelRank = item.JewelRank;
- if (jewelRank == -1) {jewelRank = 0;}
- if (item.SnoItem.Sno == 3249876973 && jewelRank == 100 || // 3249876973 - Esoteric Alteration
- item.SnoItem.Sno == 3249984784 && jewelRank == 100 || // 3249984784 - Mutilation Guard
- item.SnoItem.Sno == 3248762926 && jewelRank == 150 || // 3248762926 - Gogok of Swiftness
- item.SnoItem.Sno == 3250883209 && jewelRank == 50 || // 3250883209 - Iceblink
- item.SnoItem.Sno == 3249805099 && jewelRank == 50) // 3249805099 - Boon of the Hoarder
- {
- var layout = GRupgradeChanceFont.GetTextLayout("max");
- GRupgradeChanceFont.DrawText(layout, rect.X+24, rect.Y+33);
- return;
- }
- if (ChanceWantedPercentage == 100) {AddPerc = 10;}
- else if (ChanceWantedPercentage == 90) {AddPerc = 9;}
- else if (ChanceWantedPercentage == 80) {AddPerc = 8;}
- else if (ChanceWantedPercentage == 70) {AddPerc = 7;}
- else if (ChanceWantedPercentage == 60) {AddPerc = 0;}
- else if (ChanceWantedPercentage == 30) {AddPerc = -1;}
- else if (ChanceWantedPercentage == 15) {AddPerc = -2;}
- else if (ChanceWantedPercentage == 8) {AddPerc = -3;}
- else if (ChanceWantedPercentage == 4) {AddPerc = -4;}
- else if (ChanceWantedPercentage == 2) {AddPerc = -5;}
- else if (ChanceWantedPercentage == 1) {AddPerc = -15;}
- GRlevel = jewelRank + AddPerc + (NumberOfAttempts - 1);
- var text = GRlevel.ToString("D", CultureInfo.InvariantCulture);
- if (GRlevel < 100)
- {
- var layout = GRupgradeChanceFont.GetTextLayout(text);
- GRupgradeChanceFont.DrawText(layout, rect.X+33, rect.Y+33);
- }
- else if (GRlevel >= 100 )
- {
- var layout = GRupgradeChanceFont.GetTextLayout(text);
- GRupgradeChanceFont.DrawText(layout, rect.X+27, rect.Y+33);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement