MMR funktioniert. Tzeentch regel muss angepasst werden.
This commit is contained in:
parent
931189baca
commit
2d3c17bcf2
|
|
@ -1 +1 @@
|
|||
{"authenticated":true,"discord_id":"277898241750859776","discord_name":"mrteels","db_id":2,"display_name":"Verwirrter Servitor","discord_avatar_url":"https://cdn.discordapp.com/avatars/277898241750859776/7c3446bb51fafd72b1b4c21124b4994f.png"}
|
||||
{"authenticated":true,"discord_id":"277898241750859776","discord_name":"mrteels","db_id":2,"display_name":"Stolpernder Servitor","discord_avatar_url":"https://cdn.discordapp.com/avatars/277898241750859776/7c3446bb51fafd72b1b4c21124b4994f.png"}
|
||||
|
|
@ -136,23 +136,6 @@ def get_gamesystem_id_by_name(system_name):
|
|||
|
||||
|
||||
|
||||
def get_gamesystem_data():
|
||||
connection = sqlite3.connect(DB_PATH)
|
||||
|
||||
connection.row_factory = sqlite3.Row
|
||||
cursor = connection.cursor()
|
||||
|
||||
cursor.execute("SELECT * FROM gamesystems")
|
||||
rows = cursor.fetchall()
|
||||
connection.close()
|
||||
|
||||
# SQLite-Rows in normale Python-Dictionaries um
|
||||
result = []
|
||||
for row in rows:
|
||||
result.append(dict(row))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
||||
def get_player_statistics(player_id):
|
||||
|
|
@ -371,6 +354,36 @@ def save_calculated_match(calc_results: dict):
|
|||
# -----------------------------------------------------
|
||||
# Get Data Funktionen
|
||||
# -----------------------------------------------------
|
||||
def get_gamesystem_data(system_id):
|
||||
connection = sqlite3.connect(DB_PATH)
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("SELECT * FROM gamesystems WHERE id = ?", (system_id,))
|
||||
row = cursor.fetchone()
|
||||
connection.close()
|
||||
return dict(zip([col[0] for col in cursor.description], row)) if row else None
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def get_gamesystems_data():
|
||||
connection = sqlite3.connect(DB_PATH)
|
||||
|
||||
connection.row_factory = sqlite3.Row
|
||||
cursor = connection.cursor()
|
||||
|
||||
cursor.execute("SELECT * FROM gamesystems")
|
||||
rows = cursor.fetchall()
|
||||
connection.close()
|
||||
|
||||
# SQLite-Rows in normale Python-Dictionaries um
|
||||
result = []
|
||||
for row in rows:
|
||||
result.append(dict(row))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
||||
def get_leaderboard(system_name):
|
||||
"""Holt alle Spieler eines Systems sortiert nach MMR für die Rangliste."""
|
||||
|
|
@ -475,6 +488,8 @@ def get_system_name(sys_id):
|
|||
return "Gelöschtes System"
|
||||
|
||||
|
||||
|
||||
|
||||
def get_days_since_last_system_game(player_id, gamesystem_id):
|
||||
"""Gibt zurück, wie viele Tage das letzte Spiel in einem bestimmten System her ist."""
|
||||
connection = sqlite3.connect(DB_PATH)
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ def setup_routes(admin_discord_id):
|
|||
info_system.create_info_button("league_info")
|
||||
|
||||
placements = data_api.get_player_statistics(player_id)
|
||||
systems = data_api.get_gamesystem_data()
|
||||
systems = data_api.get_gamesystems_data()
|
||||
|
||||
my_stats = { p['gamesystem_id']: p for p in placements }
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ def calculate_match (match_id):
|
|||
base_change = int(calculation.calc_base_change(elo_factor, match_is_draw, K_FACTOR))
|
||||
rust_factor = calculation.calc_rust_factor(winner_id, looser_id, system_id)
|
||||
|
||||
|
||||
#winner
|
||||
w_base = int(base_change)
|
||||
w_khorne = int(calculation.wrath_of_khorne(winner_id, system_id))
|
||||
|
|
@ -64,8 +63,7 @@ def calculate_match (match_id):
|
|||
l_khorne = int(calculation.wrath_of_khorne(looser_id, system_id))
|
||||
|
||||
slaanesh = int(calculation.slaanesh_delight())
|
||||
tzeentch = int(calculation.tzeentch_scemes(winner_score, looser_score))
|
||||
|
||||
tzeentch = int(calculation.tzeentch_scemes(system_id, winner_score, looser_score))
|
||||
|
||||
# ==========================================
|
||||
# 3. Daten Verpacken
|
||||
|
|
@ -95,6 +93,9 @@ def calculate_match (match_id):
|
|||
}
|
||||
}
|
||||
|
||||
logger.log("MATCH CALC", f"Match{match_id} berechnet.")
|
||||
logger.log("MATCH CALC", f"Winner {data_api.get_player_name(winner_id)}: Base {w_base} + Khorne {w_khorne} + Slaanesh {slaanesh} + Tzeentch {tzeentch}")
|
||||
logger.log("MATCH CALC", f"Looser {data_api.get_player_name(looser_id)}: Base {l_base} + Khorne {l_khorne} - Slaanesh {slaanesh} - Tzeentch {tzeentch}")
|
||||
data_api.save_calculated_match(calc_results)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,5 +67,11 @@ def wrath_of_khorne(player_id, system_id):
|
|||
def slaanesh_delight():
|
||||
return 0
|
||||
|
||||
def tzeentch_scemes(winner_score, looser_score):
|
||||
return 0
|
||||
def tzeentch_scemes(system_id, winner_score, looser_score):
|
||||
sys_data = data_api.get_gamesystem_data(system_id)
|
||||
min_score = sys_data["min_score"]
|
||||
max_score = sys_data["max_score"]
|
||||
|
||||
bonus = int(((max_score*(winner_score-looser_score)))/(max_score*1.1)) #Multiplikatiionsfaktor für die Berechnung.
|
||||
|
||||
return bonus
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user