`;
}
let player_statistic_div = "";
let total_gametime = 0;
/*
Статистика карт
zavod_3_jirikupdate - 1 день 2:19:13
zavod_3_jirik - 1 день 2:19:13
zavod_3 - 1 день 2:19:13
*/
if (data.gametime) {
player_statistic_div = `
Статистика карт
`;
for (const srv in data.gametime) {
for (const map_name in data.gametime[srv]) {
//

//
.servers[srv].preview})
let map = map_name.replace("workshop/", "").split(".ugc", 1)[0];
player_statistic_div += `
${map} - ${UNIX2FACTI_TIME(data.gametime[srv][map_name])}
`;
total_gametime += data.gametime[srv][map_name];
}
}
player_statistic_div += "
"
}
let player_data_div = `
${data.steam_data.nickname}
${player_ban_div}
${player_permition_div}
${player_statistic_div}
Наиграно: ${UNIX2FACTI_TIME(total_gametime)}
`
return player_data_div;
}
function UNIX2FACTI_TIME(u_time) {
const divmod = (x, y) => [Math.floor(x / y), x % y];
let s = divmod(u_time, 60)[1];
let m = divmod(u_time, 60)[0];
let h = divmod(m, 60)[0];
m = divmod(m, 60)[1];
let d = divmod(h, 24)[0];
h = divmod(h, 24)[1];
//бля простите я тупой
if (!s & !m & !h & !d) {
return "не играл";
}
let time = `${h > 9 ? h : '0' + h}:${m > 9 ? m : '0' + m}:${s > 9 ? s : '0' + s}`;
if (!d) {
return time;
} else if (d < 2) {
return `${d} день ${time}`;
} else {
return `${d} дней ${time}`;
}
}
function human_name_impl_2(count, naming){
let number = Math.abs(count) % 100;
let number_post = number % 10;
if (number > 10 && number < 20) { return naming[2]; }
if (number_post > 1 && number_post < 5) { return naming[1]; }
if (number_post == 1) { return naming[0] }
return naming[2];
}
function ReconstructVipSection(data) {
$('#Modal_SelectPayMethod_Close').click(async function (ev) {
ev.preventDefault();
$('#Modal_SelectPayMethod').modal('hide');
});
$('#Modal_SelectPayMethod_CheckVIP').click(async function (ev) {
ev.preventDefault();
await fetch("https://tf2.pblr-nyk.pro/api/profile/current?requests=permition", { credentials: "same-origin", headers: { 'Cache-Control': 'no-cache' } })
.then(response => response.json())
.then(response => {
if (response.permition) {
$("#Modal_SelectPayMethod_CheckVIP_Status").html("(имеется)");
$("#Modal_SelectPayMethod_CheckVIP_Status").css("color", "green");
if (response.permition.amount) {
$("#Modal_SelectPayMethod_CheckVIP_EndDate").html(`До: ${CalculateVipEndDate(response.permition).toLocaleString()}`);
} else {
$("#Modal_SelectPayMethod_CheckVIP_EndDate").html(`бесконечность не предел`);
}
} else {
$("#Modal_SelectPayMethod_CheckVIP_Status").html("(отсутствует)");
$("#Modal_SelectPayMethod_CheckVIP_Status").css("color", "red");
$("#Modal_SelectPayMethod_CheckVIP_EndDate").html(`Время проверки: ${new Date().toLocaleString()}`);
}
});
});
$("#Section_VIP_buttons").empty();
const STEAM_TRADE = "https://steamcommunity.com/tradeoffer/new/?partner=47239992&token=8gNFVl7h";
const QIWI_TRADE = "https://qiwi.com/payment/form/99?currency=643&amount=(AMOUNT)&extra%5B%27comment%27%5D=(COMMENT)&extra%5B%27account%27%5D=79207516287&blocked%5B0%5D=sum&blocked%5B1%5D=account&blocked%5B2%5D=comment";
$("#Modal_SelectPayMethod_ProfileLink").attr("href", data.steamids.community_url);
$("#Modal_SelectPayMethod_ProfileName").html(`Вип будет выдан: ${data.steam_data.nickname}`);
/*let price_array = new Array(
["1 месяц", 150, "1 ключ", "site_content/images/vip/VIP_1_MOUNTH.jpg", "month"],
["1 неделя", 75, "20 рефов", "site_content/images/vip/VIP_7_DAYS.jpg", "week"],
["1 день", 20, "5 рефов", "site_content/images/vip/VIP_1_DAY.jpg", "day"],
["1 день", 0, "бесплатно", "site_content/images/vip/freevip.jpg", "free"]
);*/
let vip_select;
for (let price in api_prices) {
price = api_prices[price];
vip_select = `
${price.human_duration}
${price.money_price} Рублей
${price.item_price}
`
$(vip_select).appendTo("#Section_VIP_buttons");
$(`#Section_VIP_buttons_${price.period}`).click(async function (ev) {
ev.preventDefault();
if(price.period != "free"){
$("#Modal_SelectPayMethod_PayButtons").show(0);
$("#Modal_SelectPayMethod_GetFreeButtons").hide(0);
$("#Modal_SelectPayMethod_QIWI_Button").attr("href", QIWI_TRADE.replace("(AMOUNT)", price.money_price).replace("(COMMENT)", data.steamids.steam2.replace(":", "%3A")));
$("#Modal_SelectPayMethod_QIWI_Value").html(`${price.money_price} Рублей`);
$("#Modal_SelectPayMethod_STEAM_Button").attr("href", STEAM_TRADE);
$("#Modal_SelectPayMethod_STEAM_Value").html(price.item_price);
try {
let value_qiwi = price.period in api_response.donate.month.statistic.qiwi? api_response.donate.month.statistic.qiwi[price.period] : 0;
let value_name_1 = human_name_impl_2(value_qiwi, ["раз", "раза", "раз"])
$("#Modal_SelectPayMethod_DonateStatsValue_qiwi").html(`${value_qiwi} ${value_name_1}`);
let value_steam = price.period in api_response.donate.month.statistic.steam? api_response.donate.month.statistic.steam[price.period] : 0;
let value_name_2 = human_name_impl_2(value_steam, ["раз", "раза", "раз"])
$("#Modal_SelectPayMethod_DonateStatsValue_steam").html(`${value_steam} ${value_name_2}`);
$("#Modal_SelectPayMethod_DonateStatsText_FREE").hide(0);
$("#Modal_SelectPayMethod_DonateStatsValue").show(0);
$("#Modal_SelectPayMethod_DonateStatsText").show(0);
} catch {
$("#Modal_SelectPayMethod_DonateStatsValue").hide(0);
$("#Modal_SelectPayMethod_DonateStatsText").hide(0);
}
} else {
$("#Modal_SelectPayMethod_DonateStatsValue").hide(0);
$("#Modal_SelectPayMethod_DonateStatsText").hide(0);
$("#Modal_SelectPayMethod_PayButtons").hide(0);
$("#Modal_SelectPayMethod_GetFreeButtons").show(0);
let value_free = "day" in api_response.donate.month.statistic.free? api_response.donate.month.statistic.free.day : 0;
let value_free_naming = human_name_impl_2(value_free, ["раз", "раза", "раз"])
$("#Modal_SelectPayMethod_DonateStatsValue_free").html(`${value_free} ${value_free_naming}`);
$("#Modal_SelectPayMethod_DonateStatsText_FREE").show(0);
}
$('#Modal_SelectPayMethod').modal('show');
return false;
});
}
}
$("#Modal_SelectPayMethod_GetFreeButton_Check").click(async function (ev) {
ev.preventDefault();
await fetch("https://tf2.pblr-nyk.pro/api/profile/current/freevip", { credentials: "same-origin", headers: { 'Cache-Control': 'no-cache' }, method:"POST"})
.then(response => response.json())
.then(response => {
if (response == 0) $("#Modal_SelectPayMethod_GetFreeButton_Text").html("У тебя уже есть права!");
else if (response == 1) $("#Modal_SelectPayMethod_GetFreeButton_Text").html("Права выданы! Балдей!");
else if (response > 1) $("#Modal_SelectPayMethod_GetFreeButton_Text").html(`Ты не можешь получить вип бесплатно, вернись через ${UNIX2FACTI_TIME(response)}`);
else if (response < 0) $("#Modal_SelectPayMethod_GetFreeButton_Text").html(`Наиграй на сервере еще ${UNIX2FACTI_TIME(response * -1)}`);
else $("#Modal_SelectPayMethod_GetFreeButton_Text").html("Сегодня не твой день");
})
.catch(err => {
if (err.code == 429) {
$("#Modal_SelectPayMethod_GetFreeButton_Text").html("Помедленее друг, не так сильно");
} else {
$("#Modal_SelectPayMethod_GetFreeButton_Text").html("Сегодня не твой день, друг...");
}
});
});
//secret egg
let konami_code = "";
let activated = false;
//$().keypress(function (event) {
document.addEventListener('keypress', (event) => {
//$(":root").keypress(function (event) {
if (activated) { return; }
konami_code += event.key;
if (konami_code.length == 6 || event.key == "-") {
if (konami_code == "nigger") {
activated = true;
$("#Tab_About").attr("href", "#SecretEgg");
$('.nav-pills a[href="#SecretEgg"]').tab('show');
(new Audio("site_content/sounds/sunboy-ledi-night-16.mp3")).play();
$("#Nav_MenuButtons").remove();
ChangeBackgoundImage("site_content/images/background/hasbik_dance.jpg");
//$('Tab_Secret_Egg').click();
}
konami_code = ""
}
});