Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <unidokkan/log.h>
- #include <unidokkan/hook.h>
- #include <dokkan/crypto.h>
- #include <nlohmann/json.hpp>
- /*{
- "events": [ //Events specified but should fetch all base on id L:10
- {
- "banner_image": "https://www.baoulettes.fr/DokkanEvent/image/quest_list_banner_"+ID+".png",
- "event_image": "https://www.baoulettes.fr/DokkanEvent/image/quest_top_banner_"+ID+".png",
- "minibanner_image": "https://www.baoulettes.fr/DokkanEvent/image/quest_event_banner_"+ID+".png",
- "id": *, //Can be anything from 101 to 549 (testing purpose)
- "quests": [ //Should fetch all possible "name" in this "quests" and set name depending on their id (the best would be to fetch database.db !)
- {
- "name": "Event_Name", // Event name usually their id are "id" L:10 and 0xx (xx = 01 to 99 depending the number of stage available)
- }
- ]
- },
- ]
- }
- MEMO / TODO
- EventName = 'SELECT name FROM "areas" WHERE id=\'id L:10\'';
- i = 1;
- foreach (jsonBody["events"][0]["quests"]) { //The event with the proper id L:10
- if (i <=9) {addons="00";}
- if (i <=99) {addons="0";}
- if (i >=100) {addons="";}
- current_id = id L:10+addons+i;
- StageName = 'SELECT name FROM "quests" WHERE id=\'id L:10 + '00' + i\'';
- jsonBody["events"][0][5]["quests"][i]["names"] = StageName;
- i++;
- }
- //if (request->jsonBody["events"][0]["id"].get<int>() >= 0) {}
- */
- bool ShowEventsBanners(NetworkResponse *response) {
- using json = nlohmann::json;
- UD_LOGI("Test craps : In functions");
- auto json_body = UniDokkan::Dokkan::Crypto::DecryptSign(response->jsonBody["sign"]);
- response->jsonBody["events"][0]["id"][132] = json::array({
- {
- "banner_image", "https://www.baoulettes.fr/DokkanEvent/image/quest_list_banner_132.png",
- "event_image", "https://www.baoulettes.fr/DokkanEvent/image/quest_top_banner_132_category.png",
- "minibanner_image", "https://www.baoulettes.fr/DokkanEvent/image/quest_event_banner_132.png",
- }
- });
- response->jsonBody["sign"] = UniDokkan::Dokkan::Crypto::EncryptSign(json_body);
- return true;
- }
- extern "C" {
- int unidokkan_init_v2(HookLib* hook_lib) {
- hook_lib->addResponseHook("^/banners$", ShowEventsBanners);
- if (!hook_lib) {
- UD_LOGI("Test craps : Crashed");
- return 1;
- }
- UD_LOGI("Test craps : Loaded");
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment