Closed SafeteeWoW closed 4 years ago
Btw, this does not have memory problems. Caching all items in my full bags and bank takes 3MegaBytes, about 300 items. The next step is to remove caching in OnCommReceived to fix #160
Due to the complete code restructure, this will be in v2.9, and I will need to write a separate test lua file to make sure nothing is wrong. This will be a big step towards version 3.0. Version3 will remove all stuffs in the lootTable that can be fetched from disk through API. This PR will keep those for v2.x backward compatibility. My plan is to modulize important components in v2.9 one-by-one, including communications, widgets, rightclick menus, loot handling, etc.
This PR will deprecate all of following entries in the loot table. name, quality, ilvl, equipLoc, subType, texture, boe, relic, token, typeID, subTypeID, classes. and client side no longer needs to cache items to fix #160
ML still needs to cache items before sending lootTable. I temporarily remove the ML caching requirement for testing purposes. WIP. I expect the final PR makes ~3000 lines of change. TODO: Delay autopass until items are cached.
Can you help to make sure how DoesItemContainSpec(itemLink/ID, classID, [specID])
works?
Return value:
true if the item is in the lootspec of the given class/spec. false otherwise
Arguments:
Script I used
```
local t = {}
for id in pairs(_G.RCTokenTable) do
t[id] = DoesItemContainSpec(id, 11)
GetItemInfo(id)
end
C_Timer.After(20, function() print("time is up");
for id in pairs(_G.RCTokenTable) do
local c = DoesItemContainSpec(id, 11)
if not (c == t[id]) then
print(id, t[id], c)
end
end end
)
````
The only print is "time is up". ~~~So I think this API does not have caching requirement~~~.
Nah. Checked by two characters. Caching is still needed. It seems if the item is invalid or uncached, this API always returns true.
DoesItemContainSpec
seems to have been in the game at least since 7.0.3.
I once again find myself with very limited time for WoW, so I probably won't be of much help until next week, but it seems like you figured it out?
Also, when you say "3 MB" is that the total memory usage of RCLootCouncil, or just the items? If the latter, 300 items at 3 MB that's 10 kB each, which is a lot.
I create a RCItemUtil library to manage the code to fetch item information The purpose of this library.
GetItemInfo
It is still incomplete. But can you read this file and give me some suggestions? Sorry for lack of code comments.
The main idea is that you can use
GetItemAttr
to get one attribute of the item, for exampleGetItemAttr(ItemString, "name")
.CacheItem(item)
will cache all item attributes in a table, so we no longer needs to call any APIs inGetItemAttr
. I have also defined some functions to conveniently define item attributes.New discovery: The api
DoesItemContainSpec(itemLink, classID, [specID])
andGetItemSpecInfo
gives item spec information. This api eliminates the need to export trinket data and all other hardcode stuffs for autopassing This API also works for artifact relics and armor tokens. The former is a bit buggy if the item is not in the encounter journal(but it does work for armor tokens), for example, artifact weapon, but I think it should not matter. The latter only returns spec in the player's class. Not sure why don't I know this before. Are these added recently?