diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 9e840ec89590c4f1224d6d1da5daa5665d3328ab..9279526bb47152ae3622006004c82b7829c50e81 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -250,6 +250,14 @@ function _M:newGame() self.state = GameState.new{} local birth_done = function() if self.player.__allow_rod_recall then game.state:allowRodRecall(true) self.player.__allow_rod_recall = nil end + if self.player.__allow_transmo_chest and profile.mod.allow_build.transmo_chest then + self.player.__allow_transmo_chest = nil + local chest = game.zone:makeEntityByName(game.level, "object", "TRANSMO_CHEST") + if chest then + game.zone:addEntity(game.level, chest, "object") + self.player:addObject(self.player:getInven("INVEN"), chest) + end + end for i = 1, 50 do local o = self.state:generateRandart(true) diff --git a/game/modules/tome/data/birth/descriptors.lua b/game/modules/tome/data/birth/descriptors.lua index 06f146bb953f8afd95289b291ce70763a16e43c2..b3f5268c0448a5d267114eb7f198871980e027e0 100644 --- a/game/modules/tome/data/birth/descriptors.lua +++ b/game/modules/tome/data/birth/descriptors.lua @@ -130,6 +130,7 @@ newBirthDescriptor{ easy_mode_lifes = 99999, __game_difficulty = 1, __allow_rod_recall = false, + __allow_transmo_chest = false, }, } newBirthDescriptor{ diff --git a/game/modules/tome/data/birth/worlds.lua b/game/modules/tome/data/birth/worlds.lua index b8a79d473d2ac697be55bea5f1422b23f4aee8a4..6fec99f9b0d61869518c9a0c1162c7c1690200ee 100644 --- a/game/modules/tome/data/birth/worlds.lua +++ b/game/modules/tome/data/birth/worlds.lua @@ -75,6 +75,7 @@ newBirthDescriptor{ descriptor_choices = default_eyal_descriptors{}, copy = { __allow_rod_recall = true, + __allow_transmo_chest = true, } } @@ -94,6 +95,8 @@ newBirthDescriptor{ }, descriptor_choices = default_eyal_descriptors{ difficulty = { Tutorial = "never"} }, copy = { + __allow_transmo_chest = true, + -- Can levelup forever resolvers.generic(function(e) e.max_level = nil end), no_points_on_levelup = function(self) diff --git a/game/modules/tome/data/chats/shertul-fortress-butler.lua b/game/modules/tome/data/chats/shertul-fortress-butler.lua index 12027c3fa937b7fdfc1b7deb48ff0267f0268902..8925fa74077b171499b8ce1168e50e3e4bb9a19d 100644 --- a/game/modules/tome/data/chats/shertul-fortress-butler.lua +++ b/game/modules/tome/data/chats/shertul-fortress-butler.lua @@ -99,7 +99,16 @@ However, the Fortess is badly damaged and has lain dormant for too long. Its ene Take this Transmogrification Chest. It is linked by a permanent farportal to the Fortress. Any item you put inside will be sent to the power core and dismantled for energy. There are, however, unwanted byproducts to this operation: the generation of a metal known as gold. It is of no use to the Fortress and thus will be sent back to you.]], answers = { - {"I will, thanks.", jump="welcome", action=function() q:spawn_transmo_chest() end}, + {"I will, thanks.", jump="welcome", action=function() q:spawn_transmo_chest() end, cond=function(npc, player) return not player:attr("has_transmo") end}, + {"I have already found such a chest in my travel, will it work?", jump="alreadychest", cond=function(npc, player) return player:attr("has_transmo") end}, + } +} + +newChat{ id="alreadychest", + text = [[Yes it will, I will attune it to this fortress. +Done.]], + answers = { + {"Thanks.", jump="welcome"}, } } diff --git a/game/modules/tome/data/general/objects/quest-artifacts.lua b/game/modules/tome/data/general/objects/quest-artifacts.lua index 64b920a7e08defca95e9a1e4e714bbb67cf22563..328a2448fa5e9f7a95cce07e4272f5677a5e2ef3 100644 --- a/game/modules/tome/data/general/objects/quest-artifacts.lua +++ b/game/modules/tome/data/general/objects/quest-artifacts.lua @@ -348,3 +348,62 @@ You have heard of such items before. They are very useful to adventurers, allowi end end, } + +newEntity{ base = "BASE_WAND", + power_source = {unknown=true, arcane=false}, + type = "chest", subtype = "sher'tul", + define_as = "TRANSMO_CHEST", + add_name = false, + identified=true, force_lore_artifact=true, + name = "Transmogrification Chest", display = '~', color=colors.GOLD, unique=true, image = "object/chest4.png", + desc = [[This chest is an extension of Yiilkgur, any items dropped inside is transported to the Fortress, processed by the core and destroyed to extract energy. +The byproduct of this effect is the creation of gold, which is useless to the Fortress, so it is sent back to you. + +When you possess the chest all items you walk upon will automatically be put inside and transmogrified when you leave the level. +Simply go to your inventory to move them out of the chest if you wish to keep them. +Items in the chest will not encumber you.]], + cost = 0, quest=true, + + carrier = { + has_transmo = 1, + }, + + max_power = 1000, power_regen = 1, + use_power = { name = "transmogrify all the items in your chest at once(also done automatically when you change level)", power = 0, + use = function(self, who) + local inven = who:getInven("INVEN") + local nb = 0 + for i = #inven, 1, -1 do + local o = inven[i] + if o.__transmo then nb = nb + 1 end + end + if nb <= 0 then require("engine.ui.Dialog"):simplePopup("Transmogrification Chest", "You do not have any items to transmogrify in your chest.") return {id=true, used=true} end + + require("engine.ui.Dialog"):yesnoPopup("Transmogrification Chest", "Transmogrify all "..nb.." item(s) in your chest?", function(ret) + if not ret then return end + for i = #inven, 1, -1 do + local o = inven[i] + if o.__transmo then + who:transmoInven(inven, i, o) + end + end + end) + return {id=true, used=true} + end + }, + + on_pickup = function(self, who) + require("engine.ui.Dialog"):simpleLongPopup("Transmogrification Chest", [[This chest is an extension of Yiilkgur, any items dropped inside is transported to the Fortress, processed by the core and destroyed to extract energy. +The byproduct of this effect is the creation of gold, which is useless to the Fortress, so it is sent back to you. + +When you possess the chest all items you walk upon will automatically be put inside and transmogrified when you leave the level. +To take an item out, simply go to your inventory to move them out of the chest. +Items in the chest will not encumber you.]], 500) + end, + on_drop = function(self, who) + if who == game.player then + game.logPlayer(who, "You cannot bring yourself to drop the %s", self:getName()) + return true + end + end, +} diff --git a/game/modules/tome/data/quests/shertul-fortress.lua b/game/modules/tome/data/quests/shertul-fortress.lua index 231224e5ea4783d20bc904cc3a5395a5286481dc..5b92264d3ced978dc9c369c9eb6a23322ac37d53 100644 --- a/game/modules/tome/data/quests/shertul-fortress.lua +++ b/game/modules/tome/data/quests/shertul-fortress.lua @@ -86,6 +86,8 @@ spawn_transmo_chest = function(self, energy) game.zone:addEntity(game.level, chest, "object", spot.x + 1, spot.y) game.level.map:particleEmitter(spot.x, spot.y, 1, "demon_teleport") game.player:setQuestStatus(self.id, self.COMPLETED, "transmo-chest") + + game:setAllowedBuild("transmo_chest", true) end gain_energy = function(self, energy) diff --git a/game/modules/tome/data/texts/unlock-transmo_chest.lua b/game/modules/tome/data/texts/unlock-transmo_chest.lua new file mode 100644 index 0000000000000000000000000000000000000000..7749eae922452994dc1e7f728669782b44587f02 --- /dev/null +++ b/game/modules/tome/data/texts/unlock-transmo_chest.lua @@ -0,0 +1,25 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010, 2011 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 <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +return "New birth equipment: #LIGHT_GREEN#Transmogrification Chest", +[[You have discovered an old Fortress belonging to the mysterious Sher'tul race. +The fortress shadow gave you a transmogrification chest which shall make your dealing with storage and gold much easier. + +All your new characters will now start with a transmogrification chest at birth. All items transmogrified before you find the Fortress with them will only yield gold. +]] diff --git a/game/modules/tome/data/zones/shertul-fortress/objects.lua b/game/modules/tome/data/zones/shertul-fortress/objects.lua index 986ea6a590538428f0be37cf8d1d1ac8f94bb74a..51703846ecbf1be7ef107ad96124c17c7fde1e63 100644 --- a/game/modules/tome/data/zones/shertul-fortress/objects.lua +++ b/game/modules/tome/data/zones/shertul-fortress/objects.lua @@ -19,65 +19,6 @@ load("/data/general/objects/objects-maj-eyal.lua") -newEntity{ base = "BASE_WAND", - power_source = {unknown=true, arcane=false}, - type = "chest", subtype = "sher'tul", - define_as = "TRANSMO_CHEST", - add_name = false, - identified=true, force_lore_artifact=true, - name = "Transmogrification Chest", display = '~', color=colors.GOLD, unique=true, image = "object/chest4.png", - desc = [[This chest is an extension of Yiilkgur, any items dropped inside is transported to the Fortress, processed by the core and destroyed to extract energy. -The byproduct of this effect is the creation of gold, which is useless to the Fortress, so it is sent back to you. - -When you possess the chest all items you walk upon will automatically be put inside and transmogrified when you leave the level. -Simply go to your inventory to move them out of the chest if you wish to keep them. -Items in the chest will not encumber you.]], - cost = 0, quest=true, - - carrier = { - has_transmo = 1, - }, - - max_power = 1000, power_regen = 1, - use_power = { name = "transmogrify all the items in your chest at once(also done automatically when you change level)", power = 0, - use = function(self, who) - local inven = who:getInven("INVEN") - local nb = 0 - for i = #inven, 1, -1 do - local o = inven[i] - if o.__transmo then nb = nb + 1 end - end - if nb <= 0 then require("engine.ui.Dialog"):simplePopup("Transmogrification Chest", "You do not have any items to transmogrify in your chest.") return {id=true, used=true} end - - require("engine.ui.Dialog"):yesnoPopup("Transmogrification Chest", "Transmogrify all "..nb.." item(s) in your chest?", function(ret) - if not ret then return end - for i = #inven, 1, -1 do - local o = inven[i] - if o.__transmo then - who:transmoInven(inven, i, o) - end - end - end) - return {id=true, used=true} - end - }, - - on_pickup = function(self, who) - require("engine.ui.Dialog"):simpleLongPopup("Transmogrification Chest", [[This chest is an extension of Yiilkgur, any items dropped inside is transported to the Fortress, processed by the core and destroyed to extract energy. -The byproduct of this effect is the creation of gold, which is useless to the Fortress, so it is sent back to you. - -When you possess the chest all items you walk upon will automatically be put inside and transmogrified when you leave the level. -To take an item out, simply go to your inventory to move them out of the chest. -Items in the chest will not encumber you.]], 500) - end, - on_drop = function(self, who) - if who == game.player then - game.logPlayer(who, "You cannot bring yourself to drop the %s", self:getName()) - return true - end - end, -} - newEntity{ base = "BASE_CLOTH_ARMOR", define_as = "SIMPLE_GOWN", name = "simple gown",