Exemple #1
0
def add_to_stats(member, game_name, wins=0, played=0):
    userdata = getuser(member.id)
    stats = userdata.get("stats", {})
    stats[game_name] = [
        x + y for x, y in zip(stats.get(game_name, [0, 0]), [wins, played])
    ]
    userdata["stats"] = stats
    setuser(member.id, userdata)
Exemple #2
0
def withdraw_money(member, amount):
    userdata = getuser(member.id)
    oldmoney = userdata.get("money", 0)
    if oldmoney >= amount:
        userdata["money"] = oldmoney - amount
        setuser(member.id, userdata)
        return True
    else:
        return False
Exemple #3
0
def has_money(member, amount):
    money = getuser(member.id).get("money", 0)
    if money >= amount:
        return True
    else:
        return False
Exemple #4
0
def get_money(member):
    return getuser(member.id).get("money", 0)
Exemple #5
0
def set_money(member, amount):
    userdata = getuser(member.id)
    userdata["money"] = amount
    setuser(member.id, userdata)
    return
Exemple #6
0
async def add_xp(member, xp):
    userdata = getuser(member.id)
    oldxp = userdata.get("xp", 0)
    userdata["xp"] = oldxp + xp
    setuser(member.id, userdata)
    await update_player_nick(member)
Exemple #7
0
def deposit_money(member, amount):
    userdata = getuser(member.id)
    oldmoney = userdata.get("money", 0)
    userdata["money"] = oldmoney + amount
    setuser(member.id, userdata)
    return
Exemple #8
0
def get_all_stats():
    return [getuser(x)["stats"] for x in getuserlist()]
Exemple #9
0
def get_stats(member):
    userdata = getuser(member.id)
    return userdata.get("stats", {})
Exemple #10
0
def get_level(member):
    member_xp = getuser(member.id).get("xp", 0)
    member_level = math.ceil(math.sqrt(member_xp / 5))
    return member_level
Exemple #11
0
def get_xp(member):
    userdata = getuser(member.id)
    xp = userdata.get("xp", 0)
    return xp