many modules fixes

master
Eduardo Bart 12 years ago
parent cfa7db77da
commit 296f2a17c4

@ -46,10 +46,10 @@ function Locales.init()
Locales.installLocales('locales') Locales.installLocales('locales')
local userLocaleName = Settings.get('locale') local userLocaleName = Settings.get('locale')
if userLocaleName and Locales.setLocale(userLocaleName)then if userLocaleName and Locales.setLocale(userLocaleName) then
info('Using configured locale: ' .. userLocaleName) --info('Using configured locale: ' .. userLocaleName)
else else
info('Using default locale: ' .. defaultLocaleName) --info('Using default locale: ' .. defaultLocaleName)
Locales.setLocale(defaultLocaleName) Locales.setLocale(defaultLocaleName)
Settings.set('locale', defaultLocaleName) Settings.set('locale', defaultLocaleName)
end end

@ -118,7 +118,7 @@ locale = {
["Pass Leadership to %s"] = "Pasar el liderazgo a %s", ["Pass Leadership to %s"] = "Pasar el liderazgo a %s",
["Password"] = "Contraseña", ["Password"] = "Contraseña",
["Please enter a character name:"] = "Por favor, introduce el nombre de un personaje:", ["Please enter a character name:"] = "Por favor, introduce el nombre de un personaje:",
["Please, press the key you wish to add onto your hotkeys manager"] = "Por favor, presione la tecla que desee para añadir a tu administrador de atajos", ["Please, press the key you wish to add onto your hotkeys manager"] = "Por favor, presione la tecla que desee para\nañadir a tu administrador de atajos",
["Please wait"] = "Por favor, espere", ["Please wait"] = "Por favor, espere",
["Port"] = "Puerto", ["Port"] = "Puerto",
["Price:"] = "Precio", ["Price:"] = "Precio",
@ -137,7 +137,7 @@ locale = {
["Select object"] = "Seleccionar objeto", ["Select object"] = "Seleccionar objeto",
["Select Outfit"] = "Selecionar Traje", ["Select Outfit"] = "Selecionar Traje",
["Sell"] = "Vender", ["Sell"] = "Vender",
["Send automatically"] = "Vender automáticamente", ["Send automatically"] = "Enviar automáticamente",
["Server"] = "Servidor", ["Server"] = "Servidor",
["Server Log"] = "Registro del servidor", ["Server Log"] = "Registro del servidor",
["Set Outfit"] = "Escoger Traje", ["Set Outfit"] = "Escoger Traje",

@ -150,7 +150,7 @@ locale = {
["Pass Leadership to %s"] = "Passar liderança para %s", ["Pass Leadership to %s"] = "Passar liderança para %s",
["Password"] = "Senha", ["Password"] = "Senha",
["Please enter a character name:"] = "Por favor, entre com o nome do personagem:", ["Please enter a character name:"] = "Por favor, entre com o nome do personagem:",
["Please, press the key you wish to add onto your hotkeys manager"] = "Por favor, pressione a tecla que você deseja adicionar no gerenciador de atalhos", ["Please, press the key you wish to add onto your hotkeys manager"] = "Por favor, pressione a tecla que você deseja\nadicionar no gerenciador de atalhos",
["Please use this dialog to only report bugs. Do not report rule violations here!"] = "Por favor, use este campo apenas para reportar defeitos. Não reporte violação de regras aqui!", ["Please use this dialog to only report bugs. Do not report rule violations here!"] = "Por favor, use este campo apenas para reportar defeitos. Não reporte violação de regras aqui!",
["Please wait"] = "Por favor, espere", ["Please wait"] = "Por favor, espere",
["Port"] = "Porta", ["Port"] = "Porta",
@ -174,7 +174,7 @@ locale = {
["Select Outfit"] = "Selecionar Roupa", ["Select Outfit"] = "Selecionar Roupa",
["Sell"] = "Vender", ["Sell"] = "Vender",
["Send"] = "Enviar", ["Send"] = "Enviar",
["Send automatically"] = "Vender automaticamente", ["Send automatically"] = "Enviar automaticamente",
["Server"] = "Servidor", ["Server"] = "Servidor",
["Server Log"] = "Registro do servidor", ["Server Log"] = "Registro do servidor",
["Set Outfit"] = "Escolher Roupa", ["Set Outfit"] = "Escolher Roupa",

@ -70,6 +70,7 @@ TopPanel
anchors.right: parent.right anchors.right: parent.right
UILabel UILabel
id: frameCounter
text-align: right text-align: right
text-auto-resize: true text-auto-resize: true
color: white color: white
@ -81,7 +82,7 @@ TopPanel
@onSetup: | @onSetup: |
local updateFunc local updateFunc
updateFunc = function() updateFunc = function()
self:setText('FPS: ' .. g_app.getBackgroundPaneFps()) rootWidget:recursiveGetChildById('frameCounter'):setText('FPS: ' .. g_app.getBackgroundPaneFps())
scheduleEvent(updateFunc, 250) scheduleEvent(updateFunc, 250)
end end
updateFunc() updateFunc()

@ -386,7 +386,7 @@ function Console.popupMenu(mousePos, mouseButton, creatureName, text)
if mouseButton == MouseRightButton then if mouseButton == MouseRightButton then
local menu = createWidget('PopupMenu') local menu = createWidget('PopupMenu')
if creatureName then if creatureName then
if creatureName ~= g_game.getLocalPlayer():getName() then if creatureName ~= g_game.getCharacterName() then
menu:addOption(tr('Message to ' .. creatureName), function () g_game.openPrivateChannel(creatureName) end) menu:addOption(tr('Message to ' .. creatureName), function () g_game.openPrivateChannel(creatureName) end)
menu:addOption(tr('Add to VIP list'), function () g_game.addVip(creatureName) end) --TODO not show if creature already in vip menu:addOption(tr('Add to VIP list'), function () g_game.addVip(creatureName) end) --TODO not show if creature already in vip
-- TODO ignore creatureName -- TODO ignore creatureName
@ -492,7 +492,7 @@ function Console.sendCurrentMessage()
g_game.talkPrivate(speaktype.speakType, name, message) g_game.talkPrivate(speaktype.speakType, name, message)
message = applyMessagePrefixies(player:getName(), player:getLevel(), message) message = applyMessagePrefixies(player:getName(), player:getLevel(), message)
Console.addPrivateText(message, speaktype, name, isPrivateCommand, g_game.getLocalPlayer():getName()) Console.addPrivateText(message, speaktype, name, isPrivateCommand, g_game.getCharacterName())
end end
end end

@ -77,7 +77,7 @@ end
function HotkeysManager.save() function HotkeysManager.save()
local hotkeySettings = {} local hotkeySettings = {}
for i = 1, currentHotkeysList:getChildCount() do for i=1, currentHotkeysList:getChildCount() do
local child = currentHotkeysList:getChildByIndex(i) local child = currentHotkeysList:getChildByIndex(i)
table.insert(hotkeySettings, {keyCombo = child.keyCombo, table.insert(hotkeySettings, {keyCombo = child.keyCombo,
autoSend = child.autoSend, autoSend = child.autoSend,
@ -85,6 +85,7 @@ function HotkeysManager.save()
useType = child.useType, useType = child.useType,
value = child.value}) value = child.value})
end end
Settings.setNode('HotkeysManager', hotkeySettings) Settings.setNode('HotkeysManager', hotkeySettings)
end end
@ -311,6 +312,7 @@ function HotkeysManager.call(keyCombo)
end end
function HotkeysManager.checkSelectedHotkey(focused) function HotkeysManager.checkSelectedHotkey(focused)
if not focused then return end
if hotkeysManagerLoaded then if hotkeysManagerLoaded then
hotkeyLabelSelectedOnList = focused hotkeyLabelSelectedOnList = focused

@ -70,7 +70,7 @@ void ModuleManager::discoverModulesPath()
for(const std::string& dir : possibleModulesDirs) { for(const std::string& dir : possibleModulesDirs) {
// try to add module directory // try to add module directory
if(g_resources.addToSearchPath(dir, false)) { if(g_resources.addToSearchPath(dir, false)) {
g_logger.info(stdext::format("Using modules directory '%s'", dir.c_str())); //g_logger.info(stdext::format("Using modules directory '%s'", dir.c_str()));
found = true; found = true;
break; break;
} }
@ -88,7 +88,7 @@ void ModuleManager::discoverModulesPath()
for(const std::string& dir : possibleAddonsDirs) { for(const std::string& dir : possibleAddonsDirs) {
// try to add module directory // try to add module directory
if(g_resources.addToSearchPath(dir, true)) { if(g_resources.addToSearchPath(dir, true)) {
g_logger.info(stdext::format("Using addons directory '%s'", dir.c_str())); //g_logger.info(stdext::format("Using addons directory '%s'", dir.c_str()));
found = true; found = true;
break; break;
} }

@ -252,7 +252,7 @@ void push_luavalue(const OTMLNodePtr& node)
int currentIndex = 1; int currentIndex = 1;
for(const OTMLNodePtr& cnode : node->children()) { for(const OTMLNodePtr& cnode : node->children()) {
push_otml_subnode_luavalue(cnode); push_otml_subnode_luavalue(cnode);
if(cnode->isUnique()) { if(cnode->isUnique() && !cnode->tag().empty()) {
g_lua.setField(cnode->tag()); g_lua.setField(cnode->tag());
} else } else
g_lua.rawSeti(currentIndex++); g_lua.rawSeti(currentIndex++);

@ -43,11 +43,7 @@ Game::Game()
void Game::resetGameStates() void Game::resetGameStates()
{ {
#ifdef BOT_PROTECTION
m_denyBotCall = true;
#else
m_denyBotCall = false; m_denyBotCall = false;
#endif
m_dead = false; m_dead = false;
m_serverBeat = 50; m_serverBeat = 50;
m_canReportBugs = false; m_canReportBugs = false;
@ -66,8 +62,6 @@ void Game::resetGameStates()
m_containers.clear(); m_containers.clear();
m_vips.clear(); m_vips.clear();
m_gmActions.clear(); m_gmActions.clear();
m_worldName = "";
} }
void Game::processConnectionError(const boost::system::error_code& error) void Game::processConnectionError(const boost::system::error_code& error)
@ -133,6 +127,9 @@ void Game::processGameEnd()
// reset game state // reset game state
resetGameStates(); resetGameStates();
m_worldName = "";
m_characterName = "";
// clean map creatures // clean map creatures
g_map.cleanDynamicThings(); g_map.cleanDynamicThings();
} }
@ -407,6 +404,7 @@ void Game::loginWorld(const std::string& account, const std::string& password, c
m_protocolGame = ProtocolGamePtr(new ProtocolGame); m_protocolGame = ProtocolGamePtr(new ProtocolGame);
m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName); m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName);
m_characterName = characterName;
m_worldName = worldName; m_worldName = worldName;
} }
@ -1024,12 +1022,14 @@ void Game::mount(bool mount)
bool Game::checkBotProtection() bool Game::checkBotProtection()
{ {
#ifdef BOT_PROTECTION
// accepts calls comming from a stacktrace containing only C++ functions, // accepts calls comming from a stacktrace containing only C++ functions,
// if the stacktrace contains a lua function, then only accept if the engine is processing an input event // if the stacktrace contains a lua function, then only accept if the engine is processing an input event
if(g_lua.isInCppCallback() && !g_app->isOnInputEvent() && m_denyBotCall) { if(m_denyBotCall && g_lua.isInCppCallback() && !g_app->isOnInputEvent()) {
g_logger.error(g_lua.traceback("caught a lua call to a bot protected game function, the call was canceled")); g_logger.error(g_lua.traceback("caught a lua call to a bot protected game function, the call was canceled"));
return false; return false;
} }
#endif
return true; return true;
} }

@ -244,8 +244,6 @@ public:
bool canPerformGameAction(); bool canPerformGameAction();
bool canReportBugs() { return m_canReportBugs; } bool canReportBugs() { return m_canReportBugs; }
bool checkBotProtection(); bool checkBotProtection();
void enableBotCall() { m_denyBotCall = false; }
void disableBotCall() { m_denyBotCall = true; }
bool isOnline() { return !!m_localPlayer; } bool isOnline() { return !!m_localPlayer; }
bool isDead() { return m_dead; } bool isDead() { return m_dead; }
@ -261,9 +259,14 @@ public:
LocalPlayerPtr getLocalPlayer() { return m_localPlayer; } LocalPlayerPtr getLocalPlayer() { return m_localPlayer; }
ProtocolGamePtr getProtocolGame() { return m_protocolGame; } ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
int getProtocolVersion() { return PROTOCOL; } int getProtocolVersion() { return PROTOCOL; }
std::string getCharacterName() { return m_characterName; }
std::string getWorldName() { return m_worldName; } std::string getWorldName() { return m_worldName; }
std::vector<uint8> getGMActions() { return m_gmActions; } std::vector<uint8> getGMActions() { return m_gmActions; }
protected:
void enableBotCall() { m_denyBotCall = false; }
void disableBotCall() { m_denyBotCall = true; }
private: private:
void setAttackingCreature(const CreaturePtr& creature); void setAttackingCreature(const CreaturePtr& creature);
void setFollowingCreature(const CreaturePtr& creature); void setFollowingCreature(const CreaturePtr& creature);
@ -283,6 +286,7 @@ private:
bool m_safeFight; bool m_safeFight;
bool m_canReportBugs; bool m_canReportBugs;
std::vector<uint8> m_gmActions; std::vector<uint8> m_gmActions;
std::string m_characterName;
std::string m_worldName; std::string m_worldName;
std::bitset<Otc::LastGameFeature> m_features; std::bitset<Otc::LastGameFeature> m_features;
int m_clientVersion; int m_clientVersion;

@ -164,6 +164,7 @@ void OTClient::registerLuaFunctions()
g_lua.bindClassStaticFunction("g_game", "getLocalPlayer", std::bind(&Game::getLocalPlayer, &g_game)); g_lua.bindClassStaticFunction("g_game", "getLocalPlayer", std::bind(&Game::getLocalPlayer, &g_game));
g_lua.bindClassStaticFunction("g_game", "getProtocolGame", std::bind(&Game::getProtocolGame, &g_game)); g_lua.bindClassStaticFunction("g_game", "getProtocolGame", std::bind(&Game::getProtocolGame, &g_game));
g_lua.bindClassStaticFunction("g_game", "getProtocolVersion", std::bind(&Game::getProtocolVersion, &g_game)); g_lua.bindClassStaticFunction("g_game", "getProtocolVersion", std::bind(&Game::getProtocolVersion, &g_game));
g_lua.bindClassStaticFunction("g_game", "getCharacterName", std::bind(&Game::getCharacterName, &g_game));
g_lua.bindClassStaticFunction("g_game", "getWorldName", std::bind(&Game::getWorldName, &g_game)); g_lua.bindClassStaticFunction("g_game", "getWorldName", std::bind(&Game::getWorldName, &g_game));
g_lua.bindClassStaticFunction("g_game", "getGMActions", std::bind(&Game::getGMActions, &g_game)); g_lua.bindClassStaticFunction("g_game", "getGMActions", std::bind(&Game::getGMActions, &g_game));

Loading…
Cancel
Save