V2 update no async
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1200866
File diff suppressed because it is too large
Load Diff
+31
-31
@@ -114,7 +114,7 @@ class AutomaticDispose {
|
|||||||
self.ADisDB.open().catch((err) => {
|
self.ADisDB.open().catch((err) => {
|
||||||
console.error(err.stack || err);
|
console.error(err.stack || err);
|
||||||
});
|
});
|
||||||
self.ADisDB.on("ready", async () => {
|
self.ADisDB.on("ready", () => {
|
||||||
self.adis_settings = {
|
self.adis_settings = {
|
||||||
'Krankentransport-Automatic': false,
|
'Krankentransport-Automatic': false,
|
||||||
'Sprechwunsch-Automatic': false,
|
'Sprechwunsch-Automatic': false,
|
||||||
@@ -122,8 +122,8 @@ class AutomaticDispose {
|
|||||||
'Alliance-Automatic': false,
|
'Alliance-Automatic': false,
|
||||||
'AllianceEvent-Automatic': false
|
'AllianceEvent-Automatic': false
|
||||||
}
|
}
|
||||||
await self.genSettings()
|
self.genSettings()
|
||||||
setInterval(self.genSettings.bind(self), 1000);
|
|
||||||
|
|
||||||
if (window.location.pathname === "/" || window.location.pathname === "/#") {
|
if (window.location.pathname === "/" || window.location.pathname === "/#") {
|
||||||
self.GetAvailableMissions()
|
self.GetAvailableMissions()
|
||||||
@@ -177,11 +177,12 @@ class AutomaticDispose {
|
|||||||
self.adis_settings[setting.name] = setting.value;
|
self.adis_settings[setting.name] = setting.value;
|
||||||
});
|
});
|
||||||
self.UIUpdateSettings();
|
self.UIUpdateSettings();
|
||||||
|
setTimeout(self.genSettings, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
ADSettings() {
|
ADSettings() {
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Dexie.Promise((resolve, reject) => {
|
||||||
return resolve(self.adis_settings);
|
return resolve(self.adis_settings);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -212,15 +213,14 @@ class AutomaticDispose {
|
|||||||
|
|
||||||
CollectRescueSprechwuensche() {
|
CollectRescueSprechwuensche() {
|
||||||
let self = this;
|
let self = this;
|
||||||
new Promise(async (resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
await self.ADisDB.ADisSprechwunsch.where({
|
return self.ADisDB.ADisSprechwunsch.where({
|
||||||
done: 'false'
|
done: 'false'
|
||||||
}).each((myWunsch) => {
|
}).each((myWunsch) => {
|
||||||
if ($("#vehicle_list_" + myWunsch.vehicleID).find(".building_list_fms").text() != "5") {
|
if ($("#vehicle_list_" + myWunsch.vehicleID).find(".building_list_fms").text() != "5") {
|
||||||
self.RemoveRescueSprechwunschFromQueue(myWunsch.vehicleID);
|
self.RemoveRescueSprechwunschFromQueue(myWunsch.vehicleID);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return resolve();
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
$("#building_list").find(".building_list_vehicle_element").each((_, elem) => {
|
$("#building_list").find(".building_list_vehicle_element").each((_, elem) => {
|
||||||
var VehicleStatus = $(elem).find(".building_list_fms").text();
|
var VehicleStatus = $(elem).find(".building_list_fms").text();
|
||||||
@@ -250,7 +250,7 @@ class AutomaticDispose {
|
|||||||
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
|
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
|
||||||
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
|
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
|
||||||
|
|
||||||
self.RescueVehicleFrameWatchDog = setTimeout(async () => {
|
self.RescueVehicleFrameWatchDog = setTimeout(() => {
|
||||||
self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
|
self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
|
||||||
$("#adis-sprechwunsch-rescue-frame").attr("src", "");
|
$("#adis-sprechwunsch-rescue-frame").attr("src", "");
|
||||||
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
|
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
|
||||||
@@ -386,8 +386,8 @@ class AutomaticDispose {
|
|||||||
|
|
||||||
CollectPoliceSprechwuensche() {
|
CollectPoliceSprechwuensche() {
|
||||||
let self = this;
|
let self = this;
|
||||||
new Promise(async (resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
await self.ADisDB.ADisSprechwunschPolice.where({
|
return self.ADisDB.ADisSprechwunschPolice.where({
|
||||||
done: 'false'
|
done: 'false'
|
||||||
}).each((myWunsch) => {
|
}).each((myWunsch) => {
|
||||||
if (!$("#mission_" + myWunsch.missionID).text().match(/Gefangene sollen abtransportiert werden/g)) {
|
if (!$("#mission_" + myWunsch.missionID).text().match(/Gefangene sollen abtransportiert werden/g)) {
|
||||||
@@ -395,7 +395,6 @@ class AutomaticDispose {
|
|||||||
return self.RemovePoliceSprechwunschFromQueue(myWunsch.missionID);
|
return self.RemovePoliceSprechwunschFromQueue(myWunsch.missionID);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return resolve();
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible');
|
var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible');
|
||||||
return MOIODOS.each((_, elem) => {
|
return MOIODOS.each((_, elem) => {
|
||||||
@@ -440,7 +439,7 @@ class AutomaticDispose {
|
|||||||
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
|
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
|
||||||
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
|
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
|
||||||
|
|
||||||
self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => {
|
self.PoliceVehicleFrameWatchDog = setTimeout((MissionID) => {
|
||||||
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
|
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
|
||||||
$("#adis-sprechwunsch-police-frame").attr("src", "");
|
$("#adis-sprechwunsch-police-frame").attr("src", "");
|
||||||
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
|
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
|
||||||
@@ -909,10 +908,11 @@ class AutomaticDispose {
|
|||||||
if (typeof MissionID != 'undefined') {
|
if (typeof MissionID != 'undefined') {
|
||||||
return self.AddMission(MissionID, Runner);
|
return self.AddMission(MissionID, Runner);
|
||||||
} else {
|
} else {
|
||||||
return self.ADisSettings.runner_divs.forEach(async (RunnerX, index) => {
|
return self.ADisSettings.runner_divs.forEach((RunnerX, index) => {
|
||||||
await $("#" + RunnerX).find(".missionSideBarEntry").each(async (index, elem) => {
|
$("#" + RunnerX).find(".missionSideBarEntry").each((index, elem) => {
|
||||||
MissionID = $(elem).attr("mission_id");
|
MissionID = $(elem).attr("mission_id");
|
||||||
await self.AddMission(MissionID, RunnerX);
|
self.AddMission(MissionID, RunnerX);
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1361,45 +1361,45 @@ class AutomaticDispose {
|
|||||||
StartAlarmProcess() {
|
StartAlarmProcess() {
|
||||||
const self = this;
|
const self = this;
|
||||||
const alarming = function alarming(self) {
|
const alarming = function alarming(self) {
|
||||||
Promise.resolve().then(async () => {
|
new Dexie.Promise.resolve().then(() => {
|
||||||
return await self.PrepareVehicleNeedList();
|
return self.PrepareVehicleNeedList();
|
||||||
}).then(async () => {
|
}).then(() => {
|
||||||
return await self.CollectInvolvedVehicles();
|
return self.CollectInvolvedVehicles();
|
||||||
}).then(async () => {
|
}).then(() => {
|
||||||
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return await self.CollectPatients();
|
return self.CollectPatients();
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(() => {
|
||||||
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return await self.ProcessEmergencyMedicalService()
|
return self.ProcessEmergencyMedicalService()
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(() => {
|
||||||
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return await self.ProcessFireDepartment()
|
return self.ProcessFireDepartment()
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(() => {
|
||||||
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return await self.ProcessPoliceDepartment()
|
return self.ProcessPoliceDepartment()
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(() => {
|
||||||
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return await self.ProcessTechnicalEmergencyService()
|
return self.ProcessTechnicalEmergencyService()
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(() => {
|
||||||
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return await self.ProcessWaterRescue()
|
return self.ProcessWaterRescue()
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
||||||
if (self.OweSecure && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:checked').length == 0) {
|
if (self.OweSecure && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:checked').length == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user