Go to Page... |
Thread Tools | Display Modes |
02/09/17, 04:31 AM | #1 |
[outdated] itemlink return on GetLastCraftingResultItemInfo (resultIndex)
Currently I've managed to create Chat Announcements for item gain/loss except through that of crafting, banking or destroying items in LUI. These are all complete with working item links, and in relevant cases player links as well.
I've moved on to attempting to add something for crafting and found this function: Code:
GetLastCraftingResultItemInfo(number resultIndex) Returns: string name, textureName icon, number stack, number sellPrice, boolean meetsUsageRequirement, number equipType, number ItemType itemType, number itemStyle, number quality, number ItemUISoundCategory soundCategory, number itemInstanceId I also tried to look into adding the same functionality for Banking and couldn't find anything at all I thought would work, doesn't seem to be any event we can use for adding or removing items from the bank. Any chance it would be possible to add these events for bank item withdraw/deposits and expand the Guild Bank ones? Thanks! EDIT: Just realized it doesn't seem like there's a way to get an item you deconstructed either, just the resulting items. Might be something nice to have as well. |
|
02/11/17, 08:13 AM | #2 |
I'd actually like to second this. However, I think the slotId of the newly created item would be more helpful. You can still get the itemlink using that, and you also know exactly what was crafted. (Say you have 10 of one type of glyph in your bag)
For something being deconstructed, an item link should probably be fine. |
|
02/11/17, 10:17 AM | #3 | ||
|
For that I also don't see an easy/simple way to do, but the function you mentioned returns you the ItemType as well as the name of it. So theoretically you could loop through all items in the backpack and check if the ItemType and name do match. If they do, you can get the itemLink with the below function since you know the bagId (i.e. the backpack) as well as the slotIndex (from the loop). Alternative, you might also be able to use "GetItemInstanceId(number bagId, number slotIndex) Returns: number:nilable id" and then companre the id with the one from your method. Code:
GetItemLink(number bagId, number slotIndex, number LinkStyle linkStyle) Returns: string link
Code:
EVENT_OPEN_BANK (number eventCode) EVENT_CLOSE_BANK (number eventCode) EVENT_INVENTORY_SINGLE_SLOT_UPDATE (integer eventCode,number bagId, number slotId, boolean isNewItem, number itemSoundCategory, number inventoryUpdateReason, number stackCountChange) |
||
02/12/17, 08:15 AM | #4 |
Hey thanks for all the suggestions!
I was actually looking into indexing the inventory earlier today to do something like this, and I got it figured out. And it works for crafting/laundering too. Basically have a function for open/closing of Bank/Guild Bank/Fence/Crafting Station and it registers a different event for EVENT_INVENTORY_SINGLE_SLOT_UPDATE and uses a function to index the contents of my bag and bank where relevant. Then any changes to those slots has context sensitive messages sent to a print function that gathers further info on the item based off the itemlink. I haven't finalized the implementation yet, but now that I have this enabled, I'm pretty sure I have 100% coverage for inventory change events with LUI now (Except transfer from craft bag to normal bag, but there's no loss present there so not necessary). I even went as far as adding a function for EVENT_INVENTORY_ITEM_DESTROYED that sets a variable to true, and if the next EVENT_INVENTORY_SINGLE_SLOT_UPDATE reads that variable, it will print the item destroyed. BTW, this is the function for indexing the inventory, can just run this on initialization and also call it before opening a bank, etc: The 3 forms of information extracted here are all we need, any other information can be pulled from the itemlink if sent to another function. Code:
function CA.IndexInventory() -- Bag 1 = player bag, bag 2 = bank, bag 3 = guild bank, bag 5 = crafting bag (too big to index) local bagsize = GetBagSize(1) for i = 1,bagsize do local icon, stack = GetItemInfo(1, i) local bagitemlink = GetItemLink(1, i, LINK_STYLE_DEFAULT) if bagitemlink ~= "" then g_InventoryStacks[i] = { icon=icon, stack=stack, itemlink=bagitemlink} end end end Last edited by ArtOfShred : 02/12/17 at 08:20 AM. |
|
02/14/17, 11:05 AM | #5 |
|
I'd like to +1 this one too.
When deconstructing an item, we do get an EVENT_INVENTORY_SINGLE_SLOT_UPDATE event, but the ItemLink is empty when it was the last item from the stack. How about having the slot update event include the item link all the time? When qty=0, you'll know it's the last one. IIfA needs this so I can more easily zero out qtys associated with an itemlink without having to resort to saving/searching the bag/slot just to find out what the itemlink previously was. ----------- Shred - you really should be using the bag identifiers (BAG_BACKPACK, BAG_BANK, BAG_GUILDBANK, etc) instead of hardcoded numbers. |
ESOUI » Developer Discussions » Wish List » [outdated] itemlink return on GetLastCraftingResultItemInfo (resultIndex) |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|