Initial commit
This commit is contained in:
55
secret/achievements/handlers/combo.py
Normal file
55
secret/achievements/handlers/combo.py
Normal file
@@ -0,0 +1,55 @@
|
||||
if __name__ != "handlers.combo":
|
||||
from secret.achievements import common
|
||||
from objects import glob
|
||||
else:
|
||||
import common
|
||||
|
||||
VERSION = 1
|
||||
ORDER = 1
|
||||
|
||||
# Loads the achievement length on load
|
||||
LENGTH = 0
|
||||
|
||||
ACHIEVEMENT_BASE = {
|
||||
"name": "{index} Combo (osu!{mode})",
|
||||
"description": "{index} big ones! You're moving up in the world!",
|
||||
"icon": "osu-combo-{index}"
|
||||
}
|
||||
|
||||
ACHIEVEMENT_KEYS = {
|
||||
"index": [500, 750, 1000, 2000],
|
||||
"mode": ["std", "taiko", "ctb", "mania"]
|
||||
}
|
||||
|
||||
# For every itteration index gets increased, while mode and mode_2 gets increased every 4 itterations
|
||||
ACHIEVEMENT_STRUCT = {
|
||||
"index": 1,
|
||||
"mode": 4
|
||||
}
|
||||
|
||||
ACHIEVEMENTS = []
|
||||
|
||||
def load():
|
||||
global ACHIEVEMENTS, LENGTH
|
||||
ACHIEVEMENTS, LENGTH = common.load_achievement_data(ACHIEVEMENT_BASE, ACHIEVEMENT_KEYS, ACHIEVEMENT_STRUCT)
|
||||
|
||||
def handle(mode, score, beatmap, user_data):
|
||||
return check(mode, score.maxCombo)
|
||||
|
||||
def check(mode, max_combo):
|
||||
achievement_ids = []
|
||||
indexies = [x for x in ACHIEVEMENT_KEYS["index"] if x <= max_combo]
|
||||
|
||||
for index in range(len(indexies)):
|
||||
achievement_ids.append(index + mode * 4)
|
||||
|
||||
return achievement_ids
|
||||
|
||||
def update(userID):
|
||||
achievement_ids = []
|
||||
|
||||
entries = glob.db.fetchAll("SELECT MAX(max_combo) AS max_combo, play_mode FROM scores WHERE userid = %s AND completed >= 2 GROUP BY play_mode", [userID])
|
||||
for entry in entries:
|
||||
achievement_ids += check(entry["play_mode"], entry["max_combo"])
|
||||
|
||||
return achievement_ids
|
116
secret/achievements/handlers/mods.py
Normal file
116
secret/achievements/handlers/mods.py
Normal file
@@ -0,0 +1,116 @@
|
||||
if __name__ != "handlers.mods":
|
||||
from secret.achievements import common
|
||||
from objects import glob
|
||||
from common.constants import mods
|
||||
else:
|
||||
import common
|
||||
|
||||
VERSION = 4
|
||||
ORDER = 4
|
||||
|
||||
# Loads the achievement length on load
|
||||
LENGTH = 0
|
||||
|
||||
ACHIEVEMENT_BASE = {
|
||||
"name": "{name}",
|
||||
"description": "{description}",
|
||||
"icon": "all-intro-{mod}"
|
||||
}
|
||||
|
||||
ACHIEVEMENT_KEYS = {
|
||||
"name": [
|
||||
"Finality",
|
||||
"Perfectionist",
|
||||
"Rock Around The Clock",
|
||||
"Time And A Half",
|
||||
"Sweet Rave Party",
|
||||
"Blindsight",
|
||||
"Are You Afraid Of The Dark?",
|
||||
"Dial It Right Back",
|
||||
"Risk Averse",
|
||||
"Slowboat",
|
||||
"Burned Out"
|
||||
],
|
||||
"description": [
|
||||
"High stakes, no regrets.",
|
||||
"Accept nothing but the best.",
|
||||
"You can't stop the rock.",
|
||||
"Having a right ol' time. One and a half of them, almost.",
|
||||
"Founded in the fine tradition of changing things that were just fine as they were.",
|
||||
"I can see just perfectly.",
|
||||
"Harder than it looks, probably because it's hard to look.",
|
||||
"Sometimes you just want to take it easy.",
|
||||
"Safety nets are fun!",
|
||||
"You got there. Eventually.",
|
||||
"One cannot always spin to win."
|
||||
],
|
||||
"mod": [
|
||||
"suddendeath",
|
||||
"perfect",
|
||||
"hardrock",
|
||||
"doubletime",
|
||||
"nightcore",
|
||||
"hidden",
|
||||
"flashlight",
|
||||
"easy",
|
||||
"nofail",
|
||||
"halftime",
|
||||
"spunout"
|
||||
]
|
||||
}
|
||||
|
||||
# For every itteration index gets increased, while mode and mode_2 gets increased every 4 itterations
|
||||
ACHIEVEMENT_STRUCT = {
|
||||
"name": 1,
|
||||
"description": 1,
|
||||
"mod": 1
|
||||
}
|
||||
|
||||
ACHIEVEMENTS = []
|
||||
|
||||
def load():
|
||||
global ACHIEVEMENTS, LENGTH
|
||||
ACHIEVEMENTS, LENGTH = common.load_achievement_data(ACHIEVEMENT_BASE, ACHIEVEMENT_KEYS, ACHIEVEMENT_STRUCT)
|
||||
|
||||
def handle(mode, score, beatmap, user_data):
|
||||
return check(score.mods)
|
||||
|
||||
def check(m):
|
||||
achievement_ids = []
|
||||
|
||||
# Yes I am braindead atm and dont want to think about it...
|
||||
if m & mods.SUDDENDEATH > 0:
|
||||
achievement_ids += [0]
|
||||
if m & mods.PERFECT > 0:
|
||||
achievement_ids += [1]
|
||||
if m & mods.HARDROCK > 0:
|
||||
achievement_ids += [2]
|
||||
if m & mods.DOUBLETIME > 0:
|
||||
achievement_ids += [3]
|
||||
if m & mods.NIGHTCORE > 0:
|
||||
achievement_ids += [4]
|
||||
if m & mods.HIDDEN > 0:
|
||||
achievement_ids += [5]
|
||||
if m & mods.FLASHLIGHT > 0:
|
||||
achievement_ids += [6]
|
||||
if m & mods.EASY > 0:
|
||||
achievement_ids += [7]
|
||||
if m & mods.NOFAIL > 0:
|
||||
achievement_ids += [8]
|
||||
if m & mods.HALFTIME > 0:
|
||||
achievement_ids += [9]
|
||||
if m & mods.SPUNOUT > 0:
|
||||
achievement_ids += [10]
|
||||
if m & mods.RELAX > 0:
|
||||
achievement_ids += [11]
|
||||
|
||||
return achievement_ids
|
||||
|
||||
def update(userID):
|
||||
achievement_ids = []
|
||||
|
||||
entries = glob.db.fetchAll("SELECT mods FROM scores WHERE userid = %s GROUP BY mods", [userID])
|
||||
for entry in entries:
|
||||
achievement_ids += check(entry["mods"])
|
||||
|
||||
return achievement_ids
|
63
secret/achievements/handlers/playcount.py
Normal file
63
secret/achievements/handlers/playcount.py
Normal file
@@ -0,0 +1,63 @@
|
||||
if __name__ != "handlers.playcount":
|
||||
from secret.achievements import common
|
||||
from objects import glob
|
||||
else:
|
||||
import common
|
||||
|
||||
VERSION = 5
|
||||
ORDER = 5
|
||||
|
||||
# Loads the achievement length on load
|
||||
LENGTH = 0
|
||||
|
||||
ACHIEVEMENT_BASE = {
|
||||
"name": "{index_formatted} Plays",
|
||||
"description": "{description}",
|
||||
"icon": "osu-plays-{index}"
|
||||
}
|
||||
|
||||
ACHIEVEMENT_KEYS = {
|
||||
"index": [5000, 15000, 25000, 50000],
|
||||
"index_formatted": ["5,000", "15,000", "25,000", "50,000"],
|
||||
"description": [
|
||||
"There's a lot more where that came from.",
|
||||
"Must.. click.. circles..",
|
||||
"There's no going back.",
|
||||
"You're here forever."
|
||||
]
|
||||
}
|
||||
|
||||
# For every itteration index gets increased, while mode and mode_2 gets increased every 4 itterations
|
||||
ACHIEVEMENT_STRUCT = {
|
||||
"index": 1,
|
||||
"index_formatted": 1,
|
||||
"description": 1
|
||||
}
|
||||
|
||||
ACHIEVEMENTS = []
|
||||
|
||||
def load():
|
||||
global ACHIEVEMENTS, LENGTH
|
||||
ACHIEVEMENTS, LENGTH = common.load_achievement_data(ACHIEVEMENT_BASE, ACHIEVEMENT_KEYS, ACHIEVEMENT_STRUCT)
|
||||
|
||||
def handle(mode, score, beatmap, user_data):
|
||||
if mode is not 0:
|
||||
return []
|
||||
return check(user_data["playcount"])
|
||||
|
||||
def check(playcount):
|
||||
achievement_ids = []
|
||||
indexies = [x for x in ACHIEVEMENT_KEYS["index"] if x <= playcount]
|
||||
|
||||
for index in range(len(indexies)):
|
||||
achievement_ids.append(index)
|
||||
|
||||
return achievement_ids
|
||||
|
||||
def update(userID):
|
||||
achievement_ids = []
|
||||
|
||||
playcount = glob.db.fetch("SELECT playcount_std FROM users_stats WHERE id = %s", [userID])["playcount_std"]
|
||||
achievement_ids += check(playcount)
|
||||
|
||||
return achievement_ids
|
114
secret/achievements/handlers/skillfc.py
Normal file
114
secret/achievements/handlers/skillfc.py
Normal file
@@ -0,0 +1,114 @@
|
||||
if __name__ != "handlers.skillfc":
|
||||
import math
|
||||
from secret.achievements import common
|
||||
from common.ripple import scoreUtils
|
||||
from objects import glob, beatmap
|
||||
else:
|
||||
import common
|
||||
|
||||
VERSION = 3
|
||||
ORDER = 3
|
||||
|
||||
# Loads the achievement length on load
|
||||
LENGTH = 0
|
||||
|
||||
ACHIEVEMENT_BASE = {
|
||||
"name": "{name}",
|
||||
"description": "{description}",
|
||||
"icon": "{mode}-skill-fc-{index}"
|
||||
}
|
||||
|
||||
ACHIEVEMENT_KEYS = {
|
||||
"index": [1, 2, 3, 4, 5, 6, 7, 8],
|
||||
"mode": ["osu", "taiko", "fruits", "mania"],
|
||||
"name": [
|
||||
"Totality",
|
||||
"Keeping Time",
|
||||
"Sweet And Sour",
|
||||
"Keystruck",
|
||||
"Business As Usual",
|
||||
"To Your Own Beat",
|
||||
"Reaching The Core",
|
||||
"Keying In",
|
||||
"Building Steam",
|
||||
"Big Drums",
|
||||
"Clean Platter",
|
||||
"Hyperflow",
|
||||
"Moving Forward",
|
||||
"Adversity Overcome",
|
||||
"Between The Rain",
|
||||
"Breakthrough",
|
||||
"Paradigm Shift",
|
||||
"Demonslayer",
|
||||
"Addicted",
|
||||
"Everything Extra",
|
||||
"Anguish Quelled",
|
||||
"Rhythm's Call",
|
||||
"Quickening",
|
||||
"Level Breaker",
|
||||
"Never Give Up",
|
||||
"Time Everlasting",
|
||||
"Supersonic",
|
||||
"Step Up",
|
||||
"Aberration",
|
||||
"The Drummer's Throne",
|
||||
"Dashing Scarlet",
|
||||
"Behind The Veil"
|
||||
],
|
||||
"description": [
|
||||
"All the notes. Every single one.",
|
||||
"Two to go, please.",
|
||||
"Hey, this isn't so bad.",
|
||||
"Bet you feel good about that.",
|
||||
"Surprisingly difficult.",
|
||||
"Don't choke.",
|
||||
"Excellence is its own reward.",
|
||||
"They said it couldn't be done. They were wrong."
|
||||
]
|
||||
}
|
||||
|
||||
# For every itteration index gets increased, while mode and mode_2 gets increased every 4 itterations
|
||||
ACHIEVEMENT_STRUCT = {
|
||||
"name": 1,
|
||||
"mode": 1,
|
||||
"index": 4,
|
||||
"description": 4
|
||||
}
|
||||
|
||||
ACHIEVEMENTS = []
|
||||
|
||||
def load():
|
||||
global ACHIEVEMENTS, LENGTH
|
||||
ACHIEVEMENTS, LENGTH = common.load_achievement_data(ACHIEVEMENT_BASE, ACHIEVEMENT_KEYS, ACHIEVEMENT_STRUCT)
|
||||
|
||||
def handle(mode, score, beatmap, user_data):
|
||||
if not score.fullCombo: # No need to check if the score were not a fullcombo
|
||||
return []
|
||||
return check(mode, beatmap)
|
||||
|
||||
def check(mode, beatmap):
|
||||
achievement_ids = []
|
||||
|
||||
mode_str = scoreUtils.readableGameMode(mode)
|
||||
|
||||
mode_2 = mode_str.replace("osu", "std")
|
||||
stars = getattr(beatmap, "stars" + mode_2.title())
|
||||
|
||||
indexies = [x - 1 for x in ACHIEVEMENT_KEYS["index"] if x == math.floor(stars)]
|
||||
|
||||
for index in indexies:
|
||||
achievement_ids.append(mode + index * 4)
|
||||
|
||||
return achievement_ids
|
||||
|
||||
def update(userID):
|
||||
achievement_ids = []
|
||||
|
||||
entries = glob.db.fetchAll("SELECT beatmap_md5, play_mode FROM scores WHERE full_combo = 1 AND completed >= 2 AND userid = %s GROUP BY beatmap_md5, play_mode", [userID])
|
||||
for entry in entries:
|
||||
current_beatmap = beatmap.beatmap()
|
||||
current_beatmap.setDataFromDB(entry["beatmap_md5"])
|
||||
|
||||
achievement_ids += check(entry["play_mode"], current_beatmap)
|
||||
|
||||
return achievement_ids
|
112
secret/achievements/handlers/skillpass.py
Normal file
112
secret/achievements/handlers/skillpass.py
Normal file
@@ -0,0 +1,112 @@
|
||||
if __name__ != "handlers.skillpass":
|
||||
import math
|
||||
from secret.achievements import common
|
||||
from common.ripple import scoreUtils
|
||||
from objects import glob, beatmap
|
||||
else:
|
||||
import common
|
||||
|
||||
VERSION = 2
|
||||
ORDER = 2
|
||||
|
||||
# Loads the achievement length on load
|
||||
LENGTH = 0
|
||||
|
||||
ACHIEVEMENT_BASE = {
|
||||
"name": "{name}",
|
||||
"description": "{description}",
|
||||
"icon": "{mode}-skill-pass-{index}"
|
||||
}
|
||||
|
||||
ACHIEVEMENT_KEYS = {
|
||||
"index": [1, 2, 3, 4, 5, 6, 7, 8],
|
||||
"mode": ["osu", "taiko", "fruits", "mania"],
|
||||
"name": [
|
||||
"Rising Star",
|
||||
"My First Don",
|
||||
"A Slice Of Life",
|
||||
"First Steps",
|
||||
"Constellation Prize",
|
||||
"Katsu Katsu Katsu",
|
||||
"Dashing Ever Forward",
|
||||
"No Normal Player",
|
||||
"Building Confidence",
|
||||
"Not Even Trying",
|
||||
"Zesty Disposition",
|
||||
"Impulse Drive",
|
||||
"Insanity Approaches",
|
||||
"Face Your Demons",
|
||||
"Hyperdash ON!",
|
||||
"Hyperspeed",
|
||||
"These Clarion Skies",
|
||||
"The Demon Within",
|
||||
"It's Raining Fruit",
|
||||
"Ever Onwards",
|
||||
"Above and Beyond",
|
||||
"Drumbreaker",
|
||||
"Fruit Ninja",
|
||||
"Another Surpassed",
|
||||
"Supremacy",
|
||||
"The Godfather",
|
||||
"Dreamcatcher",
|
||||
"Extra Credit",
|
||||
"Absolution",
|
||||
"Rhythm Incarnate",
|
||||
"Lord of the Catch",
|
||||
"Maniac"
|
||||
],
|
||||
"description": [
|
||||
"Can't go forward without the first steps.",
|
||||
"Definitely not a consolation prize. Now things start getting hard!",
|
||||
"Oh, you've SO got this.",
|
||||
"You're not twitching, you're just ready.",
|
||||
"Everything seems so clear now.",
|
||||
"A cut above the rest.",
|
||||
"All marvel before your prowess.",
|
||||
"My god, you're full of stars!"
|
||||
]
|
||||
}
|
||||
|
||||
# For every itteration index gets increased, while mode and mode_2 gets increased every 4 itterations
|
||||
ACHIEVEMENT_STRUCT = {
|
||||
"name": 1,
|
||||
"mode": 1,
|
||||
"index": 4,
|
||||
"description": 4
|
||||
}
|
||||
|
||||
ACHIEVEMENTS = []
|
||||
|
||||
def load():
|
||||
global ACHIEVEMENTS, LENGTH
|
||||
ACHIEVEMENTS, LENGTH = common.load_achievement_data(ACHIEVEMENT_BASE, ACHIEVEMENT_KEYS, ACHIEVEMENT_STRUCT)
|
||||
|
||||
def handle(mode, score, beatmap, user_data):
|
||||
return check(mode, beatmap)
|
||||
|
||||
def check(mode, beatmap):
|
||||
achievement_ids = []
|
||||
|
||||
mode_str = scoreUtils.readableGameMode(mode)
|
||||
|
||||
mode_2 = mode_str.replace("osu", "std")
|
||||
stars = getattr(beatmap, "stars" + mode_2.title())
|
||||
|
||||
indexies = [x - 1 for x in ACHIEVEMENT_KEYS["index"] if x == math.floor(stars)]
|
||||
|
||||
for index in indexies:
|
||||
achievement_ids.append(mode + index * 4)
|
||||
|
||||
return achievement_ids
|
||||
|
||||
def update(userID):
|
||||
achievement_ids = []
|
||||
|
||||
entries = glob.db.fetchAll("SELECT beatmap_md5, play_mode FROM scores WHERE completed = 3 AND userid = %s", [userID])
|
||||
for entry in entries:
|
||||
current_beatmap = beatmap.beatmap()
|
||||
current_beatmap.setDataFromDB(entry["beatmap_md5"])
|
||||
|
||||
achievement_ids += check(entry["play_mode"], current_beatmap)
|
||||
|
||||
return achievement_ids
|
Reference in New Issue
Block a user