Compare commits

...

30 Commits

Author SHA1 Message Date
Rogier Neeleman e5f19b81a7 Nog wat commando's vertaald. 10 years ago
Rogier Neeleman 4fb3f61872 Logging 10 years ago
Rogier Neeleman 804ad41639 De weerkraai ingezet 10 years ago
Rogier Neeleman a39f1e90a5 Een aantal commando's extra vertaald 10 years ago
Rogier Neeleman 082ffdf78c Schieten uitgelegd en statestieken bij het starten weergegeven 10 years ago
Rogier Neeleman 1dbe20d522 Letter teveel 10 years ago
Rogier Neeleman de02496689 Nog een paar taalfouten. 10 years ago
Rogier Neeleman bd1dfa65a2 Paar taalfouten en zinsconstructies. 10 years ago
Rogier Neeleman 825960ef08 Commando's vertaald 10 years ago
Rogier Neeleman b8404eed6a Diverse aanpassingen in de taal gemaakt. 10 years ago
Rogier Neeleman 4cb447d0f9 De weerkraai was vertaald op plaatsen met weerweerkraai. 10 years ago
Rogier Neeleman ae3937cbae Commando wait is wacht geworden 10 years ago
Jeebeevee e5e89f199e KLAAR 10 years ago
Jeebeevee 9e6cf7842b 2 files volledig, 1 tot regel 2150 10 years ago
Jeebeevee 338408136b weer een deel 10 years ago
Jeebeevee 4982bbef56 tools/decorators.py 10 years ago
Jeebeevee 0c4c0a2724 modules/wofgame.py tot regel 1640, settings/wolfgame.py wat benamingen aangepast 10 years ago
Jeebeevee cba3b8436d settings/wolfbot.py volledig vertaald 10 years ago
Jeebeevee 7490d925e3 modules/wolfgame.py, vertaald tot regel 1317 10 years ago
Jeebeevee c7f69771fa wolfgame.py taal gewijzigd tot regel 872 10 years ago
Jeebeevee 31ab99c938 wolfgame.py taal gewijzigd tot regel 700 10 years ago
Jeebeevee 3b5ce7ded5 taal wijziging 10 years ago
Jeebeevee fa12eef544 Update wolfgame.py 10 years ago
Rogier Neeleman 798a97b31d No drunk and change of players 10 years ago
Rogier Neeleman 89ee91418e Settings for better gameplay 10 years ago
Rogier Neeleman efb78f538d Check if OPER and NickServ are needed 10 years ago
Rogier Neeleman 1c10d2c080 Nickserv authentication 10 years ago
Rogier Neeleman b4c0567fbe Oper commands added 10 years ago
Rogier Neeleman f4b723a4a9 New python version 10 years ago
Rogier Neeleman 57a0e30beb Ignore various files 10 years ago
  1. 11
      .gitignore
  2. 3
      botconfig.py.example
  3. 5
      modules/common.py
  4. 18
      modules/sabotage.py
  5. 1170
      modules/wolfgame.py
  6. 102
      settings/wolfgame.py
  7. 8
      tools/decorators.py
  8. 2
      wolfbot.py

