Skip to content
Snippets Groups Projects
Commit 98bf0cfa authored by DarkGod's avatar DarkGod
Browse files

mtx

parent 354aea80
No related branches found
No related tags found
No related merge requests found
......@@ -739,6 +739,22 @@ end
--- Make a module loadscreen
function _M:loadScreen(mod)
mod.waiter_load_ui = mod.waiter_load_ui or "dark-ui"
local left
local right
local middle
local bar
local function swap_ui(ui)
if fs.exists("/data/gfx/"..ui.."/waiter/left.png") and fs.exists("/data/gfx/"..ui.."/waiter/right.png") and fs.exists("/data/gfx/"..ui.."/waiter/middle.png") and fs.exists("/data/gfx/"..ui.."/waiter/bar.png") then
left = {core.display.loadImage("/data/gfx/"..ui.."/waiter/left.png"):glTexture()}
right = {core.display.loadImage("/data/gfx/"..ui.."/waiter/right.png"):glTexture()}
middle = {core.display.loadImage("/data/gfx/"..ui.."/waiter/middle.png"):glTexture()}
bar = {core.display.loadImage("/data/gfx/"..ui.."/waiter/bar.png"):glTexture()}
end
end
swap_ui(mod.waiter_load_ui)
core.display.forceRedraw()
core.wait.enable(10000, function()
local has_max = mod.loading_wait_ticks
......@@ -757,13 +773,6 @@ function _M:loadScreen(mod)
end
if pubimg then publisher = {pubimg:glTexture()} end
mod.waiter_load_ui = mod.waiter_load_ui or "dark-ui"
local left = {core.display.loadImage("/data/gfx/"..mod.waiter_load_ui.."/waiter/left.png"):glTexture()}
local right = {core.display.loadImage("/data/gfx/"..mod.waiter_load_ui.."/waiter/right.png"):glTexture()}
local middle = {core.display.loadImage("/data/gfx/"..mod.waiter_load_ui.."/waiter/middle.png"):glTexture()}
local bar = {core.display.loadImage("/data/gfx/"..mod.waiter_load_ui.."/waiter/bar.png"):glTexture()}
local font = FontPackage:get("small")
local bfont = FontPackage:get("default")
......@@ -909,6 +918,7 @@ function _M:loadScreen(mod)
end
end)
core.display.forceRedraw()
return swap_ui
end
......@@ -983,7 +993,7 @@ function _M:instanciate(mod, name, new_game, no_reboot, extra_module_info)
-- Display the loading bar
profile.waiting_auth_no_redraw = true
self:loadScreen(mod)
local loader_swap_ui = self:loadScreen(mod)
core.wait.addMaxTicks(savesize)
-- Check MD5sum with the server
......@@ -1030,6 +1040,11 @@ function _M:instanciate(mod, name, new_game, no_reboot, extra_module_info)
local hashlist = self:loadAddons(mod, (save_desc and save_desc.addons) or (__module_extra_info.set_addons))
-- HACK! I feel so dirty :<
if config.settings and config.settings.tome and config.settings.tome.ui_theme3 then
loader_swap_ui(config.settings.tome.ui_theme3.."-ui")
end
-- Check all hashes at once
hashlist[#hashlist+1] = {module=mod.version_name, md5=module_md5}
hash_valid, hash_err = profile:checkBatchHash(hashlist)
......
......@@ -316,20 +316,28 @@ function _M:installShimmer(item)
local hooks_list = {}
Module:loadAddon(game.__mod_info, add, {}, hooks_list)
dofile("/data/gfx/mtx-shimmers/"..item.effect..".lua")
local f, err = loadfile("/data/gfx/mtx-shimmers/"..item.effect..".lua")
if f then f("install") else print(err) end
Dialog:simplePopup(item.name, _t[[Shimmer pack installed!]])
if item.is_shimmer then
Dialog:simplePopup(item.name, _t[[Shimmer pack installed!]])
end
break
end end
if not found then
Dialog:simpleLongPopup(item.name, _t[[Could not dynamically link addon to current character, maybe the installation weng wrong.
You can fix that by manually downloading the shimmer addon from https://te4.org/ and placing it in game/addons/ folder.]], 600)
You can fix that by manually downloading the addon from https://te4.org/ and placing it in game/addons/ folder.]], 600)
end
end
local co co = coroutine.create(function()
local filename = ("/addons/%s-cosmetic-%s.teaa"):format(game.__mod_info.short_name, item.effect)
local filename
if item.is_teaac then
filename = ("/addons/cosmetic-%s.teaac"):format(item.effect)
else
filename = ("/addons/%s-cosmetic-%s.teaa"):format(game.__mod_info.short_name, item.effect)
end
print("==> downloading", "https://te4.org/download-mtx/"..item.id_purchasable, filename)
local d = Downloader.new{title=("Downloading cosmetic pack: #LIGHT_GREEN#%s"):tformat(item.name), co=co, dest=filename..".tmp", url="https://te4.org/download-mtx/"..item.id_purchasable, allow_downloads={addons=true}}
local ok = d:start()
......@@ -355,7 +363,7 @@ function _M:paymentSuccess()
local list = {}
for id, ok in pairs(self.cart) do if ok then
local item = self.purchasables[id]
if item.is_shimmer then
if item.is_shimmer or item.is_uipack then
self:installShimmer(item)
list[#list+1] = ("- #{bold}##ROYAL_BLUE#%s #SLATE#x%d#WHITE##{normal}#: The pack should be downloading or even finished by now."):tformat(item.name, item.nb_purchase)
elseif item.self_event or item.community_event then
......@@ -487,6 +495,9 @@ To activate it you will need to have your online events option set to "all" (whi
text[#text+1] = _t[[#{bold}##GOLD#Shimmer Pack#WHITE##{normal}#: Once purchased the game will automatically install the shimmer pack to your game and enable it for your current character too (you will still need to use the Mirror of Reflection to switch them on).
#LIGHT_GREEN#Bonus perk:#LAST# purchasing any shimmer pack will also give your characters a portable Mirror of Reflection to be able to change your appearance anywhere, anytime!]]
end
if item.is_uipack then
text[#text+1] = _t[[#{bold}##GOLD#UI Pack#WHITE##{normal}#: Once purchased the game will automatically install the UI pack to your game.]]
end
if item.effect == "vaultspace" then
text[#text+1] = _t[[#{bold}##GOLD#Vault Space#WHITE##{normal}#: Once purchased your vault space is permanently increased.]]
end
......
......@@ -90,7 +90,7 @@ Make sure you have #GOLD##{bold}#Allow online events#WHITE##{normal}# in the #GO
return
end
if item.is_shimmer then
if item.is_shimmer or item.is_uipack then
game:unregisterDialog(self)
if item.is_installed then
Dialog:simplePopup(item.name, _t"This pack is already installed and in use for your character.")
......@@ -135,7 +135,7 @@ function _M:generateList()
for _, item in ipairs(e.list) do
item.img = Entity.new{image=item.image}
item.display_name = item.img:getDisplayString().." "..item.name
if item.is_shimmer then
if item.is_shimmer or item.is_uipack then
local pack_name = "cosmetic-"..item.effect
if game.__mod_info.addons and game.__mod_info.addons[pack_name] then
item.nb_available = _t"#LIGHT_GREEN#Installed"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment