// ==UserScript==
// @name hwmDefenceNotifier
// @author Tamozhnya1
// @namespace Tamozhnya1
// @description Система уведомлений о защитах
// @include *heroeswm.ru/*
// @version 1.8
// @require https://update.greasyfork.org/scripts/490927/1360667/Tamozhnya1Lib.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM.xmlHttpRequest
// @grant GM_openInTab
// @grant GM.notification
// @license MIT
// ==/UserScript==
if(!PlayerId) {
return;
}
const DefenceDuration = 15 * 60000; // Длительность защиты 15 минут
const DefenceWaitDuration = 45 * 60000; // Длительность ожидания защиты 45 минут
const scriptExecutingPageToken = Date.now().toString();
const tasks = {};
const notificationType = { DefenceWating: 1, DefenceStarting: 2, Defence: 3 };
main();
async function main() {
if(!await checkMilitaryClan()) {
return;
}
requestServerTime();
setLastActiveTab();
document.addEventListener("visibilitychange", setLastActiveTab);
if(location.pathname == '/mapwars.php') {
const taxlogRef = document.querySelector("a[href='taxlog.php']");
const notificationsSettingsTitle = addElement("span", { style: "cursor: pointer;", innerHTML: " (<u>уведомления</u>)" }, taxlogRef.parentNode);
notificationsSettingsTitle.addEventListener("click", showScriptOptions);
}
if(new Date(parseInt(getPlayerValue("TurnOffNotificationToday", 0))) >= today()) {
return;
}
tasksAssignment();
showCurrentNotification();
}
function showCurrentNotification() {
//setPlayerValue("CurrentNotification", `{"Type":"1","Message":"The next-sibling combinator is made of the code point that separates two compound selectors. The elements represented by the two compound selectors share the same parent in the document tree and the element represented by the first compound selector immediately precedes the element represented by the second one. Non-element nodes (e.g. text between elements) are ignored when considering the adjacency of elements."}`);
if(!isHeartOnPage) {
return;
}
let currentNotificationHolder = document.querySelector("div#currentNotificationHolder");
let currentNotificationContent = document.querySelector("div#currentNotificationContent");
if(!currentNotificationHolder) {
currentNotificationHolder = addElement("div", { id: "currentNotificationHolder", style: "display: flex; position: fixed; transition-duration: 0.8s; right: 0; bottom: -300px; width: 200px; border: 2px solid #000000; background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%); font: 9pt sans-serif;" }, document.body);
currentNotificationContent = addElement("div", { id: "currentNotificationContent", style: "text-align: center;" }, currentNotificationHolder);
const divClose = addElement("div", { title: isEn ? "Close" : "Закрыть", innerText: "x", style: "border: 1px solid #abc; flex-basis: 15px; height: 15px; text-align: center; cursor: pointer;" }, currentNotificationHolder);
divClose.addEventListener("click", function() {
const rect = currentNotificationHolder.getBoundingClientRect();
currentNotificationHolder.style.bottom = `${-rect.height-1}px`;
deletePlayerValue("CurrentNotification");
});
}
if(getPlayerValue("CurrentNotification")) {
const notification = JSON.parse(getPlayerValue("CurrentNotification"));
const isDefence = notification.Type == notificationType.Defence;
const isSendBrowserNotification = getPlayerBool(isDefence ? "DefenceSendBrowserNotification" : "DefenceFoundSendBrowserNotification", true);
currentNotificationContent.innerText = notification.Message;
const rect = currentNotificationHolder.getBoundingClientRect();
currentNotificationHolder.style.bottom = `${-rect.height-1}px`;
if(isSendBrowserNotification) {
currentNotificationHolder.style.bottom = "0";
}
}
}
async function checkMilitaryClan() {
if(!getPlayerValue(`MilitaryClanId`) || location.pathname == '/pl_clans.php') {
const doc = location.pathname == '/pl_clans.php' ? document : await getRequest(`/pl_clans.php`);
if(location.pathname == '/pl_clans.php') {
deletePlayerValue(`MilitaryClanId`);
}
const clanInfos = Array.from(doc.querySelectorAll("td > li > a[href^='clan_info.php']")).map(x => { return { Id: getUrlParamValue(x.href, "id"), Name: x.firstChild.innerText, Ref: x.href }; });
for(const clanInfo of clanInfos) {
const clanInfoDoc = await getRequest(clanInfo.Ref);
if(clanInfoDoc.body.innerHTML.includes(isEn ? "[Military clan]" : "[боевой клан]")) {
setPlayerValue(`MilitaryClanId`, clanInfo.Id);
break;
}
}
}
if(!getPlayerValue(`MilitaryClanId`)) {
console.log("Вы не состоите в боевом клане");
return false;
}
return true;
}
function setLastActiveTab() {
if(document.visibilityState == "visible") {
setPlayerValue("LastActiveTab", scriptExecutingPageToken); // код отвечает за то, чтоб уведомления исходили только из последней активной вкладки, а не случайной.
}
}
async function tasksAssignment(isForce = false) {
let defences = restoreDefences();
// В начале каждой пятиминутки ищем новые защиты
const defenceSearchNeeded = truncToFiveMinutes(getServerTime()) > truncToFiveMinutes(getPlayerValue("LastSearchDate", 0)); // Текущая пятиминутка больше пятиминутки последнего опроса
if(isForce || defenceSearchNeeded || location.pathname == "/mapwars.php") {
defences = await findDefences();
}
// Распределение заданий
const nearestDefenceTime = parseInt(getPlayerValue("NearestDefenceTime", 0));
if(nearestDefenceTime > 0) {
let notifications = [];
// Вычисление всех дат оповещения
for(const isDefence of [false, true]) {
const startNotification = parseInt(getPlayerValue(isDefence ? "StartNotificationAboutDefenceEnd" : "StartNotificationAboutDefenceBegin", 0)); // Начинать оповещение о начале или конце за столько минут. Если пусто, то не оповещать, если ноль, то в момент события
if(startNotification > 0) {
// Вылидация начала оповещения
const startNotificationMax = isDefence ? 15 : 45;
if(startNotification > startNotificationMax) {
startNotification = startNotificationMax;
}
const eventTime = nearestDefenceTime - (isDefence ? 0 : DefenceDuration);
//console.log(`nearestDefenceTime: ${new Date(nearestDefenceTime).toLocaleString()}, eventTime: ${new Date(eventTime).toLocaleString()}`)
const notificationInterval = parseInt(getPlayerValue(isDefence ? "NotificationIntervalAboutDefenceEnd" : "NotificationIntervalAboutDefenceBegin", 0)); // Интервал оповещений о начале или конце в минутах. Если пусто или ноль, то оповестить один раз
let currentNotificationTime = eventTime - startNotification * 60000;
//console.log(`eventTime: ${toTimeFormat(new Date(eventTime))}, startNotification: ${startNotification}, notificationInterval: ${notificationInterval}`);
while(currentNotificationTime < eventTime) {
notifications.push({ Time: currentNotificationTime, Type: isDefence ? notificationType.Defence : notificationType.DefenceWating, DefenceTime: nearestDefenceTime });
currentNotificationTime += notificationInterval * 60000;
}
}
}
if(getPlayerValue("OnceBeforeDefence")) {
notifications.push({ Time: nearestDefenceTime - DefenceDuration - parseInt(getPlayerValue("OnceBeforeDefence")) * 1000, Type: notificationType.DefenceStarting }); // Оповещение, что защита вот-вот начнётся
}
notifications = notifications.filter(x => x.Time > getServerTime());
//console.log(Object.keys(notifications).map(x => toTimeFormat(new Date(notifications[x].Time), 3) + " " + notifications[x].Type));
// Ставим таймеры на все оповещения
for(const notification of notifications) {
if(!tasks[notification.Time]) {
tasks[notification.Time] = setTimeout(function() { executeTask(notification); }, notification.Time - getServerTime());
}
}
for(const notificationTime in tasks) {
if(notificationTime < getServerTime()) {
clearTimeout(tasks[notificationTime]);
delete tasks[notificationTime];
}
}
}
if(getPlayerValue("CurrentNotification")) {
const notification = JSON.parse(getPlayerValue("CurrentNotification"));
if(nearestDefenceTime == 0 || nearestDefenceTime > notification.DefenceTime) {
deletePlayerValue("CurrentNotification");
}
}
const nextDefencesRequestDate = truncToFiveMinutes(getServerTime()) + 300000 + 5000; // Вычисляем текущую пятиминутку на сервере, добавляем 5 минут, и на всякий случай 5 секунд
setTimeout(tasksAssignment, nextDefencesRequestDate - getServerTime());
}
async function executeTask(notification) {
if(new Date(parseInt(getPlayerValue("TurnOffNotificationToday", 0))) >= today()) {
return;
}
if(getPlayerValue("LastActiveTab", scriptExecutingPageToken) != scriptExecutingPageToken) {
return;
}
//console.log(`Сообщение запоздало на: ${getServerTime() - notification.Time} миллисекунд`);
let defences = restoreDefences();
const nearestDefenceTime = parseInt(getPlayerValue("NearestDefenceTime", 0));
if(nearestDefenceTime == 0) {
return;
}
const isDefence = notification.Type == notificationType.Defence; // Защита началась
const isPlaySound = getPlayerBool(isDefence ? "DefencePlaySound" : "DefenceFoundPlaySound", true);
if(isPlaySound) {
const soundSource = getPlayerValue(isDefence ? "DefenceAudioPath" : "DefenceFoundAudioPath") || "data:audio/mp3;base64,//uQxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAoAABC7wAGBgwMExMTGRkgICAmJiwsLDMzOTk5QEBGRkZMTFNTU1lZYGBgZmZsbGxzc3l5eYCAhoaGjIyTk5OZmaCgoKamrKyss7O5ubnAwMbGxszM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VVVVVVVVVVVVVVVVVVVVVVVU=";
new Audio(soundSource).play();
}
const isSendNotification = getPlayerBool(isDefence ? "DefenceSendNotification" : "DefenceFoundSendNotification", true);
const isSendBrowserNotification = getPlayerBool(isDefence ? "DefenceSendBrowserNotification" : "DefenceFoundSendBrowserNotification", true);
if(isSendNotification || isSendBrowserNotification) {
let message = "";
let defence = defences[nearestDefenceTime];
switch(notification.Type) {
case notificationType.DefenceWating:
const eventTime = nearestDefenceTime - DefenceDuration;
message = `Начало защиты в ${toTimeFormat(new Date(eventTime))}, осталось: ${formatInterval(eventTime - getServerTime())}, контроль объекта ${defence.objectControlPercent}%`;
const otherDefenceTimes = Object.keys(defences).filter(x => parseInt(x) != nearestDefenceTime);
const otherDefenceTimesText = otherDefenceTimes.map(x => toTimeFormat(new Date(x - DefenceDuration))).join(", ");
if(otherDefenceTimesText && otherDefenceTimesText != "") {
message += `\nЕщё защита(ы) в ${otherDefenceTimesText}`;
}
break;
case notificationType.DefenceStarting:
message = `Защита ${toTimeFormat(new Date(nearestDefenceTime - DefenceDuration))} вот-вот начнется!`;
break;
case notificationType.Defence:
defences = await findDefences();
defence = defences[nearestDefenceTime];
message = `Идет защита до ${toTimeFormat(new Date(nearestDefenceTime))}
не закрыто дорожек ${defence.openedTracks}
свободных мест ${defence.freePlaces}
ожидаемый контроль ${defence.objectControlPercentAfterDefence}%`;
break;
}
if(isSendNotification) {
GM.notification(message, "ГВД", "https://dcdn1.heroeswm.ru/i/bselect/mapwars.png?v=3aa", function() { window.focus(); GM_openInTab("/mapwars.php"); });
}
if(isSendBrowserNotification) {
notification.Message = message;
setPlayerValue("CurrentNotification", JSON.stringify(notification));
showCurrentNotification();
}
}
}
function formatInterval(interval) {
let diff = interval;
const hours = Math.floor(diff / 1000 / 60 / 60);
diff -= hours * 1000 * 60 * 60;
const mimutes = Math.floor(diff / 1000 / 60);
diff -= mimutes * 1000 * 60;
const seconds = Math.floor(diff / 1000);
const formatedTime = (hours > 0 ? hours + ":" : "") + `${mimutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
return formatedTime;
}
async function findDefences() {
const doc = location.pathname == "/mapwars.php" ? document : await getRequest("/mapwars.php");
const defenceTable = doc.querySelector("body > center > table:nth-child(2) * table * table.wbwhite");
const defences = {};
if(defenceTable) {
for(const row of defenceTable.rows) {
if(row.cells[1].querySelector(`a[href='clan_info.php?id=${getPlayerValue(`MilitaryClanId`)}']`)) {
const defenceEndExec = /(\d{1,2}:\d{1,2})/.exec(row.cells[0].innerHTML);
if(defenceEndExec) {
const defenceTime = parseDate(defenceEndExec[1], true).getTime();
const defenceObjectRef = row.cells[1].querySelector("a[href^='object-info.php']");
const defenceObjectId = getUrlParamValue(defenceObjectRef.href, "id");
const objectControlPercent = await getObjectControlPercent(defenceObjectId);
let openedTracks = 0;
let freePlaces = 0;
if(!row.cells[2].innerHTML.match(/вступление на защиту с \d{1,2}:\d{1,2}/)) {
const tracks = row.cells[2].innerHTML.split("<br>").filter(x => x.match(/[1-7]{1}\)/));
for(const track of tracks) {
const playersOnTrack = (track.match(/pl_info/g) || []).length;
if(playersOnTrack < 2) {
openedTracks++;
freePlaces += 2 - playersOnTrack;
}
}
} else {
openedTracks = 7;
freePlaces = 14;
}
defences[defenceTime] = {
freePlaces: freePlaces,
openedTracks: openedTracks,
objectControlPercent: objectControlPercent,
objectControlPercentAfterDefence: Math.max(objectControlPercent - 15 * openedTracks, 0),
defenceObjectId: defenceObjectId
};
//console.log(new Date(defenceTime).toLocaleString());
}
}
}
}
//console.log(defences)
storeDefences(defences);
setPlayerValue("LastSearchDate", getServerTime());
return defences;
}
function calcIsDefence() { return getPlayerValue("NearestDefenceTime") && getServerTime() >= parseInt(getPlayerValue("NearestDefenceTime")) - DefenceDuration; }
function restoreDefences() {
const defences = JSON.parse(getPlayerValue("Defences", "{}"));
for(const key in defences) {
const defenceTime = parseInt(key);
if(defenceTime < getServerTime() || defenceTime > getServerTime() + DefenceWaitDuration + DefenceDuration) {
delete defences[key]; // Защита устарела или мусор из будущего
var isPacked = true;
} else {
defences[key] = JSON.parse(defences[key]);
}
}
if(isPacked) {
storeDefences(defences);
}
return defences;
}
function storeDefences(defences) {
const nearestDefenceTime = Object.keys(defences).reduce((t, x) => t == 0 ? parseInt(x) : Math.min(t, parseInt(x)), 0);
if(nearestDefenceTime > 0) {
setPlayerValue("NearestDefenceTime", nearestDefenceTime);
} else {
deletePlayerValue("NearestDefenceTime");
}
const t = Object.keys(defences).reduce((t, x) => ({...t, [x]: JSON.stringify(defences[x])}), {});
setPlayerValue("Defences", JSON.stringify(t));
}
function toTimeFormat(date, parts = 2) {
const dateParts = date.toLocaleString().split(" ");
return dateParts.find(x => x.includes(":")).split(":", parts).join(":");
}
async function getObjectControlPercent(objectId) {
const doc = await getRequest(`/clan_info.php?id=${getPlayerValue(`MilitaryClanId`)}`);
const objectRow = doc.querySelector(`td.wbwhite > table.wb * a[href='object-info.php?id=${objectId}']`).closest("tr");
const controlPercentCell = objectRow.cells[objectRow.cells.length - 1];
const objectControlPercent = parseFloat(controlPercentCell.innerText.replace("%", ""));
return objectControlPercent;
}
function showScriptOptions() {
if(showPupupPanel(GM_info.script.name, onScriptOptionToggle)) {
return;
}
const fieldsMap = [];
const defenceWaitTitle = addElement("span", { innerText: "Начало защиты" });
const defenceTitle = addElement("span", { innerText: "Окончание защиты" });
fieldsMap.push([null, defenceWaitTitle, defenceTitle]);
const startNotificationAboutDefenceBeginLabel = addElement("label", { for: "startNotificationAboutDefenceBeginInput", innerText: "Начинать оповещения за столько минут" + "\t" });
const startNotificationAboutDefenceBeginInput = addElement("input", { id: "startNotificationAboutDefenceBeginInput", type: "number", value: getPlayerValue("StartNotificationAboutDefenceBegin"), onfocus: "this.select();" });
startNotificationAboutDefenceBeginInput.addEventListener("change", function() { setOrDeleteNumberPlayerValue("StartNotificationAboutDefenceBegin", this.value); });
const startNotificationAboutDefenceEndInput = addElement("input", { id: "startNotificationAboutDefenceEndInput", type: "number", value: getPlayerValue("StartNotificationAboutDefenceEnd"), onfocus: "this.select();" });
startNotificationAboutDefenceEndInput.addEventListener("change", function() { setOrDeleteNumberPlayerValue("StartNotificationAboutDefenceEnd", this.value); });
fieldsMap.push([startNotificationAboutDefenceBeginLabel, startNotificationAboutDefenceBeginInput, startNotificationAboutDefenceEndInput]);
const notificationIntervalAboutDefenceBeginLabel = addElement("label", { for: "notificationIntervalAboutDefenceBeginInput", innerText: "Интервал оповещения, минут" + "\t" });
const notificationIntervalAboutDefenceBeginInput = addElement("input", { id: "notificationIntervalAboutDefenceBeginInput", type: "number", value: getPlayerValue("NotificationIntervalAboutDefenceBegin"), onfocus: "this.select();" });
notificationIntervalAboutDefenceBeginInput.addEventListener("change", function() { setOrDeleteNumberPlayerValue("NotificationIntervalAboutDefenceBegin", this.value); });
const notificationIntervalAboutDefenceEndInput = addElement("input", { id: "notificationIntervalAboutDefenceEndInput", type: "number", value: getPlayerValue("NotificationIntervalAboutDefenceEnd"), onfocus: "this.select();" });
notificationIntervalAboutDefenceEndInput.addEventListener("change", function() { setOrDeleteNumberPlayerValue("NotificationIntervalAboutDefenceEnd", this.value); });
fieldsMap.push([notificationIntervalAboutDefenceBeginLabel, notificationIntervalAboutDefenceBeginInput, notificationIntervalAboutDefenceEndInput]);
const defenceFoundPlaySoundLabel = addElement("label", { for: "defenceFoundPlaySoundInput", innerText: "Проиграть звук" + "\t" });
const defenceFoundPlaySoundInput = addElement("input", { id: "defenceFoundPlaySoundInput", type: "checkbox" });
defenceFoundPlaySoundInput.checked = getPlayerBool("DefenceFoundPlaySound", true);
defenceFoundPlaySoundInput.addEventListener("change", function() { setPlayerValue("DefenceFoundPlaySound", this.checked); });
const defencePlaySoundInput = addElement("input", { id: "defencePlaySoundInput", type: "checkbox" });
defencePlaySoundInput.checked = getPlayerBool("DefencePlaySound", true);
defencePlaySoundInput.addEventListener("change", function() { setPlayerValue("DefencePlaySound", this.checked); });
fieldsMap.push([defenceFoundPlaySoundLabel, defenceFoundPlaySoundInput, defencePlaySoundInput]);
const defenceFoundAudioPathLabel = addElement("label", { for: "defenceFoundAudioPathInput", innerText: "Mp3 url" + "\t" });
const defenceFoundAudioPathInput = addElement("input", { id: "defenceFoundAudioPathInput", type: "text", value: getPlayerValue("DefenceFoundAudioPath", ""), onfocus: "this.select();" });
defenceFoundAudioPathInput.addEventListener("change", function() { gmSetOrDeleteString("DefenceFoundAudioPath", this.value); });
const defenceAudioPathInput = addElement("input", { id: "defenceAudioPathInput", type: "text", value: getPlayerValue("DefenceAudioPath", ""), onfocus: "this.select();" });
defenceAudioPathInput.addEventListener("change", function() { gmSetOrDeleteString("DefenceAudioPath", this.value); });
fieldsMap.push([defenceFoundAudioPathLabel, defenceFoundAudioPathInput, defenceAudioPathInput]);
const defenceFoundSendNotificationLabel = addElement("label", { for: "defenceFoundSendNotificationInput", innerText: "Прислать оповещение" + "\t" });
const defenceFoundSendNotificationInput = addElement("input", { id: "defenceFoundSendNotificationInput", type: "checkbox" });
defenceFoundSendNotificationInput.checked = getPlayerBool("DefenceFoundSendNotification", true);
defenceFoundSendNotificationInput.addEventListener("change", function() { setPlayerValue("DefenceFoundSendNotification", this.checked); });
const defenceSendNotificationInput = addElement("input", { id: "defenceSendNotificationInput", type: "checkbox" });
defenceSendNotificationInput.checked = getPlayerBool("DefenceSendNotification", true);
defenceSendNotificationInput.addEventListener("change", function() { setPlayerValue("DefenceSendNotification", this.checked); });
fieldsMap.push([defenceFoundSendNotificationLabel, defenceFoundSendNotificationInput, defenceSendNotificationInput]);
const defenceFoundSendBrowserNotificationLabel = addElement("label", { for: "defenceFoundSendBrowserNotificationInput", innerText: "Показать оповещение в браузере" + "\t" });
const defenceFoundSendBrowserNotificationInput = addElement("input", { id: "defenceFoundSendBrowserNotificationInput", type: "checkbox" });
defenceFoundSendBrowserNotificationInput.checked = getPlayerBool("DefenceFoundSendBrowserNotification", true);
defenceFoundSendBrowserNotificationInput.addEventListener("change", function() { setPlayerValue("DefenceFoundSendBrowserNotification", this.checked); });
const defenceSendBrowserNotificationInput = addElement("input", { id: "defenceSendBrowserNotificationInput", type: "checkbox" });
defenceSendBrowserNotificationInput.checked = getPlayerBool("DefenceSendBrowserNotification", true);
defenceSendBrowserNotificationInput.addEventListener("change", function() { setPlayerValue("DefenceSendBrowserNotification", this.checked); });
fieldsMap.push([defenceFoundSendBrowserNotificationLabel, defenceFoundSendBrowserNotificationInput, defenceSendBrowserNotificationInput]);
const onceBeforeDefenceLabel = addElement("label", { for: "onceBeforeDefenceInput", innerText: "Дать одиночное оповещение за столько секунд до начала защиты" + "\t" });
const onceBeforeDefenceInput = addElement("input", { id: "onceBeforeDefenceInput", type: "number", value: getPlayerValue("OnceBeforeDefence"), onfocus: "this.select();" });
onceBeforeDefenceInput.addEventListener("change", function() { setOrDeleteNumberPlayerValue("OnceBeforeDefence", this.value); });
fieldsMap.push([onceBeforeDefenceLabel, onceBeforeDefenceInput]);
const turnOffNotificationTodayLabel = addElement("label", { for: "turnOffNotificationTodayInput", innerText: "Отключить уведомления на сегодня" + "\t" });
const turnOffNotificationTodayInput = addElement("input", { id: "turnOffNotificationTodayInput", type: "checkbox" });
turnOffNotificationTodayInput.checked = parseInt(getPlayerValue("TurnOffNotificationToday", 0)) >= toServerTime(today().getTime()) ? true : false;
turnOffNotificationTodayInput.addEventListener("change", function() { if(this.checked) { setPlayerValue("TurnOffNotificationToday", getServerTime()); } else { deletePlayerValue("TurnOffNotificationToday"); } });
fieldsMap.push([turnOffNotificationTodayLabel, turnOffNotificationTodayInput]);
createPupupPanel(GM_info.script.name, getScriptReferenceHtml() + " " + getSendErrorMailReferenceHtml(), fieldsMap, onScriptOptionToggle);
}
function onScriptOptionToggle(isShown) {
if(isShown) {
setTimeout("clearTimeout(Timer)", 0); // Вкл/выкл таймер обновления страницы (взаимодействие со скриптом на странице)
} else {
setTimeout("Refresh()", 0);
}
}