[v7.6] [English] [Turbro] InventoryMainStatPlugin menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Turbro's Avatar Member
    Reputation
    4
    Join Date
    Jun 2018
    Posts
    4
    Thanks G/R
    3/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [v7.6] [English] [Turbro] InventoryMainStatPlugin

    A simple plugin to show the main stat of items in the inventory. I made this to help with sorting loot. Hope it helps someone.


    mainstat.png
    [v7.6] [English] [Turbro] InventoryMainStatPlugin-mainstat-png

    Plugin code:
    [C#] InventoryMainStatPlugin - Pastebin.com

    Save the file to plugins\Turbro\InventoryMainStat.cs

    [v7.6] [English] [Turbro] InventoryMainStatPlugin
  2. Thanks SeaDragon, johnbl (2 members gave Thanks to Turbro for this useful post)
  3. #2
    SeaDragon's Avatar Contributor
    Reputation
    321
    Join Date
    Aug 2016
    Posts
    1,041
    Thanks G/R
    140/299
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Different font colors may be easier to identify

  4. #3
    Noobz's Avatar Member
    Reputation
    6
    Join Date
    Mar 2017
    Posts
    143
    Thanks G/R
    8/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This may be older, but I just found it. I tried to change the postion of the text from top left to top right but was not able to. Tried fooling around a bit but no luck. Any chance to make this change? Top left on the items currenly shows the gem inserted into that item from another plugin.

    Noobz

  5. #4
    s4000's Avatar Contributor
    Reputation
    285
    Join Date
    Oct 2018
    Posts
    489
    Thanks G/R
    18/272
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I have modify the code with different color, but no idea how to adjust the location
    Code:
    	public class MainStatPlugin : BasePlugin, IInGameTopPainter {
    		public IFont DexStatFont { get; set; }
    		public IFont StrStatFont { get; set; }
    		public IFont IntStatFont { get; set; }
    
    		private int stashPage, stashTab, stashTabAbs;
    		private float rv;
    
    		public MainStatPlugin() {
    			Enabled = true;
    		}
    
    		public override void Load(IController hud) {
    			base.Load(hud);
    
    			DexStatFont = Hud.Render.CreateFont("arial", 7, 255, 0, 0, 0, true, false, 255, 153, 255, 51, true);
    			StrStatFont = Hud.Render.CreateFont("arial", 7, 255, 0, 0, 0, true, false, 255, 255, 153, 153, true);
    			IntStatFont = Hud.Render.CreateFont("arial", 7, 255, 0, 0, 0, true, false, 255, 255, 255, 153, true);
    		}
    
    		public void PaintTopInGame(ClipState clipState) {
    			if (clipState != ClipState.Inventory) return;
    			
    			stashTab = Hud.Inventory.SelectedStashTabIndex;
    			stashPage = Hud.Inventory.SelectedStashPageIndex;
    			stashTabAbs = stashTab + stashPage * Hud.Inventory.MaxStashTabCountPerPage;
    			rv = 32.0f / 600.0f * Hud.Window.Size.Height;
    
    			var items = Hud.Game.Items.Where(x => x.Location != ItemLocation.Merchant && x.Location != ItemLocation.Floor);
    			foreach (var item in items) {
    				if (item.Location == ItemLocation.Stash) {
    					var tabIndex = item.InventoryY / 10;
    					if (tabIndex != stashTabAbs) continue;
    				}
    
    				if ((item.InventoryX < 0) || (item.InventoryY < 0)) continue;
    
    				var rect = Hud.Inventory.GetItemRect(item);
    				if (rect == System.Drawing.RectangleF.Empty) continue;
    
    				if (item.IsLegendary) // for leg item
    					DrawItemMainStat(item, rect);
    			}
    	   }
    
    		private static string GetMainStatString(IItem item) {
    			if (item != null && item.Perfections != null) {
    				foreach (IItemPerfection perfection in item.Perfections) {
    					if (perfection.Attribute.Code == "Dexterity_Item") return "dex";
    					if (perfection.Attribute.Code == "Intelligence_Item") return "int";
    					if (perfection.Attribute.Code == "Strength_Item") return "str";
    				}
    			}
    			return null;
    		}
    
    		private void DrawItemMainStat(IItem item, System.Drawing.RectangleF rect) {
    			var text = GetMainStatString(item);
    			var size = rv / 4.0f; // test
    			
    			switch (text) {
    				case "dex" : DexStatFont.DrawText("敏", rect.Right - size - rv / 30.0f, rect.Bottom - 2*size- rv / 15.0f); break;
    				case "int" : IntStatFont.DrawText("智", rect.Right - size - rv / 30.0f, rect.Bottom - 2*size- rv / 15.0f); break;
    				case "str" : StrStatFont.DrawText("力", rect.Right - size - rv / 30.0f, rect.Bottom - 2*size - rv / 15.0f); break;
    			}
    		}
    	}
    }

  6. #5
    iThinkiWin's Avatar Active Member
    Reputation
    28
    Join Date
    Oct 2018
    Posts
    104
    Thanks G/R
    25/25
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for width 0.15 can be adjusted left 0.01 to right 0.99
    and height bottom 0.01 to top 0.99

    removed it saying str/dex/int as the text lengths differ and it bugs me so using \u25C6 which is ◆ just colored to the main stat.

    Code:
    using System.Linq;
    using Turbo.Plugins.Default;
     
    namespace Turbo.Plugins.Turbro
    {
        public class InventoryMainStatPlugin : BasePlugin, IInGameTopPainter
        {
            public bool OverlayMainStatOnItems { get; set; }
            public IFont MainStatFont { get; set; }
            public IFont MainStatDexFont { get; set; }
            public IFont MainStatIntFont { get; set; }
            public IFont MainStatStrFont { get; set; }
     
            private int stashPage, stashTab, stashTabAbs;
     
            public InventoryMainStatPlugin()
            {
                Enabled = true;
                OverlayMainStatOnItems = true;
            }
     
            public override void Load(IController hud)
            {
                base.Load(hud);
     
                MainStatFont = Hud.Render.CreateFont("tahoma", 8, 0, 0, 0, 0, false, false, false);
    
                MainStatDexFont = Hud.Render.CreateFont("tahoma", 8, 255, 20, 255, 20, false, false, false);
                MainStatDexFont.SetShadowBrush(128, 0, 0, 0, true);
    
                MainStatIntFont = Hud.Render.CreateFont("tahoma", 8, 255, 255, 255, 20, false, false, false);
                MainStatIntFont.SetShadowBrush(128, 0, 0, 0, true);
    
                MainStatStrFont = Hud.Render.CreateFont("tahoma", 8, 255, 255, 20, 20, false, false, false);
                MainStatStrFont.SetShadowBrush(128, 0, 0, 0, true);
    
            }
     
            public void PaintTopInGame(ClipState clipState)
            {
                if(!OverlayMainStatOnItems) return;
                if (clipState != ClipState.Inventory) return;
               
                stashTab = Hud.Inventory.SelectedStashTabIndex;
                stashPage = Hud.Inventory.SelectedStashPageIndex;
                stashTabAbs = stashTab + stashPage * Hud.Inventory.MaxStashTabCountPerPage;
     
                var items = Hud.Game.Items.Where(x => x.Location != ItemLocation.Merchant && x.Location != ItemLocation.Floor);
                foreach (var item in items)
                {
                    if (item.Location == ItemLocation.Stash)
                    {
                        var tabIndex = item.InventoryY / 10;
                        if (tabIndex != stashTabAbs) continue;
                    }
     
                    if ((item.InventoryX < 0) || (item.InventoryY < 0)) continue;
     
                    var rect = Hud.Inventory.GetItemRect(item);
                    if (rect == System.Drawing.RectangleF.Empty) continue;
     
                    DrawItemMainStat(item, rect);
                }
           }
     
            private static string GetMainStatString(IItem item)
            {
                if (item != null && item.Perfections != null)
                {
                    foreach (IItemPerfection perfection in item.Perfections)
                    {
                        if (perfection.Attribute.Code == "Dexterity_Item") return "dex";
                        if (perfection.Attribute.Code == "Intelligence_Item") return "int";
                        if (perfection.Attribute.Code == "Strength_Item") return "str";
                    }
                }
                return null;
            }
     
            private void DrawItemMainStat(IItem item, System.Drawing.RectangleF rect)
            {
                var text = GetMainStatString(item);
                if(text != null)
                {
                    var font = MainStatFont;
                    if (text == "dex") font = MainStatDexFont;
                    if (text == "int") font = MainStatIntFont;
                    if (text == "str") font = MainStatStrFont;
                    //var textLayout = font.GetTextLayout(text);
                    font.DrawText("\u25C6", rect.Left + rect.Width * 0.15f, rect.Bottom - rect.Height * 0.98f);
                }
            }
        }
    }

  7. #6
    JarJarD3's Avatar Contributor
    Reputation
    106
    Join Date
    Oct 2017
    Posts
    395
    Thanks G/R
    41/101
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    You can check how InventoryAndStashPlugin does this:
    Code:
    private void DrawItemAncientRank(IItem item, System.Drawing.RectangleF rect)
    {
        if (!AncientRankEnabled) return;
        var ancientRank = item.AncientRank;
        if (ancientRank >= 1)
        {
            var caldesannRank = CaldesannRankEnabled ? item.CaldesannRank : 0;
    
            var ancientRankText = ancientRank == 1 ? "A" : "P";
            var font = ancientRank == 1 ? AncientRankFont : PrimalRankFont;
    
            var text = ancientRankText + (caldesannRank > 0 ? ("+" + caldesannRank.ToString("D", CultureInfo.InvariantCulture)) : "");
            var textLayout = font.GetTextLayout(text);
            font.DrawText(textLayout, rect.Right - rv / 15.0f - textLayout.Metrics.Width, rect.Bottom - rv / 35.0f - textLayout.Metrics.Height);
        }
    }
    Bottom left is as easy:
    Code:
    font.DrawText(textLayout, rect.Left + rv / 15.0f, rect.Bottom - rv / 15.0f - textLayout.Metrics.Height);
    rv is kind of margin value and defined as:
    Code:
    rv = 32.0f / 600.0f * Hud.Window.Size.Height;
    This way code might handle different screen resolutions better.
    Though I believe that most screens are Full HD (mine 1920x1200).

    And thank you for the idea to show item main stat, it is brilliant and I stole it immediately!

  8. #7
    iThinkiWin's Avatar Active Member
    Reputation
    28
    Join Date
    Oct 2018
    Posts
    104
    Thanks G/R
    25/25
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now please fix your popup plugin because i adore that one, spend 90% of regular rift playing by map so seeing what actually is happening is nice lol

Similar Threads

  1. [v7.2] [ENGLISH] [Jack] WeaponDamageRerollCalculatorPlugin
    By JackCeparou in forum TurboHUD Community Plugins
    Replies: 74
    Last Post: 12-10-2020, 10:28 AM
  2. [v7.2] [ENGLISH] [Jack] DifficultiesInfoPlugin
    By JackCeparou in forum TurboHUD Community Plugins
    Replies: 13
    Last Post: 08-22-2019, 10:27 PM
  3. [v7.2] [ENGLISH] [Csavo] LegendaryCountPlugin
    By Csavo in forum TurboHUD Community Plugins
    Replies: 21
    Last Post: 04-06-2018, 08:24 AM
  4. [v7.2] [ENGLISH] [DM] DisplayCraftingMaterialPlugin
    By deadmarine in forum TurboHUD Community Plugins
    Replies: 1
    Last Post: 04-12-2017, 05:07 PM
  5. [v7.2] [ENGLISH] [Gigi] RiftTrackerPlugin
    By d3gigi in forum TurboHUD Community Plugins
    Replies: 13
    Last Post: 04-07-2017, 06:29 AM
All times are GMT -5. The time now is 09:00 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search