TekNoLogic/Cork — pull request #92 by daniel-pittman (2013-11-25 04:19:30+00:00)
Title: Item opener: tooltip scanning version

This is a "discussion" patch for replacing the current OpenableItems module. It is not yet ready to merge.

It uses a tooltip scanner, and the global string used to indicate if an item can be opened, to scan inventory items for opening rather than maintaining a human list. While not applicable to all attributes of items, this allows for basic tooltip based interaction with them items.

I have tested this in actual play, and simulated as many odd scenarios as I can envision, and can't currently break it. (Which, naturally, means that I will find an embarrassing bug the instance I click "send pull request" ;)

The approach is generic enough to extend to other attributes of items, which is quite deliberate: locked boxes are also identified with a global string, and I would like to implement a scanner for those next to automatically unlock them. (Some additional infrastructure and refactoring required, but the heart of the scanning engine will remain the same.)

It is also easy to change to allow multiple patterns, rather than just one, per actor; that just waits on an actual need.

I am uncertain if extending this to scan for, eg, combined items is a good plan. They don't use a uniform i18n global string, which means that we have no assurance that they will continue to work correctly once the next generation are released, and we have to handle i18n patterns ourselves. I like the idea, but I suspect that hand-maintained lists are better value overall.

If you like the principal I will finish off this work and update the pull request: rename the scanner to something more reasonable, remove the now redundant template and modules, and generally get it up to quality.

While I have a reasonable grasp of what I wanted to do, my WoW Lua programming experience is relatively limited; if there are potential trouble spots in the code let me know and I can fix those too.