|
@@ -40,10 +40,17 @@ module.exports = {
|
|
|
this.temp[wizardID] = {};
|
|
this.temp[wizardID] = {};
|
|
|
}
|
|
}
|
|
|
if (command === 'BattleScenarioStart') {
|
|
if (command === 'BattleScenarioStart') {
|
|
|
- proxy.log({ type: 'info', source: 'plugin', name: this.pluginName, message: `IVV RUN START: ${resp}` })
|
|
|
|
|
//for (var key in req) {
|
|
//for (var key in req) {
|
|
|
- // proxy.log({ type: 'info', source: 'plugin', name: this.pluginName, message: `IVV REQ: ${key}: ${req[key]}` })
|
|
|
|
|
|
|
+ // this.log('DEBUG', `IVV SCE START: ${key}: ${req[key]}`);
|
|
|
//}
|
|
//}
|
|
|
|
|
+ if (req["helper_list"] != null || req["mentor_helper_list"] != null || req["npc_friend_helper_list"] != null ){
|
|
|
|
|
+ //this.log('DEBUG', `IVV MENTOR 1`);
|
|
|
|
|
+ this.temp[wizardID].helper = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ //this.log('DEBUG', `IVV MENTOR 0`);
|
|
|
|
|
+ this.temp[wizardID].helper = 0;
|
|
|
|
|
+ }
|
|
|
this.temp[wizardID].area = req.region_id;
|
|
this.temp[wizardID].area = req.region_id;
|
|
|
this.temp[wizardID].stage = req.stage_no;
|
|
this.temp[wizardID].stage = req.stage_no;
|
|
|
this.temp[wizardID].difficulty = req.difficulty;
|
|
this.temp[wizardID].difficulty = req.difficulty;
|
|
@@ -199,6 +206,9 @@ module.exports = {
|
|
|
log = true;
|
|
log = true;
|
|
|
|
|
|
|
|
if (command === 'BattleDungeonResult') {
|
|
if (command === 'BattleDungeonResult') {
|
|
|
|
|
+ for (var key in req) {
|
|
|
|
|
+ this.log("DEBUG", `IVV DUNGEON REQ: ${key}: ${req[key]}`);
|
|
|
|
|
+ }
|
|
|
if (req.dungeon_id > 10000){
|
|
if (req.dungeon_id > 10000){
|
|
|
// Hall of Heroes or unknown
|
|
// Hall of Heroes or unknown
|
|
|
log = false;
|
|
log = false;
|
|
@@ -206,12 +216,18 @@ module.exports = {
|
|
|
run.area = req.dungeon_id;
|
|
run.area = req.dungeon_id;
|
|
|
run.stage = req.stage_id;
|
|
run.stage = req.stage_id;
|
|
|
run.difficulty = 0
|
|
run.difficulty = 0
|
|
|
|
|
+ // TODO: Read request
|
|
|
|
|
+ run.helper = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (command === 'BattleScenarioResult') {
|
|
if (command === 'BattleScenarioResult') {
|
|
|
- for (var key in this.temp[wizardID]) {
|
|
|
|
|
- this.log("DEBUG", `IVV TEMP: ${key}: ${this.temp[wizardID][key]}`);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //for (var key in this.temp[wizardID]) {
|
|
|
|
|
+ // this.log("DEBUG", `IVV TEMP: ${key}: ${this.temp[wizardID][key]}`);
|
|
|
|
|
+ //}
|
|
|
|
|
+ //for (var key in req) {
|
|
|
|
|
+ // this.log("DEBUG", `IVV REQ: ${key}: ${req[key]}`);
|
|
|
|
|
+ //}
|
|
|
|
|
+ run.helper = this.temp[wizardID].helper;
|
|
|
run.area = this.temp[wizardID].area;
|
|
run.area = this.temp[wizardID].area;
|
|
|
run.stage = this.temp[wizardID].stage;
|
|
run.stage = this.temp[wizardID].stage;
|
|
|
run.difficulty = this.temp[wizardID].difficulty;
|
|
run.difficulty = this.temp[wizardID].difficulty;
|
|
@@ -224,6 +240,7 @@ module.exports = {
|
|
|
run.area = req.dungeon_id;
|
|
run.area = req.dungeon_id;
|
|
|
run.stage = req.stage_id;
|
|
run.stage = req.stage_id;
|
|
|
run.difficulty = 0
|
|
run.difficulty = 0
|
|
|
|
|
+ run.helper = 0;
|
|
|
}
|
|
}
|
|
|
run.uid = wizardID;
|
|
run.uid = wizardID;
|
|
|
run.win = resp.win_lose; // 1/0 2 is lost in scenario
|
|
run.win = resp.win_lose; // 1/0 2 is lost in scenario
|
|
@@ -238,7 +255,7 @@ module.exports = {
|
|
|
run.crystal = reward.crystal ? reward.crystal : 0;
|
|
run.crystal = reward.crystal ? reward.crystal : 0;
|
|
|
|
|
|
|
|
// TODO: GET
|
|
// TODO: GET
|
|
|
- run.helper = 0;
|
|
|
|
|
|
|
+ //run.helper = 0;
|
|
|
|
|
|
|
|
run.rune = {};
|
|
run.rune = {};
|
|
|
run.unit = 0;
|
|
run.unit = 0;
|
|
@@ -254,9 +271,9 @@ module.exports = {
|
|
|
|
|
|
|
|
if (reward.crate.rune) {
|
|
if (reward.crate.rune) {
|
|
|
const rune = reward.crate.rune;
|
|
const rune = reward.crate.rune;
|
|
|
- //for (var key in rune) {
|
|
|
|
|
- // this.proxy.log({ type: 'info', source: 'plugin', name: this.pluginName, message: `IVV RUNE: ${key}: ${rune[key]}` })
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ for (var key in rune) {
|
|
|
|
|
+ this.proxy.log({ type: 'info', source: 'plugin', name: this.pluginName, message: `IVV RUNE: ${key}: ${rune[key]}` })
|
|
|
|
|
+ }
|
|
|
run.rune.id = rune.rune_id;
|
|
run.rune.id = rune.rune_id;
|
|
|
run.rune.grade = rune.class;
|
|
run.rune.grade = rune.class;
|
|
|
run.rune.value = rune.sell_value;
|
|
run.rune.value = rune.sell_value;
|
|
@@ -270,6 +287,14 @@ module.exports = {
|
|
|
run.rune.innate = rune.prefix_eff[0];
|
|
run.rune.innate = rune.prefix_eff[0];
|
|
|
run.rune.innate_value = rune.prefix_eff[1];
|
|
run.rune.innate_value = rune.prefix_eff[1];
|
|
|
}
|
|
}
|
|
|
|
|
+ run.rune['substat_1'] = 0;
|
|
|
|
|
+ run.rune['substat_1_value'] = 0;
|
|
|
|
|
+ run.rune['substat_2'] = 0;
|
|
|
|
|
+ run.rune['substat_2_value'] = 0;
|
|
|
|
|
+ run.rune['substat_3'] = 0;
|
|
|
|
|
+ run.rune['substat_3_value'] = 0;
|
|
|
|
|
+ run.rune['substat_4'] = 0;
|
|
|
|
|
+ run.rune['substat_4_value'] = 0;
|
|
|
rune.sec_eff.forEach((substat, i) => {
|
|
rune.sec_eff.forEach((substat, i) => {
|
|
|
run.rune[`substat_${i + 1}`] = substat[0];
|
|
run.rune[`substat_${i + 1}`] = substat[0];
|
|
|
run.rune[`substat_${i + 1}_value`] = substat[1];
|
|
run.rune[`substat_${i + 1}_value`] = substat[1];
|
|
@@ -303,13 +328,16 @@ module.exports = {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
json_rune = '[';
|
|
json_rune = '[';
|
|
|
- if (run.rune.length > 0){
|
|
|
|
|
|
|
+ if (run.rune.id != undefined){
|
|
|
|
|
+ json_rune += '{';
|
|
|
json_rune += `"id": "${run.rune.id}", `;
|
|
json_rune += `"id": "${run.rune.id}", `;
|
|
|
- json_rune += `"grade": "${run.rune.grade}", `;
|
|
|
|
|
- json_rune += `"set": "${run.rune.set}", `;
|
|
|
|
|
|
|
+ json_rune += `"stars": "${run.rune.grade}", `;
|
|
|
|
|
+ json_rune += `"type": "${run.rune.set}", `;
|
|
|
json_rune += `"slot": "${run.rune.slot}", `;
|
|
json_rune += `"slot": "${run.rune.slot}", `;
|
|
|
json_rune += `"efficiency": "${run.rune.efficiency}", `;
|
|
json_rune += `"efficiency": "${run.rune.efficiency}", `;
|
|
|
json_rune += `"quality": "${run.rune.quality}", `;
|
|
json_rune += `"quality": "${run.rune.quality}", `;
|
|
|
|
|
+ // TODO: Get
|
|
|
|
|
+ json_rune += `"ancient": 0, `;
|
|
|
json_rune += `"value": "${run.rune.value}", `;
|
|
json_rune += `"value": "${run.rune.value}", `;
|
|
|
json_rune += `"main_stat": "${run.rune.main}", `;
|
|
json_rune += `"main_stat": "${run.rune.main}", `;
|
|
|
json_rune += `"main_stat_value": "${run.rune.main_value}", `;
|
|
json_rune += `"main_stat_value": "${run.rune.main_value}", `;
|
|
@@ -320,23 +348,28 @@ module.exports = {
|
|
|
json_rune += `"substat_2": "${run.rune.substat_2}", `;
|
|
json_rune += `"substat_2": "${run.rune.substat_2}", `;
|
|
|
json_rune += `"substat_2_value": "${run.rune.substat_2_value}", `;
|
|
json_rune += `"substat_2_value": "${run.rune.substat_2_value}", `;
|
|
|
json_rune += `"substat_3": "${run.rune.substat_3}", `;
|
|
json_rune += `"substat_3": "${run.rune.substat_3}", `;
|
|
|
- json_rune += `"substat_4_value": "${run.rune.substat_3_value}", `;
|
|
|
|
|
|
|
+ json_rune += `"substat_3_value": "${run.rune.substat_3_value}", `;
|
|
|
json_rune += `"substat_4": "${run.rune.substat_4}", `;
|
|
json_rune += `"substat_4": "${run.rune.substat_4}", `;
|
|
|
json_rune += `"substat_4_value": "${run.rune.substat_4_value}"`;
|
|
json_rune += `"substat_4_value": "${run.rune.substat_4_value}"`;
|
|
|
|
|
+ json_rune += '}';
|
|
|
}
|
|
}
|
|
|
json_rune = json_rune + "]";
|
|
json_rune = json_rune + "]";
|
|
|
|
|
|
|
|
json_item = '[';
|
|
json_item = '[';
|
|
|
if (run.item.length > 0){
|
|
if (run.item.length > 0){
|
|
|
|
|
+ json_item += '{';
|
|
|
json_item += `"id": "${run.item.id}", `;
|
|
json_item += `"id": "${run.item.id}", `;
|
|
|
json_item += `"quantity": "${run.item.quantity}"`;
|
|
json_item += `"quantity": "${run.item.quantity}"`;
|
|
|
|
|
+ json_item += '}';
|
|
|
}
|
|
}
|
|
|
json_item = json_item + "]";
|
|
json_item = json_item + "]";
|
|
|
|
|
|
|
|
json_unit_pieces = '[';
|
|
json_unit_pieces = '[';
|
|
|
if (run.unit_pieces.length > 0){
|
|
if (run.unit_pieces.length > 0){
|
|
|
|
|
+ json_unit_pieces += '{';
|
|
|
json_unit_pieces += `"id": "${run.unit_pieces.id}", `;
|
|
json_unit_pieces += `"id": "${run.unit_pieces.id}", `;
|
|
|
- json_unit_pieces += `"quantity": "${run.unit_pieces.quantity}" `;
|
|
|
|
|
|
|
+ json_unit_pieces += `"quantity": "${run.unit_pieces.quantity}"`;
|
|
|
|
|
+ json_unit_pieces += '}';
|
|
|
}
|
|
}
|
|
|
json_unit_pieces = json_unit_pieces + "]";
|
|
json_unit_pieces = json_unit_pieces + "]";
|
|
|
|
|
|
|
@@ -365,8 +398,8 @@ module.exports = {
|
|
|
json += `"unit": ${run.unit}, `;
|
|
json += `"unit": ${run.unit}, `;
|
|
|
json += `"unit_pieces": ${json_unit_pieces}, `;
|
|
json += `"unit_pieces": ${json_unit_pieces}, `;
|
|
|
json += `"shapeshifting": ${run.shapeshifting}, `;
|
|
json += `"shapeshifting": ${run.shapeshifting}, `;
|
|
|
- json += `"party": ${json_party}`, ;
|
|
|
|
|
- json += `"helper": "${run.helper}", `;
|
|
|
|
|
|
|
+ json += `"party": ${json_party}, `;
|
|
|
|
|
+ json += `"helper": "${run.helper}"`;
|
|
|
json += `}`;
|
|
json += `}`;
|
|
|
this.log('DEBUG', `json: ${json}`)
|
|
this.log('DEBUG', `json: ${json}`)
|
|
|
//const filename = sanitize(`${wizardName}-${wizardID}-runs.csv`);
|
|
//const filename = sanitize(`${wizardName}-${wizardID}-runs.csv`);
|
|
@@ -382,55 +415,6 @@ module.exports = {
|
|
|
value: json
|
|
value: json
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // npm install -S request eyespect
|
|
|
|
|
- /*var url = this.target_host + ':' + this.target_port + '/' + this.target_url;
|
|
|
|
|
- var options = {
|
|
|
|
|
- method: 'post',
|
|
|
|
|
- body: postData,
|
|
|
|
|
- json: false, //json: true,
|
|
|
|
|
- url: url
|
|
|
|
|
- }
|
|
|
|
|
- request(options, function (err, res, body) {
|
|
|
|
|
- if (err) {
|
|
|
|
|
- this.log('ERROR', `REQUEST ERROR ${err}, `)
|
|
|
|
|
- //return
|
|
|
|
|
- }
|
|
|
|
|
- //var headers = res.headers
|
|
|
|
|
- //var statusCode = res.statusCode
|
|
|
|
|
- //inspect(headers, 'headers')
|
|
|
|
|
- //inspect(statusCode, 'statusCode')
|
|
|
|
|
- //inspect(body, 'body')
|
|
|
|
|
- })*/
|
|
|
|
|
-
|
|
|
|
|
- /*const req_options = setRequestAuth(
|
|
|
|
|
- {
|
|
|
|
|
- json: true,
|
|
|
|
|
- body: { data: { request: req, response: resp, __version: acceptedCommands.__version } }
|
|
|
|
|
- },
|
|
|
|
|
- wizard_id
|
|
|
|
|
- );*/
|
|
|
|
|
-
|
|
|
|
|
- // Send it
|
|
|
|
|
- /*var url = this.target_host + ':' + this.target_port + '/' + this.target_url;
|
|
|
|
|
- request.post(url, postData, (error, response, body) => {
|
|
|
|
|
- if (error) {
|
|
|
|
|
- this.log('error',`Error: ${error.message}`);
|
|
|
|
|
- //return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Log message to proxy window
|
|
|
|
|
- if (response.statusCode === 200) {
|
|
|
|
|
- this.log('success',`${command} logged successfully`);
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- if (response.statusCode == 401) {
|
|
|
|
|
- this.log('error',`SWARFARM Authentication failure: ${body.detail}`);
|
|
|
|
|
- } else {
|
|
|
|
|
- this.log('error',`Error ${response.statusCode}: ${body.detail}`);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });*/
|
|
|
|
|
-
|
|
|
|
|
var querystring = require('querystring');
|
|
var querystring = require('querystring');
|
|
|
var http = require('http');
|
|
var http = require('http');
|
|
|
var fs = require('fs');
|
|
var fs = require('fs');
|
|
@@ -451,12 +435,14 @@ module.exports = {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// Set up the request
|
|
// Set up the request
|
|
|
|
|
+ var resp = ""
|
|
|
var post_req = http.request(post_options, function(res) {
|
|
var post_req = http.request(post_options, function(res) {
|
|
|
res.setEncoding('utf8');
|
|
res.setEncoding('utf8');
|
|
|
res.on('data', function (chunk) {
|
|
res.on('data', function (chunk) {
|
|
|
- this.log("DEBUG", 'Response: ' + chunk);
|
|
|
|
|
|
|
+ resp = chunk;
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// post the data
|
|
// post the data
|
|
|
post_req.write(post_data);
|
|
post_req.write(post_data);
|