Skip to content
Snippets Groups Projects
Commit fc70eb06 authored by dg's avatar dg
Browse files

The Sher'Tul Fortress gained a new function: talk to the shadow butler and...

The Sher'Tul Fortress gained a new function: talk to the shadow butler and gain the Transmogrification Chest which is both a way to power the fortress for further functions and a way to turn unwanted items into gold without having to come back to a shop.


git-svn-id: http://svn.net-core.org/repos/t-engine4@2825 51575b47-30f0-44d4-a5cc-537603b46e54
parent f6899109
No related branches found
No related tags found
No related merge requests found
......@@ -53,26 +53,32 @@ function _M:setupOnGame()
}
end
function _M:addMessage(channel, user, msg)
local log = self.channels[channel].log
table.insert(log, 1, {user=user, msg=msg})
while #log > self.max do table.remove(log) end
self.changed = true
end
function _M:event(e)
if e.se == "Talk" then
e.msg = e.msg:removeColorCodes()
self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}}
local log = self.channels[e.channel].log
table.insert(log, 1, {user=e.user, msg=e.msg})
while #log > self.max do table.remove(log) end
self.changed = true
self:addMessage(e.channel, e.user, e.msg)
if type(game) == "table" and game.log then game.log("#YELLOW#<%s> %s", e.user, e.msg) end
elseif e.se == "Join" then
self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}}
self.channels[e.channel].users[e.user] = true
self.channels_changed = true
self:addMessage(e.channel, e.user, "#{italic}##FIREBRICK#has joined the channel#{normal}#")
if type(game) == "table" and game.log and e.channel == self.cur_channel then game.log("#{italic}##FIREBRICK#%s has joined channel %s (press space to talk).#{normal}#", e.user, e.channel) end
elseif e.se == "Part" then
self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}}
self.channels[e.channel].users[e.user] = nil
self.channels_changed = true
self:addMessage(e.channel, e.user, "#{italic}##FIREBRICK#has left the channel#{normal}#")
if type(game) == "table" and game.log and e.channel == self.cur_channel then game.log("#{italic}##FIREBRICK#%s has left channel %s.#{normal}#", e.user, e.channel) end
elseif e.se == "UserInfo" then
local info = e.data:unserialize()
......@@ -225,7 +231,7 @@ function _M:display()
local old_style = self.font:getStyle()
for z = 1 + self.scroll, #log do
local stop = false
local tstr = ("<%s> %s"):format(log[z].user, log[z].msg)
local tstr = ("<%s> %s"):format(log[z].user, log[z].msg):toTString()
local gen = tstring.makeLineTextures(tstr, self.w - 4, self.font_mono)
for i = #gen, 1, -1 do
self.dlist[#self.dlist+1] = gen[i]
......
......@@ -27,13 +27,13 @@ local Separator = require "engine.ui.Separator"
module(..., package.seeall, class.inherit(Dialog))
function _M:init(title, x, y, filter, action)
function _M:init(title, x, y, filter, action, takeall)
self.x, self.y = x, y
self.filter = filter
self.action = action
Dialog.init(self, title or "Pickup", math.max(800, game.w * 0.8), math.max(600, game.h * 0.8))
local takeall = Button.new{text="(*) Take all", width=self.iw - 40, fct=function() self:takeAll() end}
local takeall = Button.new{text=takeall or "(*) Take all", width=self.iw - 40, fct=function() self:takeAll() end}
self.c_desc = TextzoneList.new{width=math.floor(self.iw / 2 - 10), height=self.ih - takeall.h, no_color_bleed=true}
......@@ -117,7 +117,7 @@ function _M:generateList()
local enc = 0
o:forAllStack(function(o) enc=enc+o.encumber end)
list[#list+1] = { char=char, name=o:getName(), color=o:getDisplayColor(), object=o, item=i, cat=o.subtype, encumberance=enc, desc=o:getDesc() }
list[#list+1] = { char=char, name=o:getName(), color=o:getDisplayColor(), object=o, item=idx, cat=o.subtype, encumberance=enc, desc=o:getDesc() }
i = i + 1
end
idx = idx + 1
......
......@@ -30,6 +30,7 @@ Welcome, master.]],
{"Master? I am not your mas..", jump="master", cond=isNotSet"master", action=set"master"},
{"Why do I understand you, the texts are unreadable to me.", jump="understand", cond=isNotSet"understand", action=set"understand"},
{"What can I do here?", jump="storage", cond=isNotSet"storage", action=set"storage"},
{"What else can this place do?", jump="energy", cond=isNotSet"energy", action=set"energy"},
{"[leave]"},
}
}
......@@ -89,4 +90,15 @@ To the south you will find the storage room.]],
}
}
newChat{ id="energy",
text = [[This Fortress is designed as a mobile base for the Godslayers - it can fly.
It is also equiped with various facilities: exploratory farportal, emergency containment field, remote storage, ...
However the Fortess is badly damaged and laid dormant for too long, its energies are nearly depleted.
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 has no use for the Fortress and thus will be sent back to you.]],
answers = {
{"I will, thanks.", jump="welcome", action=function() q:spawn_transmo_chest() end},
}
}
return "welcome"
game/modules/tome/data/gfx/shockbolt/object/chest2.png

