mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Refactor modules, closes #223
* All modules are sandboxed now * All images,sounds,fonts,translations and styles were moved to "data" folder * Reorganize image files folders * Remove unmaintained modules: client_particles, client_shaders * Implement new automatic way to load styles and fonts * Add hide/show offline option in VipList * Add invite/exclude to/from private channel in players menus * Many other minor changes
This commit is contained in:
@@ -26,7 +26,7 @@ arrowKeys = {
|
||||
}
|
||||
|
||||
function init()
|
||||
g_ui.importStyle('styles/countwindow.otui')
|
||||
g_ui.importStyle('styles/countwindow')
|
||||
|
||||
connect(g_game, {
|
||||
onGameStart = onGameStart,
|
||||
@@ -34,7 +34,7 @@ function init()
|
||||
onLoginAdvice = onLoginAdvice
|
||||
}, true)
|
||||
|
||||
gameRootPanel = g_ui.displayUI('gameinterface.otui')
|
||||
gameRootPanel = g_ui.displayUI('gameinterface')
|
||||
gameRootPanel:hide()
|
||||
gameRootPanel:lower()
|
||||
gameRootPanel.onGeometryChange = updateStretchShrink
|
||||
@@ -49,7 +49,7 @@ function init()
|
||||
gameBottomPanel = gameRootPanel:getChildById('gameBottomPanel')
|
||||
connect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
|
||||
|
||||
logoutButton = TopMenu.addLeftButton('logoutButton', 'Logout', '/images/logout.png', tryLogout, true)
|
||||
logoutButton = modules.client_topmenu.addLeftButton('logoutButton', 'Logout', '/images/topbuttons/logout', tryLogout, true)
|
||||
|
||||
bindKeys()
|
||||
|
||||
@@ -125,7 +125,7 @@ end
|
||||
|
||||
function show()
|
||||
connect(g_app, { onClose = tryExit })
|
||||
Background.hide()
|
||||
modules.client_background.hide()
|
||||
gameRootPanel:show()
|
||||
gameRootPanel:focus()
|
||||
gameMapPanel:followCreature(g_game.getLocalPlayer())
|
||||
@@ -147,7 +147,7 @@ function hide()
|
||||
countWindow = nil
|
||||
end
|
||||
gameRootPanel:hide()
|
||||
Background.show()
|
||||
modules.client_background.show()
|
||||
end
|
||||
|
||||
function onLoginAdvice(message)
|
||||
@@ -230,7 +230,7 @@ function smartWalk(defaultDir)
|
||||
end
|
||||
|
||||
local dir = defaultDir
|
||||
if Options.getOption('smartWalk') then
|
||||
if modules.client_options.getOption('smartWalk') then
|
||||
if g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Left') then
|
||||
dir = NorthWest
|
||||
elseif g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Right') then
|
||||
@@ -242,7 +242,7 @@ function smartWalk(defaultDir)
|
||||
end
|
||||
end
|
||||
|
||||
if Options.getOption('walkBooster') then
|
||||
if modules.client_options.getOption('walkBooster') then
|
||||
if g_game.getLocalPlayer():canWalk(dir) then
|
||||
g_game.walk(dir)
|
||||
else
|
||||
@@ -259,7 +259,7 @@ function smartWalk(defaultDir)
|
||||
end
|
||||
|
||||
function updateStretchShrink()
|
||||
if Options.getOption('dontStretchShrink') then
|
||||
if modules.client_options.getOption('dontStretchShrink') then
|
||||
gameMapPanel:setKeepAspectRatio(true)
|
||||
gameMapPanel:setVisibleDimension({ width = 15, height = 11 })
|
||||
|
||||
@@ -475,7 +475,7 @@ end
|
||||
function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, useThing, creatureThing)
|
||||
local keyboardModifiers = g_keyboard.getModifiers()
|
||||
|
||||
if not Options.getOption('classicControl') then
|
||||
if not modules.client_options.getOption('classicControl') then
|
||||
if keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
|
||||
createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
||||
return true
|
||||
|
@@ -1,17 +1,17 @@
|
||||
|
||||
GameSidePanel < UIMiniWindowContainer
|
||||
image-source: /images/sidepanel.png
|
||||
image-source: /images/ui/panel_side
|
||||
image-border: 4
|
||||
padding: 4
|
||||
width: 198
|
||||
|
||||
GameBottomPanel < Panel
|
||||
image-source: /images/bottompanel.png
|
||||
image-source: /images/ui/panel_bottom
|
||||
image-border: 4
|
||||
|
||||
GameMapPanel < UIGameMap
|
||||
padding: 4
|
||||
image-source: /images/mappanel.png
|
||||
image-source: /images/ui/panel_map
|
||||
image-border: 4
|
||||
|
||||
UIWidget
|
||||
@@ -63,7 +63,7 @@ UIWidget
|
||||
anchors.bottom: parent.bottom
|
||||
relative-margin: bottom
|
||||
margin-bottom: 172
|
||||
@canUpdateMargin: function(self, newMargin) if Options.getOption('dontStretchShrink') then return self:getMarginBottom() end return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 100) end
|
||||
@canUpdateMargin: function(self, newMargin) if modules.client_options.getOption('dontStretchShrink') then return self:getMarginBottom() end return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 100) end
|
||||
@onGeometryChange: function(self) self:setMarginBottom(math.min(math.max(self:getParent():getHeight() - 300, 100), self:getMarginBottom())) end
|
||||
|
||||
UIWidget
|
||||
|
@@ -4,7 +4,7 @@ Module
|
||||
author: OTClient team
|
||||
website: www.otclient.info
|
||||
sandboxed: true
|
||||
scripts: [ widgets/uigamemap.lua, widgets/uiitem.lua, gameinterface.lua ]
|
||||
scripts: [ widgets/uigamemap, widgets/uiitem, gameinterface ]
|
||||
load-later:
|
||||
- game_hotkeys
|
||||
- game_questlog
|
||||
@@ -24,7 +24,6 @@ Module
|
||||
- game_playertrade
|
||||
- game_ruleviolation
|
||||
- game_bugreport
|
||||
- game_shaders
|
||||
- game_playerdeath
|
||||
- game_playermount
|
||||
- game_market
|
||||
|
@@ -80,7 +80,7 @@ function UIItem:onMouseRelease(mousePosition, mouseButton)
|
||||
local item = self:getItem()
|
||||
if not item or not self:containsPoint(mousePosition) then return false end
|
||||
|
||||
if Options.getOption('classicControl') and
|
||||
if modules.client_options.getOption('classicControl') and
|
||||
((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) or
|
||||
(g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then
|
||||
g_game.look(item)
|
||||
|
Reference in New Issue
Block a user