I know, don't worry! Your method is great too!
Unluckily I think that it's not possible to do the same thing in FiddlerScript because there is no async delay, so if you start a loop and do requests..
However I code a method that does everytime you press the hotkey CTRL + SHIFT + L a number of level of your choice, of course every level takes time, so you have to wait until finish, I'm using 5 levels at time right now, but however I don't like very much this solution..
If you know how to do async function (I need async Sleep in FiddlerScript let me know please).
This is the code that I wrote:
On top of code
Code:
FiddlerObject.UI.RegisterCustomHotkey(HotkeyModifiers.Control | HotkeyModifiers.Shift, 0x4C, "levelup");
Into class handlers:
Code:
static var CurrentCharacter = null;
static var FreeLevelUp = true;
static var CurrentLevel = 0;
static var MaxLevelCount = 5;
static function CharLevelUp() {
try{
FiddlerObject.log("Function CharLevelUp started!");
for(var levelCount=0;levelCount<MaxLevelCount;levelCount++){
if (!FreeLevelUp || CurrentCharacter == null || CurrentCharacter == "null") return;
var headersPath = MarketUpdaterPath + "Headers.json";
if (!System.IO.File.Exists(headersPath)) return;
var headerString = System.IO.File.ReadAllText(headersPath);
var headerJson = Fiddler.WebFormats.JSON.JsonDecode(headerString).JSONObject;
var requestBody = "";
if(CurrentLevel == 51){ requestBody = '{"characterName":"' + CurrentCharacter + '", "selectedNodeIds":["0"], "entityBlockedNodeIds":[]}'; }
else { requestBody = '{"characterName":"' + CurrentCharacter + '", "selectedNodeIds":[], "entityBlockedNodeIds":["0"]}'; }
var request = new System.Net.WebClient();
var baseUrl = "";
for(var i=0;i<headerJson.Count;i++){
request.Headers.Add(headerJson[i]["name"], headerJson[i]["value"]);
if (headerJson[i]["name"] == "Host") baseUrl = "https://" + headerJson[i]["value"];
}
var url = baseUrl+"/api/v1/dbd-character-data/bloodweb";
request.UploadString(url, "POST", requestBody);
}
FiddlerObject.log("Function CharLevelUp ended successfully!");
}
catch(e){
FiddlerObject.log(e);
}
}
Into OnBeforeResponse:
Code:
if(FreeLevelUp && oSession.uriContains("api/v1/dbd-character-data/bloodweb")){
try{
oSession.utilDecodeRequest();
oSession.utilDecodeResponse();
var oJsonRequest = Fiddler.WebFormats.JSON.JsonDecode(oSession.GetRequestBodyAsString()).JSONObject;
var oJsonResponse = Fiddler.WebFormats.JSON.JsonDecode(oSession.GetResponseBodyAsString()).JSONObject;
CurrentCharacter = oJsonRequest["characterName"];
CurrentLevel = oJsonResponse["bloodWebLevel"];
FiddlerObject.log("Selected character: " + CurrentCharacter + ", Character level: " + CurrentLevel);
}
catch(e){
FiddlerObject.log(e);
}
}
Into switch(sAction) inside OnExecAction:
Code:
case "levelup":
CharLevelUp();
return true;
How it works:
Select a char open and close Bloodweb (to do a real Bloodweb request), then press CTRL + SHIFT + L to trigger the function.
You can change
static var MaxLevelCount = 5; value here to do more level with one time press (don't use too high numbers or it will crash)
- - - Updated - - -
Ah of course it requires function to create Headers.json (The same that is used for Challenge Completer)
Inside OnBeforeResponse or OnBeforeRequest (it's the same in this case)
Code:
if (oSession.uriContains("api/v1/auth/v2/publicKey")){
try{
oSession.utilDecodeRequest();
var headers = oSession.oRequest.headers;
var headerArray = new System.Collections.ArrayList();
var enumerator = headers.GetEnumerator();
while (enumerator.MoveNext()) {
var header = enumerator.Current;
if (header.Name == "Content-Length") continue;
var headerObject = new System.Collections.Hashtable();
headerObject.Add("name", header.Name);
headerObject.Add("value", header.Value);
headerArray.Add(headerObject);
}
System.IO.File.WriteAllText(MarketUpdaterPath+"Headers.json", Fiddler.WebFormats.JSON.JsonEncode(headerArray));
}
catch(e){
FiddlerObject.log(e);
}
}