mirror of
https://github.com/FAUSheppy/open-web-leaderboard.git
synced 2025-12-05 22:51:36 +01:00
update: change some medals
Some checks failed
Container Build for open-web-leaderboard / docker (push) Failing after 12s
Some checks failed
Container Build for open-web-leaderboard / docker (push) Failing after 12s
This commit is contained in:
33
medals.py
33
medals.py
@@ -1,4 +1,5 @@
|
|||||||
import flask
|
import flask
|
||||||
|
import markupsafe
|
||||||
|
|
||||||
medalDict = { "games-played-1" : { "name" : "Tourist",
|
medalDict = { "games-played-1" : { "name" : "Tourist",
|
||||||
"text" : "Played {} games on this server",
|
"text" : "Played {} games on this server",
|
||||||
@@ -15,6 +16,11 @@ medalDict = { "games-played-1" : { "name" : "Tourist",
|
|||||||
"color" : "yellow",
|
"color" : "yellow",
|
||||||
"text-color" : "black" },
|
"text-color" : "black" },
|
||||||
|
|
||||||
|
"games-played-4" : { "name" : "Alpha Chad",
|
||||||
|
"text" : "Played {} games on this server",
|
||||||
|
"color" : "black",
|
||||||
|
"text-color" : "red" },
|
||||||
|
|
||||||
"rating-cur-1" : { "name" : "Slightly skilled",
|
"rating-cur-1" : { "name" : "Slightly skilled",
|
||||||
"text" : "Rated above 1500",
|
"text" : "Rated above 1500",
|
||||||
"color" : "beige",
|
"color" : "beige",
|
||||||
@@ -28,6 +34,10 @@ medalDict = { "games-played-1" : { "name" : "Tourist",
|
|||||||
"text" : "Played {} games above 2000 rating",
|
"text" : "Played {} games above 2000 rating",
|
||||||
"color" : "lightgreen",
|
"color" : "lightgreen",
|
||||||
"text-color" : "black" },
|
"text-color" : "black" },
|
||||||
|
"rating-2k-3" : { "name" : "Epic Backup",
|
||||||
|
"text" : "Played {} games above 2000 rating",
|
||||||
|
"color" : "darkgreen",
|
||||||
|
"text-color" : "white" },
|
||||||
|
|
||||||
"rating-3k-1" : { "name" : "Epic",
|
"rating-3k-1" : { "name" : "Epic",
|
||||||
"text" : "Played {} games above 3000 rating",
|
"text" : "Played {} games above 3000 rating",
|
||||||
@@ -38,9 +48,13 @@ medalDict = { "games-played-1" : { "name" : "Tourist",
|
|||||||
"color" : "orange",
|
"color" : "orange",
|
||||||
"text-color" : "black" },
|
"text-color" : "black" },
|
||||||
"rating-3k-3" : { "name" : "All Along The Watchtower",
|
"rating-3k-3" : { "name" : "All Along The Watchtower",
|
||||||
"text" : "Played {} games above 3000 rating",
|
"text" : "???",
|
||||||
"color" : "red",
|
"color" : "red",
|
||||||
"text-color" : "black" },
|
"text-color" : "black" },
|
||||||
|
"rating-3k-4" : { "name" : "Highlander",
|
||||||
|
"text" : "There can only be one.",
|
||||||
|
"color" : "darkred",
|
||||||
|
"text-color" : "white" }
|
||||||
}
|
}
|
||||||
|
|
||||||
def medalGen(medal, formatInsert=None):
|
def medalGen(medal, formatInsert=None):
|
||||||
@@ -56,13 +70,15 @@ def medalGen(medal, formatInsert=None):
|
|||||||
color=medal["text-color"])
|
color=medal["text-color"])
|
||||||
if formatInsert:
|
if formatInsert:
|
||||||
tmp = tmp.format(formatInsert)
|
tmp = tmp.format(formatInsert)
|
||||||
return flask.Markup(tmp)
|
return markupsafe.Markup(tmp)
|
||||||
|
|
||||||
def getMedals(ratingList, gamesPlayed, currentRating):
|
def getMedals(ratingList, gamesPlayed, currentRating):
|
||||||
'''Get Medals this player should have'''
|
'''Get Medals this player should have'''
|
||||||
medals = []
|
medals = []
|
||||||
|
|
||||||
if gamesPlayed > 500:
|
if gamesPlayed > 2000:
|
||||||
|
medals += [medalGen(medalDict["games-played-4"], gamesPlayed)]
|
||||||
|
elif gamesPlayed > 500:
|
||||||
medals += [medalGen(medalDict["games-played-3"], gamesPlayed)]
|
medals += [medalGen(medalDict["games-played-3"], gamesPlayed)]
|
||||||
elif gamesPlayed > 100:
|
elif gamesPlayed > 100:
|
||||||
medals += [medalGen(medalDict["games-played-2"], gamesPlayed)]
|
medals += [medalGen(medalDict["games-played-2"], gamesPlayed)]
|
||||||
@@ -72,22 +88,23 @@ def getMedals(ratingList, gamesPlayed, currentRating):
|
|||||||
games2k = len(list(filter(lambda x: x > 2000, ratingList)))
|
games2k = len(list(filter(lambda x: x > 2000, ratingList)))
|
||||||
games3k = len(list(filter(lambda x: x > 3000, ratingList)))
|
games3k = len(list(filter(lambda x: x > 3000, ratingList)))
|
||||||
|
|
||||||
if games2k > 100:
|
if games2k > 1000:
|
||||||
|
medals += [medalGen(medalDict["rating-2k-3"], games2k)]
|
||||||
|
elif games2k > 100:
|
||||||
medals += [medalGen(medalDict["rating-2k-2"], games2k)]
|
medals += [medalGen(medalDict["rating-2k-2"], games2k)]
|
||||||
elif games2k > 0:
|
elif games2k > 0:
|
||||||
medals += [medalGen(medalDict["rating-2k-1"], games2k)]
|
medals += [medalGen(medalDict["rating-2k-1"], games2k)]
|
||||||
|
|
||||||
|
if games3k > 350:
|
||||||
|
medals += [medalGen(medalDict["rating-3k-4"], games3k)]
|
||||||
if games3k > 200:
|
if games3k > 200:
|
||||||
medals += [medalGen(medalDict["rating-3k-3"], games3k)]
|
medals += [medalGen(medalDict["rating-3k-3"], games3k)]
|
||||||
|
|
||||||
if games3k > 50:
|
if games3k > 50:
|
||||||
medals += [medalGen(medalDict["rating-3k-2"], games3k)]
|
medals += [medalGen(medalDict["rating-3k-2"], games3k)]
|
||||||
elif games3k > 5:
|
if games3k > 5:
|
||||||
medals += [medalGen(medalDict["rating-3k-1"], games3k)]
|
medals += [medalGen(medalDict["rating-3k-1"], games3k)]
|
||||||
|
|
||||||
if currentRating > 1500:
|
if currentRating > 1500:
|
||||||
medals += [medalGen(medalDict["rating-cur-1"])]
|
medals += [medalGen(medalDict["rating-cur-1"])]
|
||||||
|
|
||||||
return medals
|
return medals
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user