vexler222
Active Member
- Joined
- Apr 22, 2012
- Messages
- 714
- Solutions
- 15
- Reaction score
- 47
Hi, can someone add me to this command to show spells with rebirth?
I want something like, if spell need rebirth then is on last positon and before spell name, be text "Rebirth X"
In spells for rebirth 0, show only "Level: X"
I was tryed but without success, cuz i don't know how to get rebirth from spells.xml
Neded rebirth is in spells.xml like level, "rebirth = 0"
I want something like, if spell need rebirth then is on last positon and before spell name, be text "Rebirth X"
In spells for rebirth 0, show only "Level: X"
I was tryed but without success, cuz i don't know how to get rebirth from spells.xml
Neded rebirth is in spells.xml like level, "rebirth = 0"
Code:
local spellsCommand = TalkAction("!spells")
function spellsCommand.onSay(player, words, param)
local text = ""
local spells = {}
for _, spell in ipairs(player:getInstantSpells()) do
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
spells[#spells + 1] = spell
end
end
table.sort(spells, function(a, b) return a.level < b.level end)
local prevLevel = -1
for i, spell in ipairs(spells) do
local line = ""
if prevLevel ~= spell.level then
if i ~= 1 then
line = "\n"
end
line = line .. "====================\n\n"
line = line .. "Level: " .. spell.level .. "\n"
prevLevel = spell.level
end
text = text .. line .. " [-] " .. spell.words .. "\n"
line = line .. "====================\n"
end
player:showTextDialog(1692, text)
return true
end
spellsCommand:register()
Last edited: