Skip to content

Commit

Permalink
fix: clean cache + Change language in options
Browse files Browse the repository at this point in the history
  • Loading branch information
InnerCircleTFS authored Dec 10, 2024
1 parent db94fde commit ca56936
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 34 deletions.
3 changes: 3 additions & 0 deletions modules/client_bottommenu/bottommenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ function init()
boss2:setImageSource(randomItem.creature2)
boss2:setVisible(true)
end
if g_game.isOnline() then
hide()
end
end

function terminate()
Expand Down
21 changes: 18 additions & 3 deletions modules/client_options/styles/misc/help.otui
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ UIWidget
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
height: 33
height: 55
margin-top: 5

QtButton
Expand All @@ -40,5 +40,20 @@ UIWidget
margin-right: 10
anchors.left: parent.left
anchors.top: parent.top
@onClick: g_platform.openUrl("https://github.com/mehah/otclient/wiki")

@onClick: |
g_settings.clear()
controller:scheduleEvent(function()
g_app.restart()
end, 1000)
QtButton
!text: tr('Change language')
size: 130 20
margin-top: 5
anchors.top: prev.bottom
anchors.left: parent.left
@onClick: |
if g_game.isOnline() then
g_logger.warning("To prevent errors, change the language while offline." )
else
modules.client_locales.createWindow()
end
48 changes: 23 additions & 25 deletions modules/client_topmenu/topmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,32 +152,30 @@ function online()
pingImg:hide()
end
end
if PingWidget then
return
end
PingWidget = g_ui.loadUI("pingFps", modules.game_interface.getMapPanel())
MainPingPanel = g_ui.createWidget("testPingPanel", PingWidget:getChildByIndex(1))
MainPingPanel.setId(MainPingPanel, "ping")
pingImg = MainPingPanel.getChildByIndex(MainPingPanel, 1)
pingPanel = MainPingPanel.getChildByIndex(MainPingPanel, 2)
if modules.client_options.getOption('showPing') then
pingImg:setVisible(true)
pingPanel:setVisible(true)
else
pingImg:setVisible(false)
pingPanel:setVisible(true)
end
mainFpsPanel = g_ui.createWidget("testPingPanel", PingWidget:getChildByIndex(2))
mainFpsPanel.setId(mainFpsPanel, "fps")
fpsPanel2 = mainFpsPanel.getChildByIndex(mainFpsPanel, 2)
if modules.client_options.getOption('showFps') then
fpsPanel2:setVisible(true)
else
fpsPanel2:setVisible(false)
end
end)
if PingWidget then
return
end

PingWidget = g_ui.loadUI("pingFps", modules.game_interface.getMapPanel())

MainPingPanel = g_ui.createWidget("testPingPanel", PingWidget:getChildByIndex(1))
MainPingPanel.setId(MainPingPanel, "ping")
pingImg = MainPingPanel.getChildByIndex(MainPingPanel, 1)
pingPanel = MainPingPanel.getChildByIndex(MainPingPanel, 2)
if modules.client_options.getOption('showPing') then
pingImg:setVisible(true)
pingPanel:setVisible(true)
else
pingImg:setVisible(false)
pingPanel:setVisible(true)
end
mainFpsPanel = g_ui.createWidget("testPingPanel", PingWidget:getChildByIndex(2))
mainFpsPanel.setId(mainFpsPanel, "fps")
fpsPanel2 = mainFpsPanel.getChildByIndex(mainFpsPanel, 2)
if modules.client_options.getOption('showFps') then
fpsPanel2:setVisible(true)
else
fpsPanel2:setVisible(false)
end
end

function offline()
Expand Down
1 change: 1 addition & 0 deletions modules/game_healthcircle/game_healthcircle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function terminate()
disconnect(g_game, {
onGameStart = setPlayerValues
})
statsBarMenuLoaded = false
end

-------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions modules/game_textmessage/textmessage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ function displayMessage(mode, text)
if msgtype == MessageSettings.loot then
local coloredText = ItemsDatabase.setColorLootMessage(text)
label:setColoredText(coloredText)
local console = modules.game_console
local consoleBuffer = console.consoleTabBar:getTabPanel(console.getTab("Server Log")):getChildById('consoleBuffer')
consoleBuffer:getLastChild():setColoredText(coloredText)
local getTabServerLog = modules.game_console.consoleTabBar:getTabPanel(modules.game_console.getTab("Server Log"))
if getTabServerLog then
getTabServerLog:getChildById('consoleBuffer'):getLastChild():setColoredText(coloredText)
end
else
label:setText(text)
label:setColor(msgtype.color)
Expand Down
2 changes: 1 addition & 1 deletion modules/game_viplist/addgroup.otui
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MainWindow
text-offset: 0 1
@onEnter: modules.game_viplist.addGroup()
@onEscape: |
self:getParent():destroy()
self:destroy()
modules.game_viplist.addGroupWindow = nil

Label
Expand Down
2 changes: 1 addition & 1 deletion src/framework/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool Config::save()
return m_confsDoc->save(m_fileName);
}

void Config::clear() const
void Config::clear()
{
m_confsDoc->clear();
}
Expand Down
2 changes: 1 addition & 1 deletion src/framework/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Config : public LuaObject
bool load(const std::string& file);
bool unload();
bool save();
void clear() const;
void clear();
void setValue(const std::string& key, const std::string& value);
void setList(const std::string& key, const std::vector<std::string>& list);
std::string getValue(const std::string& key);
Expand Down
1 change: 1 addition & 0 deletions src/framework/luafunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<Config>("getOrCreateNode", &Config::getOrCreateNode);
g_lua.bindClassMemberFunction<Config>("mergeNode", &Config::mergeNode);
g_lua.bindClassMemberFunction<Config>("getFileName", &Config::getFileName);
g_lua.bindClassMemberFunction<Config>("clear", &Config::clear);

// Module
g_lua.registerClass<Module>();
Expand Down

0 comments on commit ca56936

Please sign in to comment.