PK
ݥzA data/UT 2dzP2dzPux d PK
ݥzA data/entities/UT 2dzP2dzPux d PK
{AUq data/entities/fortress-grids.luaUT tڴP2dzPux 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
A hooks/UT )PPux d PK
Ag;^ hooks/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)
class:bindHook("ToME:PlayerDumpJSON", IV.hookPlayerDumpJSON)
PK
eAm init.luaUT uP*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 = {1,0,0}
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 2dzPPux d PK
{A overload/data/UT JڴP2dzPux d PK
A overload/data/chats/UT *PJڴPux d PK
A>j: : / overload/data/chats/items-vault-command-orb.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
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 not o.special and true or false
return profile:isDonator() and not o.quest and not o.special 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
ݥzA overload/data/maps/UT 2dzP2dzPux d PK
ݥzA overload/data/maps/items-vault/UT 2dzP2dzPux d PK
{Aɉ + overload/data/maps/items-vault/fortress.luaUT _P2dzPux 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
%#yA overload/engine/UT PPux d PK
%#yAv # 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
%#yA
overload/mod/UT PPux d PK
A overload/mod/dialogs/UT )PPux d PK
A4 4 # 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.used_items_vault = true
game.player:addObject(game.player.INVEN_INVEN, o)
game.zone:addEntity(game.level, o, "object")
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
A overload/mod/class/UT )PPux d PK
A" $ 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
function hookPlayerDumpJSON(self, data)
if self.used_items_vault then
data.js:hiddenData("used_items_vault", true)
end
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
ݥzA A data/UT 2dzPux d PK
ݥzA A? data/entities/UT 2dzPux d PK
{AUq data/entities/fortress-grids.luaUT tڴPux d PK
A A hooks/UT )Pux d PK
Ag;^ : hooks/load.luaUT )Pux d PK
eAm init.luaUT uPux d PK
ݥzA A overload/UT 2dzPux d PK
{A AL overload/data/UT JڴPux d PK
A A overload/data/chats/UT *Pux d PK
A>j: : / overload/data/chats/items-vault-command-orb.luaUT *Pux d PK
ݥzA A overload/data/maps/UT 2dzPux d PK
ݥzA A overload/data/maps/items-vault/UT 2dzPux d PK
{Aɉ + +! overload/data/maps/items-vault/fortress.luaUT _Pux d PK
%#yA A) overload/engine/UT Pux d PK
%#yAv # c) overload/engine/EntityVaultSave.luaUT Pux d PK
%#yA
A/ overload/mod/UT Pux d PK
A A/ overload/mod/dialogs/UT )Pux d PK
A4 4 # <0 overload/mod/dialogs/ItemsVault.luaUT )Pux d PK
A A? overload/mod/class/UT )Pux d PK
A" $ @ overload/mod/class/ItemsVaultDLC.luaUT )Pux d PK - pS