blueboy / portal

This portal repo is for development purposes only
http://github.com/blueboy/portal
GNU General Public License v2.0
27 stars 24 forks source link

save 'autoequip' toggle to SQL (see CO) #24

Closed kennumen closed 11 years ago

kennumen commented 11 years ago

autoequip toggle is not saved once the bots log off. Save this in the MySQL database, recommend using same table as combat orders / combat delay.

blueboy commented 11 years ago

Big thanks for the work you are doing. I've been trying to sort out the email on the forum (hotmail users are being blocked). Not sure whether you have something in the pipeline for this issue, but I'll run with it if you like ;)

Cheers

kennumen commented 11 years ago

I'm lazy - don't ever worry about taking too much work away from me. It might be debatable if I've already assigned myself to an issue but even then it wouldn't bother me much (that might get annoying if it happens often and I'm halfway there several times).

I've assigned you to it, if you decide otherwise (be it now or later) just unassign yourself.

Thanks for looking into it. Don't forget to increment the SQL version requirements thing (I believe that info can be found at the bottom of the bot_readme.txt).

blueboy commented 11 years ago

O.K. I have a working patch and I'll be pushing it shortly to 'new-ai' branch.

As suggested I have utilized the 'playerbot_saved_data' table to hold the 'autoequip' data. I have also hijacked the existing function CombatDelayRestore() to retrieve the data. Because this function is now not solely used to retrieve combat delay data, I have renamed it to something more appropriate - BotDataRestore(). The database is updated each time you toggle 'm_AutoEquipToggle' when executing >equip auto

I have also added a new subcommand to the 'equip' command, called 'info'. This shows the bot(s) autoquip status, without changing it. More information can be obtained from in-game help; >help equip

I have fixed the sql files in the 'sql/playerbotai' directory, that were pointing at the wrong database table.

Let me know if you find any problems..;)

kennumen commented 11 years ago

Wow! Way to go above and beyond :)

Tested using SQL_R4_UPDATE and no troubles. Works great.

One small thing though, not sure if it was intended or no. It wasn't saving to "OFF" when you used once, while the in-game value did change. Restructured the function so it would do so while still re-using as much code as possible :)

Personally I would've gone for 'equip auto info' but your command was unused and is shorter. If we need it later on we can always move the command or just add the info to it. Right now all I can think of is listing the auto equip item priorities for this class and (as I just pointed out) that's also auto equip lol. Would probably go under 'equip preferences' or some such anyway.

Wouldn't have adjusted this bottom line: https://github.com/blueboy/portal/commit/31906b13d7608eccd11a417c1003b9223444a3cc Was just there for an example so you knew what to adjust. But doesn't hurt and is actually clearer this way.

Anyway, great job. If you're bored, I see several more unassigned issues ;p

blueboy commented 11 years ago

Your adjustment looks good and I think we can now close this one. I'll take a look at the issue list and grab another

Cheers