Code:
//BLOODWEB AND GETALL, IT NEEDS Bloodweb_v6 and MarketUpdaterPath as global variables (at top of code)
if(Bloodweb_v6 && (oSession.uriContains("api/v1/dbd-character-data/bloodweb") || oSession.uriContains("api/v1/dbd-character-data/get-all"))){
try{
if (MarketUpdaterPath[-1] != "\\") MarketUpdaterPath += "\\";
var getallPath = MarketUpdaterPath + "Files\\GetAll.json";
if (!System.IO.File.Exists(getallPath)) return;
var customDataPath = MarketUpdaterPath + "Other\\CustomCharacterData.json";
var customStatus = CustomPrestige && System.IO.File.Exists(customDataPath);
var getallString = System.IO.File.ReadAllText(getallPath);
var getallJson = Fiddler.WebFormats.JSON.JsonDecode(getallString);
var bloodWebData = new System.Collections.Hashtable();
var paths = new System.Collections.ArrayList();
var ringData = new System.Collections.ArrayList();
var nodeItem = new System.Collections.Hashtable();
nodeItem.Add("nodeId", "0");
nodeItem.Add("state", "Collected");
var nodeData = new System.Collections.Hashtable();
var nodeDataList = new System.Collections.ArrayList();
nodeDataList.Add(nodeItem);
nodeData.Add("nodeData", nodeDataList);
ringData.Add(nodeData);
bloodWebData.Add("paths", paths);
bloodWebData.Add("ringData", ringData);
if (customStatus) {
var customDataString = System.IO.File.ReadAllText(customDataPath);
var customDataJson = Fiddler.WebFormats.JSON.JsonDecode(customDataString);
}
if (oSession.uriContains("api/v1/dbd-character-data/get-all")){
if (customStatus){
for(var i=0;i<getallJson.JSONObject["list"].Count;i++){
getallJson.JSONObject["list"][i]["bloodWebData"].Clear();
getallJson.JSONObject["list"][i]["bloodWebData"] = bloodWebData;
var j = 0;
while(j<customDataJson.JSONObject["list"].Count && customDataJson.JSONObject["list"][j]["characterName"].ToLower() != getallJson.JSONObject["list"][i]["characterName"].ToLower()) j++;
if (customDataJson.JSONObject["list"][j]["characterName"].ToLower() == getallJson.JSONObject["list"][i]["characterName"].ToLower()) getallJson.JSONObject["list"][i]["prestigeLevel"] = customDataJson.JSONObject["list"][j]["prestigeLevel"];
}
getallString = Fiddler.WebFormats.JSON.JsonEncode(getallJson.JSONObject);
}
oSession.utilSetResponseBody(getallString);
return;
}
oSession.utilDecodeRequest();
oSession.utilDecodeResponse();
var jsonRequest = oSession.GetRequestBodyAsString();
var oJsonRequest = Fiddler.WebFormats.JSON.JsonDecode(jsonRequest);
var jsonResponse = oSession.GetResponseBodyAsString();
var oJsonResponse = Fiddler.WebFormats.JSON.JsonDecode(jsonResponse);
var characterSelected = oJsonRequest.JSONObject["characterName"];
for(var i=0;i<getallJson.JSONObject["list"].Count;i++){
if(getallJson.JSONObject["list"][i]["characterName"].ToLower() == characterSelected.ToLower()){
oJsonResponse.JSONObject["bloodWebLevel"] = 50;
oJsonResponse.JSONObject["prestigeLevel"] = getallJson.JSONObject["list"][i]["prestigeLevel"];
if (customStatus){
var j = 0;
while(j<customDataJson.JSONObject["list"].Count && customDataJson.JSONObject["list"][j]["characterName"].ToLower() != characterSelected.ToLower()) j++;
if (customDataJson.JSONObject["list"][j]["characterName"].ToLower() == characterSelected.ToLower()) oJsonResponse.JSONObject["prestigeLevel"] = customDataJson.JSONObject["list"][j]["prestigeLevel"];
}
oJsonResponse.JSONObject["characterItems"].AddRange(getallJson.JSONObject["list"][i]["characterItems"]);
break;
}
}
oJsonResponse.JSONObject["bloodWebData"].Clear();
oJsonResponse.JSONObject["bloodWebData"] = bloodWebData;
var oString = Fiddler.WebFormats.JSON.JsonEncode(oJsonResponse.JSONObject);
oSession.utilSetResponseBody(oString);
}
catch(e){
FiddlerObject.log(e);
}
}
//MARKET, IT NEEDS Market_v3 as global variable (at top of code)
if (Market_v3 && oSession.uriContains("api/v1/inventories")) {
try{
if (MarketUpdaterPath[-1] != "\\") MarketUpdaterPath += "\\";
var marketPath = MarketUpdaterPath + "Files\\MarketNoSavefile.json";
if (!System.IO.File.Exists(marketPath)) return;
var marketString = System.IO.File.ReadAllText(marketPath);
var marketJson = Fiddler.WebFormats.JSON.JsonDecode(marketString);
oSession.utilDecodeResponse();
var jsonString = oSession.GetResponseBodyAsString();
var oJson = Fiddler.WebFormats.JSON.JsonDecode(jsonString);
for(var i = 0; i < marketJson.JSONObject["data"]["inventory"].Count ; i++){
oJson.JSONObject["data"]["inventory"].Add(marketJson.JSONObject["data"]["inventory"][i]);
}
var oString = Fiddler.WebFormats.JSON.JsonEncode(oJson.JSONObject);
oSession.utilSetResponseBody(oString);
}
catch(e){
FiddlerObject.log(e);
}
}
//QUEST, IT NEEDS Quest as global variable (at top of code)
if (Quest && oSession.uriContains("api/v1/archives/stories/update/active-node-v3")){
try{
//DECODING AND CONVERTING REQUEST AND RESPONSE
oSession.utilDecodeRequest();
oSession.utilDecodeResponse();
var jsonRequest = oSession.GetRequestBodyAsString();
var oJsonRequest = Fiddler.WebFormats.JSON.JsonDecode(jsonRequest);
var jsonResponse = oSession.GetResponseBodyAsString();
var oJsonResponse = Fiddler.WebFormats.JSON.JsonDecode(jsonResponse);
//GETTING VARIABLES FROM SELECTED CHALLENGE
if(oJsonResponse.JSONObject["activeNodesFull"].Count == 0) return;
var role = oJsonRequest.JSONObject["role"];
if(role == "both") role = "survivor";
var neededProgression = oJsonResponse.JSONObject["activeNodesFull"][0]["objectives"][0]["neededProgression"];
var questEvents = oJsonResponse.JSONObject["activeNodesFull"][0]["objectives"][0]["questEvent"];
var matchId = System.Guid.NewGuid().ToString();
var requestBody = '{"matchId":"'+matchId+'","questEvents":[';
for(var i=0;i<questEvents.Count;i++){
var repetition = questEvents[i]["repetition"];
repetition *= neededProgression;
var questEventId = questEvents[i]["questEventId"];
var parameters = questEvents[i]["parameters"];
if(parameters != undefined) requestBody += '{"parameters":"'+parameters+'","questEventId":"'+questEventId+'","repetition":'+repetition+'}';
else requestBody += '{"questEventId":"'+questEventId+'","repetition":'+repetition+'}';
if(questEvents.Count > 1 && i != questEvents.Count - 1) requestBody += ",";
}
requestBody += '],"role":"'+role+'"}';
//GENERATING REQUEST WITH VARIABLES TO COMPLETE THE CHALLENGE
var request = new System.Net.WebClient();
var currentUrl = new System.Uri(oSession.fullUrl);
var baseUrl = currentUrl.GetLeftPart(System.UriPartial.Authority);
var url = baseUrl+"/api/v1/archives/stories/update/quest-progress-v2";
request.Headers.Set("X-HTTP-Method-Override", "POST");
request.Headers.Add("Host", "brill.live.bhvrdbd.com");
request.Headers.Add("Accept", "*/*");
request.Headers.Add("Content-Type", "application/json");
request.Headers.Add("Cookie", oSession.oRequest["Cookie"]);
var responseBody = request.UploadString(url, "POST", requestBody);
}
catch(e){FiddlerObject.log("Error unlocking challenge");}
}