diff --git a/init.lua b/init.lua index 633defc..d317dc5 100644 --- a/init.lua +++ b/init.lua @@ -72,8 +72,7 @@ i3.files.groups() i3.files.callbacks() local storage = core.get_mod_storage() -local slz, dslz, ESC, str_to_pos, add_hud_waypoint = - i3.get("slz", "dslz", "ESC", "str_to_pos", "add_hud_waypoint") +local slz, dslz, str_to_pos, add_hud_waypoint = i3.get("slz", "dslz", "str_to_pos", "add_hud_waypoint") i3.data = dslz(storage:get_string "data") or {} @@ -142,7 +141,7 @@ local function init_data(player, info) i3.data[name] = i3.data[name] or {} local data = i3.data[name] - data.player_name = ESC(name) + data.player_name = name data.filter = "" data.pagenum = 1 data.items = i3.init_items diff --git a/src/bags.lua b/src/bags.lua index a7a23b2..99c0264 100644 --- a/src/bags.lua +++ b/src/bags.lua @@ -1,5 +1,5 @@ -local S, ES, fmt, clr, msg, slz, dslz, play_sound, create_inventory = - i3.get("S", "ES", "fmt", "clr", "msg", "slz", "dslz", "play_sound", "create_inventory") +local S, ES, fmt, clr, msg, slz, dslz = i3.get("S", "ES", "fmt", "clr", "msg", "slz", "dslz") +local play_sound, create_inventory = i3.get("play_sound", "create_inventory") local function get_content_inv(name) return core.get_inventory { @@ -13,15 +13,14 @@ local function get_content(content) for i, v in pairs(content) do local stack = ItemStack(v.name) - local meta, wear = v.meta, v.wear - if meta then + if v.meta then local m = stack:get_meta() - m:from_table(meta) + m:from_table(v.meta) end - if wear then - stack:set_wear(wear) + if v.wear then + stack:set_wear(v.wear) end t[i] = stack diff --git a/src/gui.lua b/src/gui.lua index c979e12..9134f5b 100644 --- a/src/gui.lua +++ b/src/gui.lua @@ -288,7 +288,9 @@ end local function get_container(fs, data, player, yoffset, ctn_len, award_list, awards_unlocked, award_list_nb) local name = data.player_name - add_subtitle(fs, "player_name", 0, ctn_len, 22, true, name) + local esc_name = ESC(name) + + add_subtitle(fs, "player_name", 0, ctn_len, 22, true, esc_name) if damage_enabled then local hp = data.hp or player:get_hp() or 20 @@ -340,17 +342,25 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa end if data.subcat == 1 then - fs(fmt("list[detached:i3_bag_%s;main;0,%f;1,1;]", name, yextra + 0.7)) + fs(fmt("list[detached:i3_bag_%s;main;0,%f;1,1;]", esc_name, yextra + 0.7)) - local inv = core.get_inventory { - type = "detached", - name = fmt("i3_bag_%s", data.player_name) - } + local inv = core.get_inventory{type = "detached", name = fmt("i3_bag_%s", name)} if not inv:is_empty"main" then + local h, m, yy = 4.75, 10, 0 + + if data.bag_size == 1 then + h, m, yy = 1.9, 2, 0.12 + elseif data.bag_size == 2 then + h, m, yy = 3.05, 5, 0.06 + elseif data.bag_size == 3 then + h, m = 4.2, 10 + end + fs("image", 0.5, yextra + 1.85, 0.6, 0.6, PNG.arrow_content) - fs(fmt("style[content;bgimg=%s;fgimg=i3_blank.png;bgimg_middle=10,10;sound=]", PNG.bg_content)) - fs("image_button", 1.1, yextra + 0.5, 4.75, 4.75, "", "content", "") + fs(fmt("style[content;bgimg=%s;fgimg=i3_blank.png;bgimg_middle=10,%u;sound=]", + PNG.bg_content, m)) + fs("image_button", 1.1, yextra + 0.5 + yy, 4.75, h, "", "content", "") fs("hypertext", 1.3, yextra + 0.8, 4.3, 0.6, "content", fmt("
%s
", ES"Content")) @@ -361,13 +371,14 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa end fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing)) - fs(fmt("list[detached:i3_bag_content_%s;main;%f,%f;4,%u;]", name, x, yextra + 1.3, data.bag_size)) + fs(fmt("list[detached:i3_bag_content_%s;main;%f,%f;4,%u;]", + esc_name, x, yextra + 1.3, data.bag_size)) fs("style_type[list;size=1;spacing=0.15]") end elseif data.subcat == 2 then if i3.modules.armor then - fs(fmt("list[detached:%s_armor;armor;0,%f;3,2;]", name, yextra + 0.7)) + fs(fmt("list[detached:%s_armor;armor;0,%f;3,2;]", esc_name, yextra + 0.7)) local armor_def = armor.def[name] @@ -538,7 +549,15 @@ local function get_inventory_fs(player, data, fs) local max_val = damage_enabled and 12 or 7 if data.subcat == 1 and data.bag_size then - max_val = max_val + 32 + if data.bag_size == 1 then + max_val = max_val + 6 + elseif data.bag_size == 2 then + max_val = max_val + 16 + elseif data.bag_size == 3 then + max_val = max_val + 26 + else + max_val = max_val + 32 + end elseif i3.modules.armor and data.subcat == 2 then if data.scrbar_inv >= max_val then