Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bf8407640 | |||
| a8b5e0148f | |||
| 50413eb420 | |||
| ea49c39e53 | |||
| f599a9a648 |
+44
-15
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#define PLACEHOLDER_ITEMID "Anniversary2025Offering"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
static std::random_device rd;
|
||||
@@ -101,11 +103,10 @@ void Spoofer::loadConfig()
|
||||
try
|
||||
{
|
||||
json configJson = json::parse(configFile);
|
||||
_config.spoofCharacterOwnership = configJson.value("spoofCharacterOwnership", false);
|
||||
_config.spoofInventory = configJson.value("spoofInventory", true);
|
||||
_config.spoofCustomization = configJson.value("spoofCustomization", true);
|
||||
Log::info("Loaded config: Ownership={}, Inventory={}, Customization={}", _config.spoofCharacterOwnership,
|
||||
_config.spoofInventory, _config.spoofCustomization);
|
||||
_config.spoofCharacterOwnership =
|
||||
configJson.value("spoofCharacterOwnership", _config.spoofCharacterOwnership);
|
||||
_config.spoofInventory = configJson.value("spoofInventory", _config.spoofInventory);
|
||||
_config.spoofCustomization = configJson.value("spoofCustomization", _config.spoofCustomization);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -115,11 +116,15 @@ void Spoofer::loadConfig()
|
||||
else
|
||||
{
|
||||
Log::info("config.json not found, using default settings");
|
||||
json defaultConfig = {
|
||||
{"spoofCharacterOwnership", true}, {"spoofInventory", true}, {"spoofCustomization", true}};
|
||||
json defaultConfig = {{"spoofCharacterOwnership", _config.spoofCharacterOwnership},
|
||||
{"spoofInventory", _config.spoofInventory},
|
||||
{"spoofCustomization", _config.spoofCustomization}};
|
||||
std::ofstream out(configPath);
|
||||
out << defaultConfig.dump(4);
|
||||
}
|
||||
|
||||
Log::info("Loaded config: Ownership={}, Inventory={}, Customization={}", _config.spoofCharacterOwnership,
|
||||
_config.spoofInventory, _config.spoofCustomization);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -202,7 +207,7 @@ std::string Spoofer::getRandomItem()
|
||||
for (auto* s : allSets)
|
||||
if (!s->empty()) validSets.push_back(s);
|
||||
|
||||
if (validSets.empty()) return "Spring2024Offering";
|
||||
if (validSets.empty()) return PLACEHOLDER_ITEMID;
|
||||
|
||||
std::uniform_int_distribution<> setDist(0, static_cast<int>(validSets.size()) - 1);
|
||||
const auto& selectedSet = *validSets[setDist(gen)];
|
||||
@@ -304,10 +309,6 @@ void Spoofer::modifyCharacterData(json& js)
|
||||
if (js.contains("bloodWebData")) generateBloodweb(js["bloodWebData"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (js.value("isEntitled", false) == false) return;
|
||||
}
|
||||
|
||||
/*
|
||||
item spoofing
|
||||
@@ -329,9 +330,9 @@ void Spoofer::modifyCharacterData(json& js)
|
||||
|
||||
for (auto& item : js["characterItems"])
|
||||
{
|
||||
/*
|
||||
set existing items to rnd number
|
||||
*/
|
||||
/*
|
||||
set existing items to rnd number
|
||||
*/
|
||||
if (item.contains("itemId") && item["itemId"].is_string())
|
||||
{
|
||||
std::string itemId = item["itemId"];
|
||||
@@ -541,6 +542,9 @@ void Spoofer::onBloodweb(std::string& body, std::string& respHeaders)
|
||||
json doc = json::parse(body, nullptr, false);
|
||||
if (doc.is_discarded()) return Log::error("JSON parse error for bloodweb response");
|
||||
|
||||
/*
|
||||
return fake bloodweb data
|
||||
*/
|
||||
if (_config.spoofCharacterOwnership)
|
||||
{
|
||||
if (body.find("NotAllowedException") != std::string::npos && body.find("not owned") != std::string::npos)
|
||||
@@ -576,6 +580,31 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
prevent bloodweb reqs from overriding inventory values
|
||||
*/
|
||||
modifyCharacterData(doc);
|
||||
body = doc.dump();
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
struct SpooferConfig
|
||||
{
|
||||
bool spoofCharacterOwnership = false;
|
||||
bool spoofInventory = false;
|
||||
bool spoofCustomization = false;
|
||||
bool spoofInventory = true;
|
||||
bool spoofCustomization = true;
|
||||
};
|
||||
|
||||
class Spoofer
|
||||
|
||||
Reference in New Issue
Block a user