mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
reorganize modules
This commit is contained in:
@@ -3,7 +3,11 @@ Module
|
||||
description: Console for executing lua functions
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
// console can be loaded after core
|
||||
autoLoad: true
|
||||
autoLoadPriority: 20
|
||||
|
||||
dependencies:
|
||||
- core
|
||||
|
1
modules/addon_playground/playground.lua
Normal file
1
modules/addon_playground/playground.lua
Normal file
@@ -0,0 +1 @@
|
||||
-- place any code for testing purposes here
|
@@ -1,9 +1,6 @@
|
||||
Module
|
||||
name: playground
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- core
|
||||
|
||||
onLoad: |
|
||||
require 'playground'
|
||||
return true
|
@@ -1,13 +1,13 @@
|
||||
OTClient = { }
|
||||
Client = { }
|
||||
|
||||
-- TODO: load and save configurations
|
||||
function OTClient.init()
|
||||
function Client.init()
|
||||
g_window.move({ x=220, y=220 })
|
||||
g_window.resize({ width=800, height=600 })
|
||||
g_window.setTitle('OTClient')
|
||||
g_window.setIcon('otcicon.png')
|
||||
g_window.setIcon('clienticon.png')
|
||||
return true
|
||||
end
|
||||
|
||||
function OTClient.terminate()
|
||||
function Client.terminate()
|
||||
end
|
22
modules/client/client.otmod
Normal file
22
modules/client/client.otmod
Normal file
@@ -0,0 +1,22 @@
|
||||
Module
|
||||
name: client
|
||||
description: Load all other otclient dependecies
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
// NOTE: order does matter
|
||||
dependencies:
|
||||
- client_background
|
||||
- client_topmenu
|
||||
- client_tibiafiles
|
||||
- client_about
|
||||
- client_options
|
||||
- client_entergame
|
||||
- game
|
||||
|
||||
onLoad: |
|
||||
require 'client'
|
||||
return Client.init()
|
||||
|
||||
onUnload: |
|
||||
Client.terminate()
|
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 518 B |
@@ -1,16 +1,16 @@
|
||||
About = {}
|
||||
|
||||
-- private variables
|
||||
local about
|
||||
local aboutWindow
|
||||
|
||||
-- public functions
|
||||
function About.create()
|
||||
about = UI.display('about.otui', { locked = true })
|
||||
aboutWindow = UI.display('about.otui', { locked = true })
|
||||
end
|
||||
|
||||
function About.destroy()
|
||||
about:destroy()
|
||||
about = nil
|
||||
aboutWindow:destroy()
|
||||
aboutWindow = nil
|
||||
end
|
||||
|
||||
function About.openWebpage()
|
@@ -1,10 +1,8 @@
|
||||
Module
|
||||
name: about
|
||||
name: client_about
|
||||
description: Create the about window
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
dependencies:
|
||||
- core
|
||||
|
||||
onLoad: |
|
||||
require 'about'
|
@@ -1,10 +1,8 @@
|
||||
Module
|
||||
name: background
|
||||
name: client_background
|
||||
description: Handles the background of the login screen
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
dependencies:
|
||||
- core
|
||||
|
||||
onLoad: |
|
||||
require 'background'
|
@@ -1,7 +1,7 @@
|
||||
Panel
|
||||
id: background
|
||||
image:
|
||||
source: /background/background.png
|
||||
source: /client_background/background.png
|
||||
smooth: true
|
||||
fixed ratio: true
|
||||
anchors.top: topMenu.bottom
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
@@ -1,8 +1,9 @@
|
||||
Module
|
||||
name: entergame
|
||||
name: client_entergame
|
||||
description: Manages enter game and character list windows
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
onLoad: |
|
||||
require 'entergame'
|
||||
require 'characterlist'
|
@@ -1,8 +1,9 @@
|
||||
Module
|
||||
name: options
|
||||
name: client_options
|
||||
description: Create the options window
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
onLoad: |
|
||||
require 'options'
|
||||
return true
|
1
modules/client_tibiafiles
Submodule
1
modules/client_tibiafiles
Submodule
Submodule modules/client_tibiafiles added at e76fa2786e
@@ -15,4 +15,4 @@ end
|
||||
|
||||
function TopMenu.getButton(id)
|
||||
return topMenu:getChildById(id)
|
||||
end
|
||||
end
|
@@ -1,13 +1,8 @@
|
||||
Module
|
||||
name: topmenu
|
||||
name: client_topmenu
|
||||
description: Create the top menu
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
dependencies:
|
||||
- core
|
||||
- entergame
|
||||
- options
|
||||
- about
|
||||
|
||||
onLoad: |
|
||||
require 'topmenu'
|
||||
@@ -16,4 +11,3 @@ Module
|
||||
|
||||
onUnload: |
|
||||
TopMenu.destroy()
|
||||
|
@@ -3,19 +3,15 @@ Module
|
||||
description: Contains lua classes, functions and constants used by other modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
// core must be loaded before other modules
|
||||
autoLoad: true
|
||||
autoLoadPriority: 10
|
||||
|
||||
// NOTE: order does matter
|
||||
dependencies:
|
||||
- core_fonts
|
||||
- core_styles
|
||||
|
||||
onLoad: |
|
||||
require 'ext/table'
|
||||
require 'ext/string'
|
||||
require 'constants'
|
||||
require 'util'
|
||||
require 'dispatcher'
|
||||
require 'widget'
|
||||
require 'ui'
|
||||
require 'gfx'
|
||||
return true
|
||||
- core_scripts
|
||||
- core_widgets
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 9.7 KiB |
16
modules/core_scripts/core_scripts.otmod
Normal file
16
modules/core_scripts/core_scripts.otmod
Normal file
@@ -0,0 +1,16 @@
|
||||
Module
|
||||
name: core_scripts
|
||||
description: Contains core lua classes, functions and constants used by other modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
onLoad: |
|
||||
require 'ext/table'
|
||||
require 'ext/string'
|
||||
require 'constants'
|
||||
require 'util'
|
||||
require 'dispatcher'
|
||||
require 'widget'
|
||||
require 'ui'
|
||||
require 'gfx'
|
||||
return true
|
@@ -12,14 +12,18 @@ function createEnvironment()
|
||||
return env
|
||||
end
|
||||
|
||||
function connect(object, signalsAndSlots)
|
||||
function connect(object, signalsAndSlots, pushFront)
|
||||
for signal,slot in pairs(signalsAndSlots) do
|
||||
if not object[signal] then
|
||||
object[signal] = slot
|
||||
elseif type(object[signal]) == 'function' then
|
||||
object[signal] = { object[signal], slot }
|
||||
elseif type(object[signal]) == 'table' then
|
||||
table.insert(object[signal], #object[signal]+1, slot)
|
||||
if pushFront then
|
||||
table.insert(object[signal], 1, slot)
|
||||
else
|
||||
table.insert(object[signal], #object[signal]+1, slot)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@@ -3,8 +3,7 @@ Module
|
||||
description: Contains ui styles used by other modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
dependencies:
|
||||
- core_fonts
|
||||
|
||||
onLoad: |
|
||||
importStyles 'styles/buttons.otui'
|
||||
importStyles 'styles/labels.otui'
|
||||
@@ -17,4 +16,3 @@ Module
|
||||
importStyles 'styles/items.otui'
|
||||
importStyles 'styles/creatures.otui'
|
||||
return true
|
||||
|
||||
|
10
modules/core_widgets/core_widgets.otmod
Normal file
10
modules/core_widgets/core_widgets.otmod
Normal file
@@ -0,0 +1,10 @@
|
||||
Module
|
||||
name: core_widgets
|
||||
description: Contains widgets used by other modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
onLoad: |
|
||||
require 'tooltip/tooltip'
|
||||
require 'messagebox/messagebox'
|
||||
return true
|
@@ -16,7 +16,7 @@ end
|
||||
function Game.createInterface()
|
||||
Background.hide()
|
||||
CharacterList.destroyLoadBox()
|
||||
Game.gameUi = UI.display('/game/game.otui')
|
||||
Game.gameUi = UI.display('game.otui')
|
||||
UI.root:moveChildToIndex(Game.gameUi, 1)
|
||||
Game.gameMapPanel = Game.gameUi:getChildById('mapPanel')
|
||||
Game.gameRightPanel = Game.gameUi:getChildById('rightPanel')
|
||||
@@ -56,5 +56,5 @@ function Game.onConnectionError(message)
|
||||
errorBox.onOk = CharacterList.show
|
||||
end
|
||||
|
||||
connect(Game, { onLogin = Game.createInterface,
|
||||
onLogout = Game.destroyInterface })
|
||||
connect(Game, { onLogin = Game.createInterface }, true)
|
||||
connect(Game, { onLogout = Game.destroyInterface })
|
||||
|
@@ -3,6 +3,16 @@ Module
|
||||
description: Create the game interface, where the ingame stuff starts
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
dependencies:
|
||||
- game_healthbar
|
||||
- game_inventory
|
||||
- game_skills
|
||||
- game_textmessage
|
||||
- game_viplist
|
||||
- game_chat
|
||||
- game_outfit
|
||||
|
||||
onLoad: |
|
||||
require 'game'
|
||||
return true
|
||||
return true
|
@@ -1,5 +1,5 @@
|
||||
Module
|
||||
name: chat
|
||||
name: game_chat
|
||||
description: Manage chat window
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
@@ -1,11 +1,11 @@
|
||||
HealthMana = {}
|
||||
HealthBar = {}
|
||||
|
||||
-- private variables
|
||||
local healthManaPanel = nil
|
||||
|
||||
-- public functions
|
||||
function HealthMana.create()
|
||||
healthManaPanel = UI.display('health_mana.otui', { parent = Game.gameRightPanel })
|
||||
function HealthBar.create()
|
||||
healthManaPanel = UI.display('healthbar.otui', { parent = Game.gameRightPanel })
|
||||
|
||||
local healthBar = UIProgressBar.create()
|
||||
healthManaPanel:addChild(healthBar)
|
||||
@@ -32,7 +32,7 @@ function HealthMana.create()
|
||||
healthManaPanel:setHeight(healthBar:getHeight() + manaBar:getHeight() + 4)
|
||||
end
|
||||
|
||||
function HealthMana.destroy()
|
||||
function HealthBar.destroy()
|
||||
healthManaPanel:destroy()
|
||||
healthManaPanel = nil
|
||||
end
|
||||
@@ -61,5 +61,5 @@ function Game.onManaChange(mana, maxMana)
|
||||
manaBar:setPercent(percent)
|
||||
end
|
||||
|
||||
connect(Game, { onLogin = HealthMana.create,
|
||||
onLogout = HealthMana.destroy })
|
||||
connect(Game, { onLogin = HealthBar.create,
|
||||
onLogout = HealthBar.destroy })
|
@@ -1,10 +1,10 @@
|
||||
Module
|
||||
name: health_mana
|
||||
name: game_healthbar
|
||||
description: Displays health and mana points
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
require 'health_mana'
|
||||
require 'healthbar'
|
||||
return true
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
Module
|
||||
name: inventory
|
||||
name: game_inventory
|
||||
description: View local player equipments window
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
@@ -1,5 +1,5 @@
|
||||
Module
|
||||
name: outfit
|
||||
name: game_outfit
|
||||
description: Change local player outfit
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
@@ -1,5 +1,5 @@
|
||||
Module
|
||||
name: skills
|
||||
name: game_skills
|
||||
description: Manage skills window
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
@@ -1,7 +1,7 @@
|
||||
TextMessage = {}
|
||||
|
||||
-- require styles
|
||||
importStyles '/textmessage/textmessage.otui'
|
||||
importStyles 'textmessage.otui'
|
||||
|
||||
-- private variables
|
||||
local bottomLabelWidget, centerLabelWidget
|
@@ -1,5 +1,5 @@
|
||||
Module
|
||||
name: textmessage
|
||||
name: game_textmessage
|
||||
description: Manage game text messages
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
@@ -1,5 +1,5 @@
|
||||
Module
|
||||
name: viplist
|
||||
name: game_viplist
|
||||
description: Manage vip list window
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
@@ -1,12 +0,0 @@
|
||||
Module
|
||||
name: messagebox
|
||||
description: Manages message boxes
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- core
|
||||
|
||||
onLoad: |
|
||||
require 'messagebox'
|
||||
return true
|
@@ -1,27 +0,0 @@
|
||||
Module
|
||||
name: otclient
|
||||
description: Load all other otclient modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoLoad: true
|
||||
autoLoadPriority: 10
|
||||
dependencies:
|
||||
- core
|
||||
- background
|
||||
- topmenu
|
||||
- game
|
||||
- health_mana
|
||||
- inventory
|
||||
- skills
|
||||
- viplist
|
||||
- textmessage
|
||||
- chat
|
||||
- outfit
|
||||
- tibiafiles
|
||||
|
||||
onLoad: |
|
||||
require 'otclient'
|
||||
return OTClient.init()
|
||||
|
||||
onUnload: |
|
||||
OTClient.terminate()
|
@@ -1,24 +0,0 @@
|
||||
-- place any code for testing purposes here
|
||||
|
||||
function UIItem.onMouseRelease(self, mousePos, mouseButton)
|
||||
if mouseButton ~= MouseRightButton then return end
|
||||
local top = self:getY()
|
||||
local bottom = self:getY() + self:getHeight()
|
||||
local left = self:getX()
|
||||
local right = self:getX() + self:getWidth()
|
||||
if not (mousePos.y >= top and mousePos.y <= bottom and mousePos.x >= left and mousePos.x <= right) then return end
|
||||
|
||||
local menuFile = self:getStyle()['popup menu']
|
||||
if not menuFile then return end
|
||||
|
||||
local popupMenu = UI.display(menuFile)
|
||||
if not popupMenu then return end
|
||||
|
||||
popupMenu:moveTo(mousePos)
|
||||
popupMenu.onMouseRelease = function(self) self:destroy() end
|
||||
end
|
||||
|
||||
local function init()
|
||||
end
|
||||
|
||||
addEvent(init)
|
Submodule modules/tibiafiles deleted from 8bb3b7d6d8
@@ -1,13 +0,0 @@
|
||||
Module
|
||||
name: tooltip
|
||||
description: Enable tooltips on any button
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoLoad: true
|
||||
autoLoadPriority: 2
|
||||
dependencies:
|
||||
- core
|
||||
|
||||
onLoad: |
|
||||
require 'tooltip'
|
||||
return true
|
Reference in New Issue
Block a user