Differentiate between food and drink menu

User Tag List

Results 1 to 13 of 13
  1. #1
    attn's Avatar Member
    Reputation
    13
    Join Date
    Sep 2009
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Differentiate between food and drink

    The next code gives me a dump of vendor's inventory

    Code:
          max_num = GetMerchantNumItems()
          for i = 1, max_num do
            name, link, quality, iLevel, reqLevel, class, subclass, 
              maxStack, equipSlot, texture, vendorPrice = GetItemInfo(GetMerchantItemLink(i));
            if (subclass == "Food & Drink") then
              has_food = 1
              has_drink = 1
                
              break
            end
          end
    and best I can get from lua is subclass for "Food & Drink" category. But to make bot automatically buy food and/or drink I need to know exactly what type is each item.

    I've search thru wow api but I didn't find anything. Only "subclass". I've search thru post on this forum but doesn't look like Item has Food/Drink internal type.

    One idea to extract this from Item Description. For the food I think it always said "Restore XXX health over xxx sec" and for drink "Restore xxx mana over xxx seconds.". But Item description also not available via wow api unless I mouse over the item. If I'm correct it's in DBCache files. Any suggestions/links how to get it from there for Item (by name of by link) ?

    Differentiate between food and drink
  2. #2
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at what spell each items casts with GetItemSpell. It will be either "Food" or "Drink".

    Now if only I had a way to extract the spell ID (instead of just name & rank) from the items...

    Edit: my bad, didn't see that it was in vendor that you needed this.
    Last edited by amadmonk; 12-08-2009 at 12:25 PM.
    Don't believe everything you think.

  3. #3
    attn's Avatar Member
    Reputation
    13
    Join Date
    Sep 2009
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    Just tried but only works if item in my inventory. Doesn't works for items on vendor page .

  4. #4
    luciferc's Avatar Contributor
    Reputation
    90
    Join Date
    Jul 2008
    Posts
    373
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your out of process Lists r Ftw

    #1 Extract List of Food/Drink/Both

    #2 Use List

    #3 ????

    #4 Done


    (Item Id List of/c)

  5. #5
    attn's Avatar Member
    Reputation
    13
    Join Date
    Sep 2009
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you mean
    #2 Use List
    I have it just don't know how get Item Spell if it's not in a bag

  6. #6
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by amadmonk View Post
    Look at what spell each items casts with GetItemSpell. It will be either "Food" or "Drink".

    Now if only I had a way to extract the spell ID (instead of just name & rank) from the items...
    Quote from wowwiki:
    local _, _, Color, Ltype, Id, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
    "itemLink" should obviously be an item link. If you're enumerating the bags, use GetContainerItemLink(bag, slot).
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  7. #7
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, this is slightly off topic, but still -- if anyone knows how to get the actual *spell ID* from the item, that would be boss. I use GetItemSpell right now for a poor man's version, but this doesn't give ID, only name and rank. I can manually search all spells for a matching name and rank, but this is potentially slow (yes, I can cache it, but that adds a whole new layer of complexity).

    If nobody has it offhand, I'll try RE'ing GetItemSpell today (home from work with a cold) and see if it's easily obtainable (and if it's obtainable from the item ID, that might solve the OP's problem, too).
    Don't believe everything you think.

  8. #8
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by amadmonk View Post
    Actually, this is slightly off topic, but still -- if anyone knows how to get the actual *spell ID* from the item, that would be boss. I use GetItemSpell right now for a poor man's version, but this doesn't give ID, only name and rank. I can manually search all spells for a matching name and rank, but this is potentially slow (yes, I can cache it, but that adds a whole new layer of complexity).

    If nobody has it offhand, I'll try RE'ing GetItemSpell today (home from work with a cold) and see if it's easily obtainable (and if it's obtainable from the item ID, that might solve the OP's problem, too).
    It's stored in the item cache struct for the item. (As well as a slew of other information)

  9. #9
    audible83's Avatar Member
    Reputation
    4
    Join Date
    Jun 2008
    Posts
    48
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You get it from COMBAT_LOG_EVENT, i havent found the direct lua function for it.

    If not usable, go with reversing.


    On topic :

    By the merchant I go over each item and check the texture, if texture matches to what i want, and its highest level available that i can use, and its a consumable ...

    This has not failed me yet when it comes to restocking drink / food from vendor, note that its untested with all items, just 0-40ish with horde.

    Now, there is an even "better" solution. This is written in lua.


    Code:
    function ParseMerchantToopTips()
    local mytext, my2text
    local text, metext
    local numItems = GetMerchantNumItems()
    	for i=1, numItems do
    
    			ToolTipForMerchant:SetOwner(UIParent, "ANCHOR_NONE")
    			ToolTipForMerchant:ClearLines()
    			ToolTipForMerchant:SetMerchantItem(i)
    		for i=1,MerchantTooltip:NumLines() do
    		
    mytext, my2text = getglobal("MerchantTooltipTextLeft" .. i), getglobal("MerchantTooltipTextRight" .. i)
    text, metext = mytext:GetText(), my2text:GetText()
    	-- this will print all tooltip lines for all items at a merchant.
    	print(text,metext)
    		
    		end
    	ToolTipForMerchant:Hide()
    	
    	end
    end
    
    ToolTipForMerchant = CreateFrame("GameTooltip", "MerchantTooltip", UIParent, "GameTooltipTemplate")
    Last edited by audible83; 12-08-2009 at 03:19 PM. Reason: added lua code

  10. #10
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    It's stored in the item cache struct for the item. (As well as a slew of other information)
    Glah. Haven't really looked at the cache yet. Guess it's time...

    Thanks, Apoc.
    Don't believe everything you think.

  11. #11
    attn's Avatar Member
    Reputation
    13
    Join Date
    Sep 2009
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @audible thanks and +1 rep . That's my solution

  12. #12
    rootguy's Avatar Member
    Reputation
    3
    Join Date
    Aug 2008
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just reversed the GetItemSpell lua function and found exactely what i needed

    unsigned long GetItemSpell(unsigned long item_id);

    very easy to find 113 bytes from the start of the lua function

  13. #13
    zzgw's Avatar Member
    Reputation
    6
    Join Date
    Mar 2008
    Posts
    31
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For what it's worth you can also just use LibPeriodicTable to get more information about an item.

Similar Threads

  1. Replies: 21
    Last Post: 08-08-2007, 08:39 PM
  2. For Mage: Free Food And Water
    By Coochie in forum World of Warcraft Guides
    Replies: 11
    Last Post: 03-17-2007, 06:04 PM
  3. The diffrence between EU and US scam policy..
    By Wagstorm in forum World of Warcraft General
    Replies: 8
    Last Post: 01-24-2007, 05:39 PM
  4. Transfer gold and items between horde and alliance
    By Coolness in forum World of Warcraft Exploits
    Replies: 6
    Last Post: 11-04-2006, 03:46 PM
All times are GMT -5. The time now is 08:56 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