Browse Source

modules/wolfgame.py, vertaald tot regel 1317

pull/1/head
Jeebeevee 10 years ago
parent
commit
f6404de3fe
  1. 108
      modules/wolfgame.py

108
modules/wolfgame.py

@ -901,7 +901,7 @@ def del_player(cli, nick, forced_death = False, devoice = True):
if nick not in var.DEAD: if nick not in var.DEAD:
var.DEAD.append(nick) var.DEAD.append(nick)
ret = not chk_win(cli) ret = not chk_win(cli)
if var.PHASE in ("night", "day") and ret: if var.PHASE in ("nacht", "dag") and ret:
# remove him from variables if he is in there # remove him from variables if he is in there
for a,b in list(var.KILLS.items()): for a,b in list(var.KILLS.items()):
if b == nick: if b == nick:
@ -917,7 +917,7 @@ def del_player(cli, nick, forced_death = False, devoice = True):
del x[k] del x[k]
if nick in var.DISCONNECTED: if nick in var.DISCONNECTED:
del var.DISCONNECTED[nick] del var.DISCONNECTED[nick]
if var.PHASE == "day" and not forced_death and ret: # didn't die from lynching if var.PHASE == "dag" and not forced_death and ret: # didn't die from lynching
if nick in var.VOTES.keys(): if nick in var.VOTES.keys():
del var.VOTES[nick] # Delete other people's votes on him del var.VOTES[nick] # Delete other people's votes on him
for k in list(var.VOTES.keys()): for k in list(var.VOTES.keys()):
@ -930,7 +930,7 @@ def del_player(cli, nick, forced_death = False, devoice = True):
if nick in var.WOUNDED: if nick in var.WOUNDED:
var.WOUNDED.remove(nick) var.WOUNDED.remove(nick)
chk_decision(cli) chk_decision(cli)
elif var.PHASE == "night" and ret: elif var.PHASE == "nacht" and ret:
chk_nightdone(cli) chk_nightdone(cli)
return ret return ret
@ -965,27 +965,27 @@ def reaper(cli, gameid):
for nck in to_kill: for nck in to_kill:
if nck not in var.list_players(): if nck not in var.list_players():
continue continue
cli.msg(chan, ("\u0002{0}\u0002 didn't get out of bed "+ cli.msg(chan, ("\u0002{0}\u0002 is niet opgestaan "+
"for a very long time. S/He is declared dead. Appears "+ "voor een erg lange tijd. Hij/zij is nu dood verklaard. "+
"(s)he was a \u0002{1}\u0002.").format(nck, var.get_role(nck))) "Hij/zij was een \u0002{1}\u0002.").format(nck, var.get_role(nck)))
if not del_player(cli, nck): if not del_player(cli, nck):
return return
pl = var.list_players() pl = var.list_players()
x = [a for a in to_warn if a in pl] x = [a for a in to_warn if a in pl]
if x: if x:
cli.msg(chan, ("{0}: \u0002You have been idling for a while. "+ cli.msg(chan, ("{0}: \u0002Je Bent Idle voor een tijdje. "+
"Please say something soon or you "+ "Doe actief mee of je word binnenkort "+
"might be declared dead.\u0002").format(", ".join(x))) "dood verklaard.\u0002").format(", ".join(x)))
for dcedplayer in list(var.DISCONNECTED.keys()): for dcedplayer in list(var.DISCONNECTED.keys()):
_, timeofdc, what = var.DISCONNECTED[dcedplayer] _, timeofdc, what = var.DISCONNECTED[dcedplayer]
if what == "quit" and (datetime.now() - timeofdc) > timedelta(seconds=var.QUIT_GRACE_TIME): if what == "quit" and (datetime.now() - timeofdc) > timedelta(seconds=var.QUIT_GRACE_TIME):
cli.msg(chan, ("\02{0}\02 died due to a fatal attack by wild animals. Appears (s)he "+ cli.msg(chan, ("\02{0}\02 is gestorven door een fatale aanvan van wilde dieren. "+
"was a \02{1}\02.").format(dcedplayer, var.get_role(dcedplayer))) "Hij/zij was een \02{1}\02.").format(dcedplayer, var.get_role(dcedplayer)))
if not del_player(cli, dcedplayer, devoice = False): if not del_player(cli, dcedplayer, devoice = False):
return return
elif what == "part" and (datetime.now() - timeofdc) > timedelta(seconds=var.PART_GRACE_TIME): elif what == "part" and (datetime.now() - timeofdc) > timedelta(seconds=var.PART_GRACE_TIME):
cli.msg(chan, ("\02{0}\02 died due to eating poisonous berries. Appears (s)he was "+ cli.msg(chan, ("\02{0}\02 is gestorven door het eten van giftige bessen. "+
"a \02{1}\02.").format(dcedplayer, var.get_role(dcedplayer))) "Hij/zij was een \02{1}\02.").format(dcedplayer, var.get_role(dcedplayer)))
if not del_player(cli, dcedplayer, devoice = False): if not del_player(cli, dcedplayer, devoice = False):
return return
time.sleep(10) time.sleep(10)
@ -1014,7 +1014,7 @@ def on_join(cli, raw_nick, chan, acc="*", rname=""):
cli.mode(chan, "+v", nick, nick+"!*@*") cli.mode(chan, "+v", nick, nick+"!*@*")
del var.DISCONNECTED[nick] del var.DISCONNECTED[nick]
cli.msg(chan, "\02{0}\02 has returned to the village.".format(nick)) cli.msg(chan, "\02{0}\02 is teruggekeerd naar het dorp.".format(nick))
for r,rlist in var.ORIGINAL_ROLES.items(): for r,rlist in var.ORIGINAL_ROLES.items():
if "(dced)"+nick in rlist: if "(dced)"+nick in rlist:
rlist.remove("(dced)"+nick) rlist.remove("(dced)"+nick)
@ -1027,22 +1027,22 @@ def on_join(cli, raw_nick, chan, acc="*", rname=""):
def goat(cli, nick, chan, rest): def goat(cli, nick, chan, rest):
"""Use a goat to interact with anyone in the channel during the day""" """Use a goat to interact with anyone in the channel during the day"""
if var.PHASE in ("geen", "join"): if var.PHASE in ("geen", "join"):
cli.notice(nick, "No game is currently running.") cli.notice(nick, "Er is nu geen spel bezig.")
return return
elif nick not in var.list_players() or nick in var.DISCONNECTED.keys(): elif nick not in var.list_players() or nick in var.DISCONNECTED.keys():
cli.notice(nick, "You're not currently playing.") cli.notice(nick, "Je bent nu niet aan het spelen.")
return return
if var.PHASE != "day": if var.PHASE != "dag":
cli.notice(nick, "You can only do that in the day.") cli.notice(nick, "Dat kun je alleen overdag doen.")
return return
if var.GOATED: if var.GOATED:
cli.notice(nick, "You can only do that once per day.") cli.notice(nick, "Je kunt dat maar een keer per dag doen.")
return return
ul = list(var.USERS.keys()) ul = list(var.USERS.keys())
ull = [x.lower() for x in ul] ull = [x.lower() for x in ul]
rest = re.split(" +",rest)[0].strip().lower() rest = re.split(" +",rest)[0].strip().lower()
if not rest: if not rest:
cli.notice(nick, "Not enough parameters.") cli.notice(nick, "Niet genoeg parameters.")
return return
matches = 0 matches = 0
for player in ull: for player in ull:
@ -1054,13 +1054,13 @@ def goat(cli, nick, chan, rest):
matches += 1 matches += 1
else: else:
if matches != 1: if matches != 1:
pm(cli, nick,"\u0002{0}\u0002 is not in this channel.".format(rest)) pm(cli, nick,"\u0002{0}\u0002 is niet in dit kanaal.".format(rest))
return return
victim = ul[ull.index(victim)] victim = ul[ull.index(victim)]
cli.msg(botconfig.CHANNEL, ("\u0002{0}\u0002's goat walks by "+ cli.msg(botconfig.CHANNEL, ("\u0002{0}\u0002's geit loopt langs "+
"and kicks \u0002{1}\u0002.").format(nick, "en schopt \u0002{1}\u0002.").format(nick,
victim)) victim))
var.LOGGER.logMessage("{0}'s goat walks by and kicks {1}.".format(nick, victim)) var.LOGGER.logMessage("{0}'s geit loopt langs en schopt {1}.".format(nick, victim))
var.GOATED = True var.GOATED = True
@ -1086,7 +1086,7 @@ def on_nick(cli, prefix, nick):
r.append(nick) r.append(nick)
r.remove(prefix) r.remove(prefix)
if var.PHASE in ("night", "day"): if var.PHASE in ("nacht", "dag"):
for k,v in var.ORIGINAL_ROLES.items(): for k,v in var.ORIGINAL_ROLES.items():
if prefix in v: if prefix in v:
var.ORIGINAL_ROLES[k].remove(prefix) var.ORIGINAL_ROLES[k].remove(prefix)
@ -1122,7 +1122,7 @@ def on_nick(cli, prefix, nick):
var.IDLE_WARNED.remove(prefix) var.IDLE_WARNED.remove(prefix)
var.IDLE_WARNED.append(nick) var.IDLE_WARNED.append(nick)
if var.PHASE == "day": if var.PHASE == "dag":
if prefix in var.WOUNDED: if prefix in var.WOUNDED:
var.WOUNDED.remove(prefix) var.WOUNDED.remove(prefix)
var.WOUNDED.append(nick) var.WOUNDED.append(nick)
@ -1137,7 +1137,7 @@ def on_nick(cli, prefix, nick):
v.append(nick) v.append(nick)
# Check if he was DC'ed # Check if he was DC'ed
if var.PHASE in ("night", "day"): if var.PHASE in ("nacht", "dag"):
with var.GRAVEYARD_LOCK: with var.GRAVEYARD_LOCK:
if nick in var.DISCONNECTED.keys(): if nick in var.DISCONNECTED.keys():
clk = var.DISCONNECTED[nick][0] clk = var.DISCONNECTED[nick][0]
@ -1145,8 +1145,8 @@ def on_nick(cli, prefix, nick):
cli.mode(chan, "+v", nick, nick+"!*@*") cli.mode(chan, "+v", nick, nick+"!*@*")
del var.DISCONNECTED[nick] del var.DISCONNECTED[nick]
cli.msg(chan, ("\02{0}\02 has returned to "+ cli.msg(chan, ("\02{0}\02 is terug gekeerd naar "+
"the village.").format(nick)) "het dorp.").format(nick))
def leave(cli, what, nick, why=""): def leave(cli, what, nick, why=""):
nick, _, _, cloak = parse_nick(nick) nick, _, _, cloak = parse_nick(nick)
@ -1170,17 +1170,17 @@ def leave(cli, what, nick, why=""):
# the player who just quit was in the game # the player who just quit was in the game
killhim = True killhim = True
if what == "part" and (not var.PART_GRACE_TIME or var.PHASE == "join"): if what == "part" and (not var.PART_GRACE_TIME or var.PHASE == "join"):
msg = ("\02{0}\02 died due to eating poisonous berries. Appears "+ msg = ("\02{0}\02 is gestorven door het eten van giftige bessen. "+
"(s)he was a \02{1}\02.").format(nick, var.get_role(nick)) "Hij/zij was een \02{1}\02.").format(nick, var.get_role(nick))
elif what == "quit" and (not var.QUIT_GRACE_TIME or var.PHASE == "join"): elif what == "quit" and (not var.QUIT_GRACE_TIME or var.PHASE == "join"):
msg = ("\02{0}\02 died due to a fatal attack by wild animals. Appears "+ msg = ("\02{0}\02 is gestorven door een fatale aan van van wilde dieren. "+
"(s)he was a \02{1}\02.").format(nick, var.get_role(nick)) "Hij/zij was een \02{1}\02.").format(nick, var.get_role(nick))
elif what != "kick": elif what != "kick":
msg = "\u0002{0}\u0002 has gone missing.".format(nick) msg = "\u0002{0}\u0002 is vermist.".format(nick)
killhim = False killhim = False
else: else:
msg = ("\02{0}\02 died due to falling off a cliff. Appears "+ msg = ("\02{0}\02 is gestorven door van een klif te vallen. "+
"(s)he was a \02{1}\02.").format(nick, var.get_role(nick)) "Hij/zij was een \02{1}\02.").format(nick, var.get_role(nick))
cli.msg(botconfig.CHANNEL, msg) cli.msg(botconfig.CHANNEL, msg)
var.LOGGER.logMessage(msg.replace("\02", "")) var.LOGGER.logMessage(msg.replace("\02", ""))
if killhim: if killhim:
@ -1198,15 +1198,15 @@ hook("kick")(lambda cli, nick, *rest: leave(cli, "kick", rest[1]))
def leave_game(cli, nick, chan, rest): def leave_game(cli, nick, chan, rest):
"""Quits the game.""" """Quits the game."""
if var.PHASE == "geen": if var.PHASE == "geen":
cli.notice(nick, "No game is currently running.") cli.notice(nick, "Er is nu geen spel bezig.")
return return
if nick not in var.list_players() or nick in var.DISCONNECTED.keys(): # not playing if nick not in var.list_players() or nick in var.DISCONNECTED.keys(): # not playing
cli.notice(nick, "You're not currently playing.") cli.notice(nick, "Je doet nu niet mee aan het spel.")
return return
cli.msg(botconfig.CHANNEL, ("\02{0}\02 died of an unknown disease. "+ cli.msg(botconfig.CHANNEL, ("\02{0}\02 is gestorven aan een onbekende ziekte. "+
"S/He was a \02{1}\02.").format(nick, var.get_role(nick))) "Hij/zij was een \02{1}\02.").format(nick, var.get_role(nick)))
var.LOGGER.logMessage(("{0} died of an unknown disease. "+ var.LOGGER.logMessage(("{0} is gestorven aan een onbekende ziekte. "+
"S/He was a {1}.").format(nick, var.get_role(nick))) "Hij/zij was een {1}.").format(nick, var.get_role(nick)))
del_player(cli, nick) del_player(cli, nick)
@ -1223,9 +1223,9 @@ def begin_day(cli):
var.HVISITED = {} var.HVISITED = {}
var.GUARDED = {} var.GUARDED = {}
msg = ("The villagers must now vote for whom to lynch. "+ msg = ("De burgers moeten nu stemmen wie ze willen elimineren. "+
'Use "{0}lynch <nick>" to cast your vote. {1} votes '+ 'gebruik "{0}lynch <nick>" om je stem door te geven. {1} stemmen '+
'are required to lynch.').format(botconfig.CMD_CHAR, len(var.list_players()) // 2 + 1) 'zijn nodig om iemand te elimineren.').format(botconfig.CMD_CHAR, len(var.list_players()) // 2 + 1)
cli.msg(chan, msg) cli.msg(chan, msg)
var.LOGGER.logMessage(msg) var.LOGGER.logMessage(msg)
var.LOGGER.logBare("DAY", "BEGIN") var.LOGGER.logBare("DAY", "BEGIN")
@ -1244,10 +1244,10 @@ def night_warn(cli, gameid):
if var.PHASE == "day": if var.PHASE == "day":
return return
cli.msg(botconfig.CHANNEL, ("\02A few villagers awake early and notice it " + cli.msg(botconfig.CHANNEL, ("\02A De burgers worden wakker en het valt ze op " +
"is still dark outside. " + "dat het buiten nogsteeds donker is. " +
"The night is almost over and there are " + "De nacht is bijna voorbij en er zijn " +
"still whispers heard in the village.\02")) "nogsteeds geluiden te horen in het dorp.\02"))
def transition_day(cli, gameid=0): def transition_day(cli, gameid=0):
if gameid: if gameid:
@ -1255,10 +1255,10 @@ def transition_day(cli, gameid=0):
return return
var.NIGHT_ID = 0 var.NIGHT_ID = 0
if var.PHASE == "day": if var.PHASE == "dag":
return return
var.PHASE = "day" var.PHASE = "dag"
var.GOATED = False var.GOATED = False
chan = botconfig.CHANNEL chan = botconfig.CHANNEL
@ -1269,9 +1269,9 @@ def transition_day(cli, gameid=0):
var.DAY_START_TIME = datetime.now() var.DAY_START_TIME = datetime.now()
if (not len(var.SEEN)+len(var.KILLS)+len(var.OBSERVED) # neither seer nor wolf acted if (not len(var.SEEN)+len(var.KILLS)+len(var.OBSERVED) # neither seer nor wolf acted
and var.FIRST_NIGHT and var.ROLES["seer"] and not botconfig.DEBUG_MODE): and var.FIRST_NIGHT and var.ROLES["ziener"] and not botconfig.DEBUG_MODE):
cli.msg(botconfig.CHANNEL, "\02The wolves all die of a mysterious plague.\02") cli.msg(botconfig.CHANNEL, "\02De wolven zijn allemaal gestorven door een onbekende ziekte.\02")
for x in var.ROLES["wolf"]+var.ROLES["werecrow"]+var.ROLES["traitor"]: for x in var.ROLES["wolf"]+var.ROLES["weerkraai"]+var.ROLES["verrader"]:
if not del_player(cli, x, True): if not del_player(cli, x, True):
return return

Loading…
Cancel
Save