Fix rsa change, messagebox and remove lua variable from c++

master
Henrique Santiago 12 years ago
parent d0b3c04853
commit 4e8afab335

@ -51,18 +51,24 @@ function UIMessageBox.display(title, message, buttons, onEnterCallback, onEscape
end
function displayInfoBox(title, message)
local defaultCallback = function(self) self:ok() end
return UIMessageBox.display(title, message, {{text='Ok', callback=defaultCallback}}, defaultCallback, defaultCallback)
local messageBox
local defaultCallback = function() messageBox:ok() end
messageBox = UIMessageBox.display(title, message, {{text='Ok', callback=defaultCallback}}, defaultCallback, defaultCallback)
return messageBox
end
function displayErrorBox(title, message)
local defaultCallback = function(self) self:ok() end
return UIMessageBox.display(title, message, {{text='Ok', callback=defaultCallback}}, defaultCallback, defaultCallback)
local messageBox
local defaultCallback = function() messageBox:ok() end
messageBox = UIMessageBox.display(title, message, {{text='Ok', callback=defaultCallback}}, defaultCallback, defaultCallback)
return messageBox
end
function displayCancelBox(title, message)
local defaultCallback = function(self) self:cancel() end
return UIMessageBox.display(title, message, {{text='Cancel', callback=defaultCallback}}, defaultCallback, defaultCallback)
local messageBox
local defaultCallback = function() messageBox:cancel() end
messageBox = UIMessageBox.display(title, message, {{text='Cancel', callback=defaultCallback}}, defaultCallback, defaultCallback)
return messageBox
end
function displayGeneralBox(title, message, buttons, onEnterCallback, onEscapeCallback)

@ -265,6 +265,9 @@ std::string Crypt::sha512Encode(const std::string& decoded_string, bool upperCas
void Crypt::rsaSetPublicKey(const std::string& n, const std::string& e)
{
RSA_free(m_rsa);
m_rsa = RSA_new();
BN_dec2bn(&m_rsa->n, n.c_str());
BN_dec2bn(&m_rsa->e, e.c_str());
}

@ -1203,7 +1203,7 @@ void Game::setFollowingCreature(const CreaturePtr& creature)
std::string Game::formatCreatureName(const std::string& name)
{
std::string formatedName = name;
if(g_lua.callGlobalField<bool>("g_game", "isCreatureNameFormatEnabled") && name.length() > 0)
if(m_isCreatureNameFormatEnabled && name.length() > 0)
formatedName[0] = stdext::upchar(formatedName[0]);
return formatedName;
}

@ -269,6 +269,8 @@ public:
std::vector<uint8> getGMActions() { return m_gmActions; }
std::string formatCreatureName(const std::string &name);
void enableCreatureNameFormat() { m_isCreatureNameFormatEnabled = true; }
void disableCreatureNameFormat() { m_isCreatureNameFormatEnabled = false; }
protected:
void enableBotCall() { m_denyBotCall = false; }
@ -285,6 +287,7 @@ private:
std::map<int, ContainerPtr> m_containers;
std::map<int, Vip> m_vips;
stdext::boolean<true> m_isCreatureNameFormatEnabled;
bool m_online;
bool m_denyBotCall;
bool m_dead;

@ -206,6 +206,8 @@ void OTClient::registerLuaFunctions()
g_lua.bindSingletonFunction("g_game", "getFeature", &Game::getFeature, &g_game);
g_lua.bindSingletonFunction("g_game", "setFeature", &Game::setFeature, &g_game);
g_lua.bindSingletonFunction("g_game", "enableFeature", &Game::enableFeature, &g_game);
g_lua.bindSingletonFunction("g_game", "enableCreatureNameFormat", &Game::enableCreatureNameFormat, &g_game);
g_lua.bindSingletonFunction("g_game", "disableCreatureNameFormat", &Game::disableCreatureNameFormat, &g_game);
g_lua.registerSingletonClass("g_shaders");
g_lua.bindSingletonFunction("g_shaders", "createShader", &ShaderManager::createShader, &g_shaders);

Loading…
Cancel
Save