Baoulettes

dokkan non working craps

Mar 1st, 2020
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.28 KB | None | 0 0
  1. #include <unidokkan/log.h>
  2. #include <unidokkan/hook.h>
  3. #include <dokkan/crypto.h>
  4. #include <nlohmann/json.hpp>
  5.  
  6. /*{
  7.     "events": [ //Events specified but should fetch all base on id L:10
  8.         {
  9.             "banner_image": "https://www.baoulettes.fr/DokkanEvent/image/quest_list_banner_"+ID+".png",
  10.             "event_image": "https://www.baoulettes.fr/DokkanEvent/image/quest_top_banner_"+ID+".png",
  11.             "minibanner_image": "https://www.baoulettes.fr/DokkanEvent/image/quest_event_banner_"+ID+".png",
  12.             "id": *, //Can be anything from 101 to 549 (testing purpose)
  13.             "quests": [ //Should fetch all possible "name" in this "quests" and set name depending on their id (the best would be to fetch database.db !)
  14.                 {
  15.                     "name": "Event_Name", // Event name usually their id are "id" L:10 and 0xx (xx = 01 to 99 depending the number of stage available)
  16.  
  17.                 }
  18.             ]
  19.         },
  20.     ]
  21. }
  22. MEMO / TODO
  23. EventName = 'SELECT name FROM "areas" WHERE id=\'id L:10\'';
  24. i = 1;
  25. foreach (jsonBody["events"][0]["quests"]) { //The event with the proper id L:10
  26.     if (i <=9) {addons="00";}
  27.     if (i <=99) {addons="0";}
  28.     if (i >=100) {addons="";}
  29.     current_id = id L:10+addons+i;
  30.     StageName = 'SELECT name FROM "quests" WHERE id=\'id L:10 + '00' + i\'';
  31.     jsonBody["events"][0][5]["quests"][i]["names"] = StageName;
  32.     i++;
  33. }
  34. //if (request->jsonBody["events"][0]["id"].get<int>() >= 0) {}
  35. */
  36. bool ShowEventsBanners(NetworkResponse *response) {
  37.     using json = nlohmann::json;
  38.     UD_LOGI("Test craps : In functions");
  39.     auto json_body      =   UniDokkan::Dokkan::Crypto::DecryptSign(response->jsonBody["sign"]);
  40.     response->jsonBody["events"][0]["id"][132] = json::array({
  41.         {
  42.             "banner_image", "https://www.baoulettes.fr/DokkanEvent/image/quest_list_banner_132.png",
  43.             "event_image", "https://www.baoulettes.fr/DokkanEvent/image/quest_top_banner_132_category.png",
  44.             "minibanner_image", "https://www.baoulettes.fr/DokkanEvent/image/quest_event_banner_132.png",
  45.         }
  46.     });
  47.     response->jsonBody["sign"] = UniDokkan::Dokkan::Crypto::EncryptSign(json_body);
  48.     return true;
  49. }
  50. extern "C" {
  51.     int unidokkan_init_v2(HookLib* hook_lib) {
  52.         hook_lib->addResponseHook("^/banners$", ShowEventsBanners);
  53.         if (!hook_lib) {
  54.             UD_LOGI("Test craps : Crashed");
  55.             return 1;
  56.         }
  57.         UD_LOGI("Test craps : Loaded");
  58.         return 0;
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment