How to get my equipped health potion sno id ? menu

User Tag List

Results 1 to 12 of 12
  1. #1
    takayo72's Avatar Active Member
    Reputation
    17
    Join Date
    Jan 2018
    Posts
    203
    Thanks G/R
    43/15
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to get my equipped health potion sno id ?

    After getting the sno id, i get the icon texture and display on screen on certain condition

    How to get my equipped health potion sno id ?
  2. #2
    User5981's Avatar First Dev On The Internet
    Reputation
    379
    Join Date
    Aug 2017
    Posts
    765
    Thanks G/R
    30/358
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by takayo72 View Post
    After getting the sno id, i get the icon texture and display on screen on certain condition
    var EquippedPotion = Hud.Game.Items.FirstOrDefault(x => x.Location == ItemLocation.MerchantAvaibleItemsForPurchase);
    Supported version for all Resu plugins

  3. Thanks JarJarD3 (1 members gave Thanks to User5981 for this useful post)
  4. #3
    takayo72's Avatar Active Member
    Reputation
    17
    Join Date
    Jan 2018
    Posts
    203
    Thanks G/R
    43/15
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    it's not working. There is an exception error
    'IEnumerable<IItem>' does not contain a definition for 'FirstOrDefault' and no accessible extension method 'FirstOrDefault' accepting a first argument of type 'IEnumerable<IItem>' could be found (are you missing a using directive or an assembly reference?)

  5. #4
    User5981's Avatar First Dev On The Internet
    Reputation
    379
    Join Date
    Aug 2017
    Posts
    765
    Thanks G/R
    30/358
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by takayo72 View Post
    it's not working. There is an exception error
    'IEnumerable<IItem>' does not contain a definition for 'FirstOrDefault' and no accessible extension method 'FirstOrDefault' accepting a first argument of type 'IEnumerable<IItem>' could be found (are you missing a using directive or an assembly reference?)
    That plugin of mine where I picked up the code line works for months :
    Resu/PotionPerfectionPlugin.cs at master . User5981/Resu . GitHub

    FirstOrDefault needs System.Linq
    Enumerable.FirstOrDefault Method (System.Linq) | Microsoft Docs
    you have to add
    using System.Linq;
    at the beginning of your code.
    Supported version for all Resu plugins

  6. #5
    takayo72's Avatar Active Member
    Reputation
    17
    Join Date
    Jan 2018
    Posts
    203
    Thanks G/R
    43/15
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    my original hard-code a potion and it is working
    Code:
    public ITexture Icon_Texture { get; set; }
    
    Icon_Texture = Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_09);
    Icon_Texture.Draw(MessageX+10, MessageY, 30.0f, 30.0f);
    Now I changed to show the equipped potion on screen
    Code:
    public ITexture Icon_Texture { get; set; }
    
    var EquippedPotion = Hud.Game.Items.FirstOrDefault(x => x.Location == ItemLocation.MerchantAvaibleItemsForPurchase);
    Icon_Texture = Hud.Texture.GetItemTexture(EquippedPotion.SnoItem);
    Icon_Texture.Draw(MessageX+10, MessageY, 30.0f, 30.0f);
    No exception error. But No potion icon drawn on the screen.

  7. #6
    User5981's Avatar First Dev On The Internet
    Reputation
    379
    Join Date
    Aug 2017
    Posts
    765
    Thanks G/R
    30/358
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Give the full code if you want help
    Supported version for all Resu plugins

  8. #7
    takayo72's Avatar Active Member
    Reputation
    17
    Join Date
    Jan 2018
    Posts
    203
    Thanks G/R
    43/15
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    full source code
    Code:
    using System;
    using System.Linq;
    using Turbo.Plugins.Default;
    namespace Turbo.Plugins.adrian
    {
        public class HealthPotionSkillOverlayMessage : BasePlugin, IInGameTopPainter
        {
            public IFont OverlayMessageFont { get; set; }
            public string OverlayMessage  { get; set; }
            public float MessageX { get; set; }
            public float MessageY { get; set; }
            private float HudWidth { get { return Hud.Window.Size.Width; } }
            private float HudHeight { get { return Hud.Window.Size.Height; } }
            public float OffsetX { get; set; }
            public float OffsetY { get; set; }
            public ITexture Icon_Texture { get; set; }
    
            public HealthPotionSkillOverlayMessage()
            {
                Enabled = true;
            }
    
            public override void Load(IController hud)
            {
                base.Load(hud);
                var EquippedPotion = Hud.Game.Items.FirstOrDefault(x => x.Location == ItemLocation.MerchantAvaibleItemsForPurchase);
    
                //Icon_Texture = Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.HealthPotionLegendary_09);
                Icon_Texture = Hud.Texture.GetItemTexture(EquippedPotion.SnoItem);
    
                OverlayMessageFont = Hud.Render.CreateFont("tahoma", 9, 255, 255, 0, 0, true, false, true);
                OffsetX = 0.625f;
                OffsetY = 0;
                OverlayMessage = "POTION IS READY!!";
            }
    
            public void PaintTopInGame(ClipState clipState)
            {
                if (Hud.Render.UiHidden) return;
                if (clipState != ClipState.BeforeClip) return;
                MessageY = HudHeight * OffsetY;
                MessageX = HudWidth * OffsetX;
    
                double Cooldown;
                bool OnCooldown;
    
                Cooldown = (Hud.Game.Me.Powers.HealthPotionSkill.CooldownFinishTick - Hud.Game.CurrentGameTick) / 60d;
                OnCooldown = Cooldown <= 30 && Cooldown >= 0 ? true : false;
                if (!OnCooldown)
                {
                    //OverlayMessageFont.DrawText(OverlayMessage, MessageX, MessageY);
                    Icon_Texture.Draw(MessageX+10, MessageY, 30.0f, 30.0f);
                }
    
            }
        }
    }

  9. #8
    User5981's Avatar First Dev On The Internet
    Reputation
    379
    Join Date
    Aug 2017
    Posts
    765
    Thanks G/R
    30/358
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe try
    OverlayMessage = EquippedPotion.SnoItem.ToString();
    to see what is displayed and identify the problem.
    Supported version for all Resu plugins

  10. #9
    takayo72's Avatar Active Member
    Reputation
    17
    Join Date
    Jan 2018
    Posts
    203
    Thanks G/R
    43/15
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by User5981 View Post
    maybe try
    OverlayMessage = EquippedPotion.SnoItem.ToString();
    to see what is displayed and identify the problem.
    Nothing displayed

  11. #10
    RNN's Avatar Legendary
    Reputation
    801
    Join Date
    Sep 2018
    Posts
    1,043
    Thanks G/R
    102/764
    Trade Feedback
    0 (0%)
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by takayo72 View Post
    Nothing displayed
    Try this, I made some changes:

    Code:
    using System.Linq;
    using Turbo.Plugins.Default;
    
    namespace Turbo.Plugins.adrian
    {
    	public class HealthPotionSkillOverlayMessage : BasePlugin, IInGameTopPainter
    	{
    		public IFont OverlayMessageFont { get; set; }
    		public string OverlayMessage  { get; set; }
    		public float MessageX { get; set; }
    		public float MessageY { get; set; }
    		private float HudWidth { get { return Hud.Window.Size.Width; } }
    		private float HudHeight { get { return Hud.Window.Size.Height; } }
    		public float OffsetX { get; set; }
    		public float OffsetY { get; set; }
    		public ITexture Icon_Texture { get; set; }
    
    		public HealthPotionSkillOverlayMessage()
    		{
    			Enabled = true;
    		}
    		
    		public override void Load(IController hud)
    		{
    			base.Load(hud);
    			OverlayMessageFont = Hud.Render.CreateFont("tahoma", 9, 255, 255, 0, 0, true, false, true);
    			OffsetX = 0.625f;
    			OffsetY = 0;
    			OverlayMessage = "POTION IS READY!!";			
    		}
    
    		public void PaintTopInGame(ClipState clipState)
    		{
    			if (Hud.Render.UiHidden) return;
    			if (clipState != ClipState.BeforeClip) return;
    			MessageY = HudHeight * OffsetY;
    			MessageX = HudWidth * OffsetX;		
    			var EquippedPotion = Hud.Game.Items.FirstOrDefault(x => x.Location == ItemLocation.MerchantAvaibleItemsForPurchase);
    			Icon_Texture = Hud.Texture.GetItemTexture( (EquippedPotion != null)? EquippedPotion.SnoItem : Hud.Sno.SnoItems.HealthPotionBottomless);
    			if (!Hud.Game.Me.Powers.HealthPotionSkill.IsOnCooldown)
    			{
    				OverlayMessageFont.DrawText(OverlayMessage, MessageX, MessageY);
    				Icon_Texture.Draw(MessageX - 40, MessageY, 30.0f, 30.0f);
    			}
    		}
    	}
    }
    Last edited by RNN; 09-07-2019 at 08:50 AM. Reason: if we change the potion its texture will be updated

  12. #11
    takayo72's Avatar Active Member
    Reputation
    17
    Join Date
    Jan 2018
    Posts
    203
    Thanks G/R
    43/15
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Wrong placement of code of mine
    thx RNN~~~~~

  13. #12
    nutrion's Avatar Member
    Reputation
    1
    Join Date
    May 2020
    Posts
    6
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is there any plugin that shows potion taken by player in party and cooldown (kull for walls or any potion icon) ?

Similar Threads

  1. How to get my account unlocked?
    By CronoSword in forum WoW Scams Help
    Replies: 1
    Last Post: 12-30-2010, 06:36 AM
  2. how to get my email
    By iainaplin in forum World of Warcraft General
    Replies: 2
    Last Post: 11-01-2008, 12:16 PM
  3. How to get my wep skill?
    By master_4cs in forum World of Warcraft General
    Replies: 1
    Last Post: 08-23-2008, 05:41 AM
  4. How to get my Paypal account vertified
    By gigabyt3r in forum Community Chat
    Replies: 11
    Last Post: 06-05-2008, 02:59 AM
  5. Forgot my Scammed account name, How to get it back??
    By Therioni in forum World of Warcraft General
    Replies: 8
    Last Post: 11-04-2007, 10:16 AM
All times are GMT -5. The time now is 06:07 PM. 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