summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-12-17 21:43:33 -0500
committerrsiddharth <s@ricketyspace.net>2019-12-17 21:45:08 -0500
commitad7b00a713227910de2e66021521157636a10d06 (patch)
tree589c0e1e55b98c7f570b1a62ee6252b174136be1
parent248f5e12e9ed0fd521d6ead4ff98a54dc894e2e6 (diff)
nfsw.scenes: Update thanks.
* nfsw/scenes.py (thanks): Change ending.
-rw-r--r--nfsw/scenes.py37
1 files changed, 34 insertions, 3 deletions
diff --git a/nfsw/scenes.py b/nfsw/scenes.py
index cf6b310..cfb560d 100644
--- a/nfsw/scenes.py
+++ b/nfsw/scenes.py
@@ -10,7 +10,7 @@
import os.path
import subprocess
-from flask import current_app, g
+from flask import current_app, g, session
from nfsw.redis import redis
from nfsw.util import read_junk
@@ -638,11 +638,42 @@ def bedroom(o):
def thanks(o):
r = redis()
+ def stats():
+ k = 'players:finished'
+ id = session['user_id']
+
+ if r.r.sismember(k, id):
+ return ''
+
+ r.r.sadd(k, id)
+
+ place = r.r.scard(k)
+
+ # Record place
+ r.set('player:place', place)
+
+ unit = place % 10
+ hund = place % 100
+
+ th = 'th'
+ if place == 1 or (unit == 1 and hund != 1):
+ th = 'st'
+ elif unit == 2 and hund != 1:
+ th = 'nd'
+ elif unit == 3 and hund != 1:
+ th = 'rd'
+
+ return ' You\'re the {}{} person to finish this game!'.format(
+ place, th
+ )
+
if r.sismember('scenes:done', 'thanks'):
return 'You\'ve finished the game!'
# Mark scene done
r.sadd('scenes:done', 'thanks')
- type = r.get('player:type:mind').decode()
- return read_junk('thanks/solong-{}'.format(type))
+ return '\n'.join([
+ stats(),
+ '\n - Santa'
+ ])