fix loop... police cars send to verband mission

This commit is contained in:
2019-02-19 00:47:20 +01:00
parent c1602189ac
commit 0edf21fa24
3 changed files with 62 additions and 44 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/*Generated on:Tue Feb 19 2019 00:29:30 GMT+0100 (CET)*/ /*Generated on:Tue Feb 19 2019 00:47:18 GMT+0100 (CET)*/
var AutomaticDispose_Branch = "master"; var AutomaticDispose_Branch = "master";
var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/"; var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/";
var da_lss_adis_time = new Date().getTime(); var da_lss_adis_time = new Date().getTime();
+31 -22
View File
@@ -1,4 +1,4 @@
/*Generated on:Tue Feb 19 2019 00:29:30 GMT+0100 (CET)*/ /*Generated on:Tue Feb 19 2019 00:47:18 GMT+0100 (CET)*/
/* /*
* Dexie.js - a minimalistic wrapper for IndexedDB * Dexie.js - a minimalistic wrapper for IndexedDB
* =============================================== * ===============================================
@@ -4591,7 +4591,7 @@
"last_check": Math.floor(new Date().getTime() / 1000), "last_check": Math.floor(new Date().getTime() / 1000),
"next_check": Math.floor(new Date().getTime() / 1000) + 1 "next_check": Math.floor(new Date().getTime() / 1000) + 1
} }
if (data.vehicle_state === 0 && (data.missing_text===null || (data.missing_text && data.missing_text.includes('Zusätzlich benötigte Fahrzeuge')))) { if (data.vehicle_state === 0 && (data.missing_text === null || (data.missing_text && data.missing_text.includes('Zusätzlich benötigte Fahrzeuge')))) {
window.AutomaticDisposeCall.AddMissionsToQueue(missionData) window.AutomaticDisposeCall.AddMissionsToQueue(missionData)
} else if (data.missing_text === 'Gefangene sollen abtransportiert werden.') { } else if (data.missing_text === 'Gefangene sollen abtransportiert werden.') {
window.AutomaticDisposeCall.AddPoliceSprechwunschToQueue(String(data.id)); window.AutomaticDisposeCall.AddPoliceSprechwunschToQueue(String(data.id));
@@ -18431,7 +18431,7 @@
Check_Call_Police_Active() { Check_Call_Police_Active() {
let self = this; let self = this;
if (($('#h2_prisoners').length > 0 || $('img.patientPrisonerIcon').length > 0) /*&& !self.includesString($('#missionH1').text(),'[verband]')*/) { if (($('#h2_prisoners').length > 0 || $('img.patientPrisonerIcon').length > 0) /*&& !self.includesString($('#missionH1').text(),'[verband]')*/ ) {
//TODO: check if Verband or Event and //TODO: check if Verband or Event and
// Maybe done with //__FIXX__20192 // Maybe done with //__FIXX__20192
self.Collect_Jails(); self.Collect_Jails();
@@ -18462,6 +18462,7 @@
let self = this; let self = this;
self.Jails = []; self.Jails = [];
var CountGefangene = Number(parseInt($('#h2_prisoners').text())); var CountGefangene = Number(parseInt($('#h2_prisoners').text()));
let ImThere = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar"),#mission_vehicle_driving tr > td:nth-child(7) > a:contains("Jomaar")').length;
var parentNode = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar")').parent().parent(); var parentNode = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar")').parent().parent();
var GefKw = parentNode.find('td:nth-child(2) > a[vehicle_type_id="52"]'); var GefKw = parentNode.find('td:nth-child(2) > a[vehicle_type_id="52"]');
var FuStW = parentNode.find('td:nth-child(2) > a[vehicle_type_id="32"]'); var FuStW = parentNode.find('td:nth-child(2) > a[vehicle_type_id="32"]');
@@ -18610,37 +18611,45 @@
//__FIXX__20192 //__FIXX__20192
let me = $(elem).find('td:nth-child(5) > a:contains("Jomaar")').length; let me = $(elem).find('td:nth-child(5) > a:contains("Jomaar")').length;
if (me > 0) { if (me > 0) {
//__FIXX__20192 //__FIXX__20192
var CalledVehicleID = parseInt($(elem).find("a").first().attr("vehicle_type_id")); var CalledVehicleID = parseInt($(elem).find("a").first().attr("vehicle_type_id"));
if (CalledVehicleID == 52) { if (CalledVehicleID == 52) {
CountGefangene -= 5; CountGefangene -= 5;
} else if (CalledVehicleID == 32) { } else if (CalledVehicleID == 32) {
CountGefangene -= 1; CountGefangene -= 1;
} }
//__FIXX__20192 //__FIXX__20192
} }
//__FIXX__20192 //__FIXX__20192
}); });
if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').length > 0 && CountGefangene >= 5) { if (ImThere > 0) {
$('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').each((_, elem) => { if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').length > 0 && CountGefangene >= 5) {
if (CountGefangene > 0) { $('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').each((_, elem) => {
$(elem).click() if (CountGefangene > 0) {
CountGefangene -= 5; $(elem).click()
} CountGefangene -= 5;
}
});
}
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 0 && CountGefangene > 0) {
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').each((_, elem) => {
if (CountGefangene > 0) {
$(elem).click()
CountGefangene -= 1;
}
});
}
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0) {
$('#mission_alarm_btn').click();
}
} else {
let MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
tellParent(`console.log('sprechwunsch:${window.name}:${MissionID}');setTimeout(function(){ window.AutomaticDisposeCall.FreeIframe('adis-sprechwunsch-police-frame');},500);`);
}); });
} }
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 0 && CountGefangene > 0) {
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').each((_, elem) => {
if (CountGefangene > 0) {
$(elem).click()
CountGefangene -= 1;
}
});
}
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0) {
$('#mission_alarm_btn').click();
}
} }
} }
+30 -21
View File
@@ -116,7 +116,7 @@
"last_check": Math.floor(new Date().getTime() / 1000), "last_check": Math.floor(new Date().getTime() / 1000),
"next_check": Math.floor(new Date().getTime() / 1000) + 1 "next_check": Math.floor(new Date().getTime() / 1000) + 1
} }
if (data.vehicle_state === 0 && (data.missing_text===null || (data.missing_text && data.missing_text.includes('Zusätzlich benötigte Fahrzeuge')))) { if (data.vehicle_state === 0 && (data.missing_text === null || (data.missing_text && data.missing_text.includes('Zusätzlich benötigte Fahrzeuge')))) {
window.AutomaticDisposeCall.AddMissionsToQueue(missionData) window.AutomaticDisposeCall.AddMissionsToQueue(missionData)
} else if (data.missing_text === 'Gefangene sollen abtransportiert werden.') { } else if (data.missing_text === 'Gefangene sollen abtransportiert werden.') {
window.AutomaticDisposeCall.AddPoliceSprechwunschToQueue(String(data.id)); window.AutomaticDisposeCall.AddPoliceSprechwunschToQueue(String(data.id));
@@ -632,7 +632,7 @@
Check_Call_Police_Active() { Check_Call_Police_Active() {
let self = this; let self = this;
if (($('#h2_prisoners').length > 0 || $('img.patientPrisonerIcon').length > 0) /*&& !self.includesString($('#missionH1').text(),'[verband]')*/) { if (($('#h2_prisoners').length > 0 || $('img.patientPrisonerIcon').length > 0) /*&& !self.includesString($('#missionH1').text(),'[verband]')*/ ) {
//TODO: check if Verband or Event and //TODO: check if Verband or Event and
// Maybe done with //__FIXX__20192 // Maybe done with //__FIXX__20192
self.Collect_Jails(); self.Collect_Jails();
@@ -663,6 +663,7 @@
let self = this; let self = this;
self.Jails = []; self.Jails = [];
var CountGefangene = Number(parseInt($('#h2_prisoners').text())); var CountGefangene = Number(parseInt($('#h2_prisoners').text()));
let ImThere = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar"),#mission_vehicle_driving tr > td:nth-child(7) > a:contains("Jomaar")').length;
var parentNode = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar")').parent().parent(); var parentNode = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar")').parent().parent();
var GefKw = parentNode.find('td:nth-child(2) > a[vehicle_type_id="52"]'); var GefKw = parentNode.find('td:nth-child(2) > a[vehicle_type_id="52"]');
var FuStW = parentNode.find('td:nth-child(2) > a[vehicle_type_id="32"]'); var FuStW = parentNode.find('td:nth-child(2) > a[vehicle_type_id="32"]');
@@ -811,37 +812,45 @@
//__FIXX__20192 //__FIXX__20192
let me = $(elem).find('td:nth-child(5) > a:contains("Jomaar")').length; let me = $(elem).find('td:nth-child(5) > a:contains("Jomaar")').length;
if (me > 0) { if (me > 0) {
//__FIXX__20192 //__FIXX__20192
var CalledVehicleID = parseInt($(elem).find("a").first().attr("vehicle_type_id")); var CalledVehicleID = parseInt($(elem).find("a").first().attr("vehicle_type_id"));
if (CalledVehicleID == 52) { if (CalledVehicleID == 52) {
CountGefangene -= 5; CountGefangene -= 5;
} else if (CalledVehicleID == 32) { } else if (CalledVehicleID == 32) {
CountGefangene -= 1; CountGefangene -= 1;
} }
//__FIXX__20192 //__FIXX__20192
} }
//__FIXX__20192 //__FIXX__20192
}); });
if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').length > 0 && CountGefangene >= 5) { if (ImThere > 0) {
$('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').each((_, elem) => { if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').length > 0 && CountGefangene >= 5) {
if (CountGefangene > 0) { $('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').each((_, elem) => {
$(elem).click() if (CountGefangene > 0) {
CountGefangene -= 5; $(elem).click()
} CountGefangene -= 5;
}
});
}
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 0 && CountGefangene > 0) {
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').each((_, elem) => {
if (CountGefangene > 0) {
$(elem).click()
CountGefangene -= 1;
}
});
}
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0) {
$('#mission_alarm_btn').click();
}
} else {
let MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
tellParent(`console.log('sprechwunsch:${window.name}:${MissionID}');setTimeout(function(){ window.AutomaticDisposeCall.FreeIframe('adis-sprechwunsch-police-frame');},500);`);
}); });
} }
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 0 && CountGefangene > 0) {
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').each((_, elem) => {
if (CountGefangene > 0) {
$(elem).click()
CountGefangene -= 1;
}
});
}
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0) {
$('#mission_alarm_btn').click();
}
} }
} }