4.34 KiB

game/modules/tome/data/gfx/shockbolt/object/chest3.png

7.82 KiB

game/modules/tome/data/gfx/shockbolt/object/chest4.png

4.69 KiB

......@@ -31,9 +31,16 @@ desc = function(self, who)
if self:isCompleted("butler") then
desc[#desc+1] = "You have activated what seems to be a ... butler? with your rod of recall."
end
if self.shertul_energy > 0 then
desc[#desc+1] = ("The Fortress current energy level is: %d."):format(self.shertul_energy)
end
return table.concat(desc, "\n")
end
on_grant = function(self, who)
self.shertul_energy = 0
end
spawn_butler = function(self)
local spot = game.level:pickSpot{type="spawn", subtype="butler"}
local butler = game.zone:makeEntityByName(game.level, "actor", "BUTLER")
......@@ -44,3 +51,15 @@ spawn_butler = function(self)
world:gainAchievement("SHERTUL_FORTRESS", game.player)
end
spawn_transmo_chest = function(self, energy)
local spot = game.level:pickSpot{type="spawn", subtype="butler"}
local chest = game.zone:makeEntityByName(game.level, "object", "TRANSMO_CHEST")
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")
end
gain_energy = function(self, energy)
self.shertul_energy = self.shertul_energy + energy
end
......@@ -19,13 +19,45 @@
load("/data/general/objects/objects.lua")
newEntity{ base = "BASE_LORE",
define_as = "LINANIIL_LECTURE",
subtype = "lecture on humility", unique=true, no_unique_lore=true, not_in_stores=false,
name = "Lecture on Humility by Archmage Linaniil", lore="angolwen-linaniil-lecture",
desc = [[Lecture on Humility by Archmage Linaniil. A tale of the first ages and the Spellblaze.]],
rarity = false,
encumberance = 0,
cost = 2,
}
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 activated it will prompt to destroy items on the floor, if there are none it prompts for your inventory.]],
cost = 0, quest=true,
max_power = 1000, power_regen = 1,
use_power = { name = "open a portal to send items to the Fortress core, extracting energies from it for the Fortress and sending back useless gold.", power = 0,
use = function(self, who)
-- On the floor or inventory
if game.level.map:getObjectTotal(who.x, who.y) > 0 then
local d = require("engine.dialogs.ShowPickupFloor").new("Transmogrify", who.x, who.y, function(o) if o:getPrice() <= 0 or o.quest then return false end return true end, function(o, idx)
local price = o:getPrice() * o:getNumber()
price = math.min(price, 25)
game.level.map:removeObject(who.x, who.y, idx)
who:incMoney(price)
who:hasQuest("shertul-fortress"):gain_energy(price/10)
game.log("You gain %0.2f gold from the transmogrification of %s.", price, o:getName{do_count=true, do_color=true})
end, "Transmogrify all")
game:registerDialog(d)
else
local d = require("engine.dialogs.ShowInventory").new("Transmogrify", who:getInven("INVEN"), function(o) if o:getPrice() <= 0 or o.quest then return false end return true end, function(o, idx)
local price = o:getPrice() * o:getNumber()
price = math.min(price, 25)
who:removeObject(who:getInven("INVEN"), idx, true)
who:sortInven()
who:incMoney(price)
who:hasQuest("shertul-fortress"):gain_energy(price/10)
game.log("You gain %0.2f gold from the transmogrification of %s.", price, o:getName{do_count=true, do_color=true})
end, who)
game:registerDialog(d)
end
end
},
}
......@@ -29,7 +29,7 @@ return {
level_range = {18, 25},
max_level = 1,
width = 60, height = 60,
persistent = "zone",
persistent = "memory",
-- all_remembered = true,
all_lited = true,
persistent = "zone",
......
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