Skip to content

Commit 6930871

Browse files
committed
Fixed spell check
1 parent f7977df commit 6930871

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/003-core.lua

+15
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,20 @@ Core = (function()
464464
and xeno.selfSay(words)
465465
end
466466

467+
local function isSpell(words)
468+
local spellPrefixes = {'exan', 'exura', 'utan', 'utevo', 'exevo', 'exor', 'utor'}
469+
local isSpell = false
470+
for i = 1, #spellPrefixes do
471+
local prefix = spellPrefixes[i]
472+
local pattern = ("^%s.*$"):format(prefix)
473+
if words:match(pattern) then
474+
isSpell = true
475+
break
476+
end
477+
end
478+
return isSpell
479+
end
480+
467481
local function cureConditions(callback)
468482
local conditions = {
469483
poisoned = {
@@ -668,6 +682,7 @@ Core = (function()
668682
talk = talk,
669683
clearWalkerPath = clearWalkerPath,
670684
cast = cast,
685+
isSpell = isSpell,
671686
cureConditions = cureConditions,
672687
isCorpseOpen = isCorpseOpen,
673688
getWalkableTiles = getWalkableTiles,

src/014-events.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ do
2424
local getSelfName = Core.getSelfName
2525
local sortPositionsByDistance = Core.sortPositionsByDistance
2626
local cast = Core.cast
27+
local isSpell = Core.isSpell
2728
local cureConditions = Core.cureConditions
2829
local checkSoftBoots = Core.checkSoftBoots
2930
local log = Console.log
@@ -1085,7 +1086,7 @@ do
10851086
end, true)--]]
10861087
end
10871088
-- Spell, forward to default channel
1088-
elseif xeno.getSelfSpellRequirementsMet(message:lower()) then
1089+
elseif isSpell(message:lower()) then
10891090
xeno.selfSay(message)
10901091
-- Not command, handle as usual
10911092
else

0 commit comments

Comments
 (0)