Creating Shards
Introducing shards, a new way of binding and encrypting your folder into a single file.
To build shards, you have to add a shard table to your header.lua, which contains all the names of your files you would use in module.load(id, name).
If you build a libshard, lib = true has to be added additionally.
-- this file is also in gbk charset
local isCN = hanbot and hanbot.language == 1
local supported = {
Ashe = true,
Lux = true,
}
return {
id = "some_unique_name",
name = isCN and "你好" or "Hello",
author = "aaa",
description = [[]],
shard = {
'main',
'spells/q',
},
-- menu will be loaded by this order: "Orbwalker" / "Evade" / "Utility" / "Other" / "Champion"
type = "Champion", -- if this shard is a champion plugin
-- current shard will not be loaded when "load" return failed.
load = function ()
return supported[player.charName]
end
}Additionally you can bind sprites into a shard by adding it's names to a resource table.
WARNING
The resource is shared between ALL plugins, it is better to have a unique name.
return {
...
...
shard = {
'main', 'spells/q',
},
resources = {
'SPRITE_NAME.png', —developer/SHARD_NAME/SPRITE_NAME.png
'SUB_FOLDER/SPRITE_NAME.png', —developer/SHARD_NAME/SUB_FOLDER/SPRITE_NAME.png
},
hprotect = true, -- enable the enhanced protection to protect your source code
-- lib = true, -- build a libshard
}TIP
Note that the sprite name added to the resource folder is the same as when using it ingame.
cb.add(cb.sprite, function()
graphics.draw_sprite('SPRITE_NAME.png', vec2)
graphics.draw_sprite('SUB_FOLDER/SPRITE_NAME.png', vec2)
end)Shard builder is available in the developer group.
WARNING
There is no error handling for the shard builder.
Make sure your script is working ingame, has a valid header and the folder name is being input correctly.
Do not build shards out of scripts that already use the crypt module.