Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [Core] Mission 27.03,Header,sDM #657

Merged
merged 10 commits into from Mar 27, 2020
95 changes: 60 additions & 35 deletions lss-manager-v3/helperfunctions.js
Expand Up @@ -8,7 +8,7 @@
// 4 = Wasserrettung
if (I18n.locale == "en_US")
{
lssm.extensions = {
lssm.extensions = {
// FW-Erwerterungen (0-9)
"Ambulance extension": 0,
"Water rescue expansion": 1,
Expand All @@ -18,7 +18,7 @@ if (I18n.locale == "en_US")
"More cell": 10,
// Schule-Erweiterungen (20-29)
"More classrooms": 20,
};
};
lssm.carsById = {
"0": ["Type 1 fire engine", 0],
"1": ["Type 2 fire engine", 0],
Expand Down Expand Up @@ -569,7 +569,7 @@ else if (I18n.locale == "ro_RO") {
}
else if (I18n.locale == "nl_NL")
{
lssm.extensions = {
lssm.extensions = {
// FW-Erwerterungen (0-9)
"Ambulance standplaats": 0,
"Waterongevallenbestrijding": 1,
Expand All @@ -584,7 +584,7 @@ else if (I18n.locale == "nl_NL")
"Arrestatieteam": 14,
// Schule-Erweiterungen (20-29)
"Extra klaslokaal": 20,
};
};
lssm.carsById = {
"0": ["SIV | Snel Interventie Voertuig", 0],
"1": ["TS 8/9 | Tankautospuit (8/9 personen)", 0],
Expand Down Expand Up @@ -646,7 +646,7 @@ else if (I18n.locale == "nl_NL")
}
else if (I18n.locale == "de_DE")
{
lssm.extensions = {
lssm.extensions = {
// FW-Erwerterungen (0-9)
"Rettungsdienst-Erweiterung": 0,
"Wasserrettungs-Erweiterung": 1,
Expand Down Expand Up @@ -679,7 +679,32 @@ else if (I18n.locale == "de_DE")
"2. Technischer Zug - Grundvoraussetzung": 44,
"2. Technischer Zug: Bergungsgruppe 2": 45,
"2. Technischer Zug: Zugtrupp ": 46,
};
};

lssm.buildingTypes = [
'Feuerwache',
'Feuerwehrschule',
'Rettungswache',
'Rettungsschule',
'Krankenhaus',
'Rettungshubschrauber-Station',
'Polizeiwache',
'Leitstelle',
'Polizeischule',
'THW',
'THW Bundesschule',
'Bereitschaftspolizei',
'Schnelleinsatzgruppe (SEG)',
'Polizeihubschrauberstation',
'Bereitstellungsraum',
'Wasserrettung',
'Verbandszellen',
'Polizei-Sondereinheiten',
'Feuerwache (Kleinwache)',
'Polizeiwache (Kleinwache)',
'Rettungswache (Kleinwache)'
];

lssm.carsById = {
"0": ["LF 20", 0],
"1": ["LF 10", 0],
Expand Down Expand Up @@ -806,8 +831,8 @@ lssm.car_list_all = function() {
lssm.car_list_printable = function(list) {
let data = "";
$.each(list, function (key, car) {
data += "<div style=\"margin-top: 3px;\"><span class=\"building_list_fms building_list_fms_" + car.fms_real + "\">" + car.fms_show + "</span> " + car.name +
"</div>";
data += "<div style=\"margin-top: 3px;\"><span class=\"building_list_fms building_list_fms_" + car.fms_real + "\">" + car.fms_show + "</span> " + car.name +
"</div>";
});
return data;
}
Expand Down Expand Up @@ -862,18 +887,18 @@ lssm.updateStatusCount = function(async=true) {
'X-LSS-Manager': lssm.headerVersion()
},
success: function (response) {
for (let status in response) {
lssm.statusCount[status] = response[status];
}
for (let status in response) {
lssm.statusCount[status] = response[status];
}
}
});
};

// Funktion zum Updaten des FMS eigener Fzg.
$(document).bind(lssm.hook.postname("radioMessage"), function(event, t) {
if(t.type === "vehicle_fms"
&& lssm.vehicles.hasOwnProperty(t.id)
&& !t.fms_text.startsWith("[Verband]"))
&& lssm.vehicles.hasOwnProperty(t.id)
&& !t.fms_text.startsWith("[Verband]"))
{
let vehicle = lssm.vehicles[t.id];
lssm.statusCount[vehicle.fms_show]--;
Expand Down Expand Up @@ -935,9 +960,9 @@ lssm.newDragableDivOnMap=function(id, classe, pos) {
let m = map.getSize();
let p = L.DomUtil.getPosition(info._div);
let pos = {
x: changeX(p.x, m.x),
y: changeY(p.y, m.y)
};
x: changeX(p.x, m.x),
y: changeY(p.y, m.y)
};
lssm.settings.set(lssm.config.prefix + "_"+id+"Position",pos);
L.DomUtil.setPosition(info._div, new L.Point(pos.x,pos.y));
};
Expand All @@ -952,27 +977,27 @@ lssm.newDragableDivOnMap=function(id, classe, pos) {
// Add custom String format function
if (!String.format) {
// console.log("execute");
String.format = function(format) {
let args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined' ? args[number] : match;
});
};
String.format = function(format) {
let args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined' ? args[number] : match;
});
};
}
lssm.notification = function(msg, type, duration) {
type = (typeof type === 'undefined') ? 'alert-success' : type;
duration = (typeof duration === 'undefined') ? 2000 : duration;
$("#content")
.before(
'<div class="alert alert-dismissable ' + type + '" id="lssm_notification" ' +
'style="text-align:center;width:90%"><a href="#" class="close" data-dismiss="alert" ' +
'aria-label="close">&times;</a>' + msg +
'</div>');
setTimeout(function() {
$("#lssm_notification").slideUp("slow", function() {
$("#lssm_notification").remove();
});
}, duration);
type = (typeof type === 'undefined') ? 'alert-success' : type;
duration = (typeof duration === 'undefined') ? 2000 : duration;
$("#content")
.before(
'<div class="alert alert-dismissable ' + type + '" id="lssm_notification" ' +
'style="text-align:center;width:90%"><a href="#" class="close" data-dismiss="alert" ' +
'aria-label="close">&times;</a>' + msg +
'</div>');
setTimeout(function() {
$("#lssm_notification").slideUp("slow", function() {
$("#lssm_notification").remove();
});
}, duration);
};

lssm.headerVersion = () => `${I18n.t('lssm.version')} ${lssm.version}`;
Expand Down
18 changes: 2 additions & 16 deletions modules/lss-WachenplanungOnMap/WachenplanungOnMap.user.js
Expand Up @@ -264,8 +264,8 @@
// Type

form += '<div class="input-group select required building_building_type"><div class="input-group-addon"><label class="select required " for="building_building_type"><abbr title="required">*</abbr> ' + I18n.t('lssm.wpom.btype') + '</label></div><select class="select required form-control" id="building_building_type"><option value=""></option>';
for (let i in btypes) {
form += '<option value="' + i + '">' + btypes[i] + '</option>';
for (let i in lssm.buildingTypes) {
form += '<option value="' + i + '">' + lssm.buildingTypes[i] + '</option>';
}
form += '</select></div>';
// Name
Expand Down Expand Up @@ -443,20 +443,6 @@
createSettings();
// alle aktiven Typen zeichnen
drawCircles(true);
let btypes = {};
$.get('/buildings/new')
.fail(function () {
console.log("Could not get building list. Disabling mapmarkers.");
$("#WachenplanungOnMap_remmarker").remove();
$("#WachenplanungOnMap_addmarker").remove();
})
.done(function (data) {
$.each($(data).find("#building_building_type option"), function (key, value) {
"use strict";
if (value.value !== "")
btypes[value.value] = value.text;
});
});
let pmid = 0;
let plannedMarkers = lssm.settings.get("wpomp", []);
let plannedMarkersMap = [];
Expand Down
26 changes: 18 additions & 8 deletions modules/lss-creditserweiterung/creditserweiterung.user.js
Expand Up @@ -606,8 +606,12 @@
}

function createExtension() {
$.get("/api/credits")
.then(response => {
$.ajax({
url: '/api/credits',
headers: {
'X-LSS-Manager': lssm.headerVersion()
},
success(response) {
let earnedCredits = response.credits_user_total;
let creditsOfNextRank = getCreditsOfNextRank(earnedCredits);
if (creditsOfNextRank === null) {
Expand Down Expand Up @@ -644,16 +648,21 @@

$('#menu_creditsverwaltung').attr('title', 'Credits: ' + $('#navigation_top').text().replace(/[\D.]*/, '') + '\nCoins: ' + $('#coins_top').text().replace(/[\D.]*/, ''));

$('#menu_creditsverwaltung').click(function() {
$('#menu_creditsverwaltung').click(function () {
updateValues();
});
});
}
});
}

function updateValues() {
if (updateable) {
$.get("/api/credits")
.then(response => {
$.ajax({
url: '/api/credits',
headers: {
'X-LSS-Manager': lssm.headerVersion()
},
success(response) {
let earnedCredits = response.credits_user_total;
let creditsOfNextRank = getCreditsOfNextRank(earnedCredits);
if (creditsOfNextRank === null) {
Expand All @@ -673,10 +682,11 @@
$("#creditsextensionAllianceFunds").html(I18n.t('lssm.creditserweiterung.texts.allianceFunds') + ': ' + allianceFundsCredits.toLocaleString() + ' Credits');
}
updateable = false;
setTimeout(function() {
setTimeout(function () {
updateable = true;
}, 300000);
});
}
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/lss-geoborders/GeoBorders.js
Expand Up @@ -11,7 +11,7 @@
};

let openBtn = '<div id="borders-openBtn" class="leaflet-bar leaflet-control leaflet-control-custom map-expand-button" style="background-image: url(' + lssm.getlink('/modules/lss-geoborders/img/ico_de.png') + '); background-color: white; width: 26px; height: 26px;"></div>';
$('.leaflet-bottom.leaflet-left').append(openBtn);
$('.leaflet-control-container .leaflet-top.leaflet-left').append(openBtn);

$('#borders-openBtn').click(() => {
$('#borders-modal').show();
Expand Down
13 changes: 13 additions & 0 deletions modules/lss-missionHelper/missions.de_DE.json
Expand Up @@ -9421,5 +9421,18 @@
"percentages": {
"mess": 30
}
},
"516": {
"name": "Flugzeug Erstlandung",
"stations": {
"0": 1
},
"vehicles": {
"arff": 2
},
"credits": 1700,
"poi": 32,
"siwa": true,
"dauer": "30 Minuten"
}
}
6 changes: 4 additions & 2 deletions modules/lss-missionKeyword/missionKeyword.user.js
Expand Up @@ -537,7 +537,8 @@
512: 'Herrenloses Gepäckstück',
513: 'Hausdach eingestürzt',
514: 'Durchsuchung - Gebäudekomplex',
515: 'Brand einer Produktionshalle'
515: 'Brand einer Produktionshalle',
516: 'Flugzeug Erstlandung'
}
};
I18n.translations.en_US.lssm.missionKeywordDefaults = {
Expand Down Expand Up @@ -4436,7 +4437,8 @@
512: 'POL 1',
513: 'THW 3',
514: 'BP 2',
515: 'B 7'
515: 'B 7',
516: 'ABSICHERUNG'
};
let DEFAULT_AAO_ENUS = {
0: 'FIRE 1',
Expand Down
2 changes: 1 addition & 1 deletion modules/lss-overview/overview.js
Expand Up @@ -3017,7 +3017,7 @@
$('#table-' + hiorg + '-body').append('<tr><td>' + vehicle.name + '</td><td>' + (vehicle.min || vehicle.min === 0 ? vehicle.min : "undefined") + '</td><td>' + (vehicle.max || vehicle.max === 0 ? vehicle.max : "undefined") + '</td><td>' + (vehicle.credits ? vehicle.credits.toLocaleString() : "undefined") + ' Credits / ' + (vehicle.coins ? vehicle.coins.toLocaleString() : "undefined") + ' Coins</td><td>' + (vehicle.schooling ? vehicle.schooling : I18n.t('lssm.overview.none')) + '</td><td>' + (vehicle.special ? vehicle.special : "") + '</td></tr>');
} else if (I18n.locale === "en_GB") {
$('#table-' + hiorg + '-body').append('<tr><td>' + vehicle.name + '</td><td>' + (vehicle.min || vehicle.min === 0 ? vehicle.min : "undefined") + '</td><td>' + (vehicle.max || vehicle.max === 0 ? vehicle.max : "undefined") + '</td><td>' + (vehicle.credits ? vehicle.credits.toLocaleString() : "undefined") + ' Credits / ' + (vehicle.coins ? vehicle.coins.toLocaleString() : "undefined") + ' Coins</td><td>' + (vehicle.schooling ? vehicle.schooling : I18n.t('lssm.overview.none')) + '</td><td>' + (vehicle.special ? vehicle.special : "") + '</td></tr>');
} else if (I18n.locale === "nl") {
} else if (I18n.locale === "nl_NL") {
$('#table-' + hiorg + '-body').append('<tr><td>' + vehicle.name + '</td><td>' + (vehicle.min || vehicle.min === 0 ? vehicle.min : "undefined") + '</td><td>' + (vehicle.max || vehicle.max === 0 ? vehicle.max : "undefined") + '</td><td>' + (vehicle.credits ? vehicle.credits.toLocaleString() : "undefined") + ' Credits / ' + (vehicle.coins ? vehicle.coins.toLocaleString() : "undefined") + ' Coins</td><td>' + (vehicle.schooling ? vehicle.schooling : I18n.t('lssm.overview.none')) + '</td><td>' + (vehicle.special ? vehicle.special : "") + '</td></tr>');
}
}
Expand Down
37 changes: 27 additions & 10 deletions modules/lss-shareAlliancePost/ShareAlliancePost.js
Expand Up @@ -514,16 +514,33 @@
const message = $('#allianceShareText').val();

$('.alert_notify_alliance').html(I18n.t('lssm.sharealliancepost.share'));
$.get('/missions/' + missionId + '/alliance', () => {
$('.alert_notify_alliance').html(I18n.t('lssm.sharealliancepost.chat'));
$.post("/mission_replies", { authenticity_token: csrfToken, mission_reply: { alliance_chat: sendToAlliance, content: message, mission_id: missionId } }, (data, status, xhr) => {
$('.alert_notify_alliance').html(I18n.t('lssm.sharealliancepost.alert'));
if (getSetting('jumpNext')) {
$('.alert_next').first().click();
} else {
$('#mission_alarm_btn').click();
}
});
$.ajax({
url: `/missions/${missionId}/alliance`,
headers: {
'X-LSS-Manager': lssm.headerVersion()
},
success(data) {
$('.alert_notify_alliance').html(I18n.t('lssm.sharealliancepost.chat'));
$.ajax({
type: 'POST',
url: `/mission_replies`,
headers: {
'X-LSS-Manager': lssm.headerVersion()
},
data: {
authenticity_token: csrfToken,
mission_reply: {alliance_chat: sendToAlliance, content: message, mission_id: missionId}
},
success() {
$('.alert_notify_alliance').html(I18n.t('lssm.sharealliancepost.alert'));
if (getSetting('jumpNext')) {
$('.alert_next').first().click();
} else {
$('#mission_alarm_btn').click();
}
}
});
}
});

};
Expand Down