Add files
This commit is contained in:
43
cpp/spinner.cpp
Executable file
43
cpp/spinner.cpp
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#include <Windows.h>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cmath>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
|
constexpr auto num_points = 10;
|
||||||
|
constexpr auto sleep_msec = 1;
|
||||||
|
constexpr auto radius = 100.0f;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
const auto window_handle = FindWindow(nullptr, "osu!");
|
||||||
|
if (!window_handle) {
|
||||||
|
printf("FATAL: Could not find osu!. (0x%X)\n", GetLastError());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto get_desired_pos = [&]() -> std::tuple<int, int> {
|
||||||
|
static auto counter = 0;
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
RECT rect;
|
||||||
|
GetWindowRect(window_handle, &rect);
|
||||||
|
|
||||||
|
const auto center_x = rect.left + (rect.right - rect.left) / 2;
|
||||||
|
const auto center_y = rect.top + (rect.bottom - rect.top) / 2;
|
||||||
|
|
||||||
|
const auto angle = 3.1415926f * 2.0f * (float)counter / (float)num_points;
|
||||||
|
|
||||||
|
if (counter > num_points) {
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { center_x + radius * sin(angle), center_y + radius * cos(angle) };
|
||||||
|
};
|
||||||
|
|
||||||
|
while (!GetAsyncKeyState(VK_DELETE)) {
|
||||||
|
if (GetAsyncKeyState('P')) {
|
||||||
|
std::apply(SetCursorPos, get_desired_pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
Sleep(sleep_msec);
|
||||||
|
}
|
||||||
|
}
|
||||||
47
python/web/get_7k_pp.py
Executable file
47
python/web/get_7k_pp.py
Executable file
@@ -0,0 +1,47 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print("usage: python get_7k_pp.py [api key] [username]")
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
api_key = sys.argv[1]
|
||||||
|
usernames = sys.argv[2:]
|
||||||
|
|
||||||
|
def get_json(url):
|
||||||
|
page = requests.get(url)
|
||||||
|
|
||||||
|
try:
|
||||||
|
page.raise_for_status()
|
||||||
|
except:
|
||||||
|
print("Could not get '{}'".format(url))
|
||||||
|
return []
|
||||||
|
|
||||||
|
return json.loads(page.text)
|
||||||
|
|
||||||
|
def get_user_best(api_key, username):
|
||||||
|
return get_json("https://osu.ppy.sh/api/get_user_best?k={}&limit=100&m=3&u={}".format(api_key, username))
|
||||||
|
|
||||||
|
def get_beatmap(api_key, id):
|
||||||
|
return get_json("https://osu.ppy.sh/api/get_beatmaps?k={}&b={}".format(api_key, id))
|
||||||
|
|
||||||
|
for username in usernames:
|
||||||
|
scores_7k = []
|
||||||
|
pp_7k = 0.0
|
||||||
|
for score in get_user_best(api_key, username):
|
||||||
|
info = get_beatmap(api_key, score["beatmap_id"])[0]
|
||||||
|
if info["diff_size"] == '7':
|
||||||
|
# theres probably a prettier solution for this
|
||||||
|
percentage = 100.0
|
||||||
|
for num in range(len(scores_7k)):
|
||||||
|
percentage *= 0.95
|
||||||
|
|
||||||
|
pp_7k += float(score["pp"]) / 100.0 * percentage
|
||||||
|
scores_7k.append("[{:.2f}+ ({:.2f}%)] {:.2f} {} [{}] {}k".format(pp_7k, percentage, float(score["pp"]), info["title"], info["version"], score["score"][:3]))
|
||||||
|
|
||||||
|
print("7k pp for '{}'".format(username))
|
||||||
|
print("Total = {}".format(pp_7k))
|
||||||
|
|
||||||
|
for score_7k in scores_7k:
|
||||||
|
print(score_7k)
|
||||||
Reference in New Issue
Block a user