Compare commits

...

2 Commits

Author SHA1 Message Date
neru 4f0ae22d87 fix: add new bloodweb url
Build / build (push) Successful in 3m43s
2026-04-29 11:55:05 -03:00
neru ef0d19e659 style: move bloodweb fix to its own fn 2026-04-29 11:54:53 -03:00
2 changed files with 28 additions and 19 deletions
+26 -19
View File
@@ -283,6 +283,29 @@ int Spoofer::getRandomQuantity()
return dist(gen); return dist(gen);
} }
void Spoofer::fixBloodweb(nlohmann::json& js)
{
if (!js.contains("bloodWebData") || !js["bloodWebData"].is_object()) return;
auto& bloodWebData = js["bloodWebData"];
if (!bloodWebData.contains("paths") || !bloodWebData.contains("ringData")) return;
for (auto& ring : js["bloodWebData"]["ringData"])
{
if (!ring.contains("nodeData")) continue;
for (auto& node : ring["nodeData"])
{
if (!node.contains("contentId")) continue;
std::string contentId = node["contentId"];
if (_camperPerkIds.contains(contentId) || _slasherPerkIds.contains(contentId))
node["contentId"] = PLACEHOLDER_ITEMID;
}
}
Log::verbose("Fixed bloodweb request");
}
void Spoofer::generateBloodweb(nlohmann::json& js) void Spoofer::generateBloodweb(nlohmann::json& js)
{ {
if (!js.is_object()) js = json::object(); if (!js.is_object()) js = json::object();
@@ -654,23 +677,7 @@ void Spoofer::onBloodweb(std::string& body, std::string& respHeaders)
bloodweb fixup for perks bloodweb fixup for perks
(if all perks are unlocked, the game will interpret bloodwebs with perks as invalid so perks will be replaced with PLACEHOLDER_ITEMID) (if all perks are unlocked, the game will interpret bloodwebs with perks as invalid so perks will be replaced with PLACEHOLDER_ITEMID)
*/ */
if (_config.spoofInventory) if (_config.spoofInventory) fixBloodweb(doc);
{
if (doc.contains("bloodWebData") && doc["bloodWebData"].contains("ringData"))
{
for (auto& ring : doc["bloodWebData"]["ringData"])
{
if (!ring.contains("nodeData")) continue;
for (auto& node : ring["nodeData"])
{
if (!node.contains("contentId")) continue;
std::string contentId = node["contentId"];
if (_camperPerkIds.contains(contentId) || _slasherPerkIds.contains(contentId))
node["contentId"] = PLACEHOLDER_ITEMID;
}
}
}
}
/* /*
prevent bloodweb reqs from overriding inventory values prevent bloodweb reqs from overriding inventory values
@@ -760,7 +767,7 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
if (url.ends_with("api/v1/dbd-character-data/get-all")) return onGetAll(body); if (url.ends_with("api/v1/dbd-character-data/get-all")) return onGetAll(body);
if (url.ends_with("api/v1/dbd-character-data/bloodweb") || if (url.ends_with("api/v1/dbd-character-data/bloodweb") || url.ends_with("api/v1/dbd-character-data/bloodweb/v2") ||
url.ends_with("api/v1/dbd-character-data/bulk-spending-bloodweb")) url.ends_with("api/v1/dbd-character-data/bulk-spending-bloodweb"))
return onBloodweb(body, respHeaders); return onBloodweb(body, respHeaders);
@@ -774,7 +781,7 @@ void Spoofer::clientRequestHandler(const std::string& url, std::string& body, st
if (url.ends_with("api/v1/dbd-character-data/get-all")) return onGetAllClient(body); if (url.ends_with("api/v1/dbd-character-data/get-all")) return onGetAllClient(body);
if (url.ends_with("api/v1/dbd-character-data/bloodweb") || if (url.ends_with("api/v1/dbd-character-data/bloodweb") || url.ends_with("api/v1/dbd-character-data/bloodweb/v2") ||
url.ends_with("api/v1/dbd-character-data/bulk-spending-bloodweb")) url.ends_with("api/v1/dbd-character-data/bulk-spending-bloodweb"))
return onBloodwebClient(body); return onBloodwebClient(body);
+2
View File
@@ -37,7 +37,9 @@ class Spoofer
std::string getRandomItem(); std::string getRandomItem();
int getRandomQuantity(); int getRandomQuantity();
void fixBloodweb(nlohmann::json& data);
void generateBloodweb(nlohmann::json& data); void generateBloodweb(nlohmann::json& data);
void modifyCharacterData(nlohmann::json& js); void modifyCharacterData(nlohmann::json& js);
void onGetAll(std::string& body); void onGetAll(std::string& body);