From 0842a3018453a1d3864576febf933cecbdd54a01 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 12 Feb 2012 21:36:25 +0000
Subject: [PATCH] fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@4843 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/data/general/objects/staves.lua |  2 +-
 game/modules/tome/dialogs/UseTalents.lua          | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/game/modules/tome/data/general/objects/staves.lua b/game/modules/tome/data/general/objects/staves.lua
index 46996e9a98..808bf3ea79 100644
--- a/game/modules/tome/data/general/objects/staves.lua
+++ b/game/modules/tome/data/general/objects/staves.lua
@@ -40,7 +40,7 @@ newEntity{
 		sound = {"actions/melee", pitch=0.6, vol=1.2}, sound_miss = {"actions/melee", pitch=0.6, vol=1.2},
 	},
 	desc = [[Staves designed for wielders of magic, by the greats of the art.]],
-	egos = "/data/general/objects/egos/weapon-test.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
+	egos = "/data/general/objects/egos/staves.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
 newEntity{ base = "BASE_STAFF",
diff --git a/game/modules/tome/dialogs/UseTalents.lua b/game/modules/tome/dialogs/UseTalents.lua
index 6b127f8b4b..d8c1657922 100644
--- a/game/modules/tome/dialogs/UseTalents.lua
+++ b/game/modules/tome/dialogs/UseTalents.lua
@@ -100,6 +100,7 @@ end
 function _M:onDrag(item)
 	if item and item.talent then
 		local t = self.actor:getTalentFromId(item.talent)
+		if t.mode == "passive" then return end
 		local s = t.display_entity:getEntityFinalSurface(nil, 64, 64)
 		local x, y = core.mouse.get()
 		game.mouse:startDrag(x, y, s, {kind="talent", id=t.id}, function(drag, used)
@@ -231,12 +232,12 @@ function _M:generateList()
 	end
 ]]
 
-	local actives, sustains, sustained, unavailables, cooldowns = {}, {}, {}, {}, {}
+	local actives, sustains, sustained, unavailables, cooldowns, passives = {}, {}, {}, {}, {}, {}
 	local chars = {}
 
 	-- Find all talents of this school
 	for j, t in pairs(self.actor.talents_def) do
-		if self.actor:knowTalent(t.id) and t.mode ~= "passive" then
+		if self.actor:knowTalent(t.id) then
 			local typename = "talent"
 			local nodes = t.mode == "sustained" and sustains or actives
 			local status = tstring{{"color", "LIGHT_GREEN"}, "Active"}
@@ -249,7 +250,7 @@ function _M:generateList()
 			elseif t.mode == "sustained" then
 				if self.actor:isTalentActive(t.id) then nodes = sustained end
 				status = self.actor:isTalentActive(t.id) and tstring{{"color", "YELLOW"}, "Sustaining"} or tstring{{"color", "LIGHT_GREEN"}, "Sustain"}
-			elseif t.mode == "passive" then
+			elseif t.mode == "passive" and not t.hide then
 				nodes = passives
 				status = tstring{{"color", "BLUE"}, "Passive"}
 			end
@@ -280,11 +281,13 @@ function _M:generateList()
 	table.sort(sustained, function(a,b) return a.cname < b.cname end)
 	table.sort(cooldowns, function(a,b) return a.cname < b.cname end)
 	table.sort(unavailables, function(a,b) return a.cname < b.cname end)
+	table.sort(passives, function(a,b) return a.cname < b.cname end)
 	for i, node in ipairs(actives) do node.char = self:makeKeyChar(letter) chars[node.char] = node letter = letter + 1 end
 	for i, node in ipairs(sustains) do node.char = self:makeKeyChar(letter) chars[node.char] = node letter = letter + 1 end
 	for i, node in ipairs(sustained) do node.char = self:makeKeyChar(letter) chars[node.char] = node letter = letter + 1 end
 	for i, node in ipairs(cooldowns) do node.char = self:makeKeyChar(letter) chars[node.char] = node letter = letter + 1 end
 	for i, node in ipairs(unavailables) do node.char = self:makeKeyChar(letter) chars[node.char] = node letter = letter + 1 end
+	for i, node in ipairs(passives) do node.char = "" end
 
 
 	list = {
@@ -293,6 +296,7 @@ function _M:generateList()
 		{ char='', name=('#{bold}#Sustained talents#{normal}#'):toTString(), status='', hotkey='', desc="All sustainable talents you currently sustain, using them will de-activate them.", color=function() return colors.simple(colors.YELLOW) end, nodes=sustained, shown=true },
 		{ char='', name=('#{bold}#Cooling down talents#{normal}#'):toTString(), status='', hotkey='', desc="All talents you have used that are still cooling down.", color=function() return colors.simple(colors.LIGHT_RED) end, nodes=cooldowns, shown=true },
 		{ char='', name=('#{bold}#Unavailable talents#{normal}#'):toTString(), status='', hotkey='', desc="All talents you have that do not have enough resources, or satisfy other dependencies.", color=function() return colors.simple(colors.GREY) end, nodes=unavailables, shown=true },
+		{ char='', name=('#{bold}#Passive talents#{normal}#'):toTString(), status='', hotkey='', desc="All your passive talents, they are always active.", color=function() return colors.simple(colors.WHITE) end, nodes=passives, shown=true },
 		chars = chars,
 	}
 	self.list = list
-- 
GitLab