diff --git a/src/unlocker/spoofing.cpp b/src/unlocker/spoofing.cpp index f9eb0fd..619a285 100644 --- a/src/unlocker/spoofing.cpp +++ b/src/unlocker/spoofing.cpp @@ -437,6 +437,60 @@ void Spoofer::onInventoryAll(std::string& body) Log::verbose("Inventory spoofed"); } +void Spoofer::onMessageList(std::string& body) +{ + json doc = json::parse(body, nullptr, false); + if (doc.is_discarded()) return Log::error("JSON parse error for dbd-messages/listV2"); + + auto now = std::chrono::system_clock::now(); + auto now_seconds = std::chrono::duration_cast(now.time_since_epoch()).count(); + auto now_milliseconds = std::chrono::duration_cast(now.time_since_epoch()).count(); + + json msg; + + /* + msg base + */ + msg["allowedPlatforms"] = json::array({"egs", "grdk", "ps4", "ps5", "steam", "xbox", "xsx"}); + msg["flag"] = "READ"; + msg["gameSpecificData"] = {}; + msg["read"] = false; + msg["tag"] = json::array({"inbox"}); + msg["expireAt"] = now_seconds + (1337 * 24 * 60 * 60); + msg["received"] = now_milliseconds; + msg["recipientId"] = "system"; + + /* + msg content + */ + json bodyContent; + bodyContent["sections"] = json::array(); + bodyContent["sections"].push_back( + {{"type", "text"}, + {"text", "Japan is turning footsteps into electricity!

Using piezoelectric tiles, every step " + "you take generates a small amount of energy. Millions of steps together can power LED " + "lights and displays in busy places like Shibuya Station.

A brilliant way to create a " + "sustainable and smart city — turning movement into clean, renewable energy."}}); + + bodyContent["image"] = { + {"packagedPath", "/Game/UI/UMGAssets/Icons/ItemAddons/iconAddon_powerBulb.iconAddon_powerBulb"}, + {"contentVersion", "ccc3f02b0a671fe19a0017d6a69293876a465fd9"}, + {"uri", ""}}; + + bodyContent["sections"].push_back( + {{"type", "itemshowcase"}, + {"rewards", json::array({{{"type", "inventory"}, {"id", "ADDON_flashlight_oddbulb"}, {"amount", 1}}})}}); + + msg["message"] = {}; + msg["message"]["title"] = "Japan is turning footsteps into electricity"; + msg["message"]["body"] = bodyContent.dump(); + + doc["messages"].push_back(msg); + + body = doc.dump(); + Log::verbose("Spoofed message list"); +} + void Spoofer::onBloodweb(std::string& body, std::string& respHeaders) { json doc = json::parse(body, nullptr, false); @@ -491,6 +545,7 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s if (url.find("api/v1/dbd-character-data/get-all") != std::string::npos) return onGetAll(body); if (url.find("api/v1/dbd-inventories/all") != std::string::npos) return onInventoryAll(body); + if (url.find("/api/v1/messages/listV2") != std::string::npos) return onMessageList(body); if (url.find("api/v1/dbd-character-data/bloodweb") != std::string::npos || url.find("api/v1/dbd-character-data/bulk-spending-bloodweb") != std::string::npos) return onBloodweb(body, respHeaders);