11
.gitignore vendored

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
# Ignore the configfile
botconfig.py
# Ignore the errorlog
errors.log
# Ignore the database
data.sqlite3
# Ignore the python files
**/*.pyc

3
botconfig.py.example

@ -3,7 +3,10 @@ CHANNEL = "#mywolfgame" @@ -3,7 +3,10 @@ CHANNEL = "#mywolfgame"
HOST = "irc.freenode.net"
PORT = 6667
USERNAME = "" # for authentication, can be left blank if same as NICK
OPERUSER = ""
OPERPASS = ""
NICK = "mywolfbot"
NICKPASS = "nickserv password"
CMD_CHAR = "!"
CHANGING_HOST_QUIT_MESSAGE = "Changing host"

5
modules/common.py

@ -97,6 +97,11 @@ hook = decorators.generate(HOOKS, raw_nick=True, permissions=False) @@ -97,6 +97,11 @@ hook = decorators.generate(HOOKS, raw_nick=True, permissions=False)
def connect_callback(cli):
def prepare_stuff(*args):
if botconfig.OPERUSER and botconfig.OPERPASS:
cli.send("OPER", botconfig.OPERUSER, botconfig.OPERPASS)
if botconfig.NICKPASS:
cli.ns_identify(botconfig.NICKPASS)
cli.join(botconfig.CHANNEL)
cli.msg("ChanServ", "op "+botconfig.CHANNEL)

18
modules/sabotage.py

@ -23,7 +23,7 @@ pmcmd = decorators.generate(PM_COMMANDS) @@ -23,7 +23,7 @@ pmcmd = decorators.generate(PM_COMMANDS)
hook = decorators.generate(HOOKS, raw_nick=True, permissions=False)
def connect_callback(cli):
var.PHASE = "none"
var.PHASE = "geen"
var.PLAYERS = []
var.LAST_STATS = None
@ -33,7 +33,7 @@ def connect_callback(cli): @@ -33,7 +33,7 @@ def connect_callback(cli):
def join(cli, nick, chan, rest):
"""Either starts a new game of Werewolf or joins an existing game that has not started yet."""
if var.PHASE == "none":
if var.PHASE == "geen":
cli.mode(chan, "+v", nick, nick+"!*@*")
var.PLAYERS.append(nick)
@ -41,19 +41,19 @@ def join(cli, nick, chan, rest): @@ -41,19 +41,19 @@ def join(cli, nick, chan, rest):
var.WAITED = 0
var.GAME_ID = time.time()
var.CAN_START_TIME = datetime.now() + timedelta(seconds=var.MINIMUM_WAIT)
cli.msg(chan, ('\u0002{0}\u0002 has started a game of Sabotage. '+
'Type "{1}join" to join. Type "{1}start" to start the game. '+
'Type "{1}wait" to increase join wait time.').format(nick, botconfig.CMD_CHAR))
cli.msg(chan, ('\u0002{0}\u0002 Heeft een spel gestart. '+
'Tik "{1}join" om mee te spelen. Tik "{1}start" om het spel te starten. '+
'Tik "{1}wait" om nog even te wachten met het staten van het spel.').format(nick, botconfig.CMD_CHAR))
elif nick in var.PLAYERS:
cli.notice(nick, "You're already playing!")
cli.notice(nick, "Je speelt al mee!")
elif len(pl) >= var.MAX_PLAYERS:
cli.notice(nick, "Too many players! Try again next time.")
cli.notice(nick, "Het spel zit al vol. Probeer het later nog eens.")
elif var.PHASE != "join":
cli.notice(nick, "Sorry but the game is already running. Try again next time.")
cli.notice(nick, "Sorry het spel is al bezig. Probeer het later nog eens.")
else:
cli.mode(chan, "+v", nick, nick+"!*@*")
var.PLAYERS.append(nick)
cli.msg(chan, '\u0002{0}\u0002 has joined the game.'.format(nick))
cli.msg(chan, '\u0002{0}\u0002 doet mee met het spel.'.format(nick))
var.LAST_STATS = None # reset

1170
modules/wolfgame.py

File diff suppressed because it is too large Load Diff

102
settings/wolfgame.py

@ -9,18 +9,18 @@ ADMINS_RATE_LIMIT = 300 @@ -9,18 +9,18 @@ ADMINS_RATE_LIMIT = 300
SHOTS_MULTIPLIER = .12 # ceil(shots_multiplier * len_players) = bullets given
MAX_PLAYERS = 30
DRUNK_SHOTS_MULTIPLIER = 3
NIGHT_TIME_LIMIT = 120
NIGHT_TIME_WARN = 0 # should be less than NIGHT_TIME_LIMIT
DAY_TIME_LIMIT_WARN = 780
DAY_TIME_LIMIT_CHANGE = 120 # seconds after DAY_TIME_LIMIT_WARN has passed
NIGHT_TIME_LIMIT = 100
NIGHT_TIME_WARN = 20 # should be less than NIGHT_TIME_LIMIT
DAY_TIME_LIMIT_WARN = 100
DAY_TIME_LIMIT_CHANGE = 20 # seconds after DAY_TIME_LIMIT_WARN has passed
KILL_IDLE_TIME = 300
WARN_IDLE_TIME = 180
PART_GRACE_TIME = 7
QUIT_GRACE_TIME = 30
MAX_PRIVMSG_TARGETS = 1
LOG_FILENAME = ""
BARE_LOG_FILENAME = ""
LOG_FILENAME = "wolfbot.log"
BARE_LOG_FILENAME = "wolfbot_bare.log"
# HIT MISS SUICIDE
GUN_CHANCES = ( 5/7 , 1/7 , 1/7 )
@ -29,19 +29,19 @@ MANSLAUGHTER_CHANCE = 1/5 # ACCIDENTAL HEADSHOT (FATAL) @@ -29,19 +29,19 @@ MANSLAUGHTER_CHANCE = 1/5 # ACCIDENTAL HEADSHOT (FATAL)
GUNNER_KILLS_WOLF_AT_NIGHT_CHANCE = 0
GUARDIAN_ANGEL_DIES_CHANCE = 1/2
DETECTIVE_REVEALED_CHANCE = 2/5
rechercheur_REVEALED_CHANCE = 2/5
#################################################################################################################
# ROLE INDEX: PLAYERS SEER WOLF CURSED DRUNK HARLOT TRAITOR GUNNER CROW ANGEL DETECTIVE ##
# ROLE INDEX: PLAYERS SEER WOLF CURSED DRUNK HARLOT TRAITOR GUNNER CROW ANGEL rechercheur ##
#################################################################################################################
ROLES_GUIDE = { 4 : ( 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ), ##
6 : ( 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ), ##
8 : ( 1 , 2 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 ), ##
10 : ( 1 , 2 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 ), ##
11 : ( 1 , 2 , 1 , 1 , 1 , 1 , 1 , 0 , 1 , 0 ), ##
15 : ( 1 , 3 , 1 , 1 , 1 , 1 , 1 , 0 , 1 , 1 ), ##
22 : ( 1 , 4 , 1 , 1 , 1 , 1 , 1 , 0 , 1 , 1 ), ##
29 : ( 1 , 5 , 1 , 1 , 1 , 1 , 1 , 0 , 1 , 1 ), ##
6 : ( 1 , 1 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 ), ##
8 : ( 1 , 2 , 1 , 0 , 1 , 1 , 1 , 0 , 0 , 0 ), ##
10 : ( 1 , 2 , 1 , 0 , 1 , 1 , 1 , 0 , 1 , 0 ), ##
11 : ( 1 , 2 , 1 , 0 , 1 , 1 , 1 , 0 , 1 , 0 ), ##
15 : ( 1 , 3 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 0 ), ##
22 : ( 1 , 4 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 ), ##
29 : ( 1 , 5 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 ), ##
None : ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 )} ##
#################################################################################################################
# Notes: ##
@ -51,35 +51,35 @@ GAME_MODES = {} @@ -51,35 +51,35 @@ GAME_MODES = {}
AWAY = [] # cloaks of people who are away.
SIMPLE_NOTIFY = [] # cloaks of people who !simple, who want everything /notice'd
ROLE_INDICES = {0 : "seer",
ROLE_INDICES = {0 : "ziener",
1 : "wolf",
2 : "cursed villager",
3 : "village drunk",
4 : "harlot",
5 : "traitor",
6 : "gunner",
7 : "werecrow",
8 : "guardian angel",
9 : "detective"}
2 : "vervloekte burger",
3 : "dronken burger",
4 : "onschuldige meisje",
5 : "verrader",
6 : "kanonnier",
7 : "weerkraai",
8 : "bescherm engel",
9 : "rechercheur"}
INDEX_OF_ROLE = dict((v,k) for k,v in ROLE_INDICES.items())
NO_VICTIMS_MESSAGES = ("The body of a young penguin pet is found.",
"A pool of blood and wolf paw prints are found.",
"Traces of wolf fur are found.")
LYNCH_MESSAGES = ("The villagers, after much debate, finally decide on lynching \u0002{0}\u0002, who turned out to be... a \u0002{1}\u0002.",
"Under a lot of noise, the pitchfork-bearing villagers lynch \u0002{0}\u0002, who turned out to be... a \u0002{1}\u0002.",
"The mob drags a protesting \u0002{0}\u0002 to the hanging tree. S/He succumbs to the will of the horde, and is hanged. It is discovered (s)he was a \u0002{1}\u0002.",
"Resigned to his/her fate, \u0002{0}\u0002 is led to the gallows. After death, it is discovered (s)he was a \u0002{1}\u0002.")
NO_VICTIMS_MESSAGES = ("Het lichaam van een jonge huisdier is gevonden.",
"Een plas van bloed en wolfpoot afdrukken zijn gevonden.",
"Een pluk van wolvenhaar is gevonden.")
LYNCH_MESSAGES = ("De burgers hebben, na lang overleg, besloten om \u0002{0}\u0002 te elimineren. Hij/zij was een... \u0002{1}\u0002.",
"Onder veel lawaai hebben de woedende burgers \u0002{0}\u0002 geelimineerd. Hij/zij was een... \u0002{1}\u0002.",
"De menigte sleept een protesterende \u0002{0}\u0002 naar de galg. Hij/zij bezwijkt aan de wil van de groep, en wordt opgehangen. Hij/zij was een \u0002{1}\u0002.",
"Verslagen door zijn/haar lot, is \u0002{0}\u0002 naar de galg geleid. Na de dood bleek hij/zij een \u0002{1}\u0002 te zijn.")
import botconfig
RULES = (botconfig.CHANNEL + " channel rules: 1) Be nice to others. 2) Do not share information "+
"after death. 3) No bots allowed. 4) Do not play with clones.\n"+
"5) Do not quit unless you need to leave. 6) No swearing and keep it "+
"family-friendly. 7) Do not paste PM's from the bot during the game. "+
"8) Use common sense. 9) Waiting for timeouts is discouraged.")
RULES = (botconfig.CHANNEL + " Kanaal regels: 1) Wees aardig voor elkaar. 2) Deel geen spel infomatie "+
"na je dood. 3) Bots zijn niet toegestaan. 4) Speel niet met clones van jezelf.\n"+
"5) Stop niet met spelen, tenzij het niet anders kan. 6) Niet vloeken en hou het leuk "+
"voor iedereen. 7) Sla geen Prive berichten over van het spel tijdens het spel. "+
"8) Gebruik je gezonde verstand. 9) Wachten op timeouts is niet leuk.")
# Other settings:
START_WITH_DAY = False
@ -91,8 +91,8 @@ PING_IN = [] # cloaks of users who have opted in for ping @@ -91,8 +91,8 @@ PING_IN = [] # cloaks of users who have opted in for ping
is_role = lambda plyr, rol: rol in ROLES and plyr in ROLES[rol]
def plural(role):
if role == "wolf": return "wolves"
elif role == "person": return "people"
if role == "wolf": return "wolven"
elif role == "persoon": return "personen"
else: return role + "s"
def list_players():
@ -125,16 +125,16 @@ def game_mode(name): @@ -125,16 +125,16 @@ def game_mode(name):
return decor
CHANGEABLE_ROLES = { "seers" : INDEX_OF_ROLE["seer"],
"wolves" : INDEX_OF_ROLE["wolf"],
"cursed" : INDEX_OF_ROLE["cursed villager"],
"drunks" : INDEX_OF_ROLE["village drunk"],
"harlots" : INDEX_OF_ROLE["harlot"],
"traitors" : INDEX_OF_ROLE["traitor"],
"gunners" : INDEX_OF_ROLE["gunner"],
"werecrows" : INDEX_OF_ROLE["werecrow"],
"angels" : INDEX_OF_ROLE["guardian angel"],
"detectives" : INDEX_OF_ROLE["detective"]}
CHANGEABLE_ROLES = { "zieners" : INDEX_OF_ROLE["ziener"],
"wolven" : INDEX_OF_ROLE["wolf"],
"vervloekten" : INDEX_OF_ROLE["vervloekte burger"],
"dronkaarts" : INDEX_OF_ROLE["dronken burger"],
"onschuldige meisjes" : INDEX_OF_ROLE["onschuldige meisje"],
"verraders" : INDEX_OF_ROLE["verrader"],
"kanonniers" : INDEX_OF_ROLE["kanonnier"],
"weerkraaien" : INDEX_OF_ROLE["weerkraai"],
"engelen" : INDEX_OF_ROLE["bescherm engel"],
"rechercheurs" : INDEX_OF_ROLE["rechercheur"]}
@ -161,8 +161,8 @@ class ChangedRolesMode(object): @@ -161,8 +161,8 @@ class ChangedRolesMode(object):
try:
lx[CHANGEABLE_ROLES[role.lower()]] = num
except KeyError:
raise InvalidModeException(("The role \u0002{0}\u0002 "+
"is not valid.").format(role))
raise InvalidModeException(("De rol \u0002{0}\u0002 "+
"is niet geldig.").format(role))
except ValueError:
raise InvalidModeException("A bad value was used in mode roles.")
for k in ROLES_GUIDE.keys():
@ -196,7 +196,7 @@ with conn: @@ -196,7 +196,7 @@ with conn:
c.execute('DROP TABLE IF EXISTS roles')
c.execute('CREATE TABLE roles (id INTEGER PRIMARY KEY AUTOINCREMENT, role TEXT)')
for x in ["villager"]+list(ROLE_INDICES.values()):
for x in ["burger"]+list(ROLE_INDICES.values()):
c.execute("INSERT OR REPLACE INTO roles (role) VALUES (?)", (x,))

8
tools/decorators.py

@ -37,7 +37,7 @@ def generate(fdict, permissions=True, **kwargs): @@ -37,7 +37,7 @@ def generate(fdict, permissions=True, **kwargs):
if fnmatch.fnmatch(cloak.lower(), pattern.lower()):
for cmdname in s:
if cmdname in botconfig.DENY[pattern]:
largs[0].notice(nick, "You do not have permission to use that command.")
largs[0].notice(nick, "Je hebt geen rechten voor dat commando.")
return
for pattern in botconfig.ALLOW.keys():
if fnmatch.fnmatch(cloak.lower(), pattern.lower()):
@ -49,14 +49,14 @@ def generate(fdict, permissions=True, **kwargs): @@ -49,14 +49,14 @@ def generate(fdict, permissions=True, **kwargs):
if fnmatch.fnmatch(cloak.lower(), ptn.lower())]:
return f(*largs)
elif cloak:
largs[0].notice(nick, "You are not the owner.")
largs[0].notice(nick, "Je bent niet de eigenaar.")
return
if admin_only:
if cloak and [ptn for ptn in botconfig.ADMINS+botconfig.OWNERS
if fnmatch.fnmatch(cloak.lower(), ptn.lower())]:
return f(*largs)
elif cloak:
largs[0].notice(nick, "You are not an admin.")
largs[0].notice(nick, "Je bent geen administrator.")
return
return f(*largs)
alias = False
@ -68,7 +68,7 @@ def generate(fdict, permissions=True, **kwargs): @@ -68,7 +68,7 @@ def generate(fdict, permissions=True, **kwargs):
for fn in fdict[x]:
if (fn.owner_only != owner_only or
fn.admin_only != admin_only):
raise Exception("Command: "+x+" has non-matching protection levels!")
raise Exception("Commando: "+x+" heeft geen passende beschermingsniveau!")
fdict[x].append(innerf)
if alias:
innerf.aliases.append(x)

2
wolfbot.py

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# Copyright (c) 2011 Jimmy Cao
# Permission is hereby granted, free of charge, to any person obtaining a copy

Loading…
Cancel
Save