From 77725ad527b2d0af80678dd7254b804dc51d1dc8 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sun, 11 Dec 2022 00:00:30 -0800 Subject: [PATCH] Factor maze & deathmatch scores when calculating best players References: - https://github.com/arianne/stendhal/issues/453 - https://stendhalgame.org/chat/2022-07-05.html --- data/script/halloffame.sql | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/data/script/halloffame.sql b/data/script/halloffame.sql index 6a26ba17d12..365e52cba5b 100644 --- a/data/script/halloffame.sql +++ b/data/script/halloffame.sql @@ -8,7 +8,7 @@ -- X XP -- B Best (xp and online age) -- @ Achievement score --- R Role play score (xp, achievement, karma, & money) (TODO: add maze score, deathmatch score, visited zones, & completed quests) +-- R Role play score (xp, achievement, karma, money, maze score, & deathmatch score) (TODO: visited zones & completed quests) -- O -- 0 -- 3,4,5,6,7,8,9 Paper Chase 2013 and newer @@ -108,7 +108,14 @@ ORDER BY points DESC, nmb DESC, xp DESC) As scoretable, INSERT INTO halloffame_archive_recent (charname, fametype, halloffame_archive_recent.rank, points, day) SELECT scoretable.name, 'R', @rownum:=@rownum+1 as rankX, scoretable.points, CURRENT_DATE() FROM ( - SELECT name, round(ln((xp+karma+money)*(ifnull(sum(1/reached)*1000,0)+0.0001))*1000) As points, sum(1/reached) + SELECT + name, + round(ln( + (xp+karma+money + +ifnull((SELECT points FROM halloffame WHERE fametype='M' AND charname=name LIMIT 1), 0) + +ifnull((SELECT points FROM halloffame WHERE fametype='D' AND charname=name LIMIT 1), 0) + )*(ifnull(sum(1/reached)*1000,0)+0.0001))*1000) As points, + sum(1/reached) FROM achievement JOIN reached_achievement ra ON (ra.achievement_id=achievement.id) RIGHT JOIN character_stats ON name = charname @@ -207,7 +214,14 @@ ORDER BY points DESC, nmb DESC, xp DESC) As scoretable, INSERT INTO halloffame_archive_alltimes (charname, fametype, halloffame_archive_alltimes.rank, points, day) SELECT scoretable.name, 'R', @rownum:=@rownum+1 as rankX, scoretable.points, CURRENT_DATE() FROM ( - SELECT name, round(ln((xp+karma+money)*(ifnull(sum(1/reached)*1000,0)+0.0001))*1000) As points, sum(1/reached) + SELECT + name, + round(ln( + (xp+karma+money + +ifnull((SELECT points FROM halloffame WHERE fametype='M' AND charname=name LIMIT 1), 0) + +ifnull((SELECT points FROM halloffame WHERE fametype='D' AND charname=name LIMIT 1), 0) + )*(ifnull(sum(1/reached)*1000,0)+0.0001))*1000) As points, + sum(1/reached) FROM achievement JOIN reached_achievement ra ON (ra.achievement_id=achievement.id) RIGHT JOIN character_stats ON name = charname