dsa
This commit is contained in:
parent
e9d7dabd6d
commit
3703dc22f7
5 changed files with 300 additions and 210 deletions
|
@ -1,6 +1,6 @@
|
|||
@page
|
||||
@model About
|
||||
@ViewData["Title"] = about
|
||||
@{ ViewData["Title"] = "about"; }
|
||||
<div>
|
||||
<h1>neroduckale.</h1>
|
||||
<h2><a href="https://t.me/neroduck" style="color: #00ff9d">telegram</a></h2>
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
@page
|
||||
@model Minecraftia
|
||||
@{ViewData["Title"] = "minecraft";}
|
||||
@{
|
||||
ViewData["Title"] = "minecraft";
|
||||
string[] custom = ["interact_with_crafting_table", "leave_game", "time_since_death", "damage_resisted", "sprint_one_cm","damage_blocked_by_shield","drop","talked_to_villager","play_time","deaths","jump","walk_on_water_one_cm","enchant_item","interact_with_furnace","sleep_in_bed","waystone_activated","damage_dealt","player_kills","crouch_one_cm","interact_with_smoker","interact_with_smithing_table","interact_with_anvil","mob_kills","damage_dealt_resisted","climb_one_cm","walk_one_cm","sneak_time","walk_under_water_one_cm","boat_one_cm","total_world_time","interact_with_stonecutter","interact_with_grindstone","time_since_rest","damage_absorbed","damage_taken","trigger_trapped_chest","swim_one_cm","fly_one_cm","pig_one_cm","open_chest","fall_one_cm"];
|
||||
}
|
||||
|
||||
Статистика игрока
|
||||
Статистика игрока
|
||||
<span>
|
||||
<input type="radio" id="nrdk" name="nickname" checked /><label for="huey">neroduckale</label>
|
||||
<input type="radio" id="ygolek" name="nickname"/><label for="huey">ygolek</label>
|
||||
<input type="radio" id="nrdk" name="nickname" checked/><label for="nrdk">neroduckale</label>
|
||||
<input type="radio" id="ygolek" name="nickname"/><label for="ygolek">ygolek</label>
|
||||
</span>
|
||||
<div>Сюда внесены первые десять позиций по количеству, типо какого предмета я скрафтил в больших количествах и так далее</div>
|
||||
<div class="grid-cards">
|
||||
|
@ -43,14 +46,27 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<select name="choose" id="choose">
|
||||
@{
|
||||
foreach (var str in custom)
|
||||
{
|
||||
if (custom[0] == str)
|
||||
{
|
||||
<option selected> @str </option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option>@str</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
|
||||
<div class="stats grid-cards">
|
||||
<div class="card">
|
||||
<canvas id="sravn">
|
||||
|
||||
</canvas>
|
||||
<canvas id="stat"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="https://unpkg.com/chart.js@4.2.1/dist/chart.umd.js"></script>
|
||||
<script type="module" src="~/js/minecraft.js"></script>
|
||||
<script type="module" src="~/js/inventory.js"></script>
|
||||
<script type="module" src="~/js/minecraft.js"></script>
|
|
@ -1,5 +1,5 @@
|
|||
@page
|
||||
@model Ygolek
|
||||
@ViewData["Title"] = ygolek
|
||||
@{ ViewData["Title"] = "ygolek";}
|
||||
|
||||
<img src="~/img/ygolek.jpg" style="width: 75%; height: 500px;" alt="YGOLEK'S PHOTO"/>
|
|
@ -1,226 +1,300 @@
|
|||
import {palette} from "./palette.js";
|
||||
|
||||
let chart = [];
|
||||
let charts = [];
|
||||
const keysToSort = [
|
||||
"minecraft:killed_by",
|
||||
"minecraft:broken",
|
||||
"minecraft:used",
|
||||
"minecraft:killed",
|
||||
"minecraft:dropped",
|
||||
"minecraft:crafted",
|
||||
"minecraft:picked_up",
|
||||
"minecraft:mined",
|
||||
"minecraft:killed_by",
|
||||
"minecraft:broken",
|
||||
"minecraft:used",
|
||||
"minecraft:killed",
|
||||
"minecraft:dropped",
|
||||
"minecraft:crafted",
|
||||
"minecraft:picked_up",
|
||||
"minecraft:mined",
|
||||
];
|
||||
|
||||
const custom = [
|
||||
"minecraft:interact_with_crafting_table",
|
||||
"minecraft:leave_game",
|
||||
"minecraft:time_since_death",
|
||||
"minecraft:damage_resisted",
|
||||
"minecraft:sprint_one_cm",
|
||||
"minecraft:damage_blocked_by_shield",
|
||||
"minecraft:drop",
|
||||
"minecraft:talked_to_villager",
|
||||
"minecraft:play_time",
|
||||
"minecraft:deaths",
|
||||
"minecraft:jump",
|
||||
"minecraft:walk_on_water_one_cm",
|
||||
"minecraft:enchant_item",
|
||||
"minecraft:interact_with_furnace",
|
||||
"minecraft:sleep_in_bed",
|
||||
"minecraft:waystone_activated",
|
||||
"minecraft:damage_dealt",
|
||||
"minecraft:player_kills",
|
||||
"minecraft:crouch_one_cm",
|
||||
"minecraft:interact_with_smoker",
|
||||
"minecraft:interact_with_smithing_table",
|
||||
"minecraft:interact_with_anvil",
|
||||
"minecraft:mob_kills",
|
||||
"minecraft:damage_dealt_resisted",
|
||||
"minecraft:climb_one_cm",
|
||||
"minecraft:walk_one_cm",
|
||||
"minecraft:sneak_time",
|
||||
"minecraft:walk_under_water_one_cm",
|
||||
"minecraft:boat_one_cm",
|
||||
"minecraft:total_world_time",
|
||||
"minecraft:interact_with_stonecutter",
|
||||
"minecraft:interact_with_grindstone",
|
||||
"minecraft:time_since_rest",
|
||||
"minecraft:damage_absorbed",
|
||||
"minecraft:damage_taken",
|
||||
"minecraft:trigger_trapped_chest",
|
||||
"minecraft:swim_one_cm",
|
||||
"minecraft:fly_one_cm",
|
||||
"minecraft:pig_one_cm",
|
||||
"minecraft:open_chest",
|
||||
"minecraft:fall_one_cm"
|
||||
]
|
||||
let nrdkstats;
|
||||
let ygolekstats;
|
||||
let locale;
|
||||
|
||||
|
||||
|
||||
async function getJson(json) {
|
||||
let a;
|
||||
await fetch(`https://neroduck.ru/${json}`, {
|
||||
method: "GET",
|
||||
headers: { Accept: "application/json" },
|
||||
})
|
||||
.then((response) => {
|
||||
return response.json();
|
||||
})
|
||||
.then((data) => {
|
||||
a = data;
|
||||
});
|
||||
return a;
|
||||
let a;
|
||||
await fetch(`https://neroduck.ru/${json}`, {
|
||||
method: "GET",
|
||||
headers: {Accept: "application/json"},
|
||||
})
|
||||
.then((response) => {
|
||||
return response.json();
|
||||
})
|
||||
.then((data) => {
|
||||
a = data;
|
||||
});
|
||||
return a;
|
||||
}
|
||||
|
||||
async function getJsons() {
|
||||
await getJson("nrdk.json").then((a) => {
|
||||
nrdkstats = a;
|
||||
});
|
||||
await getJson("ygolek.json").then((a) => {
|
||||
ygolekstats = a;
|
||||
});
|
||||
await getJson("ru_edited.json").then((a) => {
|
||||
locale = a;
|
||||
});
|
||||
}
|
||||
async function parseStats(stats) {
|
||||
let values = {
|
||||
valuedropped: [],
|
||||
datasdropped: [],
|
||||
valueused: [],
|
||||
datasused: [],
|
||||
valuecrafted: [],
|
||||
datascrafted: [],
|
||||
valuekilled_by: [],
|
||||
dataskilled_by: [],
|
||||
valuebroken: [],
|
||||
datasbroken: [],
|
||||
valuepicked_up: [],
|
||||
dataspicked_up: [],
|
||||
valuemined: [],
|
||||
datasmined: [],
|
||||
valuekilled: [],
|
||||
dataskilled: [],
|
||||
};
|
||||
// SORTING
|
||||
keysToSort.forEach((key) => {
|
||||
if (stats["stats"][key] && typeof stats["stats"][key] === "object") {
|
||||
stats["stats"][key] = Object.fromEntries(
|
||||
Object.entries(stats["stats"][key]).sort((a, b) => b[1] - a[1])
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//parsing
|
||||
keysToSort.forEach((key) => {
|
||||
let statistic = stats["stats"][key];
|
||||
statistic = Object.fromEntries(Object.entries(statistic).slice(0, 10));
|
||||
let keyy = key.replace("minecraft:", "");
|
||||
for (let item in statistic) {
|
||||
values["value" + keyy].push(translate(item, key));
|
||||
values["datas" + keyy].push(statistic[item]);
|
||||
}
|
||||
createPie(values["value" + keyy], values["datas" + keyy], keyy);
|
||||
});
|
||||
}
|
||||
async function createPie(items, datas, idcanvas) {
|
||||
|
||||
await charts.forEach((chart) => {
|
||||
chart.destroy();
|
||||
})
|
||||
|
||||
let bgcol = palette("tol-rainbow", items.length);
|
||||
for (let i = 0; i < bgcol.length; i++) {
|
||||
bgcol[i] = "#" + bgcol[i];
|
||||
}
|
||||
bgcol = bgcol.reverse();
|
||||
|
||||
const data = {
|
||||
labels: items,
|
||||
datasets: [
|
||||
{
|
||||
label: "количество",
|
||||
data: datas,
|
||||
backgroundColor: bgcol,
|
||||
hoverOffset: 6,
|
||||
},
|
||||
],
|
||||
};
|
||||
const config = {
|
||||
type: "doughnut",
|
||||
data: data,
|
||||
options: {
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: "white",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
let canvas = document.getElementById(idcanvas);
|
||||
charts.push(new Chart(canvas, config))
|
||||
await getJson("nrdk.json").then((a) => {
|
||||
nrdkstats = a;
|
||||
});
|
||||
await getJson("ygolek.json").then((a) => {
|
||||
ygolekstats = a;
|
||||
});
|
||||
await getJson("ru_edited.json").then((a) => {
|
||||
locale = a;
|
||||
});
|
||||
}
|
||||
|
||||
async function createBar() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const data = {
|
||||
labels: ["Смерти"],
|
||||
datasets: [
|
||||
{
|
||||
label: "neroduckale",
|
||||
data: [nrdkstats["stats"]["minecraft:custom"]["minecraft:deaths"]],
|
||||
backgroundColor: "#34b8e9",
|
||||
borderColor: "#ffffff",
|
||||
hoverOffset: 6,
|
||||
},
|
||||
{
|
||||
label: "ygolek",
|
||||
data: [ygolekstats["stats"]["minecraft:custom"]["minecraft:deaths"]],
|
||||
backgroundColor: "#e00000",
|
||||
borderColor: "#ffffff",
|
||||
hoverOffset: 6,
|
||||
},
|
||||
],
|
||||
};
|
||||
const config = {
|
||||
type: "bar",
|
||||
data: data,
|
||||
options: {
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: "white",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
let canvas = document.getElementById("sravn");
|
||||
let chart = new Chart(canvas, config)
|
||||
async function parseStats(stats) {
|
||||
let values = {
|
||||
valuedropped: [],
|
||||
datasdropped: [],
|
||||
valueused: [],
|
||||
datasused: [],
|
||||
valuecrafted: [],
|
||||
datascrafted: [],
|
||||
valuekilled_by: [],
|
||||
dataskilled_by: [],
|
||||
valuebroken: [],
|
||||
datasbroken: [],
|
||||
valuepicked_up: [],
|
||||
dataspicked_up: [],
|
||||
valuemined: [],
|
||||
datasmined: [],
|
||||
valuekilled: [],
|
||||
dataskilled: [],
|
||||
};
|
||||
// SORTING
|
||||
keysToSort.forEach((key) => {
|
||||
if (stats["stats"][key] && typeof stats["stats"][key] === "object") {
|
||||
stats["stats"][key] = Object.fromEntries(
|
||||
Object.entries(stats["stats"][key]).sort((a, b) => b[1] - a[1])
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//parsing
|
||||
keysToSort.forEach((key) => {
|
||||
let statistic = stats["stats"][key];
|
||||
statistic = Object.fromEntries(Object.entries(statistic).slice(0, 10));
|
||||
let keyy = key.replace("minecraft:", "");
|
||||
for (let item in statistic) {
|
||||
values["value" + keyy].push(translate(item, key));
|
||||
values["datas" + keyy].push(statistic[item]);
|
||||
}
|
||||
createPie(values["value" + keyy], values["datas" + keyy], keyy);
|
||||
});
|
||||
}
|
||||
function translate(item, type) {
|
||||
if (item.includes("minecraft:") === false) {
|
||||
return item;
|
||||
}
|
||||
let r;
|
||||
switch (type) {
|
||||
|
||||
case "minecraft:killed_by":
|
||||
r = locale["entity." + item];
|
||||
return r;
|
||||
case "minecraft:broken":
|
||||
r = locale["item." + item]
|
||||
return r
|
||||
case "minecraft:used":
|
||||
r = locale["item." + item]
|
||||
if (r === undefined) {
|
||||
r = locale["block." + item];
|
||||
}
|
||||
return r
|
||||
case "minecraft:killed":
|
||||
r = locale["entity." + item]
|
||||
return r
|
||||
case "minecraft:dropped":
|
||||
r = locale["item." + item];
|
||||
if (r === undefined) {
|
||||
r = locale["block." + item];
|
||||
}
|
||||
return r
|
||||
case "minecraft:crafted":
|
||||
r = locale["item." + item]
|
||||
if (r === undefined) {
|
||||
r = locale["block." + item];
|
||||
}
|
||||
return r
|
||||
case "minecraft:picked_up":
|
||||
r = locale["item." + item]
|
||||
if (r === undefined) {
|
||||
r = locale["block." + item];
|
||||
}
|
||||
return r
|
||||
case "minecraft:mined":
|
||||
r = locale["block." + item]
|
||||
return r
|
||||
}
|
||||
|
||||
async function createPie(items, datas, idcanvas) {
|
||||
|
||||
await charts.forEach((chart) => {
|
||||
chart.destroy();
|
||||
})
|
||||
|
||||
let bgcol = palette("tol-rainbow", items.length);
|
||||
for (let i = 0; i < bgcol.length; i++) {
|
||||
bgcol[i] = "#" + bgcol[i];
|
||||
}
|
||||
bgcol = bgcol.reverse();
|
||||
|
||||
const data = {
|
||||
labels: items,
|
||||
datasets: [
|
||||
{
|
||||
label: "количество",
|
||||
data: datas,
|
||||
backgroundColor: bgcol,
|
||||
hoverOffset: 6,
|
||||
},
|
||||
],
|
||||
};
|
||||
const config = {
|
||||
type: "doughnut",
|
||||
data: data,
|
||||
options: {
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: "white",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
let canvas = document.getElementById(idcanvas);
|
||||
charts.push(new Chart(canvas, config))
|
||||
}
|
||||
|
||||
async function createBar(value1, value2, stat) {
|
||||
chart.forEach((a) => {
|
||||
a.destroy();
|
||||
});
|
||||
|
||||
const data = {
|
||||
labels: [stat],
|
||||
datasets: [
|
||||
{
|
||||
label: "neroduckale",
|
||||
data: [value1],
|
||||
backgroundColor: "#34b8e9",
|
||||
borderColor: "#ffffff",
|
||||
hoverOffset: 6,
|
||||
},
|
||||
{
|
||||
label: "ygolek",
|
||||
data: [value2],
|
||||
backgroundColor: "#e00000",
|
||||
borderColor: "#ffffff",
|
||||
hoverOffset: 6,
|
||||
},
|
||||
],
|
||||
};
|
||||
const config = {
|
||||
type: "bar",
|
||||
data: data,
|
||||
options: {
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: "white",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
let canvas = document.getElementById("stat");
|
||||
chart.push(new Chart(canvas, config));
|
||||
}
|
||||
|
||||
async function changeBar(value1, value2, stat) {
|
||||
chart[0].data = {
|
||||
labels: [stat],
|
||||
datasets: [
|
||||
{
|
||||
label: "neroduckale",
|
||||
data: [value1],
|
||||
backgroundColor: "#34b8e9",
|
||||
borderColor: "#ffffff",
|
||||
hoverOffset: 6,
|
||||
},
|
||||
{
|
||||
label: "ygolek",
|
||||
data: [value2],
|
||||
backgroundColor: "#e00000",
|
||||
borderColor: "#ffffff",
|
||||
hoverOffset: 6,
|
||||
},
|
||||
],
|
||||
};
|
||||
chart[0].update();
|
||||
//перевод, cm -> blocks
|
||||
}
|
||||
function translate(item, type) {
|
||||
if (item.includes("minecraft:") === false) {
|
||||
return item;
|
||||
}
|
||||
let r;
|
||||
switch (type) {
|
||||
|
||||
case "minecraft:killed_by":
|
||||
r = locale["entity." + item];
|
||||
return r;
|
||||
case "minecraft:broken":
|
||||
r = locale["item." + item]
|
||||
return r
|
||||
case "minecraft:used":
|
||||
r = locale["item." + item]
|
||||
if (r === undefined) {
|
||||
r = locale["block." + item];
|
||||
}
|
||||
return r
|
||||
case "minecraft:killed":
|
||||
r = locale["entity." + item]
|
||||
return r
|
||||
case "minecraft:dropped":
|
||||
r = locale["item." + item];
|
||||
if (r === undefined) {
|
||||
r = locale["block." + item];
|
||||
}
|
||||
return r
|
||||
case "minecraft:crafted":
|
||||
r = locale["item." + item]
|
||||
if (r === undefined) {
|
||||
r = locale["block." + item];
|
||||
}
|
||||
return r
|
||||
case "minecraft:picked_up":
|
||||
r = locale["item." + item]
|
||||
if (r === undefined) {
|
||||
r = locale["block." + item];
|
||||
}
|
||||
return r
|
||||
case "minecraft:mined":
|
||||
r = locale["block." + item]
|
||||
return r
|
||||
}
|
||||
}
|
||||
|
||||
$('#ygolek').change(async function () {
|
||||
await parseStats(ygolekstats);
|
||||
return false;
|
||||
await parseStats(ygolekstats);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#nrdk').change(async function () {
|
||||
await parseStats(nrdkstats);
|
||||
return false;
|
||||
await parseStats(nrdkstats);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#choose').change(async function (event) {
|
||||
let a = event.target.value;
|
||||
await changeBar(nrdkstats["stats"]["minecraft:custom"]["minecraft:" + a], ygolekstats["stats"]["minecraft:custom"]["minecraft:" + a], a)
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
await getJsons();
|
||||
await parseStats(nrdkstats);
|
||||
await createBar();
|
||||
await createBar(nrdkstats["stats"]["minecraft:custom"]["minecraft:interact_with_crafting_table"], ygolekstats["stats"]["minecraft:custom"]["minecraft:interact_with_crafting_table"], "minecraft:interact_with_crafting_table");
|
||||
|
|
Loading…
Reference in a new issue