From 2c20692f33cadc75edf279e2f0bed032d083b56d Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Sun, 15 Apr 2018 01:09:38 +0200 Subject: Added support for 1.8er Skins --- api.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'api.lua') diff --git a/api.lua b/api.lua index a0259cd..5cd9821 100644 --- a/api.lua +++ b/api.lua @@ -43,3 +43,22 @@ function skins.set_player_skin(player, skin) end return success end + +-- Check Skin format (code stohlen from stu's multiskin) +function skins.get_skin_format(file) + file:seek("set", 1) + if file:read(3) == "PNG" then + file:seek("set", 16) + local ws = file:read(4) + local hs = file:read(4) + local w = ws:sub(3, 3):byte() * 256 + ws:sub(4, 4):byte() + local h = hs:sub(3, 3):byte() * 256 + hs:sub(4, 4):byte() + if w >= 64 then + if w == h then + return "1.8" + elseif w == h * 2 then + return "1.0" + end + end + end +end -- cgit v1.2.3