summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/core/s_aux.lua27
-rw-r--r--lib/mods/theme/core/s_aux.lua27
-rw-r--r--lib/mods/theme/scpt/library.lua11
-rw-r--r--lib/scpt/library.lua11
4 files changed, 36 insertions, 40 deletions
diff --git a/lib/core/s_aux.lua b/lib/core/s_aux.lua
index 4cc4a199..ec609b04 100644
--- a/lib/core/s_aux.lua
+++ b/lib/core/s_aux.lua
@@ -293,6 +293,22 @@ function adjust_power(s, x)
end
end
+-- Get spell school name(s) as a /-separated string.
+function spell_school_name(s)
+ local xx, sch_str
+ xx = nil
+ sch_str = ""
+ for index, sch in __spell_school[s] do
+ if xx then
+ sch_str = sch_str.."/"..school(sch).name
+ else
+ xx = 1
+ sch_str = sch_str..school(sch).name
+ end
+ end
+ return sch_str
+end
+
-- Print the book and the spells
function print_book(book, spl, obj)
local x, y, index, sch, size, s
@@ -317,16 +333,7 @@ function print_book(book, spl, obj)
else color = TERM_L_GREEN end
end
- xx = nil
- sch_str = ""
- for index, sch in __spell_school[s] do
- if xx then
- sch_str = sch_str.."/"..school(sch).name
- else
- xx = 1
- sch_str = sch_str..school(sch).name
- end
- end
+ sch_str = spell_school_name(s)
if na then
c_prt(color, format("%c) %-20s%-16s %3s %4s %3d%s %s", size + strbyte("a"), spell(s).name, sch_str, na, get_mana(s), spell_chance(s), "%", __spell_info[s]()), y, x)
diff --git a/lib/mods/theme/core/s_aux.lua b/lib/mods/theme/core/s_aux.lua
index 4cc4a199..ec609b04 100644
--- a/lib/mods/theme/core/s_aux.lua
+++ b/lib/mods/theme/core/s_aux.lua
@@ -293,6 +293,22 @@ function adjust_power(s, x)
end
end
+-- Get spell school name(s) as a /-separated string.
+function spell_school_name(s)
+ local xx, sch_str
+ xx = nil
+ sch_str = ""
+ for index, sch in __spell_school[s] do
+ if xx then
+ sch_str = sch_str.."/"..school(sch).name
+ else
+ xx = 1
+ sch_str = sch_str..school(sch).name
+ end
+ end
+ return sch_str
+end
+
-- Print the book and the spells
function print_book(book, spl, obj)
local x, y, index, sch, size, s
@@ -317,16 +333,7 @@ function print_book(book, spl, obj)
else color = TERM_L_GREEN end
end
- xx = nil
- sch_str = ""
- for index, sch in __spell_school[s] do
- if xx then
- sch_str = sch_str.."/"..school(sch).name
- else
- xx = 1
- sch_str = sch_str..school(sch).name
- end
- end
+ sch_str = spell_school_name(s)
if na then
c_prt(color, format("%c) %-20s%-16s %3s %4s %3d%s %s", size + strbyte("a"), spell(s).name, sch_str, na, get_mana(s), spell_chance(s), "%", __spell_info[s]()), y, x)
diff --git a/lib/mods/theme/scpt/library.lua b/lib/mods/theme/scpt/library.lua
index decf490c..02bfeddd 100644
--- a/lib/mods/theme/scpt/library.lua
+++ b/lib/mods/theme/scpt/library.lua
@@ -187,16 +187,7 @@ function library_quest.print_spell(color, y, spl)
local lvl, na = get_level_school(s, 50, -50)
local xx, sch_str
- xx = nil
- sch_str = ""
- for index, sch in __spell_school[s] do
- if xx then
- sch_str = sch_str.."/"..school(sch).name
- else
- xx = 1
- sch_str = sch_str..school(sch).name
- end
- end
+ sch_str = spell_school_name(s)
if s == spl then
if na then
diff --git a/lib/scpt/library.lua b/lib/scpt/library.lua
index 99c2c0f4..9939b3eb 100644
--- a/lib/scpt/library.lua
+++ b/lib/scpt/library.lua
@@ -184,16 +184,7 @@ function library_quest.print_spell(color, y, spl)
local lvl, na = get_level_school(s, 50, -50)
local xx, sch_str
- xx = nil
- sch_str = ""
- for index, sch in __spell_school[s] do
- if xx then
- sch_str = sch_str.."/"..school(sch).name
- else
- xx = 1
- sch_str = sch_str..school(sch).name
- end
- end
+ sch_str = spell_school_name(s)
if s == spl then
if na then