Added: setDbProp64 lua function

--HG--
branch : patches-from-atys
hg/hotfix/patches-from-atys
ulukyn 6 years ago
parent 57406f6a8c
commit a50bd10b84

@ -500,6 +500,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls)
LUABIND_FUNC(getDbProp),
LUABIND_FUNC(getDbProp64),
LUABIND_FUNC(setDbProp),
LUABIND_FUNC(setDbProp64),
LUABIND_FUNC(addDbProp),
LUABIND_FUNC(delDbProp),
LUABIND_FUNC(debugInfo),
@ -2630,6 +2631,36 @@ void CLuaIHMRyzom::setDbProp(const std::string &dbProp, sint32 value)
debugInfo(toString("setDbProp(): '%s' dbProp Not found", dbProp.c_str()));
}
void CLuaIHMRyzom::setDbProp64(const std::string &dbProp, sint64 value)
{
//H_AUTO(Lua_CLuaIHM_setDbProp)
// Do not allow Write on SERVER: or LOCAL:
static const std::string dbServer = "SERVER:";
static const std::string dbLocal = "LOCAL:";
static const std::string dbLocalR2 = "LOCAL:R2";
if ((dbProp.compare(0, dbServer.size(), dbServer) == 0) ||
(dbProp.compare(0, dbLocal.size(), dbLocal) == 0)
)
{
if (dbProp.compare(0, dbLocalR2.size(), dbLocalR2) != 0)
{
nlstop;
throw ELuaIHMException("setDbProp(): You are not allowed to write on 'SERVER:...' or 'LOCAL:...' database");
}
}
// Write to the DB if found
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(dbProp, false);
if (node)
node->setValue64(value);
else
debugInfo(toString("setDbProp(): '%s' dbProp Not found", dbProp.c_str()));
}
void CLuaIHMRyzom::delDbProp(const string &dbProp)
{
//H_AUTO(Lua_CLuaIHM_setDbProp)

@ -122,6 +122,7 @@ private:
static sint32 getDbProp(const std::string &dbProp); // return 0 if not found.
static sint64 getDbProp64(const std::string &dbProp); // return 0 if not found.
static void setDbProp(const std::string &dbProp, sint32 value); // Nb: the db prop is not created if not present.
static void setDbProp64(const std::string &dbProp, sint64 value); // Nb: the db prop is not created if not present.
static void addDbProp(const std::string &dbProp, sint32 value); // Nb: the db prop is created if not present.
static void delDbProp(const std::string &dbProp);

Loading…
Cancel
Save