finish guildwar system

This commit is contained in:
ErikasKontenis
2020-11-14 14:10:02 +02:00
parent cf893a1aaa
commit 2546d1a0a5
20 changed files with 604 additions and 125 deletions

View File

@@ -48,4 +48,35 @@ end
if not nextUseStaminaTime then
nextUseStaminaTime = {}
end
function isInArray(array, value, isCaseSensitive)
local compareLowerCase = false
if value ~= nil and type(value) == "string" and not isCaseSensitive then
value = string.lower(value)
compareLowerCase = true
end
if array == nil or value == nil then
return (array == value), nil
end
local t = type(array)
if t ~= "table" then
if compareLowerCase and t == "string" then
return (string.lower(array) == string.lower(value)), nil
else
return (array == value), nil
end
end
for k,v in pairs(array) do
local newV
if compareLowerCase and type(v) == "string" then
newV = string.lower(v)
else
newV = v
end
if newV == value then
return true, k
end
end
return false
end