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
@@ -32,59 +32,56 @@ EmblemBlue = 3
|
||||
function getSkullImagePath(skullId)
|
||||
local path
|
||||
if skullId == SkullYellow then
|
||||
path = 'icons/skull_yellow.png'
|
||||
path = '/images/game/skulls/skull_yellow'
|
||||
elseif skullId == SkullGreen then
|
||||
path = 'icons/skull_green.png'
|
||||
path = '/images/game/skulls/skull_green'
|
||||
elseif skullId == SkullWhite then
|
||||
path = 'icons/skull_white.png'
|
||||
path = '/images/game/skulls/skull_white'
|
||||
elseif skullId == SkullRed then
|
||||
path = 'icons/skull_red.png'
|
||||
path = '/images/game/skulls/skull_red'
|
||||
elseif skullId == SkullBlack then
|
||||
path = 'icons/skull_black.png'
|
||||
path = '/images/game/skulls/skull_black'
|
||||
elseif skullId == SkullOrange then
|
||||
path = 'icons/skull_orange.png'
|
||||
path = '/images/game/skulls/skull_orange'
|
||||
end
|
||||
path = resolvepath(path)
|
||||
return path
|
||||
end
|
||||
|
||||
function getShieldImagePathAndBlink(shieldId)
|
||||
local path, blink
|
||||
if shieldId == ShieldWhiteYellow then
|
||||
path, blink = 'icons/shield_yellow_white.png', false
|
||||
path, blink = '/images/game/shields/shield_yellow_white', false
|
||||
elseif shieldId == ShieldWhiteBlue then
|
||||
path, blink = 'icons/shield_blue_white.png', false
|
||||
path, blink = '/images/game/shields//shield_blue_white', false
|
||||
elseif shieldId == ShieldBlue then
|
||||
path, blink = 'icons/shield_blue.png', false
|
||||
path, blink = '/images/game/shields//shield_blue', false
|
||||
elseif shieldId == ShieldYellow then
|
||||
path, blink = 'icons/shield_yellow.png', false
|
||||
path, blink = '/images/game/shields//shield_yellow', false
|
||||
elseif shieldId == ShieldBlueSharedExp then
|
||||
path, blink = 'icons/shield_blue_shared.png', false
|
||||
path, blink = '/images/game/shields//shield_blue_shared', false
|
||||
elseif shieldId == ShieldYellowSharedExp then
|
||||
path, blink = 'icons/shield_yellow_shared.png', false
|
||||
path, blink = '/images/game/shields//shield_yellow_shared', false
|
||||
elseif shieldId == ShieldBlueNoSharedExpBlink then
|
||||
path, blink = 'icons/shield_blue_not_shared.png', true
|
||||
path, blink = '/images/game/shields//shield_blue_not_shared', true
|
||||
elseif shieldId == ShieldYellowNoSharedExpBlink then
|
||||
path, blink = 'icons/shield_yellow_not_shared.png', true
|
||||
path, blink = '/images/game/shields//shield_yellow_not_shared', true
|
||||
elseif shieldId == ShieldBlueNoSharedExp then
|
||||
path, blink = 'icons/shield_blue_not_shared.png', false
|
||||
path, blink = '/images/game/shields//shield_blue_not_shared', false
|
||||
elseif shieldId == ShieldYellowNoSharedExp then
|
||||
path, blink = 'icons/shield_yellow_not_shared.png', false
|
||||
path, blink = '/images/game/shields//shield_yellow_not_shared', false
|
||||
end
|
||||
path = resolvepath(path)
|
||||
return path, blink
|
||||
end
|
||||
|
||||
function getEmblemImagePath(emblemId)
|
||||
local path
|
||||
if emblemId == EmblemGreen then
|
||||
path = 'icons/emblem_green.png'
|
||||
path = '/images/game/emblems/emblem_green'
|
||||
elseif emblemId == EmblemRed then
|
||||
path = 'icons/emblem_red.png'
|
||||
path = '/images/game/emblems/emblem_red'
|
||||
elseif emblemId == EmblemBlue then
|
||||
path = 'icons/emblem_blue.png'
|
||||
path = '/images/game/emblems/emblem_blue'
|
||||
end
|
||||
path = resolvepath(path)
|
||||
return path
|
||||
end
|
||||
|
||||
|
@@ -5,7 +5,6 @@ Module
|
||||
website: www.otclient.info
|
||||
|
||||
dependencies:
|
||||
- client_extended
|
||||
- game_tibiafiles
|
||||
|
||||
@onLoad: |
|
||||
|
Before Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 494 B |
Before Width: | Height: | Size: 407 B |
Before Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 438 B |
Before Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 421 B |
Before Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 437 B |
@@ -1,15 +1,23 @@
|
||||
local opcodeCallbacks = {}
|
||||
local extendedCallbacks = {}
|
||||
|
||||
function ProtocolGame:onOpcode(opcode, msg)
|
||||
for i, callback in pairs(opcodeCallbacks) do
|
||||
if i == opcode then
|
||||
callback(msg)
|
||||
callback(self, msg)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function ProtocolGame:onExtendedOpcode(opcode, buffer)
|
||||
local callback = extendedCallbacks[opcode]
|
||||
if callback then
|
||||
callback(self, opcode, buffer)
|
||||
end
|
||||
end
|
||||
|
||||
function ProtocolGame.registerOpcode(opcode, callback)
|
||||
if opcodeCallbacks[opcode] then
|
||||
error('opcode ' .. opcode .. ' already registered will be overriden')
|
||||
@@ -21,3 +29,31 @@ end
|
||||
function ProtocolGame.unregisterOpcode(opcode)
|
||||
opcodeCallbacks[opcode] = nil
|
||||
end
|
||||
|
||||
function ProtocolGame.registerExtendedOpcode(opcode, callback)
|
||||
if not callback or type(callback) ~= 'function' then
|
||||
error('Invalid callback.')
|
||||
end
|
||||
|
||||
if opcode < 0 or opcode > 255 then
|
||||
error('Invalid opcode. Range: 0-255')
|
||||
end
|
||||
|
||||
if extendedCallbacks[opcode] then
|
||||
error('Opcode is already taken.')
|
||||
end
|
||||
|
||||
extendedCallbacks[opcode] = callback
|
||||
end
|
||||
|
||||
function ProtocolGame.unregisterExtendedOpcode(opcode)
|
||||
if opcode < 0 or opcode > 255 then
|
||||
error('Invalid opcode. Range: 0-255')
|
||||
end
|
||||
|
||||
if not extendedCallbacks[opcode] then
|
||||
error('Opcode is not registered.')
|
||||
end
|
||||
|
||||
extendedCallbacks[opcode] = nil
|
||||
end
|
||||
|
@@ -2,12 +2,13 @@
|
||||
ProtocolLogin = extends(Protocol)
|
||||
|
||||
LoginServerError = 10
|
||||
LoginServerUpdate = 17
|
||||
LoginServerMotd = 20
|
||||
LoginServerUpdateNeeded = 30
|
||||
LoginServerCharacterList = 100
|
||||
LoginServerExtendedCharacterList = 101
|
||||
|
||||
function ProtocolLogin:login(host, port, accountName, accountPassword)
|
||||
function ProtocolLogin:login(host, port, accountName, accountPassword, locale)
|
||||
if string.len(host) == 0 or port == nil or port == 0 then
|
||||
signalcall(self.onError, self, tr("You must enter a valid server address and port."))
|
||||
return
|
||||
@@ -16,6 +17,7 @@ function ProtocolLogin:login(host, port, accountName, accountPassword)
|
||||
self.accountName = accountName
|
||||
self.accountPassword = accountPassword
|
||||
self.connectCallback = sendLoginPacket
|
||||
self.locale = locale
|
||||
|
||||
self:connect(host, port)
|
||||
end
|
||||
@@ -28,6 +30,16 @@ function ProtocolLogin:sendLoginPacket()
|
||||
local msg = OutputMessage.create()
|
||||
msg:addU8(ClientOpcodes.ClientEnterAccount)
|
||||
msg:addU16(g_game.getOs())
|
||||
|
||||
if g_game.getFeature(GameUpdater) then
|
||||
msg:addString(g_app.getOs())
|
||||
msg:addString(g_game.getUpdaterSignature())
|
||||
end
|
||||
|
||||
if g_game.getFeature(GameLoginLocale) then
|
||||
msg:addString(self.locale)
|
||||
end
|
||||
|
||||
msg:addU16(g_game.getProtocolVersion())
|
||||
|
||||
if g_game.getProtocolVersion() >= 971 then
|
||||
@@ -94,6 +106,9 @@ function ProtocolLogin:onRecv(msg)
|
||||
self:parseCharacterList(msg)
|
||||
elseif opcode == LoginServerExtendedCharacterList then
|
||||
self:parseExtendedCharacterList(msg)
|
||||
elseif opcode == LoginServerUpdate then
|
||||
local signature = msg:getString()
|
||||
signalcall(self.onUpdateNeeded, self, signature)
|
||||
else
|
||||
self:parseOpcode(opcode, msg)
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
SpelllistSettings = {
|
||||
['Default'] = {
|
||||
iconFile = 'icons.png',
|
||||
iconFile = 'defaultspells',
|
||||
iconSize = {width = 32, height = 32},
|
||||
spellListWidth = 210,
|
||||
spellWindowWidth = 550,
|
||||
@@ -9,7 +9,7 @@ SpelllistSettings = {
|
||||
},
|
||||
|
||||
['Sample'] = {
|
||||
iconFile = 'sample.png',
|
||||
iconFile = 'sample',
|
||||
iconSize = {width = 64, height = 64},
|
||||
spellIcons = {[1] = 'Wind Walk', [2] = 'Fire Breath', [3] = 'Moonglaives', [5] = 'Firefly', [4] = 'Critical Strike'},
|
||||
spellOrder = {'Critical Strike', 'Firefly', 'Fire Breath', 'Moonglaives', 'Wind Walk'}
|
||||
|