summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
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