forked from sass/tipibot
Merge branch 'master' of ssh://git.lapikud.ee:202/renkar/tipibot
This commit is contained in:
@@ -16,17 +16,13 @@ from typing import TypedDict
|
||||
import aiohttp
|
||||
|
||||
from . import pb_client
|
||||
from .pb_client import DatabaseError
|
||||
|
||||
import strings
|
||||
|
||||
_txn_log = logging.getLogger("tipiCOIN.txn")
|
||||
|
||||
|
||||
class DatabaseError(Exception):
|
||||
"""Raised when PocketBase is unreachable or returns an error."""
|
||||
pass
|
||||
|
||||
|
||||
def _txn(event: str, **fields) -> None:
|
||||
"""Log a single economy transaction to the transactions logger."""
|
||||
body = " ".join(f"{k}={v}" for k, v in fields.items())
|
||||
@@ -321,16 +317,16 @@ LEVEL_ROLES: list[tuple[int, str]] = [
|
||||
|
||||
|
||||
def get_level(exp: int) -> int:
|
||||
"""Level = max(1, floor(sqrt(exp/10))).
|
||||
Level 5 @ 250 EXP, 10 @ 1000, 20 @ 4000, 30 @ 9000."""
|
||||
return max(1, int(math.sqrt(max(0, exp) / 10)))
|
||||
"""Level = max(1, floor(sqrt(exp/6))).
|
||||
Level 5 @ 150 EXP, 10 @ 600, 20 @ 2400, 30 @ 5400."""
|
||||
return max(1, int(math.sqrt(max(0, exp) / 6)))
|
||||
|
||||
|
||||
def exp_for_level(level: int) -> int:
|
||||
"""Minimum cumulative EXP to reach this level."""
|
||||
"""Minimum cumulative EXP to reach this level. level^2 * 6."""
|
||||
if level <= 1:
|
||||
return 0
|
||||
return level * level * 10
|
||||
return level * level * 6
|
||||
|
||||
|
||||
def level_role_name(level: int) -> str:
|
||||
|
||||
Reference in New Issue
Block a user