-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0fbf43
commit ed954f5
Showing
10 changed files
with
171 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
# Integrated Demonlist | ||
A mod that integrates a list of the top extreme demons, according to [aredl.net](https://aredl.net), into Geometry Dash. | ||
A mod that integrates [aredl.net](https://aredl.net) and [pemonlist.com](https://pemonlist.com) into Geometry Dash. | ||
|
||
# Features | ||
- A new button in the level/list search screen that opens the demon list. | ||
- A search box that allows you to search for a demon in the list by name. | ||
- Page navigation buttons that allow you to navigate through the list. | ||
- A button that allows you to switch between the AREDL (For classic demons) and the Pemonlist (For platformer demons). | ||
- If on the list, and if enabled, there will be text on the demon's search box that states its position on the list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "IntegratedDemonlist.hpp" | ||
|
||
void IntegratedDemonlist::initializeDemons(web::WebResponse* res, bool pemonlist) { | ||
auto& list = pemonlist ? PEMONLIST : AREDL; | ||
list.clear(); | ||
for (auto const& level : res->json().value().as_array()) { | ||
list.push_back({ | ||
level["level_id"].as_int(), | ||
level["name"].as_string(), | ||
level[pemonlist ? "placement" : "position"].as_int() | ||
}); | ||
} | ||
} | ||
|
||
void IntegratedDemonlist::loadAREDL() { | ||
static std::optional<web::WebTask> task = std::nullopt; | ||
task = web::WebRequest().get("https://api.aredl.net/api/aredl/levels").map([](web::WebResponse* res) { | ||
if (res->ok()) initializeDemons(res, false); | ||
else Notification::create("Failed to load AREDL", NotificationIcon::Error)->show(); | ||
|
||
task = std::nullopt; | ||
return *res; | ||
}); | ||
} | ||
|
||
void IntegratedDemonlist::loadAREDL(EventListener<web::WebTask>&& listenerRef, utils::MiniFunction<void()> callback) { | ||
auto&& listener = std::move(listenerRef); | ||
listener.bind([callback](web::WebTask::Event* e) { | ||
if (auto res = e->getValue()) { | ||
if (res->ok()) { | ||
initializeDemons(res, false); | ||
callback(); | ||
} | ||
else FLAlertLayer::create("Load Failed", "Failed to load AREDL. Please try again later.", "OK")->show(); | ||
} | ||
}); | ||
|
||
listener.setFilter(web::WebRequest().get("https://api.aredl.net/api/aredl/levels")); | ||
} | ||
|
||
void IntegratedDemonlist::loadPemonlist() { | ||
static std::optional<web::WebTask> task = std::nullopt; | ||
task = web::WebRequest().get("https://pemonlist.com/api/list").map([](web::WebResponse* res) { | ||
if (res->ok()) initializeDemons(res, true); | ||
else Notification::create("Failed to load Pemonlist", NotificationIcon::Error)->show(); | ||
|
||
task = std::nullopt; | ||
return *res; | ||
}); | ||
} | ||
|
||
void IntegratedDemonlist::loadPemonlist(EventListener<web::WebTask>&& listenerRef, utils::MiniFunction<void()> callback) { | ||
auto&& listener = std::move(listenerRef); | ||
listener.bind([callback](web::WebTask::Event* e) { | ||
if (auto res = e->getValue()) { | ||
if (res->ok()) { | ||
initializeDemons(res, true); | ||
callback(); | ||
} | ||
else FLAlertLayer::create("Load Failed", "Failed to load Pemonlist. Please try again later.", "OK")->show(); | ||
} | ||
}); | ||
|
||
listener.setFilter(web::WebRequest().get("https://pemonlist.com/api/list")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <Geode/Geode.hpp> | ||
#include <Geode/utils/web.hpp> | ||
|
||
using namespace geode::prelude; | ||
|
||
struct IDListDemon { | ||
int id; | ||
std::string name; | ||
int position; | ||
}; | ||
|
||
class IntegratedDemonlist { | ||
public: | ||
inline static std::vector<IDListDemon> AREDL = {}; | ||
inline static std::vector<IDListDemon> PEMONLIST = {}; | ||
inline static bool TRIED_LOADING = false; | ||
|
||
static void initializeDemons(web::WebResponse*, bool); | ||
static void loadAREDL(); | ||
static void loadAREDL(EventListener<web::WebTask>&&, MiniFunction<void()> callback); | ||
static void loadPemonlist(); | ||
static void loadPemonlist(EventListener<web::WebTask>&&, MiniFunction<void()> callback); | ||
}; |
Oops, something went wrong.