View Single Post
10-07-05, 01:00 PM   #14
Kasheen
A Wyrmkin Dreamwalker
 
Kasheen's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 58
Although if you don't mind me asking, what information are you looking for that you need to use db:get()?
Of course, you may even know a better solution.

I wrote the mod called "Compact Loot Frames" which is basically a loot roll frame replacement. As far as I know the roll frames never recieve anything that it usable through the link system, only a name and an RollID number which doesnt appear to be anything to do with the loot system (ie it seems to start as a small integer).

My mod has the ability to display the name of the loot either on the roll window or in the chat, if it is displayed in the chat and the user runs LootLink or KC_Items then instead of getting some coloured text you actually get the link, the thing is I must look up the items database by name only and KC_Items seems to be sorted by ID.

Unfortunately when you try to search the whole database (or search until you find the item) there seems to be a noticable stutter so instead I have gone through the KC_Items database in order to create a table which looks like name = id. This database is only loaded when the client enters the world though for the first time which means if new items are added to KC_Items they wont be in my database but if the user is running masterDB this should hopefully not matter too much. With this I can do a much faster hash table look up with the item name, get the id and feed that back into one of the other two functions i mentioned. I've also added an "accuracy" mode in my mod which will search the name = id database first and then search the main KC_Items one incase it misses the odd item, but this mode is not default as sometimes it would cause a stutter and would stutter lots if the user didnt have a large items database already.

I guess the other downfall is that the name = id table will take up a bit of memory. Perhaps there is a better way you can suggest of doing this? I had thought of faster ways of searching the KC_Items db such as a binary search but that of course will not work unless you had the list sorted, which takes time :P, I found it odd how the game made a noticable stutter though in searching the list, perhaps there was some other problem in my code i could not see.

Phew, man, you ask a simple question and i give you a book :P. Hope I've not obscured what I was trying to do.

Thanks if you have any suggestions that may help
  Reply With Quote