-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
99 lines (79 loc) · 3.25 KB
/
main.cpp
File metadata and controls
99 lines (79 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include <Geode/Geode.hpp>
#include <Geode/modify/MenuLayer.hpp>
#include <Geode/loader/Event.hpp>
#include <Geode/utils/web.hpp>
#include "Manager.h"
using namespace geode::prelude;
class $modify(MenuLayer) {
struct Fields {
EventListener<web::WebTask> m_listener1;
EventListener<web::WebTask> m_listener2;
EventListener<web::WebTask> m_listener3;
};
bool init() {
if (!MenuLayer::init()) {
return false;
}
// If the game has already been opened, don't do the request.
if (Manager::firstTimeOpen) {
return true;
}
/*
web::AsyncWebRequest()
.postRequest()
.bodyRaw(fmt::format("type={}", "creators"))
.fetch("https://clarifygdps.com/gdutils/moreleaderboards.php")
.text()
.then([this](const std::string& response) {
Manager::parseRequestString(response, Manager::userIDList);
});
web::AsyncWebRequest()
.postRequest()
.bodyRaw(fmt::format("type={}", "moons"))
.fetch("https://clarifygdps.com/gdutils/moreleaderboards.php")
.text()
.then([this](const std::string& response) {
Manager::parseRequestString(response, Manager::userIDListMoons);
});
web::AsyncWebRequest()
.postRequest()
.bodyRaw(fmt::format("type={}", "demons"))
.fetch("https://clarifygdps.com/gdutils/moreleaderboards.php")
.text()
.then([this](const std::string& response) {
Manager::parseRequestString(response, Manager::userIDListDemons);
});
*/
m_fields->m_listener1.bind([] (web::WebTask::Event* e) {
if (web::WebResponse* res = e->getValue()) {
Manager::parseRequestString(res->string().unwrapOr("Failed."), Manager::userIDListDemons);
}
});
m_fields->m_listener2.bind([] (web::WebTask::Event* e) {
if (web::WebResponse* res = e->getValue()) {
Manager::parseRequestString(res->string().unwrapOr("Failed."), Manager::userIDList);
}
});
m_fields->m_listener3.bind([] (web::WebTask::Event* e) {
if (web::WebResponse* res = e->getValue()) {
Manager::parseRequestString(res->string().unwrapOr("Failed."), Manager::userIDListMoons);
}
});
auto req1 = web::WebRequest();
req1.param("type", "demons");
req1.param("count", "2500");
req1.bodyString(fmt::format("type={}&count={}", "demons", "2500"));
m_fields->m_listener1.setFilter(req1.get("https://clarifygdps.com/gdutils/moreleaderboards.php"));
auto req2 = web::WebRequest();
req2.param("type", "cp");
req2.param("count", "2500");
req2.bodyString(fmt::format("type={}&count={}", "cp", "2500"));
m_fields->m_listener2.setFilter(req2.get("https://clarifygdps.com/gdutils/moreleaderboards.php"));
auto req3 = web::WebRequest();
req3.param("type", "moons");
req3.param("count", "2500");
req3.bodyString(fmt::format("type={}&count={}", "moons", "2500"));
m_fields->m_listener3.setFilter(req3.get("https://clarifygdps.com/gdutils/moreleaderboards.php"));
return true;
}
};