Make the final depth appear in Advanced Rogue 5 tables.
Along the way, "SELECT name FROM table WHERE name = ..." was removed from any queries where it had been carelessly placed.
This commit is contained in:
parent
172d389ba5
commit
fd5b0c83b6
1 changed files with 18 additions and 14 deletions
32
py/rlgall.py
32
py/rlgall.py
|
|
@ -54,7 +54,8 @@ pend = """<div class="foot">
|
||||||
|
|
||||||
# This would be more useful if we had to do translation
|
# This would be more useful if we had to do translation
|
||||||
headerbook = {"endt":"End time", "score":"Score", "name":"Name", "xl":"XL",
|
headerbook = {"endt":"End time", "score":"Score", "name":"Name", "xl":"XL",
|
||||||
"fate":"Fate", "rank":"Rank", "game":"Game", "class": "Class"}
|
"fate":"Fate", "rank":"Rank", "game":"Game", "class":"Class",
|
||||||
|
"depth":"Depth"}
|
||||||
# Queries for the games table
|
# Queries for the games table
|
||||||
offselstr = "SELECT offbytes FROM games WHERE gname = %s;"
|
offselstr = "SELECT offbytes FROM games WHERE gname = %s;"
|
||||||
newoffstr = "UPDATE games SET offbytes = %s WHERE gname = %s;"
|
newoffstr = "UPDATE games SET offbytes = %s WHERE gname = %s;"
|
||||||
|
|
@ -123,6 +124,8 @@ def printTable(entries, fields, of):
|
||||||
clist.append((thing.name, cell))
|
clist.append((thing.name, cell))
|
||||||
elif field == "xl" or field == "score" or field == "rank": # Numerics
|
elif field == "xl" or field == "score" or field == "rank": # Numerics
|
||||||
clist.append((str(thing), rcell))
|
clist.append((str(thing), rcell))
|
||||||
|
elif field == "depth" or field == "maxdepth":
|
||||||
|
clist.append((str(thing), cell))
|
||||||
elif field == "name":
|
elif field == "name":
|
||||||
clist.append((playerlink(thing), cell))
|
clist.append((playerlink(thing), cell))
|
||||||
elif field == "fate":
|
elif field == "fate":
|
||||||
|
|
@ -425,7 +428,7 @@ class RogueGame(Game):
|
||||||
return dictlist
|
return dictlist
|
||||||
def getPlayer(self, player):
|
def getPlayer(self, player):
|
||||||
"Gets all player's games from the database."
|
"Gets all player's games from the database."
|
||||||
qstr = "SELECT endt, score, name, xl, fate, startt FROM " + self.uname + " WHERE name = %s;"
|
qstr = "SELECT endt, score, xl, fate, startt FROM " + self.uname + " WHERE name = %s;"
|
||||||
conn = getconn()
|
conn = getconn()
|
||||||
if conn == None:
|
if conn == None:
|
||||||
return []
|
return []
|
||||||
|
|
@ -434,12 +437,12 @@ class RogueGame(Game):
|
||||||
cur.execute(qstr, [player])
|
cur.execute(qstr, [player])
|
||||||
for record in cur:
|
for record in cur:
|
||||||
ndict = {"game": self}
|
ndict = {"game": self}
|
||||||
|
ndict["name"] = self.uname
|
||||||
ndict["endt"] = record[0]
|
ndict["endt"] = record[0]
|
||||||
ndict["score"] = record[1]
|
ndict["score"] = record[1]
|
||||||
ndict["name"] = record[2]
|
ndict["xl"] = record[2]
|
||||||
ndict["xl"] = record[3]
|
ndict["fate"] = record[3]
|
||||||
ndict["fate"] = record[4]
|
ndict["startt"] = record[4]
|
||||||
ndict["startt"] = record[5]
|
|
||||||
entries.append(ndict)
|
entries.append(ndict)
|
||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
@ -495,14 +498,14 @@ class ARogueGame(Game):
|
||||||
self.insertq = "INSERT INTO {0} ({1}) VALUES ({2});".format(self.uname,
|
self.insertq = "INSERT INTO {0} ({1}) VALUES ({2});".format(self.uname,
|
||||||
colspec, valspec)
|
colspec, valspec)
|
||||||
# Class variables
|
# Class variables
|
||||||
fields = ["name", "score", "class", "xl", "fate", "endt"]
|
fields = ["name", "score", "class", "xl", "fate", "depth", "endt"]
|
||||||
rankfields = ["rank", "score", "name", "class", "xl", "fate", "endt"]
|
rankfields = ["rank", "score", "name", "class", "xl", "fate", "depth", "endt"]
|
||||||
pfields = ["score", "class", "xl", "fate", "endt"]
|
pfields = ["score", "class", "xl", "fate", "depth", "endt"]
|
||||||
def getRecent(self, n=20):
|
def getRecent(self, n=20):
|
||||||
return []
|
return []
|
||||||
def getPlayer(self, player):
|
def getPlayer(self, player):
|
||||||
"Gets all player's games from the database."
|
"Gets all player's games from the database."
|
||||||
qstr = "SELECT endt, score, name, xl, class, fate FROM " + self.uname + " WHERE name = %s;"
|
qstr = "SELECT endt, score, xl, class, fate, depth FROM " + self.uname + " WHERE name = %s;"
|
||||||
conn = getconn()
|
conn = getconn()
|
||||||
if conn == None:
|
if conn == None:
|
||||||
return []
|
return []
|
||||||
|
|
@ -511,12 +514,13 @@ class ARogueGame(Game):
|
||||||
cur.execute(qstr, [player])
|
cur.execute(qstr, [player])
|
||||||
for record in cur:
|
for record in cur:
|
||||||
ndict = {"game": self}
|
ndict = {"game": self}
|
||||||
|
ndict["name"] = self.uname
|
||||||
ndict["endt"] = record[0]
|
ndict["endt"] = record[0]
|
||||||
ndict["score"] = record[1]
|
ndict["score"] = record[1]
|
||||||
ndict["name"] = record[2]
|
ndict["xl"] = record[2]
|
||||||
ndict["xl"] = record[3]
|
ndict["class"] = record[3]
|
||||||
ndict["class"] = record[4]
|
ndict["fate"] = record[4]
|
||||||
ndict["fate"] = record[5]
|
ndict["depth"] = record[5]
|
||||||
entries.append(ndict)
|
entries.append(ndict)
|
||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue