How to track if a Reagent was used from Reagent Bank while crafting?
Hello all,
I've been pondering on what would be the best way to determine if an item was used from the Reagent Bank during crafting? My addon currently tracks the items in the Reagent Bank. However, when a user crafts something use the Tradeskill UI. It will consume items from the Reagent Bank. That item count won't be updated until they revisit the bank. This creates inaccurate item counts. So I've been wracking my brain for a few days to come up with ideas on how to solve this. Sadly, I like none of the ideas i've come up with. Some of them are too elaborate and a few are just too simple. One idea I had was to use GetTradeSkillReagentInfo and grab the playerReagentCount to determine if the reagent count is greater than what the player has in their inventory. Subtracting and then creating a modifier that utilizes the count in the reagent bank. This is terribly ugly way of doing it. As I would have to grab the current recipe being used (TradeSkillFrame.RecipeList:GetSelectedRecipeID()). Track when it's actually crafted using UNIT_SPELLCAST_SUCCEEDED and then record a modifier for the count. I'm hoping a few of you can give some suggestions or ideas on how to tackle this. I've looked over the API and it's not very helpful for the situation I described above. If anyone know of any other methods/functions/events etc.. that would help please let me know as well. Thanks in advance! |
Hmm guess no one has an idea. I really wouldn't to do a prediction algorithm on use as it may provide inaccurate item counts. Wish there was a way to track this stuff properly when consuming items from the reagent bank while crafting.
|
Quote:
PLAYERREAGENTBANKSLOTS_CHANGED fires when an item is crafted from the reagent bank, or an item was deposited/withdrawn/moved in the reagent bank Lua Code:
Code:
item 2840 [Copper Bar] was used from your reagent bank Quote:
|
This example works for me by using GetItemCount(), with a few bugs
It returns more information than just playerReagentCount and it's easier to check before/after the cast
Lua Code:
Code:
You create: [Mithril Casing]. |
Thanks for the response Ketho. I will admit I wasn't aware of the PLAYERREAGENTBANKSLOTS_CHANGED event. Odd I did event tracking and it never fired for me. I figured I'd had to do a predictive calculation based on what was consumed in Reagent Bank and what was in the players inventory. I'm going to have to do a few tests to see if it can do it accurately. One method is to subtract the totals from the Reagent Bank per event fire and then rescan all the player bags again to get an accurate count based on the items used.
|
All times are GMT -6. The time now is 06:56 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI