many modules fixes

master
Eduardo Bart 12 years ago
parent cfa7db77da
commit 296f2a17c4

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

@ -118,7 +118,7 @@ locale = {
["Pass Leadership to %s"] = "Pasar el liderazgo a %s",
["Password"] = "Contraseña",
["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",
["Port"] = "Puerto",
["Price:"] = "Precio",
@ -137,7 +137,7 @@ locale = {
["Select object"] = "Seleccionar objeto",
["Select Outfit"] = "Selecionar Traje",
["Sell"] = "Vender",
["Send automatically"] = "Vender automáticamente",
["Send automatically"] = "Enviar automáticamente",
["Server"] = "Servidor",
["Server Log"] = "Registro del servidor",
["Set Outfit"] = "Escoger Traje",

@ -150,7 +150,7 @@ locale = {
["Pass Leadership to %s"] = "Passar liderança para %s",
["Password"] = "Senha",
["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 wait"] = "Por favor, espere",
["Port"] = "Porta",
@ -174,7 +174,7 @@ locale = {
["Select Outfit"] = "Selecionar Roupa",
["Sell"] = "Vender",
["Send"] = "Enviar",
["Send automatically"] = "Vender automaticamente",
["Send automatically"] = "Enviar automaticamente",
["Server"] = "Servidor",
["Server Log"] = "Registro do servidor",
["Set Outfit"] = "Escolher Roupa",

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

@ -386,7 +386,7 @@ function Console.popupMenu(mousePos, mouseButton, creatureName, text)
if mouseButton == MouseRightButton then
local menu = createWidget('PopupMenu')
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('Add to VIP list'), function () g_game.addVip(creatureName) end) --TODO not show if creature already in vip
-- TODO ignore creatureName
@ -492,7 +492,7 @@ function Console.sendCurrentMessage()
g_game.talkPrivate(speaktype.speakType, name, 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

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

@ -70,7 +70,7 @@ void ModuleManager::discoverModulesPath()
for(const std::string& dir : possibleModulesDirs) {
// try to add module directory
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;
break;
}
@ -88,7 +88,7 @@ void ModuleManager::discoverModulesPath()
for(const std::string& dir : possibleAddonsDirs) {
// try to add module directory
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;
break;
}

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

@ -43,11 +43,7 @@ Game::Game()
void Game::resetGameStates()
{
#ifdef BOT_PROTECTION
m_denyBotCall = true;
#else
m_denyBotCall = false;
#endif
m_dead = false;
m_serverBeat = 50;
m_canReportBugs = false;
@ -66,8 +62,6 @@ void Game::resetGameStates()
m_containers.clear();
m_vips.clear();
m_gmActions.clear();
m_worldName = "";
}
void Game::processConnectionError(const boost::system::error_code& error)
@ -133,6 +127,9 @@ void Game::processGameEnd()
// reset game state
resetGameStates();
m_worldName = "";
m_characterName = "";
// clean map creatures
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->login(account, password, worldHost, (uint16)worldPort, characterName);
m_characterName = characterName;
m_worldName = worldName;
}
@ -1024,12 +1022,14 @@ void Game::mount(bool mount)
bool Game::checkBotProtection()
{
#ifdef BOT_PROTECTION
// 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(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"));
return false;
}
#endif
return true;
}

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

Loading…
Cancel
Save