Ok, massive update on my code. I broke out a bunch of it into an include (Mote-Include.lua), trying to make things nicely generic.
Brd file: http://pastebin.com/WK9Qw907
Include file: http://pastebin.com/4JgbYR63
I actually trap precast/midcast/aftercast in the include, and then call secondary functions within the job script (job_precast, job_midcast, job_aftercast, job_post_precast, job_post_midcast, job_post_aftercast). Since equip() calls are cumulative, you can decide where to add them in the overall sequence, whether before or after the generic handling. Return true from the job_precast()/etc [pre-generic handling] if you don't want the generic handling to modify anything.
The generic handling depends heavily on set naming, but I've gotten it to where it should be extremely easy and intuitive. A brief general list of how it breaks down:
sets.precast.JA -- Top level table for all job abilities. Create sub-sets per JA for gear that should be equipped when the JA is used (eg: sets.precast.JA.Berserk).
sets.precast.WS -- Same as with JAs, though each weaponskill can also have sub-tables. So, for example, sets.precast.WS['Shijin Spiral'].Acc for an accuracy-focused Shijin Spiral build. Those sub-tables must be named from the list of WeaponskillModes values.
sets.precast.FC -- Top level table for fast cast sets. Place default fast cast set here, and then more specific sets as sub-tables (see below for details).
sets.precast[type] -- Any unique action type that isn't covered by the others (eg: Jigs, Waltzes, CorsairShots, etc).
sets.precast.FC[specifics] and sets.midcast[specifics] -- Specifics describes a general priority order of what sets the code will look for. Both of these are limited to magic spells only, since fast cast is only relevant to spells, and only spells have a midcast timing.
So, in order of priority:
First it will look for the exact spell name (eg: sets.midcast.Stoneskin).
Then it will look for spell name mappings (eg: Cure III -> 'Cure', so will use sets.midcast.Cure). Currently the available spell mappings are 'Cure' for single target cures, 'Curaga' for AOE cures, 'Barspell' for elemental (not status) barspells, and most bard song groups.
Then it will look for the spell skill (eg: sets.midcast.EnhancingMagic for enhancing spells).
Then it will look for the spell type (eg: sets.midcast.BlackMagic for any black magic type spell).
Finally it will default to the basic sets.precast.FC for precast, and sets.midcast for midcast.
Note that for now it doesn't have anything complicated for handling high fast cast. Will get to that later.
Gear equipping is handled in a similar manner, using the same types of modes I had in my xmls (OffenseMode, DefenseMode, CastingMode, IdleMode, RestingMode, PhysicalDefenseMode and MagicalDefenseMode). The mode values aren't fully fleshed out yet, though.
So the vast majority of the work needed per job is just defining the gear sets. Brd only has 130 lines of custom work, basically just dealing with special stuff for songs, and a few functions that I left in solely for reference but don't actually do anything.
Other stuff:
Binds are set the same way my xml suggested as the default, and I've actually set it up so that they can set the Gearswap binds on lua load, and set it back to Spellcast binds on unload (though one bug will be fixed in 0.722 that will make this smoother). Modifying Windower's init.txt file isn't necessary. Binds in general are easier to deal with than in Spellcast.
Anyway, play with it, break it, tell me what does and doesn't work. I'll probably make a whm and mnk lua for jobs that would be a bit more common to test with.