-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from FG-Unofficial-Developers-Guild/contains-ov…
…erride fuzzy matching of item types
- Loading branch information
Showing
5 changed files
with
80 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
-- | ||
-- Please see the LICENSE.md file included with this distribution for attribution and copyright information. | ||
-- | ||
|
||
-- | ||
-- Please see the LICENSE.md file included with this distribution for attribution and copyright information. | ||
-- | ||
|
||
-- luacheck: globals ItemManager.isArmor ItemManager.isShield ItemManager.isWeapon | ||
|
||
local contains_old; | ||
local function contains(tList, sItem) | ||
if not tList or not sItem then | ||
return false; | ||
end | ||
for i = 1, #tList do | ||
if sItem:match(tList[i]) then -- replace exact string match with string.match | ||
return true; | ||
end | ||
end | ||
return false; | ||
end | ||
|
||
local isArmor_old; | ||
local function isArmor(nodeItem, ...) | ||
contains_old = StringManager.contains; | ||
StringManager.contains = contains; | ||
local bReturn = isArmor_old(nodeItem, ...); | ||
StringManager.contains = contains_old; | ||
|
||
return bReturn; | ||
end | ||
|
||
local isShield_old; | ||
local function isShield(nodeItem, ...) | ||
contains_old = StringManager.contains; | ||
StringManager.contains = contains; | ||
local bReturn = isShield_old(nodeItem, ...); | ||
StringManager.contains = contains_old; | ||
|
||
return bReturn; | ||
end | ||
|
||
local isWeapon_old; | ||
local function isWeapon(nodeItem, ...) | ||
contains_old = StringManager.contains; | ||
StringManager.contains = contains; | ||
local bReturn = isWeapon_old(nodeItem, ...); | ||
StringManager.contains = contains_old; | ||
|
||
return bReturn; | ||
end | ||
|
||
function onInit() | ||
isArmor_old = ItemManager.isArmor | ||
ItemManager.isArmor = isArmor; | ||
|
||
isShield_old = ItemManager.isShield | ||
ItemManager.isShield = isShield; | ||
|
||
isWeapon_old = ItemManager.isWeapon | ||
ItemManager.isWeapon = isWeapon; | ||
end |