scelis/pykol — pull request #18 by aleabot (2013-01-02 14:39:11+00:00)
Title: Add 'rollover' state to kol.bot.Bot

These commits add a "rollover" state to kol.bot.Bot. This state is cleared when you log in with the bot after one or more rollovers have happened.

The first commit changes kol.Session to store the rollover time, as reported by StatusRequest, in self.rollover. Note that this value isn't constant (per KoL day) but may change each login by about 3 seconds. A CharpaneRequest is issued after the LoginRequest and before the StatusRequest, this is needed to make StatusRequest report a sensible value instead of None. I hope this extra login-time round trip is okay.

The second commit changes kol.bot.Bot and adds the "rollover" state. self.states["rollover"]{"expires"] stores the rollover time from Session and is used to determine when the rollover state has to be cleared. There is a new botPreClearRollover event for users to filter (happens just before clearState("rollover") is called). Should there be a botPostClearRollover, too?