summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
authorAlexander Weber <web.alexander@web.de>2018-04-15 01:09:38 +0200
committerAlexander Weber <web.alexander@web.de>2018-04-16 16:17:42 +0200
commit2c20692f33cadc75edf279e2f0bed032d083b56d (patch)
treed5e63e14b9e2675129267ee69abc66c67cd8a13d /api.lua
parent45edbf808ac0a74e4da6b468c2bf87b8b49e02a0 (diff)
Added support for 1.8er Skins
Diffstat (limited to 'api.lua')
-rw-r--r--api.lua19
1 files changed, 19 insertions, 0 deletions
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