Upload via GUI (146 Dateien)
This commit is contained in:
+29
-1
@@ -176,4 +176,32 @@ function waehleAnzeigeSkin(kontoProfil, spiel, kuerzlichGeaendert) {
|
||||
return Object.assign({}, kontoProfil, { skinUrl: spiel.skinUrl, variante: spiel.variante, skinAusSpiel: true });
|
||||
}
|
||||
|
||||
module.exports = { setzeSkin, setzeSkinZurueck, holeProfil, pruefeDatei, aufHttps, setzeUmhang, holeSpielTexturen, waehleAnzeigeSkin };
|
||||
/*
|
||||
* Für welche Armform ist eine Skin-Datei gemalt? Breite Arme (Steve) sind 4
|
||||
* Pixel breit, schmale (Alex) 3 – bei schmalen bleiben deshalb je Arm zwei
|
||||
* Pixelspalten der Rückseite leer: rechter Arm x 54–55 / y 20–31, linker Arm
|
||||
* x 46–47 / y 52–63. bitmap: Rohdaten mit 4 Byte je Pixel (Alpha an Stelle 3).
|
||||
* -> 'classic' | 'slim' | null (nicht eindeutig, alte 64×32-Skins: classic)
|
||||
*/
|
||||
function armformDerTextur(bitmap, breite, hoehe) {
|
||||
if (!bitmap || !breite || breite % 64 !== 0 || hoehe % 32 !== 0) return null;
|
||||
const f = breite / 64; // HD-Skins (128×128 …) mitskalieren
|
||||
if (Math.round(hoehe / f) === 32) return 'classic';
|
||||
if (Math.round(hoehe / f) !== 64) return null;
|
||||
let deckend = 0, gesamt = 0;
|
||||
const pruefe = (x0, y0) => {
|
||||
for (let y = y0 * f; y < (y0 + 12) * f; y++) {
|
||||
for (let x = x0 * f; x < (x0 + 2) * f; x++) {
|
||||
gesamt++;
|
||||
if (bitmap[(y * breite + x) * 4 + 3] > 0) deckend++;
|
||||
}
|
||||
}
|
||||
};
|
||||
pruefe(54, 20);
|
||||
pruefe(46, 52);
|
||||
if (deckend >= gesamt * 0.85) return 'classic';
|
||||
if (deckend <= gesamt * 0.1) return 'slim';
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = { setzeSkin, setzeSkinZurueck, holeProfil, pruefeDatei, aufHttps, setzeUmhang, holeSpielTexturen, waehleAnzeigeSkin, armformDerTextur };
|
||||
|
||||
Reference in New Issue
Block a user