From bad6af511608e07ade04efe088918160f21f01f7 Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Fri, 28 Dec 2012 20:33:46 +0000 Subject: [PATCH] fixes sanity paranoia git-svn-id: http://svn.net-core.org/repos/t-engine4@6268 51575b47-30f0-44d4-a5cc-537603b46e54 --- .../tome/class/interface/PartyLore.lua | 2 +- .../tome/data/birth/classes/adventurer.lua | 2 +- .../modules/tome/data/chats/eidolon-plane.lua | 19 +++++++++++++++++-- game/modules/tome/dialogs/Birther.lua | 2 +- game/modules/tome/dialogs/ShowEquipInven.lua | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/game/modules/tome/class/interface/PartyLore.lua b/game/modules/tome/class/interface/PartyLore.lua index 10f3e6752a..39c6006271 100644 --- a/game/modules/tome/class/interface/PartyLore.lua +++ b/game/modules/tome/class/interface/PartyLore.lua @@ -71,7 +71,7 @@ end function _M:additionalLore(id, name, category, lore) self.additional_lore = self.additional_lore or {} if self.additional_lore[id] then return end - self.additional_lore_nb = self.additional_lore_nb + 1 + self.additional_lore_nb = (self.additional_lore_nb or 0) + 1 self.additional_lore[id] = {id=id, name=name, category=category, lore=lore, order=self.additional_lore_nb + #self.lore_defs} end diff --git a/game/modules/tome/data/birth/classes/adventurer.lua b/game/modules/tome/data/birth/classes/adventurer.lua index 2bc6234786..a33e9bcece 100644 --- a/game/modules/tome/data/birth/classes/adventurer.lua +++ b/game/modules/tome/data/birth/classes/adventurer.lua @@ -56,7 +56,7 @@ newBirthDescriptor{ talents_types = function(birth) local tts = {} for _, class in ipairs(birth.all_classes) do - for _, sclass in ipairs(class.nodes) do if sclass.id ~= "Adventurer" and not sclass.not_on_random_boss then + for _, sclass in ipairs(class.nodes) do if sclass.id ~= "Adventurer" and sclass.def and not sclass.def.not_on_random_boss then if birth.birth_descriptor_def.subclass[sclass.id].talents_types then local tt = birth.birth_descriptor_def.subclass[sclass.id].talents_types if type(tt) == "function" then tt = tt(birth) end diff --git a/game/modules/tome/data/chats/eidolon-plane.lua b/game/modules/tome/data/chats/eidolon-plane.lua index 992ef0eb39..c04ae096e3 100644 --- a/game/modules/tome/data/chats/eidolon-plane.lua +++ b/game/modules/tome/data/chats/eidolon-plane.lua @@ -26,15 +26,30 @@ But do not abuse my help. I am not your servant, and someday I might just let yo As for your probable many questions, they will stay unanswered. I may help, but I am not here to explain why.]], answers = { {"Thank you. I will rest for a while."}, - {"Thank you. I am ready to go back!", action=function() game.level.data.eidolon_exit(false) end}, + {"Thank you. I am ready to go back!", + cond=function() return game.level.source_level end, + action=function() game.level.data.eidolon_exit(false) end + }, {"Thank you, but I fear I will not survive anyway, can you send me back somewhere else please?", - cond=function() return not game.level.source_level.data or not game.level.source_level.data.no_worldport end, + cond=function() return game.level.source_level and (not game.level.source_level.data or not game.level.source_level.data.no_worldport) end, action=function() game.level.data.eidolon_exit(true) end }, + {"Thank you, I am ready to go back!", + cond=function() return not game.level.source_level end, + jump="jump_error", + }, {"Thank you, but I am weary of this life, I wish no more, please let me go.", jump="die"}, } } +newChat{ id="jump_error", + text = [[It seems the threads of time have been disrupted... +I will try to send you to safety.]], + answers = { + {"Thanks.", action=function(npc, player) game:changeLevel(1, "wilderness") end}, + } +} + newChat{ id="die", text = [[#LIGHT_GREEN#*It seems to stare at you in weird way.*#WHITE# I...had plans for you, but I cannot go against your free will. Know that you had a destiny waiting for you. diff --git a/game/modules/tome/dialogs/Birther.lua b/game/modules/tome/dialogs/Birther.lua index 1d894fd4fc..8c1967bbef 100644 --- a/game/modules/tome/dialogs/Birther.lua +++ b/game/modules/tome/dialogs/Birther.lua @@ -793,7 +793,7 @@ function _M:generateClasses() if how == "nolore" and self.descriptors_by_type.subrace then desc = "#CRIMSON#Playing this class with the race you selected does not make much sense lore-wise. You can still do it but might miss on some special quests/...#WHITE#\n" .. desc end - nodes[#nodes+1] = { name = sd.display_name, basename=sd.display_name, id=sd.name, pid=d.name, desc=desc } + nodes[#nodes+1] = { name = sd.display_name, basename=sd.display_name, id=sd.name, pid=d.name, desc=desc, def=sd } if self.sel_class and self.sel_class.id == sd.name then newsel = nodes[#nodes] end end end diff --git a/game/modules/tome/dialogs/ShowEquipInven.lua b/game/modules/tome/dialogs/ShowEquipInven.lua index 1eab76a618..1b380f4201 100644 --- a/game/modules/tome/dialogs/ShowEquipInven.lua +++ b/game/modules/tome/dialogs/ShowEquipInven.lua @@ -58,7 +58,7 @@ function _M:init(title, actor, filter, action, on_select) local bi = self.actor:getInven(ui.inven) local ws = self.actor:getInven(wear_o:wornInven()) local os = self.actor:getObjectOffslot(wear_o) - if bi and (ws and ws.id == bi.id) or (os and self.actor:getInven(os).id == bi.id) then + if bi and ((ws and ws.id == bi.id) or (os and self.actor:getInven(os).id == bi.id)) then self.actor:doTakeoff(ui.inven, ui.item, ui:getItem(), true) end end -- GitLab