mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-13 14:24:55 +02:00
finished druid outfit quest
This commit is contained in:
@@ -117,9 +117,32 @@ if not globalStorageTable then
|
||||
end
|
||||
|
||||
function Game.getStorageValue(key)
|
||||
return globalStorageTable[key]
|
||||
-- Return from local table if possible
|
||||
if globalStorageTable[key] ~= nil then
|
||||
return globalStorageTable[key]
|
||||
end
|
||||
|
||||
-- Else look for it on the DB
|
||||
local dbData = db.storeQuery("SELECT `value` FROM `global_storage` WHERE `key` = " .. key .. " LIMIT 1;")
|
||||
if dbData ~= false then
|
||||
local value = result.getNumber(dbData, "value")
|
||||
if value ~= nil then
|
||||
-- Save it to globalStorageTable
|
||||
globalStorageTable[key] = value
|
||||
return value
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function Game.setStorageValue(key, value)
|
||||
globalStorageTable[key] = value
|
||||
|
||||
local dbData = db.storeQuery("SELECT `value` FROM `global_storage` WHERE `key` = " .. key .. " LIMIT 1;")
|
||||
if dbData ~= false then
|
||||
db.query("UPDATE `global_storage` SET `value`='".. value .."' WHERE `key` = " .. key .. " LIMIT 1;")
|
||||
else
|
||||
db.query("INSERT INTO `global_storage` (`key`, `value`) VALUES (" .. key .. ", " .. value .. ");")
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user