38 Commits

Author SHA1 Message Date
random-nick
34da084a94 Add !rolestats command (#344)
This might me a little confusing, because it calculates the number of players that won (similar to !playerstats) instead of the number of times a team won (like !gamestats). This way it gives the proper winrate of a player playing that role, but gives an inflated number of total victories and games in cases where there are multiples of a role in the same game. Maybe it would be better to hide the actual numbers and show only the winrates in order to avoid confusion.
2018-07-17 09:18:37 -07:00
Ryan Schmidt
4f5d3f1371
Style changes
- Turns out we use OR elsewhere in expression context (even though it's technically an undocumented behavior), so use it here as well for consistency
- Change indents to match other SQL statement indentation
- Change join condition ordering to put the joined table first (personal nit I enjoy picking)
2018-06-25 13:39:48 -07:00
electricalabrocoma
7552c492d6 Add total winrate output to !p (#341)
Mostly motivated by https://werewolf.chat/leaderboard/ listing only people with 200+ games
2018-06-25 13:36:14 -07:00
skizzerz
670efe6645 Fix recording role stats 2018-04-25 17:53:10 -05:00
Vgr E. Barry
022da467ec Fix !gamestats display 2018-04-24 16:01:10 -04:00
skizzerz
56f2bacd3a Amnesiac fixes and redo stop_game readout logic
- Account for revealing totem + amnesiac in experimental !stats properly
- Fix amnesiac blacklist checks to be consistent with each other
- Remove non-events from villager.py -- these always ran before or after
  all other events, so there was no point in them being events in the
  first place
- stop_game now follows the mainroles/allroles pattern instead of
  roles/templates pattern. This also modifies the data stored in db
  stats, and fixes readouts for cases where we do goofy stuff with
  secondary roles
2018-04-23 23:11:02 -05:00
jacob1
cac893fd14 record stats for "roles" gamemode 2018-01-09 23:20:38 -05:00
jacob1
0c8afe4f64 Fix db error when adding a tempban sanction on a player that already has one, fixes #245
Can happen when doing it manually, or when adding a warning after it expired but before expire_tempbans() is called
2016-11-07 21:10:18 -05:00
jacob1
f101c62af8 Fix !fflags +j overwriting flags when account name is uppercase, fixes #254
Also allow setting flags on players that haven't played any games
2016-11-03 22:06:13 -04:00
nyuszika7h
12edbdfb43 Make "!gstats <num>" also show total of all gamemodes
Also capitalized the role names and "Total wins" for consistency with
!pstats and upgraded the schema to create a new index for game lookups
without specifying the game mode.
2016-09-24 23:22:33 +02:00
nyuszika7h
e0bf47c182 Make !gstats show totals for all game modes by default 2016-09-24 12:27:45 +02:00
nyuszika7h
5a20801209 Mention game mode in !gstats output
This is to make it clear that !gstats without arguments returns stats
only for the default game mode.
2016-09-23 15:14:27 +02:00
skizzerz
b23f17cd75 Delay stasis until warning is acked 2016-09-12 23:39:11 -05:00
nyuszika7h
20d5ede0f2 Fix !ftemplate 2016-09-08 22:07:00 +02:00
skizzerz
b950060285 Fxi tpyo 2016-08-25 13:17:31 -05:00
skizzerz
1fdd9250d6 Fix tempban sanction not working 2016-08-19 23:46:13 -05:00
skizzerz
781c1bfb99 Rebuild indexes after schema updates
Also bump schema version to 4 to force a reindex
2016-08-15 21:10:03 -05:00
jacob1
05fbedd0e2 Fix sql syntax error when setting stasis 2016-08-06 12:39:25 -04:00
Ryan Schmidt
cd3f9fc345 Add tempban sanction (#238)
Can be either time-based or points-based. Also, made fwarn a bit smarter
at guessing what the user actually wanted to do based on the parameters
given to it. Warnings now always require acknowledgement, because that
paves the way for a future commit only beginning stasis once a warning
is acknowledged.

Warnings also split off into their own file to declutter wolfgame.py a
bit (now only 9k lines, wooooo! >_>)

Does not play nice with eir, that functionality isn't going to be in the
bot itself but rather some custom code in lykos (hooking into privmsg).
2016-08-02 17:57:09 -04:00
skizzerz
f3eef86db5 Fix casing (again) 2016-07-28 11:36:36 -05:00
skizzerz
e95fb49a70 Really fix pre_restart_state for real for real (once more, with feeling) 2016-07-27 23:09:46 -05:00
skizzerz
45930c3ffd <insert commit message here> 2016-07-27 23:05:14 -05:00
Vgr E. Barry
ebaca56c92 Improve string formatting 2016-07-27 23:49:55 -04:00
Vgr E. Barry
0cd5c9dd7c Fix syntax error 2016-07-27 23:48:00 -04:00
skizzerz
e47a348f22 Remove old db calls 2016-07-27 22:45:43 -05:00
skizzerz
0c0268e1b7 Report overall winrate 2016-07-27 21:37:37 -05:00
skizzerz
1b7b2f6799 Make discrimination based on case ilegel
All hostmask and account comparisons are now case-insensitive (nicks
still aren't, related to #217 -- changing nick sensitivity would break
everything in numerous places).

Also, refactor some things into other files where it makes sense to do
so, because putting unrelated things into the same commit is fun.
2016-07-27 17:03:34 -05:00
Ryan Schmidt
22aa7af5c6 Merge pull request #235 - Schema upgrade by skizzerz
Fix FK deferrable status, ensure that FKs are always enforced in the
bot, and redo how fool wins are stored/tracked. Drop unneded table.
2016-07-27 12:38:23 -04:00
skizzerz
00bf10f6c0 Fix giving warnings to new players 2016-07-16 22:55:56 -05:00
skizzerz
454afca1b3 Various fixes
- fflags no longer says things were modified on account "*" when they
  weren't
- don't give an autowarning on kick anymore; if an op is kicking chances
  are they'll be giving their own warning anyway
- attempt to make a backup copy of the database before migrating to new
  schema
2016-06-26 12:37:22 -05:00
skizzerz
c6bd24aea7 Fix fool wins and auto warning expirations 2016-06-21 23:10:19 -05:00
skizzerz
79614a0719 Use thread-local storage to hold sqlite connection 2016-06-21 17:02:18 -05:00
skizzerz
b39828be7f Remove !join
bug. Now it should actually work even if the user has no warnings.
Also don't list expired/deleted warnings as unacknowledged.
Warning expiration can now be modified via !fwarn set, and the default
expiration is now 30d instead of never (never can be manually specified
along with a handful of aliases that mean the same thing).
2016-06-14 12:02:54 -05:00
skizzerz
adea98e3ed Fix some derps
Need to move module init code after the functions it calls, also forgot
the sanction definitions for 11-14 points.
2016-06-12 23:03:47 -05:00
skizzerz
2151df4fef Add !fflags and !ftemplate
These allow for access control, and work pretty much exactly like they
do in atheme's ChanServ (the /cs flags and /cs template commands).

Also remove unused things from botconfig.py.example.
2016-06-07 17:02:12 -05:00
skizzerz
a6ea55a8fe Finish warning system
- fwarn/warn commands to view and manipulate warnings
- fstasis can now only decrease stasis, not add to it
- refreshdb command can sync bot game state with what is in the db
  (including expiring any unexpired stasis or warnings)
- stasis now expires
- tempban is still not implemented and will not be implemented as
  part of the PR (it will come later, if ever)
- sanctions can be automatically applied after warnings cross a
  certain threshold; some defaults are configured
2016-06-07 14:17:21 -05:00
skizzerz
bba5ab745e Make bot run and fwarn partially work 2016-06-06 18:59:28 -05:00
skizzerz
2d2ce6483a Initial work on new schema and warning system
Still very WIP and not completed, bot likely doesn't even run.
2016-06-06 14:35:58 -05:00