PK zAdata/UT ƳPCPux dPK N|Adata/entities/UT ѵPLPux dPK N|AUq data/entities/fortress-grids.luaUT ѵPѵPux d-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org newEntity{ define_as = "ITEMS_VAULT", name = "Item's Vault Control Orb", image = "terrain/solidwall/solid_floor1.png", add_displays = {class.new{image="terrain/pedestal_orb_02.png", display_y=-1, display_h=2}}, display = '*', color=colors.LIGHT_BLUE, notice = true, always_remember = true, block_move = function(self, x, y, e, act, couldpass) if e and e.player and act then local chat = require("engine.Chat").new("items-vault-command-orb", self, e, {player=e}) chat:invoke() end return true end, } PK N|Ahooks/UT ѵPPux dPK N|AFFhooks/load.luaUT ѵPѵPux d-- ToME - Tales of Maj'Eyal: -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org local class = require"engine.class" local IV = require("mod.class.ItemsVaultDLC") class:bindHook("MapGeneratorStatic:subgenRegister", IV.hookMapGeneratorStaticSubgenRegister) class:bindHook("Entity:loadList", IV.hookEntityLoadList) class:bindHook("DonationDialog:features", IV.hookDonationDialogFeatures) PK R^Ainit.luaUT {2PѵPux d-- ToME - Tales of Maj'Eyal: -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org long_name = "Items Vault" short_name = "items-vault" for_module = "tome" version = {0,9,44} weight = 1 author = { "DarkGod", "darkgod@te4.org" } homepage = "http://te4.org/" description = [[Adds access to the items vault (donator feature). The items vault will let you upload a few unwanted items to your online profile and retrieve them on other characters.]] overload = true --superload = true hooks = true data = true --dlc = 5 PK ]zA overload/UT PPux dPK N|Aoverload/data/UT ѵPPux dPK N|Aoverload/data/chats/UT ѵPѵPux dPK  A. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org newChat{ id="welcome", text = profile:isDonator() and [[*#LIGHT_GREEN#This orb seems to be some kind of interface to an extra-dimentional vault of items. All your characters in alternate universes will be able to access it from here. Only items from a validated game versions are uploadable.#WHITE#* #GOLD#Donator's Feature#ANCIENT_WHITE#: Items are saved on the server, only donators have access to this feature and the number of items storable at once depends on your generosity. I, DarkGod, the maker of this game want to personaly thank all donators because you people are keeping this game going. Thanks and enjoy!]] or [[*#LIGHT_GREEN#This orb seems to be some kind of interface to an extra-dimentional vault of items. All your characters in alternate universes will be able to access it from here. Only items from a validated game versions are uploadable.#WHITE#* #GOLD#Donator's Feature#ANCIENT_WHITE#: Items are saved on the server, only donators have access to this feature and the number of items storable at once depends on your generosity. If you wish to help the game select the donation option below a link will open in your browser. Make sure you are logged into your profile so the donation is registered to you. I, DarkGod, the maker of this game want to personaly thank all donators because you people are keeping this game going. Thanks and enjoy!]], answers = { {"[Place an item in the vault]", cond=function() return profile:isDonator() end, action=function(npc, player) local inven = player:getInven(player.INVEN_INVEN) local titleupdator = player:getEncumberTitleUpdator("Place an item in the Item's Vault") local d d = player:showInventory(titleupdator(), inven, function(o) -- return profile:isDonator() and not o.quest and true or false return profile:isDonator() and not o.quest and not game:isTainted() and profile.hash_valid and true or false end, function(o, item) local req = rawget(o, "require") if not req then local lev = 0 local ml = o.material_level or 1 if ml <= 2 then lev = 0 else lev = 15 + (ml - 3) * 10 end if lev > 0 then require("engine.ui.Dialog"):yesnoPopup("Requirements", ("Transfering this item will place a level %d requirement on it, since it has no requirements. Continue?"):format(lev), function(ret) if ret then o.require = {level=lev} require("mod.class.ItemsVaultDLC").transferToVault(player, o, inven, item) end end) else require("mod.class.ItemsVaultDLC").transferToVault(player, o, inven, item) end else require("mod.class.ItemsVaultDLC").transferToVault(player, o, inven, item) end end) end}, {"[Retrieve an item from the vault]", cond=function() return profile:isDonator() end, action=function() game:registerDialog(require("mod.dialogs.ItemsVault").new()) end}, {"#GOLD#I wish to help the funding of this game and donate#WHITE#", action=function() game:registerDialog(require("mod.dialogs.Donation").new()) end}, {"[Leave the orb alone]"}, } } return "welcome" PK zAoverload/data/maps/UT ƳPPux dPK N|Aoverload/data/maps/items-vault/UT ѵPPux dPK N|Aɉ+overload/data/maps/items-vault/fortress.luaUT ѵPѵPux d-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -- ToME - Tales of Maj'Eyal -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -- defineTile section defineTile("#", nil, nil, nil, nil, {__no_import=true}) -- simply dont override old features defineTile(".", "SOLID_FLOOR") defineTile("1", "ITEMS_VAULT") -- addSpot section -- addZone section addZone({1, 1, 3, 5}, "zonename", "Temporal Locked Vault") -- ASCII map section return [[ ######.# #...##.# #.1....# #...#### ########]] PK ]zA overload/mod/UT PPux dPK ^~Aoverload/mod/class/UT .PPux dPK ^~A :eexx$overload/mod/class/ItemsVaultDLC.luaUT .P.Pux d-- ToME - Tales of Maj'Eyal: -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org local class = require "class" local Dialog = require "engine.ui.Dialog" module(..., package.seeall, class.make) -------------------------------------------------------------------------------------------------- -- Hooks -------------------------------------------------------------------------------------------------- function hookDonationDialogFeatures(self, data) data.list[#data.list+1] = "the #GOLD#Item's Vault#WHITE#" end function hookMapGeneratorStaticSubgenRegister(self, data) if data.mapfile ~= "zones/shertul-fortress" then return end data.list[#data.list+1] = { x = 11, y = 42, w = 8, h = 6, overlay = true, generator = "engine.generator.map.Static", data = { map = "items-vault/fortress", }, } end function hookEntityLoadList(self, data) if data.file ~= "/data/zones/shertul-fortress/grids.lua" then return end self:loadList("/data-items-vault/entities/fortress-grids.lua", data.no_default, data.res, data.mod, data.loaded) end -------------------------------------------------------------------------------------------------- -- Data transfers -------------------------------------------------------------------------------------------------- function transferToVault(actor, o, inven, item) local ok1, ok2 = pcall(function() if not o.__items_vault then o.desc = o.desc.."\n#CRIMSON#This item has been sent to the Item's Vault." end o.__items_vault = true savefile_pipe:push(o.name, "entity", o, "engine.EntityVaultSave", function(save) fs.mkdir("/tmp") f = fs.open("/tmp/"..save:nameSaveEntity(o), "r") if f then local data = {} while true do local l = f:read() if not l then break end data[#data+1] = l end f:close() profile:entityVaultPoke(game.__mod_info.short_name, 'object', o:getName{do_color=1, no_image=1}:toString(), o:getDesc{do_color=1, no_image=1}:toString(), table.concat(data)) local popup = Dialog:simpleWaiter("Transfering...", "Teleporting object to the vault, please wait...") core.display.forceRedraw() local done = false profile:waitEvent("EntityPoke", function(e) if e.ok then local o = actor:removeObject(inven, item, true) game.logPlayer(actor, "#LIGHT_BLUE#You transfer %s to the online item's vault.", o:getName{do_colour=true, do_count=true}) actor:sortInven() game:onTickEnd(function() game:saveGame() end) done = true end end, 10000) popup:done() if not done then game.logPlayer(actor, "#LIGHT_RED#Error while transfering %s to the online item's vault, please retry later.", o:getName{do_colour=true, do_count=true}) end end fs.delete("/tmp/"..save:nameSaveEntity(o)) end) return true end) end function transferFromVault(id) profile:entityVaultPeek(game.__mod_info.short_name, 'object', id) local popup = Dialog:simpleWaiter("Transfering...", "Teleporting object from the vault, please wait...") core.display.forceRedraw() local done = false profile:waitEvent("EntityPeek", function(e) if e.ok then local o = nil fs.mkdir("/tmp") fs.delete("/tmp/__tmp_entity.entity") local f = fs.open("/tmp/__tmp_entity.entity", "w") if f then f:write(e.data) f:close() savefile_pipe:ignoreSaveToken(true) o = savefile_pipe:doLoad("", "entity", "engine.EntityVaultSave", "__tmp_entity.entity") savefile_pipe:ignoreSaveToken(false) fs.delete("/tmp/__tmp_entity.entity") if o then profile:entityVaultEmpty(game.__mod_info.short_name, 'object', id) end end done = o end end, 10000) popup:done() return done end function listVault() profile:entityVaultInfos(game.__mod_info.short_name, 'object') local popup = Dialog:simpleWaiter("Item's Vault", "Checking item's vault list, please wait...") core.display.forceRedraw() local done = false profile:waitEvent("EntityInfos", function(e) done = e.data end, 10000) popup:done() if done then done = done:unserialize() else done = {list={}, max=0} end return done end PK N|Aoverload/mod/dialogs/UT ѵPPux dPK N|AcU#overload/mod/dialogs/ItemsVault.luaUT ѵPѵPux d-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org require "engine.class" local Dialog = require "engine.ui.Dialog" local ListColumns = require "engine.ui.ListColumns" local Textzone = require "engine.ui.Textzone" local Separator = require "engine.ui.Separator" local Image = require "engine.ui.Image" local IV = require "mod.class.ItemsVaultDLC" module(..., package.seeall, class.inherit(Dialog)) function _M:init() self:generateList() Dialog.init(self, ("Item's Vault (%d/%d)"):format(#self.iv.list, self.iv.max), game.w * 0.8, game.h * 0.8) local txt = Textzone.new{width=math.floor(self.iw - 10), auto_height=true, text=[[Retrieve an item from the vault. When you place an item in the vault the paradox energies around it are so powerful you must wait one hour before retrieving it. #CRIMSON#Warning: while you *can* retrieve items made with previous versions of the game, no guaranty is given that the universe (or your character) will not explode.]]} self.c_list = ListColumns.new{width=math.floor(self.iw - 10), height=self.ih - 10, scrollbar=true, sortable=true, columns={ {name="Name", width=70, display_prop="name", sort="name"}, {name="Usable", width=30, display_prop="usable_txt", sort="usable_txt"}, }, list=self.list, fct=function(item) self:import(item) end, select=function(item, sel) self:select(item) end} self:loadUI{ {left=0, top=0, ui=txt}, {left=0, top=txt.h + 20, ui=self.c_list}, } self:setFocus(self.c_list) self:setupUI() self.key:addBinds{ EXIT = function() game:unregisterDialog(self) end, } end function _M:generateList() local infos = IV.listVault() self.iv = infos -- Makes up the list local list = {} for i, d in ipairs(infos.list) do if d.usable then d.usable_txt = "#LIGHT_GREEN#Yes" else if d.sec_until / 60 < 1 then d.usable_txt = "#LIGHT_RED#In less than one minute" else d.usable_txt = ("#LIGHT_RED#In %d minutes"):format(math.ceil(d.sec_until / 60)) end end list[#list+1] = d end -- Add known artifacts table.sort(list, function(a, b) return a.name < b.name end) self.list = list end function _M:select(item) if not item then return end if self.cur == item then return end self.cur = item if item.last_display_x then game:tooltipDisplayAtMap(item.last_display_x + self.c_list.w, item.last_display_y, item.desc) end end function _M:import(item) if not item then return end if not item.usable then self:simplePopup("Cooldown", "This item has been placed recently in the vault, you must wait a bit before removing it.") return end local o = IV.transferFromVault(item.id_entity) if o then game.player:addObject(game.player.INVEN_INVEN, o) game.player:sortInven() game:saveGame() game.log("#LIGHT_BLUE#You transfer %s from the online item's vault.", o:getName{do_colour=true, do_count=true}) else game.log("#LIGHT_RED#Error while transfering from the online item's vault, please retry later.") end self:generateList() self.c_list:setList(self.list, true) self:updateTitle(("Item's Vault (%d/%d)"):format(#self.iv.list, self.iv.max)) endPK J~zAoverload/engine/UT PPux dPK J~zAv#overload/engine/EntityVaultSave.luaUT PPux d-- TE4 - T-Engine 4 -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org require "engine.class" local Savefile = require "engine.Savefile" --- Handles a local characters vault saves module(..., package.seeall, class.inherit(Savefile)) function _M:init(savefile, coroutine) Savefile.init(self, savefile, coroutine) self.short_name = "__tmp_entity" self.save_dir = "/tmp/" self.quickbirth_file = "/tmp/useless.quickbirth" self.load_dir = "/tmp/loadsave/" end --- Get a savename for an entity function _M:nameSaveEntity(e) e.__version = game.__mod_info.version return "__tmp_entity.entity" end --- Get a savename for an entity function _M:nameLoadEntity(name) return "__tmp_entity.entity" end --- Save an entity function _M:saveEntity(e, no_dialog) Savefile.saveEntity(self, e, no_dialog) end PK N~A%Tkksvn-commit.tmpUT atP_tPux dplop --This line, and those below, will be ignored-- M overload/data/chats/items-vault-command-orb.lua PK zAAdata/UTƳPux dPK N|AA?data/entities/UTѵPux dPK N|AUq data/entities/fortress-grids.luaUTѵPux dPK N|AAhooks/UTѵPux dPK N|AFF:hooks/load.luaUTѵPux dPK R^A init.luaUT{2Pux dPK ]zA Aoverload/UTPux dPK N|AAoverload/data/UTѵPux dPK N|AAXoverload/data/chats/UTѵPux dPK  A