Page 1 of 1

addining item Id to bag item tooltip?

Posted: Tue Jun 25, 2013 6:54 pm
by lolita
this is a part from Item preview addon that adding item id to item link tooltip

Code: Select all

function ItemPreview:ItemButton_OnEnter(button)
    if button.label:GetText() == "" then return end
    
    GameTooltip:SetOwner(button, "ANCHOR_BOTTOMRIGHT")
    GameTooltip:SetHyperLink(button.label:GetText())
    GameTooltip1:Hide()
    GameTooltip2:Hide()

    if not button.itemID then return end
    local item = self.itemList[button.itemID]
    
    if self.settings.ShowZone then
        local convertFn = function(zoneID)
            return GetZoneLocalName(zoneID)
        end
        local data = self:GetItemFieldString(item, "zones", convertFn)
        if data then
            GameTooltip:AddLine(" ")
            GameTooltip:AddLine("Seen in: " .. data)
        end
    end
    
    if self.settings.ShowMobs then
        local data = self:GetItemFieldString(item, "mobs")
        if data then
            GameTooltip:AddLine(" ")
            GameTooltip:AddLine("Dropped by: " .. data)
        end
    end
    
    GameTooltip:AddLine(" ")
    if self.settings.ShowUpdateTime then
        local date = item.date or self.itemList.originalRefreshDate
        if date then
            GameTooltip:AddLine("Updated on " .. date)
        end
    end
    GameTooltip:AddLine("Item ID: " .. button.itemID)
end
this is from Inventory viewer addon, part wich adding extra info to bag item tooltip

Code: Select all

function IV_AppendTooltipData( tooltip, itemLinkOrName )

    --IV_Log( "IV_AppendTooltipData( " ..tooltip:GetName().. ", " .. itemLinkOrName .. " )" );

    if ( IVConfig_ToolTips:IsChecked() == false ) then
        return;
    end

    -- Get text we want to insert (via itemLink or exact Name)
    local text = IV_GetListOfItems3( itemLinkOrName );

    --IV_Log( "text:" .. text );

    if ( text and text ~= "" ) then

        -- Figure out the position to put the separator and set it
        local scale = GetUIScale();
        local Separator4 = getglobal( tooltip:GetName() .. "Separator4" );
        Separator4:ClearAllAnchors();
        Separator4:SetAnchor("TOP", "TOP", tooltip, 0, (tooltip:GetBottom()/scale)-(tooltip:GetTop()/scale)-(3.25/scale) );
        tooltip:AddLine("\n");

        -- Insert the text
        --IV_Log( "Appending tooltipText: " .. text );
        tooltip:AddLine( text );

        -- Set width of the separator after we've added text (which could change the size of the tooltip
        Separator4:SetWidth(tooltip:GetWidth()-20);
        Separator4:Show();
    end
end
can we make something like that (stan alone addon, or edit one of those two addons) to add item ID to bag item tooltip,
it will be much easyer then searching in item preview.
i tryed but cant get it to work :? :cry:

Re: addining item Id to bag item tooltip?

Posted: Tue Jun 25, 2013 7:08 pm
by lisa
So you want the ID on screen in the tooltip?

I just use this userfunction to get the item info.

Code: Select all

function lisa_printinventory()
	local bags = {}
	inventory:update()
	for slot = 61, 240 do
		item = inventory.BagSlot[slot]
 	    if item.Available and  item.Name ~= "<EMPTY>" then
			table.insert(bags, {Name = item.Name, Id = item.Id, Rlevel = item.RequiredLvl, stats = item.Stats})
		end;
	end;
	table.print(bags)
end

Re: addining item Id to bag item tooltip?

Posted: Wed Jun 26, 2013 1:22 am
by rock5
I'm lucky because I use the developer version of dailinotes that has a debug version that shows all item ids in the tooltips like you are describing.

It's a good idea. I'll have a look at what I can do.

Re: addining item Id to bag item tooltip?

Posted: Wed Jun 26, 2013 8:40 am
by rock5
I've added ids to bag item tooltips and skillbook skill tooltips. I also had the brilliant idea to add them to buffs/debuffs but for some reason it wont allow me to add the id to the tooltip so I print it to chat.

I had a look at trying to add ids to target tooltips but I'm not sure I'll be able to although I haven't finished trying yet.

Is there anything else that we need ids for?

Re: addining item Id to bag item tooltip?

Posted: Wed Jun 26, 2013 11:37 am
by lolita
well idk, we need:
backpack,
itemshop,
itemshop backpack,
Arcan transmutor,
house bank,
guild bank,
skill book,
player bufs/debufs,
target bufs/debufs,
target Id

that's all i can think off

Re: addining item Id to bag item tooltip?

Posted: Wed Jun 26, 2013 12:35 pm
by rock5
I'm not sure of the necessity of all of those but most of them will be easy to add. The hard one is the target id. There really isn't any way to get a units ids. That's probably why ItemPreview doesn't include unit ids. But I've had a brilliant idea. I found that if I use the TEXT function and iterate through all the possible name strings eg. TEXT("Sys"..id.."_name") I can collect all the ids and names in about a second. I don't know if I can make it work yet, I'm having strange errors but the idea is sound. Wish me luck.

Re: addining item Id to bag item tooltip?

Posted: Wed Jun 26, 2013 1:12 pm
by lolita
well basically , backpack , skills and buff's/debuff's is all we need, but if you can get target Id that will be awesome :D

and ofcourse Good luck ;)

Re: addining item Id to bag item tooltip?

Posted: Wed Jun 26, 2013 2:17 pm
by rock5
What's killing me is if I slot the code into yacit addon it works. I can't see any reason why it shouldn't work in my addon. This is for target ids. It might be because it registers the 'mouseover' event but I don't understand why it needs it.

Oh well... I'm still working on it.

Re: addining item Id to bag item tooltip?

Posted: Wed Jun 26, 2013 4:06 pm
by rock5
Ok, I got target ids working good. It was pbinfo that was causing trouble. Only downside to the target ids is there can be more than one id with the same name so I have to show them all. No way to tell which is the right one. If it's important you will just have to use "rom/getid". The skill tooltips are working properly now too.

I'll add some of the other easier ones tomorrow and I'd also like to see what I can do for quests. It will be tricky because it doesn't show tooltips but I'll see what I can do.

Re: addining item Id to bag item tooltip?

Posted: Thu Jun 27, 2013 12:15 am
by lolita
:idea: maybe titles to add too.
thay have tooltip, and easy to get ID.

Re: addining item Id to bag item tooltip?

Posted: Mon Jul 01, 2013 9:46 am
by rock5
I finished the addon. Check it out.
http://solarstrike.net/phpBB3/viewtopic ... 700#p50700