Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f0ae22d87 | |||
| ef0d19e659 |
+26
-19
@@ -283,6 +283,29 @@ int Spoofer::getRandomQuantity()
|
||||
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)
|
||||
{
|
||||
if (!js.is_object()) js = json::object();
|
||||
@@ -654,23 +677,7 @@ void Spoofer::onBloodweb(std::string& body, std::string& respHeaders)
|
||||
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 (_config.spoofInventory)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_config.spoofInventory) fixBloodweb(doc);
|
||||
|
||||
/*
|
||||
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/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"))
|
||||
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/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"))
|
||||
return onBloodwebClient(body);
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ class Spoofer
|
||||
std::string getRandomItem();
|
||||
int getRandomQuantity();
|
||||
|
||||
void fixBloodweb(nlohmann::json& data);
|
||||
void generateBloodweb(nlohmann::json& data);
|
||||
|
||||
void modifyCharacterData(nlohmann::json& js);
|
||||
|
||||
void onGetAll(std::string& body);
|
||||
|
||||
Reference in New Issue
Block a user